/** * Creates a new object of the same class as this object. * @return a clone of this instance. * @exception CloneNotSupportedException if the object's class does not support the <code>Cloneable</code> interface. * @see java.lang.Cloneable */ public Object clone() throws CloneNotSupportedException { BaseField field = new PropertiesField(null, m_strFieldName, m_iMaxLength, m_strFieldDesc, null); field.setRecord(m_record); // Set table without adding to table field list return field; } /**
/** * Get this property. */ public String getProperty(String strKey) { return ((PropertiesField)this.getField(Product.PROPERTIES)).getProperty(strKey); } /**
/** * Set this property in the user's property area. * @param strProperty The property key. * @param strValue The property value. */ public void setProperty(String strProperty, String strValue) { this.setProperty(strProperty, strValue, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); } /**
FieldDataScratchHandler listener = (FieldDataScratchHandler)this.getListener(FieldDataScratchHandler.class, false); if (listener == null) return super.doMergeData(objData); String strOrigProperties = (String)listener.getOriginalData(); Map<String,Object> propRead = this.getProperties(); // Disk image (with updates from others) Map<String,Object> propOrig = this.internalStringToProperties(strOrigProperties); // Before I made any changes Map<String,Object> propCurrent = this.internalStringToProperties((String)objData); // Current image (with my changes) Map<String,Object> propNew = new Hashtable<String,Object>(); // New image (with my changes) Utility.getLogger().info("propRead: " + propRead); String strOrigValue = (String)propOrig.get(strKey); String strReadValue = (String)propRead.get(strKey); String strNewValue = this.getNewValue(strKey, strReadValue, strOrigValue, strCurrentValue); if (strNewValue != null) propNew.put(strKey, strNewValue); if (strNewValue == strReadValue) bOrigChange = this.updateOrigKey(propOrig, strKey, strOrigValue, strNewValue, bOrigChange); String strNewValue = this.getNewValue(strKey, strReadValue, strOrigValue, strCurrentValue); if (strNewValue != null) propNew.put(strKey, strNewValue); if (strNewValue == strReadValue) bOrigChange = this.updateOrigKey(propOrig, strKey, strOrigValue, strNewValue, bOrigChange); listener.setOriginalData(this.propertiesToInternalString(propOrig)); Utility.getLogger().info("propNew: " + propNew); return this.setProperties(propNew);
/** * Add any message properties that are set in this record. */ public void addMessageProperties(String strPrefix, boolean bDeleteProperties, MessageHeader messageHeader, Message message, String strNewPrefix) { Map<String,Object> properties = ((PropertiesField)this.getField(BookingDetail.PROPERTIES)).getProperties(); if (properties != null) { Iterator<String> iterator = properties.keySet().iterator(); while (iterator.hasNext()) { String strKey = iterator.next(); if (strKey.startsWith(strPrefix)) { String value = (String)properties.get(strKey); if (bDeleteProperties) ((PropertiesField)this.getField(BookingDetail.PROPERTIES)).setProperty(strKey, null); // Remove from record strKey = strKey.substring(strPrefix.length()); if (strNewPrefix != null) strKey = strNewPrefix + strKey; if (messageHeader instanceof TrxMessageHeader) // Always ((TrxMessageHeader)messageHeader).put(strKey, value); if (message instanceof BaseMessage) // Always if (((BaseMessage)message).getMessageDataDesc(ProductRequest.PRODUCT_MESSAGE) != null) ((MessageRecordDesc)((BaseMessage)message).getMessageDataDesc(ProductRequest.PRODUCT_MESSAGE)).put(strKey, value); } } } } /**
/** * Load the properties from the field and parse them. * @return The java properties. */ public Map<String,Object> loadProperties() { return this.getProperties(); } /**
/** * Initialize class fields. */ public void init(Record record, String strName, int iDataLength, String strDesc, Object strDefault) { super.init(record, strName, iDataLength, strDesc, strDefault); } /**
m_propertiesCache = this.loadProperties(); boolean bChanged = false; if (bChanged) String strProperties = this.propertiesToInternalString(m_propertiesCache); Map<String,Object> propertiesSave = m_propertiesCache; iErrorCode = this.setString(strProperties, bDisplayOption, iMoveMode);
/** * Get this property in the user's property area. * @param strProperty The property key to retrieve. * @return The property. */ public String getProperty(String strProperty) { if ((strProperty == null) || (strProperty.length() == 0)) return null; if (m_propertiesCache == null) m_propertiesCache = this.loadProperties(); return (String)m_propertiesCache.get(strProperty); // Add code here } /**
/** * Set this property in the user's property area. * @param strProperty The property key. * @param strValue The property value. */ public int setProperties(Map<String,Object> properties) { return this.setProperties(properties, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); } /**
strNewValue = this.mergeKey(strKey, strReadValue, strCurrentValue); // I HAVE changed it, so I need to figure out which one is better
FieldDataScratchHandler listener = (FieldDataScratchHandler)this.getListener(FieldDataScratchHandler.class, false); if (listener == null) return super.doMergeData(objData); String strOrigProperties = (String)listener.getOriginalData(); Map<String,Object> propRead = this.getProperties(); // Disk image (with updates from others) Map<String,Object> propOrig = this.internalStringToProperties(strOrigProperties); // Before I made any changes Map<String,Object> propCurrent = this.internalStringToProperties((String)objData); // Current image (with my changes) Map<String,Object> propNew = new Hashtable<String,Object>(); // New image (with my changes) Utility.getLogger().info("propRead: " + propRead); String strOrigValue = (String)propOrig.get(strKey); String strReadValue = (String)propRead.get(strKey); String strNewValue = this.getNewValue(strKey, strReadValue, strOrigValue, strCurrentValue); if (strNewValue != null) propNew.put(strKey, strNewValue); if (strNewValue == strReadValue) bOrigChange = this.updateOrigKey(propOrig, strKey, strOrigValue, strNewValue, bOrigChange); String strNewValue = this.getNewValue(strKey, strReadValue, strOrigValue, strCurrentValue); if (strNewValue != null) propNew.put(strKey, strNewValue); if (strNewValue == strReadValue) bOrigChange = this.updateOrigKey(propOrig, strKey, strOrigValue, strNewValue, bOrigChange); listener.setOriginalData(this.propertiesToInternalString(propOrig)); Utility.getLogger().info("propNew: " + propNew); return this.setProperties(propNew);
/** * Add any message properties that are set in this record. */ public void addMessageProperties(String strPrefix, boolean bDeleteProperties, MessageHeader messageHeader, Message message, String strNewPrefix) { Map<String,Object> properties = ((PropertiesField)this.getField(BookingDetail.PROPERTIES)).getProperties(); if (properties != null) { Iterator<String> iterator = properties.keySet().iterator(); while (iterator.hasNext()) { String strKey = iterator.next(); if (strKey.startsWith(strPrefix)) { String value = (String)properties.get(strKey); if (bDeleteProperties) ((PropertiesField)this.getField(BookingDetail.PROPERTIES)).setProperty(strKey, null); // Remove from record strKey = strKey.substring(strPrefix.length()); if (strNewPrefix != null) strKey = strNewPrefix + strKey; if (messageHeader instanceof TrxMessageHeader) // Always ((TrxMessageHeader)messageHeader).put(strKey, value); if (message instanceof BaseMessage) // Always if (((BaseMessage)message).getMessageDataDesc(ProductRequest.PRODUCT_MESSAGE) != null) ((MessageRecordDesc)((BaseMessage)message).getMessageDataDesc(ProductRequest.PRODUCT_MESSAGE)).put(strKey, value); } } } } /**
/** * Load the properties from the field and parse them. * @return The java properties. */ public Map<String,Object> loadProperties() { return this.getProperties(); } /**
/** * Initialize this object. * @param record The parent record. * @param strName The field name. * @param iDataLength The maximum string length (pass -1 for default). * @param strDesc The string description (usually pass null, to use the resource file desc). * @param strDefault The default value (if object, this value is the default value, if string, the string is the default). */ public void init(Record record, String strName, int iDataLength, String strDesc, Object strDefault) { super.init(record, strName, iDataLength, strDesc, strDefault); } /**
m_propertiesCache = this.loadProperties(); boolean bChanged = false; if (bChanged) String strProperties = this.propertiesToInternalString(m_propertiesCache); Map<String,Object> propertiesSave = m_propertiesCache; iErrorCode = this.setString(strProperties, bDisplayOption, iMoveMode);
/** * Get this property in the user's property area. * @param strProperty The property key to retrieve. * @return The property. */ public String getProperty(String strProperty) { if ((strProperty == null) || (strProperty.length() == 0)) return null; if (m_propertiesCache == null) m_propertiesCache = this.loadProperties(); return (String)m_propertiesCache.get(strProperty); // Add code here } /**
/** * Set this property in the user's property area. * @param strProperty The property key. * @param strValue The property value. */ public int setProperties(Properties properties) { return this.setProperties((Map)properties, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); } /**
strNewValue = this.mergeKey(strKey, strReadValue, strCurrentValue); // I HAVE changed it, so I need to figure out which one is better
FieldDataScratchHandler listener = (FieldDataScratchHandler)this.getListener(FieldDataScratchHandler.class, false); if (listener == null) return super.doMergeData(objData); String strOrigProperties = (String)listener.getOriginalData(); Map<String,Object> propRead = this.getProperties(); // Disk image (with updates from others) Map<String,Object> propOrig = this.internalStringToProperties(strOrigProperties); // Before I made any changes Map<String,Object> propCurrent = this.internalStringToProperties((String)objData); // Current image (with my changes) Map<String,Object> propNew = new Hashtable<String,Object>(); // New image (with my changes) Utility.getLogger().info("propRead: " + propRead); String strOrigValue = (String)propOrig.get(strKey); String strReadValue = (String)propRead.get(strKey); String strNewValue = this.getNewValue(strKey, strReadValue, strOrigValue, strCurrentValue); if (strNewValue != null) propNew.put(strKey, strNewValue); if (strNewValue == strReadValue) bOrigChange = this.updateOrigKey(propOrig, strKey, strOrigValue, strNewValue, bOrigChange); String strNewValue = this.getNewValue(strKey, strReadValue, strOrigValue, strCurrentValue); if (strNewValue != null) propNew.put(strKey, strNewValue); if (strNewValue == strReadValue) bOrigChange = this.updateOrigKey(propOrig, strKey, strOrigValue, strNewValue, bOrigChange); listener.setOriginalData(this.propertiesToInternalString(propOrig)); Utility.getLogger().info("propNew: " + propNew); return this.setProperties(propNew);