org.dspace.app.xmlui.aspect.administrative
Class FlowContainerUtils

java.lang.Object
  extended by org.dspace.app.xmlui.aspect.administrative.FlowContainerUtils

public class FlowContainerUtils
extends java.lang.Object

Utility methods to processes actions on Communities and Collections.

Author:
scott phillips

Field Summary
static java.lang.String ROLE_ADMIN
          Possible Collection roles
static java.lang.String ROLE_DEFAULT_READ
           
static java.lang.String ROLE_SUBMIT
           
static java.lang.String ROLE_WF_STEP1
           
static java.lang.String ROLE_WF_STEP2
           
static java.lang.String ROLE_WF_STEP3
           
 
Constructor Summary
FlowContainerUtils()
           
 
Method Summary
static FlowResult changeCollectionDefaultReadToAnonymous(Context context, int collectionID)
          Change the default read privileges to the anonymous group.
static java.lang.String checkXMLFragment(java.lang.String value)
          Check whether this metadata value is a proper XML fragment.
static int createCollectionDefaultReadGroup(Context context, int collectionID)
          Change default privileges from the anonymous group to a new group that will be created and appropriate privileges assigned.
static java.lang.String escapeXMLEntities(java.lang.String value)
          Sanitize any XML that was inputed by the user, this will clean up any unescaped characters so that they can be stored as proper XML.
static int getCollectionDefaultRead(Context context, int collectionID)
          Look up the id of a group authorized for one of the given roles.
static int getCollectionRole(Context context, int collectionID, java.lang.String roleName)
          Look up the id of a group authorized for one of the given roles.
static int getCommunityRole(Context context, int communityID, java.lang.String roleName)
          Look up the id of a group authorized for one of the given roles.
static int getTemplateItemID(Context context, int collectionID)
          Look up the id of the template item for a given collection.
static FlowResult processCreateCollection(Context context, int communityID, org.apache.cocoon.environment.Request request)
          Create a new collection
static FlowResult processCreateCommunity(Context context, int communityID, org.apache.cocoon.environment.Request request)
          Create a new community
static FlowResult processCurateCollection(Context context, int dsoID, org.apache.cocoon.environment.Request request)
          processCurateCollection Utility method to process curation tasks submitted via the DSpace GUI
static FlowResult processCurateCommunity(Context context, int dsoID, org.apache.cocoon.environment.Request request)
          processCurateCommunity Utility method to process curation tasks submitted via the DSpace GUI
static FlowResult processDeleteCollection(Context context, int collectionID)
          Delete collection itself
static FlowResult processDeleteCollectionRole(Context context, int collectionID, java.lang.String roleName, int groupID)
          Delete one of collection's roles
static FlowResult processDeleteCommunity(Context context, int communityID)
          Delete community itself
static FlowResult processDeleteCommunityRole(Context context, int communityID, java.lang.String roleName, int groupID)
          Delete one of a community's roles
static FlowResult processDeleteTemplateItem(Context context, int collectionID)
          Delete a collection's template item (which is not a member of the collection).
static FlowResult processEditCollection(Context context, int collectionID, boolean deleteLogo, org.apache.cocoon.environment.Request request)
          Process the collection metadata edit form.
static FlowResult processEditCommunity(Context context, int communityID, boolean deleteLogo, org.apache.cocoon.environment.Request request)
          Process the community metadata edit form.
static FlowResult processQueueCollection(Context context, int dsoID, org.apache.cocoon.environment.Request request)
          queues curation tasks
static FlowResult processQueueCommunity(Context context, int dsoID, org.apache.cocoon.environment.Request request)
          queues curation tasks
static FlowResult processReimportCollection(Context context, int collectionID, org.apache.cocoon.environment.Request request)
          Purge the collection of all items, then run a fresh harvest cycle.
static FlowResult processRunCollectionHarvest(Context context, int collectionID, org.apache.cocoon.environment.Request request)
          Use the collection's harvest settings to immediately perform a harvest cycle.
static FlowResult processSetupCollectionHarvesting(Context context, int collectionID, org.apache.cocoon.environment.Request request)
          Process the collection harvesting options form.
static FlowResult testOAISettings(Context context, org.apache.cocoon.environment.Request request)
          Test the supplied OAI settings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ROLE_ADMIN

public static final java.lang.String ROLE_ADMIN
Possible Collection roles

See Also:
Constant Field Values

ROLE_WF_STEP1

