Merges the given EngineeringObject with the referenced model which is defined in the given field.
198254
private void mergeEngineeringObjectWithReferencedModel(Field field, EngineeringObjectModelWrapper model) {
        AdvancedModelWrapper result = performMerge(loadReferencedModel(model, field), model);
        if (result != null) {
            model = result.toEngineeringObject();
        }
    }
76788
private List<AdvancedModelWrapper> updateReferencedModelsByEO(EngineeringObjectModelWrapper model) {
        List<AdvancedModelWrapper> updates = new ArrayList<AdvancedModelWrapper>();
        for (Field field : model.getForeignKeyFields()) {
            try {
                AdvancedModelWrapper result = performMerge(model, loadReferencedModel(model, field));
                if (result != null) {
                    updates.add(result);
                }
            } catch (EDBException e) {
                LOGGER.debug("Skipped referenced model for field {}, since it does not exist.", field, e);
            }
        }
        return updates;
    }
391815
public static EngineeringObjectModelWrapper enhance(AdvancedModelWrapper model) {
        if (!model.isEngineeringObject()) {
            throw new IllegalArgumentException("The model of the AdvancedModelWrapper is no EngineeringObject");
        }
        return new EngineeringObjectModelWrapper(model.getUnderlyingModel());
    }
16184
@Override
    public void merge(WebServiceRef webServiceRef, Class<?> instanceClass, Member member) throws InjectionException {

        mergeWSRInfo(webServiceRef, instanceClass, member);

        // The former value should override the later one, i.e. the settings in DD should override the ones in annotation,
        // but we prefer the subclass.
        Class<?> annoType = webServiceRef.type();
        if (!annoType.getName().equals(Object.class.getName())) {
            Class<?> existingType = loadClass(wsrInfo.getServiceRefTypeClassName());

            if (!existingType.getName().equals(Object.class.getName())) {
                //prefer the subclass
                if (existingType.isAssignableFrom(annoType)) {
                    wsrInfo.setServiceRefTypeClassName(annoType.getName());
                } else if (annoType.isAssignableFrom(existingType)) {
                    wsrInfo.setServiceRefTypeClassName(existingType.getName());
                } else { // conflict
                    String msgKey;
                    Object[] inserts;
                    if (member != null) {
                        msgKey = "error.service.ref.type.mismatch.for.member";
                        inserts = new Object[] { wsrInfo.getJndiName(), member.getName(), member.getDeclaringClass().getName(),
                                                annoType.getName(), existingType.getName() };
                    } else {
                        msgKey = "error.service.ref.type.mismatch.for.class";
                        inserts = new Object[] { wsrInfo.getJndiName(), annoType.getName(), existingType.getName() };
                    }
                    Tr.error(tc, msgKey, inserts);
                    throw new InjectionException(Tr.formatMessage(tc, msgKey, inserts));
                }
            } else {
                wsrInfo.setServiceRefTypeClassName(annoType.getName());
            }
        }

        Class<?> annoValue = webServiceRef.value();
        if (!annoValue.getName().equals(Service.class.getName())) {
            Class<?> existingValue = loadClass(wsrInfo.getServiceInterfaceClassName());

            if (!existingValue.getName().equals(Service.class.getName())) {
                //prefer the subclass
                if (existingValue.isAssignableFrom(annoValue)) {
                    wsrInfo.setServiceInterfaceClassName(annoValue.getName());
                } else if (annoValue.isAssignableFrom(existingValue)) {
                    wsrInfo.setServiceInterfaceClassName(existingValue.getName());
                } else { // conflict
                    String msgKey;
                    Object[] inserts;
                    if (member != null) {
                        msgKey = "error.service.interface.mismatch.for.member";
                        inserts = new Object[] { wsrInfo.getJndiName(), member.getName(), member.getDeclaringClass().getName(), annoValue.getName(),
                                                existingValue.getName() };
                    } else {
                        msgKey = "error.service.interface.mismatch.for.class";
                        inserts = new Object[] { wsrInfo.getJndiName(), annoValue.getName(), existingValue.getName() };
                    }
                    Tr.error(tc, msgKey, inserts);
                    throw new InjectionException(Tr.formatMessage(tc, msgKey, inserts));
                }
            } else {
                wsrInfo.setServiceInterfaceClassName(annoValue.getName());
            }
        }

        // Validate and set value and type
        if (member == null) {
            validateAndSetClassLevelWebServiceRef(instanceClass);
        } else {
            // If the wsrInfo service ref type hasn't been set, the infer it from the member.
            validateAndSetMemberLevelWebServiceRef(member);
        }

        // now check the WSDL locations
        if (webServiceRef.wsdlLocation() != null && !webServiceRef.wsdlLocation().isEmpty()) {
            processExistingWSDL(webServiceRef.wsdlLocation(), member);
        }

        // now check to see if there was an @HandlerChain annotation on this member
        HandlerChain handlerChainInstance = null;
        if (member == null) {
            handlerChainInstance = instanceClass.getAnnotation(HandlerChain.class);
        } else if (member instanceof Field) {
            Field field = (Field) member;
            handlerChainInstance = field.getAnnotation(HandlerChain.class);
        } else if (member instanceof Method) {
            Method method = (Method) member;
            handlerChainInstance = method.getAnnotation(HandlerChain.class);
        }
        if (handlerChainInstance != null) {
            if (tc.isDebugEnabled()) {
                Tr.debug(tc, "@HandlerChain annotation found with @WebServiceRef annotation, jndiName: " + webServiceRef.name());
            }
            wsrInfo.setHandlerChainDeclaringClassName(instanceClass.getName());
            wsrInfo.setHandlerChainAnnotation(handlerChainInstance);
        }

    }
