mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
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:
parent
13bf1ec5da
commit
e0de79b170
@ -30,9 +30,10 @@ public interface ResourceMetaDataService {
|
||||
* @param resourceId TODO
|
||||
* @param resourceType
|
||||
* @param details
|
||||
* @param forDisplay TODO
|
||||
* @return
|
||||
*/
|
||||
boolean addResourceMetaData(String resourceId, ResourceObjectType resourceType, Map<String, String> details);
|
||||
boolean addResourceMetaData(String resourceId, ResourceObjectType resourceType, Map<String, String> details, boolean forDisplay);
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@ -549,6 +549,7 @@ public class ApiConstants {
|
||||
public static final String PASSIVE = "passive";
|
||||
public static final String VERSION = "version";
|
||||
public static final String START = "start";
|
||||
public static final String DISPLAY = "display";
|
||||
|
||||
public enum HostDetails {
|
||||
all, capacity, events, stats, min;
|
||||
|
||||
@ -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")
|
||||
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 ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
@ -77,6 +80,14 @@ public class AddResourceDetailCmd extends BaseAsyncCmd {
|
||||
return resourceId;
|
||||
}
|
||||
|
||||
public boolean forDisplay() {
|
||||
if (display != null) {
|
||||
return display;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
@ -104,7 +115,7 @@ public class AddResourceDetailCmd extends BaseAsyncCmd {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
_resourceMetaDataService.addResourceMetaData(getResourceId(), getResourceType(), getDetails());
|
||||
_resourceMetaDataService.addResourceMetaData(getResourceId(), getResourceType(), getDetails(), forDisplay());
|
||||
setResponseObject(new SuccessResponse(getCommandName()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@ public class ListResourceDetailsCmd extends BaseListProjectAndAccountResourcesCm
|
||||
@Parameter(name = ApiConstants.RESOURCE_TYPE, type = CommandType.STRING, description = "list by resource type", required = true)
|
||||
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;
|
||||
|
||||
@Parameter(name = ApiConstants.KEY, type = CommandType.STRING, description = "list by key")
|
||||
|
||||
@ -190,7 +190,7 @@ public class VolumeResponse extends BaseResponse implements ControlledViewEntity
|
||||
|
||||
@SerializedName(ApiConstants.DISPLAY_VOLUME)
|
||||
@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)
|
||||
@Param(description = "The path of the volume")
|
||||
@ -406,12 +406,12 @@ public class VolumeResponse extends BaseResponse implements ControlledViewEntity
|
||||
this.tags.add(tag);
|
||||
}
|
||||
|
||||
public Boolean getDisplayVm() {
|
||||
return displayVm;
|
||||
public Boolean getDisplayVolume() {
|
||||
return displayVolume;
|
||||
}
|
||||
|
||||
public void setDisplayVm(Boolean displayVm) {
|
||||
this.displayVm = displayVm;
|
||||
public void setDisplayVolume(Boolean displayVm) {
|
||||
this.displayVolume = displayVm;
|
||||
}
|
||||
|
||||
public void setStoragePoolId(String storagePoolId) {
|
||||
|
||||
@ -40,8 +40,6 @@ import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
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.to.VolumeObjectTO;
|
||||
import org.apache.cloudstack.utils.identity.ManagementServerNode;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.agent.AgentManager;
|
||||
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.
|
||||
if (_uservmDetailsDao.findDetail(vm.getId(), "cpuOvercommitRatio") == null &&
|
||||
((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(), "memoryOvercommitRatio", cluster_detail_ram.getValue());
|
||||
_uservmDetailsDao.addDetail(vm.getId(), "cpuOvercommitRatio", cluster_detail_cpu.getValue(), true);
|
||||
_uservmDetailsDao.addDetail(vm.getId(), "memoryOvercommitRatio", cluster_detail_ram.getValue(), true);
|
||||
} else if (_uservmDetailsDao.findDetail(vm.getId(), "cpuOvercommitRatio") != null) {
|
||||
_uservmDetailsDao.addDetail(vm.getId(), "cpuOvercommitRatio", cluster_detail_cpu.getValue());
|
||||
_uservmDetailsDao.addDetail(vm.getId(), "memoryOvercommitRatio", cluster_detail_ram.getValue());
|
||||
_uservmDetailsDao.addDetail(vm.getId(), "cpuOvercommitRatio", cluster_detail_cpu.getValue(), true);
|
||||
_uservmDetailsDao.addDetail(vm.getId(), "memoryOvercommitRatio", cluster_detail_ram.getValue(), true);
|
||||
}
|
||||
vmProfile.setCpuOvercommitRatio(Float.parseFloat(cluster_detail_cpu.getValue()));
|
||||
vmProfile.setMemoryOvercommitRatio(Float.parseFloat(cluster_detail_ram.getValue()));
|
||||
|
||||
@ -48,10 +48,11 @@ public class DataCenterDetailVO implements ResourceDetail {
|
||||
protected DataCenterDetailVO() {
|
||||
}
|
||||
|
||||
public DataCenterDetailVO(long dcId, String name, String value) {
|
||||
public DataCenterDetailVO(long dcId, String name, String value, boolean display) {
|
||||
this.resourceId = dcId;
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -375,7 +375,7 @@ public class DataCenterDaoImpl extends GenericDaoBase<DataCenterVO, Long> implem
|
||||
|
||||
List<DataCenterDetailVO> resourceDetails = new ArrayList<DataCenterDetailVO>();
|
||||
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);
|
||||
|
||||
@ -41,8 +41,8 @@ public class DataCenterDetailsDaoImpl extends ResourceDetailsDaoBase<DataCenterD
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDetail(long resourceId, String key, String value) {
|
||||
super.addDetail(new DataCenterDetailVO(resourceId, key, value));
|
||||
public void addDetail(long resourceId, String key, String value, boolean display) {
|
||||
super.addDetail(new DataCenterDetailVO(resourceId, key, value, display));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -48,10 +48,11 @@ public class NetworkDetailVO implements ResourceDetail {
|
||||
public NetworkDetailVO() {
|
||||
}
|
||||
|
||||
public NetworkDetailVO(long networkId, String name, String value) {
|
||||
public NetworkDetailVO(long networkId, String name, String value, boolean display) {
|
||||
this.resourceId = networkId;
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -27,8 +27,8 @@ import org.apache.cloudstack.resourcedetail.ResourceDetailsDaoBase;
|
||||
public class NetworkDetailsDaoImpl extends ResourceDetailsDaoBase<NetworkDetailVO> implements NetworkDetailsDao {
|
||||
|
||||
@Override
|
||||
public void addDetail(long resourceId, String key, String value) {
|
||||
super.addDetail(new NetworkDetailVO(resourceId, key, value));
|
||||
public void addDetail(long resourceId, String key, String value, boolean display) {
|
||||
super.addDetail(new NetworkDetailVO(resourceId, key, value, display));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -48,10 +48,11 @@ public class ServiceOfferingDetailsVO implements ResourceDetail {
|
||||
protected ServiceOfferingDetailsVO() {
|
||||
}
|
||||
|
||||
public ServiceOfferingDetailsVO(long serviceOfferingId, String name, String value) {
|
||||
public ServiceOfferingDetailsVO(long serviceOfferingId, String name, String value, boolean display) {
|
||||
this.resourceId = serviceOfferingId;
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -182,7 +182,7 @@ public class ServiceOfferingDaoImpl extends GenericDaoBase<ServiceOfferingVO, Lo
|
||||
|
||||
List<ServiceOfferingDetailsVO> resourceDetails = new ArrayList<ServiceOfferingDetailsVO>();
|
||||
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);
|
||||
|
||||
@ -29,8 +29,8 @@ import com.cloud.service.ServiceOfferingDetailsVO;
|
||||
public class ServiceOfferingDetailsDaoImpl extends ResourceDetailsDaoBase<ServiceOfferingDetailsVO> implements ServiceOfferingDetailsDao {
|
||||
|
||||
@Override
|
||||
public void addDetail(long resourceId, String key, String value) {
|
||||
super.addDetail(new ServiceOfferingDetailsVO(resourceId, key, value));
|
||||
public void addDetail(long resourceId, String key, String value, boolean display) {
|
||||
super.addDetail(new ServiceOfferingDetailsVO(resourceId, key, value, display));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -48,10 +48,11 @@ public class VMTemplateDetailVO implements ResourceDetail {
|
||||
public VMTemplateDetailVO() {
|
||||
}
|
||||
|
||||
public VMTemplateDetailVO(long templateId, String name, String value) {
|
||||
public VMTemplateDetailVO(long templateId, String name, String value, boolean display) {
|
||||
this.resourceId = templateId;
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -48,10 +48,11 @@ public class VolumeDetailVO implements ResourceDetail {
|
||||
public VolumeDetailVO() {
|
||||
}
|
||||
|
||||
public VolumeDetailVO(long volumeId, String name, String value) {
|
||||
public VolumeDetailVO(long volumeId, String name, String value, boolean display) {
|
||||
this.resourceId = volumeId;
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -22,7 +22,7 @@ import org.apache.cloudstack.resourcedetail.ResourceDetailsDaoBase;
|
||||
|
||||
public class SnapshotDetailsDaoImpl extends ResourceDetailsDaoBase<SnapshotDetailsVO> implements SnapshotDetailsDao {
|
||||
@Override
|
||||
public void addDetail(long resourceId, String key, String value) {
|
||||
super.addDetail(new SnapshotDetailsVO(resourceId, key, value));
|
||||
public void addDetail(long resourceId, String key, String value, boolean display) {
|
||||
super.addDetail(new SnapshotDetailsVO(resourceId, key, value, display));
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,14 +44,17 @@ public class SnapshotDetailsVO implements ResourceDetail {
|
||||
@Column(name = "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.name = name;
|
||||
this.value = value;
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -71,7 +74,7 @@ public class SnapshotDetailsVO implements ResourceDetail {
|
||||
|
||||
@Override
|
||||
public boolean isDisplay() {
|
||||
return false;
|
||||
return display;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -43,7 +43,7 @@ public class StoragePoolDetailsDaoImpl extends ResourceDetailsDaoBase<StoragePoo
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDetail(long resourceId, String key, String value) {
|
||||
super.addDetail(new StoragePoolDetailVO(resourceId, key, value));
|
||||
public void addDetail(long resourceId, String key, String value, boolean display) {
|
||||
super.addDetail(new StoragePoolDetailVO(resourceId, key, value, display));
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,12 +28,10 @@ import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
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.TemplateDataStoreVO;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.dc.dao.DataCenterDao;
|
||||
import com.cloud.domain.dao.DomainDao;
|
||||
@ -51,6 +49,7 @@ import com.cloud.storage.VMTemplateVO;
|
||||
import com.cloud.storage.VMTemplateZoneVO;
|
||||
import com.cloud.tags.ResourceTagVO;
|
||||
import com.cloud.tags.dao.ResourceTagDao;
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
import com.cloud.utils.db.DB;
|
||||
import com.cloud.utils.db.Filter;
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
@ -416,7 +415,7 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
|
||||
}
|
||||
List<VMTemplateDetailVO> details = new ArrayList<VMTemplateDetailVO>();
|
||||
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);
|
||||
}
|
||||
|
||||
@ -752,7 +751,7 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
|
||||
if (tmplt.getDetails() != null) {
|
||||
List<VMTemplateDetailVO> details = new ArrayList<VMTemplateDetailVO>();
|
||||
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);
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@ import com.cloud.storage.VMTemplateDetailVO;
|
||||
public class VMTemplateDetailsDaoImpl extends ResourceDetailsDaoBase<VMTemplateDetailVO> implements VMTemplateDetailsDao {
|
||||
|
||||
@Override
|
||||
public void addDetail(long resourceId, String key, String value) {
|
||||
super.addDetail(new VMTemplateDetailVO(resourceId, key, value));
|
||||
public void addDetail(long resourceId, String key, String value, boolean display) {
|
||||
super.addDetail(new VMTemplateDetailVO(resourceId, key, value, display));
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,8 +29,8 @@ import com.cloud.storage.VolumeDetailVO;
|
||||
public class VolumeDetailsDaoImpl extends ResourceDetailsDaoBase<VolumeDetailVO> implements VolumeDetailsDao {
|
||||
|
||||
@Override
|
||||
public void addDetail(long resourceId, String key, String value) {
|
||||
super.addDetail(new VolumeDetailVO(resourceId, key, value));
|
||||
public void addDetail(long resourceId, String key, String value, boolean display) {
|
||||
super.addDetail(new VolumeDetailVO(resourceId, key, value, display));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -48,10 +48,11 @@ public class NicDetailVO implements ResourceDetail {
|
||||
public NicDetailVO() {
|
||||
}
|
||||
|
||||
public NicDetailVO(long nicId, String name, String value) {
|
||||
public NicDetailVO(long nicId, String name, String value, boolean display) {
|
||||
this.resourceId = nicId;
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -48,10 +48,11 @@ public class UserVmDetailVO implements ResourceDetail {
|
||||
public UserVmDetailVO() {
|
||||
}
|
||||
|
||||
public UserVmDetailVO(long vmId, String name, String value) {
|
||||
public UserVmDetailVO(long vmId, String name, String value, boolean display) {
|
||||
this.resourceId = vmId;
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -29,7 +29,7 @@ import com.cloud.vm.NicDetailVO;
|
||||
public class NicDetailsDaoImpl extends ResourceDetailsDaoBase<NicDetailVO> implements NicDetailsDao {
|
||||
|
||||
@Override
|
||||
public void addDetail(long resourceId, String key, String value) {
|
||||
super.addDetail(new NicDetailVO(resourceId, key, value));
|
||||
public void addDetail(long resourceId, String key, String value, boolean display) {
|
||||
super.addDetail(new NicDetailVO(resourceId, key, value, display));
|
||||
}
|
||||
}
|
||||
|
||||
@ -343,7 +343,7 @@ public class UserVmDaoImpl extends GenericDaoBase<UserVmVO, Long> implements Use
|
||||
}
|
||||
List<UserVmDetailVO> details = new ArrayList<UserVmDetailVO>();
|
||||
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);
|
||||
|
||||
@ -29,8 +29,8 @@ import com.cloud.vm.UserVmDetailVO;
|
||||
public class UserVmDetailsDaoImpl extends ResourceDetailsDaoBase<UserVmDetailVO> implements UserVmDetailsDao {
|
||||
|
||||
@Override
|
||||
public void addDetail(long resourceId, String key, String value) {
|
||||
super.addDetail(new UserVmDetailVO(resourceId, key, value));
|
||||
public void addDetail(long resourceId, String key, String value, boolean display) {
|
||||
super.addDetail(new UserVmDetailVO(resourceId, key, value, display));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -44,14 +44,17 @@ public class VMSnapshotDetailsVO implements ResourceDetail {
|
||||
@Column(name = "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.name = name;
|
||||
this.value = value;
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -76,6 +79,6 @@ public class VMSnapshotDetailsVO implements ResourceDetail {
|
||||
|
||||
@Override
|
||||
public boolean isDisplay() {
|
||||
return false;
|
||||
return display;
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ import com.cloud.vm.snapshot.VMSnapshotDetailsVO;
|
||||
public class VMSnapshotDetailsDaoImpl extends ResourceDetailsDaoBase<VMSnapshotDetailsVO> implements VMSnapshotDetailsDao {
|
||||
|
||||
@Override
|
||||
public void addDetail(long resourceId, String key, String value) {
|
||||
super.addDetail(new VMSnapshotDetailsVO(resourceId, key, value));
|
||||
public void addDetail(long resourceId, String key, String value, boolean display) {
|
||||
super.addDetail(new VMSnapshotDetailsVO(resourceId, key, value, display));
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,10 +48,11 @@ public class AutoScaleVmGroupDetailVO implements ResourceDetail {
|
||||
public AutoScaleVmGroupDetailVO() {
|
||||
}
|
||||
|
||||
public AutoScaleVmGroupDetailVO(long id, String name, String value) {
|
||||
public AutoScaleVmGroupDetailVO(long id, String name, String value, boolean display) {
|
||||
this.resourceId = id;
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -48,10 +48,11 @@ public class AutoScaleVmProfileDetailVO implements ResourceDetail {
|
||||
public AutoScaleVmProfileDetailVO() {
|
||||
}
|
||||
|
||||
public AutoScaleVmProfileDetailVO(long id, String name, String value) {
|
||||
public AutoScaleVmProfileDetailVO(long id, String name, String value, boolean display) {
|
||||
this.resourceId = id;
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -48,10 +48,11 @@ public class DiskOfferingDetailVO implements ResourceDetail {
|
||||
public DiskOfferingDetailVO() {
|
||||
}
|
||||
|
||||
public DiskOfferingDetailVO(long id, String name, String value) {
|
||||
public DiskOfferingDetailVO(long id, String name, String value, boolean display) {
|
||||
this.resourceId = id;
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -48,10 +48,11 @@ public class FirewallRuleDetailVO implements ResourceDetail {
|
||||
public FirewallRuleDetailVO() {
|
||||
}
|
||||
|
||||
public FirewallRuleDetailVO(long id, String name, String value) {
|
||||
public FirewallRuleDetailVO(long id, String name, String value, boolean display) {
|
||||
this.resourceId = id;
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -48,10 +48,11 @@ public class NetworkACLItemDetailVO implements ResourceDetail {
|
||||
public NetworkACLItemDetailVO() {
|
||||
}
|
||||
|
||||
public NetworkACLItemDetailVO(long id, String name, String value) {
|
||||
public NetworkACLItemDetailVO(long id, String name, String value, boolean display) {
|
||||
this.resourceId = id;
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -48,10 +48,11 @@ public class NetworkACLListDetailVO implements ResourceDetail {
|
||||
public NetworkACLListDetailVO() {
|
||||
}
|
||||
|
||||
public NetworkACLListDetailVO(long id, String name, String value) {
|
||||
public NetworkACLListDetailVO(long id, String name, String value, boolean display) {
|
||||
this.resourceId = id;
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -48,10 +48,11 @@ public class RemoteAccessVpnDetailVO implements ResourceDetail {
|
||||
public RemoteAccessVpnDetailVO() {
|
||||
}
|
||||
|
||||
public RemoteAccessVpnDetailVO(long id, String name, String value) {
|
||||
public RemoteAccessVpnDetailVO(long id, String name, String value, boolean display) {
|
||||
this.resourceId = id;
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -66,6 +66,6 @@ public interface ResourceDetailsDao<R extends ResourceDetail> extends GenericDao
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
@ -48,10 +48,11 @@ public class Site2SiteCustomerGatewayDetailVO implements ResourceDetail {
|
||||
public Site2SiteCustomerGatewayDetailVO() {
|
||||
}
|
||||
|
||||
public Site2SiteCustomerGatewayDetailVO(long id, String name, String value) {
|
||||
public Site2SiteCustomerGatewayDetailVO(long id, String name, String value, boolean display) {
|
||||
this.resourceId = id;
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -48,10 +48,11 @@ public class Site2SiteVpnConnectionDetailVO implements ResourceDetail {
|
||||
public Site2SiteVpnConnectionDetailVO() {
|
||||
}
|
||||
|
||||
public Site2SiteVpnConnectionDetailVO(long id, String name, String value) {
|
||||
public Site2SiteVpnConnectionDetailVO(long id, String name, String value, boolean display) {
|
||||
this.resourceId = id;
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -48,10 +48,11 @@ public class Site2SiteVpnGatewayDetailVO implements ResourceDetail {
|
||||
public Site2SiteVpnGatewayDetailVO() {
|
||||
}
|
||||
|
||||
public Site2SiteVpnGatewayDetailVO(long id, String name, String value) {
|
||||
public Site2SiteVpnGatewayDetailVO(long id, String name, String value, boolean display) {
|
||||
this.resourceId = id;
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -48,10 +48,11 @@ public class UserIpAddressDetailVO implements ResourceDetail {
|
||||
public UserIpAddressDetailVO() {
|
||||
}
|
||||
|
||||
public UserIpAddressDetailVO(long id, String name, String value) {
|
||||
public UserIpAddressDetailVO(long id, String name, String value, boolean display) {
|
||||
this.resourceId = id;
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -48,10 +48,11 @@ public class VpcDetailVO implements ResourceDetail {
|
||||
public VpcDetailVO() {
|
||||
}
|
||||
|
||||
public VpcDetailVO(long id, String name, String value) {
|
||||
public VpcDetailVO(long id, String name, String value, boolean display) {
|
||||
this.resourceId = id;
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -48,10 +48,11 @@ public class VpcGatewayDetailVO implements ResourceDetail {
|
||||
public VpcGatewayDetailVO() {
|
||||
}
|
||||
|
||||
public VpcGatewayDetailVO(long id, String name, String value) {
|
||||
public VpcGatewayDetailVO(long id, String name, String value, boolean display) {
|
||||
this.resourceId = id;
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -27,7 +27,7 @@ import org.springframework.stereotype.Component;
|
||||
public class AutoScaleVmGroupDetailsDaoImpl extends ResourceDetailsDaoBase<AutoScaleVmGroupDetailVO> implements AutoScaleVmGroupDetailsDao {
|
||||
|
||||
@Override
|
||||
public void addDetail(long resourceId, String key, String value) {
|
||||
super.addDetail(new AutoScaleVmGroupDetailVO(resourceId, key, value));
|
||||
public void addDetail(long resourceId, String key, String value, boolean display) {
|
||||
super.addDetail(new AutoScaleVmGroupDetailVO(resourceId, key, value, display));
|
||||
}
|
||||
}
|
||||
@ -27,7 +27,7 @@ import org.springframework.stereotype.Component;
|
||||
public class AutoScaleVmProfileDetailsDaoImpl extends ResourceDetailsDaoBase<AutoScaleVmProfileDetailVO> implements AutoScaleVmProfileDetailsDao {
|
||||
|
||||
@Override
|
||||
public void addDetail(long resourceId, String key, String value) {
|
||||
super.addDetail(new AutoScaleVmProfileDetailVO(resourceId, key, value));
|
||||
public void addDetail(long resourceId, String key, String value, boolean display) {
|
||||
super.addDetail(new AutoScaleVmProfileDetailVO(resourceId, key, value, display));
|
||||
}
|
||||
}
|
||||
@ -27,7 +27,7 @@ import org.springframework.stereotype.Component;
|
||||
public class DiskOfferingDetailsDaoImpl extends ResourceDetailsDaoBase<DiskOfferingDetailVO> implements DiskOfferingDetailsDao {
|
||||
|
||||
@Override
|
||||
public void addDetail(long resourceId, String key, String value) {
|
||||
super.addDetail(new DiskOfferingDetailVO(resourceId, key, value));
|
||||
public void addDetail(long resourceId, String key, String value, boolean display) {
|
||||
super.addDetail(new DiskOfferingDetailVO(resourceId, key, value, display));
|
||||
}
|
||||
}
|
||||
@ -28,7 +28,7 @@ import org.apache.cloudstack.resourcedetail.ResourceDetailsDaoBase;
|
||||
public class FirewallRuleDetailsDaoImpl extends ResourceDetailsDaoBase<FirewallRuleDetailVO> implements FirewallRuleDetailsDao {
|
||||
|
||||
@Override
|
||||
public void addDetail(long resourceId, String key, String value) {
|
||||
super.addDetail(new FirewallRuleDetailVO(resourceId, key, value));
|
||||
public void addDetail(long resourceId, String key, String value, boolean display) {
|
||||
super.addDetail(new FirewallRuleDetailVO(resourceId, key, value, display));
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@ import org.apache.cloudstack.resourcedetail.ResourceDetailsDaoBase;
|
||||
public class NetworkACLItemDetailsDaoImpl extends ResourceDetailsDaoBase<NetworkACLItemDetailVO> implements NetworkACLItemDetailsDao {
|
||||
|
||||
@Override
|
||||
public void addDetail(long resourceId, String key, String value) {
|
||||
super.addDetail(new NetworkACLItemDetailVO(resourceId, key, value));
|
||||
public void addDetail(long resourceId, String key, String value, boolean display) {
|
||||
super.addDetail(new NetworkACLItemDetailVO(resourceId, key, value, display));
|
||||
}
|
||||
}
|
||||
@ -28,7 +28,7 @@ import org.apache.cloudstack.resourcedetail.ResourceDetailsDaoBase;
|
||||
public class NetworkACLListDetailsDaoImpl extends ResourceDetailsDaoBase<NetworkACLListDetailVO> implements NetworkACLListDetailsDao {
|
||||
|
||||
@Override
|
||||
public void addDetail(long resourceId, String key, String value) {
|
||||
super.addDetail(new NetworkACLListDetailVO(resourceId, key, value));
|
||||
public void addDetail(long resourceId, String key, String value, boolean display) {
|
||||
super.addDetail(new NetworkACLListDetailVO(resourceId, key, value, display));
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@ import org.apache.cloudstack.resourcedetail.ResourceDetailsDaoBase;
|
||||
public class RemoteAccessVpnDetailsDaoImpl extends ResourceDetailsDaoBase<RemoteAccessVpnDetailVO> implements RemoteAccessVpnDetailsDao {
|
||||
|
||||
@Override
|
||||
public void addDetail(long resourceId, String key, String value) {
|
||||
super.addDetail(new RemoteAccessVpnDetailVO(resourceId, key, value));
|
||||
public void addDetail(long resourceId, String key, String value, boolean display) {
|
||||
super.addDetail(new RemoteAccessVpnDetailVO(resourceId, key, value, display));
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@ import org.apache.cloudstack.resourcedetail.Site2SiteCustomerGatewayDetailVO;
|
||||
public class Site2SiteCustomerGatewayDetailsDaoImpl extends ResourceDetailsDaoBase<Site2SiteCustomerGatewayDetailVO> implements Site2SiteCustomerGatewayDetailsDao {
|
||||
|
||||
@Override
|
||||
public void addDetail(long resourceId, String key, String value) {
|
||||
super.addDetail(new Site2SiteCustomerGatewayDetailVO(resourceId, key, value));
|
||||
public void addDetail(long resourceId, String key, String value, boolean display) {
|
||||
super.addDetail(new Site2SiteCustomerGatewayDetailVO(resourceId, key, value, display));
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,7 +26,7 @@ import org.springframework.stereotype.Component;
|
||||
public class Site2SiteVpnConnectionDetailsDaoImpl extends ResourceDetailsDaoBase<Site2SiteVpnConnectionDetailVO> implements Site2SiteVpnConnectionDetailsDao {
|
||||
|
||||
@Override
|
||||
public void addDetail(long resourceId, String key, String value) {
|
||||
super.addDetail(new Site2SiteVpnConnectionDetailVO(resourceId, key, value));
|
||||
public void addDetail(long resourceId, String key, String value, boolean display) {
|
||||
super.addDetail(new Site2SiteVpnConnectionDetailVO(resourceId, key, value, display));
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@ import org.apache.cloudstack.resourcedetail.Site2SiteVpnGatewayDetailVO;
|
||||
public class Site2SiteVpnGatewayDetailsDaoImpl extends ResourceDetailsDaoBase<Site2SiteVpnGatewayDetailVO> implements Site2SiteVpnGatewayDetailsDao {
|
||||
|
||||
@Override
|
||||
public void addDetail(long resourceId, String key, String value) {
|
||||
super.addDetail(new Site2SiteVpnGatewayDetailVO(resourceId, key, value));
|
||||
public void addDetail(long resourceId, String key, String value, boolean display) {
|
||||
super.addDetail(new Site2SiteVpnGatewayDetailVO(resourceId, key, value, display));
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@ import org.springframework.stereotype.Component;
|
||||
public class UserDetailsDaoImpl extends ResourceDetailsDaoBase<UserDetailVO> implements UserDetailsDao {
|
||||
|
||||
@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));
|
||||
}
|
||||
}
|
||||
@ -28,7 +28,7 @@ import org.apache.cloudstack.resourcedetail.UserIpAddressDetailVO;
|
||||
public class UserIpAddressDetailsDaoImpl extends ResourceDetailsDaoBase<UserIpAddressDetailVO> implements UserIpAddressDetailsDao {
|
||||
|
||||
@Override
|
||||
public void addDetail(long resourceId, String key, String value) {
|
||||
super.addDetail(new UserIpAddressDetailVO(resourceId, key, value));
|
||||
public void addDetail(long resourceId, String key, String value, boolean display) {
|
||||
super.addDetail(new UserIpAddressDetailVO(resourceId, key, value, display));
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@ import org.apache.cloudstack.resourcedetail.VpcDetailVO;
|
||||
public class VpcDetailsDaoImpl extends ResourceDetailsDaoBase<VpcDetailVO> implements VpcDetailsDao {
|
||||
|
||||
@Override
|
||||
public void addDetail(long resourceId, String key, String value) {
|
||||
super.addDetail(new VpcDetailVO(resourceId, key, value));
|
||||
public void addDetail(long resourceId, String key, String value, boolean display) {
|
||||
super.addDetail(new VpcDetailVO(resourceId, key, value, display));
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@ import org.apache.cloudstack.resourcedetail.VpcGatewayDetailVO;
|
||||
public class VpcGatewayDetailsDaoImpl extends ResourceDetailsDaoBase<VpcGatewayDetailVO> implements VpcGatewayDetailsDao {
|
||||
|
||||
@Override
|
||||
public void addDetail(long resourceId, String key, String value) {
|
||||
super.addDetail(new VpcGatewayDetailVO(resourceId, key, value));
|
||||
public void addDetail(long resourceId, String key, String value, boolean display) {
|
||||
super.addDetail(new VpcGatewayDetailVO(resourceId, key, value, display));
|
||||
}
|
||||
}
|
||||
@ -232,7 +232,7 @@ public class PrimaryDataStoreDaoImpl extends GenericDaoBase<StoragePoolVO, Long>
|
||||
pool = super.persist(pool);
|
||||
if (details != null) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -388,7 +388,7 @@ public class PrimaryDataStoreDaoImpl extends GenericDaoBase<StoragePoolVO, Long>
|
||||
if (details != null) {
|
||||
List<StoragePoolDetailVO> detailsVO = new ArrayList<StoragePoolDetailVO>();
|
||||
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);
|
||||
}
|
||||
|
||||
@ -45,10 +45,11 @@ public class PrimaryDataStoreDetailVO implements ResourceDetail {
|
||||
@Column(name = "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.name = name;
|
||||
this.value = value;
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
protected PrimaryDataStoreDetailVO() {
|
||||
|
||||
@ -45,10 +45,11 @@ public class StoragePoolDetailVO implements ResourceDetail {
|
||||
@Column(name = "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.name = name;
|
||||
this.value = value;
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
public StoragePoolDetailVO() {
|
||||
|
||||
@ -41,7 +41,7 @@ public class VmSnapshotDaoTest extends CloudStackTestNGBase {
|
||||
|
||||
@Test
|
||||
public void testVmSnapshotDetails() {
|
||||
VMSnapshotDetailsVO detailsVO = new VMSnapshotDetailsVO(1L, "test", "foo");
|
||||
VMSnapshotDetailsVO detailsVO = new VMSnapshotDetailsVO(1L, "test", "foo", display);
|
||||
vmsnapshotDetailsDao.persist(detailsVO);
|
||||
Map<String, String> details = vmsnapshotDetailsDao.listDetailsKeyPairs(1L);
|
||||
Assert.assertTrue(details.containsKey("test"));
|
||||
|
||||
@ -251,7 +251,7 @@ public class StorageAllocatorTest {
|
||||
public void testClusterAllocatorWithTags() {
|
||||
try {
|
||||
createDb();
|
||||
StoragePoolDetailVO detailVO = new StoragePoolDetailVO(this.storagePoolId, "high", "true");
|
||||
StoragePoolDetailVO detailVO = new StoragePoolDetailVO(this.storagePoolId, "high", "true", display);
|
||||
poolDetailsDao.persist(detailVO);
|
||||
DiskOfferingVO diskOff = this.diskOfferingDao.findById(diskOffering.getId());
|
||||
List<String> tags = new ArrayList<String>();
|
||||
@ -285,7 +285,7 @@ public class StorageAllocatorTest {
|
||||
public void testClusterAllocatorWithWrongTag() {
|
||||
try {
|
||||
createDb();
|
||||
StoragePoolDetailVO detailVO = new StoragePoolDetailVO(this.storagePoolId, "high", "true");
|
||||
StoragePoolDetailVO detailVO = new StoragePoolDetailVO(this.storagePoolId, "high", "true", display);
|
||||
poolDetailsDao.persist(detailVO);
|
||||
DiskOfferingVO diskOff = this.diskOfferingDao.findById(diskOffering.getId());
|
||||
List<String> tags = new ArrayList<String>();
|
||||
|
||||
@ -26,8 +26,8 @@ import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDetailsDao;
|
||||
public class PrimaryDataStoreDetailsDaoImpl extends ResourceDetailsDaoBase<PrimaryDataStoreDetailVO> implements PrimaryDataStoreDetailsDao {
|
||||
|
||||
@Override
|
||||
public void addDetail(long resourceId, String key, String value) {
|
||||
super.addDetail(new PrimaryDataStoreDetailVO(resourceId, key, value));
|
||||
public void addDetail(long resourceId, String key, String value, boolean display) {
|
||||
super.addDetail(new PrimaryDataStoreDetailVO(resourceId, key, value, display));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -45,6 +45,7 @@ public class EntityManagerImpl extends ManagerBase implements EntityManager {
|
||||
return dao.findById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T, K extends Serializable> T findByIdIncludingRemoved(Class<T> entityType, K id) {
|
||||
GenericDao<? extends T, K> dao = (GenericDao<? extends T, K>)GenericDaoBase.getDao(entityType);
|
||||
return dao.findByIdIncludingRemoved(id);
|
||||
|
||||
@ -3228,7 +3228,10 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
|
||||
Boolean forDisplay = cmd.forDisplay();
|
||||
ResourceTag.ResourceObjectType resourceType = cmd.getResourceType();
|
||||
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>();
|
||||
ResourceDetail requestedDetail = null;
|
||||
|
||||
|
||||
@ -208,7 +208,7 @@ public class VolumeJoinDaoImpl extends GenericDaoBase<VolumeJoinVO, Long> implem
|
||||
}
|
||||
|
||||
volResponse.setExtractable(isExtractable);
|
||||
volResponse.setDisplayVm(volume.isDisplayVolume());
|
||||
volResponse.setDisplayVolume(volume.isDisplayVolume());
|
||||
|
||||
// set async job
|
||||
if (volume.getJobId() != null) {
|
||||
|
||||
@ -36,8 +36,6 @@ import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.acl.SecurityChecker;
|
||||
import org.apache.cloudstack.affinity.AffinityGroup;
|
||||
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.StoragePoolDetailsDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.alert.AlertManager;
|
||||
import com.cloud.api.ApiDBUtils;
|
||||
@ -443,7 +442,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
||||
if (zone == null) {
|
||||
throw new InvalidParameterValueException("unable to find zone by id " + resourceId);
|
||||
}
|
||||
_dcDetailsDao.addDetail(resourceId, name, value);
|
||||
_dcDetailsDao.addDetail(resourceId, name, value, true);
|
||||
break;
|
||||
case Cluster:
|
||||
ClusterVO cluster = _clusterDao.findById(resourceId);
|
||||
@ -465,7 +464,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
||||
if (pool == null) {
|
||||
throw new InvalidParameterValueException("unable to find storage pool by id " + resourceId);
|
||||
}
|
||||
_storagePoolDetailsDao.addDetail(resourceId, name, value);
|
||||
_storagePoolDetailsDao.addDetail(resourceId, name, value, true);
|
||||
|
||||
break;
|
||||
|
||||
@ -2039,7 +2038,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
||||
if (details != null) {
|
||||
List<ServiceOfferingDetailsVO> detailsVO = new ArrayList<ServiceOfferingDetailsVO>();
|
||||
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);
|
||||
|
||||
@ -159,7 +159,7 @@ public class ResourceMetaDataManagerImpl extends ManagerBase implements Resource
|
||||
@Override
|
||||
@DB
|
||||
@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>() {
|
||||
@Override
|
||||
public Boolean doInTransaction(TransactionStatus status) {
|
||||
@ -171,7 +171,7 @@ public class ResourceMetaDataManagerImpl extends ManagerBase implements Resource
|
||||
}
|
||||
|
||||
DetailDaoHelper newDetailDaoHelper = new DetailDaoHelper(resourceType);
|
||||
newDetailDaoHelper.addDetail(_taggedResourceMgr.getResourceId(resourceId, resourceType), key, value);
|
||||
newDetailDaoHelper.addDetail(_taggedResourceMgr.getResourceId(resourceId, resourceType), key, value, forDisplay);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -215,8 +215,8 @@ public class ResourceMetaDataManagerImpl extends ManagerBase implements Resource
|
||||
return dao.findDetail(resourceId, key);
|
||||
}
|
||||
|
||||
private void addDetail(long resourceId, String key, String value) {
|
||||
dao.addDetail(resourceId, key, value);
|
||||
private void addDetail(long resourceId, String key, String value, boolean forDisplay) {
|
||||
dao.addDetail(resourceId, key, value, forDisplay);
|
||||
}
|
||||
|
||||
private Map<String, String> getDetailsMap(long resourceId, Boolean forDisplay) {
|
||||
|
||||
@ -1431,7 +1431,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
||||
details.put(UsageEventVO.DynamicParameters.memory.name(), serviceOffering.getRamSize().toString());
|
||||
List<UserVmDetailVO> detailList = new ArrayList<UserVmDetailVO>();
|
||||
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);
|
||||
}
|
||||
_uservmDetailsDao.saveDetails(detailList);
|
||||
@ -1445,7 +1445,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
||||
details.remove(UsageEventVO.DynamicParameters.memory.name());
|
||||
List<UserVmDetailVO> detailList = new ArrayList<UserVmDetailVO>();
|
||||
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);
|
||||
}
|
||||
_uservmDetailsDao.saveDetails(detailList);
|
||||
|
||||
@ -89,7 +89,7 @@ public class ResourceMetaDataManagerTest {
|
||||
doNothing().when(_nicDetailDao).removeDetail(anyLong(), anyString());
|
||||
Map<String, String> map = new HashedMap();
|
||||
map.put("key", "value");
|
||||
_resourceMetaDataMgr.addResourceMetaData("1", ResourceTag.ResourceObjectType.Volume, map);
|
||||
_resourceMetaDataMgr.addResourceMetaData("1", ResourceTag.ResourceObjectType.Volume, map, true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -224,7 +224,7 @@ CREATE TABLE `cloud`.`user_details` (
|
||||
`user_id` bigint unsigned NOT NULL COMMENT 'VPC gateway id',
|
||||
`name` varchar(255) 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`),
|
||||
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;
|
||||
@ -453,7 +453,7 @@ CREATE TABLE `cloud`.`autoscale_vmprofile_details` (
|
||||
`autoscale_vmprofile_id` bigint unsigned NOT NULL COMMENT 'VPC gateway id',
|
||||
`name` varchar(255) 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`),
|
||||
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;
|
||||
@ -463,7 +463,67 @@ CREATE TABLE `cloud`.`autoscale_vmgroup_details` (
|
||||
`autoscale_vmgroup_id` bigint unsigned NOT NULL COMMENT 'VPC gateway id',
|
||||
`name` varchar(255) 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`),
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
@ -70,4 +70,6 @@ public interface EntityManager {
|
||||
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> T findByIdIncludingRemoved(Class<T> entityType, K id);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user