use of org.apache.cloudstack.engine.datacenter.entity.api.db.DcDetailVO in project cloudstack by apache.
the class DcDetailsDaoImpl method deleteDetails.
@Override
public void deleteDetails(long dcId) {
SearchCriteria sc = DcSearch.create();
sc.setParameters("dcId", dcId);
List<DcDetailVO> results = search(sc, null);
for (DcDetailVO result : results) {
remove(result.getId());
}
}
use of org.apache.cloudstack.engine.datacenter.entity.api.db.DcDetailVO in project cloudstack by apache.
the class DcDetailsDaoImpl method findDetails.
@Override
public Map<String, String> findDetails(long dcId) {
SearchCriteria<DcDetailVO> sc = DcSearch.create();
sc.setParameters("dcId", dcId);
List<DcDetailVO> results = search(sc, null);
Map<String, String> details = new HashMap<String, String>(results.size());
for (DcDetailVO result : results) {
details.put(result.getName(), result.getValue());
}
return details;
}
use of org.apache.cloudstack.engine.datacenter.entity.api.db.DcDetailVO in project cloudstack by apache.
the class DcDetailsDaoImpl method persist.
@Override
public void persist(long dcId, Map<String, String> details) {
TransactionLegacy txn = TransactionLegacy.currentTxn();
txn.start();
SearchCriteria<DcDetailVO> sc = DcSearch.create();
sc.setParameters("dcId", dcId);
expunge(sc);
for (Map.Entry<String, String> detail : details.entrySet()) {
DcDetailVO vo = new DcDetailVO(dcId, detail.getKey(), detail.getValue());
persist(vo);
}
txn.commit();
}
Aggregations