Search in sources :

Example 81 with Project

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

the class AddFooToProjectTest method verifyPreparedData.

@Override
protected void verifyPreparedData() throws Exception {
    // make sure the project is saved
    List<URI> ids = dbClient.queryByType(Project.class, true);
    Assert.assertEquals(1, TestDBClientUtils.size(ids));
    Project project = dbClient.queryObject(Project.class, ids.get(0));
    Assert.assertNotNull(project);
}
Also used : Project(com.emc.storageos.db.client.model.Project) URI(java.net.URI)

Example 82 with Project

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

the class AddPrefixToProjectOwner method prepareData.

@Override
protected void prepareData() throws Exception {
    // prepare a Project object for migration
    Project project = new Project();
    project.setId(URIUtil.createId(Project.class));
    project.setLabel("project1");
    project.setOwner("foo1");
    dbClient.createObject(project);
}
Also used : Project(com.emc.storageos.db.client.model.Project)

Example 83 with Project

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

the class AddPrefixToProjectOwner method verifyPreparedData.

@Override
protected void verifyPreparedData() throws Exception {
    // make sure that the Project object is persisted
    List<URI> ids = dbClient.queryByType(Project.class, true);
    Project project = null;
    int count = 0;
    for (URI id : ids) {
        project = dbClient.queryObject(Project.class, id);
        count++;
    }
    Assert.assertNotNull(project);
    Assert.assertEquals(count, 1);
}
Also used : Project(com.emc.storageos.db.client.model.Project) URI(java.net.URI) PrefixConstraint(com.emc.storageos.db.client.constraint.PrefixConstraint)

Example 84 with Project

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

the class FilePolicyAssignWorkflowCompleter method updatePolicyAssignedResources.

private void updatePolicyAssignedResources(DbClient dbClient, FilePolicy filePolicy, Status status, ServiceCoded coded) {
    for (URI resourceURI : assignToResource) {
        filePolicy.addAssignedResources(resourceURI);
        FilePolicyApplyLevel applyAt = FilePolicyApplyLevel.valueOf(filePolicy.getApplyAt());
        switch(applyAt) {
            case project:
                Project project = dbClient.queryObject(Project.class, resourceURI);
                project.addFilePolicy(filePolicy.getId());
                dbClient.updateObject(project);
                if (projectVPool != null) {
                    filePolicy.setFilePolicyVpool(projectVPool);
                }
                break;
            case vpool:
                VirtualPool vpool = dbClient.queryObject(VirtualPool.class, resourceURI);
                vpool.addFilePolicy(filePolicy.getId());
                dbClient.updateObject(vpool);
                break;
            default:
                break;
        }
    }
    dbClient.updateObject(filePolicy);
}
Also used : Project(com.emc.storageos.db.client.model.Project) VirtualPool(com.emc.storageos.db.client.model.VirtualPool) URI(java.net.URI) FilePolicyApplyLevel(com.emc.storageos.db.client.model.FilePolicy.FilePolicyApplyLevel)

Example 85 with Project

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

the class FilePolicyUnAssignWorkflowCompleter method updatePolicyUnAssignedResources.

protected void updatePolicyUnAssignedResources(DbClient dbClient, FilePolicy filePolicy, Status status, ServiceCoded coded) {
    for (URI resourceURI : unassignFromResource) {
        filePolicy.removeAssignedResources(resourceURI);
        FilePolicyApplyLevel applyLevel = FilePolicyApplyLevel.valueOf(filePolicy.getApplyAt());
        switch(applyLevel) {
            case vpool:
                VirtualPool vpool = dbClient.queryObject(VirtualPool.class, resourceURI);
                vpool.removeFilePolicy(filePolicy.getId());
                dbClient.updateObject(vpool);
                break;
            case project:
                Project project = dbClient.queryObject(Project.class, resourceURI);
                project.removeFilePolicy(project, filePolicy.getId());
                dbClient.updateObject(project);
                break;
            case file_system:
                FileShare fs = dbClient.queryObject(FileShare.class, resourceURI);
                fs.removeFilePolicy(filePolicy.getId());
                dbClient.updateObject(fs);
                break;
            default:
                _log.error("Not a valid policy apply level: " + applyLevel);
        }
    }
    if (filePolicy.getAssignedResources() == null || filePolicy.getAssignedResources().isEmpty()) {
        // remove the file policy vpool
        if (!NullColumnValueGetter.isNullURI(filePolicy.getFilePolicyVpool())) {
            filePolicy.setFilePolicyVpool(NullColumnValueGetter.getNullURI());
        }
        // If no other resources are assigned to replication policy
        // Remove the replication topology from the policy
        FileOrchestrationUtils.removeTopologyInfo(filePolicy, dbClient);
    }
    dbClient.updateObject(filePolicy);
}
Also used : Project(com.emc.storageos.db.client.model.Project) VirtualPool(com.emc.storageos.db.client.model.VirtualPool) URI(java.net.URI) FilePolicyApplyLevel(com.emc.storageos.db.client.model.FilePolicy.FilePolicyApplyLevel) FileShare(com.emc.storageos.db.client.model.FileShare)

Aggregations

Project (com.emc.storageos.db.client.model.Project)191 URI (java.net.URI)98 NamedURI (com.emc.storageos.db.client.model.NamedURI)93 ArrayList (java.util.ArrayList)67 VirtualPool (com.emc.storageos.db.client.model.VirtualPool)66 Volume (com.emc.storageos.db.client.model.Volume)58 TenantOrg (com.emc.storageos.db.client.model.TenantOrg)55 VirtualArray (com.emc.storageos.db.client.model.VirtualArray)50 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)47 StringSet (com.emc.storageos.db.client.model.StringSet)43 VirtualPoolCapabilityValuesWrapper (com.emc.storageos.volumecontroller.impl.utils.VirtualPoolCapabilityValuesWrapper)40 List (java.util.List)37 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)36 Produces (javax.ws.rs.Produces)35 BlockConsistencyGroup (com.emc.storageos.db.client.model.BlockConsistencyGroup)33 Test (org.junit.Test)31 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)28 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)27 Operation (com.emc.storageos.db.client.model.Operation)27 Consumes (javax.ws.rs.Consumes)27