Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
Need to apply option filter on the WTPart structure programmatically. What API's to be used ?
Solved! Go to Solution.
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
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
Hi, Can you please provide me exact code like how have you fetch the WTPart with given option and Choice? it will be so healpful. Thanks. My Mail ID is Siddharth.sinha@ltts.com