use of com.runwaysdk.business.RelationshipQuery in project geoprism-registry by terraframe.
the class ChangeRequest method getOrderedActions.
public List<AbstractAction> getOrderedActions() {
// TODO : Runway querybuilder is dumb
// QueryFactory qf = new QueryFactory();
//
// ChangeRequestQuery crq = new ChangeRequestQuery(qf);
// AbstractActionQuery aaq = new AbstractActionQuery(qf);
//
// aaq.ORDER_BY(aaq.getCreateActionDate(), SortOrder.DESC);
// aaq.WHERE(aaq.request(crq));
// aaq.WHERE(crq.getOid().EQ(this.getOid()));
//
// return aaq.getIterator().getAll();
MdRelationshipDAOIF mdRelationshipIF = MdRelationshipDAO.getMdRelationshipDAO(HasActionRelationship.CLASS);
QueryFactory queryFactory = new QueryFactory();
// Get the relationships where this object is the parent
RelationshipQuery rq = queryFactory.relationshipQuery(HasActionRelationship.CLASS);
rq.WHERE(rq.parentOid().EQ(this.getOid()));
// Now fetch the child objects
BusinessQuery bq = queryFactory.businessQuery(mdRelationshipIF.getChildMdBusiness().definesType());
bq.WHERE(bq.isChildIn(rq));
bq.ORDER_BY(bq.get(AbstractAction.CREATEACTIONDATE), SortOrder.ASC);
List<Business> bizes = bq.getIterator().getAll();
List<AbstractAction> actions = new ArrayList<AbstractAction>();
for (Business biz : bizes) {
actions.add((AbstractAction) biz);
}
return actions;
}
Aggregations