wip domainId removal stuff

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Rohit Yadav 2019-04-03 16:37:29 +05:30 committed by Abhishek Kumar
parent 5988884bd1
commit 8cabbcea92
10 changed files with 70 additions and 35 deletions

View File

@ -19,14 +19,13 @@ package org.apache.cloudstack.api.response;
import java.util.Date; import java.util.Date;
import java.util.Map; import java.util.Map;
import com.google.gson.annotations.SerializedName;
import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.BaseResponse;
import org.apache.cloudstack.api.EntityReference; import org.apache.cloudstack.api.EntityReference;
import com.cloud.offering.ServiceOffering; import com.cloud.offering.ServiceOffering;
import com.cloud.serializer.Param; import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
@EntityReference(value = ServiceOffering.class) @EntityReference(value = ServiceOffering.class)
public class ServiceOfferingResponse extends BaseResponse { public class ServiceOfferingResponse extends BaseResponse {
@ -81,14 +80,22 @@ public class ServiceOfferingResponse extends BaseResponse {
@Param(description = "the tags for the service offering") @Param(description = "the tags for the service offering")
private String tags; private String tags;
@SerializedName("domainid") @SerializedName(ApiConstants.DOMAIN_ID)
@Param(description = "the domain id of the service offering") @Param(description = "the domain ID(s) this disk offering belongs to. Ignore this information as it is not currently applicable.")
private String domainId; private String domainId;
@SerializedName(ApiConstants.DOMAIN) @SerializedName(ApiConstants.DOMAIN)
@Param(description = "Domain name for the offering") @Param(description = "the domain name(s) this disk offering belongs to. Ignore this information as it is not currently applicable.")
private String domain; private String domain;
@SerializedName(ApiConstants.ZONE_ID)
@Param(description = "the zone ID(s) this disk offering belongs to. Ignore this information as it is not currently applicable.", since = "4.13.0")
private String zoneId;
@SerializedName(ApiConstants.ZONE)
@Param(description = "the zone name(s) this disk offering belongs to. Ignore this information as it is not currently applicable.", since = "4.13.0")
private String zone;
@SerializedName(ApiConstants.HOST_TAGS) @SerializedName(ApiConstants.HOST_TAGS)
@Param(description = "the host tag for the service offering") @Param(description = "the host tag for the service offering")
private String hostTag; private String hostTag;
@ -324,6 +331,22 @@ public class ServiceOfferingResponse extends BaseResponse {
this.domain = domain; this.domain = domain;
} }
public String getZoneId() {
return zoneId;
}
public void setZoneId(String zoneId) {
this.zoneId = zoneId;
}
public String getZone() {
return zone;
}
public void setZone(String zone) {
this.zone = zone;
}
public String getHostTag() { public String getHostTag() {
return hostTag; return hostTag;
} }

View File

@ -121,6 +121,4 @@ public interface DataCenterDao extends GenericDao<DataCenterVO, Long> {
List<DataCenterVO> findByKeyword(String keyword); List<DataCenterVO> findByKeyword(String keyword);
List<DataCenterVO> listAllZones(); List<DataCenterVO> listAllZones();
List<DataCenterVO> list(Object[] ids);
} }

View File

@ -437,12 +437,4 @@ public class DataCenterDaoImpl extends GenericDaoBase<DataCenterVO, Long> implem
return dcs; return dcs;
} }
@Override
public List<DataCenterVO> list(Object[] ids) {
SearchBuilder<DataCenterVO> sb = createSearchBuilder();
SearchCriteria<DataCenterVO> sc = sb.create();
sc.addAnd("id", SearchCriteria.Op.IN, ids);
return listBy(sc);
}
} }

View File

@ -40,6 +40,4 @@ public interface DomainDao extends GenericDao<DomainVO, Long> {
Set<Long> getDomainParentIds(long domainId); Set<Long> getDomainParentIds(long domainId);
List<Long> getDomainChildrenIds(String path); List<Long> getDomainChildrenIds(String path);
List<DomainVO> list(Object[] ids);
} }

View File

@ -290,12 +290,4 @@ public class DomainDaoImpl extends GenericDaoBase<DomainVO, Long> implements Dom
return parentDomains; return parentDomains;
} }
@Override
public List<DomainVO> list(Object[] ids) {
SearchBuilder<DomainVO> sb = createSearchBuilder();
SearchCriteria<DomainVO> sc = sb.create();
sc.addAnd("id", SearchCriteria.Op.IN, ids);
return listBy(sc);
}
} }

View File

