Interface Admin


public interface Admin
Interface for administrative actions. Use Admin.getInstance() to create an instance of this interface.
  • Method Details

    • getInstance

      static Admin getInstance()
      Get the Admin to make administrative actions on the server.
      Returns:
      an Admin object
    • stopServer

      void stopServer()
      Stop the @enterprise server
    • restartServer

      void restartServer()
      Restart the @enterprise server
    • generateFormClass

      void generateFormClass(FormType ft) throws Exception
      Generate the classes for the given form type.
      Throws:
      Exception
    • replaceHTML

      void replaceHTML(FormType ft, String htmlpage) throws Exception
      Regenerate a form. In case of HTML forms the second argument contains the HTML text for this form, in case of XHTML forms the second argument is ignored. The functions recreates the form classes and adds or drop fields to the form table if necessary. Note that the type of new form fields must be provided in the html text (attributes dbtype and dblength). NOTE: Import/Export functionality should be used instead of this method for transporting ALL aspects of form types.
      NOTE 2: The method MAY make an implicit commit of the database transaction, when an alter table statement is executed. Be careful using this method in one transaction with other database operations.
      Throws:
      Exception
    • changeIdOfFormType

      FormType changeIdOfFormType(FormType ft, String newid, boolean keep, PrintWriter pw) throws Exception
      Change the id of the passed formtype. Note: the current user must have ADMIN permissions to execute this function.
      Parameters:
      ft - the formtype which id shall be changed
      newid - the new id for the formtype
      keep - if true a copy of the original formtype will be made and kept in the system before changing the id
      pw - used to log information about the steps performed during this operation
      Returns:
      the formtype with the old id if keep was true else null
      Throws:
      Exception
    • serverInfo

      String serverInfo() throws Exception
      Print out the server information.
      Throws:
      Exception
    • executeTimer

      void executeTimer(String id) throws Exception
      Execute the timer with the given id
      Throws:
      Exception
    • refreshWorklistCacheOrgData

      void refreshWorklistCacheOrgData()
      Refresh the organizational data in the worklist cache
    • refreshWorklistCacheInstances

      void refreshWorklistCacheInstances()
      Refresh the activities in the worklist cache
    • initLogFile

      void initLogFile()
      Initialize the log file (start writing a new one)
    • viewLogFile

      String viewLogFile() throws IOException
      View the current log file
      Throws:
      IOException
    • isLoginAllowed

      boolean isLoginAllowed()
      Is login to @enterprise allowed?
    • logout

      void logout(String sessionId)
      Logout a user.
      Parameters:
      sessionId - the id of the user session.
    • getUserSessionId

      String getUserSessionId(String httpSessionId)
      Get the user session id from http-session id.
      Returns:
    • setLoginAllowed

      void setLoginAllowed(String nodeid, boolean allowed, String message) throws Exception
      Allow or deny the login on the given node.
      Parameters:
      nodeid - id of cluster node, ignored in non-cluster mode
      allowed - if true login is allowed
      message - a message for the users trying to login.
      Throws:
      Exception
    • setLoginAllowed

      void setLoginAllowed(String nodeid, boolean allowed, String message, int currentSessions, String successorNodeId) throws Exception
      Allow or deny the login on the given node.
      Throws:
      Exception
    • executeUpgrade

      String executeUpgrade() throws Exception
      Execute db-upgrades in @enterprise, if db-version is out-of-date.
      Throws:
      Exception
    • showClassLocation

      URL showClassLocation(String cl)
      Search the resource in the classpath.
    • createSysEvent

      void createSysEvent(String id, String description)
      Write a record to the system event log in the database.
      Parameters:
      id - an id
      description - description of the event
    • importXML

      String importXML(String resource) throws Exception
      Perform an XML-Import.
      Parameters:
      resource - a resource in the classpath
      Returns:
      the log information is returned
      Throws:
      Exception
    • installApplication

      String installApplication(String destdir, File source) throws Exception
      Method for installing an application.
      Parameters:
      destdir - destination directory
      source - the zip file containing the application
      Returns:
      log output of the install process (mainly from the import)
      Throws:
      Exception
    • fileImport

      String fileImport(File fs, String key) throws Exception
      Method for importing a text file into a database table.
      Parameters:
      fs - the file to import
      key - the key referencing the import description. This key has the following syntax: applid:descname The applid is the id of an application, an import description is searched in the classpath using the path applid/import.xml, the descname is the name of an import declaration in the file.
      Returns:
      log output of the import process
      Throws:
      Exception
    • exportXML

      String exportXML(String mainclass, String condition, List<Object> params, String clustername, String description, Set<String> skipclasses, OutputStream os, PrintWriter pw) throws Exception
      Perform an XML Export.
      Parameters:
      mainclass - export elements of this class
      condition - restriction for mainclass
      params - parameter of the condition
      clustername - refers to a cluster in SchemaDescription contains a list of classes to export
      description - description for export file
      skipclasses - do not export member of these classes
      os - write the export to this stream
      pw - write the log to this writer
      Returns:
      a name of the export file
      Throws:
      Exception
    • exportXML

      String exportXML(String mainclass, String condition, List<Object> params, String clustername, String description, Set<String> skipclasses, boolean mapusers, OutputStream os, PrintWriter pw) throws Exception
      Perform an XML Export.
      Parameters:
      mainclass - export elements of this class
      condition - restriction for mainclass
      params - parameter of the condition
      clustername - refers to a cluster in SchemaDescription contains a list of classes to export
      description - description for export file
      skipclasses - do not export member of these classes
      mapusers - map users tro sysadm
      os - write the export to this stream
      pw - write the log to this writer
      Returns:
      a name of the export file
      Throws:
      Exception
    • exportXML

      String exportXML(List<Exportable> objects, String clustername, String description, Set<String> skipclasses, OutputStream os, PrintWriter pw) throws Exception
      Perform an XML Export.
      Parameters:
      objects - a homogenous list of objects of an exportable class
      clustername - refers to a cluster in SchemaDescription contains a list of classes to export
      description - description for export file
      skipclasses - do not export member of these classes
      os - write the export to this stream
      pw - write the log to this writer
      Returns:
      a name of the export file
      Throws:
      Exception
    • getReferencedObjects

      List<Exportable> getReferencedObjects(Exportable e) throws Exception
      Returns the objects referenced by the given object, including the object itself. The functionality is similar to the XML-Export, where the export of an object contains all components of this object. For example, if the argument is a user, the method returns a list of user-role-relations, user-properties, etc. The method can be used to copy such an object with all its components.
      Parameters:
      e - an Exportable (User, Role, ProcessDefinition)
      Returns:
      a list of Exportables
      Throws:
      Exception
    • getServerURL

      String getServerURL()
      returns the url to the web server, the information is maintained in the server object in the administration. The context path is the actual deployment path.
      Returns:
      an url string, for example: http://hostname:port/wf/
    • getServerAdminURL

      String getServerAdminURL()
      returns the url to the admin connector of the web server, the information is maintained in the server object in the administration. The context path is taken from the configuration. If no separate admin connector has been specified, getServerURL() is returned.
      Returns:
      an url string, for example: http://hostname:port/wf/
    • reloadDBConnections

      void reloadDBConnections()
      Marks all Database Connections as old. Old connections are refreshed before binding them to a thread. Refreshing means to close the connection and to open a new one. Can be used to redistribute database connections among nodes of a clustered DBMS.
    • setFieldModes

      void setFieldModes(ProcessDefinition pd, String stepid, String formid, String subformids, Map<String,Short> modes)
      Set the field mode for a step in a process. The parameter subformids specifies the subform.
      Parameters:
      pd - the process definition object, mandatory
      stepid - the id of the step, mandatory
      formid - the id of the form, mandatory
      subformids - the key for subforms: If the modes of a subform are set, this parameter contains the subforms id(s) separated be a slash. Example: the form f has a subform g with id 1, g has a subform h with id 3, the parameter subformids should have the value "1/3" if setting the field values of form h. If the modes of a mainform are set the parameters is either "0" or may be null.
      modes - The modes map is a map of fieldnames and mode values. See the constants in WfEngine for the value range. The field names are either the java field names of the form class of the classname and id of the subform, separated by a space.
    • removeFieldModes

      void removeFieldModes(ProcessDefinition pd, String stepid, String formid, String subformids)
      Remove the field modes of a form in a process.
      Parameters:
      pd - the process definition object, mandatory
      stepid - the stepid, may be null
      formid - id of the form in the process, mandatory
      subformids - syntax as in setFieldModes, null means all form fields of the form (and step) are deleted.
    • addAdminLinks

      @Deprecated(since="10.0", forRemoval=true) void addAdminLinks(String name, Resource resource, Link[] actions)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use appl_id/admin_tasks_fragment.xml files for extending the admin interface.
      Add a group of links to the administration / admin tasks. If the name of the group is already there, the entries are replaced.
      Parameters:
      name - the name of the admin group
      resource - the resource to use for i18n
      actions - the admin actions to add
    • addToLogEntryTable

      void addToLogEntryTable(String formClassname)
      Adds the passed form class to the list of available classes for which objects the historic data may be listed using the according admin task in the Administration UI.
      Parameters:
      formClassname - the full qualified name of the class. Must be a class of type DMSForm, otherwise if will not be added and a log message will inform about this situation.
    • getMessageTemplate

      MessageTemplate getMessageTemplate(String id)
      Read the message template with the given id from the database. Subject and body replacement is performed by default!
      Parameters:
      id - id of a message template
      Returns:
      a message template
    • createMessageTemplate

      MessageTemplate createMessageTemplate()
      Create a new, empty message template. Please note that subject/body replacement is not performed by default!
    • sendToAdmin

      void sendToAdmin(String subject, String message)
      Send a message with mime-type text/plain to the system administrator.
      Parameters:
      subject - the subject
      message - the message
    • sendToAdmin

      void sendToAdmin(String subject, String message, MailSender.MailAction action)
      Send a message with mime-type text/plain to the system administrator.
      Parameters:
      subject - the subject
      message - the message
      action - the MailSender.MailAction, if null the configured setting of property "ep.mail.queue.usage" is taken