edu.internet2.middleware.grouper.changeLog
Class ChangeLogEntry

java.lang.Object
  extended by edu.internet2.middleware.grouper.GrouperAPI
      extended by edu.internet2.middleware.grouper.changeLog.ChangeLogEntry
All Implemented Interfaces:
HibGrouperLifecycle, GrouperCloneable, GrouperUtil.FieldValuable, Serializable, org.hibernate.classic.Lifecycle

public class ChangeLogEntry
extends GrouperAPI

 represents a user change log record.  This is a change to a record in the DB (insert/update/delete).
 
 note: if this object is headed for the temp table, then the getters in the composite key will not be null, will be empty.
 this is a hibernate constraint
 
 

See Also:
Serialized Form

Field Summary
static String CHANGE_LOG_ENTRY_ENTITY_NAME
          entity name for change log
static String CHANGE_LOG_ENTRY_TEMP_ENTITY_NAME
          entity name for change log temp
static String COLUMN_CHANGE_LOG_TYPE_ID
          column
static String COLUMN_CONTEXT_ID
          column
static String COLUMN_CREATED_ON
          column
static String COLUMN_ID
          column
static String COLUMN_SEQUENCE_NUMBER
          column
static String COLUMN_STRING01
          column
static String COLUMN_STRING02
          column
static String COLUMN_STRING03
          column
static String COLUMN_STRING04
          column
static String COLUMN_STRING05
          column
static String COLUMN_STRING06
          column
static String COLUMN_STRING07
          column
static String COLUMN_STRING08
          column
static String COLUMN_STRING09
          column
static String COLUMN_STRING10
          column
static String COLUMN_STRING11
          column
static String COLUMN_STRING12
          column
static String FIELD_CHANGE_LOG_TYPE_ID
          constant for field name for: changeLogTypeId
static String FIELD_CONTEXT_ID
          constant for field name for: contextId
static String FIELD_CREATED_ON_DB
          constant for field name for: createdOnDb
static String FIELD_ID
          constant for field name for: id
static String FIELD_STRING01
          constant for field name for: string01
static String FIELD_STRING02
          constant for field name for: string02
static String FIELD_STRING03
          constant for field name for: string03
static String FIELD_STRING04
          constant for field name for: string04
static String FIELD_STRING05
          constant for field name for: string05
static String FIELD_STRING06
          constant for field name for: string06
static String FIELD_STRING07
          constant for field name for: string07
static String FIELD_STRING08
          constant for field name for: string08
static String FIELD_STRING09
          constant for field name for: string09
static String FIELD_STRING10
          constant for field name for: string10
static String FIELD_STRING11
          constant for field name for: string11
static String FIELD_STRING12
          constant for field name for: string12
static String TABLE_GROUPER_CHANGE_LOG_ENTRY
          name of the grouper changeLog entry table in the db
static String TABLE_GROUPER_CHANGE_LOG_ENTRY_TEMP
          name of the grouper changeLog entry temp table in the db, where records go first before being moved to the real table
 
Fields inherited from class edu.internet2.middleware.grouper.GrouperAPI
COLUMN_HIBERNATE_VERSION_NUMBER, FIELD_DB_VERSION, FIELD_HIBERNATE_VERSION_NUMBER, INITIAL_VERSION_NUMBER
 
Fields inherited from interface org.hibernate.classic.Lifecycle
NO_VETO, VETO
 
Constructor Summary
ChangeLogEntry()
          construct
ChangeLogEntry(boolean tempObject1, ChangeLogTypeIdentifier changeLogTypeIdentifier, String... labelNamesAndValues)
          construct, assign an id
 
Method Summary
 void assignStringValue(ChangeLogType changeLogType, String label, String value)
           
static void clearNextSequenceNumberCache()
          clear the sequence number so the next call to nextSequenceNumber() will requery the max.
 GrouperAPI clone()
          deep clone the fields in this object
 void delete()
          delete the change log entry from either the temp table or the entity table
 boolean equals(Object obj)
           
 boolean equalsCategoryAndAction(ChangeLogTypeIdentifier changeLogTypeIdentifier)
          see if this identifier matches the change log type by category and action
 void fromJsonHelper(net.sf.json.JSONObject jsonObject)
          convert to one json object
