Package org.openbravo.service.system
Class SystemService
- java.lang.Object
-
- org.openbravo.service.system.SystemService
-
- All Implemented Interfaces:
OBProvidable
,OBSingleton
public class SystemService extends Object implements OBSingleton
Provides utility like services.- Author:
- Martin Taal
-
-
Constructor Summary
Constructors Constructor Description SystemService()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
deleteClient(Client client)
This process deletes a client from the database.static SystemService
getInstance()
org.apache.ddlutils.model.Database
getModelFromDatabase(org.apache.ddlutils.Platform platform)
Given a org.apache.ddlutils.Platform, builds a org.apache.ddlutils.model.Database after applying the exclude filtersorg.apache.ddlutils.model.Database
getModelFromDatabase(org.apache.ddlutils.Platform platform, boolean doPlSqlStandardization)
Given a org.apache.ddlutils.Platform, builds a org.apache.ddlutils.model.Database after applying the exclude filters.org.apache.ddlutils.Platform
getPlatform()
Returns a dbsourcemanager Platform objectboolean
hasChanged(Class<?>[] clzs, Date afterDate)
Returns true if for a certain class there are objects which have changed.void
killConnectionsAndSafeMode(Connection con)
Kills the active sessions for the current user and sets the System Admin role as the only one availableString
logValidationResult(org.apache.log4j.Logger log, SystemValidationResult result)
Deprecated.String
logValidationResult(org.apache.logging.log4j.Logger log, SystemValidationResult result)
Prints the validation result grouped by validation type to the log.void
resetSafeMode(Connection con)
Callend after killConnectionsAndSafeMode, it disables the restriction to log only with the System Administrator rolestatic void
setInstance(SystemService instance)
SystemValidationResult
validateDatabase(Module module, org.apache.ddlutils.model.Database database)
Validates the database for a specific module.SystemValidationResult
validateDatabase(Module module, org.apache.ddlutils.model.Database database, boolean validateAD)
Validates the database for a specific module.SystemValidationResult
validateModule(Module module, org.apache.ddlutils.model.Database database)
Validates a specific module, checks the javapackage, dependency on core etc.
-
-
-
Method Detail
-
getInstance
public static SystemService getInstance()
-
setInstance
public static void setInstance(SystemService instance)
-
hasChanged
public boolean hasChanged(Class<?>[] clzs, Date afterDate)
Returns true if for a certain class there are objects which have changed.- Parameters:
clzs
- the type of objects which are checkedafterDate
- the timestamp to check- Returns:
- true if there is an object in the database which changed since afterDate, false otherwise
-
validateModule
public SystemValidationResult validateModule(Module module, org.apache.ddlutils.model.Database database)
Validates a specific module, checks the javapackage, dependency on core etc. The database changes of the module are not checked. This is a separate task.- Parameters:
module
- the module to validatedatabase
- the database to read the dbschema from- Returns:
- the validation result
-
validateDatabase
public SystemValidationResult validateDatabase(Module module, org.apache.ddlutils.model.Database database)
Validates the database for a specific module.- Parameters:
module
- the module to validatedatabase
- the database to read the dbschema from- Returns:
- the validation result
-
validateDatabase
public SystemValidationResult validateDatabase(Module module, org.apache.ddlutils.model.Database database, boolean validateAD)
Validates the database for a specific module.- Parameters:
module
- the module to validatedatabase
- the database to read the dbschema fromvalidateAD
- a flag that determines if Application Dictionary checks should be done- Returns:
- the validation result
-
logValidationResult
public String logValidationResult(org.apache.logging.log4j.Logger log, SystemValidationResult result)
Prints the validation result grouped by validation type to the log.- Parameters:
log
- the log to which the validation result is printedresult
- the validation result containing both errors and warning- Returns:
- the errors are returned as a string
-
logValidationResult
@Deprecated public String logValidationResult(org.apache.log4j.Logger log, SystemValidationResult result)
Deprecated.Prints the validation result grouped by validation type to the log.- Parameters:
log
- the log to which the validation result is printedresult
- the validation result containing both errors and warning- Returns:
- the errors are returned as a string
-
deleteClient
public void deleteClient(Client client)
This process deletes a client from the database. During its execution, the Scheduler is stopped, and all sessions active for other users are cancelled- Parameters:
client
- The client to be deleted
-
resetSafeMode
public void resetSafeMode(Connection con)
Callend after killConnectionsAndSafeMode, it disables the restriction to log only with the System Administrator role- Parameters:
con
- Connection used to make the queries
-
killConnectionsAndSafeMode
public void killConnectionsAndSafeMode(Connection con)
Kills the active sessions for the current user and sets the System Admin role as the only one available- Parameters:
con
- the Connection used to execute the queries
-
getPlatform
public org.apache.ddlutils.Platform getPlatform()
Returns a dbsourcemanager Platform object- Returns:
- A Platform object built following the configuration set in the Openbravo.properties file
-
getModelFromDatabase
public org.apache.ddlutils.model.Database getModelFromDatabase(org.apache.ddlutils.Platform platform)
Given a org.apache.ddlutils.Platform, builds a org.apache.ddlutils.model.Database after applying the exclude filters
-
getModelFromDatabase
public org.apache.ddlutils.model.Database getModelFromDatabase(org.apache.ddlutils.Platform platform, boolean doPlSqlStandardization)
Given a org.apache.ddlutils.Platform, builds a org.apache.ddlutils.model.Database after applying the exclude filters. It is possible to specify whether the PLSQL code standardization should be done
-
-