/** * Updates status of a business object data storage unit. * * @param businessObjectDataStorageUnitKey the business object data storage unit key * @param request the business object data status update request * * @return the business object data storage unit status update response */ private BusinessObjectDataStorageUnitStatusUpdateResponse updateBusinessObjectDataStorageUnitStatusHelper( BusinessObjectDataStorageUnitKey businessObjectDataStorageUnitKey, BusinessObjectDataStorageUnitStatusUpdateRequest request) { // Update status of the business object data storage unit. BusinessObjectDataStorageUnitStatusUpdateResponse response = businessObjectDataStorageUnitStatusService.updateBusinessObjectDataStorageUnitStatus(businessObjectDataStorageUnitKey, request); // Create storage unit notification. notificationEventService.processStorageUnitNotificationEventAsync(NotificationEventTypeEntity.EventTypesStorageUnit.STRGE_UNIT_STTS_CHG, storageUnitHelper.getBusinessObjectDataKey(response.getBusinessObjectDataStorageUnitKey()), response.getBusinessObjectDataStorageUnitKey().getStorageName(), response.getStatus(), response.getPreviousStatus()); return response; } }
@Test public void testGetBusinessObjectDataKey() { // Get a business object data key. BusinessObjectDataKey result = storageUnitHelper.getBusinessObjectDataKey( new BusinessObjectDataStorageUnitKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, STORAGE_NAME)); // Validate the result object. assertEquals( new BusinessObjectDataKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION), result); }
/** * Updates status of a business object data storage unit. * * @param businessObjectDataStorageUnitKey the business object data storage unit key * @param request the business object data status update request * * @return the business object data storage unit status update response */ private BusinessObjectDataStorageUnitStatusUpdateResponse updateBusinessObjectDataStorageUnitStatusHelper( BusinessObjectDataStorageUnitKey businessObjectDataStorageUnitKey, BusinessObjectDataStorageUnitStatusUpdateRequest request) { // Update status of the business object data storage unit. BusinessObjectDataStorageUnitStatusUpdateResponse response = businessObjectDataStorageUnitStatusService.updateBusinessObjectDataStorageUnitStatus(businessObjectDataStorageUnitKey, request); // Create storage unit notification. notificationEventService.processStorageUnitNotificationEventAsync(NotificationEventTypeEntity.EventTypesStorageUnit.STRGE_UNIT_STTS_CHG, storageUnitHelper.getBusinessObjectDataKey(response.getBusinessObjectDataStorageUnitKey()), response.getBusinessObjectDataStorageUnitKey().getStorageName(), response.getStatus(), response.getPreviousStatus()); return response; } }
when(storageUnitHelper.getBusinessObjectDataKey(businessObjectDataStorageUnitKey)).thenReturn(businessObjectDataKey); verify(storageUnitHelper).getBusinessObjectDataKey(businessObjectDataStorageUnitKey); verify(notificationEventService) .processStorageUnitNotificationEventAsync(NotificationEventTypeEntity.EventTypesStorageUnit.STRGE_UNIT_STTS_CHG, businessObjectDataKey,
when(storageUnitHelper.getBusinessObjectDataKey(businessObjectDataStorageUnitKey)).thenReturn(businessObjectDataKey); when(businessObjectDataDaoHelper.getBusinessObjectDataEntity(businessObjectDataKey)).thenReturn(businessObjectDataEntity); when(storageDaoHelper.getStorageEntity(STORAGE_NAME)).thenReturn(storageEntity); verify(storageUnitHelper).getBusinessObjectDataKey(businessObjectDataStorageUnitKey); verify(businessObjectDataDaoHelper).getBusinessObjectDataEntity(businessObjectDataKey); verify(storageDaoHelper).getStorageEntity(STORAGE_NAME);
/** * Creates new storage unit for a given business object data and storage. * * @param request the create business object data storage unit create request * * @return the create business object data storage unit create response */ protected BusinessObjectDataStorageUnitCreateResponse createBusinessObjectDataStorageUnitImpl(BusinessObjectDataStorageUnitCreateRequest request) { // Validate the request. validateBusinessObjectDataStorageUnitCreateRequest(request); // Retrieve and validate that business object data exists. BusinessObjectDataEntity businessObjectDataEntity = businessObjectDataDaoHelper.getBusinessObjectDataEntity(storageUnitHelper.getBusinessObjectDataKey(request.getBusinessObjectDataStorageUnitKey())); // Retrieve and validate that storage exists. StorageEntity storageEntity = storageDaoHelper.getStorageEntity(request.getBusinessObjectDataStorageUnitKey().getStorageName()); // Create a storage unit entity. StorageUnitEntity storageUnitEntity = businessObjectDataDaoHelper .createStorageUnitEntity(businessObjectDataEntity, storageEntity, request.getStorageDirectory(), request.getStorageFiles(), request.isDiscoverStorageFiles()); // Persist the newly created storage unit entity. storageUnitDao.saveAndRefresh(storageUnitEntity); // Construct and return the response. return createBusinessObjectDataStorageUnitCreateResponse(storageUnitEntity); }
/** * Creates new storage unit for a given business object data and storage. * * @param request the create business object data storage unit create request * * @return the create business object data storage unit create response */ protected BusinessObjectDataStorageUnitCreateResponse createBusinessObjectDataStorageUnitImpl(BusinessObjectDataStorageUnitCreateRequest request) { // Validate the request. validateBusinessObjectDataStorageUnitCreateRequest(request); // Retrieve and validate that business object data exists. BusinessObjectDataEntity businessObjectDataEntity = businessObjectDataDaoHelper.getBusinessObjectDataEntity(storageUnitHelper.getBusinessObjectDataKey(request.getBusinessObjectDataStorageUnitKey())); // Retrieve and validate that storage exists. StorageEntity storageEntity = storageDaoHelper.getStorageEntity(request.getBusinessObjectDataStorageUnitKey().getStorageName()); // Create a storage unit entity. StorageUnitEntity storageUnitEntity = businessObjectDataDaoHelper .createStorageUnitEntity(businessObjectDataEntity, storageEntity, request.getStorageDirectory(), request.getStorageFiles(), request.isDiscoverStorageFiles()); // Persist the newly created storage unit entity. storageUnitDao.saveAndRefresh(storageUnitEntity); // Construct and return the response. return createBusinessObjectDataStorageUnitCreateResponse(storageUnitEntity); }
storageUnitHelper.getBusinessObjectDataKey(businessObjectDataStorageUnitStatusUpdateResponse.getBusinessObjectDataStorageUnitKey()), businessObjectDataStorageUnitStatusUpdateResponse.getBusinessObjectDataStorageUnitKey().getStorageName(), businessObjectDataStorageUnitStatusUpdateResponse.getStatus(), businessObjectDataStorageUnitStatusUpdateResponse.getPreviousStatus());
storageUnitHelper.getBusinessObjectDataKey(businessObjectDataStorageUnitStatusUpdateResponse.getBusinessObjectDataStorageUnitKey()), businessObjectDataStorageUnitStatusUpdateResponse.getBusinessObjectDataStorageUnitKey().getStorageName(), businessObjectDataStorageUnitStatusUpdateResponse.getStatus(), businessObjectDataStorageUnitStatusUpdateResponse.getPreviousStatus());