static Collection<ChangeLogEntry> fromJsonToCollection(String json)
          convert json to a collection (generally of size one) of change log entries
 ChangeLogType getChangeLogType()
          get the changeLog type, it better be there
 String getChangeLogTypeId()
          foreign key to the type of changeLog entry this is
 String getContextId()
          context id ties multiple db changes
 Timestamp getCreatedOn()
          when created
 Long getCreatedOnDb()
          when created, microseconds since 1970
 String getId()
          uuid for temp object
 Long getSequenceNumber()
          optional sequence for ordering
 String getString01()
          misc field 1
 String getString02()
          misc field 2
 String getString03()
          misc field 3
 String getString04()
          misc field 4
 String getString05()
          misc field 5
 String getString06()
          misc field 6
 String getString07()
          misc field 7
 String getString08()
          misc field 8
 String getString09()
           
 String getString10()
          get string 10
 String getString11()
           
 String getString12()
          get string 12
 int hashCode()
           
 boolean isTempObject()
          if this is a temp object, destined for the temp table
static Long maxSequenceNumber(boolean considerConsumers)
          max sequence number in DB
 void onPreSave(HibernateSession hibernateSession)
          before a save (insert) occurs
 void onPreUpdate(HibernateSession hibernateSession)
          before an update occurs
 String retrieveValueForLabel(ChangeLogLabel changeLogLabel)
          reutrn the value based on friendly label.
 String retrieveValueForLabel(String label)
          reutrn the value based on friendly label.
 void save()
          save this object (insert) to the temp table if configured to do so, and set context id and other things save (insert) this object
static void saveTempUpdates(ChangeLogTypeIdentifier changeLogTypeIdentifier, Object theObject, Object dbVersion, List<String> labelNamesAndValues, List<String> objectPropertyNames, List<String> changeLogPropertyNames)
           
 void setChangeLogTypeId(String changeLogTypeId1)
          foreign key to the type of changeLog entry this is
 void setContextId(String contextId1)
          context id ties multiple db changes
 void setCreatedOn(Timestamp createdOn1)
          when created
 void setCreatedOnDb(Long createdOn1)
          when created, microseconds since 1970
 void setId(String id)
          set uuid for temp object
 void setSequenceNumber(Long sequenceNumber1)
          optional sequence for ordering
 void setString01(String string01a)
          misc field 1
 void setString02(String string02a)
          misc field 2
 void setString03(String string03a)
          misc field 3
 void setString04(String string04a)
          misc field 4
 void setString05(String string05a)
          misc field 5
 void setString06(String string06a)
          misc field 6
 void setString07(String string07a)
          misc field 7
 void setString08(String string08a)
          misc field 8
 void setString09(String theString09)
          set the string 09
 void setString10(String theString10)
          set string 10
 void setString11(String _string11)
          set string 11
 void setString12(String _string12)
          set string 12
 void setTempObject(boolean tempObject1)
          if this is a temp object headed for the temp table
 String toJson(boolean includeContainer)
           
 String toStringDeep()
          the string repre
 String toStringReport(boolean extended)
           
 void truncate()
          make sure this object will fit in the DB
 void update()
          update this object to the temp or entity table if configured to do so, and set context id and other things save (insert) this object
 
Methods inherited from class edu.internet2.middleware.grouper.GrouperAPI
dbVersion, dbVersionClear, dbVersionDifferentFields, dbVersionIsDifferent, dbVersionReset, fieldValue, getHibernateVersionNumber, onDelete, onLoad, onPostDelete, onPostSave, onPostUpdate, onPreDelete, onSave, onUpdate, setHibernateVersionNumber
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COLUMN_ID

public static final String COLUMN_ID
column

See Also:
Constant Field Values

COLUMN_CHANGE_LOG_TYPE_ID

public static final String COLUMN_CHANGE_LOG_TYPE_ID
column

See Also:
Constant Field Values

COLUMN_CONTEXT_ID

public static final String COLUMN_CONTEXT_ID
column

See Also:
Constant Field Values

COLUMN_CREATED_ON

public static final String COLUMN_CREATED_ON
column

