edu.internet2.middleware.grouper.dataField.GrouperDataRowFieldAssign Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of grouper Show documentation
Show all versions of grouper Show documentation
Internet2 Groups Management Toolkit
package edu.internet2.middleware.grouper.dataField;
import java.sql.Timestamp;
import edu.internet2.middleware.grouper.tableIndex.TableIndex;
import edu.internet2.middleware.grouper.tableIndex.TableIndexType;
import edu.internet2.middleware.grouperClient.jdbc.GcDbVersionable;
import edu.internet2.middleware.grouperClient.jdbc.GcPersist;
import edu.internet2.middleware.grouperClient.jdbc.GcPersistableClass;
import edu.internet2.middleware.grouperClient.jdbc.GcPersistableField;
import edu.internet2.middleware.grouperClient.jdbc.GcSqlAssignPrimaryKey;
import edu.internet2.middleware.grouperClient.util.GrouperClientUtils;
import org.apache.commons.lang3.builder.EqualsBuilder;
/**
* loader config for grouper data row field assign
*/
@GcPersistableClass(tableName="grouper_data_row_field_assign", defaultFieldPersist=GcPersist.doPersist)
public class GrouperDataRowFieldAssign implements GcSqlAssignPrimaryKey, GcDbVersionable {
private long dataRowAssignInternalId = -1;
private long dataFieldInternalId = -1;
@GcPersistableField(primaryKey=true, primaryKeyManuallyAssigned=true)
private long internalId = -1;
private Long valueInteger;
private Long valueDictionaryInternalId;
private Timestamp createdOn = null;
/**
* version from db
*/
@GcPersistableField(persist = GcPersist.dontPersist)
private GrouperDataRowFieldAssign dbVersion;
public long getInternalId() {
return internalId;
}
public void setInternalId(long internalId) {
this.internalId = internalId;
}
public Timestamp getCreatedOn() {
return createdOn;
}
public void setCreatedOn(Timestamp createdOn) {
this.createdOn = createdOn;
}
public long getDataFieldInternalId() {
return dataFieldInternalId;
}
public long getDataRowAssignInternalId() {
return dataRowAssignInternalId;
}
public void setDataRowAssignInternalId(long dataRowAssignInternalId) {
this.dataRowAssignInternalId = dataRowAssignInternalId;
}
public void setDataFieldInternalId(long dataFieldInternalId) {
this.dataFieldInternalId = dataFieldInternalId;
}
public Long getValueInteger() {
return valueInteger;
}
public void setValueInteger(Long valueInteger) {
this.valueInteger = valueInteger;
}
public Long getValueDictionaryInternalId() {
return valueDictionaryInternalId;
}
public void setValueDictionaryInternalId(Long valueDictionaryInternalId) {
this.valueDictionaryInternalId = valueDictionaryInternalId;
}
/**
*
*/
@Override
public boolean gcSqlAssignNewPrimaryKeyForInsert() {
if (this.internalId != -1) {
return false;
}
this.internalId = TableIndex.reserveId(TableIndexType.dataRowFieldAssign);
return true;
}
//########## END GENERATED BY GcDbVersionableGenerate.java ###########
/**
* deep clone the fields in this object
*/
@Override
public GrouperDataRowFieldAssign clone() {
GrouperDataRowFieldAssign grouperDataRowFieldAssign = new GrouperDataRowFieldAssign();
//dbVersion DONT CLONE
grouperDataRowFieldAssign.createdOn = this.createdOn;
grouperDataRowFieldAssign.dataRowAssignInternalId = this.dataRowAssignInternalId;
grouperDataRowFieldAssign.dataFieldInternalId = this.dataFieldInternalId;
grouperDataRowFieldAssign.internalId = this.internalId;
grouperDataRowFieldAssign.valueInteger = this.valueInteger;
grouperDataRowFieldAssign.valueDictionaryInternalId = this.valueDictionaryInternalId;
return grouperDataRowFieldAssign;
}
/**
* db version
*/
@Override
public void dbVersionDelete() {
this.dbVersion = null;
}
/**
* if we need to update this object
* @return if needs to update this object
*/
@Override
public boolean dbVersionDifferent() {
return !this.equalsDeep(this.dbVersion);
}
/**
* take a snapshot of the data since this is what is in the db
*/
@Override
public void dbVersionReset() {
//lets get the state from the db so we know what has changed
this.dbVersion = this.clone();
}
/**
*
*/
public boolean equalsDeep(Object obj) {
if (this==obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof GrouperDataRowFieldAssign)) {
return false;
}
GrouperDataRowFieldAssign other = (GrouperDataRowFieldAssign) obj;
return new EqualsBuilder()
//dbVersion DONT EQUALS
.append(this.createdOn, other.createdOn)
.append(this.dataRowAssignInternalId, other.dataRowAssignInternalId)
.append(this.dataFieldInternalId, other.dataFieldInternalId)
.append(this.internalId, other.internalId)
.append(this.valueDictionaryInternalId, other.valueDictionaryInternalId)
.append(this.valueInteger, other.valueInteger)
.isEquals();
}
public void storePrepare() {
if (this.createdOn == null) {
this.createdOn = new Timestamp(System.currentTimeMillis());
}
}
/**
*
*/
@Override
public String toString() {
return GrouperClientUtils.toStringReflection(this, null);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy