use of com.cloud.deployasis.TemplateDeployAsIsDetailVO in project cloudstack by apache.
the class TemplateDeployAsIsDetailsDaoImpl method findPropertyByTemplateAndKey.
@Override
public OVFPropertyTO findPropertyByTemplateAndKey(long templateId, String key) {
SearchCriteria<TemplateDeployAsIsDetailVO> sc = createSearchCriteria();
sc.addAnd("resourceId", SearchCriteria.Op.EQ, templateId);
sc.addAnd("name", SearchCriteria.Op.EQ, key.startsWith(DeployAsIsConstants.PROPERTY_PREFIX) ? key : DeployAsIsConstants.PROPERTY_PREFIX + key);
OVFPropertyTO property = null;
TemplateDeployAsIsDetailVO detail = findOneBy(sc);
if (detail != null) {
property = gson.fromJson(detail.getValue(), OVFPropertyTO.class);
}
return property;
}
use of com.cloud.deployasis.TemplateDeployAsIsDetailVO in project cloudstack by apache.
the class TemplateDeployAsIsDetailsDaoImpl method listNetworkRequirementsByTemplateId.
@Override
public List<OVFNetworkTO> listNetworkRequirementsByTemplateId(long templateId) {
List<TemplateDeployAsIsDetailVO> networkDetails = listDetailsByTemplateIdMatchingPrefix(templateId, DeployAsIsConstants.NETWORK_PREFIX);
List<OVFNetworkTO> networkPrereqs = new ArrayList<>();
for (TemplateDeployAsIsDetailVO property : networkDetails) {
OVFNetworkTO ovfPropertyTO = gson.fromJson(property.getValue(), OVFNetworkTO.class);
networkPrereqs.add(ovfPropertyTO);
}
networkPrereqs.sort(new Comparator<OVFNetworkTO>() {
@Override
public int compare(OVFNetworkTO o1, OVFNetworkTO o2) {
return o1.getInstanceID() - o2.getInstanceID();
}
});
return networkPrereqs;
}
use of com.cloud.deployasis.TemplateDeployAsIsDetailVO in project cloudstack by apache.
the class DeployAsIsHelperImpl method saveTemplateDeployAsIsPropertyAttribute.
private void saveTemplateDeployAsIsPropertyAttribute(long templateId, String key, String value) {
if (LOGGER.isTraceEnabled()) {
LOGGER.trace(String.format("Saving property %s for template %d as detail", key, templateId));
}
if (templateDeployAsIsDetailsDao.findDetail(templateId, key) != null) {
LOGGER.debug(String.format("Detail '%s' existed for template %d, deleting.", key, templateId));
templateDeployAsIsDetailsDao.removeDetail(templateId, key);
}
if (LOGGER.isTraceEnabled()) {
LOGGER.trace(String.format("Template detail for template %d to save is '%s': '%s'", templateId, key, value));
}
TemplateDeployAsIsDetailVO detailVO = new TemplateDeployAsIsDetailVO(templateId, key, value);
LOGGER.debug("Persisting template details " + detailVO.getName() + " from OVF properties for template " + templateId);
templateDeployAsIsDetailsDao.persist(detailVO);
}
Aggregations