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;