if(options != null)
optionsPerfectMatchIterator = options.iterator();
while(optionsPerfectMatchIterator.hasNext())
{
GenericOptionDefinition option = optionsPerfectMatchIterator.next();
try
{
if(componentProperty != null && componentProperty.getValue() != null && option != null && option.getValue() != null)
{
//The option values
String optionValue = option.getValue();
//The saved values
String[] optionValueArray = optionValue.split(",");
String[] values = componentProperty.getValue().split(",");
logger.info("optionValue:" + optionValue);
logger.info("savedValue:" + componentProperty.getValue());
Set<String> optionValueSet = new HashSet(Arrays.asList(optionValueArray));
List<String> optionValueList = new ArrayList(Arrays.asList(optionValueSet.toArray()));
Collections.sort(optionValueList);
Set<String> valuesSet = new HashSet(Arrays.asList(values));
List<String> valuesList = new ArrayList(Arrays.asList(valuesSet.toArray()));
Collections.sort(valuesList);
String newOptionValue = "";
for(String value : optionValueList)
newOptionValue += value + ",";
String newValuesList = "";
for(String value : valuesList)
newValuesList += value + ",";
logger.info("newOptionValue:" + newOptionValue);
logger.info("newValuesList:" + newValuesList);
if(newOptionValue.equals(newValuesList))
exactMatchOptionName = option.getName();
}
}
catch (Exception e)
{
logger.error("Error getting exact match: " + e.getMessage(), e);