Codota Logo
FieldsLockingPolicy
Code IndexAdd Codota to your IDE (free)

How to use
FieldsLockingPolicy
in
org.eclipse.persistence.descriptors

Best Java code snippets using org.eclipse.persistence.descriptors.FieldsLockingPolicy (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ScheduledThreadPoolExecutor s =
  • Codota Iconnew ScheduledThreadPoolExecutor(corePoolSize)
  • Codota IconThreadFactory threadFactory;new ScheduledThreadPoolExecutor(corePoolSize, threadFactory)
  • Codota IconString str;new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder().setNameFormat(str).build())
  • Smart code suggestions by Codota
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * INTERNAL:
 * Returns the fields that should be compared in the where clause.
 * In this case, it is all the fields, except for the primary key
 * and class indicator field.
 */
protected List<DatabaseField> getAllNonPrimaryKeyFields() {
  if (allNonPrimaryKeyFields == null) {
    allNonPrimaryKeyFields = buildAllNonPrimaryKeyFields();
  }
  return allNonPrimaryKeyFields;
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * INTERNAL:
 * filter the fields based on the passed in table.  Only return fields of this table.
 */
protected Vector getAllNonPrimaryKeyFields(DatabaseTable table) {
  Vector filteredFields = new Vector();
  for (Enumeration enumtr = getAllNonPrimaryKeyFields().elements(); enumtr.hasMoreElements();) {
    DatabaseField dbField = (DatabaseField)enumtr.nextElement();
    if (dbField.getTableName().equals(table.getName())) {
      filteredFields.addElement(dbField);
    }
  }
  return filteredFields;
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * INTERNAL:
 * This method must be included in any locking policy.  When given an
 * expression, this method will return a new expression with the optimistic
 * locking values included.  The values are taken from the passed in database row.
 * This expression will be used in a delete call.
 */
public Expression buildUpdateExpression(DatabaseTable table, Expression mainExpression, AbstractRecord transRow, AbstractRecord modifyRow) {
  return mainExpression.and(buildExpression(table, transRow, modifyRow, mainExpression.getBuilder()));
}
origin: com.haulmont.thirdparty/eclipselink

/**
 * INTERNAL:
 * returns the expression to be used in both the delete and update where clause.
 */
protected Expression buildExpression(DatabaseTable table, AbstractRecord transRow, AbstractRecord modifyRow, ExpressionBuilder builder) {
  Expression exp = null;
  DatabaseField field;
  Iterator<DatabaseField> iterator = getFieldsToCompare(table, transRow, modifyRow).iterator();
  if (iterator.hasNext()) {
    field = iterator.next();//First element
    exp = builder.getField(field).equal(builder.getParameter(field));
  }
  while (iterator.hasNext()) {
    field = iterator.next();
    exp = exp.and(builder.getField(field).equal(builder.getParameter(field)));
  }
  return exp;
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * INTERNAL: It is responsible for initializing the policy;
 */
@Override
public void initialize(AbstractSession session) {
  super.initialize(session);
  List<DatabaseField> lockFields = getLockFields();
  int size = lockFields.size();
  for (int index = 0; index < size; index++) {
    DatabaseField field = lockFields.get(index);
    field = descriptor.buildField(field);
    lockFields.set(index, field);
    List<DatabaseField> fieldsForTable = getLockFieldsByTable().get(field.getTable());
    if (fieldsForTable == null) {
      fieldsForTable = org.eclipse.persistence.internal.helper.NonSynchronizedVector.newInstance();
      getLockFieldsByTable().put(field.getTable(), fieldsForTable);
    }
    fieldsForTable.add(field);
  }
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * INTERNAL:
 * Returns the fields that should be compared in the where clause.
 * In this case, it is all the fields, except for the primary key
 * and class indicator fields.
 * This is called durring lazy initialization
 */
protected Vector buildAllNonPrimaryKeyFields() {
  Vector fields = new Vector();
  for (Enumeration enumtr = descriptor.getFields().elements(); enumtr.hasMoreElements();) {
    DatabaseField dbField = (DatabaseField)enumtr.nextElement();
    if (!isPrimaryKey(dbField)) {
      if (descriptor.hasInheritance()) {
        DatabaseField classField = descriptor.getInheritancePolicy().getClassIndicatorField();
        if (!((classField == null) || dbField.equals(classField))) {
          fields.addElement(dbField);
        }
      } else {
        fields.addElement(dbField);
      }
    }
  }
  /* CR#... nullpoint occurs if null is returned, not sure why this was here.
  if (fields.isEmpty()) {
    return null;
  }*/
  return fields;
}
origin: com.haulmont.thirdparty/eclipselink

/**
 * INTERNAL:
 * This method must be included in any locking policy.  When given an
 * expression, this method will return a new expression with the optimistic
 * locking values included.  The values are taken from the passed in database row.
 * This expression will be used in a delete call.
 */
public Expression buildUpdateExpression(DatabaseTable table, Expression mainExpression, AbstractRecord transRow, AbstractRecord modifyRow) {
  return mainExpression.and(buildExpression(table, transRow, modifyRow, mainExpression.getBuilder()));
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * INTERNAL:
 * returns the expression to be used in both the delete and update where clause.
 */
protected Expression buildExpression(DatabaseTable table, AbstractRecord transRow, AbstractRecord modifyRow, ExpressionBuilder builder) {
  Expression exp = null;
  DatabaseField field;
  Enumeration enumtr = getFieldsToCompare(table, transRow, modifyRow).elements();
  if (enumtr.hasMoreElements()) {
    field = (DatabaseField)enumtr.nextElement();//First element
    exp = builder.getField(field).equal(builder.getParameter(field));
  }
  while (enumtr.hasMoreElements()) {
    field = (DatabaseField)enumtr.nextElement();
    exp = exp.and(builder.getField(field).equal(builder.getParameter(field)));
  }
  return exp;
}
origin: com.haulmont.thirdparty/eclipselink

/**
 * INTERNAL: It is responsible for initializing the policy;
 */
@Override
public void initialize(AbstractSession session) {
  super.initialize(session);
  List<DatabaseField> lockFields = getLockFields();
  int size = lockFields.size();
  for (int index = 0; index < size; index++) {
    DatabaseField field = lockFields.get(index);
    field = descriptor.buildField(field);
    lockFields.set(index, field);
    List<DatabaseField> fieldsForTable = getLockFieldsByTable().get(field.getTable());
    if (fieldsForTable == null) {
      fieldsForTable = org.eclipse.persistence.internal.helper.NonSynchronizedVector.newInstance();
      getLockFieldsByTable().put(field.getTable(), fieldsForTable);
    }
    fieldsForTable.add(field);
  }
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * INTERNAL:
 * Returns the fields that should be compared in the where clause.
 * In this case, it is all the fields, except for the primary key
 * and class indicator fields.
 * This is called during lazy initialization.
 */
protected List buildAllNonPrimaryKeyFields() {
  List fields = new ArrayList();
  for (DatabaseField dbField : descriptor.getSelectionFields()) {
    if (!isPrimaryKey(dbField)) {
      if (descriptor.hasInheritance()) {
        DatabaseField classField = descriptor.getInheritancePolicy().getClassIndicatorField();
        if (!((classField == null) || dbField.equals(classField))) {
          fields.add(dbField);
        }
      } else {
        fields.add(dbField);
      }
    }
  }
  /* CR#... nullpoint occurs if null is returned, not sure why this was here.
  if (fields.isEmpty()) {
    return null;
  }*/
  return fields;
}
origin: com.haulmont.thirdparty/eclipselink

/**
 * INTERNAL:
 * When given an expression, this method will return a new expression with the optimistic
 * locking values included.  The values are taken from the passed in database row.
 * This expression will be used in a delete call.
 */
public Expression buildDeleteExpression(DatabaseTable table, Expression mainExpression, AbstractRecord row) {
  return mainExpression.and(buildExpression(table, row, null, mainExpression.getBuilder()));
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * INTERNAL:
 * Returns the fields that should be compared in the where clause.
 * In this case, it is all the fields, except for the primary key
 * and class indicator field.
 */
protected Vector getAllNonPrimaryKeyFields() {
  if (allNonPrimaryKeyFields == null) {
    allNonPrimaryKeyFields = buildAllNonPrimaryKeyFields();
  }
  return allNonPrimaryKeyFields;
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * INTERNAL:
 * filter the fields based on the passed in table.  Only return fields of this table.
 */
protected List<DatabaseField> getAllNonPrimaryKeyFields(DatabaseTable table) {
  List<DatabaseField> filteredFields = new ArrayList<DatabaseField>();
  for (DatabaseField dbField : getAllNonPrimaryKeyFields()) {
    if (dbField.getTableName().equals(table.getName())) {
      filteredFields.add(dbField);
    }
  }
  return filteredFields;
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * INTERNAL:
 * returns the expression to be used in both the delete and update where clause.
 */
protected Expression buildExpression(DatabaseTable table, AbstractRecord transRow, AbstractRecord modifyRow, ExpressionBuilder builder) {
  Expression exp = null;
  DatabaseField field;
  Iterator<DatabaseField> iterator = getFieldsToCompare(table, transRow, modifyRow).iterator();
  if (iterator.hasNext()) {
    field = iterator.next();//First element
    exp = builder.getField(field).equal(builder.getParameter(field));
  }
  while (iterator.hasNext()) {
    field = iterator.next();
    exp = exp.and(builder.getField(field).equal(builder.getParameter(field)));
  }
  return exp;
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * INTERNAL:
 * It is responsible for initializing the policy;
 */
public void initialize(AbstractSession session) {
  super.initialize(session);
  List lockFields = getLockFields();
  int size = lockFields.size();
  for (int index = 0; index < size; index++) {
    DatabaseField field = (DatabaseField)lockFields.get(index);
    field = descriptor.buildField(field);
    lockFields.set(index, field);
    Vector fieldsForTable = (Vector)getLockFieldsByTable().get(field.getTable());
    if (fieldsForTable == null) {
      fieldsForTable = org.eclipse.persistence.internal.helper.NonSynchronizedVector.newInstance();
      getLockFieldsByTable().put(field.getTable(), fieldsForTable);
    }
    fieldsForTable.addElement(field);
  }
}
origin: com.haulmont.thirdparty/eclipselink

/**
 * INTERNAL:
 * Returns the fields that should be compared in the where clause.
 * In this case, it is all the fields, except for the primary key
 * and class indicator fields.
 * This is called during lazy initialization.
 */
protected List buildAllNonPrimaryKeyFields() {
  List fields = new ArrayList();
  for (DatabaseField dbField : descriptor.getSelectionFields()) {
    if (!isPrimaryKey(dbField)) {
      if (descriptor.hasInheritance()) {
        DatabaseField classField = descriptor.getInheritancePolicy().getClassIndicatorField();
        if (!((classField == null) || dbField.equals(classField))) {
          fields.add(dbField);
        }
      } else {
        fields.add(dbField);
      }
    }
  }
  /* CR#... nullpoint occurs if null is returned, not sure why this was here.
  if (fields.isEmpty()) {
    return null;
  }*/
  return fields;
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * INTERNAL:
 * When given an expression, this method will return a new expression with the optimistic
 * locking values included.  The values are taken from the passed in database row.
 * This expression will be used in a delete call.
 */
public Expression buildDeleteExpression(DatabaseTable table, Expression mainExpression, AbstractRecord row) {
  return mainExpression.and(buildExpression(table, row, null, mainExpression.getBuilder()));
}
origin: com.haulmont.thirdparty/eclipselink

/**
 * INTERNAL:
 * Returns the fields that should be compared in the where clause.
 * In this case, it is all the fields, except for the primary key
 * and class indicator field.
 */
protected List<DatabaseField> getAllNonPrimaryKeyFields() {
  if (allNonPrimaryKeyFields == null) {
    allNonPrimaryKeyFields = buildAllNonPrimaryKeyFields();
  }
  return allNonPrimaryKeyFields;
}
origin: com.haulmont.thirdparty/eclipselink

/**
 * INTERNAL:
 * filter the fields based on the passed in table.  Only return fields of this table.
 */
protected List<DatabaseField> getAllNonPrimaryKeyFields(DatabaseTable table) {
  List<DatabaseField> filteredFields = new ArrayList<DatabaseField>();
  for (DatabaseField dbField : getAllNonPrimaryKeyFields()) {
    if (dbField.getTableName().equals(table.getName())) {
      filteredFields.add(dbField);
    }
  }
  return filteredFields;
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * INTERNAL:
 * When given an expression, this method will return a new expression with the optimistic
 * locking values included.  The values are taken from the passed in database row.
 * This expression will be used in a delete call.
 */
public Expression buildDeleteExpression(DatabaseTable table, Expression mainExpression, AbstractRecord row) {
  return mainExpression.and(buildExpression(table, row, null, mainExpression.getBuilder()));
}
org.eclipse.persistence.descriptorsFieldsLockingPolicy

Javadoc

Purpose: An abstract superclass of some implementations of the OptimisticLockingPolicy interface. All of the subclasses of this class implement OptimisticLocking based on mapped fields in the object. These fields are only compared and not modified. Any modification (incrementing etc..) must be handled by the application.

Most used methods

  • buildAllNonPrimaryKeyFields
    INTERNAL: Returns the fields that should be compared in the where clause. In this case, it is all th
  • buildExpression
    INTERNAL: returns the expression to be used in both the delete and update where clause.
  • getAllNonPrimaryKeyFields
    INTERNAL: filter the fields based on the passed in table. Only return fields of this table.
  • getFieldsToCompare
    INTERNAL: Returns the fields that should be compared in the where clause. This method must be implem
  • initialize
    INTERNAL: It is responsible for initializing the policy;
  • isPrimaryKey
    INTERNAL: Returns whether or not this field is a primary key. This method will also return true for

Popular in Java

  • Finding current android device location
  • addToBackStack (FragmentTransaction)
  • setContentView (Activity)
  • orElseThrow (Optional)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • FileOutputStream (java.io)
    A file output stream is an output stream for writing data to aFile or to a FileDescriptor. Whether
  • PrintStream (java.io)
    A PrintStream adds functionality to another output stream, namely the ability to print representatio
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • Hashtable (java.util)
    Hashtable is a synchronized implementation of Map. All optional operations are supported.Neither key
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now