100241
private static <V, R extends Serializable> Accumulator<V, R> mergeSingle(Accumulator<?, ?> target,
																			 Accumulator<?, ?> toMerge) {
		@SuppressWarnings("unchecked")
		Accumulator<V, R> typedTarget = (Accumulator<V, R>) target;

		@SuppressWarnings("unchecked")
		Accumulator<V, R> typedToMerge = (Accumulator<V, R>) toMerge;

		typedTarget.merge(typedToMerge);

		return typedTarget;
	}
1176570
def MergeFrom(self, other):
    
    self._values.extend(other._values)
    self._message_listener.Modified()
1113547
public void add(final Field _field)
    {
        this.fields.put(_field.getId(), _field);
        this.fieldName2Field.put(_field.getName(), _field);
        if (_field.getReference() != null && _field.getReference().length() > 0) {
            final String ref = _field.getReference();
            int index;
            int end = 0;
            while ((index = ref.indexOf("$<", end)) > 0) {
                index += 2;
                end = ref.indexOf(">", index);
                addFieldExpr(ref.substring(index, end));
            }
        }
        _field.setCollectionUUID(getUUID());
    }
712079
private AdvancedModelWrapper performMerge(AdvancedModelWrapper source, AdvancedModelWrapper target) {
        if (source == null || target == null) {
            return null;
        }
        ModelDescription sourceDesc = source.getModelDescription();
        ModelDescription targetDesc = target.getModelDescription();
        Object transformResult = transformationEngine.performTransformation(sourceDesc, targetDesc,
            source.getUnderlyingModel(), target.getUnderlyingModel());
        AdvancedModelWrapper wrapper = AdvancedModelWrapper.wrap(transformResult);
        wrapper.removeOpenEngSBModelEntry(EDBConstants.MODEL_VERSION);
        return wrapper;
    }
1218077
private void ensureReferencedFKs(ModelDef modelDef, CollectionDescriptorDef collDef) throws ConstraintException
    {
        String             elementClassName = collDef.getProperty(PropertyHelper.OJB_PROPERTY_ELEMENT_CLASS_REF);
        ClassDescriptorDef elementClassDef  = modelDef.getClass(elementClassName);
        String             fkFieldNames     = collDef.getProperty(PropertyHelper.OJB_PROPERTY_FOREIGNKEY);
        ArrayList          missingFields    = new ArrayList();
        SequencedHashMap   fkFields         = new SequencedHashMap();

        // first we gather all field names
        for (CommaListIterator it = new CommaListIterator(fkFieldNames); it.hasNext();)
        {
            String             fieldName = (String)it.next();
            FieldDescriptorDef fieldDef  = elementClassDef.getField(fieldName);

            if (fieldDef == null)
            {
                missingFields.add(fieldName);
            }
            fkFields.put(fieldName, fieldDef);
        }

        // next we traverse all sub types and gather fields as we go
        for (Iterator it = elementClassDef.getAllExtentClasses(); it.hasNext() && !missingFields.isEmpty();)
        {
            ClassDescriptorDef subTypeDef = (ClassDescriptorDef)it.next();

            for (int idx = 0; idx < missingFields.size();)
            {
                FieldDescriptorDef fieldDef = subTypeDef.getField((String)missingFields.get(idx));

                if (fieldDef != null)
                {
                    fkFields.put(fieldDef.getName(), fieldDef);
                    missingFields.remove(idx);
                }
                else
                {
                    idx++;
                }
            }
        }
        if (!missingFields.isEmpty())
        {
            throw new ConstraintException("Cannot find field "+missingFields.get(0).toString()+" in the hierarchy with root type "+
                                          elementClassDef.getName()+" which is used as foreignkey in collection "+
                                          collDef.getName()+" in "+collDef.getOwner().getName());
        }

        // copy the found fields into the element class
        ensureFields(elementClassDef, fkFields.values());
    }
