Tabnine Logo
EISOneToManyMappingHelper
Code IndexAdd Tabnine to your IDE (free)

How to use
EISOneToManyMappingHelper
in
org.eclipse.persistence.eis.mappings

Best Java code snippets using org.eclipse.persistence.eis.mappings.EISOneToManyMappingHelper (Showing top 20 results out of 315)

origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * INTERNAL:
 * Compare the attributes belonging to this mapping for the objects.
 */
@Override
public boolean compareObjects(Object object1, Object object2, AbstractSession session) {
  if (isForeignKeyRelationship()) {
    return (new EISOneToManyMappingHelper(this)).compareObjects(object1, object2, session);
  }
  return super.compareObjects(object1, object2, session);
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * INTERNAL:
 * Compare the attributes belonging to this mapping for the objects.
 */
public boolean compareObjects(Object object1, Object object2, AbstractSession session) {
  return this.compareAttributeValues(this.getRealCollectionAttributeValueFromObject(object1, session), this.getRealCollectionAttributeValueFromObject(object2, session), session);
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
* ADVANCED:
* This method is used to have an object removed from a collection once the changeSet is applied
* The referenceKey parameter should only be used for direct Maps.
*/
public void simpleRemoveFromCollectionChangeRecord(Object referenceKey, Object changeSetToRemove, ObjectChangeSet changeSet, AbstractSession session) {
  (new EISOneToManyMappingHelper(this)).simpleRemoveFromCollectionChangeRecord(referenceKey, changeSetToRemove, changeSet, session);
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * ADVANCED:
 * This method is used to have an object add to a collection once the changeSet is applied
 * The referenceKey parameter should only be used for direct Maps.
 */
@Override
public void simpleAddToCollectionChangeRecord(Object referenceKey, Object changeSetToAdd, ObjectChangeSet changeSet, AbstractSession session) {
  (new EISOneToManyMappingHelper(this)).simpleAddToCollectionChangeRecord(referenceKey, changeSetToAdd, changeSet, session);
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

ContainerPolicy cp = this.getContainerPolicy();
EISOrderedCollectionChangeRecord changeRecord = new EISOrderedCollectionChangeRecord(owner, this.getAttributeName(), this.getDatabaseMapping());
  boolean found = false;
  for (int j = 0; j < backupVector.size(); j++) {
    if (this.compareElementsForChange(cloneElement, backupVector.get(j), session)) {
      changeRecord.addMovedChangeSet(this.buildChangeSet(cloneElement, owner, session), j, i);
      break;// matching backup element found - skip the rest of them
    changeRecord.addAddedChangeSet(this.buildChangeSet(cloneElement, owner, session), i);
  if (backupElement != XXX) {
    changeRecord.addRemovedChangeSet(this.buildChangeSet(backupElement, owner, session), i);
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

ContainerPolicy cp = this.getContainerPolicy();
AbstractSession session = mergeManager.getSession();
  targetCollection = cp.containerInstance(sdkChangeRecord.getAdds().size());
} else {
  targetCollection = this.getRealCollectionAttributeValueFromObject(target, session);
    Object removeElement = this.buildRemovedElementFromChangeSet(stream.nextElement(), mergeManager);
      if (this.compareElements(targetElement, removeElement, session)) {
        break;// matching element found - skip the rest of them
    Object addElement = this.buildAddedElementFromChangeSet(stream.nextElement(), mergeManager);
    cp.addInto(addElement, targetCollection, session);
    Object changedMapKeyElement = this.buildAddedElementFromChangeSet(stream.nextElement(), mergeManager);
    Object originalElement = ((UnitOfWorkImpl)session).getOriginalVersionOfObject(changedMapKeyElement);
    cp.removeFrom(originalElement, targetCollection, session);
this.setRealAttributeValueInObject(target, targetCollection);
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * INTERNAL:
 * Merge changes from the source to the target object.
 * Simply replace the entire target collection.
 */
public void mergeIntoObject(Object target, boolean isTargetUnInitialized, Object source, MergeManager mergeManager, AbstractSession targetSession) {
  ContainerPolicy cp = this.getContainerPolicy();
  AbstractSession session = mergeManager.getSession();
  Object sourceCollection = this.getRealCollectionAttributeValueFromObject(source, session);
  Object targetCollection = cp.containerInstance(cp.sizeFor(sourceCollection));
  for (Object iter = cp.iteratorFor(sourceCollection); cp.hasNext(iter);) {
    Object targetElement = this.buildElementFromElement(cp.next(iter, session), mergeManager, targetSession);
    cp.addInto(targetElement, targetCollection, session);
  }
  // reset the attribute to allow for set method to re-morph changes if the collection is not being stored directly
  setRealAttributeValueInObject(target, targetCollection);
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * INTERNAL:
 * Build and return the change record that results
 * from comparing the two collection attributes.
 */
public ChangeRecord compareForChange(Object clone, Object backup, ObjectChangeSet owner, AbstractSession session) {
  ContainerPolicy cp = this.getContainerPolicy();
  Object cloneCollection = this.getRealCollectionAttributeValueFromObject(clone, session);
  Object backupCollection = null;
  if (owner.isNew()) {
    backupCollection = cp.containerInstance(1);
  } else {
    backupCollection = this.getRealCollectionAttributeValueFromObject(backup, session);
  }
  if (cp.hasOrder()) {
    return this.compareAttributeValuesForChangeWithOrder(cloneCollection, backupCollection, owner, session);
  } else {
    return this.compareAttributeValuesForChangeWithoutOrder(cloneCollection, backupCollection, owner, session);
  }
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * Merge changes from the source to the target object.
 * Simply replace the entire target collection.
 */
private void mergeChangesIntoObjectWithOrder(Object target, ChangeRecord changeRecord, Object source, MergeManager mergeManager) {
  ContainerPolicy cp = this.getContainerPolicy();
  AbstractSession session = mergeManager.getSession();
  Vector changes = ((EISOrderedCollectionChangeRecord)changeRecord).getNewCollection();
  Object targetCollection = cp.containerInstance(changes.size());
  for (Enumeration stream = changes.elements(); stream.hasMoreElements();) {
    Object targetElement = this.buildAddedElementFromChangeSet(stream.nextElement(), mergeManager);
    cp.addInto(targetElement, targetCollection, session);
  }
  // reset the attribute to allow for set method to re-morph changes if the collection is not being stored directly
  this.setRealAttributeValueInObject(target, targetCollection);
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * Compare the attributes. Return true if they are alike.
 * Assume the passed-in attributes are non-null.
 */
private boolean compareAttributeValues(Object collection1, Object collection2, AbstractSession session) {
  ContainerPolicy cp = this.getContainerPolicy();
  if (cp.sizeFor(collection1) != cp.sizeFor(collection2)) {
    return false;
  }
  // if they are both empty, go no further...
  if (cp.sizeFor(collection1) == 0) {
    return true;
  }
  if (cp.hasOrder()) {
    return this.compareAttributeValuesWithOrder(collection1, collection2, session);
  } else {
    return this.compareAttributeValuesWithoutOrder(collection1, collection2, session);
  }
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * INTERNAL:
 * Compare the changes between two collections. Element comparisons are
 * made using identity and, when appropriate, the value of the element's key
 * for the Map container.
 */
public ChangeRecord compareForChange(Object clone, Object backup, ObjectChangeSet owner, AbstractSession session) {
  if (isForeignKeyRelationship()) {
    if ((this.getAttributeValueFromObject(clone) != null) && (!this.isAttributeValueInstantiatedOrChanged(clone))) {
      return null;// never instantiated - no changes to report
    }
    return (new EISOneToManyMappingHelper(this)).compareForChange(clone, backup, owner, session);
  } else {
    return super.compareForChange(clone, backup, owner, session);
  }
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * INTERNAL:
 * If the mapping has a foreign key, it is order, so must use a different merge.
 */
@Override
public void mergeIntoObject(Object target, boolean isTargetUnInitialized, Object source, MergeManager mergeManager, AbstractSession targetSession) {
  if (isForeignKeyRelationship()) {
    (new EISOneToManyMappingHelper(this)).mergeIntoObject(target, isTargetUnInitialized, source, mergeManager, targetSession);
    return;
  }
  super.mergeIntoObject(target, isTargetUnInitialized, source, mergeManager, targetSession);
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * INTERNAL:
 * If the mapping has a foreign key, it is order, so must use a different merge.
 */
@Override
public void mergeChangesIntoObject(Object target, ChangeRecord chgRecord, Object source, MergeManager mergeManager, AbstractSession targetSession) {
  if (isForeignKeyRelationship()) {
    (new EISOneToManyMappingHelper(this)).mergeChangesIntoObject(target, chgRecord, source, mergeManager, targetSession);
    return;
  }
  super.mergeChangesIntoObject(target, chgRecord, source, mergeManager, targetSession);
}
origin: com.haulmont.thirdparty/eclipselink

ContainerPolicy cp = this.getContainerPolicy();
EISOrderedCollectionChangeRecord changeRecord = new EISOrderedCollectionChangeRecord(owner, this.getAttributeName(), this.getDatabaseMapping());
  boolean found = false;
  for (int j = 0; j < backupVector.size(); j++) {
    if (this.compareElementsForChange(cloneElement, backupVector.get(j), session)) {
      changeRecord.addMovedChangeSet(this.buildChangeSet(cloneElement, owner, session), j, i);
      break;// matching backup element found - skip the rest of them
    changeRecord.addAddedChangeSet(this.buildChangeSet(cloneElement, owner, session), i);
  if (backupElement != XXX) {
    changeRecord.addRemovedChangeSet(this.buildChangeSet(backupElement, owner, session), i);
origin: org.eclipse.persistence/org.eclipse.persistence.core

ContainerPolicy cp = this.getContainerPolicy();
AbstractSession session = mergeManager.getSession();
  targetCollection = cp.containerInstance(sdkChangeRecord.getAdds().size());
} else {
  targetCollection = this.getRealCollectionAttributeValueFromObject(target, session);
    Object removeElement = buildRemovedElementFromChangeSet(removed, mergeManager, targetSession);
      if (this.compareElements(targetElement, removeElement, session)) {
        break;// matching element found - skip the rest of them
    Object addElement = buildAddedElementFromChangeSet(added, mergeManager, targetSession);
    cp.addInto(addElement, targetCollection, session);
    Object changedMapKeyElement = buildAddedElementFromChangeSet(changed, mergeManager, targetSession);
    Object originalElement = ((UnitOfWorkImpl)session).getOriginalVersionOfObject(changedMapKeyElement);
    cp.removeFrom(originalElement, targetCollection, session);
setRealAttributeValueInObject(target, targetCollection);
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * INTERNAL:
 * Merge changes from the source to the target object.
 * Simply replace the entire target collection.
 */
public void mergeIntoObject(Object target, boolean isTargetUnInitialized, Object source, MergeManager mergeManager) {
  ContainerPolicy cp = this.getContainerPolicy();
  AbstractSession session = mergeManager.getSession();
  Object sourceCollection = this.getRealCollectionAttributeValueFromObject(source, session);
  Object targetCollection = cp.containerInstance(cp.sizeFor(sourceCollection));
  for (Object iter = cp.iteratorFor(sourceCollection); cp.hasNext(iter);) {
    Object targetElement = this.buildElementFromElement(cp.next(iter, session), mergeManager);
    cp.addInto(targetElement, targetCollection, session);
  }
  // reset the attribute to allow for set method to re-morph changes if the collection is not being stored directly
  this.setRealAttributeValueInObject(target, targetCollection);
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * INTERNAL:
 * Build and return the change record that results
 * from comparing the two collection attributes.
 */
public ChangeRecord compareForChange(Object clone, Object backup, ObjectChangeSet owner, AbstractSession session) {
  ContainerPolicy cp = this.getContainerPolicy();
  Object cloneCollection = this.getRealCollectionAttributeValueFromObject(clone, session);
  Object backupCollection = null;
  if (owner.isNew()) {
    backupCollection = cp.containerInstance(1);
  } else {
    backupCollection = this.getRealCollectionAttributeValueFromObject(backup, session);
  }
  if (cp.hasOrder()) {
    return this.compareAttributeValuesForChangeWithOrder(cloneCollection, backupCollection, owner, session);
  } else {
    return this.compareAttributeValuesForChangeWithoutOrder(cloneCollection, backupCollection, owner, session);
  }
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * Merge changes from the source to the target object.
 * Simply replace the entire target collection.
 */
private void mergeChangesIntoObjectWithOrder(Object target, ChangeRecord changeRecord, Object source, MergeManager mergeManager, AbstractSession targetSession) {
  ContainerPolicy cp = this.getContainerPolicy();
  AbstractSession session = mergeManager.getSession();
  List changes = ((EISOrderedCollectionChangeRecord)changeRecord).getNewCollection();
  Object targetCollection = cp.containerInstance(changes.size());
  for (Object changed : changes) {
    Object targetElement = buildAddedElementFromChangeSet(changed, mergeManager, targetSession);
    cp.addInto(targetElement, targetCollection, session);
  }
  // reset the attribute to allow for set method to re-morph changes if the collection is not being stored directly
  this.setRealAttributeValueInObject(target, targetCollection);
}
origin: com.haulmont.thirdparty/eclipselink

/**
 * Compare the attributes. Return true if they are alike.
 * Assume the passed-in attributes are non-null.
 */
private boolean compareAttributeValues(Object collection1, Object collection2, AbstractSession session) {
  ContainerPolicy cp = this.getContainerPolicy();
  if (cp.sizeFor(collection1) != cp.sizeFor(collection2)) {
    return false;
  }
  // if they are both empty, go no further...
  if (cp.sizeFor(collection1) == 0) {
    return true;
  }
  if (cp.hasOrder()) {
    return this.compareAttributeValuesWithOrder(collection1, collection2, session);
  } else {
    return this.compareAttributeValuesWithoutOrder(collection1, collection2, session);
  }
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * ADVANCED:
 * This method is used to have an object removed from a collection once the changeSet is applied
 * The referenceKey parameter should only be used for direct Maps.
 */
@Override
public void simpleRemoveFromCollectionChangeRecord(Object referenceKey, Object changeSetToRemove, ObjectChangeSet changeSet, AbstractSession session) {
  (new EISOneToManyMappingHelper(this)).simpleRemoveFromCollectionChangeRecord(referenceKey, changeSetToRemove, changeSet, session);
}
org.eclipse.persistence.eis.mappingsEISOneToManyMappingHelper

Javadoc

INTERNAL: Helper class to consolidate all the heinous comparing and merging code for the EIS one to many mappings.

Most used methods

  • <init>
    Constructor.
  • buildAddedElementFromChangeSet
    Convenience method.
  • buildChangeSet
    Convenience method.
  • buildElementFromElement
    Convenience method.
  • buildRemovedElementFromChangeSet
    Convenience method.
  • compareAttributeValues
    Compare the attributes. Return true if they are alike. Assume the passed-in attributes are non-null.
  • compareAttributeValuesForChangeWithOrder
    Build and return the change record that results from comparing the two collection attributes. The or
  • compareAttributeValuesForChangeWithoutOrder
    Build and return the change record that results from comparing the two collection attributes. Ignore
  • compareAttributeValuesWithOrder
    Compare the attributes. Return true if they are alike. The order of the elements is significant.
  • compareAttributeValuesWithoutOrder
    Compare the attributes. Return true if they are alike. Ignore the order of the elements.
  • compareElements
    Convenience method. Check for null values before delegating to the mapping.
  • compareElementsForChange
    Convenience method. Check for null values before delegating to the mapping.
  • compareElements,
  • compareElementsForChange,
  • compareForChange,
  • compareObjects,
  • getAttributeName,
  • getContainerPolicy,
  • getDatabaseMapping,
  • getMapping,
  • getRealCollectionAttributeValueFromObject,
  • mapKeyHasChanged

Popular in Java

  • Reactive rest calls using spring rest template
  • requestLocationUpdates (LocationManager)
  • setScale (BigDecimal)
  • getApplicationContext (Context)
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • JButton (javax.swing)
  • JCheckBox (javax.swing)
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now