
oracle.toplink.essentials.internal.sequencing.Sequencing Maven / Gradle / Ivy
/*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the "License"). You may not use this file except
* in compliance with the License.
*
* You can obtain a copy of the license at
* glassfish/bootstrap/legal/CDDLv1.0.txt or
* https://glassfish.dev.java.net/public/CDDLv1.0.html.
* See the License for the specific language governing
* permissions and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* HEADER in each file and include the License file at
* glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
* add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your
* own identifying information: Portions Copyright [yyyy]
* [name of copyright owner]
*/
// Copyright (c) 1998, 2007, Oracle. All rights reserved.
package oracle.toplink.essentials.internal.sequencing;
/**
*
* Purpose: Define interface to use sequencing.
*
* Description: This interface accessed through Session.getSequencing() method.
* Used by TopLink internals to obtain sequencing values.
*
* Responsibilities:
*
* - Provides sequencing objects and supporting APIs.
*
*/
public interface Sequencing {
// Possible return values for whenShouldAcquireValueForAll() method:
// all classes should acquire sequencing value before insert;
public static final int BEFORE_INSERT = -1;
// some classes should acquire sequencing value before insert, some after;
public static final int UNDEFINED = 0;
// all classes should acquire sequencing value after insert;
public static final int AFTER_INSERT = 1;
/**
* INTERNAL:
* Indicates when sequencing value should be acqiured for all classes.
* There are just three possible return values:
* BEFORE_INSERT, UNDEFINED, AFTER_INSERT.
* Used as a shortcut to avoid individual checks for each class:
* shouldAcquireValueAfterInsert(Class cls).
* Currently UNDEFINED only happens in a case of a SessionBroker:
* session1 - BEFORE_INSERT, session2 - AFTER_INSERT
*/
public int whenShouldAcquireValueForAll();
/**
* INTERNAL:
* Indicates whether sequencing value should be acqiured
* before or after INSERT
*/
public boolean shouldAcquireValueAfterInsert(Class cls);
/**
* INTERNAL:
* Indicates whether existing attribute value should be overridden.
* This method is called in case an attribute mapped to PK of sequencing-using
* descriptor contains non-null value.
* @param seqName String is sequencing number field name
* @param existingValue Object is a non-null value of PK-mapped attribute.
*/
public boolean shouldOverrideExistingValue(Class cls, Object existingValue);
/**
* INTERNAL:
* Return the newly-generated sequencing value.
* @param cls Class for which the sequencing value is generated.
*/
public Object getNextValue(Class cls);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy