Examples of DynamicViewEntity


Examples of org.ofbiz.entity.model.DynamicViewEntity

        }

        GenericValue[] productFeatures = (GenericValue[]) productFeaturesList.toArray(new GenericValue[0]);
        GenericValue productFeature = null;

    DynamicViewEntity dve = EntityHelper.createDynamicViewEntity( delegator, "ProductFeatureType");
    dve.addMemberEntity("ProductFeature", "ProductFeature");
    dve.addViewLink("ProductFeatureType", "ProductFeature", Boolean.FALSE, UtilMisc.toList(new ModelKeyMap("productFeatureTypeId", "productFeatureTypeId")));
    dve.addAlias("ProductFeature", "productFeatureId", null, null, null, null, null);
    
    List exprList = new ArrayList();
   
    String feature = "";
View Full Code Here

Examples of org.ofbiz.entity.model.DynamicViewEntity

           where
            product_feature_appl.product_id = 'GZ-2644' and
            product_feature_appl.product_feature_id = product_feature.product_feature_id and
            product_feature.product_feature_type_id = 'SOFTWARE_FEATURE'
        */
        DynamicViewEntity dve = EntityHelper.createDynamicViewEntity( delegator, "ProductFeature");
    dve.addMemberEntity("ProductFeatureAppl", "ProductFeatureAppl");
    dve.addViewLink("ProductFeature", "ProductFeatureAppl", Boolean.FALSE, UtilMisc.toList(new ModelKeyMap("productFeatureId", "productFeatureId")));
    dve.addAlias("ProductFeatureAppl", "productId", null, null, null, null, null);
    
    EntityCondition condition = new EntityConditionList(UtilMisc.toList(
        new EntityExpr("productFeatureTypeId", EntityOperator.EQUALS, productFeatureTypeId),
        new EntityExpr("productId", EntityOperator.EQUALS, productId)),
        EntityOperator.AND);
View Full Code Here