1288689
def add_model(refwcs, newcoeffs):
    
    # Update refwcs with distortion model
    for kw in model_attrs:
        if newcoeffs.__dict__[key] is not None:
            refwcs.__dict__[key] = newcoeffs.__dict__[key]
1109384
private void mergeAllFieldValues(DBObject srcDBObj, DBObject tgtDBObj) {
        for (String fieldName : srcDBObj.getUpdatedFieldNames()) {
            FieldDefinition fieldDef = m_tableDef.getFieldDef(fieldName);
            if (fieldDef != null && (fieldDef.isCollection() || fieldDef.isLinkField())) {
                Set<String> newValueSet =
                    ScalarFieldUpdater.mergeMVFieldValues(tgtDBObj.getFieldValues(fieldName),
                                                          srcDBObj.getRemoveValues(fieldName),
                                                          srcDBObj.getFieldValues(fieldName));
                tgtDBObj.clearValues(fieldName);
                tgtDBObj.addFieldValues(fieldName, newValueSet);
            } else {
                tgtDBObj.clearValues(fieldName);
                tgtDBObj.addFieldValue(fieldName, srcDBObj.getFieldValue(fieldName));
            }
        }
    }
821780
@Override
	public void addField(final SchemaField field) {

		if (field instanceof FieldDefinition) {
			addField((FieldDefinition) field);
		} else if (field instanceof CopyFieldDefinition) {
			addCopyField((CopyFieldDefinition) field);
		}
	}
264666
def _attach_to_model(self, model):
        
        if not issubclass(model, ModelWithDynamicFieldMixin):
            raise ImplementationError(
                'The "%s" model does not inherit from ModelWithDynamicFieldMixin '
                'so the "%s" DynamicField cannot be attached to it' % (
                model.__name__, self.name))

        super(DynamicFieldMixin, self)._attach_to_model(model)

        if self.dynamic_version_of is not None:
            return

        if hasattr(model, self.name):
            return

        setattr(model, self.name, self)
751766
public void merge(Object obj) {
        if (obj == null) {
            throw new IllegalArgumentException(
                    "Object to merge cannot be null");
        }

        m_properties.putAll(getPropertyMap(obj));
    }
607881
def merge(obj_a, obj_b, strategy='smart', renderer='yaml', merge_lists=False):
    '''
    
    '''
    return salt.utils.dictupdate.merge(obj_a, obj_b, strategy, renderer,
            merge_lists)
427144
private void fillEDBObjectWithEngineeringObjectInformation(EDBObject object, OpenEngSBModel model)
        throws IllegalAccessException {
        if (!new AdvancedModelWrapper(model).isEngineeringObject()) {
            return;
        }
        for (Field field : model.getClass().getDeclaredFields()) {
            OpenEngSBForeignKey annotation = field.getAnnotation(OpenEngSBForeignKey.class);
            if (annotation == null) {
                continue;
            }
            String value = (String) FieldUtils.readField(field, model, true);
            if (value == null) {
                continue;
            }
            value = String.format("%s/%s", ContextHolder.get().getCurrentContextId(), value);
            String key = getEOReferenceStringFromAnnotation(annotation);
            object.put(key, new EDBObjectEntry(key, value, String.class));
        }
    }
525086
function mergeField(memo, key){
  var result = {},
    match;

  if(_.isPlainObject(key)){
    result = key;
  }else if(_.isString(key) && (match = key.match(re.RENAME))){
    result[match[2]] = match[1];
  }else{
    result[key] = null;
  }

  return _.merge(memo, result);
}