public static final java.lang.String ROLE_WF_STEP1
See Also:
Constant Field Values

ROLE_WF_STEP2

public static final java.lang.String ROLE_WF_STEP2
See Also:
Constant Field Values

ROLE_WF_STEP3

public static final java.lang.String ROLE_WF_STEP3
See Also:
Constant Field Values

ROLE_SUBMIT

public static final java.lang.String ROLE_SUBMIT
See Also:
Constant Field Values

ROLE_DEFAULT_READ

public static final java.lang.String ROLE_DEFAULT_READ
See Also:
Constant Field Values
Constructor Detail

FlowContainerUtils

public FlowContainerUtils()
Method Detail

processEditCollection

public static FlowResult processEditCollection(Context context,
                                               int collectionID,
                                               boolean deleteLogo,
                                               org.apache.cocoon.environment.Request request)
                                        throws java.sql.SQLException,
                                               java.io.IOException,
                                               AuthorizeException
Process the collection metadata edit form.

Parameters:
context - The current DSpace context.
collectionID - The collection id.
deleteLogo - Determines if the logo should be deleted along with the metadata editing action.
request - the Cocoon request object
Returns:
A process result's object.
Throws:
java.sql.SQLException
java.io.IOException
AuthorizeException

processSetupCollectionHarvesting

public static FlowResult processSetupCollectionHarvesting(Context context,
                                                          int collectionID,
                                                          org.apache.cocoon.environment.Request request)
                                                   throws java.sql.SQLException,
                                                          java.io.IOException,
                                                          AuthorizeException
Process the collection harvesting options form.

Parameters:
context - The current DSpace context.
collectionID - The collection id.
request - the Cocoon request object
Returns:
A process result's object.
Throws:
java.sql.SQLException
java.io.IOException
AuthorizeException

processRunCollectionHarvest

public static FlowResult processRunCollectionHarvest(Context context,
                                                     int collectionID,
                                                     org.apache.cocoon.environment.Request request)
                                              throws java.sql.SQLException,
                                                     java.io.IOException,
                                                     AuthorizeException,
                                                     CrosswalkException,
                                                     javax.xml.parsers.ParserConfigurationException,
                                                     org.xml.sax.SAXException,
                                                     javax.xml.transform.TransformerException
Use the collection's harvest settings to immediately perform a harvest cycle.

Parameters:
context - The current DSpace context.
collectionID - The collection id.
request - the Cocoon request object
Returns:
A process result's object.
Throws:
javax.xml.transform.TransformerException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
CrosswalkException
java.sql.SQLException
java.io.IOException
AuthorizeException

processReimportCollection

public static FlowResult processReimportCollection(Context context,
                                                   int collectionID,
                                                   org.apache.cocoon.environment.Request request)
                                            throws java.sql.SQLException,
                                                   java.io.IOException,
                                                   AuthorizeException,
                                                   CrosswalkException,
                                                   javax.xml.parsers.ParserConfigurationException,
                                                   org.xml.sax.SAXException,
                                                   javax.xml.transform.TransformerException,
                                                   BrowseException
Purge the collection of all items, then run a fresh harvest cycle.

Parameters:
context - The current DSpace context.
collectionID - The collection id.
request - the Cocoon request object
Returns:
A process result's object.
Throws:
javax.xml.transform.TransformerException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
CrosswalkException
BrowseException
java.sql.SQLException
java.io.IOException
AuthorizeException

testOAISettings

public static FlowResult testOAISettings(Context context,
                                         org.apache.cocoon.environment.Request request)
Test the supplied OAI settings.

Parameters:
context -
request -
Returns:

getTemplateItemID

public static int getTemplateItemID(Context context,
                                    int collectionID)
                             throws java.sql.SQLException,
                                    AuthorizeException,
                                    java.io.IOException
Look up the id of the template item for a given collection.

Parameters:
context - The current DSpace context.
collectionID - The collection id.
Returns:
The id of the template item.
Throws:
java.io.IOException
java.sql.SQLException
AuthorizeException

getCollectionRole

public static int getCollectionRole(Context context,
                                    int collectionID,
                                    java.lang.String roleName)
                             throws java.sql.SQLException,
                                    AuthorizeException,
                                    java.io.IOException
Look up the id of a group authorized for one of the given roles. If no group is currently authorized to perform this role then a new group will be created and assigned the role.

