AbstractBOM Method Implementations

The next step is to implement the BOM methods. Details on how to do this are provided below. Note also that the Javadoc for the BOM interfaces provides more information on each of the methods. These interfaces are all members of the package curam.util.ctm.bom.

getName() : Retrieving the name of the Business Object Type

The method getName() should return the name of the Business Object Type. This name will be displayed in the User Interface while searching for the set of Business Object Types available on a system. For example, the implementation for User BOMs could return the BOM name User.

getInitialBO() : Provide the Entity Business Object Builder for the Initial Entity

The get InitialBO() method implementation should provide the Entity Business Object Builder for the Initial Entity of the Business Object Type. For the sample User Business Object Type, this is the User entity. The following code snippet illustrates the process:

protected AbstractBOBuilder getInitialBO(
	final BusinessObjectIdentifier boIdentifier) {

	final UserEntityBOBuilder userEntityBOBuilder
		= userEntityBOBuilderProvider.get();

	userEntityBOBuilder.setID(Long.parseLong(
		boIdentifier.getBusinessObjectKey().get()));

	return userEntityBOBuilder;

}

In the code snippet, a new instance of UserEntityBOBuilder is created and initiated with the identifier obtained from the incoming BusinessObjectIdentifier. This instance is then returned.

The BOTraits annotation: Specifying the Mode of Deletion

The class level annotation curam.util.ctm.bom.annotation.BOTraits is used to indicate the Mode of Deletion supported by this Business Object Type. It needs to be specified on the implementation of the curam.util.ctm.bom.InformationalBOM interface. In the UserBOM example, a common implementation class is being developed for all BOMs (i.e. the UserBOM class). So the annotation is specified on this class. This is illustrated on the following code snippet:

@BOTraits(deletionMode = DeletionMode.LOGICAL)
public class UserBOM extends AbstractBOM{

}

The annotation in the example declares that the User Business Object Type supports logical deletion. However, note that if the BOTraits annotation is not specified, the infrastructure assumes that the Business Object Type uses Logical deletion. Hence for a Business Object Type that uses Logical deletion, it is not mandatory to provide this annotation. However, Business Object Types that are physically deleted must specify the annotation, using the deletion mode DeletionMode.PHYSICAL.

getDependentBusinessObjectIdentifiers() : Fetching the Dependent Business Object identifiers

The getDependentBusinessObjectIdentifiers() method implementation should return the set of Business Object identifiers on which the Business Object is dependent (if any). The following code snippet illustrates the process:

public Set<BusinessObjectIdentifier> getDependentBusinessObjectIdentifiers(
	final BusinessObjectIdentifier boIdentifier){

	final Set<BusinessObjectIdentifier> setOfDependantBOs
	    = new HashSet<BusinessObjectIdentifier>();

	// Adding CodeTable dependencies.
	addCodeTableBusinessTypeDependency(
	    setOfDependantBOs, RECORDSTATUSEntry.TABLENAME);
	addCodeTableBusinessTypeDependency(
	    setOfDependantBOs, GroupNameEntry.TABLENAME);
	addCodeTableBusinessTypeDependency(
	    setOfDependantBOs, CategoryName.TABLENAME);

    	// Add Folder dependencies
	final User user = userDAO.get(Long.parseLong(
	    boIdentifier.getBusinessObjectKey().get()));

	for (final Note note : userDAO.searchAllNotes(user)){

		final Folder folder = note.getFolder();

      	    	setOfDependantBOs.add(
      	        	  BusinessObjectIdentifierFactoryImpl.get().
      	                 createBusinessObjectIdentifier(
	                 FolderBOMConstants.kFolderBusinessObjectType.
	                 get(), String.valueOf(folder.getID())));

	}
	return setOfDependantBOs;

}

As previously noted, during the Business Object Type analysis, it was identified that the User Business Object is dependent on the CodeTable and Folder Business Objects. Therefore, the code snippet above adds the relevant CodeTable Business Objects as dependencies. This is achieved by calling the method addCodeTableBusinessTypeDependency(). Additionally, because the User entity can be related to the Folder entity through Note entity, the code calls searchAllNotes() to retrieve the set of Note entities related to a user. Then, for each Note, the corresponding Folder Business Object is identified and added to the set to be returned.

getReadSecurityIdentifier() : Retrieving the Read Security identifiers

The getReadSecurityIdentifier() method implementation has to return all of the security identifiers (SIDs) required to read the Business Object content. This is used to assess whether or not an administrative user using CTM has the required read permissions for the Business Object. An example code snippet is provided below:

public public Set<String> getReadSecurityIdentifier() {

    final Set<String> readSecurityIdentifiers
    	= new HashSet<String>();

    readSecurityIdentifiers.add("UserManager.readUser");
    readSecurityIdentifiers.add("UserManager.readAllNotes");
    readSecurityIdentifiers.add("UserManager.readAllToDos");
    readSecurityIdentifiers.add("UserManager.readAllToDos");
    readSecurityIdentifiers.add("NoteManager.readNote");
    readSecurityIdentifiers.add("ToDoManager.readToDo");

    return readSecurityIdentifiers;

  }

The above implementation gathers together all of the read operation SIDs from the relevant Façade APIs. Refer to Assumptions on the availability of classes for more details.

getWriteSecurityIdentifier() : Retrieving the Write Security identifiers

Similarly, the method getWriteSecurityIdentifier() needs to specify all of the security identifies (SIDs) required to write the Business Object content. An example code snippet is provided below:

public Set<String> getWriteSecurityIdentifier() {

	final Set<String> writeSecurityIdentifiers
		= new HashSet<String>();

	writeSecurityIdentifiers.add("UserManager.createUser");
	writeSecurityIdentifiers.add("UserManager.editUser");
	writeSecurityIdentifiers.add("UserManager.deleteUser");
	writeSecurityIdentifiers.add("UserManager.associateNotes");
	writeSecurityIdentifiers.add("UserManager.disassociateNotes");
	writeSecurityIdentifiers.add("UserManager.associateToDos");
	writeSecurityIdentifiers.add("UserManager.disassociateToDos");

	writeSecurityIdentifiers.add("NoteManager.createNote");
	writeSecurityIdentifiers.add("NoteManager.editNote");
	writeSecurityIdentifiers.add("NoteManager.deleteNote");

	writeSecurityIdentifiers.add("ToDoManager.createToDo");
	writeSecurityIdentifiers.add("ToDoManager.editToDo");
	writeSecurityIdentifiers.add("ToDoManager.deleteToDo");

	return writeSecurityIdentifiers;
}

The above implementation gathers together all of the write operation SIDs from the relevant Façade APIs. Refer to Assumptions on the availability of classes for more details.