Search in sources :

Example 16 with ResourceTagResponse

use of org.apache.cloudstack.api.response.ResourceTagResponse in project cloudstack by apache.

the class GenericDaoBaseWithTagInformationBaseTest method getResourceTagResponse.

private ResourceTagResponse getResourceTagResponse() {
    ResourceTagResponse tagResponse = new ResourceTagResponse();
    tagResponse.setKey(TAG_KEY);
    tagResponse.setValue(TAG_VALUE);
    tagResponse.setObjectName(RESPONSE_OBJECT_NAME);
    tagResponse.setResourceType(TAG_RESOURCE_TYPE_STR);
    tagResponse.setResourceId(TAG_RESOURCE_UUID);
    tagResponse.setDomainId(TAG_DOMAIN_ID_STR);
    tagResponse.setDomainName(TAG_DOMAIN_NAME);
    tagResponse.setCustomer(TAG_CUSTOMER);
    tagResponse.setAccountName(TAG_ACCOUNT_NAME);
    return tagResponse;
}
Also used : ResourceTagResponse(org.apache.cloudstack.api.response.ResourceTagResponse)

Example 17 with ResourceTagResponse

use of org.apache.cloudstack.api.response.ResourceTagResponse in project cloudstack by apache.

the class ResourceTagJoinDaoImpl method newResourceTagResponse.

@Override
public ResourceTagResponse newResourceTagResponse(ResourceTagJoinVO resourceTag, boolean keyValueOnly) {
    ResourceTagResponse response = new ResourceTagResponse();
    response.setKey(resourceTag.getKey());
    response.setValue(resourceTag.getValue());
    if (!keyValueOnly) {
        response.setResourceType(resourceTag.getResourceType().toString());
        response.setResourceId(resourceTag.getResourceUuid());
        ApiResponseHelper.populateOwner(response, resourceTag);
        response.setDomainId(resourceTag.getDomainUuid());
        response.setDomainName(resourceTag.getDomainName());
        response.setCustomer(resourceTag.getCustomer());
    }
    response.setObjectName("tag");
    return response;
}
Also used : ResourceTagResponse(org.apache.cloudstack.api.response.ResourceTagResponse)

Example 18 with ResourceTagResponse

use of org.apache.cloudstack.api.response.ResourceTagResponse in project cloudstack by apache.

the class ResourceTagsDaoImpl method listTags.

@Override
public Map<String, Set<ResourceTagResponse>> listTags() {
    SearchCriteria<ResourceTagVO> sc = AllFieldsSearch.create();
    List<ResourceTagVO> resourceTagList = listBy(sc);
    Map<String, Set<ResourceTagResponse>> resourceTagMap = new HashMap();
    String resourceKey = null;
    ResourceTagResponse resourceTagResponse = null;
    for (ResourceTagVO resourceTagVO : resourceTagList) {
        resourceTagResponse = new ResourceTagResponse();
        resourceTagResponse.setKey(resourceTagVO.getKey());
        resourceTagResponse.setValue(resourceTagVO.getValue());
        Set<ResourceTagResponse> resourceTagSet = new HashSet();
        resourceKey = resourceTagVO.getResourceId() + ":" + resourceTagVO.getResourceType();
        if (resourceTagMap.get(resourceKey) != null) {
            resourceTagSet = resourceTagMap.get(resourceKey);
        }
        resourceTagSet.add(resourceTagResponse);
        resourceTagMap.put(resourceKey, resourceTagSet);
    }
    return resourceTagMap;
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) HashMap(java.util.HashMap) ResourceTagResponse(org.apache.cloudstack.api.response.ResourceTagResponse) ResourceTagVO(com.cloud.tags.ResourceTagVO) HashSet(java.util.HashSet)

Aggregations

ResourceTagResponse (org.apache.cloudstack.api.response.ResourceTagResponse)18 ResourceTag (com.cloud.server.ResourceTag)12 ArrayList (java.util.ArrayList)12 Network (com.cloud.network.Network)6 PhysicalNetwork (com.cloud.network.PhysicalNetwork)6 DataCenter (com.cloud.dc.DataCenter)5 HashSet (java.util.HashSet)5 FirewallRule (com.cloud.network.rules.FirewallRule)4 HashMap (java.util.HashMap)4 ResourceTagJoinVO (com.cloud.api.query.vo.ResourceTagJoinVO)3 IpAddress (com.cloud.network.IpAddress)3 Vpc (com.cloud.network.vpc.Vpc)3 UserVm (com.cloud.uservm.UserVm)3 Map (java.util.Map)3 Set (java.util.Set)3 SecurityGroupJoinVO (com.cloud.api.query.vo.SecurityGroupJoinVO)2 Provider (com.cloud.network.Network.Provider)2 Service (com.cloud.network.Network.Service)2 OvsProvider (com.cloud.network.OvsProvider)2 PhysicalNetworkServiceProvider (com.cloud.network.PhysicalNetworkServiceProvider)2