public class CollidingBPQueryClauseBuilder
extends java.lang.Object
BOProcI
(Business Object Procedures)
that conflict with existing Business Procedures (BPs).
This builder is designed for conflict detection related to modifications (updates,
deletions and BLOB operations) on BO
s. Queries generated by instances of this
class sharing the same affected Business Object (BO) and attribute will be identical,
which enables safe storage of these builders in maps using keys derived from
getKey()
.
Important: The key returned by getKey()
is dynamic and might change
if the underlying Business Object's ID is modified (e.g., after the BO is initially
saved and assigned a persistent ID). This dynamic nature could impact the behavior of
hash-based collections that rely on key immutability; careful consideration is required
when using these builders as map keys across BO state changes.
Constructor and Description |
---|
CollidingBPQueryClauseBuilder(BOProcI _proc,
SchemaI _schema,
boolean _created)
Constructs a new CollidingBPQueryClauseBuilder for the given Business Object Procedure
(BOProcI) and schema.
|
CollidingBPQueryClauseBuilder(BP bp)
Constructs a new CollidingBPQueryClauseBuilder for the given Business Procedure (BP).
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getBOTIdsClause(EntityI entity)
|
java.lang.String |
getClause()
|
java.lang.String |
getKey()
Generates a unique key for this CollidingBPQueryClauseBuilder instance.
|
public CollidingBPQueryClauseBuilder(BP bp)
This constructor initializes the builder to check for conflicts related to database modifications represented by the provided BP object. Since a BP typically operates on an already-persisted BO (i.e., not a newly created one), this constructor delegates to the more detailed constructor, automatically setting the _created flag to false.
bp
- The BP instance representing the modification to check for conflicts.
This BP must not represent a creation operation on its target BO.java.lang.IllegalArgumentException
- If the provided bp represents a creation operation
(i.e., BOProcI.isCreation() returns true for the underlying procedure),
as this builder is not designed to handle conflicts arising from new object creations;
moreover, creations cannot collide with an existing BP in the database and thus need not be checked.public CollidingBPQueryClauseBuilder(BOProcI _proc, SchemaI _schema, boolean _created)
This is the primary constructor that initializes the builder to construct query clauses aimed at detecting conflicts for a specific modification (update, deletion or BLOB operation) represented by the BOProcI. It requires the associated SchemaI for meta-information crucial to query building.
The _created flag is an important optimization hint: if true, it indicates that the procedure modifies or deletes a BO that was newly created within the current transaction. In such cases, collision detection can be simplified and optimized, as conflicts with existing, already-persisted BPs are not possible.
proc
- The BOProcI instance representing the modification (update, deletion or BLOB
operation) to check for conflicts. This procedure must not be a creation operation
(i.e. BOProcI.isCreation() must return false), as creations cannot collide with an
existing BP in the database and thus need not be checked.schema
- The SchemaI providing schema-related meta-information necessary for building
conflict detection queries.created
- A boolean flag indicating whether the procedure modifies or deletes a newly created
BO within the current transaction. This allows for optimized collision detection.java.lang.IllegalArgumentException
- If the provided proc is identified as a creation operation
(i.e., BOProcI.isCreation() returns true), as this builder is not designed to handle conflict
detection for new object creations; moreover, creations cannot collide with an existing BP in
the database and thus need not be checked.public java.lang.String getKey()
The key is constructed by concatenating the ID of the BO
associated with the
wrapped BOProcI
and the name of the attribute it affects, separated by an '@' symbol.
true
(indicating the procedure modifies or deletes
a newly created BO), an asterisk ('*') is appended to the key. This suffix helps to
differentiate keys for newly created BOs, which have different conflict detection logic.
true
), a multiplication
sign resembling a small cross ('×') is appended to the key. This is necessary because the
attribute name will be null for both BLOB changes and purging operations, and this suffix
ensures the uniqueness of the key in such cases.
public java.lang.String getClause()
BP
s)
that are in conflict with the modification represented by the wrapped BOProcI
.
A "collision" typically means another BP affects the same Business Object (BO) and attribute that this
BOProcI
is modifying or deleting, potentially leading to inconsistencies if both BPs are applied.
This method constructs an OQL fragment suitable for use in a WHERE clause to find such conflicting BPs.
The method intelligently handles various attribute types and relation scenarios to build the appropriate conflict detection logic:
String
representing the OQL query clause suitable for a WHERE statement,
or null
if the attribute referenced by the BOProcI
is not found in the schema.public java.lang.String getBOTIdsClause(EntityI entity)
BOT
) Ids
associated with the given EntityI
or any of its sub-entities.
This method constructs a string fragment suitable for use in an OQL WHERE clause,
typically in the format BOTId IN LIST(...). The list of BOT Ids is obtained
by recursively traversing the entity hierarchy starting from the provided entity
.
entity
- The EntityI
for which to generate the BOT Ids clause. This entity
and all its direct and indirect sub-entities will contribute their BOT Ids.String
representing the BOT Ids clause, formatted for use in OQL
(e.g., "BOTId IN LIST(1234, 5678, ...)", where the numbers are the BOT Ids).BOT.getBOTIdsList(EntityI)
Copyright © 2000-2025 OAshi S.à r.l. All Rights Reserved.