Examples of org.ofbiz.entity.model.DynamicViewEntity

        ArrayList list = new ArrayList();
        List returnList = null;
       
    // select X from Deal d, entity_access ea, team_member tm where ea.entity = "Deal" and ea.partyEntityType = "Team"
    //  and ea.party_id = tm.team_id and tm.party_id = <partyId> and ea.entity_id = d.deal_id
    DynamicViewEntity dve = EntityHelper.createDynamicViewEntity( delegator, "Deal");
    dve.addMemberEntity("EntityAccess", "EntityAccess");
    dve.addMemberEntity("TeamMember", "TeamMember");
    dve.addViewLink("Deal", "EntityAccess", Boolean.FALSE, UtilMisc.toList(new ModelKeyMap("dealId", "entityId")));
    dve.addViewLink("EntityAccess", "TeamMember", Boolean.FALSE, UtilMisc.toList(new ModelKeyMap("partyId", "teamId")));
    dve.addAlias("EntityAccess", "partyEntityType", null, null, null, null, null);
    dve.addAlias("EntityAccess", "entity", null, null, null, null, null);
    dve.addAlias("TeamMember", "tmPartyId", "partyId", null, null, null, null);
    
    EntityCondition condition = new EntityConditionList(UtilMisc.toList(
        new EntityExpr("entity", EntityOperator.EQUALS, "Deal"),
             new EntityExpr("partyEntityType", EntityOperator.EQUALS, "Team"),
        new EntityExpr("tmPartyId", EntityOperator.EQUALS, partyId),
View Full Code Here

Examples of org.ofbiz.entity.model.DynamicViewEntity

        return this.condition;
    }

    public List runQuery() throws GenericEntityException {
        Delegator delegator = this.getDelegator();
        DynamicViewEntity view = this.makeView();
        EntityListIterator eli = null;
        List result = null;
        try {
            eli = delegator.findListIteratorByCondition(view, this.getCondition(), null, null, null, null);
            result = eli.getCompleteList();
View Full Code Here

Examples of org.ofbiz.entity.model.DynamicViewEntity

    protected Delegator getDelegator() {
        return SharkContainer.getDelegator();
    }

    private DynamicViewEntity makeView() {
        DynamicViewEntity view = new DynamicViewEntity();


        // create the members
        Iterator eni = this.entityNames.entrySet().iterator();
        while (eni.hasNext()) {
            Map.Entry entry = (Map.Entry) eni.next();
            view.addMemberEntity((String) entry.getKey(), (String) entry.getValue());
        }

        // set alias all fields
        Iterator aai = autoFields.iterator();
        while (aai.hasNext()) {
            String alias = (String) aai.next();
            view.addAliasAll(alias, "", null);
        }

        // create the other field aliases
        Iterator fni = fieldNames.keySet().iterator();
        while (fni.hasNext()) {
            String entityAlias = (String) fni.next();
            Map fieldMap = (Map) fieldNames.get(entityAlias);
            Iterator fmi = fieldMap.entrySet().iterator();
            while (fmi.hasNext()) {
                Map.Entry entry = (Map.Entry) fmi.next();
                view.addAlias(entityAlias, (String) entry.getValue(), (String) entry.getKey(), null, null, null, null);
            }
        }

        // add the view links
        Iterator vli = this.viewLinks.iterator();
        while (vli.hasNext()) {
            ViewLink vl = (ViewLink) vli.next();
            view.addViewLink(vl.entityAlias, vl.relEntityAlias, vl.relOptional, vl.keyMaps);
        }

        return view;
    }
View Full Code Here

Examples of org.ofbiz.entity.model.DynamicViewEntity

        ArrayList orderBy = new ArrayList();
        orderBy.add("description");

    // select X from roleType rt,. code c where rt.roleTypeId = c.codeId and c.codeTypeId = "ROLE_TYPE_SFA" order by description    
    DynamicViewEntity dve = EntityHelper.createDynamicViewEntity( delegator, "RoleType");
    dve.addMemberEntity("Code", "Code");
    dve.addViewLink("RoleType", "Code", Boolean.FALSE, UtilMisc.toList(new ModelKeyMap("roleTypeId", "codeId")));
    dve.addAlias("Code", "codeTypeId", null, null, null, null, null);
    
    EntityCondition condition = new EntityConditionList(UtilMisc.toList(
        new EntityExpr("codeTypeId", EntityOperator.EQUALS, "ROLE_TYPE_SFA")),
        EntityOperator.AND);
       
View Full Code Here

Examples of org.ofbiz.entity.model.DynamicViewEntity

        List<GenericValue> partyList = null;
        List<Map<String, String>> resultList = null;

        // create the dynamic view entity
        DynamicViewEntity dynamicView = new DynamicViewEntity();

        // Person (name + card)
        dynamicView.addMemberEntity("PT", "Party");
        dynamicView.addAlias("PT", "partyId");
        dynamicView.addAlias("PT", "statusId");
        dynamicView.addAlias("PT", "partyTypeId");
        dynamicView.addMemberEntity("PE", "Person");
        dynamicView.addAlias("PE", "partyId");
        dynamicView.addAlias("PE", "lastName");
        dynamicView.addAlias("PE", "cardId");
        dynamicView.addViewLink("PT", "PE", Boolean.FALSE, ModelKeyMap.makeKeyMapList("partyId"));

        if (UtilValidate.isNotEmpty(email)) {
            // ContactMech (email)
            dynamicView.addMemberEntity("PM", "PartyContactMechPurpose");
            dynamicView.addAlias("PM", "contactMechId");
            dynamicView.addAlias("PM", "contactMechPurposeTypeId");
            dynamicView.addAlias("PM", "thruDate");
            dynamicView.addMemberEntity("CM", "ContactMech");
            dynamicView.addAlias("CM", "infoString");
            dynamicView.addViewLink("PT", "PM", Boolean.FALSE, ModelKeyMap.makeKeyMapList("partyId"));
            dynamicView.addViewLink("PM", "CM", Boolean.FALSE, ModelKeyMap.makeKeyMapList("contactMechId"));
        } else if (UtilValidate.isNotEmpty(phone)) {
            dynamicView.addMemberEntity("PM", "PartyContactMechPurpose");
            dynamicView.addAlias("PM", "contactMechId");
            dynamicView.addAlias("PM", "thruDate");
            dynamicView.addAlias("PM", "contactMechPurposeTypeId");
            dynamicView.addMemberEntity("TN", "TelecomNumber");
            dynamicView.addAlias("TN", "contactNumber");
            dynamicView.addViewLink("PT", "PM", Boolean.FALSE, ModelKeyMap.makeKeyMapList("partyId"));
            dynamicView.addViewLink("PM", "TN", Boolean.FALSE, ModelKeyMap.makeKeyMapList("contactMechId"));
        }

            // define the main condition & expression list
            List<EntityCondition> andExprs = FastList.newInstance();
            EntityCondition mainCond = null;
View Full Code Here

Examples of org.ofbiz.entity.model.DynamicViewEntity

        throws GenericEntityException {
        // Figure out the attribute ID for the UiAttribute this parameter corresponds to so we can
        // save the query.
        // select * from UiAttribute a, UIEntity e where e.entity_id = a.entity_id and a.attribute_name = <searchAttrName> and e.entityName = <searchEntityName>
       
        DynamicViewEntity dve = EntityHelper.createDynamicViewEntity( delegator, "UiAttribute");
    dve.addMemberEntity("UiEntity", "UiEntity");
    dve.addViewLink("UiAttribute", "UiEntity", Boolean.FALSE, UtilMisc.toList(new ModelKeyMap("entityId", "entityId")));
    dve.addAlias("UiEntity", "entityName", null, null, null, null, null);
    
    EntityCondition condition = new EntityConditionList(UtilMisc.toList(
        new EntityExpr("attributeName", EntityOperator.EQUALS, searchAttribName),
        new EntityExpr("entityName", EntityOperator.EQUALS, searchEntityName)),
        EntityOperator.AND);
View Full Code Here

Examples of org.ofbiz.entity.model.DynamicViewEntity

        if ((sectionId != null)) {

      // Find the last query used by this party ID for this screen section.
      // select X from ui_attribute a, ui_screen_section_entity sse where a.entity_id = sse.entity_id and sse.section_id = <sectionId> order by attribute_name
      DynamicViewEntity dve = EntityHelper.createDynamicViewEntity( delegator, "UiAttribute");
      dve.addMemberEntity("UiScreenSectionEntity", "UiScreenSectionEntity");
      dve.addViewLink("UiAttribute", "UiScreenSectionEntity", Boolean.FALSE, UtilMisc.toList(new ModelKeyMap("entityId", "entityId")));
      dve.addAlias("UiScreenSectionEntity", "sectionId", null, null, null, null, null);
    
      EntityCondition condition = new EntityConditionList(UtilMisc.toList(
          new EntityExpr("sectionId", EntityOperator.EQUALS, sectionId)),
          EntityOperator.AND);
View Full Code Here

Examples of org.ofbiz.entity.model.DynamicViewEntity

   * @return a dynamic view entity that is based on the specified modelEntity
   */
  public static DynamicViewEntity createDynamicViewEntity(GenericDelegator delegator, ModelEntity modelEntity)
  {
    String entityName = modelEntity.getEntityName();
    DynamicViewEntity dve = new DynamicViewEntity();
    dve.addMemberEntity(entityName, entityName);
   
    Iterator modelFieldIter = modelEntity.getFieldsIterator();
    while (modelFieldIter.hasNext()) {
      ModelField modelField = (ModelField) modelFieldIter.next();
      dve.addAlias(entityName, modelField.getName(), null, null, Boolean.valueOf(modelField.getIsPk()), null, null);
    }

    return dve;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.