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;
}
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;
}
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;
}
Aggregations