The plug-in interface for IReplaceDepartmentHandler is used by IPSIS Adapters to support the replace operation for Departments.
The interface implementation is D2L.IM.IPSIS.OrgUnits.Departments.Handlers.IReplaceDepartmentHandler.
The IPSIS, Template - Department configuration lists provide a starting point for any IPSIS implementation.
The following handler list is used as a starting point:
- ReplaceDepartmentReadHandler (Sort Order = 10)
- ReplaceDepartmentValidateHandler (Sort Order = 20)
- ReplaceDepartmentCreateLMSHandler (Sort Order = 30)
- ReplaceDepartmentCreateIMHandler (Sort Order = 40)
- ReplaceDepartmentSaveLMSHandler (Sort Order = 50)
- ReplaceDepartmentSaveIMHandler (Sort Order = 60)
ReplaceDepartmentReadHandler
The ReplaceDepartmentReadHandler reads all information related to the Department that exists in the LMS or IM Tables of the database to be used in further handlers.
Implementation
D2L.IM.IPSIS.Default.OrgUnits.Departmentss.Handlers.ReplaceDepartmentReadHandler
Expected behavior
The handler performs the following tasks:
- Attempts to read information about the Department from the IM tables:
- If found, the handler attempts to read any mappings to the LMS for the Department.
- If found, the handler attempts to read about the Department from the LMS.
- Attempts to read information about any indicated parent OrgUnits from the IM tables.
- If none are found, the handler sets the default parent list of the Organization at the only parent.
- Processing continues to the next handler (Return True).
Error behavior
If there is a problem during processing, an exception is thrown, along with as much detailed information as possible.
Configuration note
A Read handler should occur before Validate handlers.
ReplaceDepartmentValidateHandler
The ReplaceDepartmentValidateHandler ensures that a Valid Code and Name are assigned to the Department.
Implementation
D2L.IM.IPSIS.Default.OrgUnits.Departments.Handlers.ReplaceDepartmentValidateHandler
Expected behavior
The handler performs the following tasks:
- The Validate handler checks to ensure that both a Code and Name were specified for the request. The Code and Name values must be strings of length greater than 0. If either the Code or the Name are null or empty, the handler throws an ArgumentNullException and all handler processing stops.
- The Validate handler also checks to make sure that the request isn't trying to change the type (ex. change a College to a Department) of an existing org unit.
- If the request is trying to change the type then an InvalidOperationException is thrown and all handler processing stops.
- If everything is successful, processing continues to the next handler (Return True).
Error behavior
If there is a problem during processing, an exception is thrown, along with as much detailed information as possible.
Configuration note
Validate handlers should be configured before the Create handler.
ReplaceDepartmentParentsNoUpdateLMSHandler
The ReplaceDepartmentParentsNoUpdateLMSHandler retrieves org unit parents manually created in the LMS and preserves the relationship so that it is not overwritten by this update operation.
Implementation
D2L.IM.IPSIS.Default.OrgUnits.Departments.Handlers.ReplaceDepartmentParentsNoUpdateLMSHandler
Expected behavior
The handler performs the following tasks:
- Fetches all parents of the department and updates the parent list.
- Processing continues to the next handler (Return True).
Error behavior
No errors are thrown for this translator.
Configuration note
- This handler must occur after the Read & Validate handlers.
- This handler must occur before the Save handlers.
- Recommended Sort Order = 3.
ReplaceDepartmentCreateLMSHandler
The ReplaceDepartmentCreateLMSHandler creates the Department in the Brightspace.
Implementation
D2L.IM.IPSIS.Default.OrgUnits.Departments.Handlers.ReplaceDepartmentCreateLMSHandler
Expected behavior
This handler only runs if there are no Brightspace Departments associated with the request. The handler performs the following tasks:
- Creates the Brightspace Department using the information passed in the request (triggering automatic audit logging).
- If everything is successful, the handler sets the status of the result to EntityCreated.
- If there is an error, the handler sets the status of the result to CreateFailed.
- Processing continues to the next handler (Return True).
Error behavior
If there was a problem processing, an exception is thrown, along with as much detailed information available.
Configuration notes
- This handler is placed after any Validate handlers.
- The Create LMS handler should occur before the Create IM handler.
ReplaceDepartmentCreateIMHandler
The ReplaceDepartmentCreateIMHandler creates the Entity in the IM tables, and a mapping if one is defined.
Implementation
D2L.IM.IPSIS.Default.OrgUnits.Departments.Handlers.ReplaceDepartmentCreateIMHandler
Expected behavior
This handler only runs if there is no matching Entity in the IM tables. The handler performs the following tasks:
- Creates the Department in the IM Platform.
- If there is an LMS OrgUnit associated with the request, the handler creates the IM Platform Department Mapping to the LMS Department.
- If everything is successful, the handler sets the status of the result to EntityCreated.
- Processing continues to the next handler (Return True).
Error behavior
If there was a problem processing, an exception is thrown, along with as much detailed information available.
Configuration note
This handler would be placed after any CreateLMS Handler.
ReplaceDepartmentSaveLMSHandler
The ReplaceDepartmentSaveLMSHandler saves any changes that have been made to the Brightspace Department.
Implementation
This handler only runs if there are changes to be saved for the Brightspace Department. The handler performs the following tasks:
- Updates the Brightspace Department (triggering automatic audit logging).
- If the request is an update, and at least one field was modified, the handler sets the status of the result to EntityUpdated.
- Processing continues to the next handler (Return True).
Error behavior
If there is a problem during processing, an exception is thrown, along with as much detailed information as possible.
Configuration note
This handler is placed after any Create handlers.
ReplaceDepartmentSaveIMHandler
The ReplaceDepartmentSaveIMHandler saves any changes that have been made to IM Entity and Mappings.
Implementation
D2L.IM.IPSIS.Default.OrgUnits.Departments.Handlers.ReplaceDepartmentSaveIMHandler
Expected behavior
The handler only runs if there are changes to be saved for the Entity or Hierarchy in the IM tables. The handler performs the following tasks:
- Updates the IM Entity if there are pending changes.
- Updates the IM Entity Hierarchy relationships if parents were added or removed.
- Processing continues to the next handler (Return True).
Error behavior
If there is a problem during processing, an exception is thrown, along with as much detailed information as possible.
Configuration note
This handler is placed after any SaveLMS handlers.
ReplaceDepartmentMapByCodeHandler
This handler associates a Department with an existing Brightspace Department by Matching on OrgUnitCode.
Implementation
D2L.IM.IPSIS.Default.OrgUnits.Departments.Handlers.ReplaceDepartmentMapByCodeHandler
Expected behavior
This handler should only be used if the Org Unit Code is expected to be unique within an Org. The handler performs the following tasks:
- If there is no Department Mapping, the handler attempts to find a Department in the Brightspace that matches on OrgUnitCode.
- If a match is found, the handler updates the request object to contain the matched orgUnit.
- If no match is found, the handler does nothing.
- If multiple matches are found, the handler throws a MultipleOrgUnitsFoundException which results in an error being returned.
- The handler should only be used if the Org Unit Code is expected to be unique within an Org.
- Processing proceeds to next handler.
Error behavior
If there is a problem during processing, an exception is thrown, along with as much detailed information as possible.
Configuration note
This handler would typically be placed between the Read handlers and the Create handlers, in which case it only executes if the Read handlers fail to find a mapped Department.
ReplaceDepartmentNameNoUpdateLMSHandler
Implementation
D2L.IM.IPSIS.Default.OrgUnits.Departments.Handlers.ReplaceDepartmentCreateHandler
Expected behavior
The handler performs the following tasks:
- Updates the request object to indicate that the Name should not be updated.
- Processing continues to the next handler (Return True).
Error behavior
If there is a problem during processing, an exception is thrown, along with as much detailed information as possible.
Configuration note
This handler is placed before any SaveLMS Handlers.
ReplaceDepartmentValidateLMSOrgUnitExistsHandler
The ReplaceDepartmentValidateLMSOrgUnitExistsHandler checks to see if the org unit that the request corresponds to has been deleted in the Brightspace.
Implementation
D2L.IM.IPSIS.Default.OrgUnits.Departments.Handlers.ReplaceDepartmentValidateLMSOrgUnitExistsHandler
Expected behavior
The handler performs the following tasks:
- Tries to get the current org unit.
- If the current org unit does not exist (either the request is a create, or the org unit was deleted from Brightspace), the handler tries to get the ExternalOrgUnitInfo for the request.
- If the ExternalOrgUnitInfo is valid, then this isn't a create, and the org unit was deleted from the Brightspace. An UpdateOrgUnitFailedException is thrown.
- This exception will cause the LIS Service to respond with invaliddata. This was deemed to be the most suitable response code for this situation.
Error behavior
If there is a problem during processing, an exception is thrown, along with as much detailed information as possible.
Configuration note
This handler is placed after the Read handlers, usually as one of the first Validate handlers.