See Also:
Constant Field Values

COLUMN_STRING01

public static final String COLUMN_STRING01
column

See Also:
Constant Field Values

COLUMN_STRING02

public static final String COLUMN_STRING02
column

See Also:
Constant Field Values

COLUMN_STRING03

public static final String COLUMN_STRING03
column

See Also:
Constant Field Values

COLUMN_STRING04

public static final String COLUMN_STRING04
column

See Also:
Constant Field Values

COLUMN_STRING05

public static final String COLUMN_STRING05
column

See Also:
Constant Field Values

COLUMN_STRING06

public static final String COLUMN_STRING06
column

See Also:
Constant Field Values

COLUMN_STRING07

public static final String COLUMN_STRING07
column

See Also:
Constant Field Values

COLUMN_STRING08

public static final String COLUMN_STRING08
column

See Also:
Constant Field Values

COLUMN_STRING09

public static final String COLUMN_STRING09
column

See Also:
Constant Field Values

COLUMN_STRING10

public static final String COLUMN_STRING10
column

See Also:
Constant Field Values

COLUMN_STRING11

public static final String COLUMN_STRING11
column

See Also:
Constant Field Values

COLUMN_STRING12

public static final String COLUMN_STRING12
column

See Also:
Constant Field Values

COLUMN_SEQUENCE_NUMBER

public static final String COLUMN_SEQUENCE_NUMBER
column

See Also:
Constant Field Values

CHANGE_LOG_ENTRY_TEMP_ENTITY_NAME

public static final String CHANGE_LOG_ENTRY_TEMP_ENTITY_NAME
entity name for change log temp

See Also:
Constant Field Values

CHANGE_LOG_ENTRY_ENTITY_NAME

public static final String CHANGE_LOG_ENTRY_ENTITY_NAME
entity name for change log

See Also:
Constant Field Values

FIELD_CHANGE_LOG_TYPE_ID

public static final String FIELD_CHANGE_LOG_TYPE_ID
constant for field name for: changeLogTypeId

See Also:
Constant Field Values

FIELD_ID

public static final String FIELD_ID
constant for field name for: id

See Also:
Constant Field Values

FIELD_CONTEXT_ID

public static final String FIELD_CONTEXT_ID
constant for field name for: contextId

See Also:
Constant Field Values

FIELD_CREATED_ON_DB

public static final String FIELD_CREATED_ON_DB
constant for field name for: createdOnDb

See Also:
Constant Field Values

FIELD_STRING01

public static final String FIELD_STRING01
constant for field name for: string01

See Also:
Constant Field Values

FIELD_STRING02

public static final String FIELD_STRING02
constant for field name for: string02

See Also:
Constant Field Values

FIELD_STRING03

public static final String FIELD_STRING03
constant for field name for: string03

See Also:
Constant Field Values

FIELD_STRING04

public static final String FIELD_STRING04
constant for field name for: string04

See Also:
Constant Field Values

FIELD_STRING05

public static final String FIELD_STRING05
constant for field name for: string05

See Also:
Constant Field Values

FIELD_STRING06

public static final String FIELD_STRING06
constant for field name for: string06

See Also:
Constant Field Values

FIELD_STRING07

public static final String FIELD_STRING07
constant for field name for: string07

See Also:
Constant Field Values

FIELD_STRING08

public static final String FIELD_STRING08
constant for field name for: string08

See Also:
Constant Field Values

FIELD_STRING09

public static final String FIELD_STRING09
constant for field name for: string09

See Also:
Constant Field Values

FIELD_STRING10

public static final String FIELD_STRING10
constant for field name for: string10

See Also:
Constant Field Values

FIELD_STRING11

public static final String FIELD_STRING11
constant for field name for: string11

See Also:
Constant Field Values

FIELD_STRING12

public static final String FIELD_STRING12
constant for field name for: string12

See Also:
Constant Field Values

TABLE_GROUPER_CHANGE_LOG_ENTRY

public static final String TABLE_GROUPER_CHANGE_LOG_ENTRY
name of the grouper changeLog entry table in the db

See Also:
Constant Field Values

TABLE_GROUPER_CHANGE_LOG_ENTRY_TEMP

