Package org.dspace.xmlworkflow
Class WorkflowUtils
- java.lang.Object
-
- org.dspace.app.util.Util
-
- org.dspace.xmlworkflow.WorkflowUtils
-
public class WorkflowUtils extends Util
Utility methods for the xml workflow- Author:
- Bram De Schouwer (bram.deschouwer at dot com), Kevin Van de Velde (kevin at atmire dot com), Ben Bosman (ben at atmire dot com), Mark Diggory (markd at atmire dot com)
-
-
Field Summary
Fields Modifier and Type Field Description protected static CollectionRoleServicecollectionRoleServiceprotected static ConfigurationServiceconfigurationServiceprotected static GroupServicegroupServicestatic org.apache.logging.log4j.Loggerloglog4j categoryprotected static XmlWorkflowFactoryxmlWorkflowFactory
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcreateCollectionWorkflowRole(Context context, Collection collection, String roleId, Group group)Creates a role for a collection by linking a group of epersons to a role IDstatic voiddeleteRoleGroup(Context context, Collection collection, String roleID)static Map<String,Role>getAllExternalRoles(Collection thisCollection)static Map<String,Role>getCollectionAndRepositoryRoles(Collection thisCollection)static Map<String,Role>getCollectionRoles(Collection thisCollection)static StringgetOriginalURL(javax.servlet.http.HttpServletRequest request)Get the original request URL.static StringgetRequestLogInfo(javax.servlet.http.HttpServletRequest request)Return a string for logging, containing useful information about the current request - the URL, the method and parameters.static GroupgetRoleGroup(Context context, Collection collection, Role role)static voidsendAlert(javax.servlet.http.HttpServletRequest request, Exception exception)Send an alert to the designated "alert recipient" - that is, when a database error or internal error occurs, this person is sent an e-mail with details.static voidstoreOriginalURL(javax.servlet.http.HttpServletRequest request)Put the original request URL into the request object as an attribute for later use.-
Methods inherited from class org.dspace.app.util.Util
differenceInSubmissionFields, encodeBitstreamName, encodeBitstreamName, formatFileSize, getBoolParameter, getControlledVocabulariesDisplayValueLocalized, getIntParameter, getIntParameters, getSourceVersion, getSubmitButton, getUUIDParameter, getUUIDParameters, nonBreakSpace, splitList
-
-
-
-
Field Detail
-
log
public static org.apache.logging.log4j.Logger log
log4j category
-
collectionRoleService
protected static final CollectionRoleService collectionRoleService
-
groupService
protected static final GroupService groupService
-
xmlWorkflowFactory
protected static final XmlWorkflowFactory xmlWorkflowFactory
-
configurationService
protected static final ConfigurationService configurationService
-
-
Method Detail
-
getRequestLogInfo
public static String getRequestLogInfo(javax.servlet.http.HttpServletRequest request)
Return a string for logging, containing useful information about the current request - the URL, the method and parameters.- Parameters:
request- the request object.- Returns:
- a multi-line string containing information about the request.
-
getOriginalURL
public static String getOriginalURL(javax.servlet.http.HttpServletRequest request)
Get the original request URL.- Parameters:
request- the HTTP request- Returns:
- the original request URL
-
storeOriginalURL
public static void storeOriginalURL(javax.servlet.http.HttpServletRequest request)
Put the original request URL into the request object as an attribute for later use. This is necessary because forwarding a request removes this information. The attribute is only written if it hasn't been before; thus it can be called after a forward safely.- Parameters:
request- Servlet's HTTP request object.
-
sendAlert
public static void sendAlert(javax.servlet.http.HttpServletRequest request, Exception exception)Send an alert to the designated "alert recipient" - that is, when a database error or internal error occurs, this person is sent an e-mail with details.The recipient is configured via the "alert.recipient" property in
dspace.cfg. If this property is omitted, no alerts are sent.This method "swallows" any exception that might occur - it will just be logged. This is because this method will usually be invoked as part of an error handling routine anyway.
- Parameters:
request- the HTTP request leading to the errorexception- the exception causing the error, or null
-
createCollectionWorkflowRole
public static void createCollectionWorkflowRole(Context context, Collection collection, String roleId, Group group) throws AuthorizeException, SQLException
Creates a role for a collection by linking a group of epersons to a role ID- Parameters:
context- The relevant DSpace Context.collection- the target collectionroleId- the role to be linked.group- group of EPersons- Throws:
AuthorizeException- Exception indicating the current user of the context does not have permission to perform a particular action.SQLException- An exception that provides information on a database access error or other errors.
-
deleteRoleGroup
public static void deleteRoleGroup(Context context, Collection collection, String roleID) throws SQLException, IOException, WorkflowConfigurationException
-
getCollectionRoles
public static Map<String,Role> getCollectionRoles(Collection thisCollection) throws IOException, WorkflowConfigurationException, SQLException
-
getCollectionAndRepositoryRoles
public static Map<String,Role> getCollectionAndRepositoryRoles(Collection thisCollection) throws IOException, WorkflowConfigurationException, SQLException
-
getAllExternalRoles
public static Map<String,Role> getAllExternalRoles(Collection thisCollection) throws IOException, WorkflowConfigurationException, SQLException
-
getRoleGroup
public static Group getRoleGroup(Context context, Collection collection, Role role) throws SQLException
- Throws:
SQLException
-
-