@Override public long getNumberOfCommands(final QueryOptions options) throws SBonitaReadException { logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogBeforeMethod(this.getClass(), "getNumberOfCommands")); try { final long number = persistenceService.getNumberOfEntities(SCommand.class, options, null); logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogAfterMethod(this.getClass(), "getNumberOfCommands")); return number; } catch (final SBonitaReadException bre) { logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogOnExceptionMethod(this.getClass(), "getNumberOfCommands", bre)); throw new SBonitaReadException(bre); } }
@Override public List<STenant> searchTenants(final QueryOptions options) throws SBonitaReadException { if (isTraced) { logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogBeforeMethod(this.getClass(), "searchSTenants")); } final List<STenant> listsSTenants = platformPersistenceService.searchEntity(STenant.class, options, null); if (isTraced) { logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogAfterMethod(this.getClass(), "searchSTenants")); } return listsSTenants; }
private void logOnExceptionMethod(final TechnicalLogSeverity technicalLogSeverity, final String methodName, final Exception e) { if (logger.isLoggable(this.getClass(), technicalLogSeverity)) { logger.log(this.getClass(), technicalLogSeverity, LogUtil.getLogOnExceptionMethod(this.getClass(), methodName, e)); } }
@Override public void deleteTenant(final long tenantId) throws STenantDeletionException, STenantNotFoundException, SDeletingActivatedTenantException { if (isTraced) { logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogBeforeMethod(this.getClass(), LOG_DELETE_TENANT)); } final STenant tenant = getTenant(tenantId); if (tenant.getStatus().equals(STenant.ACTIVATED)) { throw new SDeletingActivatedTenantException(); } try { platformPersistenceService.delete(tenant); } catch (final SPersistenceException e) { if (isTraced) { logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogOnExceptionMethod(this.getClass(), LOG_DELETE_TENANT, e)); } throw new STenantDeletionException("Unable to delete the tenant : " + e.getMessage(), e); } }
private void logBeforeMethod(final TechnicalLogSeverity technicalLogSeverity, final String methodName) { if (logger.isLoggable(this.getClass(), technicalLogSeverity)) { logger.log(this.getClass(), technicalLogSeverity, LogUtil.getLogBeforeMethod(this.getClass(), methodName)); } }
private void logAfterMethod(final TechnicalLogSeverity technicalLogSeverity, final String methodName) { if (logger.isLoggable(this.getClass(), technicalLogSeverity)) { logger.log(this.getClass(), technicalLogSeverity, LogUtil.getLogAfterMethod(this.getClass(), methodName)); } }
protected void delete(final SCommand command, final SCommandLogBuilder logBuilder) throws SCommandDeletionException { final boolean isTraceEnable = logger.isLoggable(getClass(), TechnicalLogSeverity.TRACE); try { recorder.recordDelete(new DeleteRecord(command), COMMAND); if (isTraceEnable) { logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogAfterMethod(this.getClass(), "delete")); } log(command.getId(), SQueriableLog.STATUS_OK, logBuilder, "delete"); } catch (final SRecorderException re) { if (isTraceEnable) { logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogOnExceptionMethod(this.getClass(), "delete", re)); } log(command.getId(), SQueriableLog.STATUS_FAIL, logBuilder, "delete"); throw new SCommandDeletionException(re); } }
@Override public List<STenant> searchTenants(final QueryOptions options) throws SBonitaReadException { if (isTraced) { logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogBeforeMethod(this.getClass(), "searchSTenants")); } final List<STenant> listsSTenants = platformPersistenceService.searchEntity(STenant.class, options, null); if (isTraced) { logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogAfterMethod(this.getClass(), "searchSTenants")); } return listsSTenants; }
private void logOnExceptionMethod(final String methodName, final Exception e) { if (logger.isLoggable(this.getClass(), TechnicalLogSeverity.TRACE)) { logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogOnExceptionMethod(this.getClass(), methodName, e)); } }
@Override public void deleteTenant(final long tenantId) throws STenantDeletionException, STenantNotFoundException, SDeletingActivatedTenantException { if (isTraced) { logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogBeforeMethod(this.getClass(), LOG_DELETE_TENANT)); } final STenant tenant = getTenant(tenantId); if (tenant.getStatus().equals(STenant.ACTIVATED)) { throw new SDeletingActivatedTenantException(); } try { platformPersistenceService.delete(tenant); } catch (final SPersistenceException e) { if (isTraced) { logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogOnExceptionMethod(this.getClass(), LOG_DELETE_TENANT, e)); } throw new STenantDeletionException("Unable to delete the tenant : " + e.getMessage(), e); } }
private void logBeforeMethod(final String methodName) { if (logger.isLoggable(this.getClass(), TechnicalLogSeverity.TRACE)) { logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogBeforeMethod(this.getClass(), methodName)); } }
private void logAfterMethod(final String methodName) { if (logger.isLoggable(this.getClass(), TechnicalLogSeverity.TRACE)) { logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogAfterMethod(this.getClass(), methodName)); } }
protected void delete(final SCommand command, final SCommandLogBuilder logBuilder) throws SCommandDeletionException { final boolean isTraceEnable = logger.isLoggable(getClass(), TechnicalLogSeverity.TRACE); try { recorder.recordDelete(new DeleteRecord(command), COMMAND); if (isTraceEnable) { logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogAfterMethod(this.getClass(), "delete")); } log(command.getId(), SQueriableLog.STATUS_OK, logBuilder, "delete"); } catch (final SRecorderException re) { if (isTraceEnable) { logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogOnExceptionMethod(this.getClass(), "delete", re)); } log(command.getId(), SQueriableLog.STATUS_FAIL, logBuilder, "delete"); throw new SCommandDeletionException(re); } }
@Override public long getNumberOfCommands(final QueryOptions options) throws SBonitaReadException { logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogBeforeMethod(this.getClass(), "getNumberOfCommands")); try { final long number = persistenceService.getNumberOfEntities(SCommand.class, options, null); logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogAfterMethod(this.getClass(), "getNumberOfCommands")); return number; } catch (final SBonitaReadException bre) { logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogOnExceptionMethod(this.getClass(), "getNumberOfCommands", bre)); throw new SBonitaReadException(bre); } }
@Override public void setSessionDuration(final long duration) { if (logger.isLoggable(this.getClass(), TechnicalLogSeverity.TRACE)) { logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogBeforeMethod(this.getClass(), "setSessionDuration")); } if (duration <= 0) { throw new IllegalArgumentException("The duration must be greater then 0"); } sessionDuration = duration; if (logger.isLoggable(this.getClass(), TechnicalLogSeverity.TRACE)) { logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogAfterMethod(this.getClass(), "setSessionDuration")); } }
private void logOnExceptionMethod(final String username, final String methodName) { if (logger.isLoggable(this.getClass(), TechnicalLogSeverity.TRACE)) { logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogOnExceptionMethod(this.getClass(), methodName, "Invalid user : " + username)); } }
@Override public long createTenant(final STenant tenant) throws STenantCreationException, STenantAlreadyExistException { if (isTraced) { logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogBeforeMethod(this.getClass(), LOG_CREATE_TENANT)); } // check if the tenant already exists. If yes, throws TenantAlreadyExistException checkIfTenantAlreadyExists(tenant); // create the tenant try { recorder.recordInsert(new InsertRecord(tenant), TENANT); } catch (final SRecorderException e) { if (isTraced) { logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogOnExceptionMethod(this.getClass(), LOG_CREATE_TENANT, e)); } throw new STenantCreationException("Unable to insert the tenant row : " + e.getMessage(), e); } initializeTenant(tenant); return tenant.getId(); }
private void logBeforeMethod(final TechnicalLogSeverity technicalLogSeverity, final String methodName) { if (logger.isLoggable(this.getClass(), technicalLogSeverity)) { logger.log(this.getClass(), technicalLogSeverity, LogUtil.getLogBeforeMethod(this.getClass(), methodName)); } }
private void logAfterMethod(final TechnicalLogSeverity technicalLogSeverity, final String methodName) { if (logger.isLoggable(this.getClass(), technicalLogSeverity)) { logger.log(this.getClass(), technicalLogSeverity, LogUtil.getLogAfterMethod(this.getClass(), methodName)); } }
@Override public long getNumberOfTenants(final QueryOptions options) throws SBonitaReadException { if (isTraced) { logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogBeforeMethod(this.getClass(), "getNumberOfSTenant")); } try { final long number = platformPersistenceService.getNumberOfEntities(STenant.class, options, null); if (isTraced) { logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogAfterMethod(this.getClass(), "getNumberOfSTenant")); } return number; } catch (final SBonitaReadException bre) { if (isTraced) { logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogOnExceptionMethod(this.getClass(), "getNumberOfSTenant", bre)); } throw new SBonitaReadException(bre); } }