Parameters:
context - The current DSpace context.
collectionID - The collection id.
roleName - ADMIN, WF_STEP1, WF_STEP2, WF_STEP3, SUBMIT, DEFAULT_READ.
Returns:
The id of the group associated with that particular role, or -1 if the role was not found.
Throws:
java.sql.SQLException
AuthorizeException
java.io.IOException

processDeleteCollectionRole

public static FlowResult processDeleteCollectionRole(Context context,
                                                     int collectionID,
                                                     java.lang.String roleName,
                                                     int groupID)
                                              throws java.sql.SQLException,
                                                     UIException,
                                                     java.io.IOException,
                                                     AuthorizeException
Delete one of collection's roles

Parameters:
context - The current DSpace context.
collectionID - The collection id.
roleName - ADMIN, WF_STEP1, WF_STEP2, WF_STEP3, SUBMIT, DEFAULT_READ.
groupID - The id of the group associated with this role.
Returns:
A process result's object.
Throws:
java.sql.SQLException
UIException
java.io.IOException
AuthorizeException

getCollectionDefaultRead

public static int getCollectionDefaultRead(Context context,
                                           int collectionID)
                                    throws java.sql.SQLException,
                                           AuthorizeException
Look up the id of a group authorized for one of the given roles. If no group is currently authorized to perform this role then a new group will be created and assigned the role.

Parameters:
context - The current DSpace context.
collectionID - The collection id.
Returns:
The id of the group associated with that particular role or -1
Throws:
java.sql.SQLException
AuthorizeException

createCollectionDefaultReadGroup

public static int createCollectionDefaultReadGroup(Context context,
                                                   int collectionID)
                                            throws java.sql.SQLException,
                                                   AuthorizeException,
                                                   UIException
Change default privileges from the anonymous group to a new group that will be created and appropriate privileges assigned. The id of this new group will be returned.

Parameters:
context - The current DSpace context.
collectionID - The collection id.
Returns:
The group ID of the new group.
Throws:
java.sql.SQLException
AuthorizeException
UIException

changeCollectionDefaultReadToAnonymous

public static FlowResult changeCollectionDefaultReadToAnonymous(Context context,
                                                                int collectionID)
                                                         throws java.sql.SQLException,
                                                                AuthorizeException,
                                                                UIException
Change the default read privileges to the anonymous group. If getCollectionDefaultRead() returns -1 or the anonymous group then nothing is done.

Parameters:
context - The current DSpace context.
collectionID - The collection id.
Returns:
A process result's object.
Throws:
java.sql.SQLException
AuthorizeException
UIException

processDeleteCollection

public static FlowResult processDeleteCollection(Context context,
                                                 int collectionID)
                                          throws java.sql.SQLException,
                                                 AuthorizeException,
                                                 java.io.IOException
Delete collection itself

Parameters:
context - The current DSpace context.
collectionID - The collection id.
Returns:
A process result's object.
Throws:
java.sql.SQLException
AuthorizeException
java.io.IOException

processCreateCollection

public static FlowResult processCreateCollection(Context context,
                                                 int communityID,
                                                 org.apache.cocoon.environment.Request request)
                                          throws java.sql.SQLException,
                                                 AuthorizeException,
                                                 java.io.IOException
Create a new collection

Parameters:
context - The current DSpace context.
communityID - The id of the parent community.
Returns:
A process result's object.
Throws:
java.sql.SQLException
AuthorizeException
java.io.IOException

processCreateCommunity

public static FlowResult processCreateCommunity(Context context,
                                                int communityID,
                                                org.apache.cocoon.environment.Request request)
                                         throws AuthorizeException,
                                                java.io.IOException,
                                                java.sql.SQLException
Create a new community

Parameters:
context - The current DSpace context.
communityID - The id of the parent community (-1 for a top-level community).
Returns:
A process result's object.
Throws:
AuthorizeException
java.io.IOException
java.sql.SQLException

processEditCommunity

public static FlowResult processEditCommunity(Context context,
                                              int communityID,
                                              boolean deleteLogo,
                                              org.apache.cocoon.environment.Request request)
                                       throws AuthorizeException,
                                              java.io.IOException,
                                              java.sql.SQLException
Process the community metadata edit form.

Parameters:
context - The current DSpace context.
communityID - The community id.
deleteLogo - Determines if the logo should be deleted along with the metadata editing action.
request - the Cocoon request object
Returns:
A process result's object.
Throws:
AuthorizeException
java.io.IOException
java.sql.SQLException

processDeleteCommunity

