The plug-in interface for IReplaceOrgUnitHandler is used by IPSIS Adapters to support the replace operation for any operations that are not of the standard OrgUnit Types including: Semesters, Departments, Course Templates, Course Offerings, and Course Sections. Examples include: Colleges, Campuses.
The interface implementation is D2L.IM.IPSIS.OrgUnits.OtherOrgUnits.Handlers.IReplaceOrgUnitHandler.
The Template - OrgUnit,IPSIS configuration lists provide a starting point for any IPSIS implementation.
The following handler list is used as a starting point:
- ReplaceOrgUnitReadHandler (Sort Order = 10)
- ReplaceOrgUnitValidateHandler (Sort Order = 20)
- ReplaceOrgUnitCreateLMSHandler (Sort Order = 30)
- ReplaceOrgUnitCreateIMHandler (Sort Order = 40)
- ReplaceOrgUnitSaveLMSHandler (Sort Order = 50)
- ReplaceOrgUnitSaveIMHandler (Sort Order = 60)
ReplaceOrgUnitReadHandler
The ReplaceOrgUnitReadHandler reads all information related to the OrgUnit that exists in the LMS or IM Tables of the database to be used in further handlers.
Implementation
D2L.IM.IPSIS.Default.OrgUnits.OtherOrgUnits.Handlers.ReplaceOrgUnitReadHandler
Expected behavior
The handler performs the following tasks:
- Attempts to read information about the OrgUnit from the IM tables.
- If found, the handler attempt to read any mappings to the LMS for the OrgUnit with the particular Org Unit Type and attempts to read about the OrgUnit from the LMS.
- The handler 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.
ReplaceOrgUnitValidateHandler
The ReplaceOrgUnitValidateHandler ensures that a Valid Code and Name are assigned to the OrgUnit.
Implementation
D2L.IM.IPSIS.Default.OrgUnits.OtherOrgUnits.Handlers.ReplaceOrgUnitValidateHandler
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. These 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 (e.g., 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.
ReplaceOrgUnitCreateLMSHandler
The ReplaceOrgUnitCreateLMSHandler creates the OrgUnit in the Brightspace.
Implementation
D2L.IM.IPSIS.Default.OrgUnits.OtherOrgUnits.Handlers.ReplaceOrgUnitCreateLMSHandler
Expected behavior
This handler only runs if there are no Brightspace OrgUnits associated with the request. The handler performs the following tasks:
- Creates the OrgUnit using the information passed in the request (triggering automatic "Create {OrgUnitType}" 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 is a problem during processing, an exception is thrown, along with as much detailed information as possible.
Configuration notes
- This handler would be placed after any Validate handlers.
- The Create LMS handler should occur before the Create IM handler.
ReplaceOrgUnitCreateIMHandler
The ReplaceOrgUnitCreateIMHandler creates the Entity in the IM tables, and a mapping if one is defined.
Implementation
D2L.IM.IPSIS.Default.OrgUnits.OtherOrgUnits.Handlers.ReplaceOrgUnitCreateIMHandler
Expected behavior
This handler only runs if there is no matching Entity in the IM tables. The handler performs the following tasks:
- Creates the OrgUnit in the IM Platform.
- If there is an LMS OrgUnit associated with the request, the handler creates the IM Platform OrgUnit Mapping to the LMS OrgUnit.
- 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 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 CreateLMS handlers.
ReplaceOrgUnitSaveLMSHandler
The ReplaceOrgUnitSaveLMSHandler saves any changes that have been made to the LMS OrgUnit.
Implementation
D2L.IM.IPSIS.Default.OrgUnits.OtherOrgUnits.Handlers.ReplaceOrgUnitSaveLMSHandler
Expected behavior
This handler only runs if there are changes to be saved for the LMS OrgUnit. The handler performs the following tasks:
- Updates the OrgUnit (triggering automatic audit logging).
- If the request is an update, and at least one field was modified, then set 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.
ReplaceOrgUnitSaveIMHandler
The ReplaceOrgUnitSaveIMHandler saves any changes that have been made to IM Entity and Mappings.
Implementation
D2L.IM.IPSIS.Default.OrgUnits.OtherOrgUnits.Handlers.ReplaceOrgUnitSaveIMHandler
Expected behavior
This 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's 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 would be placed after any SaveLMS handlers.
ReplaceOrgUnitMapByCodeHandler
The ReplaceOrgUnitMapByCodeHandler associates an OrgUnit with an existing LMS OrgUnit by Matching on OrgUnitCode and type.
Implementation
D2L.IM.IPSIS.Default.OrgUnits.OtherOrgUnits.Handlers.ReplaceOrgUnitMapByCodeHandler
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 OrgUnit Mapping, the handler attempts to find an OrgUnit in the Brightspace that matches on OrgUnitCode and OrgUnitType
- If a match is found, the handler updates the request object to contain the matched orgUnit.
- If no matches are found, the handler does nothing.
- If multiple matches are found, the handler throws a MultipleOrgUnitsFoundException
- Processing proceeds to the 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 is typically placed between the Read handlers and the Create handlers, in which case it only executes if the Read handlers fail to find a mapped OrgUnit.
ReplaceOrgUnitNameNoUpdateLMSHandler
Implementation
D2L.IM.IPSIS.Default.OrgUnits.OtherOrgUnits.Handlers.ReplaceOrgUnitNoUpdateLMSHandler
Expected behavior
- 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.
ReplaceOrgUnitValidateLMSOrgUnitExistsHandler
The ReplaceOrgUnitValidateLMSOrgUnitExistsHandler checks to see if the org unit that the request corresponds to has been deleted in the Brightspace.
Implementation
D2L.IM.IPSIS.Default.OrgUnits.OtherOrgUnits.Handlers.ReplaceOrgUnitValidateLMSOrgUnitExistsHandler
Expected behavior
The handler performs the following tasks:
- The handler 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 the Brightspace):
- Try 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 LMS. Thus, throw a UpdateOrgUnitFailedException.
- 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 would be placed after the read handlers, usually as one of the first validate handlers.