use of org.finra.herd.model.jpa.BusinessObjectDefinitionSubjectMatterExpertEntity in project herd by FINRAOS.
the class BusinessObjectDefinitionSubjectMatterExpertServiceTest method testDeleteBusinessObjectDefinitionSubjectMatterExpertLowerCaseParameters.
@Test
public void testDeleteBusinessObjectDefinitionSubjectMatterExpertLowerCaseParameters() {
// Create a business object definition subject matter expert key.
BusinessObjectDefinitionSubjectMatterExpertKey key = new BusinessObjectDefinitionSubjectMatterExpertKey(BDEF_NAMESPACE, BDEF_NAME, USER_ID);
// Create and persist a business object definition subject matter expert.
BusinessObjectDefinitionSubjectMatterExpertEntity businessObjectDefinitionSubjectMatterExpertEntity = businessObjectDefinitionSubjectMatterExpertDaoTestHelper.createBusinessObjectDefinitionSubjectMatterExpertEntity(key);
// Validate that this business object definition subject matter expert exists.
assertNotNull(businessObjectDefinitionSubjectMatterExpertDao.getBusinessObjectDefinitionSubjectMatterExpertByKey(key));
// Delete this business object definition subject matter expert using lower case parameter values.
BusinessObjectDefinitionSubjectMatterExpert deletedBusinessObjectDefinitionSubjectMatterExpert = businessObjectDefinitionSubjectMatterExpertService.deleteBusinessObjectDefinitionSubjectMatterExpert(new BusinessObjectDefinitionSubjectMatterExpertKey(BDEF_NAMESPACE.toLowerCase(), BDEF_NAME.toLowerCase(), USER_ID.toLowerCase()));
// Validate the returned object.
assertEquals(new BusinessObjectDefinitionSubjectMatterExpert(businessObjectDefinitionSubjectMatterExpertEntity.getId(), key), deletedBusinessObjectDefinitionSubjectMatterExpert);
// Ensure that this business object definition subject matter expert is no longer there.
assertNull(businessObjectDefinitionSubjectMatterExpertDao.getBusinessObjectDefinitionSubjectMatterExpertByKey(key));
}
use of org.finra.herd.model.jpa.BusinessObjectDefinitionSubjectMatterExpertEntity in project herd by FINRAOS.
the class BusinessObjectDefinitionSubjectMatterExpertServiceImpl method createBusinessObjectDefinitionSubjectMatterExpertEntity.
/**
* Creates and persists a new business object definition subject matter expert entity from the business object definition entity and the request
* information.
*
* @param businessObjectDefinitionEntity the business object definition entity
* @param request the business object definition subject matter expert create request
*
* @return the newly created business object definition subject matter expert entity
*/
private BusinessObjectDefinitionSubjectMatterExpertEntity createBusinessObjectDefinitionSubjectMatterExpertEntity(BusinessObjectDefinitionEntity businessObjectDefinitionEntity, BusinessObjectDefinitionSubjectMatterExpertCreateRequest request) {
BusinessObjectDefinitionSubjectMatterExpertEntity businessObjectDefinitionSubjectMatterExpertEntity = new BusinessObjectDefinitionSubjectMatterExpertEntity();
businessObjectDefinitionSubjectMatterExpertEntity.setBusinessObjectDefinition(businessObjectDefinitionEntity);
businessObjectDefinitionSubjectMatterExpertEntity.setUserId(request.getBusinessObjectDefinitionSubjectMatterExpertKey().getUserId());
return businessObjectDefinitionSubjectMatterExpertDao.saveAndRefresh(businessObjectDefinitionSubjectMatterExpertEntity);
}
use of org.finra.herd.model.jpa.BusinessObjectDefinitionSubjectMatterExpertEntity in project herd by FINRAOS.
the class BusinessObjectDefinitionSubjectMatterExpertServiceImpl method deleteBusinessObjectDefinitionSubjectMatterExpert.
@NamespacePermission(fields = "#key.namespace", permissions = { NamespacePermissionEnum.WRITE_DESCRIPTIVE_CONTENT, NamespacePermissionEnum.WRITE })
@Override
public BusinessObjectDefinitionSubjectMatterExpert deleteBusinessObjectDefinitionSubjectMatterExpert(BusinessObjectDefinitionSubjectMatterExpertKey key) {
// Validate and trim the business object definition subject matter expert key.
validateBusinessObjectDefinitionSubjectMatterExpertKey(key);
// Retrieve and ensure that a business object definition subject matter expert exists.
BusinessObjectDefinitionSubjectMatterExpertEntity businessObjectDefinitionSubjectMatterExpertEntity = businessObjectDefinitionSubjectMatterExpertDaoHelper.getBusinessObjectDefinitionSubjectMatterExpertEntity(key);
// Delete the business object definition subject matter expert.
BusinessObjectDefinitionEntity businessObjectDefinitionEntity = businessObjectDefinitionSubjectMatterExpertEntity.getBusinessObjectDefinition();
businessObjectDefinitionEntity.getSubjectMatterExperts().remove(businessObjectDefinitionSubjectMatterExpertEntity);
businessObjectDefinitionDao.saveAndRefresh(businessObjectDefinitionEntity);
// Notify the search index that a business object definition must be updated.
searchIndexUpdateHelper.modifyBusinessObjectDefinitionInSearchIndex(businessObjectDefinitionEntity, SEARCH_INDEX_UPDATE_TYPE_UPDATE);
// Create and return the business object definition subject matter expert object from the deleted entity.
return createBusinessObjectDefinitionSubjectMatterExpertFromEntity(businessObjectDefinitionSubjectMatterExpertEntity);
}
Aggregations