Deprecated! Needs review.

Using the store is quite simple. Any Object can be stored for a specific KDOM-id and a (unique) key.

The method you should use to store something is: KnowWEUtils.storeObject(KnowWEArticle article, Section<?> s, String key, Object o) The method to look up stored information is: KnowWEUtils.getStoredObject(KnowWEArticle article, Section<?> s, String key)

  • Be sure that you use the identical section for lookup as for storing (e.g., not a father or child section)!
  • The store will survive page-edits if this particular section does not change
  • The store for a section will be reseted when the section has changed via page edit




Example is deprecated!

The following example is taken from the XMLSectionFinder:

KnowWEUtils.storeSectionInfo(article.getWeb(), article.getTitle(), sectionKDOMid, XMLSectionFinder.ATTRIBUTE_MAP_STORE_KEY, parameterMap);

Here the object parameterMap is stored for a given web, article-title, KDOM-id and a key. The following method shows how this object can be retrieved again from the store:

public static Map<String, String> getAttributeMapFor(Section s) {
	KnowWEArticle article = s.getArticle();
	if (article != null) {
		return (Map<String, String>) KnowWEUtils.getStoredObject(article.getWeb(),
					article.getTitle(), s.getId(), XMLSectionFinder.ATTRIBUTE_MAP_STORE_KEY);
	}
	return null;
}

Hint: Be sure to use the correct web, article-title, KDOM-id and key you've used to store the desired object. <tags>HowTo</tags>