public class JboCompOper extends java.lang.Object implements DefPersistable, java.io.Serializable, DiffMergeable
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
OPER_AFTER
This is a framework defined system operator and not
meant to be used by a custom operator.
|
static java.lang.String |
OPER_BEFORE
This is a framework defined system operator and not
meant to be used by a custom operator.
|
static java.lang.String |
OPER_BETWEEN
This is a framework defined system operator and not
meant to be used by a custom operator.
|
static int |
OPER_CARDINALITY_NO_MAX |
static java.lang.String |
OPER_CONTAINS
This is a framework defined system operator and not
meant to be used by a custom operator.
|
static java.lang.String |
OPER_CONTAINS_ALL
This is a framework defined system operator and not
meant to be used by a custom operator.
|
static java.lang.String |
OPER_CONTAINS_DELIMITED_ID
This is a framework defined system operator and not
meant to be used by a custom operator.
|
static java.lang.String |
OPER_DOES_NOT_CONTAIN
This is a framework defined system operator and not
meant to be used by a custom operator.
|
static java.lang.String |
OPER_ENDS_WITH
This is a framework defined system operator and not
meant to be used by a custom operator.
|
static java.lang.String |
OPER_EQ
This is a framework defined system operator and not
meant to be used by a custom operator.
|
static java.lang.String |
OPER_EXISTS
This is a framework defined system operator and not
meant to be used by a custom operator.
|
static java.lang.String |
OPER_GE
This is a framework defined system operator and not
meant to be used by a custom operator.
|
static java.lang.String |
OPER_GT
This is a framework defined system operator and not
meant to be used by a custom operator.
|
static java.lang.String |
OPER_IN
This is a framework defined system operator and not
meant to be used by a custom operator.
|
static java.lang.String |
OPER_IS_BLANK
This is a framework defined system operator and not
meant to be used by a custom operator.
|
static java.lang.String |
OPER_IS_NOT_BLANK
This is a framework defined system operator and not
meant to be used by a custom operator.
|
static java.lang.String |
OPER_LE
This is a framework defined system operator and not
meant to be used by a custom operator.
|
static java.lang.String |
OPER_LIKE
This is a framework defined system operator and not
meant to be used by a custom operator.
|
static java.lang.String |
OPER_LT
This is a framework defined system operator and not
meant to be used by a custom operator.
|
static java.lang.String |
OPER_NE
This is a framework defined system operator and not
meant to be used by a custom operator.
|
static java.lang.String |
OPER_NOT_BETWEEN
This is a framework defined system operator and not
meant to be used by a custom operator.
|
static java.lang.String |
OPER_NOT_EXISTS
This is a framework defined system operator and not
meant to be used by a custom operator.
|
static java.lang.String |
OPER_NOTIN
This is a framework defined system operator and not
meant to be used by a custom operator.
|
static java.lang.String |
OPER_ON_OR_AFTER
This is a framework defined system operator and not
meant to be used by a custom operator.
|
static java.lang.String |
OPER_ON_OR_BEFORE
This is a framework defined system operator and not
meant to be used by a custom operator.
|
static java.lang.String |
OPER_STARTS_WITH
This is a framework defined system operator and not
meant to be used by a custom operator.
|
static int |
OPER_TODO_ADD |
static int |
OPER_TODO_CLEAR |
static int |
OPER_TODO_KEEP |
static int |
OPER_TODO_REMOVE |
XML_STATEMENT
Constructor and Description |
---|
JboCompOper() |
JboCompOper(int toDo,
java.lang.Class msgBundleClass,
java.lang.String strCode,
java.lang.String oper)
Creates an instance of a comparison operator used in view criteria
|
JboCompOper(int toDo,
java.lang.Class msgBundleClass,
java.lang.String strCode,
java.lang.String oper,
int minCardinality,
int maxCardinality,
java.lang.String expression)
Creates an instance of a comparison operator used in view criteria
|
JboCompOper(int toDo,
java.lang.String operDesc,
java.lang.String oper,
int minCardinality,
int maxCardinality,
java.lang.String expression)
Creates an instance of a comparison operator used in view criteria
|
JboCompOper(int toDo,
java.lang.String msgBundleClassName,
java.lang.String strCode,
java.lang.String oper,
int minCardinality,
int maxCardinality,
java.lang.String expression)
Creates an instance of a comparison operator used in view criteria
|
JboCompOper(java.lang.String id,
int toDo,
java.lang.Class msgBundleClass,
java.lang.String strCode,
java.lang.String oper,
int minCardinality,
int maxCardinality,
java.lang.String expression)
Creates an instance of a comparison operator used in view criteria.
|
JboCompOper(java.lang.String id,
int toDo,
java.lang.String operDesc,
java.lang.String oper,
int minCardinality,
int maxCardinality,
java.lang.String expression)
Creates an instance of a comparison operator used in view criteria.
|
JboCompOper(java.lang.String id,
int toDo,
java.lang.String msgBundleClassName,
java.lang.String strCode,
java.lang.String oper,
int minCardinality,
int maxCardinality,
java.lang.String expression)
Creates an instance of a comparison operator used in view criteria.
|
Modifier and Type | Method and Description |
---|---|
static void |
addCompOper(int typeGroup,
java.lang.Class msgBundleClass,
java.lang.String strCode,
java.lang.String oper,
int minCardinality,
int maxCardinality)
For internal use only to load framework operators for a particular type.
|
static void |
addCompOper(int typeGroup,
java.lang.String operDesc,
java.lang.String oper,
int minCardinality,
int maxCardinality)
For internal use only to load framework operators for a particular type.
|
static void |
addCompOperEntry(int typeGroup,
int toDo,
java.lang.Class msgBundleClass,
java.lang.String strCode,
java.lang.String oper,
int minCardinality,
int maxCardinality)
For internal use only to load framework operators for a particular type.
|
static void |
addCompOperEntry(int typeGroup,
int toDo,
java.lang.String operDesc,
java.lang.String oper,
int minCardinality,
int maxCardinality)
For internal use only to load framework operators for a particular type.
|
void |
applyDiffChildren(DifferDetails dif,
DiffResolver resolver)
Applies changes to children defs.
|
void |
applyDiffContents(DifferDetails dif,
DiffResolver resolver)
When diff/merge operation is requested, we have the following
three def objects:
|
DifferDetails |
beginDiffObjects(DiffMergeable docDef,
DiffMergeable orgDef,
DifferDetails difDetails)
This method is the entry point call when the diffing process
begins on the document-level def.
|
java.lang.Object |
clone() |
DifferDetails |
diffChildren(DiffMergeable docDef,
DiffMergeable orgDef,
DifferDetails difDetails)
Performs diff of children defs.
|
DifferDetails |
diffContents(DiffMergeable docDef,
DiffMergeable orgDef,
DifferDetails difDetails)
Performs diff of scalar values.
|
DifferDetails |
diffObjects(DiffMergeable docDef,
DiffMergeable orgDef,
DifferDetails difDetails)
The work-horse method performing diff between two defs of this
def type.
|
DifferDetails |
ensureDifferDetails(DifferDetails difDetails)
Ensures that we have a valid
DifferDetails . |
boolean |
equals(java.lang.Object other) |
static java.util.HashMap |
getAllBaseCompOpers(LocaleContext locale)
For internal use only.
|
static java.lang.String[][] |
getBaseCompOpers(LocaleContext locale)
For internal use only.
|
static void |
getCompOperList(int typeGroup,
java.util.ArrayList list)
The list of operators for a specific type.
|
java.lang.String |
getDefTypeName()
Returns the XML def type name of this defintion object, e.g.,
"PDefEntityObject".
|
java.lang.String |
getDefXMLElementTag()
For internal use only
|
java.lang.String |
getDefXMLNameSpace()
For internal use only
|
java.lang.String |
getExpression() |
ExpressionDef |
getExpressionDef() |
java.lang.String |
getFullName()
This method returns the Persistence reference of the object.
|
java.lang.String |
getId() |
int |
getMaxCardinality() |
java.lang.String |
getMergeableFullName()
Returns the fully qualified name of the diff-mergeable definition object.
|
java.lang.String |
getMergeableName()
Returns the diff-mergeable definition's name (short form).
|
java.lang.Class |
getMessageBundleClass() |
int |
getMinCardinality() |
java.lang.String |
getName() |
java.lang.String |
getOper() |
java.lang.String |
getOperDesc() |
java.lang.String |
getOperDescStr(LocaleContext locale) |
java.lang.String |
getOperDescStrCode() |
DefPersistable |
getOrigObject() |
int |
getToDo() |
java.lang.String |
getXMLElementTag()
For internal use only
|
void |
init(java.lang.String id,
int toDo,
java.lang.String strCode,
java.lang.String oper,
int minCardinality,
int maxCardinality,
java.lang.String expression) |
static void |
internalSealStaticOpers()
Deprecated.
since 11.1.1.5.1
For internal framework use only. Implementation and signature may change without notice.
|
boolean |
isDirty()
This method returns if an Object is modified from last save/load
|
boolean |
isNew()
This method returns if this object is previously persisted.
|
boolean |
isRelationalOperator()
If a view criteria item has a value set, temporary bind variables are
generated for the values to use statement caching efficiently.
|
void |
loadXMLContent(DefElement xmlElement) |
static void |
mergeEntries(java.util.ArrayList opers,
java.util.ArrayList list)
For internal use only.
|
static void |
mergeEntry(java.util.ArrayList list,
int toDo,
java.lang.Object ent)
For internal use only.
|
static void |
populateCompOpers() |
static java.lang.String[][] |
processCompOpers(LocaleContext locale,
java.util.ArrayList list) |
void |
setDirty(boolean isDirty)
This method marks the Object dirty
|
void |
setExpressionDef(ExpressionDef exprDef) |
void |
setMessageBundleClass(java.lang.Class cls) |
void |
setMessageBundleClassName(java.lang.String msgBundleClassName) |
void |
setNew(boolean b)
This method marks the as previously persisted.
|
void |
setOperDesc(java.lang.String operDesc)
sets the non-translatable operator description.
|
void |
setOrigObject(DefPersistable oldObj) |
void |
setResourceBundleDef(ResourceBundleDef def) |
void |
writeChildren(DefWriter jos)
Writes the Object's children to the Persistent storage
|
void |
writeContents(DefWriter jos)
Objects should write their persistence output in this method
|
void |
writeContents(DefWriter jos,
boolean bWriteId) |
void |
writeObject(DefWriter jos)
Objects should write their persistence output in this method
|
public static final java.lang.String OPER_EQ
public static final java.lang.String OPER_GT
public static final java.lang.String OPER_GE
public static final java.lang.String OPER_LT
public static final java.lang.String OPER_LE
public static final java.lang.String OPER_NE
public static final java.lang.String OPER_LIKE
public static final java.lang.String OPER_CONTAINS
public static final java.lang.String OPER_DOES_NOT_CONTAIN
public static final java.lang.String OPER_CONTAINS_DELIMITED_ID
public static final java.lang.String OPER_STARTS_WITH
public static final java.lang.String OPER_ENDS_WITH
public static final java.lang.String OPER_IS_BLANK
public static final java.lang.String OPER_IS_NOT_BLANK
public static final java.lang.String OPER_BETWEEN
public static final java.lang.String OPER_NOT_BETWEEN
public static final java.lang.String OPER_BEFORE
public static final java.lang.String OPER_AFTER
public static final java.lang.String OPER_ON_OR_BEFORE
public static final java.lang.String OPER_ON_OR_AFTER
public static final java.lang.String OPER_EXISTS
public static final java.lang.String OPER_NOT_EXISTS
public static final java.lang.String OPER_IN
public static final java.lang.String OPER_NOTIN
public static final java.lang.String OPER_CONTAINS_ALL
public static final int OPER_TODO_KEEP
public static final int OPER_TODO_ADD
public static final int OPER_TODO_REMOVE
public static final int OPER_TODO_CLEAR
public static final int OPER_CARDINALITY_NO_MAX
public JboCompOper()
public JboCompOper(int toDo, java.lang.Class msgBundleClass, java.lang.String strCode, java.lang.String oper)
toDo
- use OPER_TODO_ADD
, OPER_TODO_REMOVE
and OPER_TODO_CLEAR
to add, remove or remove all operators defined
on the owner.msgBundleClass
- the message bundle that holds the description of the
operator displayed in the search formstrCode
- the key used to lookup the message bundleoper
- the operator string saved in the view criteria item xml. For example
oper
could be ">" msgbundleClass
could be "OperatorsBundle"
and strCode
could be "GREATER_THAN". The bundle may contain the
value "Greater than" for key "GREATER_THAN".public JboCompOper(int toDo, java.lang.Class msgBundleClass, java.lang.String strCode, java.lang.String oper, int minCardinality, int maxCardinality, java.lang.String expression)
toDo
- use OPER_TODO_ADD
, OPER_TODO_REMOVE
and OPER_TODO_CLEAR
to add, remove or remove all operators defined
on the ownermsgBundleClass
- the message bundle that holds the description of the
operator displayed in the search formstrCode
- the key used to lookup the message bundleoper
- the operator string saved in the view criteria item xml. For example
oper
could be ">" msgbundleClass
could be "OperatorsBundle"
and strCode
could be "GREATER_THAN". The bundle may contain the
value "Greater than" for key "GREATER_THAN".minCardinality
- the minimum cardinality of the operator. for example
"greater than" has a minimum cardinality of 1 and "is not null" operator has
a minimum cardinality of 0.maxCardinality
- the maximum cardinality of the operator. for example
"greater than" has a maximum cardinality of 1 and "between" has a maximum
cardinality of 2.expression
- a groovy expression that returns a where clause fragment.
The expression is passed a reference to a ViewCriteriaItem
and
can introspect into the values of the item by calling public methods on it.public JboCompOper(java.lang.String id, int toDo, java.lang.Class msgBundleClass, java.lang.String strCode, java.lang.String oper, int minCardinality, int maxCardinality, java.lang.String expression)
id
- The string used to identify a comp operator occurence uniquely
under an owner. Theoretically a user can remove a system provided operator
and implement an overridden version. For example TODO_REMOVE, > and
TODO_ADD, >, custom expression. The same operator is repeated twice and
hence the need to introduce a unique attribute to identify an element.toDo
- use OPER_TODO_ADD
, OPER_TODO_REMOVE
and OPER_TODO_CLEAR
to add, remove or remove all operators defined
on the ownermsgBundleClass
- the message bundle that holds the description of the
operator displayed in the search formstrCode
- the key used to lookup the message bundleoper
- the operator string saved in the view criteria item xml. For example
oper
could be ">" msgbundleClass
could be "OperatorsBundle"
and strCode
could be "GREATER_THAN". The bundle may contain the
value "Greater than" for key "GREATER_THAN".minCardinality
- the minimum cardinality of the operator. for example
"greater than" has a minimum cardinality of 1 and "is not null" operator has
a minimum cardinality of 0.maxCardinality
- the maximum cardinality of the operator. for example
"greater than" has a maximum cardinality of 1 and "between" has a maximum
cardinality of 2.expression
- a groovy expression that returns a where clause fragment.
The expression is passed a reference to a ViewCriteriaItem
and
can introspect into the values of the item by calling public methods on it.public JboCompOper(int toDo, java.lang.String msgBundleClassName, java.lang.String strCode, java.lang.String oper, int minCardinality, int maxCardinality, java.lang.String expression)
toDo
- use OPER_TODO_ADD
, OPER_TODO_REMOVE
and OPER_TODO_CLEAR
to add, remove or remove all operators defined
on the ownermsgBundleClassName
- the message bundle name that holds the description of the
operator displayed in the search formstrCode
- the key used to lookup the message bundleoper
- the operator string saved in the view criteria item xml. For example
oper
could be ">" msgbundleClass
could be "OperatorsBundle"
and strCode
could be "GREATER_THAN". The bundle may contain the
value "Greater than" for key "GREATER_THAN".minCardinality
- the minimum cardinality of the operator. for example
"greater than" has a minimum cardinality of 1 and "is not null" operator has
a minimum cardinality of 0.maxCardinality
- the maximum cardinality of the operator. for example
"greater than" has a maximum cardinality of 1 and "between" has a maximum
cardinality of 2.expression
- a groovy expression that returns a where clause fragment.
The expression is passed a reference to a ViewCriteriaItem
and
can introspect into the values of the item by calling public methods on it.public JboCompOper(java.lang.String id, int toDo, java.lang.String msgBundleClassName, java.lang.String strCode, java.lang.String oper, int minCardinality, int maxCardinality, java.lang.String expression)
id
- The string used to identify a comp operator occurence uniquely
under an owner. Theoretically a user can remove a system provided operator
and implement an overridden version. For example TODO_REMOVE, > and
TODO_ADD, >, custom expression. The same operator is repeated twice and
hence the need to introduce a unique attribute to identify an element.toDo
- use OPER_TODO_ADD
, OPER_TODO_REMOVE
and OPER_TODO_CLEAR
to add, remove or remove all operators defined
on the ownermsgBundleClassName
- the message bundle name that holds the description of the
operator displayed in the search formstrCode
- the key used to lookup the message bundleoper
- the operator string saved in the view criteria item xml. For example
oper
could be ">" msgbundleClass
could be "OperatorsBundle"
and strCode
could be "GREATER_THAN". The bundle may contain the
value "Greater than" for key "GREATER_THAN".minCardinality
- the minimum cardinality of the operator. for example
"greater than" has a minimum cardinality of 1 and "is not null" operator has
a minimum cardinality of 0.maxCardinality
- the maximum cardinality of the operator. for example
"greater than" has a maximum cardinality of 1 and "between" has a maximum
cardinality of 2.expression
- a groovy expression that returns a where clause fragment.
The expression is passed a reference to a ViewCriteriaItem
and
can introspect into the values of the item by calling public methods on it.public JboCompOper(int toDo, java.lang.String operDesc, java.lang.String oper, int minCardinality, int maxCardinality, java.lang.String expression)
toDo
- use OPER_TODO_ADD
, OPER_TODO_REMOVE
and OPER_TODO_CLEAR
to add, remove or remove all operators defined
on the owner.operDesc
- a non-translatable description for the operator.oper
- the operator string saved in the view criteria item xml. For example
oper
could be ">" operDesc
could be passed in
as "Greater than".minCardinality
- the minimum cardinality of the operator. for example
"greater than" has a minimum cardinality of 1 and "is not null" operator has
a minimum cardinality of 0.maxCardinality
- the maximum cardinality of the operator. for example
"greater than" has a maximum cardinality of 1 and "between" has a maximum
cardinality of 2.expression
- a groovy expression that returns a where clause fragment.
The expression is passed a reference to a ViewCriteriaItem
and
can introspect into the values of the item by calling public methods on it.public JboCompOper(java.lang.String id, int toDo, java.lang.String operDesc, java.lang.String oper, int minCardinality, int maxCardinality, java.lang.String expression)
id
- The string used to identify a comp operator occurence uniquely
under an owner. Theoretically a user can remove a system provided operator
and implement an overridden version. For example TODO_REMOVE, > and
TODO_ADD, >, custom expression. The same operator is repeated twice and
hence the need to introduce a unique attribute to identify an element.toDo
- use OPER_TODO_ADD
, OPER_TODO_REMOVE
and OPER_TODO_CLEAR
to add, remove or remove all operators defined
on the owner.operDesc
- a non-translatable description for the operator.oper
- the operator string saved in the view criteria item xml. For example
oper
could be ">" operDesc
could be passed in
as "Greater than".minCardinality
- the minimum cardinality of the operator. for example
"greater than" has a minimum cardinality of 1 and "is not null" operator has
a minimum cardinality of 0.maxCardinality
- the maximum cardinality of the operator. for example
"greater than" has a maximum cardinality of 1 and "between" has a maximum
cardinality of 2.expression
- a groovy expression that returns a where clause fragment.
The expression is passed a reference to a ViewCriteriaItem
and
can introspect into the values of the item by calling public methods on it.@Concealed public void init(java.lang.String id, int toDo, java.lang.String strCode, java.lang.String oper, int minCardinality, int maxCardinality, java.lang.String expression)
@Concealed public static void internalSealStaticOpers()
public static void populateCompOpers()
public static void addCompOper(int typeGroup, java.lang.Class msgBundleClass, java.lang.String strCode, java.lang.String oper, int minCardinality, int maxCardinality)
public static void addCompOper(int typeGroup, java.lang.String operDesc, java.lang.String oper, int minCardinality, int maxCardinality)
public static void addCompOperEntry(int typeGroup, int toDo, java.lang.Class msgBundleClass, java.lang.String strCode, java.lang.String oper, int minCardinality, int maxCardinality)
public static void addCompOperEntry(int typeGroup, int toDo, java.lang.String operDesc, java.lang.String oper, int minCardinality, int maxCardinality)
public static void mergeEntry(java.util.ArrayList list, int toDo, java.lang.Object ent)
list
- the collected list of operators.toDo
- OPER_TODO_ADD
, OPER_TODO_REMOVE
and OPER_TODO_CLEAR
to add, remove or remove all operators defined
on the owner.ent
- the operator entry that is applying the change.public static void mergeEntries(java.util.ArrayList opers, java.util.ArrayList list)
opers
- the collected list of operators.list
- the list of changes to be applied on opers.public static void getCompOperList(int typeGroup, java.util.ArrayList list)
typeGroup
- the type for which the operators need to be returned.list
- the list of operators.public static java.util.HashMap getAllBaseCompOpers(LocaleContext locale)
public static java.lang.String[][] getBaseCompOpers(LocaleContext locale)
public static java.lang.String[][] processCompOpers(LocaleContext locale, java.util.ArrayList list)
locale
- the locale to fetch the operator descriptionslist
- the list of operatorslist
and
each element containing the operator name and descriptionpublic int getToDo()
OPER_TODO_ADD
, OPER_TODO_REMOVE
and OPER_TODO_CLEAR
to add, remove or remove all operators defined
on the owner.public java.lang.String getId()
public java.lang.Class getMessageBundleClass()
public void setMessageBundleClass(java.lang.Class cls)
cls
- The message bundle class that holds the description of the operator.public void setMessageBundleClassName(java.lang.String msgBundleClassName)
cls
- The message bundle class name that holds the description of the operator.public void setResourceBundleDef(ResourceBundleDef def)
def
- ResourceBundleDef
is an abstraction around alternate
message bundle types supported by the framework like xlf, properties bundle.public java.lang.String getOperDescStrCode()
public java.lang.String getOperDesc()
public java.lang.String getOperDescStr(LocaleContext locale)
locale
- the locale used to fetch the operator descriptionpublic void setOperDesc(java.lang.String operDesc)
public int getMinCardinality()
public int getMaxCardinality()
public java.lang.String getOper()
public java.lang.String getExpression()
public ExpressionDef getExpressionDef()
public void setExpressionDef(ExpressionDef exprDef)
public java.lang.Object clone()
clone
in class java.lang.Object
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public boolean isDirty()
DefPersistable
isDirty
in interface DefPersistable
public void setDirty(boolean isDirty)
DefPersistable
setDirty
in interface DefPersistable
isDirty
- If true the Object is marked Dirty.public boolean isNew()
DefPersistable
isNew
in interface DefPersistable
public void setNew(boolean b)
DefPersistable
setNew
in interface DefPersistable
b
- If true the Object is marked as new object.public java.lang.String getName()
public java.lang.String getFullName()
DefPersistable
getFullName
in interface DefPersistable
public java.lang.String getMergeableName()
DiffMergeable
getMergeableName
in interface DiffMergeable
public java.lang.String getMergeableFullName()
DiffMergeable
getMergeableFullName
in interface DiffMergeable
public DefPersistable getOrigObject()
getOrigObject
in interface DefPersistable
public void setOrigObject(DefPersistable oldObj)
setOrigObject
in interface DefPersistable
public void writeObject(DefWriter jos)
PersistentDefinition
writeObject
in interface PersistentDefinition
jos
- the Output storage for persistencepublic void writeContents(DefWriter jos)
PersistentDefinition
writeContents
in interface PersistentDefinition
jos
- the Output storage for persistencepublic void writeContents(DefWriter jos, boolean bWriteId)
public void writeChildren(DefWriter jos)
PersistentDefinition
writeChildren
in interface PersistentDefinition
jos
- the Output storage for persistencepublic void loadXMLContent(DefElement xmlElement)
public java.lang.String getDefXMLElementTag()
getDefXMLElementTag
in interface PersistentDefinition
public java.lang.String getDefTypeName()
DiffMergeable
getDefTypeName
in interface DiffMergeable
public java.lang.String getXMLElementTag()
getXMLElementTag
in interface PersistentDefinition
public java.lang.String getDefXMLNameSpace()
getDefXMLNameSpace
in interface PersistentDefinition
public boolean isRelationalOperator()
true
if the operator is relational.public DifferDetails ensureDifferDetails(DifferDetails difDetails)
DiffMergeable
DifferDetails
.
This method is to create a DifferDetails
object to
be used for diffing if necessary. The difDetails
may come in
as null
. By calling this method, we can ensure that
a non-null difDetails
is there. So, instead of
writing:
if (difDetails == null) { difDetails = new DifferDetails(..); } difDetails.addDiffDetail(..);we can write
(difDetails = diffMergeable.ensureDifferDetails(difDetails)).addDiffDetail(..);
ensureDifferDetails
in interface DiffMergeable
difDetails
- the incoming DifferDetails
. It may
be null
.difDetails
if it wasn't
null
coming in, or a new DifferDetails
if
the incoming difDetails
was null
public DifferDetails diffContents(DiffMergeable docDef, DiffMergeable orgDef, DifferDetails difDetails)
DiffMergeable
orgDef
. Then, help
methods on DifferBase
can be used to diff the attr values
and accumulate the details of diff in difDetails
.
Here is example code snippet:
private static final String DIFF_STRING_ELEMS[] = { "MyStringVal1", "MyStringVal2" }; private static final String DIFF_INT_ELEMS[] = { "MyIntVal", } public DifferDetails diffContents(DiffMergeable docDef, DiffMergeable orgDef, DifferDetails difDetails) {orgDefImpl = ( ) orgDef; final String editStringValues[] = { this.getMyStringVal1(), this.getMyStringVal2() }; String orgStringValues[] = null; if (orgDef != null) { String orgV[] = { orgDefImpl.getMyStringVal1(), orgDefImpl.getMyStringVal2() }; orgStringValues = orgV; } final int editIntValues[] = { this.getMyIntVal(), }; int orgIntValues[] = null; if (orgDef != null) { int orgV[] = { orgDefImpl.getMyIntVal() }; orgIntValues = orgV; } difDetails = DifferBase.diffStringArray(this, DIFF_STRING_ELEMS, editStringValues, orgStringValues, difDetails); difDetails = DifferBase.diffIntArray(this, DIFF_INT_ELEMS, editIntValues, orgIntValues, difDetails); return difDetails; }
diffContents
in interface DiffMergeable
docDef
- the document-level definitionorgDef
- the original definition. It could be
null
if the definition did not exist originallydifDetails
- the DifferDetails
that accumulate
the details of diff from the document-level (top-level) defDifferDetails
that has all the details
of diffpublic DifferDetails diffChildren(DiffMergeable docDef, DiffMergeable orgDef, DifferDetails difDetails)
DiffMergeable
difDetails
and
return it at the end.
For example, if this def has Child1 and Child2, its implementation should look something like:
public DifferDetails diffChildren(DiffMergeable docDef, DiffMergeable orgDef, DifferDetails difDetails) { difDetails = diffChildrenChild1(docDef, orgDef, difDetails); difDetails = diffChildrenChild1(docDef, orgDef, difDetails); return difDetails; }
where diffChildrenChild1()
uses DifferChildren
's
helper method diffChildrenList
to diff the child defs.
diffChildren
in interface DiffMergeable
docDef
- the document-level definitionorgDef
- the original definition. It could be
null
if the definition did not exist originallydifDetails
- the DifferDetails
that accumulate
the details of diff from the document-level (top-level) defDifferDetails
that has all the details
of diffpublic DifferDetails beginDiffObjects(DiffMergeable docDef, DiffMergeable orgDef, DifferDetails difDetails)
DiffMergeable
DiffMergeable
's. 'this'
object is the
changed definition.
beginDiffObjects
in interface DiffMergeable
docDef
- the document-level definitionorgDef
- the original definition. It could be
null
if the definition did not exist originallydifDetails
- the DifferDetails
that accumulate
the details of diff from the document-level (top-level) defDifferDetails
that has all the details
of diffpublic DifferDetails diffObjects(DiffMergeable docDef, DiffMergeable orgDef, DifferDetails difDetails)
DiffMergeable
diffContents
to diff scalar values and diffChildren
to diff
children objects. The children objects themselves are expected
to be DiffMergeable
. 'this'
object is the
changed definition.
diffObjects
in interface DiffMergeable
docDef
- the document-level definitionorgDef
- the original definition. It could be
null
if the definition did not exist originallydifDetails
- the DifferDetails
that accumulate
the details of diff from the document-level (top-level) defDifferDetails
that has all the details
of diffpublic void applyDiffChildren(DifferDetails dif, DiffResolver resolver)
DiffMergeable
dif
contains the
changes to be applied to the children. For each child def, this method
should first retrieve the diff details for the child, which is of type
DifferChildren
. Then, it should call
DifferChildren.applyDiffChanges(oracle.jbo.mom.DiffChildrenMerge, oracle.jbo.mom.DiffResolver)
to perform
the change operation.
applyChanges()
requires a
DiffChildrenMerge
object, which has the insert,
update, and remove methods. 'this'
def object must
provide implmementation of these operations.
Here is a sample:
public void applyDiffChildren(DifferDetails dif, DiffResolver resolver) { DifferChangeMap detailMap = dif.getDetailMap(); if (detailMap != null) { DifferChildren difChild1 = (DifferChildren) detailMap.getValue(); if (difVCs != null) { DiffChildrenMerge dm = new DiffChildrenMerge() { public void insertChild(Object id, Object value) { .. perform insert op for Child1 .. } public void updateChild(Object id, Object value, Object oldValue) { .. perform update op for Child1 .. } public void removeChild(Object id) { .. perform remove op for Child1 .. } }; difChild1.applyDiffChanges(dm, resolver); } // Similarly for Child2 } }
applyDiffChildren
in interface DiffMergeable
public void applyDiffContents(DifferDetails dif, DiffResolver resolver)
DiffMergeable
orgDef - original def object (from the branch point)
editDef - def object into which changes are to be merge
toMergeDef - def object to be merged (source of changes)
For sandbox refresh operation, orgDef
comes from the branch
point, editDef
from the sandbox, toMergeDef
from the
mainline of the repos. With these three defs, we first diff editDef
against orgDef
, producing editDifDetails
.
Similarly, toMergeDef
is diffed against orgDef
,
producing toMergeDifDetails
. The diff engine then
walks through these two sets of diffs and identifies conflicts.
After the conflicts are all resolved, we apply appropriate
changes to editDef
.
applyDiffContents
is called to apply changes to
scalar values. dif
contains the changed values to
be applied to 'this'
object. Use sample code like
the following:
public void applyDiffContents(DifferDetails dif, DiffResolver resolver) { DifferChangeMap detailMap = dif.getDetailMap(); Object[] updValues; // DIFF_STRING_ELEMS from the above example code for (int j = 0; j < DIFF_STRING_ELEMS.length; j++) { if ((updValues = (Object[]) detailMap.getValue(DIFF_STRING_ELEMS[j])) != null) { switch(j) { case 0: setMyStringVal1((String) updValues[0]); break; case 1: setMyStringVal2((String) updValues[0]); break; } } } for (int j = 0; j < DIFF_INT_ELEMS.length; j++) { if ((updValues = (Object[]) detailMap.getValue(DIFF_INT_ELEMS[j])) != null) { switch(j) { case 0: setMyIntVal((Integer) updValues[0]); break; } } } }
Notice that the index specified in the case
statement is the array index of the attr in the String, int,
or boolean array.
applyDiffContents
in interface DiffMergeable
dif
- changes to be applied to 'this'
defresolver
- the diff resolver used in diff/merge operation