@Override public NVPair[] process(MessageProcessorContext mpContext, MessageObject inputObject) throws MessageException, ProcessingException { if (inputObject == null) return null; /* * Load the value of configured properties */ for (PPDataHolder holder : ppData) { String propertyValue = null; try { boolean useCustomerId = StringUtils.getBoolean(holder.getUseCustomerId()); if (useCustomerId) propertyValue = PersistentProperty.get( holder.getKey(), holder.getPropertyType(), holder.getPropertyName()); else { String customerId = CustomerContext.getInstance().getCustomerID(); CustomerContext.getInstance().setCustomerID(CustomerContext.DEFAULT_CUSTOMER_ID); propertyValue = PersistentProperty.get( holder.getKey(), holder.getPropertyType(), holder.getPropertyName()); CustomerContext.getInstance().setCustomerID(customerId); } } catch (Exception ex) { Debug.warning( "Unable to get configured property from persistent property :" + holder.toString()); } /* * set the value into message processor context */ if (StringUtils.hasValue(propertyValue)) { if (Debug.isLevelEnabled(Debug.DB_DATA)) Debug.log( Debug.DB_DATA, " setting value :" + propertyValue + " on location :" + holder.getOutputLoc()); mpContext.set(holder.getOutputLoc(), propertyValue); } } /* Always return input value to provide pass-through semantics. */ return (formatNVPair(inputObject)); }
@Override public void initialize(String key, String type) throws ProcessingException { super.initialize(key, type); for (int Ix = 0; true; Ix++) { String propKey = getPropertyValue(PersistentProperty.getPropNameIteration(KEY_PROP, Ix)); if (!StringUtils.hasValue(propKey)) break; PPDataHolder holder = new PPDataHolder( propKey, getPropertyValue(PersistentProperty.getPropNameIteration(PROPERTY_TYPE_PROP, Ix)), getPropertyValue(PersistentProperty.getPropNameIteration(PROPERTY_NAME_PROP, Ix)), getPropertyValue(PersistentProperty.getPropNameIteration(OUTPUT_LOCATION_PROP, Ix)), getPropertyValue(PersistentProperty.getPropNameIteration(USE_CUSTOMER_ID_PROP, Ix))); ppData.add(holder); if (Debug.isLevelEnabled(Debug.SYSTEM_CONFIG)) Debug.log(Debug.SYSTEM_CONFIG, " Found configured property :" + holder); } }