public static final String TABLE_GROUPER_CHANGE_LOG_ENTRY_TEMP
name of the grouper changeLog entry temp table in the db, where records go first before being moved to the real table

See Also:
Constant Field Values
Constructor Detail

ChangeLogEntry

public ChangeLogEntry()
construct


ChangeLogEntry

public ChangeLogEntry(boolean tempObject1,
                      ChangeLogTypeIdentifier changeLogTypeIdentifier,
                      String... labelNamesAndValues)
construct, assign an id

Parameters:
tempObject1 - if this is a temp object, or a normal change log entry
changeLogTypeIdentifier - points to changeLog type
labelNamesAndValues - alternate label name and value
Method Detail

saveTempUpdates

public static void saveTempUpdates(ChangeLogTypeIdentifier changeLogTypeIdentifier,
                                   Object theObject,
                                   Object dbVersion,
                                   List<String> labelNamesAndValues,
                                   List<String> objectPropertyNames,
                                   List<String> changeLogPropertyNames)
Parameters:
changeLogTypeIdentifier -
theObject -
dbVersion -
labelNamesAndValues -
objectPropertyNames -
changeLogPropertyNames -

equals

public boolean equals(Object obj)
Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Overrides:
hashCode in class Object
See Also:
Object.hashCode()

getChangeLogType

public ChangeLogType getChangeLogType()
get the changeLog type, it better be there

Returns:
the changeLog type

toStringReport

public String toStringReport(boolean extended)
Parameters:
extended - if all fields should be printed
Returns:
the report

save

public void save()
save this object (insert) to the temp table if configured to do so, and set context id and other things save (insert) this object


update

public void update()
update this object to the temp or entity table if configured to do so, and set context id and other things save (insert) this object


delete

public void delete()
delete the change log entry from either the temp table or the entity table


retrieveValueForLabel

public String retrieveValueForLabel(ChangeLogLabel changeLogLabel)
reutrn the value based on friendly label. ChangeLogEntry keeps data in string01, string02, etc. But it is more useful when querying by group id. so pass in the fiendly label from the ChangeLogType, and it will look up which field, and return the value of that field

Parameters:
changeLogLabel - is probably from ChangeLogLabels constants
Returns:
the value

retrieveValueForLabel

public String retrieveValueForLabel(String label)
reutrn the value based on friendly label. ChangeLogEntry keeps data in string01, string02, etc. But it is more useful when querying by group id. so pass in the fiendly label from the ChangeLogType, and it will look up which field, and return the value of that field

Parameters:
label -
Returns:
the value

assignStringValue

public void assignStringValue(ChangeLogType changeLogType,
                              String label,
                              String value)
Parameters:
changeLogType -
label -
value -

getSequenceNumber

public Long getSequenceNumber()
optional sequence for ordering

Returns:
sequence number

setSequenceNumber

public void setSequenceNumber(Long sequenceNumber1)
optional sequence for ordering

Parameters:
sequenceNumber1 -

getId

public String getId()
uuid for temp object

Returns:
uuid for temp object

setId

public void setId(String id)
set uuid for temp object

Parameters:
id -

getChangeLogTypeId

public String getChangeLogTypeId()
foreign key to the type of changeLog entry this is

Returns:
the changeLog type id

setChangeLogTypeId

public void setChangeLogTypeId(String changeLogTypeId1)
foreign key to the type of changeLog entry this is

Parameters:
changeLogTypeId1 -

getContextId

public String getContextId()
context id ties multiple db changes

Returns:
id

setContextId

public void setContextId(String contextId1)
context id ties multiple db changes

Parameters:
contextId1 -

getString01

public String getString01()
misc field 1

Returns:
field

setString01

public void setString01(String string01a)
misc field 1

Parameters:
string01a -

getString02

public String getString02()
misc field 2

Returns:
field

setString02

public void setString02(String string02a)
misc field 2

Parameters:
string02a -

getString03

public String getString03()
misc field 3

Returns:
field

setString03

public void setString03(String string03a)
misc field 3

Parameters:
string03a -

getString04

public String getString04()
misc field 4

Returns:
field

setString04

public void setString04(String string04a)
misc field 4

