How to apply option filter for a WTPart structure programmatically?
Need to apply option filter on the WTPart structure programmatically. What API's to be used ?
Need to apply option filter on the WTPart structure programmatically. What API's to be used ?
Finally got a way to achieve this, Below is the approach and not the exact code.
// Create a New filter or get a existing Filter as below
NavigationCriteria nc = NavigationCriteriaHelper.service.getNavigationCriteria("FilterName");
//Get the Option and Choice linked to the part container
Map<String, Set<String>> optionToChoiceMap = new HashMap<String, Set<String>>();
// Op1 : Ch1
Set<String> choiceSet = new HashSet<String>();
Option option1 = OptionHelper.service.getOptionByName (op1, part.getContainerReference());
Choice choiceOp1 = OptionHelper.service.getChoice(ch1, op1, part.getContainerReference());
choiceSet.add(choiceOp1.getPersistInfo().getObjectIdentifier().toString());
optionToChoiceMap.put(option1.getPersistInfo().getObjectIdentifier().toString(), choiceSet);
//Create a New ATOFilter to apply the option and choices to the Navigation Criteria. Set the Option & Choice to the ATOFilter
ATONavigationFilter filter = ATONavigationFilter.newATONavigationFilter();
filter.setFilterMode(1);
filter.setOptionSet(optionSet);
filter.setChoiceMap(optionToChoiceMap);
filter.setRuleCheckingDisabled(true);
// Applying the latest ConfigSpec
List <ATORuleConfigSpec> atoRuleConfigs = new ArrayList<ATORuleConfigSpec>();
ATORuleConfigSpec atoRuleConfigSpec =ATORuleConfigSpec.newATORuleConfigSpec();
atoRuleConfigSpec.setEffActive(false);
atoRuleConfigSpec.setLatestActive(true);
atoRuleConfigSpec.setLifeCycleActive(false);
atoRuleConfigSpec = (ATORuleConfigSpec)PersistenceHelper.manager.store(atoRuleConfigSpec);
atoRuleConfigs.add(atoRuleConfigSpec);
filter.setConfigSpecs(atoRuleConfigs);
// Now add the filter to the navigation criteria
ArrayList<NavigationFilter2> filterList = new ArrayList<NavigationFilter2>(1);
filterList.add(filter);
nc.setFilters(filterList);
// Persist the navigation criteria
NavigationCriteriaHelper.service.saveNavigationCriteria(nc);
Regards,
Thiagarajan
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.