Search in sources :

Example 1 with DcDetailVO

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());
    }
}
Also used : DcDetailVO(org.apache.cloudstack.engine.datacenter.entity.api.db.DcDetailVO) SearchCriteria(com.cloud.utils.db.SearchCriteria)

Example 2 with DcDetailVO

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;
}
Also used : DcDetailVO(org.apache.cloudstack.engine.datacenter.entity.api.db.DcDetailVO) HashMap(java.util.HashMap)

Example 3 with DcDetailVO

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();
}
Also used : TransactionLegacy(com.cloud.utils.db.TransactionLegacy) DcDetailVO(org.apache.cloudstack.engine.datacenter.entity.api.db.DcDetailVO) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

DcDetailVO (org.apache.cloudstack.engine.datacenter.entity.api.db.DcDetailVO)3 HashMap (java.util.HashMap)2 SearchCriteria (com.cloud.utils.db.SearchCriteria)1 TransactionLegacy (com.cloud.utils.db.TransactionLegacy)1 Map (java.util.Map)1