Parameters:
string04a -

getString05

public String getString05()
misc field 5

Returns:
field

setString05

public void setString05(String string05a)
misc field 5

Parameters:
string05a -

getString06

public String getString06()
misc field 6

Returns:
field

setString06

public void setString06(String string06a)
misc field 6

Parameters:
string06a -

getString07

public String getString07()
misc field 7

Returns:
field

setString07

public void setString07(String string07a)
misc field 7

Parameters:
string07a -

getString08

public String getString08()
misc field 8

Returns:
field

setString08

public void setString08(String string08a)
misc field 8

Parameters:
string08a -

getCreatedOn

public Timestamp getCreatedOn()
when created

Returns:
timestamp

getCreatedOnDb

public Long getCreatedOnDb()
when created, microseconds since 1970

Returns:
timestamp

setCreatedOn

public void setCreatedOn(Timestamp createdOn1)
when created

Parameters:
createdOn1 -

truncate

public void truncate()
make sure this object will fit in the DB


clone

public GrouperAPI clone()
Description copied from class: GrouperAPI
deep clone the fields in this object

Specified by:
clone in interface GrouperCloneable
Specified by:
clone in class GrouperAPI
Returns:
the clone of the object
See Also:
GrouperAPI.clone()

onPreSave

public void onPreSave(HibernateSession hibernateSession)
Description copied from interface: HibGrouperLifecycle
before a save (insert) occurs

Specified by:
onPreSave in interface HibGrouperLifecycle
Overrides:
onPreSave in class GrouperAPI
See Also:
GrouperAPI.onPreSave(edu.internet2.middleware.grouper.hibernate.HibernateSession)

clearNextSequenceNumberCache

public static void clearNextSequenceNumberCache()
clear the sequence number so the next call to nextSequenceNumber() will requery the max.


maxSequenceNumber

public static Long maxSequenceNumber(boolean considerConsumers)
max sequence number in DB

Parameters:
considerConsumers - if the consumers should be considered
Returns:
the max sequence number (or null if not there)

onPreUpdate

public void onPreUpdate(HibernateSession hibernateSession)
Description copied from interface: HibGrouperLifecycle
before an update occurs

Specified by:
onPreUpdate in interface HibGrouperLifecycle
Overrides:
onPreUpdate in class GrouperAPI
See Also:
GrouperAPI.onPreUpdate(edu.internet2.middleware.grouper.hibernate.HibernateSession)

setCreatedOnDb

public void setCreatedOnDb(Long createdOn1)
when created, microseconds since 1970

Parameters:
createdOn1 -

toStringDeep

public String toStringDeep()
the string repre

Returns:
string

getString09

public String getString09()
Returns:
the string 09

setString09

public void setString09(String theString09)
set the string 09

Parameters:
theString09 -

getString10

public String getString10()
get string 10

Returns:
string 10

setString10

public void setString10(String theString10)
set string 10

Parameters:
theString10 -

getString11

public String getString11()
Returns:
string 11

setString11

public void setString11(String _string11)
set string 11

Parameters:
_string11 -

getString12

public String getString12()
get string 12

Returns:
string 12

setString12

public void setString12(String _string12)
set string 12

Parameters:
_string12 -

isTempObject

public boolean isTempObject()
if this is a temp object, destined for the temp table

Returns:
temp object

setTempObject

public void setTempObject(boolean tempObject1)
if this is a temp object headed for the temp table

Parameters:
tempObject1 -

equalsCategoryAndAction

public boolean equalsCategoryAndAction(ChangeLogTypeIdentifier changeLogTypeIdentifier)
see if this identifier matches the change log type by category and action

Parameters:
changeLogTypeIdentifier -
Returns:
true if matches

fromJsonToCollection

public static Collection<ChangeLogEntry> fromJsonToCollection(String json)
convert json to a collection (generally of size one) of change log entries

Parameters:
json -
Returns:
the change log entry

fromJsonHelper

public void fromJsonHelper(net.sf.json.JSONObject jsonObject)
convert to one json object

Parameters:
jsonObject -

toJson

public String toJson(boolean includeContainer)
Parameters:
includeContainer - true will include a container and an array of events
Returns:
json