Search in sources :

Example 1 with MdRelationshipDAOIF

use of com.runwaysdk.dataaccess.MdRelationshipDAOIF 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;
}
Also used : BusinessQuery(com.runwaysdk.business.BusinessQuery) MdRelationshipDAOIF(com.runwaysdk.dataaccess.MdRelationshipDAOIF) QueryFactory(com.runwaysdk.query.QueryFactory) RelationshipQuery(com.runwaysdk.business.RelationshipQuery) ArrayList(java.util.ArrayList) Business(com.runwaysdk.business.Business)

Aggregations

Business (com.runwaysdk.business.Business)1 BusinessQuery (com.runwaysdk.business.BusinessQuery)1 RelationshipQuery (com.runwaysdk.business.RelationshipQuery)1 MdRelationshipDAOIF (com.runwaysdk.dataaccess.MdRelationshipDAOIF)1 QueryFactory (com.runwaysdk.query.QueryFactory)1 ArrayList (java.util.ArrayList)1