Search in sources :

Example 1 with ProjectionList

use of org.hibernate.criterion.ProjectionList in project opennms by OpenNMS.

the class AssetRecordDaoHibernate method getDistinctProperties.

@Override
public List<OnmsAssetRecord> getDistinctProperties() {
    DetachedCriteria criteria = DetachedCriteria.forClass(OnmsAssetRecord.class);
    ProjectionList projList = Projections.projectionList();
    // projList.add(Projections.alias(Projections.property("geolocation"), "geolocation"));
    projList.add(Projections.alias(Projections.property("additionalhardware"), "additionalhardware"));
    projList.add(Projections.alias(Projections.property("geolocation.address1"), "address1"));
    projList.add(Projections.alias(Projections.property("geolocation.address2"), "address2"));
    projList.add(Projections.alias(Projections.property("admin"), "admin"));
    projList.add(Projections.alias(Projections.property("assetNumber"), "assetNumber"));
    projList.add(Projections.alias(Projections.property("autoenable"), "autoenable"));
    projList.add(Projections.alias(Projections.property("building"), "building"));
    projList.add(Projections.alias(Projections.property("category"), "category"));
    projList.add(Projections.alias(Projections.property("circuitId"), "circuitId"));
    projList.add(Projections.alias(Projections.property("geolocation.city"), "city"));
    projList.add(Projections.alias(Projections.property("comment"), "comment"));
    projList.add(Projections.alias(Projections.property("connection"), "connection"));
    projList.add(Projections.alias(Projections.property("geolocation.longitude"), "longitude"));
    projList.add(Projections.alias(Projections.property("geolocation.latitude"), "latitude"));
    projList.add(Projections.alias(Projections.property("cpu"), "cpu"));
    projList.add(Projections.alias(Projections.property("department"), "department"));
    projList.add(Projections.alias(Projections.property("description"), "description"));
    projList.add(Projections.alias(Projections.property("displayCategory"), "displayCategory"));
    projList.add(Projections.alias(Projections.property("division"), "division"));
    projList.add(Projections.alias(Projections.property("enable"), "enable"));
    projList.add(Projections.alias(Projections.property("floor"), "floor"));
    projList.add(Projections.alias(Projections.property("hdd1"), "hdd1"));
    projList.add(Projections.alias(Projections.property("hdd2"), "hdd2"));
    projList.add(Projections.alias(Projections.property("hdd3"), "hdd3"));
    projList.add(Projections.alias(Projections.property("hdd4"), "hdd4"));
    projList.add(Projections.alias(Projections.property("hdd5"), "hdd5"));
    projList.add(Projections.alias(Projections.property("hdd6"), "hdd6"));
    projList.add(Projections.alias(Projections.property("inputpower"), "inputpower"));
    projList.add(Projections.alias(Projections.property("lease"), "lease"));
    projList.add(Projections.alias(Projections.property("maintcontract"), "maintcontract"));
    projList.add(Projections.alias(Projections.property("manufacturer"), "manufacturer"));
    projList.add(Projections.alias(Projections.property("modelNumber"), "modelNumber"));
    projList.add(Projections.alias(Projections.property("notifyCategory"), "notifyCategory"));
    projList.add(Projections.alias(Projections.property("numpowersupplies"), "numpowersupplies"));
    projList.add(Projections.alias(Projections.property("operatingSystem"), "operatingSystem"));
    projList.add(Projections.alias(Projections.property("pollerCategory"), "pollerCategory"));
    projList.add(Projections.alias(Projections.property("port"), "port"));
    projList.add(Projections.alias(Projections.property("rack"), "rack"));
    projList.add(Projections.alias(Projections.property("ram"), "ram"));
    projList.add(Projections.alias(Projections.property("region"), "region"));
    projList.add(Projections.alias(Projections.property("room"), "room"));
    projList.add(Projections.alias(Projections.property("serialNumber"), "serialNumber"));
    projList.add(Projections.alias(Projections.property("slot"), "slot"));
    projList.add(Projections.alias(Projections.property("snmpcommunity"), "snmpcommunity"));
    projList.add(Projections.alias(Projections.property("geolocation.state"), "state"));
    projList.add(Projections.alias(Projections.property("storagectrl"), "storagectrl"));
    projList.add(Projections.alias(Projections.property("supportPhone"), "supportPhone"));
    projList.add(Projections.alias(Projections.property("thresholdCategory"), "thresholdCategory"));
    projList.add(Projections.alias(Projections.property("username"), "username"));
    projList.add(Projections.alias(Projections.property("vendor"), "vendor"));
    projList.add(Projections.alias(Projections.property("vendorAssetNumber"), "vendorAssetNumber"));
    projList.add(Projections.alias(Projections.property("vendorFax"), "vendorFax"));
    projList.add(Projections.alias(Projections.property("vendorPhone"), "vendorPhone"));
    projList.add(Projections.alias(Projections.property("geolocation.zip"), "zip"));
    projList.add(Projections.alias(Projections.property("vmwareManagedObjectId"), "vmwareManagedObjectId"));
    projList.add(Projections.alias(Projections.property("vmwareManagedEntityType"), "vmwareManagedEntityType"));
    projList.add(Projections.alias(Projections.property("vmwareManagementServer"), "vmwareManagementServer"));
    projList.add(Projections.alias(Projections.property("vmwareTopologyInfo"), "vmwareTopologyInfo"));
    projList.add(Projections.alias(Projections.property("vmwareState"), "vmwareState"));
    criteria.setProjection(Projections.distinct(projList));
    criteria.setResultTransformer(Transformers.aliasToBean(OnmsAssetRecord.class));
    @SuppressWarnings("unchecked") List<OnmsAssetRecord> result = (List<OnmsAssetRecord>) getHibernateTemplate().findByCriteria(criteria);
    return result;
}
Also used : OnmsAssetRecord(org.opennms.netmgt.model.OnmsAssetRecord) DetachedCriteria(org.hibernate.criterion.DetachedCriteria) List(java.util.List) ProjectionList(org.hibernate.criterion.ProjectionList) ProjectionList(org.hibernate.criterion.ProjectionList)

Aggregations

List (java.util.List)1 DetachedCriteria (org.hibernate.criterion.DetachedCriteria)1 ProjectionList (org.hibernate.criterion.ProjectionList)1 OnmsAssetRecord (org.opennms.netmgt.model.OnmsAssetRecord)1