* @param categoryBagStr
* @return
*/
protected CategoryBag parseCategoryBag(String categoryBagStr) {
CategoryBag categoryBag = new CategoryBag();
log.debug("CategoryBag Annotation=" + categoryBagStr);
if (!"".equals(categoryBagStr)) {
String[] sections = categoryBagStr.split(",");
for (String section : sections) {
if (section.startsWith(KEYED_REFERENCE)) {
String keyedReferenceStr = section.substring(KEYED_REFERENCE.length(),section.length());
log.debug("Found KeyedReference=" + keyedReferenceStr);
String[] keyedReferences = keyedReferenceStr.split(";");
KeyedReference keyedReference = new KeyedReference();
for (String key : keyedReferences) {
if (key.startsWith(KEY_NAME)) keyedReference.setKeyName(key.substring(KEY_NAME.length(),key.length()));
if (key.startsWith(KEY_VALUE)) keyedReference.setKeyValue(key.substring(KEY_VALUE.length(),key.length()));
if (key.startsWith(TMODEL_KEY)) keyedReference.setTModelKey(key.substring(TMODEL_KEY.length(),key.length()));
}
log.debug("KeyedReference = " + KEY_NAME + keyedReference.getKeyName() + " "
+ KEY_VALUE + keyedReference.getKeyValue() + " "
+ TMODEL_KEY + keyedReference.getTModelKey());
categoryBag.getKeyedReference().add(keyedReference);
} else {
log.warn("Ignoring " + section);
//TODO add support for KeyedReferenceGroups?
}
}