Search in sources :

Example 1 with RDFGroupList

use of com.emc.storageos.model.rdfgroup.RDFGroupList in project coprhd-controller by CoprHD.

the class StorageSystemService method getAllRAGroups.

/**
 * Get All RA Groups
 *
 * @param id
 * @brief List RDF groups names in a storage system
 * @return
 */
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}/rdf-groups")
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR })
public RDFGroupList getAllRAGroups(@PathParam("id") URI id) {
    // Make sure storage system is registered.
    ArgValidator.checkFieldUriType(id, StorageSystem.class, "id");
    StorageSystem system = queryResource(id);
    ArgValidator.checkEntity(system, id, isIdEmbeddedInURL(id));
    RDFGroupList rdfGroupList = new RDFGroupList();
    URIQueryResultList rdfGroupURIs = new URIQueryResultList();
    _dbClient.queryByConstraint(ContainmentConstraint.Factory.getStorageDeviceRemoteGroupsConstraint(id), rdfGroupURIs);
    Iterator<URI> rdfGroupIter = rdfGroupURIs.iterator();
    while (rdfGroupIter.hasNext()) {
        URI rdfGroupURI = rdfGroupIter.next();
        RemoteDirectorGroup rdfGroup = _dbClient.queryObject(RemoteDirectorGroup.class, rdfGroupURI);
        if (rdfGroup != null && !rdfGroup.getInactive()) {
            rdfGroupList.getRdfGroups().add(toNamedRelatedResource(rdfGroup, rdfGroup.getNativeGuid()));
        }
    }
    return rdfGroupList;
}
Also used : RemoteDirectorGroup(com.emc.storageos.db.client.model.RemoteDirectorGroup) RDFGroupList(com.emc.storageos.model.rdfgroup.RDFGroupList) URI(java.net.URI) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) StorageSystem(com.emc.storageos.db.client.model.StorageSystem) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Aggregations

URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)1 RemoteDirectorGroup (com.emc.storageos.db.client.model.RemoteDirectorGroup)1 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)1 RDFGroupList (com.emc.storageos.model.rdfgroup.RDFGroupList)1 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)1 URI (java.net.URI)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1