Search in sources :

Example 6 with NamespacePermission

use of org.finra.herd.model.annotation.NamespacePermission in project herd by FINRAOS.

the class StorageUnitServiceImpl method getStorageUnitDownloadCredential.

@NamespacePermission(fields = "#businessObjectDataKey?.namespace", permissions = NamespacePermissionEnum.READ)
@Override
public StorageUnitDownloadCredential getStorageUnitDownloadCredential(BusinessObjectDataKey businessObjectDataKey, String storageName) {
    StorageUnitDownloadCredential businessObjectDataDownloadCredential = new StorageUnitDownloadCredential();
    businessObjectDataDownloadCredential.setAwsCredential(getBusinessObjectDataS3Credential(businessObjectDataKey, null, storageName, false));
    return businessObjectDataDownloadCredential;
}
Also used : StorageUnitDownloadCredential(org.finra.herd.model.api.xml.StorageUnitDownloadCredential) NamespacePermission(org.finra.herd.model.annotation.NamespacePermission)

Example 7 with NamespacePermission

use of org.finra.herd.model.annotation.NamespacePermission in project herd by FINRAOS.

the class UserNamespaceAuthorizationServiceImpl method getUserNamespaceAuthorization.

@NamespacePermission(fields = "#key?.namespace", permissions = NamespacePermissionEnum.READ)
@Override
public UserNamespaceAuthorization getUserNamespaceAuthorization(UserNamespaceAuthorizationKey key) {
    // Validate and trim the key.
    validateUserNamespaceAuthorizationKey(key);
    // Retrieve and ensure that a user namespace authorization exists with the specified key.
    UserNamespaceAuthorizationEntity userNamespaceAuthorizationEntity = getUserNamespaceAuthorizationEntity(key);
    // Create and return the user namespace authorization object from the persisted entity.
    return createUserNamespaceAuthorizationFromEntity(userNamespaceAuthorizationEntity);
}
Also used : UserNamespaceAuthorizationEntity(org.finra.herd.model.jpa.UserNamespaceAuthorizationEntity) NamespacePermission(org.finra.herd.model.annotation.NamespacePermission)

Example 8 with NamespacePermission

use of org.finra.herd.model.annotation.NamespacePermission in project herd by FINRAOS.

the class CustomDdlServiceImpl method createCustomDdl.

/**
 * Creates a new custom DDL.
 *
 * @param request the information needed to create a custom DDL
 *
 * @return the newly created custom DDL information
 */
@NamespacePermission(fields = "#request.customDdlKey.namespace", permissions = NamespacePermissionEnum.WRITE)
@Override
public CustomDdl createCustomDdl(CustomDdlCreateRequest request) {
    // Validate and trim the key.
    customDdlHelper.validateCustomDdlKey(request.getCustomDdlKey());
    // Validate and trim the DDL.
    Assert.hasText(request.getDdl(), "DDL must be specified.");
    request.setDdl(request.getDdl().trim());
    // Get the business object format and ensure it exists.
    BusinessObjectFormatEntity businessObjectFormatEntity = businessObjectFormatDaoHelper.getBusinessObjectFormatEntity(new BusinessObjectFormatKey(request.getCustomDdlKey().getNamespace(), request.getCustomDdlKey().getBusinessObjectDefinitionName(), request.getCustomDdlKey().getBusinessObjectFormatUsage(), request.getCustomDdlKey().getBusinessObjectFormatFileType(), request.getCustomDdlKey().getBusinessObjectFormatVersion()));
    // Ensure a custom DDL with the specified name doesn't already exist for the specified business object format.
    CustomDdlEntity customDdlEntity = customDdlDao.getCustomDdlByKey(request.getCustomDdlKey());
    if (customDdlEntity != null) {
        throw new AlreadyExistsException(String.format("Unable to create custom DDL with name \"%s\" because it already exists for the business object format {%s}.", request.getCustomDdlKey().getCustomDdlName(), businessObjectFormatHelper.businessObjectFormatEntityAltKeyToString(businessObjectFormatEntity)));
    }
    // Create a custom DDL entity from the request information.
    customDdlEntity = createCustomDdlEntity(businessObjectFormatEntity, request);
    // Persist the new entity.
    customDdlEntity = customDdlDao.saveAndRefresh(customDdlEntity);
    // Create and return the custom DDL object from the persisted entity.
    return createCustomDdlFromEntity(customDdlEntity);
}
Also used : CustomDdlEntity(org.finra.herd.model.jpa.CustomDdlEntity) AlreadyExistsException(org.finra.herd.model.AlreadyExistsException) BusinessObjectFormatKey(org.finra.herd.model.api.xml.BusinessObjectFormatKey) BusinessObjectFormatEntity(org.finra.herd.model.jpa.BusinessObjectFormatEntity) NamespacePermission(org.finra.herd.model.annotation.NamespacePermission)

Example 9 with NamespacePermission

use of org.finra.herd.model.annotation.NamespacePermission in project herd by FINRAOS.

the class CustomDdlServiceImpl method getCustomDdl.

/**
 * Gets an existing custom DDL by key.
 *
 * @param customDdlKey the custom DDL key
 *
 * @return the custom DDL information
 */
@NamespacePermission(fields = "#customDdlKey.namespace", permissions = NamespacePermissionEnum.READ)
@Override
public CustomDdl getCustomDdl(CustomDdlKey customDdlKey) {
    // Validate and trim the key.
    customDdlHelper.validateCustomDdlKey(customDdlKey);
    // Retrieve and ensure that a custom DDL exists with the specified key.
    CustomDdlEntity customDdlEntity = customDdlDaoHelper.getCustomDdlEntity(customDdlKey);
    // Create and return the custom DDL object from the persisted entity.
    return createCustomDdlFromEntity(customDdlEntity);
}
Also used : CustomDdlEntity(org.finra.herd.model.jpa.CustomDdlEntity) NamespacePermission(org.finra.herd.model.annotation.NamespacePermission)

Example 10 with NamespacePermission

use of org.finra.herd.model.annotation.NamespacePermission in project herd by FINRAOS.

the class CustomDdlServiceImpl method getCustomDdls.

/**
 * Gets a list of keys for all existing custom DDLs.
 *
 * @return the custom DDL keys
 */
@NamespacePermission(fields = "#businessObjectFormatKey.namespace", permissions = NamespacePermissionEnum.READ)
@Override
public CustomDdlKeys getCustomDdls(BusinessObjectFormatKey businessObjectFormatKey) {
    // Validate and trim the business object format key.
    businessObjectFormatHelper.validateBusinessObjectFormatKey(businessObjectFormatKey);
    // Ensure that the business object format exists.
    businessObjectFormatDaoHelper.getBusinessObjectFormatEntity(businessObjectFormatKey);
    // Create and populate a list of custom DDL keys.
    CustomDdlKeys customDdlKeys = new CustomDdlKeys();
    customDdlKeys.getCustomDdlKeys().addAll(customDdlDao.getCustomDdls(businessObjectFormatKey));
    return customDdlKeys;
}
Also used : CustomDdlKeys(org.finra.herd.model.api.xml.CustomDdlKeys) 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