Package com.ibm.di.server
Class Compare
- java.lang.Object
-
- com.ibm.di.server.Compare
-
public class Compare extends java.lang.Object
This class is used for making comparisons of entries and attributes.
-
-
Constructor Summary
Constructors Constructor Description Compare()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Entry
applyMods(Entry source, java.util.ArrayList<ModificationItem> mods)
Applies a given ArrayList of modifications to an Entry object and returns it.java.lang.String
compactDN(java.lang.String p1)
Removes spaces in a given string, including those at the string beginning, end and those following a comma character.java.util.ArrayList<ModificationItem>
compareEntries(Entry a, Entry b)
Compares two given Entry objects and returns an ArrayList with the differences (attributes that were in one of the entries and not the other).boolean
differs(Attribute a, Attribute b)
Compares two Attribute objects and returns if they are different.boolean
equalsDN(java.lang.String p1, java.lang.String p2)
Checks if two strings are equal.void
join(Attribute a, Attribute b)
Adds all values from the second Attribute object to the first one (if they are not already present).boolean
vectorContains(java.lang.Object val, java.util.Vector<java.lang.Object> v, boolean dn)
Return true if and only if a Vector contains a value, and remove that value from the Vector.
-
-
-
Method Detail
-
join
public void join(Attribute a, Attribute b) throws java.lang.Exception
Adds all values from the second Attribute object to the first one (if they are not already present).- Parameters:
a
- the attribute that will accept additional valuesb
- the attribute whose values will be added to the first one- Throws:
java.lang.Exception
- if a problem occurs
-
differs
public boolean differs(Attribute a, Attribute b) throws java.lang.Exception
Compares two Attribute objects and returns if they are different.- Parameters:
a
- first Attribute objectb
- second Attribute object- Returns:
true
if the attributes are different, otherwisefalse
- Throws:
java.lang.Exception
- if a problem occurs
-
vectorContains
public boolean vectorContains(java.lang.Object val, java.util.Vector<java.lang.Object> v, boolean dn)
Return true if and only if a Vector contains a value, and remove that value from the Vector. Look into the values if they are complex. If dn is true, also compact Strings (by removing some spaces).- Parameters:
val
- an Object that will be searchedv
- the vector whose contents will be checkeddn
- determines whether strings need to be compact or not- Returns:
true
if the vector contains the given Object, otherwisefalse
-
compareEntries
public java.util.ArrayList<ModificationItem> compareEntries(Entry a, Entry b) throws java.lang.Exception
Compares two given Entry objects and returns an ArrayList with the differences (attributes that were in one of the entries and not the other).- Parameters:
a
- first Entry objectb
- second Entry object- Returns:
- a list of the differences found during the comparison
- Throws:
java.lang.Exception
- if a problem occurs
-
applyMods
public static Entry applyMods(Entry source, java.util.ArrayList<ModificationItem> mods)
Applies a given ArrayList of modifications to an Entry object and returns it.- Parameters:
source
- a source Entrymods
- ArrayList of modifications- Returns:
- the updated Entry
-
equalsDN
public boolean equalsDN(java.lang.String p1, java.lang.String p2)
Checks if two strings are equal. Insignificant space characters are ignored.- Parameters:
p1
- first stringp2
- second string- Returns:
true
it the strings are equal, otherwise
false
-
compactDN
public java.lang.String compactDN(java.lang.String p1)
Removes spaces in a given string, including those at the string beginning, end and those following a comma character.- Parameters:
p1
- the String to be processed- Returns:
- the comacted String
-
-