Search in sources :

Example 6 with WFDirectory

use of com.emc.storageos.db.client.model.uimodels.WFDirectory in project coprhd-controller by CoprHD.

the class WFDirectoryService method queryBulkResourceReps.

@Override
public WFBulkRep queryBulkResourceReps(List<URI> ids) {
    List<WFDirectoryRestRep> wfDirectoryRestReps = new ArrayList<>();
    List<WFDirectory> wfDirectories = wfDirectoryManager.getWFDirectories(ids);
    for (WFDirectory wfd : wfDirectories) {
        wfDirectoryRestReps.add(map(wfd));
    }
    return new WFBulkRep(wfDirectoryRestReps);
}
Also used : WFDirectory(com.emc.storageos.db.client.model.uimodels.WFDirectory) WFBulkRep(com.emc.vipr.model.catalog.WFBulkRep) ArrayList(java.util.ArrayList) WFDirectoryRestRep(com.emc.vipr.model.catalog.WFDirectoryRestRep)

Example 7 with WFDirectory

use of com.emc.storageos.db.client.model.uimodels.WFDirectory in project coprhd-controller by CoprHD.

the class WorkflowDirectoryManagerImpl method checkChildren.

private void checkChildren(URI id) {
    WFDirectory wfDirectory = client.wfDirectory().findById(id);
    if (null == wfDirectory) {
        throw APIException.notFound.unableToFindEntityInURL(id);
    }
    // Disallow operation if this node has children that contain workflows/ primitives
    List<WFDirectory> children = getWFDirectoryChildren(id);
    if (CollectionUtils.isNotEmpty(wfDirectory.getWorkflows())) {
        throw APIException.methodNotAllowed.notSupportedWithReason("Directory has workflows/primitives. Cannot be deleted");
    }
    for (final WFDirectory child : children) {
        if (CollectionUtils.isNotEmpty(child.getWorkflows())) {
            throw APIException.methodNotAllowed.notSupportedWithReason("Directory has children that contain workflows/primitives. Cannot be deleted");
        }
        // check the children
        checkChildren(child.getId());
    }
}
Also used : WFDirectory(com.emc.storageos.db.client.model.uimodels.WFDirectory)

Aggregations

WFDirectory (com.emc.storageos.db.client.model.uimodels.WFDirectory)7 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)4 Produces (javax.ws.rs.Produces)4 URI (java.net.URI)2 Consumes (javax.ws.rs.Consumes)2 POST (javax.ws.rs.POST)2 Path (javax.ws.rs.Path)2 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)1 WFBulkRep (com.emc.vipr.model.catalog.WFBulkRep)1 WFDirectoryList (com.emc.vipr.model.catalog.WFDirectoryList)1 WFDirectoryRestRep (com.emc.vipr.model.catalog.WFDirectoryRestRep)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 ArrayList (java.util.ArrayList)1 GET (javax.ws.rs.GET)1 PUT (javax.ws.rs.PUT)1