/** * Get the named Related Entity for the GenericValue from the persistent store across another Relation. * Helps to get related Values in a multi-to-multi relationship. * @param relationNameOne String containing the relation name which is the * combination of relation.title and relation.rel-entity-name as * specified in the entity XML definition file, for first relation * @param relationNameTwo String containing the relation name for second relation * @param value GenericValue instance containing the entity * @param orderBy The fields of the named entity to order the query by; may be null; * optionally add a " ASC" for ascending or " DESC" for descending * @return List of GenericValue instances as specified in the relation definition */ public List getMultiRelation(GenericValue value, String relationNameOne, String relationNameTwo, List orderBy) throws GenericEntityException { //TODO: add eca eval calls // traverse the relationships ModelEntity modelEntity = value.getModelEntity(); ModelRelation modelRelationOne = modelEntity.getRelation(relationNameOne); ModelEntity modelEntityOne = getModelEntity(modelRelationOne.getRelEntityName()); ModelRelation modelRelationTwo = modelEntityOne.getRelation(relationNameTwo); ModelEntity modelEntityTwo = getModelEntity(modelRelationTwo.getRelEntityName()); GenericHelper helper = getEntityHelper(modelEntity); return helper.findByMultiRelation(value, modelRelationOne, modelEntityOne, modelRelationTwo, modelEntityTwo, orderBy); }
/** * Get the named Related Entity for the GenericValue from the persistent store across another Relation. * Helps to get related Values in a multi-to-multi relationship. * @param relationNameOne String containing the relation name which is the * combination of relation.title and relation.rel-entity-name as * specified in the entity XML definition file, for first relation * @param relationNameTwo String containing the relation name for second relation * @param value GenericValue instance containing the entity * @param orderBy The fields of the named entity to order the query by; may be null; * optionally add a " ASC" for ascending or " DESC" for descending * @return List of GenericValue instances as specified in the relation definition */ public List getMultiRelation(GenericValue value, String relationNameOne, String relationNameTwo, List orderBy) throws GenericEntityException { //TODO: add eca eval calls // traverse the relationships ModelEntity modelEntity = value.getModelEntity(); ModelRelation modelRelationOne = modelEntity.getRelation(relationNameOne); ModelEntity modelEntityOne = getModelEntity(modelRelationOne.getRelEntityName()); ModelRelation modelRelationTwo = modelEntityOne.getRelation(relationNameTwo); ModelEntity modelEntityTwo = getModelEntity(modelRelationTwo.getRelEntityName()); GenericHelper helper = getEntityHelper(modelEntity); return helper.findByMultiRelation(value, modelRelationOne, modelEntityOne, modelRelationTwo, modelEntityTwo, orderBy); }
/** * Get the named Related Entity for the GenericValue from the persistent * store across another Relation. Helps to get related Values in a * multi-to-multi relationship. * * @param relationNameOne String containing the relation name which is the * combination of relation.title and relation.rel-entity-name as * specified in the entity XML definition file, for first relation * @param relationNameTwo String containing the relation name for second relation * @param value GenericValue instance containing the entity * @param orderBy The fields of the named entity to order the query by; may be null; * optionally add a " ASC" for ascending or " DESC" for descending * @return List of GenericValue instances as specified in the relation definition */ public List<GenericValue> getMultiRelation(final GenericValue value, final String relationNameOne, final String relationNameTwo, final List<String> orderBy) throws GenericEntityException { checkIfLocked(); // traverse the relationships ModelEntity modelEntity = value.getModelEntity(); ModelRelation modelRelationOne = modelEntity.getRelation(relationNameOne); ModelEntity modelEntityOne = getModelEntity(modelRelationOne.getRelEntityName()); ModelRelation modelRelationTwo = modelEntityOne.getRelation(relationNameTwo); ModelEntity modelEntityTwo = getModelEntity(modelRelationTwo.getRelEntityName()); GenericHelper helper = getEntityHelper(modelEntity); return helper.findByMultiRelation( value, modelRelationOne, modelEntityOne, modelRelationTwo, modelEntityTwo, orderBy); }