Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3


The KNS provides support to facilitate the addition of rows into the collection.

Code Block
titleExample codejava
// retrieve the list of BOs
Collection<PersistableBusinessObject> rawValues = KNSServiceLocator.getLookupResultsService()
        .retrieveSelectedResultBOs(lookupResultsSequenceNumber, lookupResultsBOClass, GlobalVariables.getUserSession().getUniversalUser().getPersonUniversalIdentifier());

// request is the http servlet request
String lookedUpCollectionName = request.getParameter(RiceConstants.LOOKED_UP_COLLECTION_NAME);
// the collection from the document, and we're assuming that it's of type java.util.Collection
Collection documentCollection = (Collection) ObjectUtils.getPropertyValue(document, lookedUpCollectionName);

// the type of elements from the documentCollection variable above
Class collectionElementClass = ...;

if (rawValues != null) {
    // see below for an explanation of this Map
    Map<String, String> template = getTemplate();
    for (PersistableBusinessObject nextBo : rawValues) {
        PersistableBusinessObject templatedBo = (PersistableBusinessObject) ObjectUtils.createHybridBusinessObject(collectionClass, nextBo, template);
        // Do other necessary processing before adding to the collection, including setting fields untouched by ObjectUtils.createHybridBusinessObject