public static FlowResult processDeleteCommunity(Context context,
                                                int communityID)
                                         throws java.sql.SQLException,
                                                AuthorizeException,
                                                java.io.IOException
Delete community itself

Parameters:
context - The current DSpace context.
communityID - The community id.
Returns:
A process result's object.
Throws:
java.sql.SQLException
AuthorizeException
java.io.IOException

getCommunityRole

public static int getCommunityRole(Context context,
                                   int communityID,
                                   java.lang.String roleName)
                            throws java.sql.SQLException,
                                   AuthorizeException,
                                   java.io.IOException
Look up the id of a group authorized for one of the given roles. If no group is currently authorized to perform this role then a new group will be created and assigned the role.

Parameters:
context - The current DSpace context.
communityID - The collection id.
roleName - ADMIN.
Returns:
The id of the group associated with that particular role, or -1 if the role was not found.
Throws:
java.sql.SQLException
AuthorizeException
java.io.IOException

processDeleteCommunityRole

public static FlowResult processDeleteCommunityRole(Context context,
                                                    int communityID,
                                                    java.lang.String roleName,
                                                    int groupID)
                                             throws java.sql.SQLException,
                                                    UIException,
                                                    java.io.IOException,
                                                    AuthorizeException
Delete one of a community's roles

Parameters:
context - The current DSpace context.
communityID - The community id.
roleName - ADMIN.
groupID - The id of the group associated with this role.
Returns:
A process result's object.
Throws:
java.sql.SQLException
UIException
java.io.IOException
AuthorizeException

processDeleteTemplateItem

public static FlowResult processDeleteTemplateItem(Context context,
                                                   int collectionID)
                                            throws java.sql.SQLException,
                                                   AuthorizeException,
                                                   java.io.IOException
Delete a collection's template item (which is not a member of the collection).

Parameters:
context -
collectionID -
Returns:
Throws:
java.sql.SQLException
AuthorizeException
java.io.IOException

processCurateCollection

public static FlowResult processCurateCollection(Context context,
                                                 int dsoID,
                                                 org.apache.cocoon.environment.Request request)
                                          throws AuthorizeException,
                                                 java.io.IOException,
                                                 java.sql.SQLException,
                                                 java.lang.Exception
processCurateCollection Utility method to process curation tasks submitted via the DSpace GUI

Parameters:
context -
dsoID -
request -
Throws:
AuthorizeException
java.io.IOException
java.sql.SQLException
java.lang.Exception

processQueueCollection

public static FlowResult processQueueCollection(Context context,
                                                int dsoID,
                                                org.apache.cocoon.environment.Request request)
                                         throws AuthorizeException,
                                                java.io.IOException,
                                                java.sql.SQLException,
                                                java.lang.Exception
queues curation tasks

Throws:
AuthorizeException
java.io.IOException
java.sql.SQLException
java.lang.Exception

processCurateCommunity

public static FlowResult processCurateCommunity(Context context,
                                                int dsoID,
                                                org.apache.cocoon.environment.Request request)
                                         throws AuthorizeException,
                                                java.io.IOException,
                                                java.sql.SQLException,
                                                java.lang.Exception
processCurateCommunity Utility method to process curation tasks submitted via the DSpace GUI

Parameters:
context -
dsoID -
request -
Throws:
AuthorizeException
java.io.IOException
java.sql.SQLException
java.lang.Exception

processQueueCommunity

public static FlowResult processQueueCommunity(Context context,
                                               int dsoID,
                                               org.apache.cocoon.environment.Request request)
                                        throws AuthorizeException,
                                               java.io.IOException,
                                               java.sql.SQLException,
                                               java.lang.Exception
queues curation tasks

Throws:
AuthorizeException
java.io.IOException
java.sql.SQLException
java.lang.Exception

checkXMLFragment

public static java.lang.String checkXMLFragment(java.lang.String value)
Check whether this metadata value is a proper XML fragment. If the value is not then an error message will be returned that might (sometimes not) tell the user how to correct the problem.

Parameters:
value - The metadat's value
Returns:
An error string of the problem or null if there is no problem with the metadata's value.

escapeXMLEntities

public static java.lang.String escapeXMLEntities(java.lang.String value)
Sanitize any XML that was inputed by the user, this will clean up any unescaped characters so that they can be stored as proper XML. These are errors that in general we want to take care of on behalf of the user.

Parameters:
value - The unsanitized value
Returns:
A sanitized value


Copyright © 2010 DuraSpace. All Rights Reserved.