Example #1
0
  /**
   * Method to return an attached copy of the passed (detached) value. The returned attached copy is
   * a SCO wrapper. Goes through the existing keys/values in the store for this owner field and
   * removes ones no longer present, and adds new keys/values. All keys/values in the (detached)
   * value are attached.
   *
   * @param value The new (map) value
   */
  public void attachCopy(Object value) {
    java.util.Map m = (java.util.Map) value;

    // Attach all of the keys/values in the new map
    boolean keysWithoutIdentity = SCOUtils.mapHasKeysWithoutIdentity(ownerMmd);
    boolean valuesWithoutIdentity = SCOUtils.mapHasValuesWithoutIdentity(ownerMmd);

    java.util.Map attachedKeysValues = new java.util.TreeMap();
    SCOUtils.attachCopyForMap(
        ownerOP, m.entrySet(), attachedKeysValues, keysWithoutIdentity, valuesWithoutIdentity);

    // Update the attached map with the detached elements
    SCOUtils.updateMapWithMapKeysValues(
        ownerOP.getExecutionContext().getApiAdapter(), this, attachedKeysValues);
  }