Search in sources :

Example 41 with NamespacePermission

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);
}
Also used : BusinessObjectDefinitionColumnEntity(org.finra.herd.model.jpa.BusinessObjectDefinitionColumnEntity) NamespacePermission(org.finra.herd.model.annotation.NamespacePermission)

Example 42 with NamespacePermission

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);
}
Also used : BusinessObjectDefinitionEntity(org.finra.herd.model.jpa.BusinessObjectDefinitionEntity) BusinessObjectDefinitionSubjectMatterExpertEntity(org.finra.herd.model.jpa.BusinessObjectDefinitionSubjectMatterExpertEntity) NamespacePermission(org.finra.herd.model.annotation.NamespacePermission)

Example 43 with NamespacePermission

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);
}
Also used : StoragePolicyEntity(org.finra.herd.model.jpa.StoragePolicyEntity) NamespacePermission(org.finra.herd.model.annotation.NamespacePermission)

Example 44 with NamespacePermission

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);
}
Also used : StorageUnitNotificationRegistrationEntity(org.finra.herd.model.jpa.StorageUnitNotificationRegistrationEntity) NamespacePermission(org.finra.herd.model.annotation.NamespacePermission)

Example 45 with NamespacePermission

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;
}
Also used : BusinessObjectDefinitionKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionKey) BusinessObjectDefinitionEntity(org.finra.herd.model.jpa.BusinessObjectDefinitionEntity) UploadBusinessObjectDefinitionSampleDataFileInitiationResponse(org.finra.herd.model.api.xml.UploadBusinessObjectDefinitionSampleDataFileInitiationResponse) StorageEntity(org.finra.herd.model.jpa.StorageEntity) Credentials(com.amazonaws.services.securitytoken.model.Credentials) NamespacePermission(org.finra.herd.model.annotation.NamespacePermission)

Aggregations

NamespacePermission (org.finra.herd.model.annotation.NamespacePermission)63 BusinessObjectDefinitionEntity (org.finra.herd.model.jpa.BusinessObjectDefinitionEntity)10 BusinessObjectFormatEntity (org.finra.herd.model.jpa.BusinessObjectFormatEntity)10 NamespaceEntity (org.finra.herd.model.jpa.NamespaceEntity)10 AlreadyExistsException (org.finra.herd.model.AlreadyExistsException)9 AttributeValueListEntity (org.finra.herd.model.jpa.AttributeValueListEntity)6 BusinessObjectDataKey (org.finra.herd.model.api.xml.BusinessObjectDataKey)5 BusinessObjectDefinitionKey (org.finra.herd.model.api.xml.BusinessObjectDefinitionKey)5 CustomDdlEntity (org.finra.herd.model.jpa.CustomDdlEntity)5 Credentials (com.amazonaws.services.securitytoken.model.Credentials)4 ArrayList (java.util.ArrayList)4 PublishNotificationMessages (org.finra.herd.model.annotation.PublishNotificationMessages)4 BusinessObjectFormatKey (org.finra.herd.model.api.xml.BusinessObjectFormatKey)4 IamRole (org.finra.herd.model.api.xml.IamRole)4 NamespaceIamRoleAuthorization (org.finra.herd.model.api.xml.NamespaceIamRoleAuthorization)4 BusinessObjectDataEntity (org.finra.herd.model.jpa.BusinessObjectDataEntity)4 NamespaceIamRoleAuthorizationEntity (org.finra.herd.model.jpa.NamespaceIamRoleAuthorizationEntity)4 UserNamespaceAuthorizationEntity (org.finra.herd.model.jpa.UserNamespaceAuthorizationEntity)4 ProcessDefinition (org.activiti.engine.repository.ProcessDefinition)3 ObjectNotFoundException (org.finra.herd.model.ObjectNotFoundException)3