Search in sources :

Example 1 with BusinessObjectDefinitionChangeEventEntity

use of org.finra.herd.model.jpa.BusinessObjectDefinitionChangeEventEntity in project herd by FINRAOS.

the class BusinessObjectDefinitionDaoHelper method saveBusinessObjectDefinitionChangeEvents.

/**
 * Update and persist the business object definition change events
 *
 * @param businessObjectDefinitionEntity the business object definition entity
 */
public void saveBusinessObjectDefinitionChangeEvents(BusinessObjectDefinitionEntity businessObjectDefinitionEntity) {
    // Set the change events and add an entry to the change event table
    List<BusinessObjectDefinitionChangeEventEntity> businessObjectDefinitionChangeEventEntities = new ArrayList<>();
    BusinessObjectDefinitionChangeEventEntity businessObjectDefinitionChangeEventEntity = new BusinessObjectDefinitionChangeEventEntity();
    businessObjectDefinitionChangeEventEntity.setBusinessObjectDefinitionEntity(businessObjectDefinitionEntity);
    businessObjectDefinitionChangeEventEntities.add(businessObjectDefinitionChangeEventEntity);
    boolean changeEventOccurred = false;
    if (businessObjectDefinitionEntity.getDisplayName() != null) {
        businessObjectDefinitionChangeEventEntity.setDisplayName(businessObjectDefinitionEntity.getDisplayName());
        changeEventOccurred = true;
    }
    if (businessObjectDefinitionEntity.getDescription() != null) {
        businessObjectDefinitionChangeEventEntity.setDescription(businessObjectDefinitionEntity.getDescription());
        changeEventOccurred = true;
    }
    if (businessObjectDefinitionEntity.getDescriptiveBusinessObjectFormat() != null) {
        businessObjectDefinitionChangeEventEntity.setUsage(businessObjectDefinitionEntity.getDescriptiveBusinessObjectFormat().getUsage());
        businessObjectDefinitionChangeEventEntity.setFileType(businessObjectDefinitionEntity.getDescriptiveBusinessObjectFormat().getFileType().getCode());
        changeEventOccurred = true;
    }
    if (changeEventOccurred) {
        if (businessObjectDefinitionEntity.getChangeEvents() != null) {
            businessObjectDefinitionEntity.getChangeEvents().add(businessObjectDefinitionChangeEventEntity);
        } else {
            businessObjectDefinitionEntity.setChangeEvents(businessObjectDefinitionChangeEventEntities);
        }
    }
}
Also used : BusinessObjectDefinitionChangeEventEntity(org.finra.herd.model.jpa.BusinessObjectDefinitionChangeEventEntity) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)1 BusinessObjectDefinitionChangeEventEntity (org.finra.herd.model.jpa.BusinessObjectDefinitionChangeEventEntity)1