Resource metadata: by default, all metadata is set with display=true (meaning that the detail is avaialble for display to the regular user). If admin wants to set a specific detail to be false, he has to specify it explicitly in addResourceDetail command

This commit is contained in:
Alena Prokharchyk 2014-02-10 10:09:19 -08:00
parent 13bf1ec5da
commit e0de79b170
72 changed files with 227 additions and 123 deletions

View File

@ -30,9 +30,10 @@ public interface ResourceMetaDataService {
* @param resourceId TODO * @param resourceId TODO
* @param resourceType * @param resourceType
* @param details * @param details
* @param forDisplay TODO
* @return * @return
*/ */
boolean addResourceMetaData(String resourceId, ResourceObjectType resourceType, Map<String, String> details); boolean addResourceMetaData(String resourceId, ResourceObjectType resourceType, Map<String, String> details, boolean forDisplay);
/** /**
* *

View File

@ -549,6 +549,7 @@ public class ApiConstants {
public static final String PASSIVE = "passive"; public static final String PASSIVE = "passive";
public static final String VERSION = "version"; public static final String VERSION = "version";
public static final String START = "start"; public static final String START = "start";
public static final String DISPLAY = "display";
public enum HostDetails { public enum HostDetails {
all, capacity, events, stats, min; all, capacity, events, stats, min;

View File

@ -49,6 +49,9 @@ public class AddResourceDetailCmd extends BaseAsyncCmd {
@Parameter(name = ApiConstants.RESOURCE_ID, type = CommandType.STRING, required = true, collectionType = CommandType.STRING, description = "resource id to create the details for") @Parameter(name = ApiConstants.RESOURCE_ID, type = CommandType.STRING, required = true, collectionType = CommandType.STRING, description = "resource id to create the details for")
private String resourceId; private String resourceId;
@Parameter(name = ApiConstants.DISPLAY, type = CommandType.BOOLEAN, description = "pass false if you want this detail to be disabled for the regular user. True by default")
private Boolean display;
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
/////////////////// Accessors /////////////////////// /////////////////// Accessors ///////////////////////
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
@ -77,6 +80,14 @@ public class AddResourceDetailCmd extends BaseAsyncCmd {
return resourceId; return resourceId;
} }
public boolean forDisplay() {
if (display != null) {
return display;
} else {
return true;
}
}
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
/////////////// API Implementation/////////////////// /////////////// API Implementation///////////////////
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
@ -104,7 +115,7 @@ public class AddResourceDetailCmd extends BaseAsyncCmd {
@Override @Override
public void execute() { public void execute() {
_resourceMetaDataService.addResourceMetaData(getResourceId(), getResourceType(), getDetails()); _resourceMetaDataService.addResourceMetaData(getResourceId(), getResourceType(), getDetails(), forDisplay());
setResponseObject(new SuccessResponse(getCommandName())); setResponseObject(new SuccessResponse(getCommandName()));
} }
} }

View File

@ -37,7 +37,7 @@ public class ListResourceDetailsCmd extends BaseListProjectAndAccountResourcesCm
@Parameter(name = ApiConstants.RESOURCE_TYPE, type = CommandType.STRING, description = "list by resource type", required = true) @Parameter(name = ApiConstants.RESOURCE_TYPE, type = CommandType.STRING, description = "list by resource type", required = true)
private String resourceType; private String resourceType;
@Parameter(name = ApiConstants.RESOURCE_ID, type = CommandType.STRING, description = "list by resource id", required = true) @Parameter(name = ApiConstants.RESOURCE_ID, type = CommandType.STRING, description = "list by resource id")
private String resourceId; private String resourceId;
@Parameter(name = ApiConstants.KEY, type = CommandType.STRING, description = "list by key") @Parameter(name = ApiConstants.KEY, type = CommandType.STRING, description = "list by key")

View File

@ -190,7 +190,7 @@ public class VolumeResponse extends BaseResponse implements ControlledViewEntity
@SerializedName(ApiConstants.DISPLAY_VOLUME) @SerializedName(ApiConstants.DISPLAY_VOLUME)
@Param(description = "an optional field whether to the display the volume to the end user or not.") @Param(description = "an optional field whether to the display the volume to the end user or not.")
private Boolean displayVm; private Boolean displayVolume;
@SerializedName(ApiConstants.PATH) @SerializedName(ApiConstants.PATH)
@Param(description = "The path of the volume") @Param(description = "The path of the volume")
@ -406,12 +406,12 @@ public class VolumeResponse extends BaseResponse implements ControlledViewEntity
this.tags.add(tag); this.tags.add(tag);
} }
public Boolean getDisplayVm() { public Boolean getDisplayVolume() {
return displayVm; return displayVolume;
} }
public void setDisplayVm(Boolean displayVm) { public void setDisplayVolume(Boolean displayVm) {
this.displayVm = displayVm; this.displayVolume = displayVm;
} }
public void setStoragePoolId(String storagePoolId) { public void setStoragePoolId(String storagePoolId) {

View File

@ -40,8 +40,6 @@ import javax.ejb.Local;
import javax.inject.Inject; import javax.inject.Inject;
import javax.naming.ConfigurationException; import javax.naming.ConfigurationException;
import org.apache.log4j.Logger;
import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao; import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao;
import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.context.CallContext;
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService; import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
@ -69,6 +67,7 @@ import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
import org.apache.cloudstack.storage.to.VolumeObjectTO; import org.apache.cloudstack.storage.to.VolumeObjectTO;
import org.apache.cloudstack.utils.identity.ManagementServerNode; import org.apache.cloudstack.utils.identity.ManagementServerNode;
import org.apache.log4j.Logger;
import com.cloud.agent.AgentManager; import com.cloud.agent.AgentManager;
import com.cloud.agent.Listener; import com.cloud.agent.Listener;
@ -939,11 +938,11 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
//storing the value of overcommit in the vm_details table for doing a capacity check in case the cluster overcommit ratio is changed. //storing the value of overcommit in the vm_details table for doing a capacity check in case the cluster overcommit ratio is changed.
if (_uservmDetailsDao.findDetail(vm.getId(), "cpuOvercommitRatio") == null && if (_uservmDetailsDao.findDetail(vm.getId(), "cpuOvercommitRatio") == null &&
((Float.parseFloat(cluster_detail_cpu.getValue()) > 1f || Float.parseFloat(cluster_detail_ram.getValue()) > 1f))) { ((Float.parseFloat(cluster_detail_cpu.getValue()) > 1f || Float.parseFloat(cluster_detail_ram.getValue()) > 1f))) {
_uservmDetailsDao.addDetail(vm.getId(), "cpuOvercommitRatio", cluster_detail_cpu.getValue()); _uservmDetailsDao.addDetail(vm.getId(), "cpuOvercommitRatio", cluster_detail_cpu.getValue(), true);
_uservmDetailsDao.addDetail(vm.getId(), "memoryOvercommitRatio", cluster_detail_ram.getValue()); _uservmDetailsDao.addDetail(vm.getId(), "memoryOvercommitRatio", cluster_detail_ram.getValue(), true);
} else if (_uservmDetailsDao.findDetail(vm.getId(), "cpuOvercommitRatio") != null) { } else if (_uservmDetailsDao.findDetail(vm.getId(), "cpuOvercommitRatio") != null) {
_uservmDetailsDao.addDetail(vm.getId(), "cpuOvercommitRatio", cluster_detail_cpu.getValue()); _uservmDetailsDao.addDetail(vm.getId(), "cpuOvercommitRatio", cluster_detail_cpu.getValue(), true);
_uservmDetailsDao.addDetail(vm.getId(), "memoryOvercommitRatio", cluster_detail_ram.getValue()); _uservmDetailsDao.addDetail(vm.getId(), "memoryOvercommitRatio", cluster_detail_ram.getValue(), true);
} }
vmProfile.setCpuOvercommitRatio(Float.parseFloat(cluster_detail_cpu.getValue())); vmProfile.setCpuOvercommitRatio(Float.parseFloat(cluster_detail_cpu.getValue()));
vmProfile.setMemoryOvercommitRatio(Float.parseFloat(cluster_detail_ram.getValue())); vmProfile.setMemoryOvercommitRatio(Float.parseFloat(cluster_detail_ram.getValue()));

View File

@ -48,10 +48,11 @@ public class DataCenterDetailVO implements ResourceDetail {
protected DataCenterDetailVO() { protected DataCenterDetailVO() {
} }
public DataCenterDetailVO(long dcId, String name, String value) { public DataCenterDetailVO(long dcId, String name, String value, boolean display) {
this.resourceId = dcId; this.resourceId = dcId;
this.name = name; this.name = name;
this.value = value; this.value = value;
this.display = display;
} }
@Override @Override

View File

@ -375,7 +375,7 @@ public class DataCenterDaoImpl extends GenericDaoBase<DataCenterVO, Long> implem
List<DataCenterDetailVO> resourceDetails = new ArrayList<DataCenterDetailVO>(); List<DataCenterDetailVO> resourceDetails = new ArrayList<DataCenterDetailVO>();
for (String key : details.keySet()) { for (String key : details.keySet()) {
resourceDetails.add(new DataCenterDetailVO(zone.getId(), key, details.get(key))); resourceDetails.add(new DataCenterDetailVO(zone.getId(), key, details.get(key), true));
} }
_detailsDao.saveDetails(resourceDetails); _detailsDao.saveDetails(resourceDetails);

View File

@ -41,8 +41,8 @@ public class DataCenterDetailsDaoImpl extends ResourceDetailsDaoBase<DataCenterD
} }
@Override @Override
public void addDetail(long resourceId, String key, String value) { public void addDetail(long resourceId, String key, String value, boolean display) {
super.addDetail(new DataCenterDetailVO(resourceId, key, value)); super.addDetail(new DataCenterDetailVO(resourceId, key, value, display));
} }
} }

View File

@ -48,10 +48,11 @@ public class NetworkDetailVO implements ResourceDetail {
public NetworkDetailVO() { public NetworkDetailVO() {
} }
public NetworkDetailVO(long networkId, String name, String value) { public NetworkDetailVO(long networkId, String name, String value, boolean display) {
this.resourceId = networkId; this.resourceId = networkId;
this.name = name; this.name = name;
this.value = value; this.value = value;
this.display = display;
} }
@Override @Override

View File

@ -27,8 +27,8 @@ import org.apache.cloudstack.resourcedetail.ResourceDetailsDaoBase;
public class NetworkDetailsDaoImpl extends ResourceDetailsDaoBase<NetworkDetailVO> implements NetworkDetailsDao { public class NetworkDetailsDaoImpl extends ResourceDetailsDaoBase<NetworkDetailVO> implements NetworkDetailsDao {
@Override @Override
public void addDetail(long resourceId, String key, String value) { public void addDetail(long resourceId, String key, String value, boolean display) {
super.addDetail(new NetworkDetailVO(resourceId, key, value)); super.addDetail(new NetworkDetailVO(resourceId, key, value, display));
} }
} }

View File

@ -48,10 +48,11 @@ public class ServiceOfferingDetailsVO implements ResourceDetail {
protected ServiceOfferingDetailsVO() { protected ServiceOfferingDetailsVO() {
} }
public ServiceOfferingDetailsVO(long serviceOfferingId, String name, String value) { public ServiceOfferingDetailsVO(long serviceOfferingId, String name, String value, boolean display) {
this.resourceId = serviceOfferingId; this.resourceId = serviceOfferingId;
this.name = name; this.name = name;
this.value = value; this.value = value;
this.display = display;
} }
@Override @Override

View File

@ -182,7 +182,7 @@ public class ServiceOfferingDaoImpl extends GenericDaoBase<ServiceOfferingVO, Lo
List<ServiceOfferingDetailsVO> resourceDetails = new ArrayList<ServiceOfferingDetailsVO>(); List<ServiceOfferingDetailsVO> resourceDetails = new ArrayList<ServiceOfferingDetailsVO>();
for (String key : details.keySet()) { for (String key : details.keySet()) {
resourceDetails.add(new ServiceOfferingDetailsVO(serviceOffering.getId(), key, details.get(key))); resourceDetails.add(new ServiceOfferingDetailsVO(serviceOffering.getId(), key, details.get(key), true));
} }
detailsDao.saveDetails(resourceDetails); detailsDao.saveDetails(resourceDetails);

View File

@ -29,8 +29,8 @@ import com.cloud.service.ServiceOfferingDetailsVO;
public class ServiceOfferingDetailsDaoImpl extends ResourceDetailsDaoBase<ServiceOfferingDetailsVO> implements ServiceOfferingDetailsDao { public class ServiceOfferingDetailsDaoImpl extends ResourceDetailsDaoBase<ServiceOfferingDetailsVO> implements ServiceOfferingDetailsDao {
@Override @Override
public void addDetail(long resourceId, String key, String value) { public void addDetail(long resourceId, String key, String value, boolean display) {
super.addDetail(new ServiceOfferingDetailsVO(resourceId, key, value)); super.addDetail(new ServiceOfferingDetailsVO(resourceId, key, value, display));
} }
} }

View File

@ -48,10 +48,11 @@ public class VMTemplateDetailVO implements ResourceDetail {
public VMTemplateDetailVO() { public VMTemplateDetailVO() {
} }
public VMTemplateDetailVO(long templateId, String name, String value) { public VMTemplateDetailVO(long templateId, String name, String value, boolean display) {
this.resourceId = templateId; this.resourceId = templateId;
this.name = name; this.name = name;
this.value = value; this.value = value;
this.display = display;
} }
@Override @Override

View File

@ -48,10 +48,11 @@ public class VolumeDetailVO implements ResourceDetail {
public VolumeDetailVO() { public VolumeDetailVO() {
} }
public VolumeDetailVO(long volumeId, String name, String value) { public VolumeDetailVO(long volumeId, String name, String value, boolean display) {
this.resourceId = volumeId; this.resourceId = volumeId;
this.name = name; this.name = name;
this.value = value; this.value = value;
this.display = display;
} }
@Override @Override

View File

@ -22,7 +22,7 @@ import org.apache.cloudstack.resourcedetail.ResourceDetailsDaoBase;
public class SnapshotDetailsDaoImpl extends ResourceDetailsDaoBase<SnapshotDetailsVO> implements SnapshotDetailsDao { public class SnapshotDetailsDaoImpl extends ResourceDetailsDaoBase<SnapshotDetailsVO> implements SnapshotDetailsDao {
@Override @Override
public void addDetail(long resourceId, String key, String value) { public void addDetail(long resourceId, String key, String value, boolean display) {
super.addDetail(new SnapshotDetailsVO(resourceId, key, value)); super.addDetail(new SnapshotDetailsVO(resourceId, key, value, display));
} }
} }

View File

@ -44,14 +44,17 @@ public class SnapshotDetailsVO implements ResourceDetail {
@Column(name = "value") @Column(name = "value")
String value; String value;
public SnapshotDetailsVO() { @Column(name = "display")
private boolean display;
public SnapshotDetailsVO() {
} }
public SnapshotDetailsVO(Long resourceId, String name, String value) { public SnapshotDetailsVO(Long resourceId, String name, String value, boolean display) {
this.resourceId = resourceId; this.resourceId = resourceId;
this.name = name; this.name = name;
this.value = value; this.value = value;
this.display = display;
} }
@Override @Override
@ -71,7 +74,7 @@ public class SnapshotDetailsVO implements ResourceDetail {
@Override @Override
public boolean isDisplay() { public boolean isDisplay() {
return false; return display;
} }
@Override @Override

View File

@ -43,7 +43,7 @@ public class StoragePoolDetailsDaoImpl extends ResourceDetailsDaoBase<StoragePoo
} }
@Override @Override
public void addDetail(long resourceId, String key, String value) { public void addDetail(long resourceId, String key, String value, boolean display) {
super.addDetail(new StoragePoolDetailVO(resourceId, key, value)); super.addDetail(new StoragePoolDetailVO(resourceId, key, value, display));
} }
} }

View File

@ -28,12 +28,10 @@ import javax.ejb.Local;
import javax.inject.Inject; import javax.inject.Inject;
import javax.naming.ConfigurationException; import javax.naming.ConfigurationException;
import com.cloud.template.VirtualMachineTemplate;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao; import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao;
import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreVO; import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreVO;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
import com.cloud.dc.dao.DataCenterDao; import com.cloud.dc.dao.DataCenterDao;
import com.cloud.domain.dao.DomainDao; import com.cloud.domain.dao.DomainDao;
@ -51,6 +49,7 @@ import com.cloud.storage.VMTemplateVO;
import com.cloud.storage.VMTemplateZoneVO; import com.cloud.storage.VMTemplateZoneVO;
import com.cloud.tags.ResourceTagVO; import com.cloud.tags.ResourceTagVO;
import com.cloud.tags.dao.ResourceTagDao; import com.cloud.tags.dao.ResourceTagDao;
import com.cloud.template.VirtualMachineTemplate;
import com.cloud.utils.db.DB; import com.cloud.utils.db.DB;
import com.cloud.utils.db.Filter; import com.cloud.utils.db.Filter;
import com.cloud.utils.db.GenericDaoBase; import com.cloud.utils.db.GenericDaoBase;
@ -416,7 +415,7 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
} }
List<VMTemplateDetailVO> details = new ArrayList<VMTemplateDetailVO>(); List<VMTemplateDetailVO> details = new ArrayList<VMTemplateDetailVO>();
for (String key : detailsStr.keySet()) { for (String key : detailsStr.keySet()) {
VMTemplateDetailVO detail = new VMTemplateDetailVO(tmpl.getId(), key, detailsStr.get(key)); VMTemplateDetailVO detail = new VMTemplateDetailVO(tmpl.getId(), key, detailsStr.get(key), true);
details.add(detail); details.add(detail);
} }
@ -752,7 +751,7 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
if (tmplt.getDetails() != null) { if (tmplt.getDetails() != null) {
List<VMTemplateDetailVO> details = new ArrayList<VMTemplateDetailVO>(); List<VMTemplateDetailVO> details = new ArrayList<VMTemplateDetailVO>();
for (String key : tmplt.getDetails().keySet()) { for (String key : tmplt.getDetails().keySet()) {
details.add(new VMTemplateDetailVO(tmplt.getId(), key, tmplt.getDetails().get(key))); details.add(new VMTemplateDetailVO(tmplt.getId(), key, tmplt.getDetails().get(key), true));
} }
_templateDetailsDao.saveDetails(details); _templateDetailsDao.saveDetails(details);
} }

View File

@ -29,7 +29,7 @@ import com.cloud.storage.VMTemplateDetailVO;
public class VMTemplateDetailsDaoImpl extends ResourceDetailsDaoBase<VMTemplateDetailVO> implements VMTemplateDetailsDao { public class VMTemplateDetailsDaoImpl extends ResourceDetailsDaoBase<VMTemplateDetailVO> implements VMTemplateDetailsDao {
@Override @Override
public void addDetail(long resourceId, String key, String value) { public void addDetail(long resourceId, String key, String value, boolean display) {
super.addDetail(new VMTemplateDetailVO(resourceId, key, value)); super.addDetail(new VMTemplateDetailVO(resourceId, key, value, display));
} }
} }

View File

@ -29,8 +29,8 @@ import com.cloud.storage.VolumeDetailVO;
public class VolumeDetailsDaoImpl extends ResourceDetailsDaoBase<VolumeDetailVO> implements VolumeDetailsDao { public class VolumeDetailsDaoImpl extends ResourceDetailsDaoBase<VolumeDetailVO> implements VolumeDetailsDao {
@Override @Override
public void addDetail(long resourceId, String key, String value) { public void addDetail(long resourceId, String key, String value, boolean display) {
super.addDetail(new VolumeDetailVO(resourceId, key, value)); super.addDetail(new VolumeDetailVO(resourceId, key, value, display));
} }
} }

View File

@ -48,10 +48,11 @@ public class NicDetailVO implements ResourceDetail {
public NicDetailVO() { public NicDetailVO() {
} }
public NicDetailVO(long nicId, String name, String value) { public NicDetailVO(long nicId, String name, String value, boolean display) {
this.resourceId = nicId; this.resourceId = nicId;
this.name = name; this.name = name;
this.value = value; this.value = value;
this.display = display;
} }
@Override @Override

View File

@ -48,10 +48,11 @@ public class UserVmDetailVO implements ResourceDetail {
public UserVmDetailVO() { public UserVmDetailVO() {
} }
public UserVmDetailVO(long vmId, String name, String value) { public UserVmDetailVO(long vmId, String name, String value, boolean display) {
this.resourceId = vmId; this.resourceId = vmId;
this.name = name; this.name = name;
this.value = value; this.value = value;
this.display = display;
} }
@Override @Override

View File

@ -29,7 +29,7 @@ import com.cloud.vm.NicDetailVO;
public class NicDetailsDaoImpl extends ResourceDetailsDaoBase<NicDetailVO> implements NicDetailsDao { public class NicDetailsDaoImpl extends ResourceDetailsDaoBase<NicDetailVO> implements NicDetailsDao {
@Override @Override
public void addDetail(long resourceId, String key, String value) { public void addDetail(long resourceId, String key, String value, boolean display) {
super.addDetail(new NicDetailVO(resourceId, key, value)); super.addDetail(new NicDetailVO(resourceId, key, value, display));
} }
} }

View File

@ -343,7 +343,7 @@ public class UserVmDaoImpl extends GenericDaoBase<UserVmVO, Long> implements Use
} }
List<UserVmDetailVO> details = new ArrayList<UserVmDetailVO>(); List<UserVmDetailVO> details = new ArrayList<UserVmDetailVO>();
for (String key : detailsStr.keySet()) { for (String key : detailsStr.keySet()) {
details.add(new UserVmDetailVO(vm.getId(), key, detailsStr.get(key))); details.add(new UserVmDetailVO(vm.getId(), key, detailsStr.get(key), true));
} }
_detailsDao.saveDetails(details); _detailsDao.saveDetails(details);

View File

@ -29,8 +29,8 @@ import com.cloud.vm.UserVmDetailVO;
public class UserVmDetailsDaoImpl extends ResourceDetailsDaoBase<UserVmDetailVO> implements UserVmDetailsDao { public class UserVmDetailsDaoImpl extends ResourceDetailsDaoBase<UserVmDetailVO> implements UserVmDetailsDao {
@Override @Override
public void addDetail(long resourceId, String key, String value) { public void addDetail(long resourceId, String key, String value, boolean display) {
super.addDetail(new UserVmDetailVO(resourceId, key, value)); super.addDetail(new UserVmDetailVO(resourceId, key, value, display));
} }
} }

View File

@ -44,14 +44,17 @@ public class VMSnapshotDetailsVO implements ResourceDetail {
@Column(name = "value") @Column(name = "value")
String value; String value;
public VMSnapshotDetailsVO() { @Column(name = "display")
private boolean display;
public VMSnapshotDetailsVO() {
} }
public VMSnapshotDetailsVO(long vmSnapshotId, String name, String value) { public VMSnapshotDetailsVO(long vmSnapshotId, String name, String value, boolean display) {
this.resourceId = vmSnapshotId; this.resourceId = vmSnapshotId;
this.name = name; this.name = name;
this.value = value; this.value = value;
this.display = display;
} }
@Override @Override
@ -76,6 +79,6 @@ public class VMSnapshotDetailsVO implements ResourceDetail {
@Override @Override
public boolean isDisplay() { public boolean isDisplay() {
return false; return display;
} }
} }

View File

@ -25,7 +25,7 @@ import com.cloud.vm.snapshot.VMSnapshotDetailsVO;
public class VMSnapshotDetailsDaoImpl extends ResourceDetailsDaoBase<VMSnapshotDetailsVO> implements VMSnapshotDetailsDao { public class VMSnapshotDetailsDaoImpl extends ResourceDetailsDaoBase<VMSnapshotDetailsVO> implements VMSnapshotDetailsDao {
@Override @Override
public void addDetail(long resourceId, String key, String value) { public void addDetail(long resourceId, String key, String value, boolean display) {
super.addDetail(new VMSnapshotDetailsVO(resourceId, key, value)); super.addDetail(new VMSnapshotDetailsVO(resourceId, key, value, display));
} }
} }

View File

@ -48,10 +48,11 @@ public class AutoScaleVmGroupDetailVO implements ResourceDetail {
public AutoScaleVmGroupDetailVO() { public AutoScaleVmGroupDetailVO() {
} }
public AutoScaleVmGroupDetailVO(long id, String name, String value) { public AutoScaleVmGroupDetailVO(long id, String name, String value, boolean display) {
this.resourceId = id; this.resourceId = id;
this.name = name; this.name = name;
this.value = value; this.value = value;
this.display = display;
} }
@Override @Override

View File

@ -48,10 +48,11 @@ public class AutoScaleVmProfileDetailVO implements ResourceDetail {
public AutoScaleVmProfileDetailVO() { public AutoScaleVmProfileDetailVO() {
} }
public AutoScaleVmProfileDetailVO(long id, String name, String value) { public AutoScaleVmProfileDetailVO(long id, String name, String value, boolean display) {
this.resourceId = id; this.resourceId = id;
this.name = name; this.name = name;
this.value = value; this.value = value;
this.display = display;
} }
@Override @Override

View File

@ -48,10 +48,11 @@ public class DiskOfferingDetailVO implements ResourceDetail {
public DiskOfferingDetailVO() { public DiskOfferingDetailVO() {
} }
public DiskOfferingDetailVO(long id, String name, String value) { public DiskOfferingDetailVO(long id, String name, String value, boolean display) {
this.resourceId = id; this.resourceId = id;
this.name = name; this.name = name;
this.value = value; this.value = value;
this.display = display;
} }
@Override @Override

View File

@ -48,10 +48,11 @@ public class FirewallRuleDetailVO implements ResourceDetail {
public FirewallRuleDetailVO() { public FirewallRuleDetailVO() {
} }
public FirewallRuleDetailVO(long id, String name, String value) { public FirewallRuleDetailVO(long id, String name, String value, boolean display) {
this.resourceId = id; this.resourceId = id;
this.name = name; this.name = name;
this.value = value; this.value = value;
this.display = display;
} }
@Override @Override

View File

@ -48,10 +48,11 @@ public class NetworkACLItemDetailVO implements ResourceDetail {
public NetworkACLItemDetailVO() { public NetworkACLItemDetailVO() {
} }
public NetworkACLItemDetailVO(long id, String name, String value) { public NetworkACLItemDetailVO(long id, String name, String value, boolean display) {
this.resourceId = id; this.resourceId = id;
this.name = name; this.name = name;
this.value = value; this.value = value;
this.display = display;
} }
@Override @Override

View File

@ -48,10 +48,11 @@ public class NetworkACLListDetailVO implements ResourceDetail {
public NetworkACLListDetailVO() { public NetworkACLListDetailVO() {
} }
public NetworkACLListDetailVO(long id, String name, String value) { public NetworkACLListDetailVO(long id, String name, String value, boolean display) {
this.resourceId = id; this.resourceId = id;
this.name = name; this.name = name;
this.value = value; this.value = value;
this.display = display;
} }
@Override @Override

View File

@ -48,10 +48,11 @@ public class RemoteAccessVpnDetailVO implements ResourceDetail {
public RemoteAccessVpnDetailVO() { public RemoteAccessVpnDetailVO() {
} }
public RemoteAccessVpnDetailVO(long id, String name, String value) { public RemoteAccessVpnDetailVO(long id, String name, String value, boolean display) {
this.resourceId = id; this.resourceId = id;
this.name = name; this.name = name;
this.value = value; this.value = value;
this.display = display;
} }
@Override @Override

View File

@ -66,6 +66,6 @@ public interface ResourceDetailsDao<R extends ResourceDetail> extends GenericDao
public void saveDetails(List<R> details); public void saveDetails(List<R> details);
public void addDetail(long resourceId, String key, String value); public void addDetail(long resourceId, String key, String value, boolean display);
} }

View File

@ -48,10 +48,11 @@ public class Site2SiteCustomerGatewayDetailVO implements ResourceDetail {
public Site2SiteCustomerGatewayDetailVO() { public Site2SiteCustomerGatewayDetailVO() {
} }
public Site2SiteCustomerGatewayDetailVO(long id, String name, String value) { public Site2SiteCustomerGatewayDetailVO(long id, String name, String value, boolean display) {
this.resourceId = id; this.resourceId = id;
this.name = name; this.name = name;
this.value = value; this.value = value;
this.display = display;
} }
@Override @Override

View File

@ -48,10 +48,11 @@ public class Site2SiteVpnConnectionDetailVO implements ResourceDetail {
public Site2SiteVpnConnectionDetailVO() { public Site2SiteVpnConnectionDetailVO() {
} }
public Site2SiteVpnConnectionDetailVO(long id, String name, String value) { public Site2SiteVpnConnectionDetailVO(long id, String name, String value, boolean display) {
this.resourceId = id; this.resourceId = id;
this.name = name; this.name = name;
this.value = value; this.value = value;
this.display = display;
} }
@Override @Override

View File

@ -48,10 +48,11 @@ public class Site2SiteVpnGatewayDetailVO implements ResourceDetail {
public Site2SiteVpnGatewayDetailVO() { public Site2SiteVpnGatewayDetailVO() {
} }
public Site2SiteVpnGatewayDetailVO(long id, String name, String value) { public Site2SiteVpnGatewayDetailVO(long id, String name, String value, boolean display) {
this.resourceId = id; this.resourceId = id;
this.name = name; this.name = name;
this.value = value; this.value = value;
this.display = display;
} }
@Override @Override

View File

@ -48,10 +48,11 @@ public class UserIpAddressDetailVO implements ResourceDetail {
public UserIpAddressDetailVO() { public UserIpAddressDetailVO() {
} }
public UserIpAddressDetailVO(long id, String name, String value) { public UserIpAddressDetailVO(long id, String name, String value, boolean display) {
this.resourceId = id; this.resourceId = id;
this.name = name; this.name = name;
this.value = value; this.value = value;
this.display = display;
} }
@Override @Override

View File

@ -48,10 +48,11 @@ public class VpcDetailVO implements ResourceDetail {
public VpcDetailVO() { public VpcDetailVO() {
} }
public VpcDetailVO(long id, String name, String value) { public VpcDetailVO(long id, String name, String value, boolean display) {
this.resourceId = id; this.resourceId = id;
this.name = name; this.name = name;
this.value = value; this.value = value;
this.display = display;
} }
@Override @Override

View File

@ -48,10 +48,11 @@ public class VpcGatewayDetailVO implements ResourceDetail {
public VpcGatewayDetailVO() { public VpcGatewayDetailVO() {
} }
public VpcGatewayDetailVO(long id, String name, String value) { public VpcGatewayDetailVO(long id, String name, String value, boolean display) {
this.resourceId = id; this.resourceId = id;
this.name = name; this.name = name;
this.value = value; this.value = value;
this.display = display;
} }
@Override @Override

View File

@ -27,7 +27,7 @@ import org.springframework.stereotype.Component;
public class AutoScaleVmGroupDetailsDaoImpl extends ResourceDetailsDaoBase<AutoScaleVmGroupDetailVO> implements AutoScaleVmGroupDetailsDao { public class AutoScaleVmGroupDetailsDaoImpl extends ResourceDetailsDaoBase<AutoScaleVmGroupDetailVO> implements AutoScaleVmGroupDetailsDao {
@Override @Override
public void addDetail(long resourceId, String key, String value) { public void addDetail(long resourceId, String key, String value, boolean display) {
super.addDetail(new AutoScaleVmGroupDetailVO(resourceId, key, value)); super.addDetail(new AutoScaleVmGroupDetailVO(resourceId, key, value, display));
} }
} }

View File

@ -27,7 +27,7 @@ import org.springframework.stereotype.Component;
public class AutoScaleVmProfileDetailsDaoImpl extends ResourceDetailsDaoBase<AutoScaleVmProfileDetailVO> implements AutoScaleVmProfileDetailsDao { public class AutoScaleVmProfileDetailsDaoImpl extends ResourceDetailsDaoBase<AutoScaleVmProfileDetailVO> implements AutoScaleVmProfileDetailsDao {
@Override @Override
public void addDetail(long resourceId, String key, String value) { public void addDetail(long resourceId, String key, String value, boolean display) {
super.addDetail(new AutoScaleVmProfileDetailVO(resourceId, key, value)); super.addDetail(new AutoScaleVmProfileDetailVO(resourceId, key, value, display));
} }
} }

View File

@ -27,7 +27,7 @@ import org.springframework.stereotype.Component;
public class DiskOfferingDetailsDaoImpl extends ResourceDetailsDaoBase<DiskOfferingDetailVO> implements DiskOfferingDetailsDao { public class DiskOfferingDetailsDaoImpl extends ResourceDetailsDaoBase<DiskOfferingDetailVO> implements DiskOfferingDetailsDao {
@Override @Override
public void addDetail(long resourceId, String key, String value) { public void addDetail(long resourceId, String key, String value, boolean display) {
super.addDetail(new DiskOfferingDetailVO(resourceId, key, value)); super.addDetail(new DiskOfferingDetailVO(resourceId, key, value, display));
} }
} }

View File

@ -28,7 +28,7 @@ import org.apache.cloudstack.resourcedetail.ResourceDetailsDaoBase;
public class FirewallRuleDetailsDaoImpl extends ResourceDetailsDaoBase<FirewallRuleDetailVO> implements FirewallRuleDetailsDao { public class FirewallRuleDetailsDaoImpl extends ResourceDetailsDaoBase<FirewallRuleDetailVO> implements FirewallRuleDetailsDao {
@Override @Override
public void addDetail(long resourceId, String key, String value) { public void addDetail(long resourceId, String key, String value, boolean display) {
super.addDetail(new FirewallRuleDetailVO(resourceId, key, value)); super.addDetail(new FirewallRuleDetailVO(resourceId, key, value, display));
} }
} }

View File

@ -28,7 +28,7 @@ import org.apache.cloudstack.resourcedetail.ResourceDetailsDaoBase;
public class NetworkACLItemDetailsDaoImpl extends ResourceDetailsDaoBase<NetworkACLItemDetailVO> implements NetworkACLItemDetailsDao { public class NetworkACLItemDetailsDaoImpl extends ResourceDetailsDaoBase<NetworkACLItemDetailVO> implements NetworkACLItemDetailsDao {
@Override @Override
public void addDetail(long resourceId, String key, String value) { public void addDetail(long resourceId, String key, String value, boolean display) {
super.addDetail(new NetworkACLItemDetailVO(resourceId, key, value)); super.addDetail(new NetworkACLItemDetailVO(resourceId, key, value, display));
} }
} }

View File

@ -28,7 +28,7 @@ import org.apache.cloudstack.resourcedetail.ResourceDetailsDaoBase;
public class NetworkACLListDetailsDaoImpl extends ResourceDetailsDaoBase<NetworkACLListDetailVO> implements NetworkACLListDetailsDao { public class NetworkACLListDetailsDaoImpl extends ResourceDetailsDaoBase<NetworkACLListDetailVO> implements NetworkACLListDetailsDao {
@Override @Override
public void addDetail(long resourceId, String key, String value) { public void addDetail(long resourceId, String key, String value, boolean display) {
super.addDetail(new NetworkACLListDetailVO(resourceId, key, value)); super.addDetail(new NetworkACLListDetailVO(resourceId, key, value, display));
} }
} }

View File

@ -28,7 +28,7 @@ import org.apache.cloudstack.resourcedetail.ResourceDetailsDaoBase;
public class RemoteAccessVpnDetailsDaoImpl extends ResourceDetailsDaoBase<RemoteAccessVpnDetailVO> implements RemoteAccessVpnDetailsDao { public class RemoteAccessVpnDetailsDaoImpl extends ResourceDetailsDaoBase<RemoteAccessVpnDetailVO> implements RemoteAccessVpnDetailsDao {
@Override @Override
public void addDetail(long resourceId, String key, String value) { public void addDetail(long resourceId, String key, String value, boolean display) {
super.addDetail(new RemoteAccessVpnDetailVO(resourceId, key, value)); super.addDetail(new RemoteAccessVpnDetailVO(resourceId, key, value, display));
} }
} }

View File

@ -28,7 +28,7 @@ import org.apache.cloudstack.resourcedetail.Site2SiteCustomerGatewayDetailVO;
public class Site2SiteCustomerGatewayDetailsDaoImpl extends ResourceDetailsDaoBase<Site2SiteCustomerGatewayDetailVO> implements Site2SiteCustomerGatewayDetailsDao { public class Site2SiteCustomerGatewayDetailsDaoImpl extends ResourceDetailsDaoBase<Site2SiteCustomerGatewayDetailVO> implements Site2SiteCustomerGatewayDetailsDao {
@Override @Override
public void addDetail(long resourceId, String key, String value) { public void addDetail(long resourceId, String key, String value, boolean display) {
super.addDetail(new Site2SiteCustomerGatewayDetailVO(resourceId, key, value)); super.addDetail(new Site2SiteCustomerGatewayDetailVO(resourceId, key, value, display));
} }
} }

View File

@ -26,7 +26,7 @@ import org.springframework.stereotype.Component;
public class Site2SiteVpnConnectionDetailsDaoImpl extends ResourceDetailsDaoBase<Site2SiteVpnConnectionDetailVO> implements Site2SiteVpnConnectionDetailsDao { public class Site2SiteVpnConnectionDetailsDaoImpl extends ResourceDetailsDaoBase<Site2SiteVpnConnectionDetailVO> implements Site2SiteVpnConnectionDetailsDao {
@Override @Override
public void addDetail(long resourceId, String key, String value) { public void addDetail(long resourceId, String key, String value, boolean display) {
super.addDetail(new Site2SiteVpnConnectionDetailVO(resourceId, key, value)); super.addDetail(new Site2SiteVpnConnectionDetailVO(resourceId, key, value, display));
} }
} }

View File

@ -28,7 +28,7 @@ import org.apache.cloudstack.resourcedetail.Site2SiteVpnGatewayDetailVO;
public class Site2SiteVpnGatewayDetailsDaoImpl extends ResourceDetailsDaoBase<Site2SiteVpnGatewayDetailVO> implements Site2SiteVpnGatewayDetailsDao { public class Site2SiteVpnGatewayDetailsDaoImpl extends ResourceDetailsDaoBase<Site2SiteVpnGatewayDetailVO> implements Site2SiteVpnGatewayDetailsDao {
@Override @Override
public void addDetail(long resourceId, String key, String value) { public void addDetail(long resourceId, String key, String value, boolean display) {
super.addDetail(new Site2SiteVpnGatewayDetailVO(resourceId, key, value)); super.addDetail(new Site2SiteVpnGatewayDetailVO(resourceId, key, value, display));
} }
} }

View File

@ -27,7 +27,7 @@ import org.springframework.stereotype.Component;
public class UserDetailsDaoImpl extends ResourceDetailsDaoBase<UserDetailVO> implements UserDetailsDao { public class UserDetailsDaoImpl extends ResourceDetailsDaoBase<UserDetailVO> implements UserDetailsDao {
@Override @Override
public void addDetail(long resourceId, String key, String value) { public void addDetail(long resourceId, String key, String value, boolean display) {
super.addDetail(new UserDetailVO(resourceId, key, value)); super.addDetail(new UserDetailVO(resourceId, key, value));
} }
} }

View File

@ -28,7 +28,7 @@ import org.apache.cloudstack.resourcedetail.UserIpAddressDetailVO;
public class UserIpAddressDetailsDaoImpl extends ResourceDetailsDaoBase<UserIpAddressDetailVO> implements UserIpAddressDetailsDao { public class UserIpAddressDetailsDaoImpl extends ResourceDetailsDaoBase<UserIpAddressDetailVO> implements UserIpAddressDetailsDao {
@Override @Override
public void addDetail(long resourceId, String key, String value) { public void addDetail(long resourceId, String key, String value, boolean display) {
super.addDetail(new UserIpAddressDetailVO(resourceId, key, value)); super.addDetail(new UserIpAddressDetailVO(resourceId, key, value, display));
} }
} }

View File

@ -28,7 +28,7 @@ import org.apache.cloudstack.resourcedetail.VpcDetailVO;
public class VpcDetailsDaoImpl extends ResourceDetailsDaoBase<VpcDetailVO> implements VpcDetailsDao { public class VpcDetailsDaoImpl extends ResourceDetailsDaoBase<VpcDetailVO> implements VpcDetailsDao {
@Override @Override
public void addDetail(long resourceId, String key, String value) { public void addDetail(long resourceId, String key, String value, boolean display) {
super.addDetail(new VpcDetailVO(resourceId, key, value)); super.addDetail(new VpcDetailVO(resourceId, key, value, display));
} }
} }

View File

@ -28,7 +28,7 @@ import org.apache.cloudstack.resourcedetail.VpcGatewayDetailVO;
public class VpcGatewayDetailsDaoImpl extends ResourceDetailsDaoBase<VpcGatewayDetailVO> implements VpcGatewayDetailsDao { public class VpcGatewayDetailsDaoImpl extends ResourceDetailsDaoBase<VpcGatewayDetailVO> implements VpcGatewayDetailsDao {
@Override @Override
public void addDetail(long resourceId, String key, String value) { public void addDetail(long resourceId, String key, String value, boolean display) {
super.addDetail(new VpcGatewayDetailVO(resourceId, key, value)); super.addDetail(new VpcGatewayDetailVO(resourceId, key, value, display));
} }
} }

View File

@ -232,7 +232,7 @@ public class PrimaryDataStoreDaoImpl extends GenericDaoBase<StoragePoolVO, Long>
pool = super.persist(pool); pool = super.persist(pool);
if (details != null) { if (details != null) {
for (Map.Entry<String, String> detail : details.entrySet()) { for (Map.Entry<String, String> detail : details.entrySet()) {
StoragePoolDetailVO vo = new StoragePoolDetailVO(pool.getId(), detail.getKey(), detail.getValue()); StoragePoolDetailVO vo = new StoragePoolDetailVO(pool.getId(), detail.getKey(), detail.getValue(), true);
_detailsDao.persist(vo); _detailsDao.persist(vo);
} }
} }
@ -388,7 +388,7 @@ public class PrimaryDataStoreDaoImpl extends GenericDaoBase<StoragePoolVO, Long>
if (details != null) { if (details != null) {
List<StoragePoolDetailVO> detailsVO = new ArrayList<StoragePoolDetailVO>(); List<StoragePoolDetailVO> detailsVO = new ArrayList<StoragePoolDetailVO>();
for (String key : details.keySet()) { for (String key : details.keySet()) {
detailsVO.add(new StoragePoolDetailVO(poolId, key, details.get(key))); detailsVO.add(new StoragePoolDetailVO(poolId, key, details.get(key), true));
} }
_detailsDao.saveDetails(detailsVO); _detailsDao.saveDetails(detailsVO);
} }

View File

@ -45,10 +45,11 @@ public class PrimaryDataStoreDetailVO implements ResourceDetail {
@Column(name = "display") @Column(name = "display")
private boolean display; private boolean display;
public PrimaryDataStoreDetailVO(long poolId, String name, String value) { public PrimaryDataStoreDetailVO(long poolId, String name, String value, boolean display) {
this.resourceId = poolId; this.resourceId = poolId;
this.name = name; this.name = name;
this.value = value; this.value = value;
this.display = display;
} }
protected PrimaryDataStoreDetailVO() { protected PrimaryDataStoreDetailVO() {

View File

@ -45,10 +45,11 @@ public class StoragePoolDetailVO implements ResourceDetail {
@Column(name = "display") @Column(name = "display")
private boolean display; private boolean display;
public StoragePoolDetailVO(long poolId, String name, String value) { public StoragePoolDetailVO(long poolId, String name, String value, boolean display) {
this.resourceId = poolId; this.resourceId = poolId;
this.name = name; this.name = name;
this.value = value; this.value = value;
this.display = display;
} }
public StoragePoolDetailVO() { public StoragePoolDetailVO() {

View File

@ -41,7 +41,7 @@ public class VmSnapshotDaoTest extends CloudStackTestNGBase {
@Test @Test
public void testVmSnapshotDetails() { public void testVmSnapshotDetails() {
VMSnapshotDetailsVO detailsVO = new VMSnapshotDetailsVO(1L, "test", "foo"); VMSnapshotDetailsVO detailsVO = new VMSnapshotDetailsVO(1L, "test", "foo", display);
vmsnapshotDetailsDao.persist(detailsVO); vmsnapshotDetailsDao.persist(detailsVO);
Map<String, String> details = vmsnapshotDetailsDao.listDetailsKeyPairs(1L); Map<String, String> details = vmsnapshotDetailsDao.listDetailsKeyPairs(1L);
Assert.assertTrue(details.containsKey("test")); Assert.assertTrue(details.containsKey("test"));

View File

@ -251,7 +251,7 @@ public class StorageAllocatorTest {
public void testClusterAllocatorWithTags() { public void testClusterAllocatorWithTags() {
try { try {
createDb(); createDb();
StoragePoolDetailVO detailVO = new StoragePoolDetailVO(this.storagePoolId, "high", "true"); StoragePoolDetailVO detailVO = new StoragePoolDetailVO(this.storagePoolId, "high", "true", display);
poolDetailsDao.persist(detailVO); poolDetailsDao.persist(detailVO);
DiskOfferingVO diskOff = this.diskOfferingDao.findById(diskOffering.getId()); DiskOfferingVO diskOff = this.diskOfferingDao.findById(diskOffering.getId());
List<String> tags = new ArrayList<String>(); List<String> tags = new ArrayList<String>();
@ -285,7 +285,7 @@ public class StorageAllocatorTest {
public void testClusterAllocatorWithWrongTag() { public void testClusterAllocatorWithWrongTag() {
try { try {
createDb(); createDb();
StoragePoolDetailVO detailVO = new StoragePoolDetailVO(this.storagePoolId, "high", "true"); StoragePoolDetailVO detailVO = new StoragePoolDetailVO(this.storagePoolId, "high", "true", display);
poolDetailsDao.persist(detailVO); poolDetailsDao.persist(detailVO);
DiskOfferingVO diskOff = this.diskOfferingDao.findById(diskOffering.getId()); DiskOfferingVO diskOff = this.diskOfferingDao.findById(diskOffering.getId());
List<String> tags = new ArrayList<String>(); List<String> tags = new ArrayList<String>();

View File

@ -26,8 +26,8 @@ import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDetailsDao;
public class PrimaryDataStoreDetailsDaoImpl extends ResourceDetailsDaoBase<PrimaryDataStoreDetailVO> implements PrimaryDataStoreDetailsDao { public class PrimaryDataStoreDetailsDaoImpl extends ResourceDetailsDaoBase<PrimaryDataStoreDetailVO> implements PrimaryDataStoreDetailsDao {
@Override @Override
public void addDetail(long resourceId, String key, String value) { public void addDetail(long resourceId, String key, String value, boolean display) {
super.addDetail(new PrimaryDataStoreDetailVO(resourceId, key, value)); super.addDetail(new PrimaryDataStoreDetailVO(resourceId, key, value, display));
} }
} }

View File

@ -45,6 +45,7 @@ public class EntityManagerImpl extends ManagerBase implements EntityManager {
return dao.findById(id); return dao.findById(id);
} }
@Override
public <T, K extends Serializable> T findByIdIncludingRemoved(Class<T> entityType, K id) { public <T, K extends Serializable> T findByIdIncludingRemoved(Class<T> entityType, K id) {
GenericDao<? extends T, K> dao = (GenericDao<? extends T, K>)GenericDaoBase.getDao(entityType); GenericDao<? extends T, K> dao = (GenericDao<? extends T, K>)GenericDaoBase.getDao(entityType);
return dao.findByIdIncludingRemoved(id); return dao.findByIdIncludingRemoved(id);

View File

@ -3228,7 +3228,10 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
Boolean forDisplay = cmd.forDisplay(); Boolean forDisplay = cmd.forDisplay();
ResourceTag.ResourceObjectType resourceType = cmd.getResourceType(); ResourceTag.ResourceObjectType resourceType = cmd.getResourceType();
String resourceIdStr = cmd.getResourceId(); String resourceIdStr = cmd.getResourceId();
long resourceId = _taggedResourceMgr.getResourceId(resourceIdStr, resourceType); Long resourceId = null;
if (resourceIdStr != null) {
resourceId = _taggedResourceMgr.getResourceId(resourceIdStr, resourceType);
}
List<? extends ResourceDetail> detailList = new ArrayList<ResourceDetail>(); List<? extends ResourceDetail> detailList = new ArrayList<ResourceDetail>();
ResourceDetail requestedDetail = null; ResourceDetail requestedDetail = null;

View File

@ -208,7 +208,7 @@ public class VolumeJoinDaoImpl extends GenericDaoBase<VolumeJoinVO, Long> implem
} }
volResponse.setExtractable(isExtractable); volResponse.setExtractable(isExtractable);
volResponse.setDisplayVm(volume.isDisplayVolume()); volResponse.setDisplayVolume(volume.isDisplayVolume());
// set async job // set async job
if (volume.getJobId() != null) { if (volume.getJobId() != null) {

View File

@ -36,8 +36,6 @@ import javax.ejb.Local;
import javax.inject.Inject; import javax.inject.Inject;
import javax.naming.ConfigurationException; import javax.naming.ConfigurationException;
import org.apache.log4j.Logger;
import org.apache.cloudstack.acl.SecurityChecker; import org.apache.cloudstack.acl.SecurityChecker;
import org.apache.cloudstack.affinity.AffinityGroup; import org.apache.cloudstack.affinity.AffinityGroup;
import org.apache.cloudstack.affinity.AffinityGroupService; import org.apache.cloudstack.affinity.AffinityGroupService;
@ -85,6 +83,7 @@ import org.apache.cloudstack.region.dao.RegionDao;
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao; import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao;
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
import org.apache.log4j.Logger;
import com.cloud.alert.AlertManager; import com.cloud.alert.AlertManager;
import com.cloud.api.ApiDBUtils; import com.cloud.api.ApiDBUtils;
@ -443,7 +442,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
if (zone == null) { if (zone == null) {
throw new InvalidParameterValueException("unable to find zone by id " + resourceId); throw new InvalidParameterValueException("unable to find zone by id " + resourceId);
} }
_dcDetailsDao.addDetail(resourceId, name, value); _dcDetailsDao.addDetail(resourceId, name, value, true);
break; break;
case Cluster: case Cluster:
ClusterVO cluster = _clusterDao.findById(resourceId); ClusterVO cluster = _clusterDao.findById(resourceId);
@ -465,7 +464,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
if (pool == null) { if (pool == null) {
throw new InvalidParameterValueException("unable to find storage pool by id " + resourceId); throw new InvalidParameterValueException("unable to find storage pool by id " + resourceId);
} }
_storagePoolDetailsDao.addDetail(resourceId, name, value); _storagePoolDetailsDao.addDetail(resourceId, name, value, true);
break; break;
@ -2039,7 +2038,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
if (details != null) { if (details != null) {
List<ServiceOfferingDetailsVO> detailsVO = new ArrayList<ServiceOfferingDetailsVO>(); List<ServiceOfferingDetailsVO> detailsVO = new ArrayList<ServiceOfferingDetailsVO>();
for (Entry<String, String> detailEntry : details.entrySet()) { for (Entry<String, String> detailEntry : details.entrySet()) {
detailsVO.add(new ServiceOfferingDetailsVO(offering.getId(), detailEntry.getKey(), detailEntry.getValue())); detailsVO.add(new ServiceOfferingDetailsVO(offering.getId(), detailEntry.getKey(), detailEntry.getValue(), true));
} }
_serviceOfferingDetailsDao.saveDetails(detailsVO); _serviceOfferingDetailsDao.saveDetails(detailsVO);

View File

@ -159,7 +159,7 @@ public class ResourceMetaDataManagerImpl extends ManagerBase implements Resource
@Override @Override
@DB @DB
@ActionEvent(eventType = EventTypes.EVENT_RESOURCE_DETAILS_CREATE, eventDescription = "creating resource meta data") @ActionEvent(eventType = EventTypes.EVENT_RESOURCE_DETAILS_CREATE, eventDescription = "creating resource meta data")
public boolean addResourceMetaData(final String resourceId, final ResourceObjectType resourceType, final Map<String, String> details) { public boolean addResourceMetaData(final String resourceId, final ResourceObjectType resourceType, final Map<String, String> details, final boolean forDisplay) {
return Transaction.execute(new TransactionCallback<Boolean>() { return Transaction.execute(new TransactionCallback<Boolean>() {
@Override @Override
public Boolean doInTransaction(TransactionStatus status) { public Boolean doInTransaction(TransactionStatus status) {
@ -171,7 +171,7 @@ public class ResourceMetaDataManagerImpl extends ManagerBase implements Resource
} }
DetailDaoHelper newDetailDaoHelper = new DetailDaoHelper(resourceType); DetailDaoHelper newDetailDaoHelper = new DetailDaoHelper(resourceType);
newDetailDaoHelper.addDetail(_taggedResourceMgr.getResourceId(resourceId, resourceType), key, value); newDetailDaoHelper.addDetail(_taggedResourceMgr.getResourceId(resourceId, resourceType), key, value, forDisplay);
} }
return true; return true;
@ -215,8 +215,8 @@ public class ResourceMetaDataManagerImpl extends ManagerBase implements Resource
return dao.findDetail(resourceId, key); return dao.findDetail(resourceId, key);
} }
private void addDetail(long resourceId, String key, String value) { private void addDetail(long resourceId, String key, String value, boolean forDisplay) {
dao.addDetail(resourceId, key, value); dao.addDetail(resourceId, key, value, forDisplay);
} }
private Map<String, String> getDetailsMap(long resourceId, Boolean forDisplay) { private Map<String, String> getDetailsMap(long resourceId, Boolean forDisplay) {

View File

@ -1431,7 +1431,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
details.put(UsageEventVO.DynamicParameters.memory.name(), serviceOffering.getRamSize().toString()); details.put(UsageEventVO.DynamicParameters.memory.name(), serviceOffering.getRamSize().toString());
List<UserVmDetailVO> detailList = new ArrayList<UserVmDetailVO>(); List<UserVmDetailVO> detailList = new ArrayList<UserVmDetailVO>();
for (String key : details.keySet()) { for (String key : details.keySet()) {
UserVmDetailVO detailVO = new UserVmDetailVO(vmId, key, details.get(key)); UserVmDetailVO detailVO = new UserVmDetailVO(vmId, key, details.get(key), true);
detailList.add(detailVO); detailList.add(detailVO);
} }
_uservmDetailsDao.saveDetails(detailList); _uservmDetailsDao.saveDetails(detailList);
@ -1445,7 +1445,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
details.remove(UsageEventVO.DynamicParameters.memory.name()); details.remove(UsageEventVO.DynamicParameters.memory.name());
List<UserVmDetailVO> detailList = new ArrayList<UserVmDetailVO>(); List<UserVmDetailVO> detailList = new ArrayList<UserVmDetailVO>();
for (String key : details.keySet()) { for (String key : details.keySet()) {
UserVmDetailVO detailVO = new UserVmDetailVO(vmId, key, details.get(key)); UserVmDetailVO detailVO = new UserVmDetailVO(vmId, key, details.get(key), true);
detailList.add(detailVO); detailList.add(detailVO);
} }
_uservmDetailsDao.saveDetails(detailList); _uservmDetailsDao.saveDetails(detailList);

View File

@ -89,7 +89,7 @@ public class ResourceMetaDataManagerTest {
doNothing().when(_nicDetailDao).removeDetail(anyLong(), anyString()); doNothing().when(_nicDetailDao).removeDetail(anyLong(), anyString());
Map<String, String> map = new HashedMap(); Map<String, String> map = new HashedMap();
map.put("key", "value"); map.put("key", "value");
_resourceMetaDataMgr.addResourceMetaData("1", ResourceTag.ResourceObjectType.Volume, map); _resourceMetaDataMgr.addResourceMetaData("1", ResourceTag.ResourceObjectType.Volume, map, true);
} }

View File

@ -224,7 +224,7 @@ CREATE TABLE `cloud`.`user_details` (
`user_id` bigint unsigned NOT NULL COMMENT 'VPC gateway id', `user_id` bigint unsigned NOT NULL COMMENT 'VPC gateway id',
`name` varchar(255) NOT NULL, `name` varchar(255) NOT NULL,
`value` varchar(1024) NOT NULL, `value` varchar(1024) NOT NULL,
`display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end user', `display` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the detail can be displayed to the end user',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
CONSTRAINT `fk_user_details__user_id` FOREIGN KEY `fk_user_details__user_id`(`user_id`) REFERENCES `user`(`id`) ON DELETE CASCADE CONSTRAINT `fk_user_details__user_id` FOREIGN KEY `fk_user_details__user_id`(`user_id`) REFERENCES `user`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@ -453,7 +453,7 @@ CREATE TABLE `cloud`.`autoscale_vmprofile_details` (
`autoscale_vmprofile_id` bigint unsigned NOT NULL COMMENT 'VPC gateway id', `autoscale_vmprofile_id` bigint unsigned NOT NULL COMMENT 'VPC gateway id',
`name` varchar(255) NOT NULL, `name` varchar(255) NOT NULL,
`value` varchar(1024) NOT NULL, `value` varchar(1024) NOT NULL,
`display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end autoscale_vmprofile', `display` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the detail can be displayed to the end user',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
CONSTRAINT `fk_autoscale_vmprofile_details__autoscale_vmprofile_id` FOREIGN KEY `fk_autoscale_vmprofile_details__autoscale_vmprofile_id`(`autoscale_vmprofile_id`) REFERENCES `autoscale_vmprofiles`(`id`) ON DELETE CASCADE CONSTRAINT `fk_autoscale_vmprofile_details__autoscale_vmprofile_id` FOREIGN KEY `fk_autoscale_vmprofile_details__autoscale_vmprofile_id`(`autoscale_vmprofile_id`) REFERENCES `autoscale_vmprofiles`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@ -463,7 +463,67 @@ CREATE TABLE `cloud`.`autoscale_vmgroup_details` (
`autoscale_vmgroup_id` bigint unsigned NOT NULL COMMENT 'VPC gateway id', `autoscale_vmgroup_id` bigint unsigned NOT NULL COMMENT 'VPC gateway id',
`name` varchar(255) NOT NULL, `name` varchar(255) NOT NULL,
`value` varchar(1024) NOT NULL, `value` varchar(1024) NOT NULL,
`display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end autoscale_vmgroup', `display` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the detail can be displayed to the end user',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
CONSTRAINT `fk_autoscale_vmgroup_details__autoscale_vmgroup_id` FOREIGN KEY `fk_autoscale_vmgroup_details__autoscale_vmgroup_id`(`autoscale_vmgroup_id`) REFERENCES `autoscale_vmgroups`(`id`) ON DELETE CASCADE CONSTRAINT `fk_autoscale_vmgroup_details__autoscale_vmgroup_id` FOREIGN KEY `fk_autoscale_vmgroup_details__autoscale_vmgroup_id`(`autoscale_vmgroup_id`) REFERENCES `autoscale_vmgroups`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `cloud`.`snapshot_details` ADD COLUMN `display` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the detail can be displayed to the end user';
ALTER TABLE `cloud`.`vm_snapshot_details` ADD COLUMN `display` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the detail can be displayed to the end user';
ALTER TABLE `cloud`.`data_center_details` CHANGE `display` `display` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the detail can be displayed to the end user';
UPDATE `cloud`.`data_center_details` set `display`=1 where id> 0;
ALTER TABLE `cloud`.`service_offering_details` CHANGE `display` `display` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the detail can be displayed to the end user';
UPDATE `cloud`.`service_offering_details` set `display`=1 where id> 0;
ALTER TABLE `cloud`.`disk_offering_details` CHANGE `display` `display` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the detail can be displayed to the end user';
UPDATE `cloud`.`disk_offering_details` set `display`=1 where id> 0;
ALTER TABLE `cloud`.`firewall_rule_details` CHANGE `display` `display` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the detail can be displayed to the end user';
UPDATE `cloud`.`firewall_rule_details` set `display`=1 where id> 0;
ALTER TABLE `cloud`.`network_acl_item_details` CHANGE `display` `display` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the detail can be displayed to the end user';
UPDATE `cloud`.`network_acl_item_details` set `display`=1 where id> 0;
ALTER TABLE `cloud`.`network_acl_details` CHANGE `display` `display` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the detail can be displayed to the end user';
UPDATE `cloud`.`network_acl_details` set `display`=1 where id> 0;
ALTER TABLE `cloud`.`network_details` CHANGE `display` `display` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the detail can be displayed to the end user';
UPDATE `cloud`.`network_details` set `display`=1 where id> 0;
ALTER TABLE `cloud`.`nic_details` CHANGE `display` `display` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the detail can be displayed to the end user';
UPDATE `cloud`.`nic_details` set `display`=1 where id> 0;
ALTER TABLE `cloud`.`storage_pool_details` CHANGE `display` `display` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the detail can be displayed to the end user';
UPDATE `cloud`.`storage_pool_details` set `display`=1 where id> 0;
ALTER TABLE `cloud`.`remote_access_vpn_details` CHANGE `display` `display` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the detail can be displayed to the end user';
UPDATE `cloud`.`remote_access_vpn_details` set `display`=1 where id> 0;
ALTER TABLE `cloud`.`s2s_customer_gateway_details` CHANGE `display` `display` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the detail can be displayed to the end user';
UPDATE `cloud`.`s2s_customer_gateway_details` set `display`=1 where id> 0;
ALTER TABLE `cloud`.`s2s_vpn_connection_details` CHANGE `display` `display` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the detail can be displayed to the end user';
UPDATE `cloud`.`s2s_vpn_connection_details` set `display`=1 where id> 0;
ALTER TABLE `cloud`.`s2s_vpn_gateway_details` CHANGE `display` `display` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the detail can be displayed to the end user';
UPDATE `cloud`.`s2s_vpn_gateway_details` set `display`=1 where id> 0;
ALTER TABLE `cloud`.`user_ip_address_details` CHANGE `display` `display` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the detail can be displayed to the end user';
UPDATE `cloud`.`user_ip_address_details` set `display`=1 where id> 0;
ALTER TABLE `cloud`.`user_vm_details` CHANGE `display` `display` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the detail can be displayed to the end user';
UPDATE `cloud`.`user_vm_details` set `display`=1 where id> 0;
ALTER TABLE `cloud`.`vm_template_details` CHANGE `display` `display` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the detail can be displayed to the end user';
UPDATE `cloud`.`vm_template_details` set `display`=1 where id> 0;
ALTER TABLE `cloud`.`volume_details` CHANGE `display` `display` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the detail can be displayed to the end user';
UPDATE `cloud`.`volume_details` set `display`=1 where id> 0;
ALTER TABLE `cloud`.`vpc_details` CHANGE `display` `display` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the detail can be displayed to the end user';
UPDATE `cloud`.`vpc_details` set `display`=1 where id> 0;
ALTER TABLE `cloud`.`vpc_gateway_details` CHANGE `display` `display` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the detail can be displayed to the end user';
UPDATE `cloud`.`vpc_gateway_details` set `display`=1 where id> 0;

View File

@ -70,4 +70,6 @@ public interface EntityManager {
public <T> List<? extends T> list(Class<T> entityType); public <T> List<? extends T> list(Class<T> entityType);
public <T, K extends Serializable> void remove(Class<T> entityType, K id); public <T, K extends Serializable> void remove(Class<T> entityType, K id);
public <T, K extends Serializable> T findByIdIncludingRemoved(Class<T> entityType, K id);
} }