Package org.dspace.content
Class CollectionServiceImpl
- java.lang.Object
-
- org.dspace.content.DSpaceObjectServiceImpl<Collection>
-
- org.dspace.content.CollectionServiceImpl
-
- All Implemented Interfaces:
CollectionService,DSpaceObjectLegacySupportService<Collection>,DSpaceObjectService<Collection>
public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> implements CollectionService
Service implementation for the Collection object. This class is responsible for all business logic calls for the Collection object and is autowired by spring. This class should never be accessed directly.- Author:
- kevinvandevelde at atmire.com
-
-
Field Summary
Fields Modifier and Type Field Description protected AuthorizeServiceauthorizeServiceprotected BitstreamServicebitstreamServiceprotected CollectionDAOcollectionDAOprotected CollectionRoleServicecollectionRoleServiceprotected CommunityServicecommunityServiceprotected GroupServicegroupServiceprotected HarvestedCollectionServiceharvestedCollectionServiceprotected ItemServiceitemServiceprotected LicenseServicelicenseServiceprotected ResourcePolicyServiceresourcePolicyServiceprotected SubscribeServicesubscribeServiceprotected XmlWorkflowFactoryworkflowFactoryprotected WorkspaceItemServiceworkspaceItemService-
Fields inherited from class org.dspace.content.DSpaceObjectServiceImpl
choiceAuthorityService, handleService, metadataAuthorityService, metadataFieldService, metadataValueService, relationshipService
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedCollectionServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddItem(Context context, Collection collection, Item item)Add an item to the collection.voidcanEdit(Context context, Collection collection)voidcanEdit(Context context, Collection collection, boolean useInheritance)booleancanEditBoolean(Context context, Collection collection)booleancanEditBoolean(Context context, Collection collection, boolean useInheritance)intcountTotal(Context context)Collectioncreate(Context context, Community community)Create a new collection with a new ID.Collectioncreate(Context context, Community community, String handle)Create a new collection with the supplied handle and with a new ID.GroupcreateAdministrators(Context context, Collection collection)Create a default administrators group if one does not already exist.GroupcreateDefaultReadGroup(Context context, Collection collection, String typeOfGroupString, int defaultRead)This method will create a default read group for the given Collection.GroupcreateSubmitters(Context context, Collection collection)Create a default submitters group if one does not already exist.voidcreateTemplateItem(Context context, Collection collection)Create an empty template item for this collection.GroupcreateWorkflowGroup(Context context, Collection collection, int step)Create a workflow group for the given step if one does not already exist.voiddelete(Context context, Collection collection)Collectionfind(Context context, UUID id)Generic find for when the precise type of an Entity is not knownList<Collection>findAll(Context context)Get all collections in the system.List<Collection>findAll(Context context, Integer limit, Integer offset)Get all collections in the system.List<Collection>findAuthorized(Context context, Community community, int actionID)return an array of collections that user has a given permission on (useful for trimming 'select to collection' list) or figuring out which collections a person is an editor for.List<Collection>findAuthorizedOptimized(Context context, int actionID)CollectionfindByGroup(Context context, Group group)CollectionfindByIdOrLegacyId(Context context, String id)CollectionfindByLegacyId(Context context, int id)Generic find for when the precise type of a DSO is not known, just the a pair of type number and database ID.List<Collection>findCollectionsWithSubscribers(Context context)List<Collection>findDirectMapped(Context context, int actionID)List<Collection>findGroup2CommunityMapped(Context context)List<Collection>findGroup2GroupMapped(Context context, int actionID)List<Collection>findGroupMapped(Context context, int actionID)DSpaceObjectgetAdminObject(Context context, Collection collection, int action)Return the dspace object where an ADMIN action right is sufficient to grant the initial authorize check.List<Map.Entry<Collection,Long>>getCollectionsWithBitstreamSizesTotal(Context context)The map entry returned contains a collection as a key and sum of bitstream sizes in bytes as a valueStringgetLicense(Collection collection)Get the license that users must grant before submitting to this collection.StringgetMetadata(Collection collection, String field)Deprecated.DSpaceObjectgetParentObject(Context context, Collection collection)Return the dspace object that "own" the current object in the hierarchy.intgetSupportsTypeConstant()Returns the Constants which this service supportsGroupgetWorkflowGroup(Context context, Collection collection, int step)Get the the workflow group corresponding to a particular workflow step.booleanhasCustomLicense(Collection collection)Find out if the collection has a custom licensevoidremoveAdministrators(Context context, Collection collection)Remove the administrators group, if no group has already been created then return without error.voidremoveItem(Context context, Collection collection, Item item)Remove an item.voidremoveSubmitters(Context context, Collection collection)Remove the submitters group, if no group has already been created then return without error.voidremoveTemplateItem(Context context, Collection collection)Remove the template item for this collection, if there is one.BitstreamsetLogo(Context context, Collection collection, InputStream is)Give the collection a logo.voidsetMetadata(Context context, Collection collection, String field, String value)Set a metadata valuevoidsetWorkflowGroup(Context context, Collection collection, int step, Group group)Set the workflow group corresponding to a particular workflow step.voidupdate(Context context, Collection collection)voidupdateLastModified(Context context, Collection collection)-
Methods inherited from class org.dspace.content.DSpaceObjectServiceImpl
addAndShiftRightMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, clearMetadata, getAuthoritiesAndConfidences, getElements, getElementsFilled, getIdentifiers, getMDValueByField, getMDValueByLegacyField, getMetadata, getMetadata, getMetadata, getMetadataByMetadataString, getMetadataFirstValue, getMetadataValuePlace, getName, getTypeText, match, moveMetadata, removeMetadataValues, replaceMetadata, setMetadataModified, setMetadataSingleValue
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.dspace.content.service.DSpaceObjectService
addAndShiftRightMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, clearMetadata, getIdentifiers, getMetadata, getMetadata, getMetadata, getMetadataByMetadataString, getMetadataFirstValue, getName, getTypeText, moveMetadata, removeMetadataValues, replaceMetadata, setMetadataModified, setMetadataSingleValue
-
-
-
-
Field Detail
-
collectionDAO
@Autowired(required=true) protected CollectionDAO collectionDAO
-
authorizeService
@Autowired(required=true) protected AuthorizeService authorizeService
-
resourcePolicyService
@Autowired(required=true) protected ResourcePolicyService resourcePolicyService
-
bitstreamService
@Autowired(required=true) protected BitstreamService bitstreamService
-
itemService
@Autowired(required=true) protected ItemService itemService
-
communityService
@Autowired(required=true) protected CommunityService communityService
-
groupService
@Autowired(required=true) protected GroupService groupService
-
licenseService
@Autowired(required=true) protected LicenseService licenseService
-
subscribeService
@Autowired(required=true) protected SubscribeService subscribeService
-
workspaceItemService
@Autowired(required=true) protected WorkspaceItemService workspaceItemService
-
harvestedCollectionService
@Autowired(required=true) protected HarvestedCollectionService harvestedCollectionService
-
workflowFactory
@Autowired(required=true) protected XmlWorkflowFactory workflowFactory
-
collectionRoleService
@Autowired(required=true) protected CollectionRoleService collectionRoleService
-
-
Method Detail
-
create
public Collection create(Context context, Community community) throws SQLException, AuthorizeException
Description copied from interface:CollectionServiceCreate a new collection with a new ID. Once created the collection is added to the given community- Specified by:
createin interfaceCollectionService- Parameters:
context- DSpace context objectcommunity- DSpace Community (parent)- Returns:
- the newly created collection
- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-
create
public Collection create(Context context, Community community, String handle) throws SQLException, AuthorizeException
Description copied from interface:CollectionServiceCreate a new collection with the supplied handle and with a new ID. Once created the collection is added to the given community- Specified by:
createin interfaceCollectionService- Parameters:
context- DSpace context objectcommunity- DSpace Community (parent)handle- the pre-determined Handle to assign to the new community- Returns:
- the newly created collection
- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-
findAll
public List<Collection> findAll(Context context) throws SQLException
Description copied from interface:CollectionServiceGet all collections in the system. These are alphabetically sorted by collection name.- Specified by:
findAllin interfaceCollectionService- Parameters:
context- DSpace context object- Returns:
- the collections in the system
- Throws:
SQLException- if database error
-
findAll
public List<Collection> findAll(Context context, Integer limit, Integer offset) throws SQLException
Description copied from interface:CollectionServiceGet all collections in the system. Adds support for limit and offset.- Specified by:
findAllin interfaceCollectionService- Parameters:
context- The relevant DSpace Context.limit- paging limitoffset- paging offset- Returns:
- List of Collections
- Throws:
SQLException- if database error
-
findAuthorizedOptimized
public List<Collection> findAuthorizedOptimized(Context context, int actionID) throws SQLException
- Specified by:
findAuthorizedOptimizedin interfaceCollectionService- Throws:
SQLException
-
findDirectMapped
public List<Collection> findDirectMapped(Context context, int actionID) throws SQLException
- Specified by:
findDirectMappedin interfaceCollectionService- Throws:
SQLException
-
findGroup2CommunityMapped
public List<Collection> findGroup2CommunityMapped(Context context) throws SQLException
- Specified by:
findGroup2CommunityMappedin interfaceCollectionService- Throws:
SQLException
-
findGroup2GroupMapped
public List<Collection> findGroup2GroupMapped(Context context, int actionID) throws SQLException
- Specified by:
findGroup2GroupMappedin interfaceCollectionService- Throws:
SQLException
-
findGroupMapped
public List<Collection> findGroupMapped(Context context, int actionID) throws SQLException
- Specified by:
findGroupMappedin interfaceCollectionService- Throws:
SQLException
-
find
public Collection find(Context context, UUID id) throws SQLException
Description copied from interface:DSpaceObjectServiceGeneric find for when the precise type of an Entity is not known- Specified by:
findin interfaceDSpaceObjectService<Collection>- Parameters:
context- - the contextid- - uuid within table of type'd dspace objects- Returns:
- the dspace object found, or null if it does not exist.
- Throws:
SQLException- only upon failure accessing the database.
-
setMetadata
public void setMetadata(Context context, Collection collection, String field, String value) throws MissingResourceException, SQLException
Description copied from interface:CollectionServiceSet a metadata value- Specified by:
setMetadatain interfaceCollectionService- Parameters:
context- DSpace Contextcollection- Collectionfield- the name of the metadata field to getvalue- value to set the field to- Throws:
MissingResourceException- if resource missingSQLException- if database error
-
setLogo
public Bitstream setLogo(Context context, Collection collection, InputStream is) throws AuthorizeException, IOException, SQLException
Description copied from interface:CollectionServiceGive the collection a logo. Passing innullremoves any existing logo. You will need to set the format of the new logo bitstream before it will work, for example to "JPEG". Note thatupdatewill need to be called for the change to take effect. Setting a logo and not callingupdatelater may result in a previous logo lying around as an "orphaned" bitstream.- Specified by:
setLogoin interfaceCollectionService- Parameters:
context- DSpace Contextcollection- Collectionis- the stream to use as the new logo- Returns:
- the new logo bitstream, or
nullif there is no logo (nullwas passed in) - Throws:
AuthorizeException- if authorization errorIOException- if IO errorSQLException- if database error
-
createWorkflowGroup
public Group createWorkflowGroup(Context context, Collection collection, int step) throws SQLException, AuthorizeException
Description copied from interface:CollectionServiceCreate a workflow group for the given step if one does not already exist. Returns either the newly created group or the previously existing one. Note that while the new group is created in the database, the association between the group and the collection is not written untilupdateis called.- Specified by:
createWorkflowGroupin interfaceCollectionService- Parameters:
context- DSpace Contextcollection- Collectionstep- the step (1-3) of the workflow to create or get the group for- Returns:
- the workflow group associated with this collection
- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-
setWorkflowGroup
public void setWorkflowGroup(Context context, Collection collection, int step, Group group) throws SQLException
Description copied from interface:CollectionServiceSet the workflow group corresponding to a particular workflow step.nullcan be passed in if there should be no associated group for that workflow step; any existing group is NOT deleted.- Specified by:
setWorkflowGroupin interfaceCollectionServicecollection- Collectionstep- the workflow step (1-3)group- the new workflow group, ornull- Throws:
SQLException
-
getWorkflowGroup
public Group getWorkflowGroup(Context context, Collection collection, int step)
Description copied from interface:CollectionServiceGet the the workflow group corresponding to a particular workflow step. This returnsnullif there is no group associated with this collection for the given step.- Specified by:
getWorkflowGroupin interfaceCollectionService- Parameters:
context- DSpace Contextcollection- Collectionstep- the workflow step (1-3)- Returns:
- the group of reviewers or
null
-
getMetadata
@Deprecated public String getMetadata(Collection collection, String field)
Deprecated.Get the value of a metadata field- Specified by:
getMetadatain interfaceDSpaceObjectService<Collection>- Overrides:
getMetadatain classDSpaceObjectServiceImpl<Collection>- Parameters:
collection- which collection to operate onfield- the name of the metadata field to get- Returns:
- the value of the metadata field
- Throws:
IllegalArgumentException- if the requested metadata field doesn't exist
-
createSubmitters
public Group createSubmitters(Context context, Collection collection) throws SQLException, AuthorizeException
Description copied from interface:CollectionServiceCreate a default submitters group if one does not already exist. Returns either the newly created group or the previously existing one. Note that other groups may also be allowed to submit to this collection by the authorization system.- Specified by:
createSubmittersin interfaceCollectionService- Parameters:
context- DSpace Contextcollection- Collection- Returns:
- the default group of submitters associated with this collection
- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-
removeSubmitters
public void removeSubmitters(Context context, Collection collection) throws SQLException, AuthorizeException
Description copied from interface:CollectionServiceRemove the submitters group, if no group has already been created then return without error. This will merely dereference the current submitters group from the collection so that it may be deleted without violating database constraints.- Specified by:
removeSubmittersin interfaceCollectionService- Parameters:
context- DSpace Contextcollection- Collection- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-
createAdministrators
public Group createAdministrators(Context context, Collection collection) throws SQLException, AuthorizeException
Description copied from interface:CollectionServiceCreate a default administrators group if one does not already exist. Returns either the newly created group or the previously existing one. Note that other groups may also be administrators.- Specified by:
createAdministratorsin interfaceCollectionService- Parameters:
context- DSpace Contextcollection- Collection- Returns:
- the default group of editors associated with this collection
- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-
removeAdministrators
public void removeAdministrators(Context context, Collection collection) throws SQLException, AuthorizeException
Description copied from interface:CollectionServiceRemove the administrators group, if no group has already been created then return without error. This will merely dereference the current administrators group from the collection so that it may be deleted without violating database constraints.- Specified by:
removeAdministratorsin interfaceCollectionService- Parameters:
context- DSpace Contextcollection- Collection- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-
getLicense
public String getLicense(Collection collection)
Description copied from interface:CollectionServiceGet the license that users must grant before submitting to this collection. If the collection does not have a specific license, the site-wide default is returned.- Specified by:
getLicensein interfaceCollectionService- Parameters:
collection- Collection- Returns:
- the license for this collection
-
hasCustomLicense
public boolean hasCustomLicense(Collection collection)
Description copied from interface:CollectionServiceFind out if the collection has a custom license- Specified by:
hasCustomLicensein interfaceCollectionService- Parameters:
collection- Collection- Returns:
trueif the collection has a custom license
-
createTemplateItem
public void createTemplateItem(Context context, Collection collection) throws SQLException, AuthorizeException
Description copied from interface:CollectionServiceCreate an empty template item for this collection. If one already exists, no action is taken. Caution: Make sure you callupdateon the collection after doing this, or the item will have been created but the collection record will not refer to it.- Specified by:
createTemplateItemin interfaceCollectionService- Parameters:
context- DSpace Contextcollection- Collection- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-
removeTemplateItem
public void removeTemplateItem(Context context, Collection collection) throws SQLException, AuthorizeException, IOException
Description copied from interface:CollectionServiceRemove the template item for this collection, if there is one. Note that since this has to remove the old template item ID from the collection record in the database, the collection record will be changed, including any other changes made; in other words, this method does anupdate.- Specified by:
removeTemplateItemin interfaceCollectionService- Parameters:
context- DSpace Contextcollection- Collection- Throws:
SQLException- if database errorAuthorizeException- if authorization errorIOException- if IO error
-
addItem
public void addItem(Context context, Collection collection, Item item) throws SQLException, AuthorizeException
Description copied from interface:CollectionServiceAdd an item to the collection. This simply adds a relationship between the item and the collection - it does nothing like set an issue date, remove a personal workspace item etc. This has instant effect;updateneed not be called.- Specified by:
addItemin interfaceCollectionService- Parameters:
context- DSpace Contextcollection- Collectionitem- item to add- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-
removeItem
public void removeItem(Context context, Collection collection, Item item) throws SQLException, AuthorizeException, IOException
Description copied from interface:CollectionServiceRemove an item. If the item is then orphaned, it is deleted.- Specified by:
removeItemin interfaceCollectionService- Parameters:
context- DSpace Contextcollection- Collectionitem- item to remove- Throws:
SQLException- if database errorAuthorizeException- if authorization errorIOException- if IO error
-
update
public void update(Context context, Collection collection) throws SQLException, AuthorizeException
- Specified by:
updatein interfaceDSpaceObjectService<Collection>- Overrides:
updatein classDSpaceObjectServiceImpl<Collection>- Throws:
SQLExceptionAuthorizeException
-
canEditBoolean
public boolean canEditBoolean(Context context, Collection collection) throws SQLException
- Specified by:
canEditBooleanin interfaceCollectionService- Throws:
SQLException
-
canEditBoolean
public boolean canEditBoolean(Context context, Collection collection, boolean useInheritance) throws SQLException
- Specified by:
canEditBooleanin interfaceCollectionService- Throws:
SQLException
-
canEdit
public void canEdit(Context context, Collection collection) throws SQLException, AuthorizeException
- Specified by:
canEditin interfaceCollectionService- Throws:
SQLExceptionAuthorizeException
-
canEdit
public void canEdit(Context context, Collection collection, boolean useInheritance) throws SQLException, AuthorizeException
- Specified by:
canEditin interfaceCollectionService- Throws:
SQLExceptionAuthorizeException
-
delete
public void delete(Context context, Collection collection) throws SQLException, AuthorizeException, IOException
- Specified by:
deletein interfaceDSpaceObjectService<Collection>- Throws:
SQLExceptionAuthorizeExceptionIOException
-
getSupportsTypeConstant
public int getSupportsTypeConstant()
Description copied from interface:DSpaceObjectServiceReturns the Constants which this service supports- Specified by:
getSupportsTypeConstantin interfaceDSpaceObjectLegacySupportService<Collection>- Specified by:
getSupportsTypeConstantin interfaceDSpaceObjectService<Collection>- Returns:
- a org.dspace.core.Constants that represents a IndexableObject type
-
findAuthorized
public List<Collection> findAuthorized(Context context, Community community, int actionID) throws SQLException
Description copied from interface:CollectionServicereturn an array of collections that user has a given permission on (useful for trimming 'select to collection' list) or figuring out which collections a person is an editor for.- Specified by:
findAuthorizedin interfaceCollectionService- Parameters:
context- DSpace Contextcommunity- (optional) restrict search to a community, else nullactionID- of the action- Returns:
- Collection [] of collections with matching permissions
- Throws:
SQLException- if database error
-
findByGroup
public Collection findByGroup(Context context, Group group) throws SQLException
- Specified by:
findByGroupin interfaceCollectionService- Parameters:
context- DSpace Contextgroup- EPerson Group- Returns:
- the collection, if any, that has the specified group as administrators or submitters
- Throws:
SQLException
-
findCollectionsWithSubscribers
public List<Collection> findCollectionsWithSubscribers(Context context) throws SQLException
- Specified by:
findCollectionsWithSubscribersin interfaceCollectionService- Throws:
SQLException
-
getAdminObject
public DSpaceObject getAdminObject(Context context, Collection collection, int action) throws SQLException
Description copied from interface:DSpaceObjectServiceReturn the dspace object where an ADMIN action right is sufficient to grant the initial authorize check.Default behaviour is ADMIN right on the object grant right on all other action on the object itself. Subclass should override this method as needed.
- Specified by:
getAdminObjectin interfaceDSpaceObjectService<Collection>- Overrides:
getAdminObjectin classDSpaceObjectServiceImpl<Collection>- Parameters:
context- DSpace contextcollection- DSpaceObjectaction- ID of action being attempted, fromorg.dspace.core.Constants. The ADMIN action is not a valid parameter for this method, an IllegalArgumentException should be thrown- Returns:
- the dspace object, if any, where an ADMIN action is sufficient to grant the original action
- Throws:
SQLException- if database error
-
getParentObject
public DSpaceObject getParentObject(Context context, Collection collection) throws SQLException
Description copied from interface:DSpaceObjectServiceReturn the dspace object that "own" the current object in the hierarchy. Note that this method has a meaning slightly different from the getAdminObject because it is independent of the action but it is in a way related to it. It defines the "first" dspace object OTHER then the current one, where allowed ADMIN actions imply allowed ADMIN actions on the object self.- Specified by:
getParentObjectin interfaceDSpaceObjectService<Collection>- Overrides:
getParentObjectin classDSpaceObjectServiceImpl<Collection>- Parameters:
context- DSpace contextcollection- DSpaceObject- Returns:
- the dspace object that "own" the current object in the hierarchy
- Throws:
SQLException- if database error
-
updateLastModified
public void updateLastModified(Context context, Collection collection) throws SQLException, AuthorizeException
- Specified by:
updateLastModifiedin interfaceDSpaceObjectService<Collection>- Throws:
SQLExceptionAuthorizeException
-
findByIdOrLegacyId
public Collection findByIdOrLegacyId(Context context, String id) throws SQLException
- Specified by:
findByIdOrLegacyIdin interfaceDSpaceObjectLegacySupportService<Collection>- Throws:
SQLException
-
findByLegacyId
public Collection findByLegacyId(Context context, int id) throws SQLException
Description copied from interface:DSpaceObjectLegacySupportServiceGeneric find for when the precise type of a DSO is not known, just the a pair of type number and database ID.- Specified by:
findByLegacyIdin interfaceDSpaceObjectLegacySupportService<Collection>- Parameters:
context- - the contextid- - the legacy id within table of type'd objects- Returns:
- the object found, or null if it does not exist.
- Throws:
SQLException- only upon failure accessing the database.
-
countTotal
public int countTotal(Context context) throws SQLException
- Specified by:
countTotalin interfaceCollectionService- Throws:
SQLException
-
getCollectionsWithBitstreamSizesTotal
public List<Map.Entry<Collection,Long>> getCollectionsWithBitstreamSizesTotal(Context context) throws SQLException
Description copied from interface:CollectionServiceThe map entry returned contains a collection as a key and sum of bitstream sizes in bytes as a value- Specified by:
getCollectionsWithBitstreamSizesTotalin interfaceCollectionService- Parameters:
context- DSpace Context- Returns:
- List of Collections and bitstream sizes map
- Throws:
SQLException- if database error
-
createDefaultReadGroup
public Group createDefaultReadGroup(Context context, Collection collection, String typeOfGroupString, int defaultRead) throws SQLException, AuthorizeException
Description copied from interface:CollectionServiceThis method will create a default read group for the given Collection. It'll create either a defaultItemRead or a defaultBitstreamRead group depending on the given parameters- Specified by:
createDefaultReadGroupin interfaceCollectionService- Parameters:
context- The relevant DSpace contextcollection- The collection for which it'll be createdtypeOfGroupString- The type of group to be made, item or bitstreamdefaultRead- The defaultRead int, item or bitstream- Returns:
- The created Group
- Throws:
SQLException- If something goes wrongAuthorizeException- If something goes wrong
-
-