use of org.finra.herd.model.annotation.NamespacePermission in project herd by FINRAOS.
the class BusinessObjectDefinitionColumnServiceImpl method updateBusinessObjectDefinitionColumn.
@NamespacePermission(fields = "#businessObjectDefinitionColumnKey.namespace", permissions = { NamespacePermissionEnum.WRITE_DESCRIPTIVE_CONTENT, NamespacePermissionEnum.WRITE })
@Override
public BusinessObjectDefinitionColumn updateBusinessObjectDefinitionColumn(BusinessObjectDefinitionColumnKey businessObjectDefinitionColumnKey, BusinessObjectDefinitionColumnUpdateRequest request) {
// Validate and trim the business object definition column key.
validateBusinessObjectDefinitionColumnKey(businessObjectDefinitionColumnKey);
// Validate and trim the business object definition column update request.
validateBusinessObjectDefinitionColumnUpdateRequest(request);
// Retrieve and ensure that a business object definition column exists with the business object definition.
BusinessObjectDefinitionColumnEntity businessObjectDefinitionColumnEntity = businessObjectDefinitionColumnDaoHelper.getBusinessObjectDefinitionColumnEntity(businessObjectDefinitionColumnKey);
// Update the entity with the new values.
businessObjectDefinitionColumnEntity.setDescription(request.getDescription());
// Persist the change event entity
businessObjectDefinitionColumnDaoHelper.saveBusinessObjectDefinitionColumnChangeEvents(businessObjectDefinitionColumnEntity);
// Persist the entity.
businessObjectDefinitionColumnEntity = businessObjectDefinitionColumnDao.saveAndRefresh(businessObjectDefinitionColumnEntity);
// Notify the search index that a business object definition must be updated.
searchIndexUpdateHelper.modifyBusinessObjectDefinitionInSearchIndex(businessObjectDefinitionColumnEntity.getBusinessObjectDefinition(), SEARCH_INDEX_UPDATE_TYPE_UPDATE);
// Create and return the business object definition column object from the persisted entity.
return createBusinessObjectDefinitionColumnFromEntity(businessObjectDefinitionColumnEntity, true, getValidSearchResponseFields(), false);
}
use of org.finra.herd.model.annotation.NamespacePermission 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);
}
use of org.finra.herd.model.annotation.NamespacePermission in project herd by FINRAOS.
the class StoragePolicyServiceImpl method getStoragePolicy.
@NamespacePermission(fields = "#storagePolicyKey?.namespace", permissions = NamespacePermissionEnum.READ)
@Override
public StoragePolicy getStoragePolicy(StoragePolicyKey storagePolicyKey) {
// Validate and trim the key.
storagePolicyHelper.validateStoragePolicyKey(storagePolicyKey);
// Retrieve and ensure that a storage policy exists with the specified key.
StoragePolicyEntity storagePolicyEntity = storagePolicyDaoHelper.getStoragePolicyEntityByKey(storagePolicyKey);
// Create and return the storage policy object from the persisted entity.
return createStoragePolicyFromEntity(storagePolicyEntity);
}
use of org.finra.herd.model.annotation.NamespacePermission in project herd by FINRAOS.
the class StorageUnitNotificationRegistrationServiceImpl method deleteStorageUnitNotificationRegistration.
@NamespacePermission(fields = "#notificationRegistrationKey?.namespace", permissions = NamespacePermissionEnum.WRITE)
@Override
public StorageUnitNotificationRegistration deleteStorageUnitNotificationRegistration(NotificationRegistrationKey notificationRegistrationKey) {
// Validate and trim the key.
validateStorageUnitNotificationRegistrationKey(notificationRegistrationKey);
// Retrieve and ensure that a storage unit notification exists with the specified key.
StorageUnitNotificationRegistrationEntity storageUnitNotificationRegistrationEntity = storageUnitNotificationRegistrationDaoHelper.getStorageUnitNotificationRegistrationEntity(notificationRegistrationKey);
// Delete the storage unit notification.
storageUnitNotificationRegistrationDao.delete(storageUnitNotificationRegistrationEntity);
// Create and return the storage unit notification object from the deleted entity.
return createStorageUnitNotificationFromEntity(storageUnitNotificationRegistrationEntity);
}
use of org.finra.herd.model.annotation.NamespacePermission in project herd by FINRAOS.
the class UploadDownloadServiceImpl method initiateUploadSampleFile.
@NamespacePermission(fields = "#request.businessObjectDefinitionKey.namespace", permissions = { NamespacePermissionEnum.WRITE_DESCRIPTIVE_CONTENT, NamespacePermissionEnum.WRITE })
@Override
public UploadBusinessObjectDefinitionSampleDataFileInitiationResponse initiateUploadSampleFile(UploadBusinessObjectDefinitionSampleDataFileInitiationRequest request) {
validateUploadBusinessObjectDefinitionSampleDataFileInitiationRequest(request);
BusinessObjectDefinitionKey businessObjectDefinitionKey = request.getBusinessObjectDefinitionKey();
// Get the business object definition entity and ensure it exists.
BusinessObjectDefinitionEntity businessObjectDefinitionEntity = businessObjectDefinitionDaoHelper.getBusinessObjectDefinitionEntity(businessObjectDefinitionKey);
businessObjectDefinitionKey.setNamespace(businessObjectDefinitionEntity.getNamespace().getCode());
businessObjectDefinitionKey.setBusinessObjectDefinitionName(businessObjectDefinitionEntity.getName());
UploadBusinessObjectDefinitionSampleDataFileInitiationResponse response = new UploadBusinessObjectDefinitionSampleDataFileInitiationResponse();
StorageEntity storageEntity = storageDaoHelper.getStorageEntity(StorageEntity.SAMPLE_DATA_FILE_STORAGE);
String s3BucketName = storageHelper.getStorageBucketName(storageEntity);
String s3EndPoint = storageHelper.getS3BucketAccessParams(storageEntity).getS3Endpoint();
String awsRoleArn = getStorageUploadRoleArn(storageEntity);
String sessionID = UUID.randomUUID().toString();
String s3KeyPrefix = s3KeyPrefixHelper.buildS3KeyPrefix(storageEntity, businessObjectDefinitionKey);
s3KeyPrefix = StringUtils.appendIfMissing(s3KeyPrefix, "/");
// need to add star for aws authorization
String s3Path = s3KeyPrefix + "*";
Integer awsRoleDurationSeconds = getStorageUploadSessionDuration(storageEntity);
Credentials assumedSessionCredentials = stsDao.getTemporarySecurityCredentials(awsHelper.getAwsParamsDto(), sessionID, awsRoleArn, awsRoleDurationSeconds, createUploaderPolicyNoKmsKey(s3BucketName, s3Path));
response.setAwsAccessKey(assumedSessionCredentials.getAccessKeyId());
response.setAwsSecretKey(assumedSessionCredentials.getSecretAccessKey());
response.setAwsSessionToken(assumedSessionCredentials.getSessionToken());
response.setAwsSessionExpirationTime(HerdDateUtils.getXMLGregorianCalendarValue(assumedSessionCredentials.getExpiration()));
response.setAwsS3BucketName(s3BucketName);
response.setBusinessObjectDefinitionKey(businessObjectDefinitionKey);
response.setS3Endpoint(s3EndPoint);
response.setS3KeyPrefix(s3KeyPrefix);
return response;
}
Aggregations