List<ISuggestionCategory> categories = new ArrayList<ISuggestionCategory>();
if ((data != null) && (data.length > 0)) {
String SEPARATOR = "::";
SuggestionCategoryImpl currentCategory = null;
for (String line : data) {
String[] tab = line.split(SEPARATOR);
if ((tab == null) || (tab.length != 3)) {
break;
}
String level = tab[0];
String label = tab[1];
String attribute = tab[2];
if ("menu".equals(level)) {
currentCategory = new SuggestionCategoryImpl();
currentCategory.setSuggestionList(new ArrayList<ISuggestionItem>());
currentCategory.setLabel(label);
categories.add(currentCategory);
} else if ("submenu".equals(level)) {
if (currentCategory != null) {
SuggestionItemImpl suggestion = new SuggestionItemImpl();
suggestion.setLabel(label);
suggestion.setValue(attribute);
currentCategory.getSuggestionList().add(suggestion);
} else {
String errorMessage = "Scan server ('" + scanserver + "') property '" + property
+ "' provide with unexpected format";
LOGGER.warn(errorMessage);
}