@Override public void updateTenant(final STenant tenant, final EntityUpdateDescriptor descriptor) throws STenantUpdateException { if (isTraced) { logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogBeforeMethod(this.getClass(), LOG_UPDATE_TENANT)); } final String tenantName = (String) descriptor.getFields().get(STenantUpdateBuilderFactory.NAME); if (tenantName != null) { try { if (getTenantByName(tenantName).getId() != tenant.getId()) { throw new STenantUpdateException("Unable to update the tenant with new name " + tenantName + " : it already exists."); } } catch (final STenantNotFoundException e) { // Ok } } try { recorder.recordUpdate(UpdateRecord.buildSetFields(tenant, descriptor), TENANT); if (isTraced) { logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogAfterMethod(this.getClass(), LOG_UPDATE_TENANT)); } } catch (final SRecorderException e) { if (isTraced) { logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogOnExceptionMethod(this.getClass(), LOG_UPDATE_TENANT, e)); } throw new STenantUpdateException("Problem while updating tenant: " + tenant, e); } }
@Override public void updateTenant(final STenant tenant, final EntityUpdateDescriptor descriptor) throws STenantUpdateException { if (isTraced) { logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogBeforeMethod(this.getClass(), LOG_UPDATE_TENANT)); } final String tenantName = (String) descriptor.getFields().get(STenantUpdateBuilderFactory.NAME); if (tenantName != null) { try { if (getTenantByName(tenantName).getId() != tenant.getId()) { throw new STenantUpdateException("Unable to update the tenant with new name " + tenantName + " : it already exists."); } } catch (final STenantNotFoundException e) { // Ok } } try { recorder.recordUpdate(UpdateRecord.buildSetFields(tenant, descriptor), TENANT); if (isTraced) { logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogAfterMethod(this.getClass(), LOG_UPDATE_TENANT)); } } catch (final SRecorderException e) { if (isTraced) { logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogOnExceptionMethod(this.getClass(), LOG_UPDATE_TENANT, e)); } throw new STenantUpdateException("Problem while updating tenant: " + tenant, e); } }