@ -75,8 +75,9 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
@Column(name = "deployment_planner") @Column(name = "deployment_planner")
private String deploymentPlanner = null; private String deploymentPlanner = null;
@Transient
@Column(name = "domain_id") @Column(name = "domain_id")
private Long domainId = null; Long domainId;
// This is a delayed load value. If the value is null, // This is a delayed load value. If the value is null,
// then this field has not been loaded yet. // then this field has not been loaded yet.

View File

@ -75,6 +75,10 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
@Column(name = "deployment_planner") @Column(name = "deployment_planner")
private String deploymentPlanner = null; private String deploymentPlanner = null;
@Transient
@Column(name = "domain_id")
Long domainId;
@Transient @Transient
Map<String, String> details = new HashMap<String, String>(); Map<String, String> details = new HashMap<String, String>();
@ -226,11 +230,6 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
return multicastRateMbps; return multicastRateMbps;
} }
@Override
public Long getDomainId() {
return null;
}
public void setHostTag(String hostTag) { public void setHostTag(String hostTag) {
this.hostTag = hostTag; this.hostTag = hostTag;
} }
@ -289,4 +288,10 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
public void setDynamicFlag(boolean isdynamic) { public void setDynamicFlag(boolean isdynamic) {
isDynamic = isdynamic; isDynamic = isdynamic;
} }
@Override
public Long getDomainId() {
// TODO: get rid of me
return domainId;
}
} }

View File

@ -67,9 +67,10 @@ public class ServiceOfferingJoinDaoImpl extends GenericDaoBase<ServiceOfferingJo
offeringResponse.setLimitCpuUse(offering.isLimitCpuUse()); offeringResponse.setLimitCpuUse(offering.isLimitCpuUse());
offeringResponse.setVolatileVm(offering.getVolatileVm()); offeringResponse.setVolatileVm(offering.getVolatileVm());
offeringResponse.setTags(offering.getTags()); offeringResponse.setTags(offering.getTags());
//TODO: get domain for offering from details table offeringResponse.setDomain(offering.getDomainName());
//offeringResponse.setDomain(offering.getDomainName()); offeringResponse.setDomainId(offering.getDomainUuid());
//offeringResponse.setDomainId(offering.getDomainUuid()); offeringResponse.setZone(offering.getZoneName());
offeringResponse.setZoneId(offering.getZoneUuid());
offeringResponse.setNetworkRate(offering.getRateMbps()); offeringResponse.setNetworkRate(offering.getRateMbps());
offeringResponse.setHostTag(offering.getHostTag()); offeringResponse.setHostTag(offering.getHostTag());
offeringResponse.setDeploymentPlanner(offering.getDeploymentPlanner()); offeringResponse.setDeploymentPlanner(offering.getDeploymentPlanner());

View File

@ -160,6 +160,15 @@ public class ServiceOfferingJoinVO extends BaseViewVO implements InternalIdentit
@Column(name = "domain_path") @Column(name = "domain_path")
private String domainPath = null; private String domainPath = null;
@Column(name = "zone_id")
private String zoneId = null;
@Column(name = "zone_uuid")
private String zoneUuid = null;
@Column(name = "zone_name")
private String zoneName = null;
@Column(name = "deployment_planner") @Column(name = "deployment_planner")
private String deploymentPlanner; private String deploymentPlanner;
@ -220,6 +229,22 @@ public class ServiceOfferingJoinVO extends BaseViewVO implements InternalIdentit
return domainName; return domainName;
} }
public String getDomainPath() {
return domainPath;
}
public String getZoneId() {
return zoneId;
}
public String getZoneUuid() {
return zoneUuid;
}
public String getZoneName() {
return zoneName;
}
public Boolean isCustomizedIops() { public Boolean isCustomizedIops() {
return customizedIops; return customizedIops;
} }

View File

@ -90,7 +90,7 @@ public class AccountManagerImplVolumeDeleteEventTest extends AccountManagetImplT
Field staticField = UsageEventUtils.class.getDeclaredField("s_" + fieldName); Field staticField = UsageEventUtils.class.getDeclaredField("s_" + fieldName);
staticField.setAccessible(true); staticField.setAccessible(true);
oldFields.put(f.getName(), staticField.get(null)); oldFields.put(f.getName(), staticField.get(null));
f.set(utils, this.getClass().getSuperclass().getDeclaredField("_" + fieldName).get(this)); f.set(utils, this.getClass().getSuperclass().getDeclaredField(fieldName).get(this));
} catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) { } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) {
e.printStackTrace(); e.printStackTrace();
} }