Commit b4973982 by Nilu Committed by Harsh Shah

BO changes

parent f95e2fa2
<?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun -->
<OBJECTS name="" xmlns:oneit="http://www.1iT.com.au"><NODE name="Script" factory="Vector">
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.DefineTableOperation">
<tableName factory="String">tl_assessment_criteria</tableName>
<column name="object_id" type="Long" nullable="false" length="11"/>
<column name="object_last_updated_date" type="Date" nullable="false" length="22"/>
<column name="object_created_date" type="Date" nullable="false" length="22"/>
<column name="name" type="String" nullable="true" length="200"/>
<column name="importance" type="String" nullable="true" length="200"/>
<column name="assessment_type" type="String" nullable="true" length="200"/>
<column name="job_id" type="Long" length="11" nullable="true"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_assessment_criteria" indexName="idx_tl_assessment_criteria_job_id" isUnique="false"><column name="job_id"/></NODE>
</NODE></OBJECTS>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun -->
<OBJECTS name="" xmlns:oneit="http://www.1iT.com.au"><NODE name="Script" factory="Vector">
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.DefineTableOperation">
<tableName factory="String">tl_assessment_criteria_answer</tableName>
<column name="object_id" type="Long" nullable="false" length="11"/>
<column name="object_last_updated_date" type="Date" nullable="false" length="22"/>
<column name="object_created_date" type="Date" nullable="false" length="22"/>
<column name="answer" type="Boolean" nullable="true"/>
<column name="notes" type="CLOB" nullable="true"/>
<column name="assessment_criteria_id" type="Long" length="11" nullable="true"/>
<column name="job_application_id" type="Long" length="11" nullable="true"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_assessment_criteria_answer" indexName="idx_tl_assessment_criteria_answer_job_application_id" isUnique="false"><column name="job_application_id"/></NODE>
</NODE></OBJECTS>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun -->
<OBJECTS name="" xmlns:oneit="http://www.1iT.com.au"><NODE name="Script" factory="Vector">
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.DefineTableOperation">
<tableName factory="String">tl_culture_criteria</tableName>
<column name="object_id" type="Long" nullable="false" length="11"/>
<column name="object_last_updated_date" type="Date" nullable="false" length="22"/>
<column name="object_created_date" type="Date" nullable="false" length="22"/>
<column name="importance" type="String" nullable="true" length="200"/>
<column name="culture_element_id" type="Long" length="11" nullable="true"/>
<column name="culture_element_rating_id" type="Long" length="11" nullable="true"/>
<column name="job_id" type="Long" length="11" nullable="true"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_culture_criteria" indexName="idx_tl_culture_criteria_job_id" isUnique="false"><column name="job_id"/></NODE>
</NODE></OBJECTS>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun -->
<OBJECTS name="" xmlns:oneit="http://www.1iT.com.au"><NODE name="Script" factory="Vector">
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.DefineTableOperation">
<tableName factory="String">tl_culture_criteria_answer</tableName>
<column name="object_id" type="Long" nullable="false" length="11"/>
<column name="object_last_updated_date" type="Date" nullable="false" length="22"/>
<column name="object_created_date" type="Date" nullable="false" length="22"/>
<column name="culture_criteria_id" type="Long" length="11" nullable="true"/>
<column name="selected_question_id" type="Long" length="11" nullable="true"/>
<column name="job_application_id" type="Long" length="11" nullable="true"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_culture_criteria_answer" indexName="idx_tl_culture_criteria_answer_job_application_id" isUnique="false"><column name="job_application_id"/></NODE>
</NODE></OBJECTS>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun -->
<OBJECTS name="" xmlns:oneit="http://www.1iT.com.au"><NODE name="Script" factory="Vector">
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.DefineTableOperation">
<tableName factory="String">tl_job</tableName>
<column name="object_id" type="Long" nullable="false" length="11"/>
<column name="object_last_updated_date" type="Date" nullable="false" length="22"/>
<column name="object_created_date" type="Date" nullable="false" length="22"/>
<column name="job_title" type="String" nullable="true" length="500"/>
<column name="job_description" type="CLOB" nullable="true"/>
<column name="job_status" type="String" nullable="true" length="200"/>
<column name="apply_by" type="Date" nullable="true"/>
<column name="include_assessment_criteria" type="Boolean" nullable="true"/>
<column name="assessment_type" type="String" nullable="true" length="200"/>
<column name="job_link" type="String" nullable="true" length="100"/>
<column name="level_id" type="Long" length="11" nullable="true"/>
<column name="secuser_id" type="Long" length="11" nullable="true"/>
</NODE>
</NODE></OBJECTS>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun -->
<OBJECTS name="" xmlns:oneit="http://www.1iT.com.au"><NODE name="Script" factory="Vector">
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.DefineTableOperation">
<tableName factory="String">tl_job_application</tableName>
<column name="object_id" type="Long" nullable="false" length="11"/>
<column name="object_last_updated_date" type="Date" nullable="false" length="22"/>
<column name="object_created_date" type="Date" nullable="false" length="22"/>
<column name="cv" type="BLOB" nullable="true"/>
<column name="candidate_id" type="Long" length="11" nullable="true"/>
<column name="job_id" type="Long" length="11" nullable="true"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_job_application" indexName="idx_tl_job_application_candidate_id" isUnique="false"><column name="candidate_id"/></NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_job_application" indexName="idx_tl_job_application_job_id" isUnique="false"><column name="job_id"/></NODE>
</NODE></OBJECTS>
\ No newline at end of file
-- DROP TABLE tl_assessment_criteria;
CREATE TABLE tl_assessment_criteria (
object_id int NOT NULL ,
object_last_updated_date datetime DEFAULT getdate() NOT NULL ,
object_created_date datetime DEFAULT getdate() NOT NULL
,
name varchar(200) NULL,
importance varchar(200) NULL,
assessment_type varchar(200) NULL,
job_id numeric(12) NULL
);
ALTER TABLE tl_assessment_criteria ADD
CONSTRAINT PK_tl_assessment_criteria PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_assessment_criteria_job_id
ON tl_assessment_criteria (job_id);
-- DROP TABLE tl_assessment_criteria_answer;
CREATE TABLE tl_assessment_criteria_answer (
object_id int NOT NULL ,
object_last_updated_date datetime DEFAULT getdate() NOT NULL ,
object_created_date datetime DEFAULT getdate() NOT NULL
,
answer char(1) NULL,
notes text NULL,
assessment_criteria_id numeric(12) NULL,
job_application_id numeric(12) NULL
);
ALTER TABLE tl_assessment_criteria_answer ADD
CONSTRAINT PK_tl_assessment_criteria_answer PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_assessment_criteria_answer_job_application_id
ON tl_assessment_criteria_answer (job_application_id);
-- DROP TABLE tl_culture_criteria;
CREATE TABLE tl_culture_criteria (
object_id int NOT NULL ,
object_last_updated_date datetime DEFAULT getdate() NOT NULL ,
object_created_date datetime DEFAULT getdate() NOT NULL
,
importance varchar(200) NULL,
culture_element_id numeric(12) NULL,
culture_element_rating_id numeric(12) NULL,
job_id numeric(12) NULL
);
ALTER TABLE tl_culture_criteria ADD
CONSTRAINT PK_tl_culture_criteria PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_culture_criteria_job_id
ON tl_culture_criteria (job_id);
-- DROP TABLE tl_culture_criteria_answer;
CREATE TABLE tl_culture_criteria_answer (
object_id int NOT NULL ,
object_last_updated_date datetime DEFAULT getdate() NOT NULL ,
object_created_date datetime DEFAULT getdate() NOT NULL
,
culture_criteria_id numeric(12) NULL,
selected_question_id numeric(12) NULL,
job_application_id numeric(12) NULL
);
ALTER TABLE tl_culture_criteria_answer ADD
CONSTRAINT PK_tl_culture_criteria_answer PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_culture_criteria_answer_job_application_id
ON tl_culture_criteria_answer (job_application_id);
-- DROP TABLE tl_job;
CREATE TABLE tl_job (
object_id int NOT NULL ,
object_last_updated_date datetime DEFAULT getdate() NOT NULL ,
object_created_date datetime DEFAULT getdate() NOT NULL
,
job_title varchar(500) NULL,
job_description text NULL,
job_status varchar(200) NULL,
apply_by datetime NULL,
include_assessment_criteria char(1) NULL,
assessment_type varchar(200) NULL,
job_link varchar(100) NULL,
level_id numeric(12) NULL,
secuser_id numeric(12) NULL
);
ALTER TABLE tl_job ADD
CONSTRAINT PK_tl_job PRIMARY KEY
(
object_id
) ;
\ No newline at end of file
-- DROP TABLE tl_job_application;
CREATE TABLE tl_job_application (
object_id int NOT NULL ,
object_last_updated_date datetime DEFAULT getdate() NOT NULL ,
object_created_date datetime DEFAULT getdate() NOT NULL
,
cv image NULL,
candidate_id numeric(12) NULL,
job_id numeric(12) NULL
);
ALTER TABLE tl_job_application ADD
CONSTRAINT PK_tl_job_application PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_job_application_candidate_id
ON tl_job_application (candidate_id);
CREATE INDEX idx_tl_job_application_job_id
ON tl_job_application (job_id);
-- DROP TABLE tl_assessment_criteria;
CREATE TABLE tl_assessment_criteria (
object_id number(12) NOT NULL ,
object_last_updated_date date DEFAULT SYSDATE NOT NULL ,
object_created_date date DEFAULT SYSDATE NOT NULL
,
name varchar2(200) NULL,
importance varchar2(200) NULL,
assessment_type varchar2(200) NULL,
job_id number(12) NULL
);
ALTER TABLE tl_assessment_criteria ADD
CONSTRAINT PK_tl_assessment_criteria PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_assessment_criteria_job_id
ON tl_assessment_criteria (job_id);
-- DROP TABLE tl_assessment_criteria_answer;
CREATE TABLE tl_assessment_criteria_answer (
object_id number(12) NOT NULL ,
object_last_updated_date date DEFAULT SYSDATE NOT NULL ,
object_created_date date DEFAULT SYSDATE NOT NULL
,
answer char(1) NULL,
notes clob NULL,
assessment_criteria_id number(12) NULL,
job_application_id number(12) NULL
);
ALTER TABLE tl_assessment_criteria_answer ADD
CONSTRAINT PK_tl_assessment_criteria_answer PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_assessment_criteria_answer_job_application_id
ON tl_assessment_criteria_answer (job_application_id);
-- DROP TABLE tl_culture_criteria;
CREATE TABLE tl_culture_criteria (
object_id number(12) NOT NULL ,
object_last_updated_date date DEFAULT SYSDATE NOT NULL ,
object_created_date date DEFAULT SYSDATE NOT NULL
,
importance varchar2(200) NULL,
culture_element_id number(12) NULL,
culture_element_rating_id number(12) NULL,
job_id number(12) NULL
);
ALTER TABLE tl_culture_criteria ADD
CONSTRAINT PK_tl_culture_criteria PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_culture_criteria_job_id
ON tl_culture_criteria (job_id);
-- DROP TABLE tl_culture_criteria_answer;
CREATE TABLE tl_culture_criteria_answer (
object_id number(12) NOT NULL ,
object_last_updated_date date DEFAULT SYSDATE NOT NULL ,
object_created_date date DEFAULT SYSDATE NOT NULL
,
culture_criteria_id number(12) NULL,
selected_question_id number(12) NULL,
job_application_id number(12) NULL
);
ALTER TABLE tl_culture_criteria_answer ADD
CONSTRAINT PK_tl_culture_criteria_answer PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_culture_criteria_answer_job_application_id
ON tl_culture_criteria_answer (job_application_id);
-- DROP TABLE tl_job;
CREATE TABLE tl_job (
object_id number(12) NOT NULL ,
object_last_updated_date date DEFAULT SYSDATE NOT NULL ,
object_created_date date DEFAULT SYSDATE NOT NULL
,
job_title varchar2(500) NULL,
job_description clob NULL,
job_status varchar2(200) NULL,
apply_by date NULL,
include_assessment_criteria char(1) NULL,
assessment_type varchar2(200) NULL,
job_link varchar2(100) NULL,
level_id number(12) NULL,
secuser_id number(12) NULL
);
ALTER TABLE tl_job ADD
CONSTRAINT PK_tl_job PRIMARY KEY
(
object_id
) ;
\ No newline at end of file
-- DROP TABLE tl_job_application;
CREATE TABLE tl_job_application (
object_id number(12) NOT NULL ,
object_last_updated_date date DEFAULT SYSDATE NOT NULL ,
object_created_date date DEFAULT SYSDATE NOT NULL
,
cv blob NULL,
candidate_id number(12) NULL,
job_id number(12) NULL
);
ALTER TABLE tl_job_application ADD
CONSTRAINT PK_tl_job_application PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_job_application_candidate_id
ON tl_job_application (candidate_id);
CREATE INDEX idx_tl_job_application_job_id
ON tl_job_application (job_id);
-- @AutoRun
-- drop table tl_assessment_criteria;
CREATE TABLE tl_assessment_criteria (
object_id numeric(12) NOT NULL ,
object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
object_created_date timestamp DEFAULT NOW() NOT NULL
,
name varchar(200) NULL,
importance varchar(200) NULL,
assessment_type varchar(200) NULL,
job_id numeric(12) NULL
);
ALTER TABLE tl_assessment_criteria ADD
CONSTRAINT pk_tl_assessment_criteria PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_assessment_criteria_job_id
ON tl_assessment_criteria (job_id);
-- @AutoRun
-- drop table tl_assessment_criteria_answer;
CREATE TABLE tl_assessment_criteria_answer (
object_id numeric(12) NOT NULL ,
object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
object_created_date timestamp DEFAULT NOW() NOT NULL
,
answer char(1) NULL,
notes text NULL,
assessment_criteria_id numeric(12) NULL,
job_application_id numeric(12) NULL
);
ALTER TABLE tl_assessment_criteria_answer ADD
CONSTRAINT pk_tl_assessment_criteria_answer PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_assessment_criteria_answer_job_application_id
ON tl_assessment_criteria_answer (job_application_id);
-- @AutoRun
-- drop table tl_culture_criteria;
CREATE TABLE tl_culture_criteria (
object_id numeric(12) NOT NULL ,
object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
object_created_date timestamp DEFAULT NOW() NOT NULL
,
importance varchar(200) NULL,
culture_element_id numeric(12) NULL,
culture_element_rating_id numeric(12) NULL,
job_id numeric(12) NULL
);
ALTER TABLE tl_culture_criteria ADD
CONSTRAINT pk_tl_culture_criteria PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_culture_criteria_job_id
ON tl_culture_criteria (job_id);
-- @AutoRun
-- drop table tl_culture_criteria_answer;
CREATE TABLE tl_culture_criteria_answer (
object_id numeric(12) NOT NULL ,
object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
object_created_date timestamp DEFAULT NOW() NOT NULL
,
culture_criteria_id numeric(12) NULL,
selected_question_id numeric(12) NULL,
job_application_id numeric(12) NULL
);
ALTER TABLE tl_culture_criteria_answer ADD
CONSTRAINT pk_tl_culture_criteria_answer PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_culture_criteria_answer_job_application_id
ON tl_culture_criteria_answer (job_application_id);
-- @AutoRun
-- drop table tl_job;
CREATE TABLE tl_job (
object_id numeric(12) NOT NULL ,
object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
object_created_date timestamp DEFAULT NOW() NOT NULL
,
job_title varchar(500) NULL,
job_description text NULL,
job_status varchar(200) NULL,
apply_by timestamp NULL,
include_assessment_criteria char(1) NULL,
assessment_type varchar(200) NULL,
job_link varchar(100) NULL,
level_id numeric(12) NULL,
secuser_id numeric(12) NULL
);
ALTER TABLE tl_job ADD
CONSTRAINT pk_tl_job PRIMARY KEY
(
object_id
) ;
\ No newline at end of file
-- @AutoRun
-- drop table tl_job_application;
CREATE TABLE tl_job_application (
object_id numeric(12) NOT NULL ,
object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
object_created_date timestamp DEFAULT NOW() NOT NULL
,
cv bytea NULL,
candidate_id numeric(12) NULL,
job_id numeric(12) NULL
);
ALTER TABLE tl_job_application ADD
CONSTRAINT pk_tl_job_application PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_job_application_candidate_id
ON tl_job_application (candidate_id);
CREATE INDEX idx_tl_job_application_job_id
ON tl_job_application (job_id);
package performa.orm;
public class AssessmentCriteria extends BaseAssessmentCriteria
{
private static final long serialVersionUID = 0L;
// This constructor should not be called
public AssessmentCriteria ()
{
// Do not add any code to this, always put it in initialiseNewObject
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='http://www.oneit.com.au/schemas/5.2/BusinessObject.xsd'>
<BUSINESSCLASS name="AssessmentCriteria" package="performa.orm">
<IMPORT value="performa.orm.types.*"/>
<TABLE name="tl_assessment_criteria" tablePrefix="object" polymorphic="FALSE">
<ATTRIB name="Name" type="String" dbcol="name" length="200"/>
<ATTRIB name="Importance" type="Importance" dbcol="importance" attribHelper="EnumeratedAttributeHelper" />
<ATTRIB name="AssessmentType" type="AssessmentType" dbcol="assessment_type" attribHelper="EnumeratedAttributeHelper" />
<SINGLEREFERENCE name="Job" type="Job" dbcol="job_id" backreferenceName="AssessmentCriterias"/>
</TABLE>
<SEARCH type="All" paramFilter="tl_assessment_criteria.object_id is not null" orderBy="tl_assessment_criteria.object_id" />
</BUSINESSCLASS>
</ROOT>
\ No newline at end of file
package performa.orm;
public class AssessmentCriteriaAnswer extends BaseAssessmentCriteriaAnswer
{
private static final long serialVersionUID = 0L;
// This constructor should not be called
public AssessmentCriteriaAnswer ()
{
// Do not add any code to this, always put it in initialiseNewObject
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='http://www.oneit.com.au/schemas/5.2/BusinessObject.xsd'>
<BUSINESSCLASS name="AssessmentCriteriaAnswer" package="performa.orm">
<IMPORT value="performa.orm.types.*"/>
<TABLE name="tl_assessment_criteria_answer" tablePrefix="object" polymorphic="FALSE">
<ATTRIB name="Answer" type="Boolean" dbcol="answer"/>
<ATTRIB name="Notes" type="String" dbcol="notes"/>
<SINGLEREFERENCE name="AssessmentCriteria" type="AssessmentCriteria" dbcol="assessment_criteria_id"/>
<SINGLEREFERENCE name="JobApplication" type="JobApplication" dbcol="job_application_id" backreferenceName="AssessmentCriteriaAnswers"/>
</TABLE>
<SEARCH type="All" paramFilter="tl_assessment_criteria_answer.object_id is not null" orderBy="tl_assessment_criteria_answer.object_id" />
</BUSINESSCLASS>
</ROOT>
\ No newline at end of file
package performa.orm;
import java.io.*;
import java.util.*;
import java.sql.ResultSet;
import java.sql.SQLException;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.objstore.assocs.*;
import oneit.objstore.rdbms.*;
import oneit.objstore.utils.*;
import oneit.sql.*;
import oneit.utils.resource.*;
import oneit.utils.*;
import oneit.utils.threading.*;
import performa.orm.types.*;
/**
* IMPORTANT!!!! Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2[oneit.objstore.PersistenceMgrTemplate.xsl]
*/
public class AssessmentCriteriaAnswerPersistenceMgr extends ObjectPersistenceMgr
{
private static final LoggingArea AssessmentCriteriaAnswerPersistence = LoggingArea.createLoggingArea(ObjectPersistenceMgr.OBJECT_PERSISTENCE, "AssessmentCriteriaAnswer");
// Private attributes corresponding to business object data
private Boolean dummyAnswer;
private String dummyNotes;
// Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper HELPER_Answer = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_Notes = DefaultAttributeHelper.INSTANCE;
public AssessmentCriteriaAnswerPersistenceMgr ()
{
dummyAnswer = (Boolean)(HELPER_Answer.initialise (dummyAnswer));
dummyNotes = (String)(HELPER_Notes.initialise (dummyNotes));
}
private String SELECT_COLUMNS = "{PREFIX}tl_assessment_criteria_answer.object_id as id, {PREFIX}tl_assessment_criteria_answer.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_assessment_criteria_answer.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_assessment_criteria_answer.answer, {PREFIX}tl_assessment_criteria_answer.notes, {PREFIX}tl_assessment_criteria_answer.assessment_criteria_id, {PREFIX}tl_assessment_criteria_answer.job_application_id, 1 AS commasafe ";
private String SELECT_JOINS = "";
public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
Set<BaseBusinessClass> resultByIDs = fetchByIDs(Collections.singleton (id), allPSets, context, sqlMgr);
if (resultByIDs.isEmpty ())
{
return null;
}
else if (resultByIDs.size () > 1)
{
throw new StorageException ("Multiple results for id:" + id);
}
else
{
return resultByIDs.iterator ().next ();
}
}
public Set<BaseBusinessClass> fetchByIDs(Set<ObjectID> ids, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
Set<BaseBusinessClass> results = new HashSet ();
Set<Long> idsToFetch = new HashSet ();
for (ObjectID id : ids)
{
if (context.containsObject(id)) // Check for cached version
{
BaseBusinessClass objectToReturn = context.getObjectToReplace(id, AssessmentCriteriaAnswer.REFERENCE_AssessmentCriteriaAnswer);
if (objectToReturn instanceof AssessmentCriteriaAnswer)
{
LogMgr.log (AssessmentCriteriaAnswerPersistence, LogLevel.TRACE, "Cache hit for id:", id);
results.add (objectToReturn);
}
else
{
throw new StorageException ("Cache collision for id:" + id + " with object " + objectToReturn + "while fetching a AssessmentCriteriaAnswer");
}
}
PersistentSet tl_assessment_criteria_answerPSet = allPSets.getPersistentSet(id, "tl_assessment_criteria_answer", PersistentSetStatus.FETCHED);
// Check for persistent sets already prefetched
if (false || !tl_assessment_criteria_answerPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!tl_assessment_criteria_answerPSet.containsAttrib(AssessmentCriteriaAnswer.FIELD_Answer)||
!tl_assessment_criteria_answerPSet.containsAttrib(AssessmentCriteriaAnswer.FIELD_Notes)||
!tl_assessment_criteria_answerPSet.containsAttrib(AssessmentCriteriaAnswer.SINGLEREFERENCE_AssessmentCriteria)||
!tl_assessment_criteria_answerPSet.containsAttrib(AssessmentCriteriaAnswer.SINGLEREFERENCE_JobApplication))
{
// We will need to retrieve it
idsToFetch.add (id.longValue());
}
else
{
LogMgr.log (AssessmentCriteriaAnswerPersistence, LogLevel.DEBUG2, "Persistent set preloaded id:", id);
/* Non Polymorphic */
AssessmentCriteriaAnswer result = new AssessmentCriteriaAnswer ();
result.setFromPersistentSets(id, allPSets);
context.addRetrievedObject(result);
results.add (result);
}
}
if (idsToFetch.size () > 0)
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_assessment_criteria_answer " +
"WHERE " + SELECT_JOINS + "{PREFIX}tl_assessment_criteria_answer.object_id IN ?";
BaseBusinessClass[] resultsFetched = loadQuery (allPSets, sqlMgr, context, query, new Object[] { idsToFetch }, null, false);
for (BaseBusinessClass objFetched : resultsFetched)
{
results.add (objFetched);
}
}
return results;
}
public BaseBusinessClass[] getReferencedObjects(ObjectID _objectID, String refName, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
if (false)
{
throw new RuntimeException ();
}
else if (refName.equals (AssessmentCriteriaAnswer.SINGLEREFERENCE_JobApplication))
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_assessment_criteria_answer " +
"WHERE " + SELECT_JOINS + "job_application_id = ?";
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, new Object[] { _objectID.longID () }, null, false);
return results;
}
else
{
throw new IllegalArgumentException ("Illegal reference type:" + refName);
}
}
public void update(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, ConcurrentUpdateConflictException, StorageException
{
EqualityResult test = EqualityResult.compare (obj, obj.getBackup ());
ObjectID objectID = obj.getID ();
if (!test.areAttributesEqual () || !test.areSingleAssocsEqual () || obj.getForcedSave())
{
PersistentSet tl_assessment_criteria_answerPSet = allPSets.getPersistentSet(objectID, "tl_assessment_criteria_answer");
if (tl_assessment_criteria_answerPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_assessment_criteria_answerPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}tl_assessment_criteria_answer " +
"SET answer = ?, notes = ?, assessment_criteria_id = ? , job_application_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE tl_assessment_criteria_answer.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_Answer.getForSQL(dummyAnswer, tl_assessment_criteria_answerPSet.getAttrib (AssessmentCriteriaAnswer.FIELD_Answer))).listEntry (HELPER_Notes.getForSQL(dummyNotes, tl_assessment_criteria_answerPSet.getAttrib (AssessmentCriteriaAnswer.FIELD_Notes))).listEntry (SQLManager.CheckNull((Long)(tl_assessment_criteria_answerPSet.getAttrib (AssessmentCriteriaAnswer.SINGLEREFERENCE_AssessmentCriteria)))).listEntry (SQLManager.CheckNull((Long)(tl_assessment_criteria_answerPSet.getAttrib (AssessmentCriteriaAnswer.SINGLEREFERENCE_JobApplication)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
if (rowsUpdated != 1)
{
// Error, either a concurrency error or a not-exists error
ResultSet r = executeQuery (sqlMgr,
"SELECT object_id, object_LAST_UPDATED_DATE FROM {PREFIX}tl_assessment_criteria_answer WHERE object_id = ?",
new Object[] { objectID.longID () });
if (r.next ())
{
Date d = new java.util.Date (r.getTimestamp (2).getTime());
String errorMsg = QueryBuilder.buildQueryString ("Concurrent update error:[?] for row:[?] objDate:[?] dbDate:[?]",
new Object[] { "tl_assessment_criteria_answer", objectID.longID (), obj.getObjectLastModified (), d },
sqlMgr.getPortabilityServices ());
LogMgr.log (AssessmentCriteriaAnswerPersistence, LogLevel.BUSINESS1, errorMsg);
throw new ConcurrentUpdateConflictException (obj, "tl_assessment_criteria_answer");
}
else
{
String errorMsg = "Attempt to update nonexistent row in table:tl_assessment_criteria_answer for row:" + objectID + " objDate:" + obj.getObjectLastModified ();
LogMgr.log (AssessmentCriteriaAnswerPersistence, LogLevel.BUSINESS1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
tl_assessment_criteria_answerPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
else
{
LogMgr.log (AssessmentCriteriaAnswerPersistence, LogLevel.DEBUG1, "Skipping update since no attribs or simple assocs changed on ", objectID);
}
}
public void delete(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, ConcurrentUpdateConflictException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet tl_assessment_criteria_answerPSet = allPSets.getPersistentSet(objectID, "tl_assessment_criteria_answer");
LogMgr.log (AssessmentCriteriaAnswerPersistence, LogLevel.DEBUG2, "Deleting:", objectID);
if (tl_assessment_criteria_answerPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_assessment_criteria_answerPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsDeleted = executeStatement (sqlMgr,
"DELETE " +
"FROM {PREFIX}tl_assessment_criteria_answer " +
"WHERE tl_assessment_criteria_answer.object_id = ? AND " + sqlMgr.getPortabilityServices ().getTruncatedTimestampColumn ("object_LAST_UPDATED_DATE") + " = " + sqlMgr.getPortabilityServices ().getTruncatedTimestampParam("?") + " ",
new Object[] { objectID.longID(), obj.getObjectLastModified () });
if (rowsDeleted != 1)
{
// Error, either a concurrency error or a not-exists error
ResultSet r = executeQuery (sqlMgr,
"SELECT object_id FROM {PREFIX}tl_assessment_criteria_answer WHERE object_id = ?",
new Object[] { objectID.longID() });
if (r.next ())
{
throw new ConcurrentUpdateConflictException (obj, "tl_assessment_criteria_answer");
}
else
{
String errorMsg = "Attempt to delete nonexistent row in table:tl_assessment_criteria_answer for row:" + objectID;
LogMgr.log (AssessmentCriteriaAnswerPersistence, LogLevel.SYSTEMERROR1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
tl_assessment_criteria_answerPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
public ResultSet executeSearchQueryAll (SQLManager sqlMgr) throws SQLException
{
throw new RuntimeException ("NOT implemented: executeSearchQueryAll");
}
public BaseBusinessClass[] loadQuery (PersistentSetCollection allPSets, SQLManager sqlMgr, RDBMSPersistenceContext context, String query, Object[] params, Integer maxRows, boolean truncateExtra) throws SQLException, StorageException
{
LinkedHashMap<ObjectID, AssessmentCriteriaAnswer> results = new LinkedHashMap ();
ResultSet r = executeQuery (sqlMgr, query, params);
while (r.next())
{
ThreadUtils.checkInterrupted ();
ObjectID objectID = new ObjectID (AssessmentCriteriaAnswer.REFERENCE_AssessmentCriteriaAnswer.getObjectIDSpace (), r.getLong ("id"));
AssessmentCriteriaAnswer resultElement;
if (maxRows != null && !results.containsKey (objectID) && results.size () >= maxRows)
{
if (truncateExtra)
{
break;
}
else
{
throw new SearchRowsExceededException ("Maximum rows exceeded:" + maxRows);
}
}
if (context.containsObject(objectID))
{
BaseBusinessClass cachedElement = context.getObjectToReplace(objectID, AssessmentCriteriaAnswer.REFERENCE_AssessmentCriteriaAnswer);
if (cachedElement instanceof AssessmentCriteriaAnswer)
{
LogMgr.log (AssessmentCriteriaAnswerPersistence, LogLevel.TRACE, "Cache hit for id:", objectID);
resultElement = (AssessmentCriteriaAnswer)cachedElement;
}
else
{
throw new StorageException ("Cache collision for id:" + objectID + " with object " + cachedElement + "while fetching a AssessmentCriteriaAnswer");
}
}
else
{
PersistentSet tl_assessment_criteria_answerPSet = allPSets.getPersistentSet(objectID, "tl_assessment_criteria_answer", PersistentSetStatus.FETCHED);
createPersistentSetFromRS(allPSets, r, objectID);
resultElement = new AssessmentCriteriaAnswer ();
resultElement.setFromPersistentSets(objectID, allPSets);
context.addRetrievedObject(resultElement);
}
results.put (objectID, resultElement);
}
BaseBusinessClass[] resultsArr = new BaseBusinessClass[results.size ()];
return results.values ().toArray (resultsArr);
}
public BaseBusinessClass[] find(String searchType, PersistentSetCollection allPSets, Hashtable criteria, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
LogMgr.log (AssessmentCriteriaAnswerPersistence, LogLevel.DEBUG2, "Search executing:", searchType, " criteria:", criteria);
String customParamFilter = (String)criteria.get (SEARCH_CustomFilter);
String customOrderBy = (String)criteria.get (SEARCH_OrderBy);
String customTables = (String)criteria.get (SEARCH_CustomExtraTables);
Boolean noCommaBeforeCustomExtraTables = (Boolean)criteria.get (SEARCH_CustomExtraTablesNoComma);
if (searchType.equals (SEARCH_CustomSQL))
{
Set<ObjectID> processedIDs = new HashSet();
SearchParamTransform tx = new SearchParamTransform (criteria);
Object[] searchParams;
customParamFilter = StringUtils.replaceParams (customParamFilter, tx);
searchParams = tx.getParamsArray();
if (customOrderBy != null)
{
customOrderBy = " ORDER BY " + customOrderBy;
}
else
{
customOrderBy = "";
}
ResultSet r;
String concatCustomTableWith = CollectionUtils.equals(noCommaBeforeCustomExtraTables, true) ? " " : ", ";
String tables = StringUtils.subBlanks(customTables) == null ? " " : concatCustomTableWith + customTables + " ";
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_assessment_criteria_answer " + tables +
"WHERE " + SELECT_JOINS + " " + customParamFilter + customOrderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, null, false);
return results;
}
else if (searchType.equals (AssessmentCriteriaAnswer.SEARCH_All))
{
// Local scope for transformed variables
{
}
String orderBy = " ORDER BY tl_assessment_criteria_answer.object_id";
String tables = " ";
Set<String> joinTableSet = new HashSet<String>();
String filter;
Object[] searchParams; // paramFilter: tl_assessment_criteria_answer.object_id is not null
String preFilter = "(tl_assessment_criteria_answer.object_id is not null)"
+ " ";
preFilter += context.getLoadingAttributes ().getCustomSQL() ;
SearchParamTransform tx = new SearchParamTransform (criteria);
filter = StringUtils.replaceParams (preFilter, tx);
searchParams = tx.getParamsArray();
Integer maxRows = context.getLoadingAttributes ().getMaxRows ();
boolean truncateExtra = !context.getLoadingAttributes ().isFailIfMaxExceeded();
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_assessment_criteria_answer " + tables + tableSetToSQL(joinTableSet) +
"WHERE " + SELECT_JOINS + " " + filter + orderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, maxRows, truncateExtra);
return results;
}
else
{
throw new IllegalArgumentException ("Illegal search type:" + searchType);
}
}
private void createPersistentSetFromRS(PersistentSetCollection allPSets, ResultSet r, ObjectID objectID) throws SQLException
{
PersistentSet tl_assessment_criteria_answerPSet = allPSets.getPersistentSet(objectID, "tl_assessment_criteria_answer", PersistentSetStatus.FETCHED);
// Object Modified
tl_assessment_criteria_answerPSet.setAttrib(BaseBusinessClass.FIELD_ObjectLastModified, r.getTimestamp ("LAST_UPDATED_DATE"));
// Object Created
tl_assessment_criteria_answerPSet.setAttrib(BaseBusinessClass.FIELD_ObjectCreated, r.getTimestamp ("CREATED_DATE"));
tl_assessment_criteria_answerPSet.setAttrib(AssessmentCriteriaAnswer.FIELD_Answer, HELPER_Answer.getFromRS(dummyAnswer, r, "answer"));
tl_assessment_criteria_answerPSet.setAttrib(AssessmentCriteriaAnswer.FIELD_Notes, HELPER_Notes.getFromRS(dummyNotes, r, "notes"));
tl_assessment_criteria_answerPSet.setAttrib(AssessmentCriteriaAnswer.SINGLEREFERENCE_AssessmentCriteria, r.getObject ("assessment_criteria_id"));
tl_assessment_criteria_answerPSet.setAttrib(AssessmentCriteriaAnswer.SINGLEREFERENCE_JobApplication, r.getObject ("job_application_id"));
}
public void create(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet tl_assessment_criteria_answerPSet = allPSets.getPersistentSet(objectID, "tl_assessment_criteria_answer");
if (tl_assessment_criteria_answerPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_assessment_criteria_answerPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
executeStatement (sqlMgr,
"INSERT INTO {PREFIX}tl_assessment_criteria_answer " +
" (answer, notes, assessment_criteria_id, job_application_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " +
" (?, ?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_Answer.getForSQL(dummyAnswer, tl_assessment_criteria_answerPSet.getAttrib (AssessmentCriteriaAnswer.FIELD_Answer))).listEntry (HELPER_Notes.getForSQL(dummyNotes, tl_assessment_criteria_answerPSet.getAttrib (AssessmentCriteriaAnswer.FIELD_Notes))) .listEntry (SQLManager.CheckNull((Long)(tl_assessment_criteria_answerPSet.getAttrib (AssessmentCriteriaAnswer.SINGLEREFERENCE_AssessmentCriteria)))).listEntry (SQLManager.CheckNull((Long)(tl_assessment_criteria_answerPSet.getAttrib (AssessmentCriteriaAnswer.SINGLEREFERENCE_JobApplication)))) .listEntry (objectID.longID ()).toList().toArray());
tl_assessment_criteria_answerPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
}
package performa.orm;
import java.io.*;
import java.util.*;
import java.sql.ResultSet;
import java.sql.SQLException;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.objstore.assocs.*;
import oneit.objstore.rdbms.*;
import oneit.objstore.utils.*;
import oneit.sql.*;
import oneit.utils.resource.*;
import oneit.utils.*;
import oneit.utils.threading.*;
import performa.orm.types.*;
/**
* IMPORTANT!!!! Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2[oneit.objstore.PersistenceMgrTemplate.xsl]
*/
public class AssessmentCriteriaPersistenceMgr extends ObjectPersistenceMgr
{
private static final LoggingArea AssessmentCriteriaPersistence = LoggingArea.createLoggingArea(ObjectPersistenceMgr.OBJECT_PERSISTENCE, "AssessmentCriteria");
// Private attributes corresponding to business object data
private String dummyName;
private Importance dummyImportance;
private AssessmentType dummyAssessmentType;
// Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper HELPER_Name = DefaultAttributeHelper.INSTANCE;
private static final EnumeratedAttributeHelper HELPER_Importance = new EnumeratedAttributeHelper (Importance.FACTORY_Importance);
private static final EnumeratedAttributeHelper HELPER_AssessmentType = new EnumeratedAttributeHelper (AssessmentType.FACTORY_AssessmentType);
public AssessmentCriteriaPersistenceMgr ()
{
dummyName = (String)(HELPER_Name.initialise (dummyName));
dummyImportance = (Importance)(HELPER_Importance.initialise (dummyImportance));
dummyAssessmentType = (AssessmentType)(HELPER_AssessmentType.initialise (dummyAssessmentType));
}
private String SELECT_COLUMNS = "{PREFIX}tl_assessment_criteria.object_id as id, {PREFIX}tl_assessment_criteria.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_assessment_criteria.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_assessment_criteria.name, {PREFIX}tl_assessment_criteria.importance, {PREFIX}tl_assessment_criteria.assessment_type, {PREFIX}tl_assessment_criteria.job_id, 1 AS commasafe ";
private String SELECT_JOINS = "";
public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
Set<BaseBusinessClass> resultByIDs = fetchByIDs(Collections.singleton (id), allPSets, context, sqlMgr);
if (resultByIDs.isEmpty ())
{
return null;
}
else if (resultByIDs.size () > 1)
{
throw new StorageException ("Multiple results for id:" + id);
}
else
{
return resultByIDs.iterator ().next ();
}
}
public Set<BaseBusinessClass> fetchByIDs(Set<ObjectID> ids, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
Set<BaseBusinessClass> results = new HashSet ();
Set<Long> idsToFetch = new HashSet ();
for (ObjectID id : ids)
{
if (context.containsObject(id)) // Check for cached version
{
BaseBusinessClass objectToReturn = context.getObjectToReplace(id, AssessmentCriteria.REFERENCE_AssessmentCriteria);
if (objectToReturn instanceof AssessmentCriteria)
{
LogMgr.log (AssessmentCriteriaPersistence, LogLevel.TRACE, "Cache hit for id:", id);
results.add (objectToReturn);
}
else
{
throw new StorageException ("Cache collision for id:" + id + " with object " + objectToReturn + "while fetching a AssessmentCriteria");
}
}
PersistentSet tl_assessment_criteriaPSet = allPSets.getPersistentSet(id, "tl_assessment_criteria", PersistentSetStatus.FETCHED);
// Check for persistent sets already prefetched
if (false || !tl_assessment_criteriaPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!tl_assessment_criteriaPSet.containsAttrib(AssessmentCriteria.FIELD_Name)||
!tl_assessment_criteriaPSet.containsAttrib(AssessmentCriteria.FIELD_Importance)||
!tl_assessment_criteriaPSet.containsAttrib(AssessmentCriteria.FIELD_AssessmentType)||
!tl_assessment_criteriaPSet.containsAttrib(AssessmentCriteria.SINGLEREFERENCE_Job))
{
// We will need to retrieve it
idsToFetch.add (id.longValue());
}
else
{
LogMgr.log (AssessmentCriteriaPersistence, LogLevel.DEBUG2, "Persistent set preloaded id:", id);
/* Non Polymorphic */
AssessmentCriteria result = new AssessmentCriteria ();
result.setFromPersistentSets(id, allPSets);
context.addRetrievedObject(result);
results.add (result);
}
}
if (idsToFetch.size () > 0)
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_assessment_criteria " +
"WHERE " + SELECT_JOINS + "{PREFIX}tl_assessment_criteria.object_id IN ?";
BaseBusinessClass[] resultsFetched = loadQuery (allPSets, sqlMgr, context, query, new Object[] { idsToFetch }, null, false);
for (BaseBusinessClass objFetched : resultsFetched)
{
results.add (objFetched);
}
}
return results;
}
public BaseBusinessClass[] getReferencedObjects(ObjectID _objectID, String refName, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
if (false)
{
throw new RuntimeException ();
}
else if (refName.equals (AssessmentCriteria.SINGLEREFERENCE_Job))
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_assessment_criteria " +
"WHERE " + SELECT_JOINS + "job_id = ?";
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, new Object[] { _objectID.longID () }, null, false);
return results;
}
else
{
throw new IllegalArgumentException ("Illegal reference type:" + refName);
}
}
public void update(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, ConcurrentUpdateConflictException, StorageException
{
EqualityResult test = EqualityResult.compare (obj, obj.getBackup ());
ObjectID objectID = obj.getID ();
if (!test.areAttributesEqual () || !test.areSingleAssocsEqual () || obj.getForcedSave())
{
PersistentSet tl_assessment_criteriaPSet = allPSets.getPersistentSet(objectID, "tl_assessment_criteria");
if (tl_assessment_criteriaPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_assessment_criteriaPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}tl_assessment_criteria " +
"SET name = ?, importance = ?, assessment_type = ?, job_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE tl_assessment_criteria.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_Name.getForSQL(dummyName, tl_assessment_criteriaPSet.getAttrib (AssessmentCriteria.FIELD_Name))).listEntry (HELPER_Importance.getForSQL(dummyImportance, tl_assessment_criteriaPSet.getAttrib (AssessmentCriteria.FIELD_Importance))).listEntry (HELPER_AssessmentType.getForSQL(dummyAssessmentType, tl_assessment_criteriaPSet.getAttrib (AssessmentCriteria.FIELD_AssessmentType))).listEntry (SQLManager.CheckNull((Long)(tl_assessment_criteriaPSet.getAttrib (AssessmentCriteria.SINGLEREFERENCE_Job)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
if (rowsUpdated != 1)
{
// Error, either a concurrency error or a not-exists error
ResultSet r = executeQuery (sqlMgr,
"SELECT object_id, object_LAST_UPDATED_DATE FROM {PREFIX}tl_assessment_criteria WHERE object_id = ?",
new Object[] { objectID.longID () });
if (r.next ())
{
Date d = new java.util.Date (r.getTimestamp (2).getTime());
String errorMsg = QueryBuilder.buildQueryString ("Concurrent update error:[?] for row:[?] objDate:[?] dbDate:[?]",
new Object[] { "tl_assessment_criteria", objectID.longID (), obj.getObjectLastModified (), d },
sqlMgr.getPortabilityServices ());
LogMgr.log (AssessmentCriteriaPersistence, LogLevel.BUSINESS1, errorMsg);
throw new ConcurrentUpdateConflictException (obj, "tl_assessment_criteria");
}
else
{
String errorMsg = "Attempt to update nonexistent row in table:tl_assessment_criteria for row:" + objectID + " objDate:" + obj.getObjectLastModified ();
LogMgr.log (AssessmentCriteriaPersistence, LogLevel.BUSINESS1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
tl_assessment_criteriaPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
else
{
LogMgr.log (AssessmentCriteriaPersistence, LogLevel.DEBUG1, "Skipping update since no attribs or simple assocs changed on ", objectID);
}
}
public void delete(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, ConcurrentUpdateConflictException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet tl_assessment_criteriaPSet = allPSets.getPersistentSet(objectID, "tl_assessment_criteria");
LogMgr.log (AssessmentCriteriaPersistence, LogLevel.DEBUG2, "Deleting:", objectID);
if (tl_assessment_criteriaPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_assessment_criteriaPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsDeleted = executeStatement (sqlMgr,
"DELETE " +
"FROM {PREFIX}tl_assessment_criteria " +
"WHERE tl_assessment_criteria.object_id = ? AND " + sqlMgr.getPortabilityServices ().getTruncatedTimestampColumn ("object_LAST_UPDATED_DATE") + " = " + sqlMgr.getPortabilityServices ().getTruncatedTimestampParam("?") + " ",
new Object[] { objectID.longID(), obj.getObjectLastModified () });
if (rowsDeleted != 1)
{
// Error, either a concurrency error or a not-exists error
ResultSet r = executeQuery (sqlMgr,
"SELECT object_id FROM {PREFIX}tl_assessment_criteria WHERE object_id = ?",
new Object[] { objectID.longID() });
if (r.next ())
{
throw new ConcurrentUpdateConflictException (obj, "tl_assessment_criteria");
}
else
{
String errorMsg = "Attempt to delete nonexistent row in table:tl_assessment_criteria for row:" + objectID;
LogMgr.log (AssessmentCriteriaPersistence, LogLevel.SYSTEMERROR1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
tl_assessment_criteriaPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
public ResultSet executeSearchQueryAll (SQLManager sqlMgr) throws SQLException
{
throw new RuntimeException ("NOT implemented: executeSearchQueryAll");
}
public BaseBusinessClass[] loadQuery (PersistentSetCollection allPSets, SQLManager sqlMgr, RDBMSPersistenceContext context, String query, Object[] params, Integer maxRows, boolean truncateExtra) throws SQLException, StorageException
{
LinkedHashMap<ObjectID, AssessmentCriteria> results = new LinkedHashMap ();
ResultSet r = executeQuery (sqlMgr, query, params);
while (r.next())
{
ThreadUtils.checkInterrupted ();
ObjectID objectID = new ObjectID (AssessmentCriteria.REFERENCE_AssessmentCriteria.getObjectIDSpace (), r.getLong ("id"));
AssessmentCriteria resultElement;
if (maxRows != null && !results.containsKey (objectID) && results.size () >= maxRows)
{
if (truncateExtra)
{
break;
}
else
{
throw new SearchRowsExceededException ("Maximum rows exceeded:" + maxRows);
}
}
if (context.containsObject(objectID))
{
BaseBusinessClass cachedElement = context.getObjectToReplace(objectID, AssessmentCriteria.REFERENCE_AssessmentCriteria);
if (cachedElement instanceof AssessmentCriteria)
{
LogMgr.log (AssessmentCriteriaPersistence, LogLevel.TRACE, "Cache hit for id:", objectID);
resultElement = (AssessmentCriteria)cachedElement;
}
else
{
throw new StorageException ("Cache collision for id:" + objectID + " with object " + cachedElement + "while fetching a AssessmentCriteria");
}
}
else
{
PersistentSet tl_assessment_criteriaPSet = allPSets.getPersistentSet(objectID, "tl_assessment_criteria", PersistentSetStatus.FETCHED);
createPersistentSetFromRS(allPSets, r, objectID);
resultElement = new AssessmentCriteria ();
resultElement.setFromPersistentSets(objectID, allPSets);
context.addRetrievedObject(resultElement);
}
results.put (objectID, resultElement);
}
BaseBusinessClass[] resultsArr = new BaseBusinessClass[results.size ()];
return results.values ().toArray (resultsArr);
}
public BaseBusinessClass[] find(String searchType, PersistentSetCollection allPSets, Hashtable criteria, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
LogMgr.log (AssessmentCriteriaPersistence, LogLevel.DEBUG2, "Search executing:", searchType, " criteria:", criteria);
String customParamFilter = (String)criteria.get (SEARCH_CustomFilter);
String customOrderBy = (String)criteria.get (SEARCH_OrderBy);
String customTables = (String)criteria.get (SEARCH_CustomExtraTables);
Boolean noCommaBeforeCustomExtraTables = (Boolean)criteria.get (SEARCH_CustomExtraTablesNoComma);
if (searchType.equals (SEARCH_CustomSQL))
{
Set<ObjectID> processedIDs = new HashSet();
SearchParamTransform tx = new SearchParamTransform (criteria);
Object[] searchParams;
customParamFilter = StringUtils.replaceParams (customParamFilter, tx);
searchParams = tx.getParamsArray();
if (customOrderBy != null)
{
customOrderBy = " ORDER BY " + customOrderBy;
}
else
{
customOrderBy = "";
}
ResultSet r;
String concatCustomTableWith = CollectionUtils.equals(noCommaBeforeCustomExtraTables, true) ? " " : ", ";
String tables = StringUtils.subBlanks(customTables) == null ? " " : concatCustomTableWith + customTables + " ";
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_assessment_criteria " + tables +
"WHERE " + SELECT_JOINS + " " + customParamFilter + customOrderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, null, false);
return results;
}
else if (searchType.equals (AssessmentCriteria.SEARCH_All))
{
// Local scope for transformed variables
{
}
String orderBy = " ORDER BY tl_assessment_criteria.object_id";
String tables = " ";
Set<String> joinTableSet = new HashSet<String>();
String filter;
Object[] searchParams; // paramFilter: tl_assessment_criteria.object_id is not null
String preFilter = "(tl_assessment_criteria.object_id is not null)"
+ " ";
preFilter += context.getLoadingAttributes ().getCustomSQL() ;
SearchParamTransform tx = new SearchParamTransform (criteria);
filter = StringUtils.replaceParams (preFilter, tx);
searchParams = tx.getParamsArray();
Integer maxRows = context.getLoadingAttributes ().getMaxRows ();
boolean truncateExtra = !context.getLoadingAttributes ().isFailIfMaxExceeded();
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_assessment_criteria " + tables + tableSetToSQL(joinTableSet) +
"WHERE " + SELECT_JOINS + " " + filter + orderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, maxRows, truncateExtra);
return results;
}
else
{
throw new IllegalArgumentException ("Illegal search type:" + searchType);
}
}
private void createPersistentSetFromRS(PersistentSetCollection allPSets, ResultSet r, ObjectID objectID) throws SQLException
{
PersistentSet tl_assessment_criteriaPSet = allPSets.getPersistentSet(objectID, "tl_assessment_criteria", PersistentSetStatus.FETCHED);
// Object Modified
tl_assessment_criteriaPSet.setAttrib(BaseBusinessClass.FIELD_ObjectLastModified, r.getTimestamp ("LAST_UPDATED_DATE"));
// Object Created
tl_assessment_criteriaPSet.setAttrib(BaseBusinessClass.FIELD_ObjectCreated, r.getTimestamp ("CREATED_DATE"));
tl_assessment_criteriaPSet.setAttrib(AssessmentCriteria.FIELD_Name, HELPER_Name.getFromRS(dummyName, r, "name"));
tl_assessment_criteriaPSet.setAttrib(AssessmentCriteria.FIELD_Importance, HELPER_Importance.getFromRS(dummyImportance, r, "importance"));
tl_assessment_criteriaPSet.setAttrib(AssessmentCriteria.FIELD_AssessmentType, HELPER_AssessmentType.getFromRS(dummyAssessmentType, r, "assessment_type"));
tl_assessment_criteriaPSet.setAttrib(AssessmentCriteria.SINGLEREFERENCE_Job, r.getObject ("job_id"));
}
public void create(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet tl_assessment_criteriaPSet = allPSets.getPersistentSet(objectID, "tl_assessment_criteria");
if (tl_assessment_criteriaPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_assessment_criteriaPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
executeStatement (sqlMgr,
"INSERT INTO {PREFIX}tl_assessment_criteria " +
" (name, importance, assessment_type, job_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " +
" (?, ?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_Name.getForSQL(dummyName, tl_assessment_criteriaPSet.getAttrib (AssessmentCriteria.FIELD_Name))).listEntry (HELPER_Importance.getForSQL(dummyImportance, tl_assessment_criteriaPSet.getAttrib (AssessmentCriteria.FIELD_Importance))).listEntry (HELPER_AssessmentType.getForSQL(dummyAssessmentType, tl_assessment_criteriaPSet.getAttrib (AssessmentCriteria.FIELD_AssessmentType))) .listEntry (SQLManager.CheckNull((Long)(tl_assessment_criteriaPSet.getAttrib (AssessmentCriteria.SINGLEREFERENCE_Job)))) .listEntry (objectID.longID ()).toList().toArray());
tl_assessment_criteriaPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
}
/*
* IMPORTANT!!!! XSL Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2 rev3 [oneit.objstore.BusinessObjectTemplate.xsl]
*
* Version: 1.0
* Vendor: Apache Software Foundation (Xalan XSLTC)
* Vendor URL: http://xml.apache.org/xalan-j
*/
package performa.orm;
import java.io.*;
import java.util.*;
import oneit.appservices.config.*;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.objstore.assocs.*;
import oneit.objstore.attributes.*;
import oneit.objstore.rdbms.filters.*;
import oneit.objstore.parser.*;
import oneit.objstore.validator.*;
import oneit.objstore.utils.*;
import oneit.utils.*;
import oneit.utils.filter.Filter;
import oneit.utils.transform.*;
import oneit.utils.parsers.FieldException;
import performa.orm.types.*;
public abstract class BaseAssessmentCriteria extends BaseBusinessClass
{
// Reference instance for the object
public static final AssessmentCriteria REFERENCE_AssessmentCriteria = new AssessmentCriteria ();
// Reference instance for the object
public static final AssessmentCriteria DUMMY_AssessmentCriteria = new DummyAssessmentCriteria ();
// Static constants corresponding to field names
public static final String FIELD_Name = "Name";
public static final String FIELD_Importance = "Importance";
public static final String FIELD_AssessmentType = "AssessmentType";
public static final String SINGLEREFERENCE_Job = "Job";
public static final String BACKREF_Job = "";
// Static constants corresponding to searches
public static final String SEARCH_All = "All";
// Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper<AssessmentCriteria> HELPER_Name = DefaultAttributeHelper.INSTANCE;
private static final EnumeratedAttributeHelper<AssessmentCriteria, Importance> HELPER_Importance = new EnumeratedAttributeHelper<AssessmentCriteria, Importance> (Importance.FACTORY_Importance);
private static final EnumeratedAttributeHelper<AssessmentCriteria, AssessmentType> HELPER_AssessmentType = new EnumeratedAttributeHelper<AssessmentCriteria, AssessmentType> (AssessmentType.FACTORY_AssessmentType);
// Private attributes corresponding to business object data
private String _Name;
private Importance _Importance;
private AssessmentType _AssessmentType;
// Private attributes corresponding to single references
private SingleAssociation<AssessmentCriteria, Job> _Job;
// Private attributes corresponding to multiple references
// Map of maps of metadata
private static final Map ATTRIBUTES_METADATA_AssessmentCriteria = new HashMap ();
// Arrays of validators for each attribute
private static final AttributeValidator[] FIELD_Name_Validators;
private static final AttributeValidator[] FIELD_Importance_Validators;
private static final AttributeValidator[] FIELD_AssessmentType_Validators;
// Arrays of behaviour decorators
private static final AssessmentCriteriaBehaviourDecorator[] AssessmentCriteria_BehaviourDecorators;
static
{
try
{
String tmp_Job = Job.BACKREF_AssessmentCriterias;
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
setupAssocMetaData_Job();
FIELD_Name_Validators = (AttributeValidator[])setupAttribMetaData_Name(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_Importance_Validators = (AttributeValidator[])setupAttribMetaData_Importance(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_AssessmentType_Validators = (AttributeValidator[])setupAttribMetaData_AssessmentType(validatorMapping).toArray (new AttributeValidator[0]);
REFERENCE_AssessmentCriteria.initialiseReference ();
DUMMY_AssessmentCriteria.initialiseReference ();
AssessmentCriteria_BehaviourDecorators = BaseBusinessClass.getBBCBehaviours(AssessmentCriteria.class).toArray(new AssessmentCriteriaBehaviourDecorator[0]);
}
catch (RuntimeException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR1, e, "Error initialising");
throw e;
}
}
// Meta Info setup
private static void setupAssocMetaData_Job()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "AssessmentCriterias");
metaInfo.put ("dbcol", "job_id");
metaInfo.put ("name", "Job");
metaInfo.put ("type", "Job");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for AssessmentCriteria.Job:", metaInfo);
ATTRIBUTES_METADATA_AssessmentCriteria.put (SINGLEREFERENCE_Job, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static List setupAttribMetaData_Name(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "name");
metaInfo.put ("length", "200");
metaInfo.put ("name", "Name");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for AssessmentCriteria.Name:", metaInfo);
ATTRIBUTES_METADATA_AssessmentCriteria.put (FIELD_Name, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(AssessmentCriteria.class, "Name", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for AssessmentCriteria.Name:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_Importance(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("attribHelper", "EnumeratedAttributeHelper");
metaInfo.put ("dbcol", "importance");
metaInfo.put ("name", "Importance");
metaInfo.put ("type", "Importance");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for AssessmentCriteria.Importance:", metaInfo);
ATTRIBUTES_METADATA_AssessmentCriteria.put (FIELD_Importance, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(AssessmentCriteria.class, "Importance", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for AssessmentCriteria.Importance:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_AssessmentType(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("attribHelper", "EnumeratedAttributeHelper");
metaInfo.put ("dbcol", "assessment_type");
metaInfo.put ("name", "AssessmentType");
metaInfo.put ("type", "AssessmentType");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for AssessmentCriteria.AssessmentType:", metaInfo);
ATTRIBUTES_METADATA_AssessmentCriteria.put (FIELD_AssessmentType, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(AssessmentCriteria.class, "AssessmentType", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for AssessmentCriteria.AssessmentType:", validators);
return validators;
}
// END OF STATIC METADATA DEFINITION
// This constructor should not be called
protected BaseAssessmentCriteria ()
{
}
protected BBCBehaviourDecorator[] getBehaviours()
{
return AssessmentCriteria_BehaviourDecorators;
}
// Initialise the attributes
protected void _initialiseNewObjAttributes (ObjectTransaction transaction) throws StorageException
{
super._initialiseNewObjAttributes (transaction);
_Name = (String)(HELPER_Name.initialise (_Name));
_Importance = (Importance)(HELPER_Importance.initialise (_Importance));
_AssessmentType = (AssessmentType)(HELPER_AssessmentType.initialise (_AssessmentType));
}
// Initialise the associations
protected void _initialiseAssociations ()
{
super._initialiseAssociations ();
_Job = new SingleAssociation<AssessmentCriteria, Job> (this, SINGLEREFERENCE_Job, Job.MULTIPLEREFERENCE_AssessmentCriterias, Job.REFERENCE_Job, "tl_assessment_criteria");
}
// Initialise the associations
protected BaseBusinessClass initialiseReference ()
{
super.initialiseReference ();
_Job = new SingleAssociation<AssessmentCriteria, Job> (this, SINGLEREFERENCE_Job, Job.MULTIPLEREFERENCE_AssessmentCriterias, Job.REFERENCE_Job, "tl_assessment_criteria");
return this;
}
/**
* Get the attribute Name
*/
public String getName ()
{
assertValid();
String valToReturn = _Name;
for (AssessmentCriteriaBehaviourDecorator bhd : AssessmentCriteria_BehaviourDecorators)
{
valToReturn = bhd.getName ((AssessmentCriteria)this, valToReturn);
}
return valToReturn;
}
/**
* Called prior to the attribute changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preNameChange (String newName) throws FieldException
{
}
/**
* Called after the attribute changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postNameChange () throws FieldException
{
}
public FieldWriteability getWriteability_Name ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute Name. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setName (String newName) throws FieldException
{
boolean oldAndNewIdentical = HELPER_Name.compare (_Name, newName);
try
{
for (AssessmentCriteriaBehaviourDecorator bhd : AssessmentCriteria_BehaviourDecorators)
{
newName = bhd.setName ((AssessmentCriteria)this, newName);
oldAndNewIdentical = HELPER_Name.compare (_Name, newName);
}
if (FIELD_Name_Validators.length > 0)
{
Object newNameObj = HELPER_Name.toObject (newName);
if (newNameObj != null)
{
int loopMax = FIELD_Name_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_AssessmentCriteria.get (FIELD_Name);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_Name_Validators[v].checkAttribute (this, FIELD_Name, metadata, newNameObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_Name () != FieldWriteability.FALSE, "Field Name is not writeable");
preNameChange (newName);
markFieldChange (FIELD_Name);
_Name = newName;
postFieldChange (FIELD_Name);
postNameChange ();
}
}
/**
* Get the attribute Importance
*/
public Importance getImportance ()
{
assertValid();
Importance valToReturn = _Importance;
for (AssessmentCriteriaBehaviourDecorator bhd : AssessmentCriteria_BehaviourDecorators)
{
valToReturn = bhd.getImportance ((AssessmentCriteria)this, valToReturn);
}
return valToReturn;
}
/**
* Called prior to the attribute changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preImportanceChange (Importance newImportance) throws FieldException
{
}
/**
* Called after the attribute changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postImportanceChange () throws FieldException
{
}
public FieldWriteability getWriteability_Importance ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute Importance. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setImportance (Importance newImportance) throws FieldException
{
boolean oldAndNewIdentical = HELPER_Importance.compare (_Importance, newImportance);
try
{
for (AssessmentCriteriaBehaviourDecorator bhd : AssessmentCriteria_BehaviourDecorators)
{
newImportance = bhd.setImportance ((AssessmentCriteria)this, newImportance);
oldAndNewIdentical = HELPER_Importance.compare (_Importance, newImportance);
}
if (FIELD_Importance_Validators.length > 0)
{
Object newImportanceObj = HELPER_Importance.toObject (newImportance);
if (newImportanceObj != null)
{
int loopMax = FIELD_Importance_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_AssessmentCriteria.get (FIELD_Importance);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_Importance_Validators[v].checkAttribute (this, FIELD_Importance, metadata, newImportanceObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_Importance () != FieldWriteability.FALSE, "Field Importance is not writeable");
preImportanceChange (newImportance);
markFieldChange (FIELD_Importance);
_Importance = newImportance;
postFieldChange (FIELD_Importance);
postImportanceChange ();
}
}
/**
* Get the attribute AssessmentType
*/
public AssessmentType getAssessmentType ()
{
assertValid();
AssessmentType valToReturn = _AssessmentType;
for (AssessmentCriteriaBehaviourDecorator bhd : AssessmentCriteria_BehaviourDecorators)
{
valToReturn = bhd.getAssessmentType ((AssessmentCriteria)this, valToReturn);
}
return valToReturn;
}
/**
* Called prior to the attribute changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preAssessmentTypeChange (AssessmentType newAssessmentType) throws FieldException
{
}
/**
* Called after the attribute changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postAssessmentTypeChange () throws FieldException
{
}
public FieldWriteability getWriteability_AssessmentType ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute AssessmentType. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setAssessmentType (AssessmentType newAssessmentType) throws FieldException
{
boolean oldAndNewIdentical = HELPER_AssessmentType.compare (_AssessmentType, newAssessmentType);
try
{
for (AssessmentCriteriaBehaviourDecorator bhd : AssessmentCriteria_BehaviourDecorators)
{
newAssessmentType = bhd.setAssessmentType ((AssessmentCriteria)this, newAssessmentType);
oldAndNewIdentical = HELPER_AssessmentType.compare (_AssessmentType, newAssessmentType);
}
if (FIELD_AssessmentType_Validators.length > 0)
{
Object newAssessmentTypeObj = HELPER_AssessmentType.toObject (newAssessmentType);
if (newAssessmentTypeObj != null)
{
int loopMax = FIELD_AssessmentType_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_AssessmentCriteria.get (FIELD_AssessmentType);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_AssessmentType_Validators[v].checkAttribute (this, FIELD_AssessmentType, metadata, newAssessmentTypeObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_AssessmentType () != FieldWriteability.FALSE, "Field AssessmentType is not writeable");
preAssessmentTypeChange (newAssessmentType);
markFieldChange (FIELD_AssessmentType);
_AssessmentType = newAssessmentType;
postFieldChange (FIELD_AssessmentType);
postAssessmentTypeChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getSingleAssocs()
{
List result = super.getSingleAssocs ();
result.add("Job");
return result;
}
public BaseBusinessClass getSingleAssocReferenceInstance (String assocName)
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Job))
{
return _Job.getReferencedType ();
}
else
{
return super.getSingleAssocReferenceInstance (assocName);
}
}
public String getSingleAssocBackReference(String assocName)
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Job))
{
return Job.MULTIPLEREFERENCE_AssessmentCriterias ;
}
else
{
return super.getSingleAssocBackReference (assocName);
}
}
public BaseBusinessClass getSingleAssoc (String assocName) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Job))
{
return getJob ();
}
else
{
return super.getSingleAssoc (assocName);
}
}
public BaseBusinessClass getSingleAssoc (String assocName, Get getType) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Job))
{
return getJob (getType);
}
else
{
return super.getSingleAssoc (assocName, getType);
}
}
public Long getSingleAssocID (String assocName) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Job))
{
return getJobID ();
}
else
{
return super.getSingleAssocID (assocName);
}
}
public void setSingleAssoc (String assocName, BaseBusinessClass newValue) throws StorageException, FieldException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Job))
{
setJob ((Job)(newValue));
}
else
{
super.setSingleAssoc (assocName, newValue);
}
}
/**
* Get the reference Job
*/
public Job getJob () throws StorageException
{
assertValid();
try
{
return (Job)(_Job.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in AssessmentCriteria:", this.getObjectID (), ", was trying to get Job:", getJobID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _Job.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Job getJob (Get getType) throws StorageException
{
assertValid();
return _Job.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getJobID ()
{
assertValid();
if (_Job == null)
{
return null;
}
else
{
return _Job.getID ();
}
}
/**
* Called prior to the assoc changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preJobChange (Job newJob) throws FieldException
{
}
/**
* Called after the assoc changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postJobChange () throws FieldException
{
}
public FieldWriteability getWriteability_Job ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference Job. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setJob (Job newJob) throws StorageException, FieldException
{
if (_Job.wouldReferencedChange (newJob))
{
assertValid();
Debug.assertion (getWriteability_Job () != FieldWriteability.FALSE, "Assoc Job is not writeable");
preJobChange (newJob);
Job oldJob = getJob ();
if (oldJob != null)
{
// This is to stop validation from triggering when we are removed
_Job.set (null);
oldJob.removeFromAssessmentCriterias ((AssessmentCriteria)(this));
}
_Job.set (newJob);
if (newJob != null)
{
newJob.addToAssessmentCriterias ((AssessmentCriteria)(this));
}
postJobChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getMultiAssocs()
{
List result = super.getMultiAssocs ();
return result;
}
/**
* Get the reference instance for the multi assoc name.
*/
public BaseBusinessClass getMultiAssocReferenceInstance(String attribName)
{
return super.getMultiAssocReferenceInstance(attribName);
}
public String getMultiAssocBackReference(String attribName)
{
return super.getMultiAssocBackReference(attribName);
}
/**
* Get the assoc count for the multi assoc name.
*/
public int getMultiAssocCount(String attribName) throws StorageException
{
return super.getMultiAssocCount(attribName);
}
/**
* Get the assoc at a particular index
*/
public BaseBusinessClass getMultiAssocAt(String attribName, int index) throws StorageException
{
return super.getMultiAssocAt(attribName, index);
}
/**
* Add to a multi assoc by attribute name
*/
public void addToMultiAssoc(String attribName, BaseBusinessClass newElement) throws StorageException
{
super.addToMultiAssoc(attribName, newElement);
}
/**
* Remove from a multi assoc by attribute name
*/
public void removeFromMultiAssoc(String attribName, BaseBusinessClass oldElement) throws StorageException
{
super.removeFromMultiAssoc(attribName, oldElement);
}
protected void __loadMultiAssoc (String attribName, BaseBusinessClass[] elements)
{
super.__loadMultiAssoc(attribName, elements);
}
protected boolean __isMultiAssocLoaded (String attribName)
{
return super.__isMultiAssocLoaded(attribName);
}
public void onDelete ()
{
try
{
// Ensure we are removed from any loaded multi-associations that aren't mandatory
if (_Job.isLoaded () || getTransaction ().isObjectLoaded (_Job.getReferencedType (), getJobID ()))
{
Job referenced = getJob ();
if (referenced != null)
{
// Stop the callback
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null AssessmentCriterias from ", getObjectID (), " to ", referenced.getObjectID ());
_Job.set (null);
referenced.removeFromAssessmentCriterias ((AssessmentCriteria)this);
}
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
super.onDelete ();
}
public AssessmentCriteria newInstance ()
{
return new AssessmentCriteria ();
}
public AssessmentCriteria referenceInstance ()
{
return REFERENCE_AssessmentCriteria;
}
public AssessmentCriteria getInTransaction (ObjectTransaction t) throws StorageException
{
return getAssessmentCriteriaByID (t, getObjectID());
}
public BaseBusinessClass dummyInstance ()
{
return DUMMY_AssessmentCriteria;
}
public String getBaseSetName ()
{
return "tl_assessment_criteria";
}
/**
* This is where an object returns the Persistent sets that will
* store it into the database.
* The should be entered into allSets
*/
public void getPersistentSets (PersistentSetCollection allSets)
{
ObjectStatus myStatus = getStatus ();
PersistentSetStatus myPSetStatus = myStatus.getPSetStatus();
ObjectID myID = getID();
super.getPersistentSets (allSets);
PersistentSet tl_assessment_criteriaPSet = allSets.getPersistentSet (myID, "tl_assessment_criteria", myPSetStatus);
tl_assessment_criteriaPSet.setAttrib (FIELD_ObjectID, myID);
tl_assessment_criteriaPSet.setAttrib (FIELD_Name, HELPER_Name.toObject (_Name)); //
tl_assessment_criteriaPSet.setAttrib (FIELD_Importance, HELPER_Importance.toObject (_Importance)); //
tl_assessment_criteriaPSet.setAttrib (FIELD_AssessmentType, HELPER_AssessmentType.toObject (_AssessmentType)); //
_Job.getPersistentSets (allSets);
}
/**
* Sets the objects state based on Persistent sets.
*/
public void setFromPersistentSets (ObjectID objectID, PersistentSetCollection allSets)
{
super.setFromPersistentSets (objectID, allSets);
PersistentSet tl_assessment_criteriaPSet = allSets.getPersistentSet (objectID, "tl_assessment_criteria");
_Name = (String)(HELPER_Name.fromObject (_Name, tl_assessment_criteriaPSet.getAttrib (FIELD_Name))); //
_Importance = (Importance)(HELPER_Importance.fromObject (_Importance, tl_assessment_criteriaPSet.getAttrib (FIELD_Importance))); //
_AssessmentType = (AssessmentType)(HELPER_AssessmentType.fromObject (_AssessmentType, tl_assessment_criteriaPSet.getAttrib (FIELD_AssessmentType))); //
_Job.setFromPersistentSets (objectID, allSets);
}
public void setAttributesFrom (BaseBusinessClass other, MultiException e)
{
super.setAttributesFrom (other, e);
if (other instanceof AssessmentCriteria)
{
AssessmentCriteria otherAssessmentCriteria = (AssessmentCriteria)other;
try
{
setName (otherAssessmentCriteria.getName ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setImportance (otherAssessmentCriteria.getImportance ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setAssessmentType (otherAssessmentCriteria.getAssessmentType ());
}
catch (FieldException ex)
{
e.addException (ex);
}
}
}
/**
* Set the attributes in this to copies of the attributes in source.
*/
public void copyAttributesFrom (BaseBusinessClass source)
{
super.copyAttributesFrom (source);
if (source instanceof BaseAssessmentCriteria)
{
BaseAssessmentCriteria sourceAssessmentCriteria = (BaseAssessmentCriteria)(source);
_Name = sourceAssessmentCriteria._Name;
_Importance = sourceAssessmentCriteria._Importance;
_AssessmentType = sourceAssessmentCriteria._AssessmentType;
}
}
/**
* Set the associations in this to copies of the attributes in source.
*/
public void copySingleAssociationsFrom (BaseBusinessClass source, boolean linkToGhosts)
{
super.copySingleAssociationsFrom (source, linkToGhosts);
if (source instanceof BaseAssessmentCriteria)
{
BaseAssessmentCriteria sourceAssessmentCriteria = (BaseAssessmentCriteria)(source);
_Job.copyFrom (sourceAssessmentCriteria._Job, linkToGhosts);
}
}
/**
* Set the associations in this to copies of the attributes in source.
*/
public void copyAssociationsFrom (BaseBusinessClass source, boolean linkToGhosts)
{
super.copyAssociationsFrom (source, linkToGhosts);
if (source instanceof BaseAssessmentCriteria)
{
BaseAssessmentCriteria sourceAssessmentCriteria = (BaseAssessmentCriteria)(source);
}
}
public void validate (ValidationContext context)
{
super.validate (context);
}
/**
* Subclasses must override this to read in their attributes
*/
protected void readExternalData(Map<String, Object> vals) throws IOException, ClassNotFoundException
{
super.readExternalData(vals);
_Name = (String)(HELPER_Name.readExternal (_Name, vals.get(FIELD_Name))); //
_Importance = (Importance)(HELPER_Importance.readExternal (_Importance, vals.get(FIELD_Importance))); //
_AssessmentType = (AssessmentType)(HELPER_AssessmentType.readExternal (_AssessmentType, vals.get(FIELD_AssessmentType))); //
_Job.readExternalData(vals.get(SINGLEREFERENCE_Job));
}
/**
* Subclasses must override this to write out their attributes
*/
protected void writeExternalData(Map<String, Object> vals) throws IOException
{
super.writeExternalData(vals);
vals.put (FIELD_Name, HELPER_Name.writeExternal (_Name));
vals.put (FIELD_Importance, HELPER_Importance.writeExternal (_Importance));
vals.put (FIELD_AssessmentType, HELPER_AssessmentType.writeExternal (_AssessmentType));
vals.put (SINGLEREFERENCE_Job, _Job.writeExternalData());
}
public void compare (BaseBusinessClass other, AttributeChangeListener listener) throws StorageException
{
super.compare (other, listener);
if (other instanceof BaseAssessmentCriteria)
{
BaseAssessmentCriteria otherAssessmentCriteria = (BaseAssessmentCriteria)(other);
if (!HELPER_Name.compare(this._Name, otherAssessmentCriteria._Name))
{
listener.notifyFieldChange(this, other, FIELD_Name, HELPER_Name.toObject(this._Name), HELPER_Name.toObject(otherAssessmentCriteria._Name));
}
if (!HELPER_Importance.compare(this._Importance, otherAssessmentCriteria._Importance))
{
listener.notifyFieldChange(this, other, FIELD_Importance, HELPER_Importance.toObject(this._Importance), HELPER_Importance.toObject(otherAssessmentCriteria._Importance));
}
if (!HELPER_AssessmentType.compare(this._AssessmentType, otherAssessmentCriteria._AssessmentType))
{
listener.notifyFieldChange(this, other, FIELD_AssessmentType, HELPER_AssessmentType.toObject(this._AssessmentType), HELPER_AssessmentType.toObject(otherAssessmentCriteria._AssessmentType));
}
// Compare single assocs
_Job.compare (otherAssessmentCriteria._Job, listener);
// Compare multiple assocs
}
}
public void visitTransients (AttributeVisitor visitor) throws StorageException
{
super.visitAttributes (visitor);
}
public void visitAttributes (AttributeVisitor visitor) throws StorageException
{
super.visitAttributes (visitor);
visitor.visitField(this, FIELD_Name, HELPER_Name.toObject(getName()));
visitor.visitField(this, FIELD_Importance, HELPER_Importance.toObject(getImportance()));
visitor.visitField(this, FIELD_AssessmentType, HELPER_AssessmentType.toObject(getAssessmentType()));
visitor.visitAssociation (_Job);
}
public void visitAssociations (AssociationVisitor visitor, AssociatedScope scope) throws StorageException
{
super.visitAssociations (visitor, scope);
if (scope.includes (_Job))
{
visitor.visit (_Job);
}
}
public static AssessmentCriteria createAssessmentCriteria (ObjectTransaction transaction) throws StorageException
{
AssessmentCriteria result = new AssessmentCriteria ();
result.initialiseNewObject (transaction);
return result;
}
public static AssessmentCriteria getAssessmentCriteriaByID (ObjectTransaction transaction, Long objectID) throws StorageException
{
return (AssessmentCriteria)(transaction.getObjectByID (REFERENCE_AssessmentCriteria, objectID));
}
public boolean testFilter (String attribName, QueryFilter filter) throws StorageException
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_Name))
{
return filter.matches (getName ());
}
else if (attribName.equals (FIELD_Importance))
{
return filter.matches (getImportance ());
}
else if (attribName.equals (FIELD_AssessmentType))
{
return filter.matches (getAssessmentType ());
}
else if (attribName.equals (SINGLEREFERENCE_Job))
{
return filter.matches (getJob ());
}
else
{
return super.testFilter (attribName, filter);
}
}
public static SearchAll SearchByAll () { return new SearchAll (); }
public static class SearchAll extends SearchObject<AssessmentCriteria>
{
public SearchAll andObjectID (QueryFilter<Long> filter)
{
filter.addFilter (context, "tl_assessment_criteria.object_id", FIELD_ObjectID);
return this;
}
public SearchAll andObjectCreated (QueryFilter<Date> filter)
{
filter.addFilter (context, "tl_assessment_criteria.object_created_date", FIELD_ObjectCreated);
return this;
}
public SearchAll andObjectLastModified (QueryFilter<Date> filter)
{
filter.addFilter (context, "tl_assessment_criteria.object_last_updated_date", FIELD_ObjectLastModified);
return this;
}
public SearchAll andName (QueryFilter<String> filter)
{
filter.addFilter (context, "tl_assessment_criteria.name", "Name");
return this;
}
public SearchAll andImportance (QueryFilter<Importance> filter)
{
filter.addFilter (context, "tl_assessment_criteria.importance", "Importance");
return this;
}
public SearchAll andAssessmentType (QueryFilter<AssessmentType> filter)
{
filter.addFilter (context, "tl_assessment_criteria.assessment_type", "AssessmentType");
return this;
}
public SearchAll andJob (QueryFilter<Job> filter)
{
filter.addFilter (context, "tl_assessment_criteria.job_id", "Job");
return this;
}
public AssessmentCriteria[]
search (ObjectTransaction transaction) throws StorageException
{
BaseBusinessClass[] results = super.search (transaction, REFERENCE_AssessmentCriteria, SEARCH_All, criteria);
Set<AssessmentCriteria> typedResults = new LinkedHashSet <AssessmentCriteria> ();
for (BaseBusinessClass bbcResult : results)
{
AssessmentCriteria aResult = (AssessmentCriteria)bbcResult;
typedResults.add (aResult);
}
return ObjstoreUtils.removeDeleted(transaction, typedResults).toArray (new AssessmentCriteria[0]);
}
}
public static AssessmentCriteria[]
searchAll (ObjectTransaction transaction) throws StorageException
{
return SearchByAll ()
.search (transaction);
}
public Object getAttribute (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_Name))
{
return HELPER_Name.toObject (getName ());
}
else if (attribName.equals (FIELD_Importance))
{
return HELPER_Importance.toObject (getImportance ());
}
else if (attribName.equals (FIELD_AssessmentType))
{
return HELPER_AssessmentType.toObject (getAssessmentType ());
}
else
{
return super.getAttribute (attribName);
}
}
public AttributeHelper getAttributeHelper (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_Name))
{
return HELPER_Name;
}
else if (attribName.equals (FIELD_Importance))
{
return HELPER_Importance;
}
else if (attribName.equals (FIELD_AssessmentType))
{
return HELPER_AssessmentType;
}
else
{
return super.getAttributeHelper (attribName);
}
}
public void setAttribute (String attribName, Object attribValue) throws FieldException
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_Name))
{
setName ((String)(HELPER_Name.fromObject (_Name, attribValue)));
}
else if (attribName.equals (FIELD_Importance))
{
setImportance ((Importance)(HELPER_Importance.fromObject (_Importance, attribValue)));
}
else if (attribName.equals (FIELD_AssessmentType))
{
setAssessmentType ((AssessmentType)(HELPER_AssessmentType.fromObject (_AssessmentType, attribValue)));
}
else
{
super.setAttribute (attribName, attribValue);
}
}
public boolean isWriteable (String fieldName)
{
return getWriteable (fieldName) == FieldWriteability.TRUE;
}
public FieldWriteability getWriteable (String fieldName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (fieldName.equals (FIELD_Name))
{
return getWriteability_Name ();
}
else if (fieldName.equals (FIELD_Importance))
{
return getWriteability_Importance ();
}
else if (fieldName.equals (FIELD_AssessmentType))
{
return getWriteability_AssessmentType ();
}
else if (fieldName.equals (SINGLEREFERENCE_Job))
{
return getWriteability_Job ();
}
else
{
return super.getWriteable (fieldName);
}
}
public void putUnwriteable (Set<String> fields)
{
if (getWriteability_Name () != FieldWriteability.TRUE)
{
fields.add (FIELD_Name);
}
if (getWriteability_Importance () != FieldWriteability.TRUE)
{
fields.add (FIELD_Importance);
}
if (getWriteability_AssessmentType () != FieldWriteability.TRUE)
{
fields.add (FIELD_AssessmentType);
}
super.putUnwriteable (fields);
}
public List<AbstractAttribute> getAttributes ()
{
List result = super.getAttributes ();
result.add(HELPER_Name.getAttribObject (getClass (), _Name, false, FIELD_Name));
result.add(HELPER_Importance.getAttribObject (getClass (), _Importance, false, FIELD_Importance));
result.add(HELPER_AssessmentType.getAttribObject (getClass (), _AssessmentType, false, FIELD_AssessmentType));
return result;
}
public Map getAttributeMetadata (String attribute)
{
if (ATTRIBUTES_METADATA_AssessmentCriteria.containsKey (attribute))
{
return (Map)ATTRIBUTES_METADATA_AssessmentCriteria.get (attribute);
}
else
{
return super.getAttributeMetadata (attribute);
}
}
public Object getAttributeMetadata (String attribute, String metadata)
{
if (ATTRIBUTES_METADATA_AssessmentCriteria.containsKey (attribute))
{
return ((Map)ATTRIBUTES_METADATA_AssessmentCriteria.get (attribute)).get(metadata);
}
else
{
return super.getAttributeMetadata (attribute, metadata);
}
}
public void preCommit (boolean willBeStored) throws Exception
{
super.preCommit(willBeStored);
if(willBeStored)
{
}
}
public oneit.servlets.objstore.binary.BinaryContentHandler getBinaryContentHandler(String attribName)
{
return super.getBinaryContentHandler(attribName);
}
public static class AssessmentCriteriaBehaviourDecorator extends BaseBusinessClass.BBCBehaviourDecorator<AssessmentCriteria>
{
/**
* Get the attribute Name
*/
public String getName (AssessmentCriteria obj, String original)
{
return original;
}
/**
* Change the value set for attribute Name.
* May modify the field beforehand
* Occurs before validation.
*/
public String setName (AssessmentCriteria obj, String newName) throws FieldException
{
return newName;
}
/**
* Get the attribute Importance
*/
public Importance getImportance (AssessmentCriteria obj, Importance original)
{
return original;
}
/**
* Change the value set for attribute Importance.
* May modify the field beforehand
* Occurs before validation.
*/
public Importance setImportance (AssessmentCriteria obj, Importance newImportance) throws FieldException
{
return newImportance;
}
/**
* Get the attribute AssessmentType
*/
public AssessmentType getAssessmentType (AssessmentCriteria obj, AssessmentType original)
{
return original;
}
/**
* Change the value set for attribute AssessmentType.
* May modify the field beforehand
* Occurs before validation.
*/
public AssessmentType setAssessmentType (AssessmentCriteria obj, AssessmentType newAssessmentType) throws FieldException
{
return newAssessmentType;
}
}
public ORMPipeLine pipes()
{
return new AssessmentCriteriaPipeLineFactory<AssessmentCriteria, AssessmentCriteria> ((AssessmentCriteria)this);
}
/**
* Use this instead of pipes() to get rid of type casting.
*/
public AssessmentCriteriaPipeLineFactory<AssessmentCriteria, AssessmentCriteria> pipelineAssessmentCriteria()
{
return (AssessmentCriteriaPipeLineFactory<AssessmentCriteria, AssessmentCriteria>) pipes();
}
public static AssessmentCriteriaPipeLineFactory<AssessmentCriteria, AssessmentCriteria> pipesAssessmentCriteria(Collection<AssessmentCriteria> items)
{
return REFERENCE_AssessmentCriteria.new AssessmentCriteriaPipeLineFactory<AssessmentCriteria, AssessmentCriteria> (items);
}
public static AssessmentCriteriaPipeLineFactory<AssessmentCriteria, AssessmentCriteria> pipesAssessmentCriteria(AssessmentCriteria[] _items)
{
return pipesAssessmentCriteria(Arrays.asList (_items));
}
public static AssessmentCriteriaPipeLineFactory<AssessmentCriteria, AssessmentCriteria> pipesAssessmentCriteria()
{
return pipesAssessmentCriteria((Collection)null);
}
public class AssessmentCriteriaPipeLineFactory<From extends BaseBusinessClass, Me extends AssessmentCriteria> extends BaseBusinessClass.ORMPipeLine<From, Me>
{
public <Prev> AssessmentCriteriaPipeLineFactory (PipeLine<From, Prev> pipeLine, Pipe<Prev, Me> nextPipe)
{
super (pipeLine, nextPipe);
}
public AssessmentCriteriaPipeLineFactory (From seed)
{
super(seed);
}
public AssessmentCriteriaPipeLineFactory (Collection<From> seed)
{
super(seed);
}
public PipeLine<From, ? extends Object> to(String name)
{
if (name.equals ("Name"))
{
return toName ();
}
if (name.equals ("Importance"))
{
return toImportance ();
}
if (name.equals ("AssessmentType"))
{
return toAssessmentType ();
}
if (name.equals ("Job"))
{
return toJob ();
}
return super.to(name);
}
public PipeLine<From, String> toName () { return pipe(new ORMAttributePipe<Me, String>(FIELD_Name)); }
public PipeLine<From, Importance> toImportance () { return pipe(new ORMAttributePipe<Me, Importance>(FIELD_Importance)); }
public PipeLine<From, AssessmentType> toAssessmentType () { return pipe(new ORMAttributePipe<Me, AssessmentType>(FIELD_AssessmentType)); }
public Job.JobPipeLineFactory<From, Job> toJob () { return toJob (Filter.ALL); }
public Job.JobPipeLineFactory<From, Job> toJob (Filter<Job> filter)
{
return Job.REFERENCE_Job.new JobPipeLineFactory<From, Job> (this, new ORMSingleAssocPipe<Me, Job>(SINGLEREFERENCE_Job, filter));
}
}
public boolean isTransientAttrib(String attribName)
{
return super.isTransientAttrib(attribName);
}
public boolean isTransientSingleReference(String assocName)
{
return super.isTransientSingleReference(assocName);
}
}
class DummyAssessmentCriteria extends AssessmentCriteria
{
// Default constructor primarily to support Externalisable
public DummyAssessmentCriteria()
{
super();
}
public void assertValid ()
{
}
public Job getJob () throws StorageException
{
return (Job)(Job.DUMMY_Job);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getJobID ()
{
return Job.DUMMY_Job.getObjectID();
}
}
/*
* IMPORTANT!!!! XSL Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2 rev3 [oneit.objstore.BusinessObjectTemplate.xsl]
*
* Version: 1.0
* Vendor: Apache Software Foundation (Xalan XSLTC)
* Vendor URL: http://xml.apache.org/xalan-j
*/
package performa.orm;
import java.io.*;
import java.util.*;
import oneit.appservices.config.*;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.objstore.assocs.*;
import oneit.objstore.attributes.*;
import oneit.objstore.rdbms.filters.*;
import oneit.objstore.parser.*;
import oneit.objstore.validator.*;
import oneit.objstore.utils.*;
import oneit.utils.*;
import oneit.utils.filter.Filter;
import oneit.utils.transform.*;
import oneit.utils.parsers.FieldException;
import performa.orm.types.*;
public abstract class BaseAssessmentCriteriaAnswer extends BaseBusinessClass
{
// Reference instance for the object
public static final AssessmentCriteriaAnswer REFERENCE_AssessmentCriteriaAnswer = new AssessmentCriteriaAnswer ();
// Reference instance for the object
public static final AssessmentCriteriaAnswer DUMMY_AssessmentCriteriaAnswer = new DummyAssessmentCriteriaAnswer ();
// Static constants corresponding to field names
public static final String FIELD_Answer = "Answer";
public static final String FIELD_Notes = "Notes";
public static final String SINGLEREFERENCE_AssessmentCriteria = "AssessmentCriteria";
public static final String SINGLEREFERENCE_JobApplication = "JobApplication";
public static final String BACKREF_JobApplication = "";
// Static constants corresponding to searches
public static final String SEARCH_All = "All";
// Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper<AssessmentCriteriaAnswer> HELPER_Answer = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<AssessmentCriteriaAnswer> HELPER_Notes = DefaultAttributeHelper.INSTANCE;
// Private attributes corresponding to business object data
private Boolean _Answer;
private String _Notes;
// Private attributes corresponding to single references
private SingleAssociation<AssessmentCriteriaAnswer, AssessmentCriteria> _AssessmentCriteria;
private SingleAssociation<AssessmentCriteriaAnswer, JobApplication> _JobApplication;
// Private attributes corresponding to multiple references
// Map of maps of metadata
private static final Map ATTRIBUTES_METADATA_AssessmentCriteriaAnswer = new HashMap ();
// Arrays of validators for each attribute
private static final AttributeValidator[] FIELD_Answer_Validators;
private static final AttributeValidator[] FIELD_Notes_Validators;
// Arrays of behaviour decorators
private static final AssessmentCriteriaAnswerBehaviourDecorator[] AssessmentCriteriaAnswer_BehaviourDecorators;
static
{
try
{
String tmp_JobApplication = JobApplication.BACKREF_AssessmentCriteriaAnswers;
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
setupAssocMetaData_AssessmentCriteria();
setupAssocMetaData_JobApplication();
FIELD_Answer_Validators = (AttributeValidator[])setupAttribMetaData_Answer(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_Notes_Validators = (AttributeValidator[])setupAttribMetaData_Notes(validatorMapping).toArray (new AttributeValidator[0]);
REFERENCE_AssessmentCriteriaAnswer.initialiseReference ();
DUMMY_AssessmentCriteriaAnswer.initialiseReference ();
AssessmentCriteriaAnswer_BehaviourDecorators = BaseBusinessClass.getBBCBehaviours(AssessmentCriteriaAnswer.class).toArray(new AssessmentCriteriaAnswerBehaviourDecorator[0]);
}
catch (RuntimeException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR1, e, "Error initialising");
throw e;
}
}
// Meta Info setup
private static void setupAssocMetaData_AssessmentCriteria()
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "assessment_criteria_id");
metaInfo.put ("name", "AssessmentCriteria");
metaInfo.put ("type", "AssessmentCriteria");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for AssessmentCriteriaAnswer.AssessmentCriteria:", metaInfo);
ATTRIBUTES_METADATA_AssessmentCriteriaAnswer.put (SINGLEREFERENCE_AssessmentCriteria, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static void setupAssocMetaData_JobApplication()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "AssessmentCriteriaAnswers");
metaInfo.put ("dbcol", "job_application_id");
metaInfo.put ("name", "JobApplication");
metaInfo.put ("type", "JobApplication");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for AssessmentCriteriaAnswer.JobApplication:", metaInfo);
ATTRIBUTES_METADATA_AssessmentCriteriaAnswer.put (SINGLEREFERENCE_JobApplication, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static List setupAttribMetaData_Answer(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "answer");
metaInfo.put ("name", "Answer");
metaInfo.put ("type", "Boolean");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for AssessmentCriteriaAnswer.Answer:", metaInfo);
ATTRIBUTES_METADATA_AssessmentCriteriaAnswer.put (FIELD_Answer, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(AssessmentCriteriaAnswer.class, "Answer", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for AssessmentCriteriaAnswer.Answer:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_Notes(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "notes");
metaInfo.put ("name", "Notes");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for AssessmentCriteriaAnswer.Notes:", metaInfo);
ATTRIBUTES_METADATA_AssessmentCriteriaAnswer.put (FIELD_Notes, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(AssessmentCriteriaAnswer.class, "Notes", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for AssessmentCriteriaAnswer.Notes:", validators);
return validators;
}
// END OF STATIC METADATA DEFINITION
// This constructor should not be called
protected BaseAssessmentCriteriaAnswer ()
{
}
protected BBCBehaviourDecorator[] getBehaviours()
{
return AssessmentCriteriaAnswer_BehaviourDecorators;
}
// Initialise the attributes
protected void _initialiseNewObjAttributes (ObjectTransaction transaction) throws StorageException
{
super._initialiseNewObjAttributes (transaction);
_Answer = (Boolean)(HELPER_Answer.initialise (_Answer));
_Notes = (String)(HELPER_Notes.initialise (_Notes));
}
// Initialise the associations
protected void _initialiseAssociations ()
{
super._initialiseAssociations ();
_AssessmentCriteria = new SingleAssociation<AssessmentCriteriaAnswer, AssessmentCriteria> (this, SINGLEREFERENCE_AssessmentCriteria, null, AssessmentCriteria.REFERENCE_AssessmentCriteria, "tl_assessment_criteria_answer");
_JobApplication = new SingleAssociation<AssessmentCriteriaAnswer, JobApplication> (this, SINGLEREFERENCE_JobApplication, JobApplication.MULTIPLEREFERENCE_AssessmentCriteriaAnswers, JobApplication.REFERENCE_JobApplication, "tl_assessment_criteria_answer");
}
// Initialise the associations
protected BaseBusinessClass initialiseReference ()
{
super.initialiseReference ();
_AssessmentCriteria = new SingleAssociation<AssessmentCriteriaAnswer, AssessmentCriteria> (this, SINGLEREFERENCE_AssessmentCriteria, null, AssessmentCriteria.REFERENCE_AssessmentCriteria, "tl_assessment_criteria_answer");
_JobApplication = new SingleAssociation<AssessmentCriteriaAnswer, JobApplication> (this, SINGLEREFERENCE_JobApplication, JobApplication.MULTIPLEREFERENCE_AssessmentCriteriaAnswers, JobApplication.REFERENCE_JobApplication, "tl_assessment_criteria_answer");
return this;
}
/**
* Get the attribute Answer
*/
public Boolean getAnswer ()
{
assertValid();
Boolean valToReturn = _Answer;
for (AssessmentCriteriaAnswerBehaviourDecorator bhd : AssessmentCriteriaAnswer_BehaviourDecorators)
{
valToReturn = bhd.getAnswer ((AssessmentCriteriaAnswer)this, valToReturn);
}
return valToReturn;
}
/**
* Called prior to the attribute changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preAnswerChange (Boolean newAnswer) throws FieldException
{
}
/**
* Called after the attribute changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postAnswerChange () throws FieldException
{
}
public FieldWriteability getWriteability_Answer ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute Answer. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setAnswer (Boolean newAnswer) throws FieldException
{
boolean oldAndNewIdentical = HELPER_Answer.compare (_Answer, newAnswer);
try
{
for (AssessmentCriteriaAnswerBehaviourDecorator bhd : AssessmentCriteriaAnswer_BehaviourDecorators)
{
newAnswer = bhd.setAnswer ((AssessmentCriteriaAnswer)this, newAnswer);
oldAndNewIdentical = HELPER_Answer.compare (_Answer, newAnswer);
}
if (FIELD_Answer_Validators.length > 0)
{
Object newAnswerObj = HELPER_Answer.toObject (newAnswer);
if (newAnswerObj != null)
{
int loopMax = FIELD_Answer_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_AssessmentCriteriaAnswer.get (FIELD_Answer);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_Answer_Validators[v].checkAttribute (this, FIELD_Answer, metadata, newAnswerObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_Answer () != FieldWriteability.FALSE, "Field Answer is not writeable");
preAnswerChange (newAnswer);
markFieldChange (FIELD_Answer);
_Answer = newAnswer;
postFieldChange (FIELD_Answer);
postAnswerChange ();
}
}
/**
* Get the attribute Notes
*/
public String getNotes ()
{
assertValid();
String valToReturn = _Notes;
for (AssessmentCriteriaAnswerBehaviourDecorator bhd : AssessmentCriteriaAnswer_BehaviourDecorators)
{
valToReturn = bhd.getNotes ((AssessmentCriteriaAnswer)this, valToReturn);
}
return valToReturn;
}
/**
* Called prior to the attribute changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preNotesChange (String newNotes) throws FieldException
{
}
/**
* Called after the attribute changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postNotesChange () throws FieldException
{
}
public FieldWriteability getWriteability_Notes ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute Notes. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setNotes (String newNotes) throws FieldException
{
boolean oldAndNewIdentical = HELPER_Notes.compare (_Notes, newNotes);
try
{
for (AssessmentCriteriaAnswerBehaviourDecorator bhd : AssessmentCriteriaAnswer_BehaviourDecorators)
{
newNotes = bhd.setNotes ((AssessmentCriteriaAnswer)this, newNotes);
oldAndNewIdentical = HELPER_Notes.compare (_Notes, newNotes);
}
if (FIELD_Notes_Validators.length > 0)
{
Object newNotesObj = HELPER_Notes.toObject (newNotes);
if (newNotesObj != null)
{
int loopMax = FIELD_Notes_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_AssessmentCriteriaAnswer.get (FIELD_Notes);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_Notes_Validators[v].checkAttribute (this, FIELD_Notes, metadata, newNotesObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_Notes () != FieldWriteability.FALSE, "Field Notes is not writeable");
preNotesChange (newNotes);
markFieldChange (FIELD_Notes);
_Notes = newNotes;
postFieldChange (FIELD_Notes);
postNotesChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getSingleAssocs()
{
List result = super.getSingleAssocs ();
result.add("AssessmentCriteria");
result.add("JobApplication");
return result;
}
public BaseBusinessClass getSingleAssocReferenceInstance (String assocName)
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_AssessmentCriteria))
{
return _AssessmentCriteria.getReferencedType ();
}else if (assocName.equals (SINGLEREFERENCE_JobApplication))
{
return _JobApplication.getReferencedType ();
}
else
{
return super.getSingleAssocReferenceInstance (assocName);
}
}
public String getSingleAssocBackReference(String assocName)
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_AssessmentCriteria))
{
return null ;
}else if (assocName.equals (SINGLEREFERENCE_JobApplication))
{
return JobApplication.MULTIPLEREFERENCE_AssessmentCriteriaAnswers ;
}
else
{
return super.getSingleAssocBackReference (assocName);
}
}
public BaseBusinessClass getSingleAssoc (String assocName) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_AssessmentCriteria))
{
return getAssessmentCriteria ();
}else if (assocName.equals (SINGLEREFERENCE_JobApplication))
{
return getJobApplication ();
}
else
{
return super.getSingleAssoc (assocName);
}
}
public BaseBusinessClass getSingleAssoc (String assocName, Get getType) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_AssessmentCriteria))
{
return getAssessmentCriteria (getType);
}else if (assocName.equals (SINGLEREFERENCE_JobApplication))
{
return getJobApplication (getType);
}
else
{
return super.getSingleAssoc (assocName, getType);
}
}
public Long getSingleAssocID (String assocName) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_AssessmentCriteria))
{
return getAssessmentCriteriaID ();
}else if (assocName.equals (SINGLEREFERENCE_JobApplication))
{
return getJobApplicationID ();
}
else
{
return super.getSingleAssocID (assocName);
}
}
public void setSingleAssoc (String assocName, BaseBusinessClass newValue) throws StorageException, FieldException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_AssessmentCriteria))
{
setAssessmentCriteria ((AssessmentCriteria)(newValue));
}else if (assocName.equals (SINGLEREFERENCE_JobApplication))
{
setJobApplication ((JobApplication)(newValue));
}
else
{
super.setSingleAssoc (assocName, newValue);
}
}
/**
* Get the reference AssessmentCriteria
*/
public AssessmentCriteria getAssessmentCriteria () throws StorageException
{
assertValid();
try
{
return (AssessmentCriteria)(_AssessmentCriteria.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in AssessmentCriteriaAnswer:", this.getObjectID (), ", was trying to get AssessmentCriteria:", getAssessmentCriteriaID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _AssessmentCriteria.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public AssessmentCriteria getAssessmentCriteria (Get getType) throws StorageException
{
assertValid();
return _AssessmentCriteria.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getAssessmentCriteriaID ()
{
assertValid();
if (_AssessmentCriteria == null)
{
return null;
}
else
{
return _AssessmentCriteria.getID ();
}
}
/**
* Called prior to the assoc changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preAssessmentCriteriaChange (AssessmentCriteria newAssessmentCriteria) throws FieldException
{
}
/**
* Called after the assoc changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postAssessmentCriteriaChange () throws FieldException
{
}
public FieldWriteability getWriteability_AssessmentCriteria ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference AssessmentCriteria. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setAssessmentCriteria (AssessmentCriteria newAssessmentCriteria) throws StorageException, FieldException
{
if (_AssessmentCriteria.wouldReferencedChange (newAssessmentCriteria))
{
assertValid();
Debug.assertion (getWriteability_AssessmentCriteria () != FieldWriteability.FALSE, "Assoc AssessmentCriteria is not writeable");
preAssessmentCriteriaChange (newAssessmentCriteria);
_AssessmentCriteria.set (newAssessmentCriteria);
postAssessmentCriteriaChange ();
}
}
/**
* Get the reference JobApplication
*/
public JobApplication getJobApplication () throws StorageException
{
assertValid();
try
{
return (JobApplication)(_JobApplication.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in AssessmentCriteriaAnswer:", this.getObjectID (), ", was trying to get JobApplication:", getJobApplicationID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _JobApplication.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public JobApplication getJobApplication (Get getType) throws StorageException
{
assertValid();
return _JobApplication.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getJobApplicationID ()
{
assertValid();
if (_JobApplication == null)
{
return null;
}
else
{
return _JobApplication.getID ();
}
}
/**
* Called prior to the assoc changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preJobApplicationChange (JobApplication newJobApplication) throws FieldException
{
}
/**
* Called after the assoc changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postJobApplicationChange () throws FieldException
{
}
public FieldWriteability getWriteability_JobApplication ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference JobApplication. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setJobApplication (JobApplication newJobApplication) throws StorageException, FieldException
{
if (_JobApplication.wouldReferencedChange (newJobApplication))
{
assertValid();
Debug.assertion (getWriteability_JobApplication () != FieldWriteability.FALSE, "Assoc JobApplication is not writeable");
preJobApplicationChange (newJobApplication);
JobApplication oldJobApplication = getJobApplication ();
if (oldJobApplication != null)
{
// This is to stop validation from triggering when we are removed
_JobApplication.set (null);
oldJobApplication.removeFromAssessmentCriteriaAnswers ((AssessmentCriteriaAnswer)(this));
}
_JobApplication.set (newJobApplication);
if (newJobApplication != null)
{
newJobApplication.addToAssessmentCriteriaAnswers ((AssessmentCriteriaAnswer)(this));
}
postJobApplicationChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getMultiAssocs()
{
List result = super.getMultiAssocs ();
return result;
}
/**
* Get the reference instance for the multi assoc name.
*/
public BaseBusinessClass getMultiAssocReferenceInstance(String attribName)
{
return super.getMultiAssocReferenceInstance(attribName);
}
public String getMultiAssocBackReference(String attribName)
{
return super.getMultiAssocBackReference(attribName);
}
/**
* Get the assoc count for the multi assoc name.
*/
public int getMultiAssocCount(String attribName) throws StorageException
{
return super.getMultiAssocCount(attribName);
}
/**
* Get the assoc at a particular index
*/
public BaseBusinessClass getMultiAssocAt(String attribName, int index) throws StorageException
{
return super.getMultiAssocAt(attribName, index);
}
/**
* Add to a multi assoc by attribute name
*/
public void addToMultiAssoc(String attribName, BaseBusinessClass newElement) throws StorageException
{
super.addToMultiAssoc(attribName, newElement);
}
/**
* Remove from a multi assoc by attribute name
*/
public void removeFromMultiAssoc(String attribName, BaseBusinessClass oldElement) throws StorageException
{
super.removeFromMultiAssoc(attribName, oldElement);
}
protected void __loadMultiAssoc (String attribName, BaseBusinessClass[] elements)
{
super.__loadMultiAssoc(attribName, elements);
}
protected boolean __isMultiAssocLoaded (String attribName)
{
return super.__isMultiAssocLoaded(attribName);
}
public void onDelete ()
{
try
{
// Ensure we are removed from any loaded multi-associations that aren't mandatory
if (_JobApplication.isLoaded () || getTransaction ().isObjectLoaded (_JobApplication.getReferencedType (), getJobApplicationID ()))
{
JobApplication referenced = getJobApplication ();
if (referenced != null)
{
// Stop the callback
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null AssessmentCriteriaAnswers from ", getObjectID (), " to ", referenced.getObjectID ());
_JobApplication.set (null);
referenced.removeFromAssessmentCriteriaAnswers ((AssessmentCriteriaAnswer)this);
}
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
super.onDelete ();
}
public AssessmentCriteriaAnswer newInstance ()
{
return new AssessmentCriteriaAnswer ();
}
public AssessmentCriteriaAnswer referenceInstance ()
{
return REFERENCE_AssessmentCriteriaAnswer;
}
public AssessmentCriteriaAnswer getInTransaction (ObjectTransaction t) throws StorageException
{
return getAssessmentCriteriaAnswerByID (t, getObjectID());
}
public BaseBusinessClass dummyInstance ()
{
return DUMMY_AssessmentCriteriaAnswer;
}
public String getBaseSetName ()
{
return "tl_assessment_criteria_answer";
}
/**
* This is where an object returns the Persistent sets that will
* store it into the database.
* The should be entered into allSets
*/
public void getPersistentSets (PersistentSetCollection allSets)
{
ObjectStatus myStatus = getStatus ();
PersistentSetStatus myPSetStatus = myStatus.getPSetStatus();
ObjectID myID = getID();
super.getPersistentSets (allSets);
PersistentSet tl_assessment_criteria_answerPSet = allSets.getPersistentSet (myID, "tl_assessment_criteria_answer", myPSetStatus);
tl_assessment_criteria_answerPSet.setAttrib (FIELD_ObjectID, myID);
tl_assessment_criteria_answerPSet.setAttrib (FIELD_Answer, HELPER_Answer.toObject (_Answer)); //
tl_assessment_criteria_answerPSet.setAttrib (FIELD_Notes, HELPER_Notes.toObject (_Notes)); //
_AssessmentCriteria.getPersistentSets (allSets);
_JobApplication.getPersistentSets (allSets);
}
/**
* Sets the objects state based on Persistent sets.
*/
public void setFromPersistentSets (ObjectID objectID, PersistentSetCollection allSets)
{
super.setFromPersistentSets (objectID, allSets);
PersistentSet tl_assessment_criteria_answerPSet = allSets.getPersistentSet (objectID, "tl_assessment_criteria_answer");
_Answer = (Boolean)(HELPER_Answer.fromObject (_Answer, tl_assessment_criteria_answerPSet.getAttrib (FIELD_Answer))); //
_Notes = (String)(HELPER_Notes.fromObject (_Notes, tl_assessment_criteria_answerPSet.getAttrib (FIELD_Notes))); //
_AssessmentCriteria.setFromPersistentSets (objectID, allSets);
_JobApplication.setFromPersistentSets (objectID, allSets);
}
public void setAttributesFrom (BaseBusinessClass other, MultiException e)
{
super.setAttributesFrom (other, e);
if (other instanceof AssessmentCriteriaAnswer)
{
AssessmentCriteriaAnswer otherAssessmentCriteriaAnswer = (AssessmentCriteriaAnswer)other;
try
{
setAnswer (otherAssessmentCriteriaAnswer.getAnswer ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setNotes (otherAssessmentCriteriaAnswer.getNotes ());
}
catch (FieldException ex)
{
e.addException (ex);
}
}
}
/**
* Set the attributes in this to copies of the attributes in source.
*/
public void copyAttributesFrom (BaseBusinessClass source)
{
super.copyAttributesFrom (source);
if (source instanceof BaseAssessmentCriteriaAnswer)
{
BaseAssessmentCriteriaAnswer sourceAssessmentCriteriaAnswer = (BaseAssessmentCriteriaAnswer)(source);
_Answer = sourceAssessmentCriteriaAnswer._Answer;
_Notes = sourceAssessmentCriteriaAnswer._Notes;
}
}
/**
* Set the associations in this to copies of the attributes in source.
*/
public void copySingleAssociationsFrom (BaseBusinessClass source, boolean linkToGhosts)
{
super.copySingleAssociationsFrom (source, linkToGhosts);
if (source instanceof BaseAssessmentCriteriaAnswer)
{
BaseAssessmentCriteriaAnswer sourceAssessmentCriteriaAnswer = (BaseAssessmentCriteriaAnswer)(source);
_AssessmentCriteria.copyFrom (sourceAssessmentCriteriaAnswer._AssessmentCriteria, linkToGhosts);
_JobApplication.copyFrom (sourceAssessmentCriteriaAnswer._JobApplication, linkToGhosts);
}
}
/**
* Set the associations in this to copies of the attributes in source.
*/
public void copyAssociationsFrom (BaseBusinessClass source, boolean linkToGhosts)
{
super.copyAssociationsFrom (source, linkToGhosts);
if (source instanceof BaseAssessmentCriteriaAnswer)
{
BaseAssessmentCriteriaAnswer sourceAssessmentCriteriaAnswer = (BaseAssessmentCriteriaAnswer)(source);
}
}
public void validate (ValidationContext context)
{
super.validate (context);
}
/**
* Subclasses must override this to read in their attributes
*/
protected void readExternalData(Map<String, Object> vals) throws IOException, ClassNotFoundException
{
super.readExternalData(vals);
_Answer = (Boolean)(HELPER_Answer.readExternal (_Answer, vals.get(FIELD_Answer))); //
_Notes = (String)(HELPER_Notes.readExternal (_Notes, vals.get(FIELD_Notes))); //
_AssessmentCriteria.readExternalData(vals.get(SINGLEREFERENCE_AssessmentCriteria));
_JobApplication.readExternalData(vals.get(SINGLEREFERENCE_JobApplication));
}
/**
* Subclasses must override this to write out their attributes
*/
protected void writeExternalData(Map<String, Object> vals) throws IOException
{
super.writeExternalData(vals);
vals.put (FIELD_Answer, HELPER_Answer.writeExternal (_Answer));
vals.put (FIELD_Notes, HELPER_Notes.writeExternal (_Notes));
vals.put (SINGLEREFERENCE_AssessmentCriteria, _AssessmentCriteria.writeExternalData());
vals.put (SINGLEREFERENCE_JobApplication, _JobApplication.writeExternalData());
}
public void compare (BaseBusinessClass other, AttributeChangeListener listener) throws StorageException
{
super.compare (other, listener);
if (other instanceof BaseAssessmentCriteriaAnswer)
{
BaseAssessmentCriteriaAnswer otherAssessmentCriteriaAnswer = (BaseAssessmentCriteriaAnswer)(other);
if (!HELPER_Answer.compare(this._Answer, otherAssessmentCriteriaAnswer._Answer))
{
listener.notifyFieldChange(this, other, FIELD_Answer, HELPER_Answer.toObject(this._Answer), HELPER_Answer.toObject(otherAssessmentCriteriaAnswer._Answer));
}
if (!HELPER_Notes.compare(this._Notes, otherAssessmentCriteriaAnswer._Notes))
{
listener.notifyFieldChange(this, other, FIELD_Notes, HELPER_Notes.toObject(this._Notes), HELPER_Notes.toObject(otherAssessmentCriteriaAnswer._Notes));
}
// Compare single assocs
_AssessmentCriteria.compare (otherAssessmentCriteriaAnswer._AssessmentCriteria, listener);
_JobApplication.compare (otherAssessmentCriteriaAnswer._JobApplication, listener);
// Compare multiple assocs
}
}
public void visitTransients (AttributeVisitor visitor) throws StorageException
{
super.visitAttributes (visitor);
}
public void visitAttributes (AttributeVisitor visitor) throws StorageException
{
super.visitAttributes (visitor);
visitor.visitField(this, FIELD_Answer, HELPER_Answer.toObject(getAnswer()));
visitor.visitField(this, FIELD_Notes, HELPER_Notes.toObject(getNotes()));
visitor.visitAssociation (_AssessmentCriteria);
visitor.visitAssociation (_JobApplication);
}
public void visitAssociations (AssociationVisitor visitor, AssociatedScope scope) throws StorageException
{
super.visitAssociations (visitor, scope);
if (scope.includes (_AssessmentCriteria))
{
visitor.visit (_AssessmentCriteria);
}
if (scope.includes (_JobApplication))
{
visitor.visit (_JobApplication);
}
}
public static AssessmentCriteriaAnswer createAssessmentCriteriaAnswer (ObjectTransaction transaction) throws StorageException
{
AssessmentCriteriaAnswer result = new AssessmentCriteriaAnswer ();
result.initialiseNewObject (transaction);
return result;
}
public static AssessmentCriteriaAnswer getAssessmentCriteriaAnswerByID (ObjectTransaction transaction, Long objectID) throws StorageException
{
return (AssessmentCriteriaAnswer)(transaction.getObjectByID (REFERENCE_AssessmentCriteriaAnswer, objectID));
}
public boolean testFilter (String attribName, QueryFilter filter) throws StorageException
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_Answer))
{
return filter.matches (getAnswer ());
}
else if (attribName.equals (FIELD_Notes))
{
return filter.matches (getNotes ());
}
else if (attribName.equals (SINGLEREFERENCE_AssessmentCriteria))
{
return filter.matches (getAssessmentCriteria ());
}
else if (attribName.equals (SINGLEREFERENCE_JobApplication))
{
return filter.matches (getJobApplication ());
}
else
{
return super.testFilter (attribName, filter);
}
}
public static SearchAll SearchByAll () { return new SearchAll (); }
public static class SearchAll extends SearchObject<AssessmentCriteriaAnswer>
{
public SearchAll andObjectID (QueryFilter<Long> filter)
{
filter.addFilter (context, "tl_assessment_criteria_answer.object_id", FIELD_ObjectID);
return this;
}
public SearchAll andObjectCreated (QueryFilter<Date> filter)
{
filter.addFilter (context, "tl_assessment_criteria_answer.object_created_date", FIELD_ObjectCreated);
return this;
}
public SearchAll andObjectLastModified (QueryFilter<Date> filter)
{
filter.addFilter (context, "tl_assessment_criteria_answer.object_last_updated_date", FIELD_ObjectLastModified);
return this;
}
public SearchAll andAnswer (QueryFilter<Boolean> filter)
{
filter.addFilter (context, "tl_assessment_criteria_answer.answer", "Answer");
return this;
}
public SearchAll andNotes (QueryFilter<String> filter)
{
filter.addFilter (context, "tl_assessment_criteria_answer.notes", "Notes");
return this;
}
public SearchAll andAssessmentCriteria (QueryFilter<AssessmentCriteria> filter)
{
filter.addFilter (context, "tl_assessment_criteria_answer.assessment_criteria_id", "AssessmentCriteria");
return this;
}
public SearchAll andJobApplication (QueryFilter<JobApplication> filter)
{
filter.addFilter (context, "tl_assessment_criteria_answer.job_application_id", "JobApplication");
return this;
}
public AssessmentCriteriaAnswer[]
search (ObjectTransaction transaction) throws StorageException
{
BaseBusinessClass[] results = super.search (transaction, REFERENCE_AssessmentCriteriaAnswer, SEARCH_All, criteria);
Set<AssessmentCriteriaAnswer> typedResults = new LinkedHashSet <AssessmentCriteriaAnswer> ();
for (BaseBusinessClass bbcResult : results)
{
AssessmentCriteriaAnswer aResult = (AssessmentCriteriaAnswer)bbcResult;
typedResults.add (aResult);
}
return ObjstoreUtils.removeDeleted(transaction, typedResults).toArray (new AssessmentCriteriaAnswer[0]);
}
}
public static AssessmentCriteriaAnswer[]
searchAll (ObjectTransaction transaction) throws StorageException
{
return SearchByAll ()
.search (transaction);
}
public Object getAttribute (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_Answer))
{
return HELPER_Answer.toObject (getAnswer ());
}
else if (attribName.equals (FIELD_Notes))
{
return HELPER_Notes.toObject (getNotes ());
}
else
{
return super.getAttribute (attribName);
}
}
public AttributeHelper getAttributeHelper (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_Answer))
{
return HELPER_Answer;
}
else if (attribName.equals (FIELD_Notes))
{
return HELPER_Notes;
}
else
{
return super.getAttributeHelper (attribName);
}
}
public void setAttribute (String attribName, Object attribValue) throws FieldException
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_Answer))
{
setAnswer ((Boolean)(HELPER_Answer.fromObject (_Answer, attribValue)));
}
else if (attribName.equals (FIELD_Notes))
{
setNotes ((String)(HELPER_Notes.fromObject (_Notes, attribValue)));
}
else
{
super.setAttribute (attribName, attribValue);
}
}
public boolean isWriteable (String fieldName)
{
return getWriteable (fieldName) == FieldWriteability.TRUE;
}
public FieldWriteability getWriteable (String fieldName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (fieldName.equals (FIELD_Answer))
{
return getWriteability_Answer ();
}
else if (fieldName.equals (FIELD_Notes))
{
return getWriteability_Notes ();
}
else if (fieldName.equals (SINGLEREFERENCE_AssessmentCriteria))
{
return getWriteability_AssessmentCriteria ();
}
else if (fieldName.equals (SINGLEREFERENCE_JobApplication))
{
return getWriteability_JobApplication ();
}
else
{
return super.getWriteable (fieldName);
}
}
public void putUnwriteable (Set<String> fields)
{
if (getWriteability_Answer () != FieldWriteability.TRUE)
{
fields.add (FIELD_Answer);
}
if (getWriteability_Notes () != FieldWriteability.TRUE)
{
fields.add (FIELD_Notes);
}
super.putUnwriteable (fields);
}
public List<AbstractAttribute> getAttributes ()
{
List result = super.getAttributes ();
result.add(HELPER_Answer.getAttribObject (getClass (), _Answer, false, FIELD_Answer));
result.add(HELPER_Notes.getAttribObject (getClass (), _Notes, false, FIELD_Notes));
return result;
}
public Map getAttributeMetadata (String attribute)
{
if (ATTRIBUTES_METADATA_AssessmentCriteriaAnswer.containsKey (attribute))
{
return (Map)ATTRIBUTES_METADATA_AssessmentCriteriaAnswer.get (attribute);
}
else
{
return super.getAttributeMetadata (attribute);
}
}
public Object getAttributeMetadata (String attribute, String metadata)
{
if (ATTRIBUTES_METADATA_AssessmentCriteriaAnswer.containsKey (attribute))
{
return ((Map)ATTRIBUTES_METADATA_AssessmentCriteriaAnswer.get (attribute)).get(metadata);
}
else
{
return super.getAttributeMetadata (attribute, metadata);
}
}
public void preCommit (boolean willBeStored) throws Exception
{
super.preCommit(willBeStored);
if(willBeStored)
{
}
}
public oneit.servlets.objstore.binary.BinaryContentHandler getBinaryContentHandler(String attribName)
{
return super.getBinaryContentHandler(attribName);
}
public static class AssessmentCriteriaAnswerBehaviourDecorator extends BaseBusinessClass.BBCBehaviourDecorator<AssessmentCriteriaAnswer>
{
/**
* Get the attribute Answer
*/
public Boolean getAnswer (AssessmentCriteriaAnswer obj, Boolean original)
{
return original;
}
/**
* Change the value set for attribute Answer.
* May modify the field beforehand
* Occurs before validation.
*/
public Boolean setAnswer (AssessmentCriteriaAnswer obj, Boolean newAnswer) throws FieldException
{
return newAnswer;
}
/**
* Get the attribute Notes
*/
public String getNotes (AssessmentCriteriaAnswer obj, String original)
{
return original;
}
/**
* Change the value set for attribute Notes.
* May modify the field beforehand
* Occurs before validation.
*/
public String setNotes (AssessmentCriteriaAnswer obj, String newNotes) throws FieldException
{
return newNotes;
}
}
public ORMPipeLine pipes()
{
return new AssessmentCriteriaAnswerPipeLineFactory<AssessmentCriteriaAnswer, AssessmentCriteriaAnswer> ((AssessmentCriteriaAnswer)this);
}
/**
* Use this instead of pipes() to get rid of type casting.
*/
public AssessmentCriteriaAnswerPipeLineFactory<AssessmentCriteriaAnswer, AssessmentCriteriaAnswer> pipelineAssessmentCriteriaAnswer()
{
return (AssessmentCriteriaAnswerPipeLineFactory<AssessmentCriteriaAnswer, AssessmentCriteriaAnswer>) pipes();
}
public static AssessmentCriteriaAnswerPipeLineFactory<AssessmentCriteriaAnswer, AssessmentCriteriaAnswer> pipesAssessmentCriteriaAnswer(Collection<AssessmentCriteriaAnswer> items)
{
return REFERENCE_AssessmentCriteriaAnswer.new AssessmentCriteriaAnswerPipeLineFactory<AssessmentCriteriaAnswer, AssessmentCriteriaAnswer> (items);
}
public static AssessmentCriteriaAnswerPipeLineFactory<AssessmentCriteriaAnswer, AssessmentCriteriaAnswer> pipesAssessmentCriteriaAnswer(AssessmentCriteriaAnswer[] _items)
{
return pipesAssessmentCriteriaAnswer(Arrays.asList (_items));
}
public static AssessmentCriteriaAnswerPipeLineFactory<AssessmentCriteriaAnswer, AssessmentCriteriaAnswer> pipesAssessmentCriteriaAnswer()
{
return pipesAssessmentCriteriaAnswer((Collection)null);
}
public class AssessmentCriteriaAnswerPipeLineFactory<From extends BaseBusinessClass, Me extends AssessmentCriteriaAnswer> extends BaseBusinessClass.ORMPipeLine<From, Me>
{
public <Prev> AssessmentCriteriaAnswerPipeLineFactory (PipeLine<From, Prev> pipeLine, Pipe<Prev, Me> nextPipe)
{
super (pipeLine, nextPipe);
}
public AssessmentCriteriaAnswerPipeLineFactory (From seed)
{
super(seed);
}
public AssessmentCriteriaAnswerPipeLineFactory (Collection<From> seed)
{
super(seed);
}
public PipeLine<From, ? extends Object> to(String name)
{
if (name.equals ("Answer"))
{
return toAnswer ();
}
if (name.equals ("Notes"))
{
return toNotes ();
}
if (name.equals ("AssessmentCriteria"))
{
return toAssessmentCriteria ();
}
if (name.equals ("JobApplication"))
{
return toJobApplication ();
}
return super.to(name);
}
public PipeLine<From, Boolean> toAnswer () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_Answer)); }
public PipeLine<From, String> toNotes () { return pipe(new ORMAttributePipe<Me, String>(FIELD_Notes)); }
public AssessmentCriteria.AssessmentCriteriaPipeLineFactory<From, AssessmentCriteria> toAssessmentCriteria () { return toAssessmentCriteria (Filter.ALL); }
public AssessmentCriteria.AssessmentCriteriaPipeLineFactory<From, AssessmentCriteria> toAssessmentCriteria (Filter<AssessmentCriteria> filter)
{
return AssessmentCriteria.REFERENCE_AssessmentCriteria.new AssessmentCriteriaPipeLineFactory<From, AssessmentCriteria> (this, new ORMSingleAssocPipe<Me, AssessmentCriteria>(SINGLEREFERENCE_AssessmentCriteria, filter));
}
public JobApplication.JobApplicationPipeLineFactory<From, JobApplication> toJobApplication () { return toJobApplication (Filter.ALL); }
public JobApplication.JobApplicationPipeLineFactory<From, JobApplication> toJobApplication (Filter<JobApplication> filter)
{
return JobApplication.REFERENCE_JobApplication.new JobApplicationPipeLineFactory<From, JobApplication> (this, new ORMSingleAssocPipe<Me, JobApplication>(SINGLEREFERENCE_JobApplication, filter));
}
}
public boolean isTransientAttrib(String attribName)
{
return super.isTransientAttrib(attribName);
}
public boolean isTransientSingleReference(String assocName)
{
return super.isTransientSingleReference(assocName);
}
}
class DummyAssessmentCriteriaAnswer extends AssessmentCriteriaAnswer
{
// Default constructor primarily to support Externalisable
public DummyAssessmentCriteriaAnswer()
{
super();
}
public void assertValid ()
{
}
public AssessmentCriteria getAssessmentCriteria () throws StorageException
{
return (AssessmentCriteria)(AssessmentCriteria.DUMMY_AssessmentCriteria);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getAssessmentCriteriaID ()
{
return AssessmentCriteria.DUMMY_AssessmentCriteria.getObjectID();
}
public JobApplication getJobApplication () throws StorageException
{
return (JobApplication)(JobApplication.DUMMY_JobApplication);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getJobApplicationID ()
{
return JobApplication.DUMMY_JobApplication.getObjectID();
}
}
...@@ -45,6 +45,8 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -45,6 +45,8 @@ public abstract class BaseCandidate extends BaseBusinessClass
public static final String BACKREF_TestAnalysises = ""; public static final String BACKREF_TestAnalysises = "";
public static final String MULTIPLEREFERENCE_Answers = "Answers"; public static final String MULTIPLEREFERENCE_Answers = "Answers";
public static final String BACKREF_Answers = ""; public static final String BACKREF_Answers = "";
public static final String MULTIPLEREFERENCE_JobApplications = "JobApplications";
public static final String BACKREF_JobApplications = "";
// Static constants corresponding to searches // Static constants corresponding to searches
public static final String SEARCH_All = "All"; public static final String SEARCH_All = "All";
...@@ -65,6 +67,7 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -65,6 +67,7 @@ public abstract class BaseCandidate extends BaseBusinessClass
// Private attributes corresponding to multiple references // Private attributes corresponding to multiple references
private MultipleAssociation<Candidate, TestAnalysis> _TestAnalysises; private MultipleAssociation<Candidate, TestAnalysis> _TestAnalysises;
private MultipleAssociation<Candidate, Answer> _Answers; private MultipleAssociation<Candidate, Answer> _Answers;
private MultipleAssociation<Candidate, JobApplication> _JobApplications;
// Map of maps of metadata // Map of maps of metadata
...@@ -84,12 +87,14 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -84,12 +87,14 @@ public abstract class BaseCandidate extends BaseBusinessClass
String tmp_TestAnalysises = TestAnalysis.BACKREF_Candidate; String tmp_TestAnalysises = TestAnalysis.BACKREF_Candidate;
String tmp_Answers = Answer.BACKREF_Candidate; String tmp_Answers = Answer.BACKREF_Candidate;
String tmp_JobApplications = JobApplication.BACKREF_Candidate;
String tmp_TestInput = TestInput.BACKREF_Candidates; String tmp_TestInput = TestInput.BACKREF_Candidates;
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping")); Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
setupAssocMetaData_TestAnalysises(); setupAssocMetaData_TestAnalysises();
setupAssocMetaData_Answers(); setupAssocMetaData_Answers();
setupAssocMetaData_JobApplications();
setupAssocMetaData_TestInput(); setupAssocMetaData_TestInput();
FIELD_FirstName_Validators = (AttributeValidator[])setupAttribMetaData_FirstName(validatorMapping).toArray (new AttributeValidator[0]); FIELD_FirstName_Validators = (AttributeValidator[])setupAttribMetaData_FirstName(validatorMapping).toArray (new AttributeValidator[0]);
...@@ -135,6 +140,20 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -135,6 +140,20 @@ public abstract class BaseCandidate extends BaseBusinessClass
// Meta Info setup // Meta Info setup
private static void setupAssocMetaData_JobApplications()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "Candidate");
metaInfo.put ("name", "JobApplications");
metaInfo.put ("type", "JobApplication");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Candidate.JobApplications:", metaInfo);
ATTRIBUTES_METADATA_Candidate.put (MULTIPLEREFERENCE_JobApplications, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static void setupAssocMetaData_TestInput() private static void setupAssocMetaData_TestInput()
{ {
Map metaInfo = new HashMap (); Map metaInfo = new HashMap ();
...@@ -207,6 +226,7 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -207,6 +226,7 @@ public abstract class BaseCandidate extends BaseBusinessClass
_TestInput = new SingleAssociation<Candidate, TestInput> (this, SINGLEREFERENCE_TestInput, TestInput.MULTIPLEREFERENCE_Candidates, TestInput.REFERENCE_TestInput, "tl_candidate"); _TestInput = new SingleAssociation<Candidate, TestInput> (this, SINGLEREFERENCE_TestInput, TestInput.MULTIPLEREFERENCE_Candidates, TestInput.REFERENCE_TestInput, "tl_candidate");
_TestAnalysises = new MultipleAssociation<Candidate, TestAnalysis> (this, MULTIPLEREFERENCE_TestAnalysises, TestAnalysis.SINGLEREFERENCE_Candidate, TestAnalysis.REFERENCE_TestAnalysis); _TestAnalysises = new MultipleAssociation<Candidate, TestAnalysis> (this, MULTIPLEREFERENCE_TestAnalysises, TestAnalysis.SINGLEREFERENCE_Candidate, TestAnalysis.REFERENCE_TestAnalysis);
_Answers = new MultipleAssociation<Candidate, Answer> (this, MULTIPLEREFERENCE_Answers, Answer.SINGLEREFERENCE_Candidate, Answer.REFERENCE_Answer); _Answers = new MultipleAssociation<Candidate, Answer> (this, MULTIPLEREFERENCE_Answers, Answer.SINGLEREFERENCE_Candidate, Answer.REFERENCE_Answer);
_JobApplications = new MultipleAssociation<Candidate, JobApplication> (this, MULTIPLEREFERENCE_JobApplications, JobApplication.SINGLEREFERENCE_Candidate, JobApplication.REFERENCE_JobApplication);
} }
...@@ -219,6 +239,7 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -219,6 +239,7 @@ public abstract class BaseCandidate extends BaseBusinessClass
_TestInput = new SingleAssociation<Candidate, TestInput> (this, SINGLEREFERENCE_TestInput, TestInput.MULTIPLEREFERENCE_Candidates, TestInput.REFERENCE_TestInput, "tl_candidate"); _TestInput = new SingleAssociation<Candidate, TestInput> (this, SINGLEREFERENCE_TestInput, TestInput.MULTIPLEREFERENCE_Candidates, TestInput.REFERENCE_TestInput, "tl_candidate");
_TestAnalysises = new MultipleAssociation<Candidate, TestAnalysis> (this, MULTIPLEREFERENCE_TestAnalysises, TestAnalysis.SINGLEREFERENCE_Candidate, TestAnalysis.REFERENCE_TestAnalysis); _TestAnalysises = new MultipleAssociation<Candidate, TestAnalysis> (this, MULTIPLEREFERENCE_TestAnalysises, TestAnalysis.SINGLEREFERENCE_Candidate, TestAnalysis.REFERENCE_TestAnalysis);
_Answers = new MultipleAssociation<Candidate, Answer> (this, MULTIPLEREFERENCE_Answers, Answer.SINGLEREFERENCE_Candidate, Answer.REFERENCE_Answer); _Answers = new MultipleAssociation<Candidate, Answer> (this, MULTIPLEREFERENCE_Answers, Answer.SINGLEREFERENCE_Candidate, Answer.REFERENCE_Answer);
_JobApplications = new MultipleAssociation<Candidate, JobApplication> (this, MULTIPLEREFERENCE_JobApplications, JobApplication.SINGLEREFERENCE_Candidate, JobApplication.REFERENCE_JobApplication);
return this; return this;
...@@ -563,6 +584,8 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -563,6 +584,8 @@ public abstract class BaseCandidate extends BaseBusinessClass
result.add("Answers"); result.add("Answers");
result.add("JobApplications");
return result; return result;
} }
...@@ -584,6 +607,11 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -584,6 +607,11 @@ public abstract class BaseCandidate extends BaseBusinessClass
return Answer.REFERENCE_Answer ; return Answer.REFERENCE_Answer ;
} }
if (MULTIPLEREFERENCE_JobApplications.equals(attribName))
{
return JobApplication.REFERENCE_JobApplication ;
}
return super.getMultiAssocReferenceInstance(attribName); return super.getMultiAssocReferenceInstance(attribName);
} }
...@@ -602,6 +630,11 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -602,6 +630,11 @@ public abstract class BaseCandidate extends BaseBusinessClass
return Answer.SINGLEREFERENCE_Candidate ; return Answer.SINGLEREFERENCE_Candidate ;
} }
if (MULTIPLEREFERENCE_JobApplications.equals(attribName))
{
return JobApplication.SINGLEREFERENCE_Candidate ;
}
return super.getMultiAssocBackReference(attribName); return super.getMultiAssocBackReference(attribName);
} }
...@@ -623,6 +656,11 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -623,6 +656,11 @@ public abstract class BaseCandidate extends BaseBusinessClass
return this.getAnswersCount(); return this.getAnswersCount();
} }
if (MULTIPLEREFERENCE_JobApplications.equals(attribName))
{
return this.getJobApplicationsCount();
}
return super.getMultiAssocCount(attribName); return super.getMultiAssocCount(attribName);
} }
...@@ -644,6 +682,11 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -644,6 +682,11 @@ public abstract class BaseCandidate extends BaseBusinessClass
return this.getAnswersAt(index); return this.getAnswersAt(index);
} }
if (MULTIPLEREFERENCE_JobApplications.equals(attribName))
{
return this.getJobApplicationsAt(index);
}
return super.getMultiAssocAt(attribName, index); return super.getMultiAssocAt(attribName, index);
} }
...@@ -669,6 +712,13 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -669,6 +712,13 @@ public abstract class BaseCandidate extends BaseBusinessClass
return; return;
} }
if (MULTIPLEREFERENCE_JobApplications.equals(attribName))
{
addToJobApplications((JobApplication)newElement);
return;
}
super.addToMultiAssoc(attribName, newElement); super.addToMultiAssoc(attribName, newElement);
} }
...@@ -693,6 +743,13 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -693,6 +743,13 @@ public abstract class BaseCandidate extends BaseBusinessClass
return; return;
} }
if (MULTIPLEREFERENCE_JobApplications.equals(attribName))
{
removeFromJobApplications((JobApplication)oldElement);
return;
}
super.removeFromMultiAssoc(attribName, oldElement); super.removeFromMultiAssoc(attribName, oldElement);
} }
...@@ -713,6 +770,12 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -713,6 +770,12 @@ public abstract class BaseCandidate extends BaseBusinessClass
return; return;
} }
if (MULTIPLEREFERENCE_JobApplications.equals(attribName))
{
_JobApplications.__loadAssociation (elements);
return;
}
super.__loadMultiAssoc(attribName, elements); super.__loadMultiAssoc(attribName, elements);
} }
...@@ -731,6 +794,11 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -731,6 +794,11 @@ public abstract class BaseCandidate extends BaseBusinessClass
return _Answers.isLoaded (); return _Answers.isLoaded ();
} }
if (MULTIPLEREFERENCE_JobApplications.equals(attribName))
{
return _JobApplications.isLoaded ();
}
return super.__isMultiAssocLoaded(attribName); return super.__isMultiAssocLoaded(attribName);
} }
...@@ -875,6 +943,75 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -875,6 +943,75 @@ public abstract class BaseCandidate extends BaseBusinessClass
return _Answers.getSet (); return _Answers.getSet ();
} }
public FieldWriteability getWriteability_JobApplications ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
public int getJobApplicationsCount () throws StorageException
{
assertValid();
return _JobApplications.getReferencedObjectsCount ();
}
public void addToJobApplications (JobApplication newElement) throws StorageException
{
if (_JobApplications.wouldAddChange (newElement))
{
assertValid();
Debug.assertion (getWriteability_JobApplications () != FieldWriteability.FALSE, "MultiAssoc JobApplications is not writeable (add)");
_JobApplications.appendElement (newElement);
try
{
if (newElement.getCandidate () != this)
{
newElement.setCandidate ((Candidate)(this));
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
}
}
public void removeFromJobApplications (JobApplication elementToRemove) throws StorageException
{
if (_JobApplications.wouldRemoveChange (elementToRemove))
{
assertValid();
Debug.assertion (getWriteability_JobApplications () != FieldWriteability.FALSE, "MultiAssoc JobApplications is not writeable (remove)");
_JobApplications.removeElement (elementToRemove);
try
{
if (elementToRemove.getCandidate () != null)
{
elementToRemove.setCandidate (null);
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
}
}
public JobApplication getJobApplicationsAt (int index) throws StorageException
{
return (JobApplication)(_JobApplications.getElementAt (index));
}
public SortedSet<JobApplication> getJobApplicationsSet () throws StorageException
{
return _JobApplications.getSet ();
}
public void onDelete () public void onDelete ()
...@@ -907,6 +1044,12 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -907,6 +1044,12 @@ public abstract class BaseCandidate extends BaseBusinessClass
referenced.setCandidate(null); referenced.setCandidate(null);
} }
for(JobApplication referenced : CollectionUtils.reverse(getJobApplicationsSet()))
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null Candidate from ", getObjectID (), " to ", referenced.getObjectID ());
referenced.setCandidate(null);
}
} }
catch (Exception e) catch (Exception e)
{ {
...@@ -1060,6 +1203,7 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -1060,6 +1203,7 @@ public abstract class BaseCandidate extends BaseBusinessClass
_TestAnalysises.copyFrom (sourceCandidate._TestAnalysises, linkToGhosts); _TestAnalysises.copyFrom (sourceCandidate._TestAnalysises, linkToGhosts);
_Answers.copyFrom (sourceCandidate._Answers, linkToGhosts); _Answers.copyFrom (sourceCandidate._Answers, linkToGhosts);
_JobApplications.copyFrom (sourceCandidate._JobApplications, linkToGhosts);
} }
} }
...@@ -1084,6 +1228,7 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -1084,6 +1228,7 @@ public abstract class BaseCandidate extends BaseBusinessClass
_TestInput.readExternalData(vals.get(SINGLEREFERENCE_TestInput)); _TestInput.readExternalData(vals.get(SINGLEREFERENCE_TestInput));
_TestAnalysises.readExternalData(vals.get(MULTIPLEREFERENCE_TestAnalysises)); _TestAnalysises.readExternalData(vals.get(MULTIPLEREFERENCE_TestAnalysises));
_Answers.readExternalData(vals.get(MULTIPLEREFERENCE_Answers)); _Answers.readExternalData(vals.get(MULTIPLEREFERENCE_Answers));
_JobApplications.readExternalData(vals.get(MULTIPLEREFERENCE_JobApplications));
} }
...@@ -1099,6 +1244,7 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -1099,6 +1244,7 @@ public abstract class BaseCandidate extends BaseBusinessClass
vals.put (SINGLEREFERENCE_TestInput, _TestInput.writeExternalData()); vals.put (SINGLEREFERENCE_TestInput, _TestInput.writeExternalData());
vals.put (MULTIPLEREFERENCE_TestAnalysises, _TestAnalysises.writeExternalData()); vals.put (MULTIPLEREFERENCE_TestAnalysises, _TestAnalysises.writeExternalData());
vals.put (MULTIPLEREFERENCE_Answers, _Answers.writeExternalData()); vals.put (MULTIPLEREFERENCE_Answers, _Answers.writeExternalData());
vals.put (MULTIPLEREFERENCE_JobApplications, _JobApplications.writeExternalData());
} }
...@@ -1124,6 +1270,7 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -1124,6 +1270,7 @@ public abstract class BaseCandidate extends BaseBusinessClass
// Compare multiple assocs // Compare multiple assocs
_TestAnalysises.compare (otherCandidate._TestAnalysises, listener); _TestAnalysises.compare (otherCandidate._TestAnalysises, listener);
_Answers.compare (otherCandidate._Answers, listener); _Answers.compare (otherCandidate._Answers, listener);
_JobApplications.compare (otherCandidate._JobApplications, listener);
} }
} }
...@@ -1145,6 +1292,7 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -1145,6 +1292,7 @@ public abstract class BaseCandidate extends BaseBusinessClass
visitor.visitAssociation (_TestInput); visitor.visitAssociation (_TestInput);
visitor.visitAssociation (_TestAnalysises); visitor.visitAssociation (_TestAnalysises);
visitor.visitAssociation (_Answers); visitor.visitAssociation (_Answers);
visitor.visitAssociation (_JobApplications);
} }
...@@ -1165,6 +1313,10 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -1165,6 +1313,10 @@ public abstract class BaseCandidate extends BaseBusinessClass
{ {
visitor.visit (_Answers); visitor.visit (_Answers);
} }
if (scope.includes (_JobApplications))
{
visitor.visit (_JobApplications);
}
} }
...@@ -1346,6 +1498,10 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -1346,6 +1498,10 @@ public abstract class BaseCandidate extends BaseBusinessClass
{ {
return getWriteability_Answers (); return getWriteability_Answers ();
} }
else if (fieldName.equals (MULTIPLEREFERENCE_JobApplications))
{
return getWriteability_JobApplications ();
}
else if (fieldName.equals (SINGLEREFERENCE_TestInput)) else if (fieldName.equals (SINGLEREFERENCE_TestInput))
{ {
return getWriteability_TestInput (); return getWriteability_TestInput ();
...@@ -1503,6 +1659,10 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -1503,6 +1659,10 @@ public abstract class BaseCandidate extends BaseBusinessClass
{ {
return toAnswers (); return toAnswers ();
} }
if (name.equals ("JobApplications"))
{
return toJobApplications ();
}
if (name.equals ("FirstName")) if (name.equals ("FirstName"))
{ {
return toFirstName (); return toFirstName ();
...@@ -1536,6 +1696,12 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -1536,6 +1696,12 @@ public abstract class BaseCandidate extends BaseBusinessClass
{ {
return Answer.REFERENCE_Answer.new AnswerPipeLineFactory<From, Answer> (this, new ORMMultiAssocPipe<Me, Answer>(MULTIPLEREFERENCE_Answers, filter)); return Answer.REFERENCE_Answer.new AnswerPipeLineFactory<From, Answer> (this, new ORMMultiAssocPipe<Me, Answer>(MULTIPLEREFERENCE_Answers, filter));
} }
public JobApplication.JobApplicationPipeLineFactory<From, JobApplication> toJobApplications () { return toJobApplications(Filter.ALL); }
public JobApplication.JobApplicationPipeLineFactory<From, JobApplication> toJobApplications (Filter<JobApplication> filter)
{
return JobApplication.REFERENCE_JobApplication.new JobApplicationPipeLineFactory<From, JobApplication> (this, new ORMMultiAssocPipe<Me, JobApplication>(MULTIPLEREFERENCE_JobApplications, filter));
}
} }
...@@ -1615,6 +1781,23 @@ class DummyCandidate extends Candidate ...@@ -1615,6 +1781,23 @@ class DummyCandidate extends Candidate
return new TreeSet(); return new TreeSet();
} }
public int getJobApplicationsCount () throws StorageException
{
return 0;
}
public JobApplication getJobApplicationsAt (int index) throws StorageException
{
throw new RuntimeException ("No elements in a dummy object in association JobApplications");
}
public SortedSet getJobApplicationsSet () throws StorageException
{
return new TreeSet();
}
} }
/*
* IMPORTANT!!!! XSL Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2 rev3 [oneit.objstore.BusinessObjectTemplate.xsl]
*
* Version: 1.0
* Vendor: Apache Software Foundation (Xalan XSLTC)
* Vendor URL: http://xml.apache.org/xalan-j
*/
package performa.orm;
import java.io.*;
import java.util.*;
import oneit.appservices.config.*;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.objstore.assocs.*;
import oneit.objstore.attributes.*;
import oneit.objstore.rdbms.filters.*;
import oneit.objstore.parser.*;
import oneit.objstore.validator.*;
import oneit.objstore.utils.*;
import oneit.utils.*;
import oneit.utils.filter.Filter;
import oneit.utils.transform.*;
import oneit.utils.parsers.FieldException;
import performa.orm.types.*;
public abstract class BaseCultureCriteria extends BaseBusinessClass
{
// Reference instance for the object
public static final CultureCriteria REFERENCE_CultureCriteria = new CultureCriteria ();
// Reference instance for the object
public static final CultureCriteria DUMMY_CultureCriteria = new DummyCultureCriteria ();
// Static constants corresponding to field names
public static final String FIELD_Importance = "Importance";
public static final String SINGLEREFERENCE_CultureElement = "CultureElement";
public static final String SINGLEREFERENCE_CultureElementRating = "CultureElementRating";
public static final String SINGLEREFERENCE_Job = "Job";
public static final String BACKREF_Job = "";
// Static constants corresponding to searches
public static final String SEARCH_All = "All";
// Static constants corresponding to attribute helpers
private static final EnumeratedAttributeHelper<CultureCriteria, Importance> HELPER_Importance = new EnumeratedAttributeHelper<CultureCriteria, Importance> (Importance.FACTORY_Importance);
// Private attributes corresponding to business object data
private Importance _Importance;
// Private attributes corresponding to single references
private SingleAssociation<CultureCriteria, CultureElement> _CultureElement;
private SingleAssociation<CultureCriteria, CultureElementRating> _CultureElementRating;
private SingleAssociation<CultureCriteria, Job> _Job;
// Private attributes corresponding to multiple references
// Map of maps of metadata
private static final Map ATTRIBUTES_METADATA_CultureCriteria = new HashMap ();
// Arrays of validators for each attribute
private static final AttributeValidator[] FIELD_Importance_Validators;
// Arrays of behaviour decorators
private static final CultureCriteriaBehaviourDecorator[] CultureCriteria_BehaviourDecorators;
static
{
try
{
String tmp_Job = Job.BACKREF_CultureCriterias;
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
setupAssocMetaData_CultureElement();
setupAssocMetaData_CultureElementRating();
setupAssocMetaData_Job();
FIELD_Importance_Validators = (AttributeValidator[])setupAttribMetaData_Importance(validatorMapping).toArray (new AttributeValidator[0]);
REFERENCE_CultureCriteria.initialiseReference ();
DUMMY_CultureCriteria.initialiseReference ();
CultureCriteria_BehaviourDecorators = BaseBusinessClass.getBBCBehaviours(CultureCriteria.class).toArray(new CultureCriteriaBehaviourDecorator[0]);
}
catch (RuntimeException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR1, e, "Error initialising");
throw e;
}
}
// Meta Info setup
private static void setupAssocMetaData_CultureElement()
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "culture_element_id");
metaInfo.put ("name", "CultureElement");
metaInfo.put ("type", "CultureElement");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for CultureCriteria.CultureElement:", metaInfo);
ATTRIBUTES_METADATA_CultureCriteria.put (SINGLEREFERENCE_CultureElement, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static void setupAssocMetaData_CultureElementRating()
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "culture_element_rating_id");
metaInfo.put ("name", "CultureElementRating");
metaInfo.put ("type", "CultureElementRating");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for CultureCriteria.CultureElementRating:", metaInfo);
ATTRIBUTES_METADATA_CultureCriteria.put (SINGLEREFERENCE_CultureElementRating, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static void setupAssocMetaData_Job()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "CultureCriterias");
metaInfo.put ("dbcol", "job_id");
metaInfo.put ("name", "Job");
metaInfo.put ("type", "Job");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for CultureCriteria.Job:", metaInfo);
ATTRIBUTES_METADATA_CultureCriteria.put (SINGLEREFERENCE_Job, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static List setupAttribMetaData_Importance(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("attribHelper", "EnumeratedAttributeHelper");
metaInfo.put ("dbcol", "importance");
metaInfo.put ("name", "Importance");
metaInfo.put ("type", "Importance");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for CultureCriteria.Importance:", metaInfo);
ATTRIBUTES_METADATA_CultureCriteria.put (FIELD_Importance, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(CultureCriteria.class, "Importance", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for CultureCriteria.Importance:", validators);
return validators;
}
// END OF STATIC METADATA DEFINITION
// This constructor should not be called
protected BaseCultureCriteria ()
{
}
protected BBCBehaviourDecorator[] getBehaviours()
{
return CultureCriteria_BehaviourDecorators;
}
// Initialise the attributes
protected void _initialiseNewObjAttributes (ObjectTransaction transaction) throws StorageException
{
super._initialiseNewObjAttributes (transaction);
_Importance = (Importance)(HELPER_Importance.initialise (_Importance));
}
// Initialise the associations
protected void _initialiseAssociations ()
{
super._initialiseAssociations ();
_CultureElement = new SingleAssociation<CultureCriteria, CultureElement> (this, SINGLEREFERENCE_CultureElement, null, CultureElement.REFERENCE_CultureElement, "tl_culture_criteria");
_CultureElementRating = new SingleAssociation<CultureCriteria, CultureElementRating> (this, SINGLEREFERENCE_CultureElementRating, null, CultureElementRating.REFERENCE_CultureElementRating, "tl_culture_criteria");
_Job = new SingleAssociation<CultureCriteria, Job> (this, SINGLEREFERENCE_Job, Job.MULTIPLEREFERENCE_CultureCriterias, Job.REFERENCE_Job, "tl_culture_criteria");
}
// Initialise the associations
protected BaseBusinessClass initialiseReference ()
{
super.initialiseReference ();
_CultureElement = new SingleAssociation<CultureCriteria, CultureElement> (this, SINGLEREFERENCE_CultureElement, null, CultureElement.REFERENCE_CultureElement, "tl_culture_criteria");
_CultureElementRating = new SingleAssociation<CultureCriteria, CultureElementRating> (this, SINGLEREFERENCE_CultureElementRating, null, CultureElementRating.REFERENCE_CultureElementRating, "tl_culture_criteria");
_Job = new SingleAssociation<CultureCriteria, Job> (this, SINGLEREFERENCE_Job, Job.MULTIPLEREFERENCE_CultureCriterias, Job.REFERENCE_Job, "tl_culture_criteria");
return this;
}
/**
* Get the attribute Importance
*/
public Importance getImportance ()
{
assertValid();
Importance valToReturn = _Importance;
for (CultureCriteriaBehaviourDecorator bhd : CultureCriteria_BehaviourDecorators)
{
valToReturn = bhd.getImportance ((CultureCriteria)this, valToReturn);
}
return valToReturn;
}
/**
* Called prior to the attribute changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preImportanceChange (Importance newImportance) throws FieldException
{
}
/**
* Called after the attribute changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postImportanceChange () throws FieldException
{
}
public FieldWriteability getWriteability_Importance ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute Importance. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setImportance (Importance newImportance) throws FieldException
{
boolean oldAndNewIdentical = HELPER_Importance.compare (_Importance, newImportance);
try
{
for (CultureCriteriaBehaviourDecorator bhd : CultureCriteria_BehaviourDecorators)
{
newImportance = bhd.setImportance ((CultureCriteria)this, newImportance);
oldAndNewIdentical = HELPER_Importance.compare (_Importance, newImportance);
}
if (FIELD_Importance_Validators.length > 0)
{
Object newImportanceObj = HELPER_Importance.toObject (newImportance);
if (newImportanceObj != null)
{
int loopMax = FIELD_Importance_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_CultureCriteria.get (FIELD_Importance);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_Importance_Validators[v].checkAttribute (this, FIELD_Importance, metadata, newImportanceObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_Importance () != FieldWriteability.FALSE, "Field Importance is not writeable");
preImportanceChange (newImportance);
markFieldChange (FIELD_Importance);
_Importance = newImportance;
postFieldChange (FIELD_Importance);
postImportanceChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getSingleAssocs()
{
List result = super.getSingleAssocs ();
result.add("CultureElement");
result.add("CultureElementRating");
result.add("Job");
return result;
}
public BaseBusinessClass getSingleAssocReferenceInstance (String assocName)
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_CultureElement))
{
return _CultureElement.getReferencedType ();
}else if (assocName.equals (SINGLEREFERENCE_CultureElementRating))
{
return _CultureElementRating.getReferencedType ();
}else if (assocName.equals (SINGLEREFERENCE_Job))
{
return _Job.getReferencedType ();
}
else
{
return super.getSingleAssocReferenceInstance (assocName);
}
}
public String getSingleAssocBackReference(String assocName)
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_CultureElement))
{
return null ;
}else if (assocName.equals (SINGLEREFERENCE_CultureElementRating))
{
return null ;
}else if (assocName.equals (SINGLEREFERENCE_Job))
{
return Job.MULTIPLEREFERENCE_CultureCriterias ;
}
else
{
return super.getSingleAssocBackReference (assocName);
}
}
public BaseBusinessClass getSingleAssoc (String assocName) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_CultureElement))
{
return getCultureElement ();
}else if (assocName.equals (SINGLEREFERENCE_CultureElementRating))
{
return getCultureElementRating ();
}else if (assocName.equals (SINGLEREFERENCE_Job))
{
return getJob ();
}
else
{
return super.getSingleAssoc (assocName);
}
}
public BaseBusinessClass getSingleAssoc (String assocName, Get getType) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_CultureElement))
{
return getCultureElement (getType);
}else if (assocName.equals (SINGLEREFERENCE_CultureElementRating))
{
return getCultureElementRating (getType);
}else if (assocName.equals (SINGLEREFERENCE_Job))
{
return getJob (getType);
}
else
{
return super.getSingleAssoc (assocName, getType);
}
}
public Long getSingleAssocID (String assocName) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_CultureElement))
{
return getCultureElementID ();
}else if (assocName.equals (SINGLEREFERENCE_CultureElementRating))
{
return getCultureElementRatingID ();
}else if (assocName.equals (SINGLEREFERENCE_Job))
{
return getJobID ();
}
else
{
return super.getSingleAssocID (assocName);
}
}
public void setSingleAssoc (String assocName, BaseBusinessClass newValue) throws StorageException, FieldException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_CultureElement))
{
setCultureElement ((CultureElement)(newValue));
}else if (assocName.equals (SINGLEREFERENCE_CultureElementRating))
{
setCultureElementRating ((CultureElementRating)(newValue));
}else if (assocName.equals (SINGLEREFERENCE_Job))
{
setJob ((Job)(newValue));
}
else
{
super.setSingleAssoc (assocName, newValue);
}
}
/**
* Get the reference CultureElement
*/
public CultureElement getCultureElement () throws StorageException
{
assertValid();
try
{
return (CultureElement)(_CultureElement.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in CultureCriteria:", this.getObjectID (), ", was trying to get CultureElement:", getCultureElementID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _CultureElement.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public CultureElement getCultureElement (Get getType) throws StorageException
{
assertValid();
return _CultureElement.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getCultureElementID ()
{
assertValid();
if (_CultureElement == null)
{
return null;
}
else
{
return _CultureElement.getID ();
}
}
/**
* Called prior to the assoc changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preCultureElementChange (CultureElement newCultureElement) throws FieldException
{
}
/**
* Called after the assoc changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postCultureElementChange () throws FieldException
{
}
public FieldWriteability getWriteability_CultureElement ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference CultureElement. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setCultureElement (CultureElement newCultureElement) throws StorageException, FieldException
{
if (_CultureElement.wouldReferencedChange (newCultureElement))
{
assertValid();
Debug.assertion (getWriteability_CultureElement () != FieldWriteability.FALSE, "Assoc CultureElement is not writeable");
preCultureElementChange (newCultureElement);
_CultureElement.set (newCultureElement);
postCultureElementChange ();
}
}
/**
* Get the reference CultureElementRating
*/
public CultureElementRating getCultureElementRating () throws StorageException
{
assertValid();
try
{
return (CultureElementRating)(_CultureElementRating.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in CultureCriteria:", this.getObjectID (), ", was trying to get CultureElementRating:", getCultureElementRatingID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _CultureElementRating.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public CultureElementRating getCultureElementRating (Get getType) throws StorageException
{
assertValid();
return _CultureElementRating.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getCultureElementRatingID ()
{
assertValid();
if (_CultureElementRating == null)
{
return null;
}
else
{
return _CultureElementRating.getID ();
}
}
/**
* Called prior to the assoc changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preCultureElementRatingChange (CultureElementRating newCultureElementRating) throws FieldException
{
}
/**
* Called after the assoc changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postCultureElementRatingChange () throws FieldException
{
}
public FieldWriteability getWriteability_CultureElementRating ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference CultureElementRating. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setCultureElementRating (CultureElementRating newCultureElementRating) throws StorageException, FieldException
{
if (_CultureElementRating.wouldReferencedChange (newCultureElementRating))
{
assertValid();
Debug.assertion (getWriteability_CultureElementRating () != FieldWriteability.FALSE, "Assoc CultureElementRating is not writeable");
preCultureElementRatingChange (newCultureElementRating);
_CultureElementRating.set (newCultureElementRating);
postCultureElementRatingChange ();
}
}
/**
* Get the reference Job
*/
public Job getJob () throws StorageException
{
assertValid();
try
{
return (Job)(_Job.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in CultureCriteria:", this.getObjectID (), ", was trying to get Job:", getJobID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _Job.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Job getJob (Get getType) throws StorageException
{
assertValid();
return _Job.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getJobID ()
{
assertValid();
if (_Job == null)
{
return null;
}
else
{
return _Job.getID ();
}
}
/**
* Called prior to the assoc changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preJobChange (Job newJob) throws FieldException
{
}
/**
* Called after the assoc changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postJobChange () throws FieldException
{
}
public FieldWriteability getWriteability_Job ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference Job. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setJob (Job newJob) throws StorageException, FieldException
{
if (_Job.wouldReferencedChange (newJob))
{
assertValid();
Debug.assertion (getWriteability_Job () != FieldWriteability.FALSE, "Assoc Job is not writeable");
preJobChange (newJob);
Job oldJob = getJob ();
if (oldJob != null)
{
// This is to stop validation from triggering when we are removed
_Job.set (null);
oldJob.removeFromCultureCriterias ((CultureCriteria)(this));
}
_Job.set (newJob);
if (newJob != null)
{
newJob.addToCultureCriterias ((CultureCriteria)(this));
}
postJobChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getMultiAssocs()
{
List result = super.getMultiAssocs ();
return result;
}
/**
* Get the reference instance for the multi assoc name.
*/
public BaseBusinessClass getMultiAssocReferenceInstance(String attribName)
{
return super.getMultiAssocReferenceInstance(attribName);
}
public String getMultiAssocBackReference(String attribName)
{
return super.getMultiAssocBackReference(attribName);
}
/**
* Get the assoc count for the multi assoc name.
*/
public int getMultiAssocCount(String attribName) throws StorageException
{
return super.getMultiAssocCount(attribName);
}
/**
* Get the assoc at a particular index
*/
public BaseBusinessClass getMultiAssocAt(String attribName, int index) throws StorageException
{
return super.getMultiAssocAt(attribName, index);
}
/**
* Add to a multi assoc by attribute name
*/
public void addToMultiAssoc(String attribName, BaseBusinessClass newElement) throws StorageException
{
super.addToMultiAssoc(attribName, newElement);
}
/**
* Remove from a multi assoc by attribute name
*/
public void removeFromMultiAssoc(String attribName, BaseBusinessClass oldElement) throws StorageException
{
super.removeFromMultiAssoc(attribName, oldElement);
}
protected void __loadMultiAssoc (String attribName, BaseBusinessClass[] elements)
{
super.__loadMultiAssoc(attribName, elements);
}
protected boolean __isMultiAssocLoaded (String attribName)
{
return super.__isMultiAssocLoaded(attribName);
}
public void onDelete ()
{
try
{
// Ensure we are removed from any loaded multi-associations that aren't mandatory
if (_Job.isLoaded () || getTransaction ().isObjectLoaded (_Job.getReferencedType (), getJobID ()))
{
Job referenced = getJob ();
if (referenced != null)
{
// Stop the callback
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null CultureCriterias from ", getObjectID (), " to ", referenced.getObjectID ());
_Job.set (null);
referenced.removeFromCultureCriterias ((CultureCriteria)this);
}
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
super.onDelete ();
}
public CultureCriteria newInstance ()
{
return new CultureCriteria ();
}
public CultureCriteria referenceInstance ()
{
return REFERENCE_CultureCriteria;
}
public CultureCriteria getInTransaction (ObjectTransaction t) throws StorageException
{
return getCultureCriteriaByID (t, getObjectID());
}
public BaseBusinessClass dummyInstance ()
{
return DUMMY_CultureCriteria;
}
public String getBaseSetName ()
{
return "tl_culture_criteria";
}
/**
* This is where an object returns the Persistent sets that will
* store it into the database.
* The should be entered into allSets
*/
public void getPersistentSets (PersistentSetCollection allSets)
{
ObjectStatus myStatus = getStatus ();
PersistentSetStatus myPSetStatus = myStatus.getPSetStatus();
ObjectID myID = getID();
super.getPersistentSets (allSets);
PersistentSet tl_culture_criteriaPSet = allSets.getPersistentSet (myID, "tl_culture_criteria", myPSetStatus);
tl_culture_criteriaPSet.setAttrib (FIELD_ObjectID, myID);
tl_culture_criteriaPSet.setAttrib (FIELD_Importance, HELPER_Importance.toObject (_Importance)); //
_CultureElement.getPersistentSets (allSets);
_CultureElementRating.getPersistentSets (allSets);
_Job.getPersistentSets (allSets);
}
/**
* Sets the objects state based on Persistent sets.
*/
public void setFromPersistentSets (ObjectID objectID, PersistentSetCollection allSets)
{
super.setFromPersistentSets (objectID, allSets);
PersistentSet tl_culture_criteriaPSet = allSets.getPersistentSet (objectID, "tl_culture_criteria");
_Importance = (Importance)(HELPER_Importance.fromObject (_Importance, tl_culture_criteriaPSet.getAttrib (FIELD_Importance))); //
_CultureElement.setFromPersistentSets (objectID, allSets);
_CultureElementRating.setFromPersistentSets (objectID, allSets);
_Job.setFromPersistentSets (objectID, allSets);
}
public void setAttributesFrom (BaseBusinessClass other, MultiException e)
{
super.setAttributesFrom (other, e);
if (other instanceof CultureCriteria)
{
CultureCriteria otherCultureCriteria = (CultureCriteria)other;
try
{
setImportance (otherCultureCriteria.getImportance ());
}
catch (FieldException ex)
{
e.addException (ex);
}
}
}
/**
* Set the attributes in this to copies of the attributes in source.
*/
public void copyAttributesFrom (BaseBusinessClass source)
{
super.copyAttributesFrom (source);
if (source instanceof BaseCultureCriteria)
{
BaseCultureCriteria sourceCultureCriteria = (BaseCultureCriteria)(source);
_Importance = sourceCultureCriteria._Importance;
}
}
/**
* Set the associations in this to copies of the attributes in source.
*/
public void copySingleAssociationsFrom (BaseBusinessClass source, boolean linkToGhosts)
{
super.copySingleAssociationsFrom (source, linkToGhosts);
if (source instanceof BaseCultureCriteria)
{
BaseCultureCriteria sourceCultureCriteria = (BaseCultureCriteria)(source);
_CultureElement.copyFrom (sourceCultureCriteria._CultureElement, linkToGhosts);
_CultureElementRating.copyFrom (sourceCultureCriteria._CultureElementRating, linkToGhosts);
_Job.copyFrom (sourceCultureCriteria._Job, linkToGhosts);
}
}
/**
* Set the associations in this to copies of the attributes in source.
*/
public void copyAssociationsFrom (BaseBusinessClass source, boolean linkToGhosts)
{
super.copyAssociationsFrom (source, linkToGhosts);
if (source instanceof BaseCultureCriteria)
{
BaseCultureCriteria sourceCultureCriteria = (BaseCultureCriteria)(source);
}
}
public void validate (ValidationContext context)
{
super.validate (context);
}
/**
* Subclasses must override this to read in their attributes
*/
protected void readExternalData(Map<String, Object> vals) throws IOException, ClassNotFoundException
{
super.readExternalData(vals);
_Importance = (Importance)(HELPER_Importance.readExternal (_Importance, vals.get(FIELD_Importance))); //
_CultureElement.readExternalData(vals.get(SINGLEREFERENCE_CultureElement));
_CultureElementRating.readExternalData(vals.get(SINGLEREFERENCE_CultureElementRating));
_Job.readExternalData(vals.get(SINGLEREFERENCE_Job));
}
/**
* Subclasses must override this to write out their attributes
*/
protected void writeExternalData(Map<String, Object> vals) throws IOException
{
super.writeExternalData(vals);
vals.put (FIELD_Importance, HELPER_Importance.writeExternal (_Importance));
vals.put (SINGLEREFERENCE_CultureElement, _CultureElement.writeExternalData());
vals.put (SINGLEREFERENCE_CultureElementRating, _CultureElementRating.writeExternalData());
vals.put (SINGLEREFERENCE_Job, _Job.writeExternalData());
}
public void compare (BaseBusinessClass other, AttributeChangeListener listener) throws StorageException
{
super.compare (other, listener);
if (other instanceof BaseCultureCriteria)
{
BaseCultureCriteria otherCultureCriteria = (BaseCultureCriteria)(other);
if (!HELPER_Importance.compare(this._Importance, otherCultureCriteria._Importance))
{
listener.notifyFieldChange(this, other, FIELD_Importance, HELPER_Importance.toObject(this._Importance), HELPER_Importance.toObject(otherCultureCriteria._Importance));
}
// Compare single assocs
_CultureElement.compare (otherCultureCriteria._CultureElement, listener);
_CultureElementRating.compare (otherCultureCriteria._CultureElementRating, listener);
_Job.compare (otherCultureCriteria._Job, listener);
// Compare multiple assocs
}
}
public void visitTransients (AttributeVisitor visitor) throws StorageException
{
super.visitAttributes (visitor);
}
public void visitAttributes (AttributeVisitor visitor) throws StorageException
{
super.visitAttributes (visitor);
visitor.visitField(this, FIELD_Importance, HELPER_Importance.toObject(getImportance()));
visitor.visitAssociation (_CultureElement);
visitor.visitAssociation (_CultureElementRating);
visitor.visitAssociation (_Job);
}
public void visitAssociations (AssociationVisitor visitor, AssociatedScope scope) throws StorageException
{
super.visitAssociations (visitor, scope);
if (scope.includes (_CultureElement))
{
visitor.visit (_CultureElement);
}
if (scope.includes (_CultureElementRating))
{
visitor.visit (_CultureElementRating);
}
if (scope.includes (_Job))
{
visitor.visit (_Job);
}
}
public static CultureCriteria createCultureCriteria (ObjectTransaction transaction) throws StorageException
{
CultureCriteria result = new CultureCriteria ();
result.initialiseNewObject (transaction);
return result;
}
public static CultureCriteria getCultureCriteriaByID (ObjectTransaction transaction, Long objectID) throws StorageException
{
return (CultureCriteria)(transaction.getObjectByID (REFERENCE_CultureCriteria, objectID));
}
public boolean testFilter (String attribName, QueryFilter filter) throws StorageException
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_Importance))
{
return filter.matches (getImportance ());
}
else if (attribName.equals (SINGLEREFERENCE_CultureElement))
{
return filter.matches (getCultureElement ());
}
else if (attribName.equals (SINGLEREFERENCE_CultureElementRating))
{
return filter.matches (getCultureElementRating ());
}
else if (attribName.equals (SINGLEREFERENCE_Job))
{
return filter.matches (getJob ());
}
else
{
return super.testFilter (attribName, filter);
}
}
public static SearchAll SearchByAll () { return new SearchAll (); }
public static class SearchAll extends SearchObject<CultureCriteria>
{
public SearchAll andObjectID (QueryFilter<Long> filter)
{
filter.addFilter (context, "tl_culture_criteria.object_id", FIELD_ObjectID);
return this;
}
public SearchAll andObjectCreated (QueryFilter<Date> filter)
{
filter.addFilter (context, "tl_culture_criteria.object_created_date", FIELD_ObjectCreated);
return this;
}
public SearchAll andObjectLastModified (QueryFilter<Date> filter)
{
filter.addFilter (context, "tl_culture_criteria.object_last_updated_date", FIELD_ObjectLastModified);
return this;
}
public SearchAll andImportance (QueryFilter<Importance> filter)
{
filter.addFilter (context, "tl_culture_criteria.importance", "Importance");
return this;
}
public SearchAll andCultureElement (QueryFilter<CultureElement> filter)
{
filter.addFilter (context, "tl_culture_criteria.culture_element_id", "CultureElement");
return this;
}
public SearchAll andCultureElementRating (QueryFilter<CultureElementRating> filter)
{
filter.addFilter (context, "tl_culture_criteria.culture_element_rating_id", "CultureElementRating");
return this;
}
public SearchAll andJob (QueryFilter<Job> filter)
{
filter.addFilter (context, "tl_culture_criteria.job_id", "Job");
return this;
}
public CultureCriteria[]
search (ObjectTransaction transaction) throws StorageException
{
BaseBusinessClass[] results = super.search (transaction, REFERENCE_CultureCriteria, SEARCH_All, criteria);
Set<CultureCriteria> typedResults = new LinkedHashSet <CultureCriteria> ();
for (BaseBusinessClass bbcResult : results)
{
CultureCriteria aResult = (CultureCriteria)bbcResult;
typedResults.add (aResult);
}
return ObjstoreUtils.removeDeleted(transaction, typedResults).toArray (new CultureCriteria[0]);
}
}
public static CultureCriteria[]
searchAll (ObjectTransaction transaction) throws StorageException
{
return SearchByAll ()
.search (transaction);
}
public Object getAttribute (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_Importance))
{
return HELPER_Importance.toObject (getImportance ());
}
else
{
return super.getAttribute (attribName);
}
}
public AttributeHelper getAttributeHelper (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_Importance))
{
return HELPER_Importance;
}
else
{
return super.getAttributeHelper (attribName);
}
}
public void setAttribute (String attribName, Object attribValue) throws FieldException
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_Importance))
{
setImportance ((Importance)(HELPER_Importance.fromObject (_Importance, attribValue)));
}
else
{
super.setAttribute (attribName, attribValue);
}
}
public boolean isWriteable (String fieldName)
{
return getWriteable (fieldName) == FieldWriteability.TRUE;
}
public FieldWriteability getWriteable (String fieldName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (fieldName.equals (FIELD_Importance))
{
return getWriteability_Importance ();
}
else if (fieldName.equals (SINGLEREFERENCE_CultureElement))
{
return getWriteability_CultureElement ();
}
else if (fieldName.equals (SINGLEREFERENCE_CultureElementRating))
{
return getWriteability_CultureElementRating ();
}
else if (fieldName.equals (SINGLEREFERENCE_Job))
{
return getWriteability_Job ();
}
else
{
return super.getWriteable (fieldName);
}
}
public void putUnwriteable (Set<String> fields)
{
if (getWriteability_Importance () != FieldWriteability.TRUE)
{
fields.add (FIELD_Importance);
}
super.putUnwriteable (fields);
}
public List<AbstractAttribute> getAttributes ()
{
List result = super.getAttributes ();
result.add(HELPER_Importance.getAttribObject (getClass (), _Importance, false, FIELD_Importance));
return result;
}
public Map getAttributeMetadata (String attribute)
{
if (ATTRIBUTES_METADATA_CultureCriteria.containsKey (attribute))
{
return (Map)ATTRIBUTES_METADATA_CultureCriteria.get (attribute);
}
else
{
return super.getAttributeMetadata (attribute);
}
}
public Object getAttributeMetadata (String attribute, String metadata)
{
if (ATTRIBUTES_METADATA_CultureCriteria.containsKey (attribute))
{
return ((Map)ATTRIBUTES_METADATA_CultureCriteria.get (attribute)).get(metadata);
}
else
{
return super.getAttributeMetadata (attribute, metadata);
}
}
public void preCommit (boolean willBeStored) throws Exception
{
super.preCommit(willBeStored);
if(willBeStored)
{
}
}
public oneit.servlets.objstore.binary.BinaryContentHandler getBinaryContentHandler(String attribName)
{
return super.getBinaryContentHandler(attribName);
}
public static class CultureCriteriaBehaviourDecorator extends BaseBusinessClass.BBCBehaviourDecorator<CultureCriteria>
{
/**
* Get the attribute Importance
*/
public Importance getImportance (CultureCriteria obj, Importance original)
{
return original;
}
/**
* Change the value set for attribute Importance.
* May modify the field beforehand
* Occurs before validation.
*/
public Importance setImportance (CultureCriteria obj, Importance newImportance) throws FieldException
{
return newImportance;
}
}
public ORMPipeLine pipes()
{
return new CultureCriteriaPipeLineFactory<CultureCriteria, CultureCriteria> ((CultureCriteria)this);
}
/**
* Use this instead of pipes() to get rid of type casting.
*/
public CultureCriteriaPipeLineFactory<CultureCriteria, CultureCriteria> pipelineCultureCriteria()
{
return (CultureCriteriaPipeLineFactory<CultureCriteria, CultureCriteria>) pipes();
}
public static CultureCriteriaPipeLineFactory<CultureCriteria, CultureCriteria> pipesCultureCriteria(Collection<CultureCriteria> items)
{
return REFERENCE_CultureCriteria.new CultureCriteriaPipeLineFactory<CultureCriteria, CultureCriteria> (items);
}
public static CultureCriteriaPipeLineFactory<CultureCriteria, CultureCriteria> pipesCultureCriteria(CultureCriteria[] _items)
{
return pipesCultureCriteria(Arrays.asList (_items));
}
public static CultureCriteriaPipeLineFactory<CultureCriteria, CultureCriteria> pipesCultureCriteria()
{
return pipesCultureCriteria((Collection)null);
}
public class CultureCriteriaPipeLineFactory<From extends BaseBusinessClass, Me extends CultureCriteria> extends BaseBusinessClass.ORMPipeLine<From, Me>
{
public <Prev> CultureCriteriaPipeLineFactory (PipeLine<From, Prev> pipeLine, Pipe<Prev, Me> nextPipe)
{
super (pipeLine, nextPipe);
}
public CultureCriteriaPipeLineFactory (From seed)
{
super(seed);
}
public CultureCriteriaPipeLineFactory (Collection<From> seed)
{
super(seed);
}
public PipeLine<From, ? extends Object> to(String name)
{
if (name.equals ("Importance"))
{
return toImportance ();
}
if (name.equals ("CultureElement"))
{
return toCultureElement ();
}
if (name.equals ("CultureElementRating"))
{
return toCultureElementRating ();
}
if (name.equals ("Job"))
{
return toJob ();
}
return super.to(name);
}
public PipeLine<From, Importance> toImportance () { return pipe(new ORMAttributePipe<Me, Importance>(FIELD_Importance)); }
public CultureElement.CultureElementPipeLineFactory<From, CultureElement> toCultureElement () { return toCultureElement (Filter.ALL); }
public CultureElement.CultureElementPipeLineFactory<From, CultureElement> toCultureElement (Filter<CultureElement> filter)
{
return CultureElement.REFERENCE_CultureElement.new CultureElementPipeLineFactory<From, CultureElement> (this, new ORMSingleAssocPipe<Me, CultureElement>(SINGLEREFERENCE_CultureElement, filter));
}
public CultureElementRating.CultureElementRatingPipeLineFactory<From, CultureElementRating> toCultureElementRating () { return toCultureElementRating (Filter.ALL); }
public CultureElementRating.CultureElementRatingPipeLineFactory<From, CultureElementRating> toCultureElementRating (Filter<CultureElementRating> filter)
{
return CultureElementRating.REFERENCE_CultureElementRating.new CultureElementRatingPipeLineFactory<From, CultureElementRating> (this, new ORMSingleAssocPipe<Me, CultureElementRating>(SINGLEREFERENCE_CultureElementRating, filter));
}
public Job.JobPipeLineFactory<From, Job> toJob () { return toJob (Filter.ALL); }
public Job.JobPipeLineFactory<From, Job> toJob (Filter<Job> filter)
{
return Job.REFERENCE_Job.new JobPipeLineFactory<From, Job> (this, new ORMSingleAssocPipe<Me, Job>(SINGLEREFERENCE_Job, filter));
}
}
public boolean isTransientAttrib(String attribName)
{
return super.isTransientAttrib(attribName);
}
public boolean isTransientSingleReference(String assocName)
{
return super.isTransientSingleReference(assocName);
}
}
class DummyCultureCriteria extends CultureCriteria
{
// Default constructor primarily to support Externalisable
public DummyCultureCriteria()
{
super();
}
public void assertValid ()
{
}
public CultureElement getCultureElement () throws StorageException
{
return (CultureElement)(CultureElement.DUMMY_CultureElement);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getCultureElementID ()
{
return CultureElement.DUMMY_CultureElement.getObjectID();
}
public CultureElementRating getCultureElementRating () throws StorageException
{
return (CultureElementRating)(CultureElementRating.DUMMY_CultureElementRating);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getCultureElementRatingID ()
{
return CultureElementRating.DUMMY_CultureElementRating.getObjectID();
}
public Job getJob () throws StorageException
{
return (Job)(Job.DUMMY_Job);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getJobID ()
{
return Job.DUMMY_Job.getObjectID();
}
}
/*
* IMPORTANT!!!! XSL Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2 rev3 [oneit.objstore.BusinessObjectTemplate.xsl]
*
* Version: 1.0
* Vendor: Apache Software Foundation (Xalan XSLTC)
* Vendor URL: http://xml.apache.org/xalan-j
*/
package performa.orm;
import java.io.*;
import java.util.*;
import oneit.appservices.config.*;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.objstore.assocs.*;
import oneit.objstore.attributes.*;
import oneit.objstore.rdbms.filters.*;
import oneit.objstore.parser.*;
import oneit.objstore.validator.*;
import oneit.objstore.utils.*;
import oneit.utils.*;
import oneit.utils.filter.Filter;
import oneit.utils.transform.*;
import oneit.utils.parsers.FieldException;
public abstract class BaseCultureCriteriaAnswer extends BaseBusinessClass
{
// Reference instance for the object
public static final CultureCriteriaAnswer REFERENCE_CultureCriteriaAnswer = new CultureCriteriaAnswer ();
// Reference instance for the object
public static final CultureCriteriaAnswer DUMMY_CultureCriteriaAnswer = new DummyCultureCriteriaAnswer ();
// Static constants corresponding to field names
public static final String SINGLEREFERENCE_CultureCriteria = "CultureCriteria";
public static final String SINGLEREFERENCE_SelectedQuestion = "SelectedQuestion";
public static final String SINGLEREFERENCE_JobApplication = "JobApplication";
public static final String BACKREF_JobApplication = "";
// Static constants corresponding to searches
public static final String SEARCH_All = "All";
// Static constants corresponding to attribute helpers
// Private attributes corresponding to business object data
// Private attributes corresponding to single references
private SingleAssociation<CultureCriteriaAnswer, CultureCriteria> _CultureCriteria;
private SingleAssociation<CultureCriteriaAnswer, CultureElementQuestion> _SelectedQuestion;
private SingleAssociation<CultureCriteriaAnswer, JobApplication> _JobApplication;
// Private attributes corresponding to multiple references
// Map of maps of metadata
private static final Map ATTRIBUTES_METADATA_CultureCriteriaAnswer = new HashMap ();
// Arrays of validators for each attribute
// Arrays of behaviour decorators
private static final CultureCriteriaAnswerBehaviourDecorator[] CultureCriteriaAnswer_BehaviourDecorators;
static
{
try
{
String tmp_JobApplication = JobApplication.BACKREF_CultureCriteriaAnswers;
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
setupAssocMetaData_CultureCriteria();
setupAssocMetaData_SelectedQuestion();
setupAssocMetaData_JobApplication();
REFERENCE_CultureCriteriaAnswer.initialiseReference ();
DUMMY_CultureCriteriaAnswer.initialiseReference ();
CultureCriteriaAnswer_BehaviourDecorators = BaseBusinessClass.getBBCBehaviours(CultureCriteriaAnswer.class).toArray(new CultureCriteriaAnswerBehaviourDecorator[0]);
}
catch (RuntimeException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR1, e, "Error initialising");
throw e;
}
}
// Meta Info setup
private static void setupAssocMetaData_CultureCriteria()
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "culture_criteria_id");
metaInfo.put ("name", "CultureCriteria");
metaInfo.put ("type", "CultureCriteria");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for CultureCriteriaAnswer.CultureCriteria:", metaInfo);
ATTRIBUTES_METADATA_CultureCriteriaAnswer.put (SINGLEREFERENCE_CultureCriteria, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static void setupAssocMetaData_SelectedQuestion()
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "selected_question_id");
metaInfo.put ("name", "SelectedQuestion");
metaInfo.put ("type", "CultureElementQuestion");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for CultureCriteriaAnswer.SelectedQuestion:", metaInfo);
ATTRIBUTES_METADATA_CultureCriteriaAnswer.put (SINGLEREFERENCE_SelectedQuestion, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static void setupAssocMetaData_JobApplication()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "CultureCriteriaAnswers");
metaInfo.put ("dbcol", "job_application_id");
metaInfo.put ("name", "JobApplication");
metaInfo.put ("type", "JobApplication");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for CultureCriteriaAnswer.JobApplication:", metaInfo);
ATTRIBUTES_METADATA_CultureCriteriaAnswer.put (SINGLEREFERENCE_JobApplication, Collections.unmodifiableMap (metaInfo));
}
// END OF STATIC METADATA DEFINITION
// This constructor should not be called
protected BaseCultureCriteriaAnswer ()
{
}
protected BBCBehaviourDecorator[] getBehaviours()
{
return CultureCriteriaAnswer_BehaviourDecorators;
}
// Initialise the attributes
protected void _initialiseNewObjAttributes (ObjectTransaction transaction) throws StorageException
{
super._initialiseNewObjAttributes (transaction);
}
// Initialise the associations
protected void _initialiseAssociations ()
{
super._initialiseAssociations ();
_CultureCriteria = new SingleAssociation<CultureCriteriaAnswer, CultureCriteria> (this, SINGLEREFERENCE_CultureCriteria, null, CultureCriteria.REFERENCE_CultureCriteria, "tl_culture_criteria_answer");
_SelectedQuestion = new SingleAssociation<CultureCriteriaAnswer, CultureElementQuestion> (this, SINGLEREFERENCE_SelectedQuestion, null, CultureElementQuestion.REFERENCE_CultureElementQuestion, "tl_culture_criteria_answer");
_JobApplication = new SingleAssociation<CultureCriteriaAnswer, JobApplication> (this, SINGLEREFERENCE_JobApplication, JobApplication.MULTIPLEREFERENCE_CultureCriteriaAnswers, JobApplication.REFERENCE_JobApplication, "tl_culture_criteria_answer");
}
// Initialise the associations
protected BaseBusinessClass initialiseReference ()
{
super.initialiseReference ();
_CultureCriteria = new SingleAssociation<CultureCriteriaAnswer, CultureCriteria> (this, SINGLEREFERENCE_CultureCriteria, null, CultureCriteria.REFERENCE_CultureCriteria, "tl_culture_criteria_answer");
_SelectedQuestion = new SingleAssociation<CultureCriteriaAnswer, CultureElementQuestion> (this, SINGLEREFERENCE_SelectedQuestion, null, CultureElementQuestion.REFERENCE_CultureElementQuestion, "tl_culture_criteria_answer");
_JobApplication = new SingleAssociation<CultureCriteriaAnswer, JobApplication> (this, SINGLEREFERENCE_JobApplication, JobApplication.MULTIPLEREFERENCE_CultureCriteriaAnswers, JobApplication.REFERENCE_JobApplication, "tl_culture_criteria_answer");
return this;
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getSingleAssocs()
{
List result = super.getSingleAssocs ();
result.add("CultureCriteria");
result.add("SelectedQuestion");
result.add("JobApplication");
return result;
}
public BaseBusinessClass getSingleAssocReferenceInstance (String assocName)
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_CultureCriteria))
{
return _CultureCriteria.getReferencedType ();
}else if (assocName.equals (SINGLEREFERENCE_SelectedQuestion))
{
return _SelectedQuestion.getReferencedType ();
}else if (assocName.equals (SINGLEREFERENCE_JobApplication))
{
return _JobApplication.getReferencedType ();
}
else
{
return super.getSingleAssocReferenceInstance (assocName);
}
}
public String getSingleAssocBackReference(String assocName)
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_CultureCriteria))
{
return null ;
}else if (assocName.equals (SINGLEREFERENCE_SelectedQuestion))
{
return null ;
}else if (assocName.equals (SINGLEREFERENCE_JobApplication))
{
return JobApplication.MULTIPLEREFERENCE_CultureCriteriaAnswers ;
}
else
{
return super.getSingleAssocBackReference (assocName);
}
}
public BaseBusinessClass getSingleAssoc (String assocName) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_CultureCriteria))
{
return getCultureCriteria ();
}else if (assocName.equals (SINGLEREFERENCE_SelectedQuestion))
{
return getSelectedQuestion ();
}else if (assocName.equals (SINGLEREFERENCE_JobApplication))
{
return getJobApplication ();
}
else
{
return super.getSingleAssoc (assocName);
}
}
public BaseBusinessClass getSingleAssoc (String assocName, Get getType) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_CultureCriteria))
{
return getCultureCriteria (getType);
}else if (assocName.equals (SINGLEREFERENCE_SelectedQuestion))
{
return getSelectedQuestion (getType);
}else if (assocName.equals (SINGLEREFERENCE_JobApplication))
{
return getJobApplication (getType);
}
else
{
return super.getSingleAssoc (assocName, getType);
}
}
public Long getSingleAssocID (String assocName) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_CultureCriteria))
{
return getCultureCriteriaID ();
}else if (assocName.equals (SINGLEREFERENCE_SelectedQuestion))
{
return getSelectedQuestionID ();
}else if (assocName.equals (SINGLEREFERENCE_JobApplication))
{
return getJobApplicationID ();
}
else
{
return super.getSingleAssocID (assocName);
}
}
public void setSingleAssoc (String assocName, BaseBusinessClass newValue) throws StorageException, FieldException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_CultureCriteria))
{
setCultureCriteria ((CultureCriteria)(newValue));
}else if (assocName.equals (SINGLEREFERENCE_SelectedQuestion))
{
setSelectedQuestion ((CultureElementQuestion)(newValue));
}else if (assocName.equals (SINGLEREFERENCE_JobApplication))
{
setJobApplication ((JobApplication)(newValue));
}
else
{
super.setSingleAssoc (assocName, newValue);
}
}
/**
* Get the reference CultureCriteria
*/
public CultureCriteria getCultureCriteria () throws StorageException
{
assertValid();
try
{
return (CultureCriteria)(_CultureCriteria.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in CultureCriteriaAnswer:", this.getObjectID (), ", was trying to get CultureCriteria:", getCultureCriteriaID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _CultureCriteria.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public CultureCriteria getCultureCriteria (Get getType) throws StorageException
{
assertValid();
return _CultureCriteria.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getCultureCriteriaID ()
{
assertValid();
if (_CultureCriteria == null)
{
return null;
}
else
{
return _CultureCriteria.getID ();
}
}
/**
* Called prior to the assoc changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preCultureCriteriaChange (CultureCriteria newCultureCriteria) throws FieldException
{
}
/**
* Called after the assoc changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postCultureCriteriaChange () throws FieldException
{
}
public FieldWriteability getWriteability_CultureCriteria ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference CultureCriteria. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setCultureCriteria (CultureCriteria newCultureCriteria) throws StorageException, FieldException
{
if (_CultureCriteria.wouldReferencedChange (newCultureCriteria))
{
assertValid();
Debug.assertion (getWriteability_CultureCriteria () != FieldWriteability.FALSE, "Assoc CultureCriteria is not writeable");
preCultureCriteriaChange (newCultureCriteria);
_CultureCriteria.set (newCultureCriteria);
postCultureCriteriaChange ();
}
}
/**
* Get the reference SelectedQuestion
*/
public CultureElementQuestion getSelectedQuestion () throws StorageException
{
assertValid();
try
{
return (CultureElementQuestion)(_SelectedQuestion.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in CultureCriteriaAnswer:", this.getObjectID (), ", was trying to get CultureElementQuestion:", getSelectedQuestionID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _SelectedQuestion.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public CultureElementQuestion getSelectedQuestion (Get getType) throws StorageException
{
assertValid();
return _SelectedQuestion.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getSelectedQuestionID ()
{
assertValid();
if (_SelectedQuestion == null)
{
return null;
}
else
{
return _SelectedQuestion.getID ();
}
}
/**
* Called prior to the assoc changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preSelectedQuestionChange (CultureElementQuestion newSelectedQuestion) throws FieldException
{
}
/**
* Called after the assoc changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postSelectedQuestionChange () throws FieldException
{
}
public FieldWriteability getWriteability_SelectedQuestion ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference SelectedQuestion. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setSelectedQuestion (CultureElementQuestion newSelectedQuestion) throws StorageException, FieldException
{
if (_SelectedQuestion.wouldReferencedChange (newSelectedQuestion))
{
assertValid();
Debug.assertion (getWriteability_SelectedQuestion () != FieldWriteability.FALSE, "Assoc SelectedQuestion is not writeable");
preSelectedQuestionChange (newSelectedQuestion);
_SelectedQuestion.set (newSelectedQuestion);
postSelectedQuestionChange ();
}
}
/**
* Get the reference JobApplication
*/
public JobApplication getJobApplication () throws StorageException
{
assertValid();
try
{
return (JobApplication)(_JobApplication.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in CultureCriteriaAnswer:", this.getObjectID (), ", was trying to get JobApplication:", getJobApplicationID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _JobApplication.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public JobApplication getJobApplication (Get getType) throws StorageException
{
assertValid();
return _JobApplication.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getJobApplicationID ()
{
assertValid();
if (_JobApplication == null)
{
return null;
}
else
{
return _JobApplication.getID ();
}
}
/**
* Called prior to the assoc changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preJobApplicationChange (JobApplication newJobApplication) throws FieldException
{
}
/**
* Called after the assoc changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postJobApplicationChange () throws FieldException
{
}
public FieldWriteability getWriteability_JobApplication ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference JobApplication. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setJobApplication (JobApplication newJobApplication) throws StorageException, FieldException
{
if (_JobApplication.wouldReferencedChange (newJobApplication))
{
assertValid();
Debug.assertion (getWriteability_JobApplication () != FieldWriteability.FALSE, "Assoc JobApplication is not writeable");
preJobApplicationChange (newJobApplication);
JobApplication oldJobApplication = getJobApplication ();
if (oldJobApplication != null)
{
// This is to stop validation from triggering when we are removed
_JobApplication.set (null);
oldJobApplication.removeFromCultureCriteriaAnswers ((CultureCriteriaAnswer)(this));
}
_JobApplication.set (newJobApplication);
if (newJobApplication != null)
{
newJobApplication.addToCultureCriteriaAnswers ((CultureCriteriaAnswer)(this));
}
postJobApplicationChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getMultiAssocs()
{
List result = super.getMultiAssocs ();
return result;
}
/**
* Get the reference instance for the multi assoc name.
*/
public BaseBusinessClass getMultiAssocReferenceInstance(String attribName)
{
return super.getMultiAssocReferenceInstance(attribName);
}
public String getMultiAssocBackReference(String attribName)
{
return super.getMultiAssocBackReference(attribName);
}
/**
* Get the assoc count for the multi assoc name.
*/
public int getMultiAssocCount(String attribName) throws StorageException
{
return super.getMultiAssocCount(attribName);
}
/**
* Get the assoc at a particular index
*/
public BaseBusinessClass getMultiAssocAt(String attribName, int index) throws StorageException
{
return super.getMultiAssocAt(attribName, index);
}
/**
* Add to a multi assoc by attribute name
*/
public void addToMultiAssoc(String attribName, BaseBusinessClass newElement) throws StorageException
{
super.addToMultiAssoc(attribName, newElement);
}
/**
* Remove from a multi assoc by attribute name
*/
public void removeFromMultiAssoc(String attribName, BaseBusinessClass oldElement) throws StorageException
{
super.removeFromMultiAssoc(attribName, oldElement);
}
protected void __loadMultiAssoc (String attribName, BaseBusinessClass[] elements)
{
super.__loadMultiAssoc(attribName, elements);
}
protected boolean __isMultiAssocLoaded (String attribName)
{
return super.__isMultiAssocLoaded(attribName);
}
public void onDelete ()
{
try
{
// Ensure we are removed from any loaded multi-associations that aren't mandatory
if (_JobApplication.isLoaded () || getTransaction ().isObjectLoaded (_JobApplication.getReferencedType (), getJobApplicationID ()))
{
JobApplication referenced = getJobApplication ();
if (referenced != null)
{
// Stop the callback
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null CultureCriteriaAnswers from ", getObjectID (), " to ", referenced.getObjectID ());
_JobApplication.set (null);
referenced.removeFromCultureCriteriaAnswers ((CultureCriteriaAnswer)this);
}
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
super.onDelete ();
}
public CultureCriteriaAnswer newInstance ()
{
return new CultureCriteriaAnswer ();
}
public CultureCriteriaAnswer referenceInstance ()
{
return REFERENCE_CultureCriteriaAnswer;
}
public CultureCriteriaAnswer getInTransaction (ObjectTransaction t) throws StorageException
{
return getCultureCriteriaAnswerByID (t, getObjectID());
}
public BaseBusinessClass dummyInstance ()
{
return DUMMY_CultureCriteriaAnswer;
}
public String getBaseSetName ()
{
return "tl_culture_criteria_answer";
}
/**
* This is where an object returns the Persistent sets that will
* store it into the database.
* The should be entered into allSets
*/
public void getPersistentSets (PersistentSetCollection allSets)
{
ObjectStatus myStatus = getStatus ();
PersistentSetStatus myPSetStatus = myStatus.getPSetStatus();
ObjectID myID = getID();
super.getPersistentSets (allSets);
PersistentSet tl_culture_criteria_answerPSet = allSets.getPersistentSet (myID, "tl_culture_criteria_answer", myPSetStatus);
tl_culture_criteria_answerPSet.setAttrib (FIELD_ObjectID, myID);
_CultureCriteria.getPersistentSets (allSets);
_SelectedQuestion.getPersistentSets (allSets);
_JobApplication.getPersistentSets (allSets);
}
/**
* Sets the objects state based on Persistent sets.
*/
public void setFromPersistentSets (ObjectID objectID, PersistentSetCollection allSets)
{
super.setFromPersistentSets (objectID, allSets);
PersistentSet tl_culture_criteria_answerPSet = allSets.getPersistentSet (objectID, "tl_culture_criteria_answer");
_CultureCriteria.setFromPersistentSets (objectID, allSets);
_SelectedQuestion.setFromPersistentSets (objectID, allSets);
_JobApplication.setFromPersistentSets (objectID, allSets);
}
public void setAttributesFrom (BaseBusinessClass other, MultiException e)
{
super.setAttributesFrom (other, e);
if (other instanceof CultureCriteriaAnswer)
{
CultureCriteriaAnswer otherCultureCriteriaAnswer = (CultureCriteriaAnswer)other;
}
}
/**
* Set the attributes in this to copies of the attributes in source.
*/
public void copyAttributesFrom (BaseBusinessClass source)
{
super.copyAttributesFrom (source);
if (source instanceof BaseCultureCriteriaAnswer)
{
BaseCultureCriteriaAnswer sourceCultureCriteriaAnswer = (BaseCultureCriteriaAnswer)(source);
}
}
/**
* Set the associations in this to copies of the attributes in source.
*/
public void copySingleAssociationsFrom (BaseBusinessClass source, boolean linkToGhosts)
{
super.copySingleAssociationsFrom (source, linkToGhosts);
if (source instanceof BaseCultureCriteriaAnswer)
{
BaseCultureCriteriaAnswer sourceCultureCriteriaAnswer = (BaseCultureCriteriaAnswer)(source);
_CultureCriteria.copyFrom (sourceCultureCriteriaAnswer._CultureCriteria, linkToGhosts);
_SelectedQuestion.copyFrom (sourceCultureCriteriaAnswer._SelectedQuestion, linkToGhosts);
_JobApplication.copyFrom (sourceCultureCriteriaAnswer._JobApplication, linkToGhosts);
}
}
/**
* Set the associations in this to copies of the attributes in source.
*/
public void copyAssociationsFrom (BaseBusinessClass source, boolean linkToGhosts)
{
super.copyAssociationsFrom (source, linkToGhosts);
if (source instanceof BaseCultureCriteriaAnswer)
{
BaseCultureCriteriaAnswer sourceCultureCriteriaAnswer = (BaseCultureCriteriaAnswer)(source);
}
}
public void validate (ValidationContext context)
{
super.validate (context);
}
/**
* Subclasses must override this to read in their attributes
*/
protected void readExternalData(Map<String, Object> vals) throws IOException, ClassNotFoundException
{
super.readExternalData(vals);
_CultureCriteria.readExternalData(vals.get(SINGLEREFERENCE_CultureCriteria));
_SelectedQuestion.readExternalData(vals.get(SINGLEREFERENCE_SelectedQuestion));
_JobApplication.readExternalData(vals.get(SINGLEREFERENCE_JobApplication));
}
/**
* Subclasses must override this to write out their attributes
*/
protected void writeExternalData(Map<String, Object> vals) throws IOException
{
super.writeExternalData(vals);
vals.put (SINGLEREFERENCE_CultureCriteria, _CultureCriteria.writeExternalData());
vals.put (SINGLEREFERENCE_SelectedQuestion, _SelectedQuestion.writeExternalData());
vals.put (SINGLEREFERENCE_JobApplication, _JobApplication.writeExternalData());
}
public void compare (BaseBusinessClass other, AttributeChangeListener listener) throws StorageException
{
super.compare (other, listener);
if (other instanceof BaseCultureCriteriaAnswer)
{
BaseCultureCriteriaAnswer otherCultureCriteriaAnswer = (BaseCultureCriteriaAnswer)(other);
// Compare single assocs
_CultureCriteria.compare (otherCultureCriteriaAnswer._CultureCriteria, listener);
_SelectedQuestion.compare (otherCultureCriteriaAnswer._SelectedQuestion, listener);
_JobApplication.compare (otherCultureCriteriaAnswer._JobApplication, listener);
// Compare multiple assocs
}
}
public void visitTransients (AttributeVisitor visitor) throws StorageException
{
super.visitAttributes (visitor);
}
public void visitAttributes (AttributeVisitor visitor) throws StorageException
{
super.visitAttributes (visitor);
visitor.visitAssociation (_CultureCriteria);
visitor.visitAssociation (_SelectedQuestion);
visitor.visitAssociation (_JobApplication);
}
public void visitAssociations (AssociationVisitor visitor, AssociatedScope scope) throws StorageException
{
super.visitAssociations (visitor, scope);
if (scope.includes (_CultureCriteria))
{
visitor.visit (_CultureCriteria);
}
if (scope.includes (_SelectedQuestion))
{
visitor.visit (_SelectedQuestion);
}
if (scope.includes (_JobApplication))
{
visitor.visit (_JobApplication);
}
}
public static CultureCriteriaAnswer createCultureCriteriaAnswer (ObjectTransaction transaction) throws StorageException
{
CultureCriteriaAnswer result = new CultureCriteriaAnswer ();
result.initialiseNewObject (transaction);
return result;
}
public static CultureCriteriaAnswer getCultureCriteriaAnswerByID (ObjectTransaction transaction, Long objectID) throws StorageException
{
return (CultureCriteriaAnswer)(transaction.getObjectByID (REFERENCE_CultureCriteriaAnswer, objectID));
}
public boolean testFilter (String attribName, QueryFilter filter) throws StorageException
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (SINGLEREFERENCE_CultureCriteria))
{
return filter.matches (getCultureCriteria ());
}
else if (attribName.equals (SINGLEREFERENCE_SelectedQuestion))
{
return filter.matches (getSelectedQuestion ());
}
else if (attribName.equals (SINGLEREFERENCE_JobApplication))
{
return filter.matches (getJobApplication ());
}
else
{
return super.testFilter (attribName, filter);
}
}
public static SearchAll SearchByAll () { return new SearchAll (); }
public static class SearchAll extends SearchObject<CultureCriteriaAnswer>
{
public SearchAll andObjectID (QueryFilter<Long> filter)
{
filter.addFilter (context, "tl_culture_criteria_answer.object_id", FIELD_ObjectID);
return this;
}
public SearchAll andObjectCreated (QueryFilter<Date> filter)
{
filter.addFilter (context, "tl_culture_criteria_answer.object_created_date", FIELD_ObjectCreated);
return this;
}
public SearchAll andObjectLastModified (QueryFilter<Date> filter)
{
filter.addFilter (context, "tl_culture_criteria_answer.object_last_updated_date", FIELD_ObjectLastModified);
return this;
}
public SearchAll andCultureCriteria (QueryFilter<CultureCriteria> filter)
{
filter.addFilter (context, "tl_culture_criteria_answer.culture_criteria_id", "CultureCriteria");
return this;
}
public SearchAll andSelectedQuestion (QueryFilter<CultureElementQuestion> filter)
{
filter.addFilter (context, "tl_culture_criteria_answer.selected_question_id", "SelectedQuestion");
return this;
}
public SearchAll andJobApplication (QueryFilter<JobApplication> filter)
{
filter.addFilter (context, "tl_culture_criteria_answer.job_application_id", "JobApplication");
return this;
}
public CultureCriteriaAnswer[]
search (ObjectTransaction transaction) throws StorageException
{
BaseBusinessClass[] results = super.search (transaction, REFERENCE_CultureCriteriaAnswer, SEARCH_All, criteria);
Set<CultureCriteriaAnswer> typedResults = new LinkedHashSet <CultureCriteriaAnswer> ();
for (BaseBusinessClass bbcResult : results)
{
CultureCriteriaAnswer aResult = (CultureCriteriaAnswer)bbcResult;
typedResults.add (aResult);
}
return ObjstoreUtils.removeDeleted(transaction, typedResults).toArray (new CultureCriteriaAnswer[0]);
}
}
public static CultureCriteriaAnswer[]
searchAll (ObjectTransaction transaction) throws StorageException
{
return SearchByAll ()
.search (transaction);
}
public Object getAttribute (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else
{
return super.getAttribute (attribName);
}
}
public AttributeHelper getAttributeHelper (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else
{
return super.getAttributeHelper (attribName);
}
}
public void setAttribute (String attribName, Object attribValue) throws FieldException
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else
{
super.setAttribute (attribName, attribValue);
}
}
public boolean isWriteable (String fieldName)
{
return getWriteable (fieldName) == FieldWriteability.TRUE;
}
public FieldWriteability getWriteable (String fieldName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (fieldName.equals (SINGLEREFERENCE_CultureCriteria))
{
return getWriteability_CultureCriteria ();
}
else if (fieldName.equals (SINGLEREFERENCE_SelectedQuestion))
{
return getWriteability_SelectedQuestion ();
}
else if (fieldName.equals (SINGLEREFERENCE_JobApplication))
{
return getWriteability_JobApplication ();
}
else
{
return super.getWriteable (fieldName);
}
}
public void putUnwriteable (Set<String> fields)
{
super.putUnwriteable (fields);
}
public List<AbstractAttribute> getAttributes ()
{
List result = super.getAttributes ();
return result;
}
public Map getAttributeMetadata (String attribute)
{
if (ATTRIBUTES_METADATA_CultureCriteriaAnswer.containsKey (attribute))
{
return (Map)ATTRIBUTES_METADATA_CultureCriteriaAnswer.get (attribute);
}
else
{
return super.getAttributeMetadata (attribute);
}
}
public Object getAttributeMetadata (String attribute, String metadata)
{
if (ATTRIBUTES_METADATA_CultureCriteriaAnswer.containsKey (attribute))
{
return ((Map)ATTRIBUTES_METADATA_CultureCriteriaAnswer.get (attribute)).get(metadata);
}
else
{
return super.getAttributeMetadata (attribute, metadata);
}
}
public void preCommit (boolean willBeStored) throws Exception
{
super.preCommit(willBeStored);
if(willBeStored)
{
}
}
public oneit.servlets.objstore.binary.BinaryContentHandler getBinaryContentHandler(String attribName)
{
return super.getBinaryContentHandler(attribName);
}
public static class CultureCriteriaAnswerBehaviourDecorator extends BaseBusinessClass.BBCBehaviourDecorator<CultureCriteriaAnswer>
{
}
public ORMPipeLine pipes()
{
return new CultureCriteriaAnswerPipeLineFactory<CultureCriteriaAnswer, CultureCriteriaAnswer> ((CultureCriteriaAnswer)this);
}
/**
* Use this instead of pipes() to get rid of type casting.
*/
public CultureCriteriaAnswerPipeLineFactory<CultureCriteriaAnswer, CultureCriteriaAnswer> pipelineCultureCriteriaAnswer()
{
return (CultureCriteriaAnswerPipeLineFactory<CultureCriteriaAnswer, CultureCriteriaAnswer>) pipes();
}
public static CultureCriteriaAnswerPipeLineFactory<CultureCriteriaAnswer, CultureCriteriaAnswer> pipesCultureCriteriaAnswer(Collection<CultureCriteriaAnswer> items)
{
return REFERENCE_CultureCriteriaAnswer.new CultureCriteriaAnswerPipeLineFactory<CultureCriteriaAnswer, CultureCriteriaAnswer> (items);
}
public static CultureCriteriaAnswerPipeLineFactory<CultureCriteriaAnswer, CultureCriteriaAnswer> pipesCultureCriteriaAnswer(CultureCriteriaAnswer[] _items)
{
return pipesCultureCriteriaAnswer(Arrays.asList (_items));
}
public static CultureCriteriaAnswerPipeLineFactory<CultureCriteriaAnswer, CultureCriteriaAnswer> pipesCultureCriteriaAnswer()
{
return pipesCultureCriteriaAnswer((Collection)null);
}
public class CultureCriteriaAnswerPipeLineFactory<From extends BaseBusinessClass, Me extends CultureCriteriaAnswer> extends BaseBusinessClass.ORMPipeLine<From, Me>
{
public <Prev> CultureCriteriaAnswerPipeLineFactory (PipeLine<From, Prev> pipeLine, Pipe<Prev, Me> nextPipe)
{
super (pipeLine, nextPipe);
}
public CultureCriteriaAnswerPipeLineFactory (From seed)
{
super(seed);
}
public CultureCriteriaAnswerPipeLineFactory (Collection<From> seed)
{
super(seed);
}
public PipeLine<From, ? extends Object> to(String name)
{
if (name.equals ("CultureCriteria"))
{
return toCultureCriteria ();
}
if (name.equals ("SelectedQuestion"))
{
return toSelectedQuestion ();
}
if (name.equals ("JobApplication"))
{
return toJobApplication ();
}
return super.to(name);
}
public CultureCriteria.CultureCriteriaPipeLineFactory<From, CultureCriteria> toCultureCriteria () { return toCultureCriteria (Filter.ALL); }
public CultureCriteria.CultureCriteriaPipeLineFactory<From, CultureCriteria> toCultureCriteria (Filter<CultureCriteria> filter)
{
return CultureCriteria.REFERENCE_CultureCriteria.new CultureCriteriaPipeLineFactory<From, CultureCriteria> (this, new ORMSingleAssocPipe<Me, CultureCriteria>(SINGLEREFERENCE_CultureCriteria, filter));
}
public CultureElementQuestion.CultureElementQuestionPipeLineFactory<From, CultureElementQuestion> toSelectedQuestion () { return toSelectedQuestion (Filter.ALL); }
public CultureElementQuestion.CultureElementQuestionPipeLineFactory<From, CultureElementQuestion> toSelectedQuestion (Filter<CultureElementQuestion> filter)
{
return CultureElementQuestion.REFERENCE_CultureElementQuestion.new CultureElementQuestionPipeLineFactory<From, CultureElementQuestion> (this, new ORMSingleAssocPipe<Me, CultureElementQuestion>(SINGLEREFERENCE_SelectedQuestion, filter));
}
public JobApplication.JobApplicationPipeLineFactory<From, JobApplication> toJobApplication () { return toJobApplication (Filter.ALL); }
public JobApplication.JobApplicationPipeLineFactory<From, JobApplication> toJobApplication (Filter<JobApplication> filter)
{
return JobApplication.REFERENCE_JobApplication.new JobApplicationPipeLineFactory<From, JobApplication> (this, new ORMSingleAssocPipe<Me, JobApplication>(SINGLEREFERENCE_JobApplication, filter));
}
}
public boolean isTransientAttrib(String attribName)
{
return super.isTransientAttrib(attribName);
}
public boolean isTransientSingleReference(String assocName)
{
return super.isTransientSingleReference(assocName);
}
}
class DummyCultureCriteriaAnswer extends CultureCriteriaAnswer
{
// Default constructor primarily to support Externalisable
public DummyCultureCriteriaAnswer()
{
super();
}
public void assertValid ()
{
}
public CultureCriteria getCultureCriteria () throws StorageException
{
return (CultureCriteria)(CultureCriteria.DUMMY_CultureCriteria);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getCultureCriteriaID ()
{
return CultureCriteria.DUMMY_CultureCriteria.getObjectID();
}
public CultureElementQuestion getSelectedQuestion () throws StorageException
{
return (CultureElementQuestion)(CultureElementQuestion.DUMMY_CultureElementQuestion);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getSelectedQuestionID ()
{
return CultureElementQuestion.DUMMY_CultureElementQuestion.getObjectID();
}
public JobApplication getJobApplication () throws StorageException
{
return (JobApplication)(JobApplication.DUMMY_JobApplication);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getJobApplicationID ()
{
return JobApplication.DUMMY_JobApplication.getObjectID();
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
/*
* IMPORTANT!!!! XSL Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2 rev3 [oneit.objstore.BusinessObjectTemplate.xsl]
*
* Version: 1.0
* Vendor: Apache Software Foundation (Xalan XSLTC)
* Vendor URL: http://xml.apache.org/xalan-j
*/
package performa.orm;
import java.io.*;
import java.util.*;
import oneit.appservices.config.*;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.objstore.assocs.*;
import oneit.objstore.attributes.*;
import oneit.objstore.rdbms.filters.*;
import oneit.objstore.parser.*;
import oneit.objstore.validator.*;
import oneit.objstore.utils.*;
import oneit.utils.*;
import oneit.utils.filter.Filter;
import oneit.utils.transform.*;
import oneit.utils.parsers.FieldException;
public abstract class BaseJobApplication extends BaseBusinessClass
{
// Reference instance for the object
public static final JobApplication REFERENCE_JobApplication = new JobApplication ();
// Reference instance for the object
public static final JobApplication DUMMY_JobApplication = new DummyJobApplication ();
// Static constants corresponding to field names
public static final String FIELD_CV = "CV";
public static final String SINGLEREFERENCE_Candidate = "Candidate";
public static final String BACKREF_Candidate = "";
public static final String SINGLEREFERENCE_Job = "Job";
public static final String BACKREF_Job = "";
public static final String MULTIPLEREFERENCE_AssessmentCriteriaAnswers = "AssessmentCriteriaAnswers";
public static final String BACKREF_AssessmentCriteriaAnswers = "";
public static final String MULTIPLEREFERENCE_CultureCriteriaAnswers = "CultureCriteriaAnswers";
public static final String BACKREF_CultureCriteriaAnswers = "";
// Static constants corresponding to searches
public static final String SEARCH_All = "All";
// Static constants corresponding to attribute helpers
private static final BLOBAttributeHelper HELPER_CV = BLOBAttributeHelper.INSTANCE;
// Private attributes corresponding to business object data
private BinaryContent _CV;
// Private attributes corresponding to single references
private SingleAssociation<JobApplication, Candidate> _Candidate;
private SingleAssociation<JobApplication, Job> _Job;
// Private attributes corresponding to multiple references
private MultipleAssociation<JobApplication, AssessmentCriteriaAnswer> _AssessmentCriteriaAnswers;
private MultipleAssociation<JobApplication, CultureCriteriaAnswer> _CultureCriteriaAnswers;
// Map of maps of metadata
private static final Map ATTRIBUTES_METADATA_JobApplication = new HashMap ();
// Arrays of validators for each attribute
private static final AttributeValidator[] FIELD_CV_Validators;
// Arrays of behaviour decorators
private static final JobApplicationBehaviourDecorator[] JobApplication_BehaviourDecorators;
static
{
try
{
String tmp_AssessmentCriteriaAnswers = AssessmentCriteriaAnswer.BACKREF_JobApplication;
String tmp_CultureCriteriaAnswers = CultureCriteriaAnswer.BACKREF_JobApplication;
String tmp_Candidate = Candidate.BACKREF_JobApplications;
String tmp_Job = Job.BACKREF_JobApplications;
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
setupAssocMetaData_AssessmentCriteriaAnswers();
setupAssocMetaData_CultureCriteriaAnswers();
setupAssocMetaData_Candidate();
setupAssocMetaData_Job();
FIELD_CV_Validators = (AttributeValidator[])setupAttribMetaData_CV(validatorMapping).toArray (new AttributeValidator[0]);
REFERENCE_JobApplication.initialiseReference ();
DUMMY_JobApplication.initialiseReference ();
JobApplication_BehaviourDecorators = BaseBusinessClass.getBBCBehaviours(JobApplication.class).toArray(new JobApplicationBehaviourDecorator[0]);
}
catch (RuntimeException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR1, e, "Error initialising");
throw e;
}
}
// Meta Info setup
private static void setupAssocMetaData_AssessmentCriteriaAnswers()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "JobApplication");
metaInfo.put ("name", "AssessmentCriteriaAnswers");
metaInfo.put ("type", "AssessmentCriteriaAnswer");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for JobApplication.AssessmentCriteriaAnswers:", metaInfo);
ATTRIBUTES_METADATA_JobApplication.put (MULTIPLEREFERENCE_AssessmentCriteriaAnswers, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static void setupAssocMetaData_CultureCriteriaAnswers()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "JobApplication");
metaInfo.put ("name", "CultureCriteriaAnswers");
metaInfo.put ("type", "CultureCriteriaAnswer");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for JobApplication.CultureCriteriaAnswers:", metaInfo);
ATTRIBUTES_METADATA_JobApplication.put (MULTIPLEREFERENCE_CultureCriteriaAnswers, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static void setupAssocMetaData_Candidate()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "JobApplications");
metaInfo.put ("dbcol", "candidate_id");
metaInfo.put ("name", "Candidate");
metaInfo.put ("type", "Candidate");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for JobApplication.Candidate:", metaInfo);
ATTRIBUTES_METADATA_JobApplication.put (SINGLEREFERENCE_Candidate, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static void setupAssocMetaData_Job()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "JobApplications");
metaInfo.put ("dbcol", "job_id");
metaInfo.put ("name", "Job");
metaInfo.put ("type", "Job");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for JobApplication.Job:", metaInfo);
ATTRIBUTES_METADATA_JobApplication.put (SINGLEREFERENCE_Job, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static List setupAttribMetaData_CV(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("attribHelper", "BLOBAttributeHelper");
metaInfo.put ("attribHelperInstance", "BLOBAttributeHelper.INSTANCE");
metaInfo.put ("binaryHandler", "loggedin");
metaInfo.put ("dbcol", "cv");
metaInfo.put ("name", "CV");
metaInfo.put ("type", "BinaryContent");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for JobApplication.CV:", metaInfo);
ATTRIBUTES_METADATA_JobApplication.put (FIELD_CV, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(JobApplication.class, "CV", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for JobApplication.CV:", validators);
return validators;
}
// END OF STATIC METADATA DEFINITION
// This constructor should not be called
protected BaseJobApplication ()
{
}
protected BBCBehaviourDecorator[] getBehaviours()
{
return JobApplication_BehaviourDecorators;
}
// Initialise the attributes
protected void _initialiseNewObjAttributes (ObjectTransaction transaction) throws StorageException
{
super._initialiseNewObjAttributes (transaction);
_CV = (BinaryContent)(HELPER_CV.initialise (_CV));
}
// Initialise the associations
protected void _initialiseAssociations ()
{
super._initialiseAssociations ();
_Candidate = new SingleAssociation<JobApplication, Candidate> (this, SINGLEREFERENCE_Candidate, Candidate.MULTIPLEREFERENCE_JobApplications, Candidate.REFERENCE_Candidate, "tl_job_application");
_Job = new SingleAssociation<JobApplication, Job> (this, SINGLEREFERENCE_Job, Job.MULTIPLEREFERENCE_JobApplications, Job.REFERENCE_Job, "tl_job_application");
_AssessmentCriteriaAnswers = new MultipleAssociation<JobApplication, AssessmentCriteriaAnswer> (this, MULTIPLEREFERENCE_AssessmentCriteriaAnswers, AssessmentCriteriaAnswer.SINGLEREFERENCE_JobApplication, AssessmentCriteriaAnswer.REFERENCE_AssessmentCriteriaAnswer);
_CultureCriteriaAnswers = new MultipleAssociation<JobApplication, CultureCriteriaAnswer> (this, MULTIPLEREFERENCE_CultureCriteriaAnswers, CultureCriteriaAnswer.SINGLEREFERENCE_JobApplication, CultureCriteriaAnswer.REFERENCE_CultureCriteriaAnswer);
}
// Initialise the associations
protected BaseBusinessClass initialiseReference ()
{
super.initialiseReference ();
_Candidate = new SingleAssociation<JobApplication, Candidate> (this, SINGLEREFERENCE_Candidate, Candidate.MULTIPLEREFERENCE_JobApplications, Candidate.REFERENCE_Candidate, "tl_job_application");
_Job = new SingleAssociation<JobApplication, Job> (this, SINGLEREFERENCE_Job, Job.MULTIPLEREFERENCE_JobApplications, Job.REFERENCE_Job, "tl_job_application");
_AssessmentCriteriaAnswers = new MultipleAssociation<JobApplication, AssessmentCriteriaAnswer> (this, MULTIPLEREFERENCE_AssessmentCriteriaAnswers, AssessmentCriteriaAnswer.SINGLEREFERENCE_JobApplication, AssessmentCriteriaAnswer.REFERENCE_AssessmentCriteriaAnswer);
_CultureCriteriaAnswers = new MultipleAssociation<JobApplication, CultureCriteriaAnswer> (this, MULTIPLEREFERENCE_CultureCriteriaAnswers, CultureCriteriaAnswer.SINGLEREFERENCE_JobApplication, CultureCriteriaAnswer.REFERENCE_CultureCriteriaAnswer);
return this;
}
/**
* Get the attribute CV
*/
public BinaryContent getCV ()
{
assertValid();
BinaryContent valToReturn = _CV;
for (JobApplicationBehaviourDecorator bhd : JobApplication_BehaviourDecorators)
{
valToReturn = bhd.getCV ((JobApplication)this, valToReturn);
}
return valToReturn;
}
/**
* Called prior to the attribute changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preCVChange (BinaryContent newCV) throws FieldException
{
}
/**
* Called after the attribute changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postCVChange () throws FieldException
{
}
public FieldWriteability getWriteability_CV ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute CV. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setCV (BinaryContent newCV) throws FieldException
{
boolean oldAndNewIdentical = HELPER_CV.compare (_CV, newCV);
try
{
for (JobApplicationBehaviourDecorator bhd : JobApplication_BehaviourDecorators)
{
newCV = bhd.setCV ((JobApplication)this, newCV);
oldAndNewIdentical = HELPER_CV.compare (_CV, newCV);
}
if (FIELD_CV_Validators.length > 0)
{
Object newCVObj = HELPER_CV.toObject (newCV);
if (newCVObj != null)
{
int loopMax = FIELD_CV_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_JobApplication.get (FIELD_CV);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_CV_Validators[v].checkAttribute (this, FIELD_CV, metadata, newCVObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_CV () != FieldWriteability.FALSE, "Field CV is not writeable");
preCVChange (newCV);
markFieldChange (FIELD_CV);
_CV = newCV;
postFieldChange (FIELD_CV);
postCVChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getSingleAssocs()
{
List result = super.getSingleAssocs ();
result.add("Candidate");
result.add("Job");
return result;
}
public BaseBusinessClass getSingleAssocReferenceInstance (String assocName)
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Candidate))
{
return _Candidate.getReferencedType ();
}else if (assocName.equals (SINGLEREFERENCE_Job))
{
return _Job.getReferencedType ();
}
else
{
return super.getSingleAssocReferenceInstance (assocName);
}
}
public String getSingleAssocBackReference(String assocName)
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Candidate))
{
return Candidate.MULTIPLEREFERENCE_JobApplications ;
}else if (assocName.equals (SINGLEREFERENCE_Job))
{
return Job.MULTIPLEREFERENCE_JobApplications ;
}
else
{
return super.getSingleAssocBackReference (assocName);
}
}
public BaseBusinessClass getSingleAssoc (String assocName) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Candidate))
{
return getCandidate ();
}else if (assocName.equals (SINGLEREFERENCE_Job))
{
return getJob ();
}
else
{
return super.getSingleAssoc (assocName);
}
}
public BaseBusinessClass getSingleAssoc (String assocName, Get getType) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Candidate))
{
return getCandidate (getType);
}else if (assocName.equals (SINGLEREFERENCE_Job))
{
return getJob (getType);
}
else
{
return super.getSingleAssoc (assocName, getType);
}
}
public Long getSingleAssocID (String assocName) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Candidate))
{
return getCandidateID ();
}else if (assocName.equals (SINGLEREFERENCE_Job))
{
return getJobID ();
}
else
{
return super.getSingleAssocID (assocName);
}
}
public void setSingleAssoc (String assocName, BaseBusinessClass newValue) throws StorageException, FieldException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Candidate))
{
setCandidate ((Candidate)(newValue));
}else if (assocName.equals (SINGLEREFERENCE_Job))
{
setJob ((Job)(newValue));
}
else
{
super.setSingleAssoc (assocName, newValue);
}
}
/**
* Get the reference Candidate
*/
public Candidate getCandidate () throws StorageException
{
assertValid();
try
{
return (Candidate)(_Candidate.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in JobApplication:", this.getObjectID (), ", was trying to get Candidate:", getCandidateID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _Candidate.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Candidate getCandidate (Get getType) throws StorageException
{
assertValid();
return _Candidate.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getCandidateID ()
{
assertValid();
if (_Candidate == null)
{
return null;
}
else
{
return _Candidate.getID ();
}
}
/**
* Called prior to the assoc changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preCandidateChange (Candidate newCandidate) throws FieldException
{
}
/**
* Called after the assoc changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postCandidateChange () throws FieldException
{
}
public FieldWriteability getWriteability_Candidate ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference Candidate. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setCandidate (Candidate newCandidate) throws StorageException, FieldException
{
if (_Candidate.wouldReferencedChange (newCandidate))
{
assertValid();
Debug.assertion (getWriteability_Candidate () != FieldWriteability.FALSE, "Assoc Candidate is not writeable");
preCandidateChange (newCandidate);
Candidate oldCandidate = getCandidate ();
if (oldCandidate != null)
{
// This is to stop validation from triggering when we are removed
_Candidate.set (null);
oldCandidate.removeFromJobApplications ((JobApplication)(this));
}
_Candidate.set (newCandidate);
if (newCandidate != null)
{
newCandidate.addToJobApplications ((JobApplication)(this));
}
postCandidateChange ();
}
}
/**
* Get the reference Job
*/
public Job getJob () throws StorageException
{
assertValid();
try
{
return (Job)(_Job.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in JobApplication:", this.getObjectID (), ", was trying to get Job:", getJobID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _Job.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Job getJob (Get getType) throws StorageException
{
assertValid();
return _Job.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getJobID ()
{
assertValid();
if (_Job == null)
{
return null;
}
else
{
return _Job.getID ();
}
}
/**
* Called prior to the assoc changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preJobChange (Job newJob) throws FieldException
{
}
/**
* Called after the assoc changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postJobChange () throws FieldException
{
}
public FieldWriteability getWriteability_Job ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference Job. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setJob (Job newJob) throws StorageException, FieldException
{
if (_Job.wouldReferencedChange (newJob))
{
assertValid();
Debug.assertion (getWriteability_Job () != FieldWriteability.FALSE, "Assoc Job is not writeable");
preJobChange (newJob);
Job oldJob = getJob ();
if (oldJob != null)
{
// This is to stop validation from triggering when we are removed
_Job.set (null);
oldJob.removeFromJobApplications ((JobApplication)(this));
}
_Job.set (newJob);
if (newJob != null)
{
newJob.addToJobApplications ((JobApplication)(this));
}
postJobChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getMultiAssocs()
{
List result = super.getMultiAssocs ();
result.add("AssessmentCriteriaAnswers");
result.add("CultureCriteriaAnswers");
return result;
}
/**
* Get the reference instance for the multi assoc name.
*/
public BaseBusinessClass getMultiAssocReferenceInstance(String attribName)
{
if (MULTIPLEREFERENCE_AssessmentCriteriaAnswers.equals(attribName))
{
return AssessmentCriteriaAnswer.REFERENCE_AssessmentCriteriaAnswer ;
}
if (MULTIPLEREFERENCE_CultureCriteriaAnswers.equals(attribName))
{
return CultureCriteriaAnswer.REFERENCE_CultureCriteriaAnswer ;
}
return super.getMultiAssocReferenceInstance(attribName);
}
public String getMultiAssocBackReference(String attribName)
{
if (MULTIPLEREFERENCE_AssessmentCriteriaAnswers.equals(attribName))
{
return AssessmentCriteriaAnswer.SINGLEREFERENCE_JobApplication ;
}
if (MULTIPLEREFERENCE_CultureCriteriaAnswers.equals(attribName))
{
return CultureCriteriaAnswer.SINGLEREFERENCE_JobApplication ;
}
return super.getMultiAssocBackReference(attribName);
}
/**
* Get the assoc count for the multi assoc name.
*/
public int getMultiAssocCount(String attribName) throws StorageException
{
if (MULTIPLEREFERENCE_AssessmentCriteriaAnswers.equals(attribName))
{
return this.getAssessmentCriteriaAnswersCount();
}
if (MULTIPLEREFERENCE_CultureCriteriaAnswers.equals(attribName))
{
return this.getCultureCriteriaAnswersCount();
}
return super.getMultiAssocCount(attribName);
}
/**
* Get the assoc at a particular index
*/
public BaseBusinessClass getMultiAssocAt(String attribName, int index) throws StorageException
{
if (MULTIPLEREFERENCE_AssessmentCriteriaAnswers.equals(attribName))
{
return this.getAssessmentCriteriaAnswersAt(index);
}
if (MULTIPLEREFERENCE_CultureCriteriaAnswers.equals(attribName))
{
return this.getCultureCriteriaAnswersAt(index);
}
return super.getMultiAssocAt(attribName, index);
}
/**
* Add to a multi assoc by attribute name
*/
public void addToMultiAssoc(String attribName, BaseBusinessClass newElement) throws StorageException
{
if (MULTIPLEREFERENCE_AssessmentCriteriaAnswers.equals(attribName))
{
addToAssessmentCriteriaAnswers((AssessmentCriteriaAnswer)newElement);
return;
}
if (MULTIPLEREFERENCE_CultureCriteriaAnswers.equals(attribName))
{
addToCultureCriteriaAnswers((CultureCriteriaAnswer)newElement);
return;
}
super.addToMultiAssoc(attribName, newElement);
}
/**
* Remove from a multi assoc by attribute name
*/
public void removeFromMultiAssoc(String attribName, BaseBusinessClass oldElement) throws StorageException
{
if (MULTIPLEREFERENCE_AssessmentCriteriaAnswers.equals(attribName))
{
removeFromAssessmentCriteriaAnswers((AssessmentCriteriaAnswer)oldElement);
return;
}
if (MULTIPLEREFERENCE_CultureCriteriaAnswers.equals(attribName))
{
removeFromCultureCriteriaAnswers((CultureCriteriaAnswer)oldElement);
return;
}
super.removeFromMultiAssoc(attribName, oldElement);
}
protected void __loadMultiAssoc (String attribName, BaseBusinessClass[] elements)
{
if (MULTIPLEREFERENCE_AssessmentCriteriaAnswers.equals(attribName))
{
_AssessmentCriteriaAnswers.__loadAssociation (elements);
return;
}
if (MULTIPLEREFERENCE_CultureCriteriaAnswers.equals(attribName))
{
_CultureCriteriaAnswers.__loadAssociation (elements);
return;
}
super.__loadMultiAssoc(attribName, elements);
}
protected boolean __isMultiAssocLoaded (String attribName)
{
if (MULTIPLEREFERENCE_AssessmentCriteriaAnswers.equals(attribName))
{
return _AssessmentCriteriaAnswers.isLoaded ();
}
if (MULTIPLEREFERENCE_CultureCriteriaAnswers.equals(attribName))
{
return _CultureCriteriaAnswers.isLoaded ();
}
return super.__isMultiAssocLoaded(attribName);
}
public FieldWriteability getWriteability_AssessmentCriteriaAnswers ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
public int getAssessmentCriteriaAnswersCount () throws StorageException
{
assertValid();
return _AssessmentCriteriaAnswers.getReferencedObjectsCount ();
}
public void addToAssessmentCriteriaAnswers (AssessmentCriteriaAnswer newElement) throws StorageException
{
if (_AssessmentCriteriaAnswers.wouldAddChange (newElement))
{
assertValid();
Debug.assertion (getWriteability_AssessmentCriteriaAnswers () != FieldWriteability.FALSE, "MultiAssoc AssessmentCriteriaAnswers is not writeable (add)");
_AssessmentCriteriaAnswers.appendElement (newElement);
try
{
if (newElement.getJobApplication () != this)
{
newElement.setJobApplication ((JobApplication)(this));
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
}
}
public void removeFromAssessmentCriteriaAnswers (AssessmentCriteriaAnswer elementToRemove) throws StorageException
{
if (_AssessmentCriteriaAnswers.wouldRemoveChange (elementToRemove))
{
assertValid();
Debug.assertion (getWriteability_AssessmentCriteriaAnswers () != FieldWriteability.FALSE, "MultiAssoc AssessmentCriteriaAnswers is not writeable (remove)");
_AssessmentCriteriaAnswers.removeElement (elementToRemove);
try
{
if (elementToRemove.getJobApplication () != null)
{
elementToRemove.setJobApplication (null);
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
}
}
public AssessmentCriteriaAnswer getAssessmentCriteriaAnswersAt (int index) throws StorageException
{
return (AssessmentCriteriaAnswer)(_AssessmentCriteriaAnswers.getElementAt (index));
}
public SortedSet<AssessmentCriteriaAnswer> getAssessmentCriteriaAnswersSet () throws StorageException
{
return _AssessmentCriteriaAnswers.getSet ();
}
public FieldWriteability getWriteability_CultureCriteriaAnswers ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
public int getCultureCriteriaAnswersCount () throws StorageException
{
assertValid();
return _CultureCriteriaAnswers.getReferencedObjectsCount ();
}
public void addToCultureCriteriaAnswers (CultureCriteriaAnswer newElement) throws StorageException
{
if (_CultureCriteriaAnswers.wouldAddChange (newElement))
{
assertValid();
Debug.assertion (getWriteability_CultureCriteriaAnswers () != FieldWriteability.FALSE, "MultiAssoc CultureCriteriaAnswers is not writeable (add)");
_CultureCriteriaAnswers.appendElement (newElement);
try
{
if (newElement.getJobApplication () != this)
{
newElement.setJobApplication ((JobApplication)(this));
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
}
}
public void removeFromCultureCriteriaAnswers (CultureCriteriaAnswer elementToRemove) throws StorageException
{
if (_CultureCriteriaAnswers.wouldRemoveChange (elementToRemove))
{
assertValid();
Debug.assertion (getWriteability_CultureCriteriaAnswers () != FieldWriteability.FALSE, "MultiAssoc CultureCriteriaAnswers is not writeable (remove)");
_CultureCriteriaAnswers.removeElement (elementToRemove);
try
{
if (elementToRemove.getJobApplication () != null)
{
elementToRemove.setJobApplication (null);
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
}
}
public CultureCriteriaAnswer getCultureCriteriaAnswersAt (int index) throws StorageException
{
return (CultureCriteriaAnswer)(_CultureCriteriaAnswers.getElementAt (index));
}
public SortedSet<CultureCriteriaAnswer> getCultureCriteriaAnswersSet () throws StorageException
{
return _CultureCriteriaAnswers.getSet ();
}
public void onDelete ()
{
try
{
// Ensure we are removed from any loaded multi-associations that aren't mandatory
if (_Candidate.isLoaded () || getTransaction ().isObjectLoaded (_Candidate.getReferencedType (), getCandidateID ()))
{
Candidate referenced = getCandidate ();
if (referenced != null)
{
// Stop the callback
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null JobApplications from ", getObjectID (), " to ", referenced.getObjectID ());
_Candidate.set (null);
referenced.removeFromJobApplications ((JobApplication)this);
}
}
// Ensure we are removed from any loaded multi-associations that aren't mandatory
if (_Job.isLoaded () || getTransaction ().isObjectLoaded (_Job.getReferencedType (), getJobID ()))
{
Job referenced = getJob ();
if (referenced != null)
{
// Stop the callback
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null JobApplications from ", getObjectID (), " to ", referenced.getObjectID ());
_Job.set (null);
referenced.removeFromJobApplications ((JobApplication)this);
}
}
for(AssessmentCriteriaAnswer referenced : CollectionUtils.reverse(getAssessmentCriteriaAnswersSet()))
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null JobApplication from ", getObjectID (), " to ", referenced.getObjectID ());
referenced.setJobApplication(null);
}
for(CultureCriteriaAnswer referenced : CollectionUtils.reverse(getCultureCriteriaAnswersSet()))
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null JobApplication from ", getObjectID (), " to ", referenced.getObjectID ());
referenced.setJobApplication(null);
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
super.onDelete ();
}
public JobApplication newInstance ()
{
return new JobApplication ();
}
public JobApplication referenceInstance ()
{
return REFERENCE_JobApplication;
}
public JobApplication getInTransaction (ObjectTransaction t) throws StorageException
{
return getJobApplicationByID (t, getObjectID());
}
public BaseBusinessClass dummyInstance ()
{
return DUMMY_JobApplication;
}
public String getBaseSetName ()
{
return "tl_job_application";
}
/**
* This is where an object returns the Persistent sets that will
* store it into the database.
* The should be entered into allSets
*/
public void getPersistentSets (PersistentSetCollection allSets)
{
ObjectStatus myStatus = getStatus ();
PersistentSetStatus myPSetStatus = myStatus.getPSetStatus();
ObjectID myID = getID();
super.getPersistentSets (allSets);
PersistentSet tl_job_applicationPSet = allSets.getPersistentSet (myID, "tl_job_application", myPSetStatus);
tl_job_applicationPSet.setAttrib (FIELD_ObjectID, myID);
tl_job_applicationPSet.setAttrib (FIELD_CV, HELPER_CV.toObject (_CV)); //
_Candidate.getPersistentSets (allSets);
_Job.getPersistentSets (allSets);
}
/**
* Sets the objects state based on Persistent sets.
*/
public void setFromPersistentSets (ObjectID objectID, PersistentSetCollection allSets)
{
super.setFromPersistentSets (objectID, allSets);
PersistentSet tl_job_applicationPSet = allSets.getPersistentSet (objectID, "tl_job_application");
_CV = (BinaryContent)(HELPER_CV.fromObject (_CV, tl_job_applicationPSet.getAttrib (FIELD_CV))); //
_Candidate.setFromPersistentSets (objectID, allSets);
_Job.setFromPersistentSets (objectID, allSets);
}
public void setAttributesFrom (BaseBusinessClass other, MultiException e)
{
super.setAttributesFrom (other, e);
if (other instanceof JobApplication)
{
JobApplication otherJobApplication = (JobApplication)other;
try
{
setCV (otherJobApplication.getCV ());
}
catch (FieldException ex)
{
e.addException (ex);
}
}
}
/**
* Set the attributes in this to copies of the attributes in source.
*/
public void copyAttributesFrom (BaseBusinessClass source)
{
super.copyAttributesFrom (source);
if (source instanceof BaseJobApplication)
{
BaseJobApplication sourceJobApplication = (BaseJobApplication)(source);
_CV = sourceJobApplication._CV;
}
}
/**
* Set the associations in this to copies of the attributes in source.
*/
public void copySingleAssociationsFrom (BaseBusinessClass source, boolean linkToGhosts)
{
super.copySingleAssociationsFrom (source, linkToGhosts);
if (source instanceof BaseJobApplication)
{
BaseJobApplication sourceJobApplication = (BaseJobApplication)(source);
_Candidate.copyFrom (sourceJobApplication._Candidate, linkToGhosts);
_Job.copyFrom (sourceJobApplication._Job, linkToGhosts);
}
}
/**
* Set the associations in this to copies of the attributes in source.
*/
public void copyAssociationsFrom (BaseBusinessClass source, boolean linkToGhosts)
{
super.copyAssociationsFrom (source, linkToGhosts);
if (source instanceof BaseJobApplication)
{
BaseJobApplication sourceJobApplication = (BaseJobApplication)(source);
_AssessmentCriteriaAnswers.copyFrom (sourceJobApplication._AssessmentCriteriaAnswers, linkToGhosts);
_CultureCriteriaAnswers.copyFrom (sourceJobApplication._CultureCriteriaAnswers, linkToGhosts);
}
}
public void validate (ValidationContext context)
{
super.validate (context);
}
/**
* Subclasses must override this to read in their attributes
*/
protected void readExternalData(Map<String, Object> vals) throws IOException, ClassNotFoundException
{
super.readExternalData(vals);
_CV = (BinaryContent)(HELPER_CV.readExternal (_CV, vals.get(FIELD_CV))); //
_Candidate.readExternalData(vals.get(SINGLEREFERENCE_Candidate));
_Job.readExternalData(vals.get(SINGLEREFERENCE_Job));
_AssessmentCriteriaAnswers.readExternalData(vals.get(MULTIPLEREFERENCE_AssessmentCriteriaAnswers));
_CultureCriteriaAnswers.readExternalData(vals.get(MULTIPLEREFERENCE_CultureCriteriaAnswers));
}
/**
* Subclasses must override this to write out their attributes
*/
protected void writeExternalData(Map<String, Object> vals) throws IOException
{
super.writeExternalData(vals);
vals.put (FIELD_CV, HELPER_CV.writeExternal (_CV));
vals.put (SINGLEREFERENCE_Candidate, _Candidate.writeExternalData());
vals.put (SINGLEREFERENCE_Job, _Job.writeExternalData());
vals.put (MULTIPLEREFERENCE_AssessmentCriteriaAnswers, _AssessmentCriteriaAnswers.writeExternalData());
vals.put (MULTIPLEREFERENCE_CultureCriteriaAnswers, _CultureCriteriaAnswers.writeExternalData());
}
public void compare (BaseBusinessClass other, AttributeChangeListener listener) throws StorageException
{
super.compare (other, listener);
if (other instanceof BaseJobApplication)
{
BaseJobApplication otherJobApplication = (BaseJobApplication)(other);
if (!HELPER_CV.compare(this._CV, otherJobApplication._CV))
{
listener.notifyFieldChange(this, other, FIELD_CV, HELPER_CV.toObject(this._CV), HELPER_CV.toObject(otherJobApplication._CV));
}
// Compare single assocs
_Candidate.compare (otherJobApplication._Candidate, listener);
_Job.compare (otherJobApplication._Job, listener);
// Compare multiple assocs
_AssessmentCriteriaAnswers.compare (otherJobApplication._AssessmentCriteriaAnswers, listener);
_CultureCriteriaAnswers.compare (otherJobApplication._CultureCriteriaAnswers, listener);
}
}
public void visitTransients (AttributeVisitor visitor) throws StorageException
{
super.visitAttributes (visitor);
}
public void visitAttributes (AttributeVisitor visitor) throws StorageException
{
super.visitAttributes (visitor);
visitor.visitField(this, FIELD_CV, HELPER_CV.toObject(getCV()));
visitor.visitAssociation (_Candidate);
visitor.visitAssociation (_Job);
visitor.visitAssociation (_AssessmentCriteriaAnswers);
visitor.visitAssociation (_CultureCriteriaAnswers);
}
public void visitAssociations (AssociationVisitor visitor, AssociatedScope scope) throws StorageException
{
super.visitAssociations (visitor, scope);
if (scope.includes (_Candidate))
{
visitor.visit (_Candidate);
}
if (scope.includes (_Job))
{
visitor.visit (_Job);
}
if (scope.includes (_AssessmentCriteriaAnswers))
{
visitor.visit (_AssessmentCriteriaAnswers);
}
if (scope.includes (_CultureCriteriaAnswers))
{
visitor.visit (_CultureCriteriaAnswers);
}
}
public static JobApplication createJobApplication (ObjectTransaction transaction) throws StorageException
{
JobApplication result = new JobApplication ();
result.initialiseNewObject (transaction);
return result;
}
public static JobApplication getJobApplicationByID (ObjectTransaction transaction, Long objectID) throws StorageException
{
return (JobApplication)(transaction.getObjectByID (REFERENCE_JobApplication, objectID));
}
public boolean testFilter (String attribName, QueryFilter filter) throws StorageException
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_CV))
{
return filter.matches (getCV ());
}
else if (attribName.equals (SINGLEREFERENCE_Candidate))
{
return filter.matches (getCandidate ());
}
else if (attribName.equals (SINGLEREFERENCE_Job))
{
return filter.matches (getJob ());
}
else
{
return super.testFilter (attribName, filter);
}
}
public static SearchAll SearchByAll () { return new SearchAll (); }
public static class SearchAll extends SearchObject<JobApplication>
{
public SearchAll andObjectID (QueryFilter<Long> filter)
{
filter.addFilter (context, "tl_job_application.object_id", FIELD_ObjectID);
return this;
}
public SearchAll andObjectCreated (QueryFilter<Date> filter)
{
filter.addFilter (context, "tl_job_application.object_created_date", FIELD_ObjectCreated);
return this;
}
public SearchAll andObjectLastModified (QueryFilter<Date> filter)
{
filter.addFilter (context, "tl_job_application.object_last_updated_date", FIELD_ObjectLastModified);
return this;
}
public SearchAll andCV (QueryFilter<BinaryContent> filter)
{
filter.addFilter (context, "tl_job_application.cv", "CV");
return this;
}
public SearchAll andCandidate (QueryFilter<Candidate> filter)
{
filter.addFilter (context, "tl_job_application.candidate_id", "Candidate");
return this;
}
public SearchAll andJob (QueryFilter<Job> filter)
{
filter.addFilter (context, "tl_job_application.job_id", "Job");
return this;
}
public JobApplication[]
search (ObjectTransaction transaction) throws StorageException
{
BaseBusinessClass[] results = super.search (transaction, REFERENCE_JobApplication, SEARCH_All, criteria);
Set<JobApplication> typedResults = new LinkedHashSet <JobApplication> ();
for (BaseBusinessClass bbcResult : results)
{
JobApplication aResult = (JobApplication)bbcResult;
typedResults.add (aResult);
}
return ObjstoreUtils.removeDeleted(transaction, typedResults).toArray (new JobApplication[0]);
}
}
public static JobApplication[]
searchAll (ObjectTransaction transaction) throws StorageException
{
return SearchByAll ()
.search (transaction);
}
public Object getAttribute (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_CV))
{
return HELPER_CV.toObject (getCV ());
}
else
{
return super.getAttribute (attribName);
}
}
public AttributeHelper getAttributeHelper (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_CV))
{
return HELPER_CV;
}
else
{
return super.getAttributeHelper (attribName);
}
}
public void setAttribute (String attribName, Object attribValue) throws FieldException
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_CV))
{
setCV ((BinaryContent)(HELPER_CV.fromObject (_CV, attribValue)));
}
else
{
super.setAttribute (attribName, attribValue);
}
}
public boolean isWriteable (String fieldName)
{
return getWriteable (fieldName) == FieldWriteability.TRUE;
}
public FieldWriteability getWriteable (String fieldName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (fieldName.equals (FIELD_CV))
{
return getWriteability_CV ();
}
else if (fieldName.equals (MULTIPLEREFERENCE_AssessmentCriteriaAnswers))
{
return getWriteability_AssessmentCriteriaAnswers ();
}
else if (fieldName.equals (MULTIPLEREFERENCE_CultureCriteriaAnswers))
{
return getWriteability_CultureCriteriaAnswers ();
}
else if (fieldName.equals (SINGLEREFERENCE_Candidate))
{
return getWriteability_Candidate ();
}
else if (fieldName.equals (SINGLEREFERENCE_Job))
{
return getWriteability_Job ();
}
else
{
return super.getWriteable (fieldName);
}
}
public void putUnwriteable (Set<String> fields)
{
if (getWriteability_CV () != FieldWriteability.TRUE)
{
fields.add (FIELD_CV);
}
super.putUnwriteable (fields);
}
public List<AbstractAttribute> getAttributes ()
{
List result = super.getAttributes ();
result.add(HELPER_CV.getAttribObject (getClass (), _CV, false, FIELD_CV));
return result;
}
public Map getAttributeMetadata (String attribute)
{
if (ATTRIBUTES_METADATA_JobApplication.containsKey (attribute))
{
return (Map)ATTRIBUTES_METADATA_JobApplication.get (attribute);
}
else
{
return super.getAttributeMetadata (attribute);
}
}
public Object getAttributeMetadata (String attribute, String metadata)
{
if (ATTRIBUTES_METADATA_JobApplication.containsKey (attribute))
{
return ((Map)ATTRIBUTES_METADATA_JobApplication.get (attribute)).get(metadata);
}
else
{
return super.getAttributeMetadata (attribute, metadata);
}
}
public void preCommit (boolean willBeStored) throws Exception
{
super.preCommit(willBeStored);
if(willBeStored)
{
{
oneit.servlets.objstore.binary.BinaryContentHandler bchandler = oneit.servlets.objstore.binary.BinaryContentServlet.getHandler("loggedin");
if(bchandler != null)
{
bchandler.preCommit(willBeStored, this, "CV");
}
else
{
LogMgr.log(BUSINESS_OBJECTS, LogLevel.SYSTEMWARNING, "Unknown BinaryContentHandler loggedin on attribute CV");
}
}
}
}
public oneit.servlets.objstore.binary.BinaryContentHandler getBinaryContentHandler(String attribName)
{
if(CollectionUtils.equals(attribName, "CV"))
{
return oneit.servlets.objstore.binary.BinaryContentServlet.getHandler("loggedin");
}
return super.getBinaryContentHandler(attribName);
}
public static class JobApplicationBehaviourDecorator extends BaseBusinessClass.BBCBehaviourDecorator<JobApplication>
{
/**
* Get the attribute CV
*/
public BinaryContent getCV (JobApplication obj, BinaryContent original)
{
return original;
}
/**
* Change the value set for attribute CV.
* May modify the field beforehand
* Occurs before validation.
*/
public BinaryContent setCV (JobApplication obj, BinaryContent newCV) throws FieldException
{
return newCV;
}
}
public ORMPipeLine pipes()
{
return new JobApplicationPipeLineFactory<JobApplication, JobApplication> ((JobApplication)this);
}
/**
* Use this instead of pipes() to get rid of type casting.
*/
public JobApplicationPipeLineFactory<JobApplication, JobApplication> pipelineJobApplication()
{
return (JobApplicationPipeLineFactory<JobApplication, JobApplication>) pipes();
}
public static JobApplicationPipeLineFactory<JobApplication, JobApplication> pipesJobApplication(Collection<JobApplication> items)
{
return REFERENCE_JobApplication.new JobApplicationPipeLineFactory<JobApplication, JobApplication> (items);
}
public static JobApplicationPipeLineFactory<JobApplication, JobApplication> pipesJobApplication(JobApplication[] _items)
{
return pipesJobApplication(Arrays.asList (_items));
}
public static JobApplicationPipeLineFactory<JobApplication, JobApplication> pipesJobApplication()
{
return pipesJobApplication((Collection)null);
}
public class JobApplicationPipeLineFactory<From extends BaseBusinessClass, Me extends JobApplication> extends BaseBusinessClass.ORMPipeLine<From, Me>
{
public <Prev> JobApplicationPipeLineFactory (PipeLine<From, Prev> pipeLine, Pipe<Prev, Me> nextPipe)
{
super (pipeLine, nextPipe);
}
public JobApplicationPipeLineFactory (From seed)
{
super(seed);
}
public JobApplicationPipeLineFactory (Collection<From> seed)
{
super(seed);
}
public PipeLine<From, ? extends Object> to(String name)
{
if (name.equals ("AssessmentCriteriaAnswers"))
{
return toAssessmentCriteriaAnswers ();
}
if (name.equals ("CultureCriteriaAnswers"))
{
return toCultureCriteriaAnswers ();
}
if (name.equals ("CV"))
{
return toCV ();
}
if (name.equals ("Candidate"))
{
return toCandidate ();
}
if (name.equals ("Job"))
{
return toJob ();
}
return super.to(name);
}
public PipeLine<From, BinaryContent> toCV () { return pipe(new ORMAttributePipe<Me, BinaryContent>(FIELD_CV)); }
public Candidate.CandidatePipeLineFactory<From, Candidate> toCandidate () { return toCandidate (Filter.ALL); }
public Candidate.CandidatePipeLineFactory<From, Candidate> toCandidate (Filter<Candidate> filter)
{
return Candidate.REFERENCE_Candidate.new CandidatePipeLineFactory<From, Candidate> (this, new ORMSingleAssocPipe<Me, Candidate>(SINGLEREFERENCE_Candidate, filter));
}
public Job.JobPipeLineFactory<From, Job> toJob () { return toJob (Filter.ALL); }
public Job.JobPipeLineFactory<From, Job> toJob (Filter<Job> filter)
{
return Job.REFERENCE_Job.new JobPipeLineFactory<From, Job> (this, new ORMSingleAssocPipe<Me, Job>(SINGLEREFERENCE_Job, filter));
}
public AssessmentCriteriaAnswer.AssessmentCriteriaAnswerPipeLineFactory<From, AssessmentCriteriaAnswer> toAssessmentCriteriaAnswers () { return toAssessmentCriteriaAnswers(Filter.ALL); }
public AssessmentCriteriaAnswer.AssessmentCriteriaAnswerPipeLineFactory<From, AssessmentCriteriaAnswer> toAssessmentCriteriaAnswers (Filter<AssessmentCriteriaAnswer> filter)
{
return AssessmentCriteriaAnswer.REFERENCE_AssessmentCriteriaAnswer.new AssessmentCriteriaAnswerPipeLineFactory<From, AssessmentCriteriaAnswer> (this, new ORMMultiAssocPipe<Me, AssessmentCriteriaAnswer>(MULTIPLEREFERENCE_AssessmentCriteriaAnswers, filter));
}
public CultureCriteriaAnswer.CultureCriteriaAnswerPipeLineFactory<From, CultureCriteriaAnswer> toCultureCriteriaAnswers () { return toCultureCriteriaAnswers(Filter.ALL); }
public CultureCriteriaAnswer.CultureCriteriaAnswerPipeLineFactory<From, CultureCriteriaAnswer> toCultureCriteriaAnswers (Filter<CultureCriteriaAnswer> filter)
{
return CultureCriteriaAnswer.REFERENCE_CultureCriteriaAnswer.new CultureCriteriaAnswerPipeLineFactory<From, CultureCriteriaAnswer> (this, new ORMMultiAssocPipe<Me, CultureCriteriaAnswer>(MULTIPLEREFERENCE_CultureCriteriaAnswers, filter));
}
}
public boolean isTransientAttrib(String attribName)
{
return super.isTransientAttrib(attribName);
}
public boolean isTransientSingleReference(String assocName)
{
return super.isTransientSingleReference(assocName);
}
}
class DummyJobApplication extends JobApplication
{
// Default constructor primarily to support Externalisable
public DummyJobApplication()
{
super();
}
public void assertValid ()
{
}
public Candidate getCandidate () throws StorageException
{
return (Candidate)(Candidate.DUMMY_Candidate);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getCandidateID ()
{
return Candidate.DUMMY_Candidate.getObjectID();
}
public Job getJob () throws StorageException
{
return (Job)(Job.DUMMY_Job);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getJobID ()
{
return Job.DUMMY_Job.getObjectID();
}
public int getAssessmentCriteriaAnswersCount () throws StorageException
{
return 0;
}
public AssessmentCriteriaAnswer getAssessmentCriteriaAnswersAt (int index) throws StorageException
{
throw new RuntimeException ("No elements in a dummy object in association AssessmentCriteriaAnswers");
}
public SortedSet getAssessmentCriteriaAnswersSet () throws StorageException
{
return new TreeSet();
}
public int getCultureCriteriaAnswersCount () throws StorageException
{
return 0;
}
public CultureCriteriaAnswer getCultureCriteriaAnswersAt (int index) throws StorageException
{
throw new RuntimeException ("No elements in a dummy object in association CultureCriteriaAnswers");
}
public SortedSet getCultureCriteriaAnswersSet () throws StorageException
{
return new TreeSet();
}
}
...@@ -4,8 +4,9 @@ ...@@ -4,8 +4,9 @@
<BUSINESSCLASS name="Candidate" package="performa.orm"> <BUSINESSCLASS name="Candidate" package="performa.orm">
<MULTIPLEREFERENCE name="TestAnalysises" type="TestAnalysis" backreferenceName="Candidate" /> <MULTIPLEREFERENCE name="TestAnalysises" type="TestAnalysis" backreferenceName="Candidate" />
<MULTIPLEREFERENCE name="Answers" type="Answer" backreferenceName="Candidate" /> <MULTIPLEREFERENCE name="Answers" type="Answer" backreferenceName="Candidate" />
<MULTIPLEREFERENCE name="JobApplications" type="JobApplication" backreferenceName="Candidate" />
<TABLE name="tl_candidate" tablePrefix="object" polymorphic="FALSE"> <TABLE name="tl_candidate" tablePrefix="object" polymorphic="FALSE">
......
package performa.orm;
public class CultureCriteria extends BaseCultureCriteria
{
private static final long serialVersionUID = 0L;
// This constructor should not be called
public CultureCriteria ()
{
// Do not add any code to this, always put it in initialiseNewObject
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='http://www.oneit.com.au/schemas/5.2/BusinessObject.xsd'>
<BUSINESSCLASS name="CultureCriteria" package="performa.orm">
<IMPORT value="performa.orm.types.*"/>
<TABLE name="tl_culture_criteria" tablePrefix="object" polymorphic="FALSE">
<ATTRIB name="Importance" type="Importance" dbcol="importance" attribHelper="EnumeratedAttributeHelper" />
<SINGLEREFERENCE name="CultureElement" type="CultureElement" dbcol="culture_element_id"/>
<SINGLEREFERENCE name="CultureElementRating" type="CultureElementRating" dbcol="culture_element_rating_id"/>
<SINGLEREFERENCE name="Job" type="Job" dbcol="job_id" backreferenceName="CultureCriterias"/>
</TABLE>
<SEARCH type="All" paramFilter="tl_culture_criteria.object_id is not null" orderBy="tl_culture_criteria.object_id" />
</BUSINESSCLASS>
</ROOT>
\ No newline at end of file
package performa.orm;
public class CultureCriteriaAnswer extends BaseCultureCriteriaAnswer
{
private static final long serialVersionUID = 0L;
// This constructor should not be called
public CultureCriteriaAnswer ()
{
// Do not add any code to this, always put it in initialiseNewObject
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='http://www.oneit.com.au/schemas/5.2/BusinessObject.xsd'>
<BUSINESSCLASS name="CultureCriteriaAnswer" package="performa.orm">
<TABLE name="tl_culture_criteria_answer" tablePrefix="object" polymorphic="FALSE">
<SINGLEREFERENCE name="CultureCriteria" type="CultureCriteria" dbcol="culture_criteria_id"/>
<SINGLEREFERENCE name="SelectedQuestion" type="CultureElementQuestion" dbcol="selected_question_id"/>
<SINGLEREFERENCE name="JobApplication" type="JobApplication" dbcol="job_application_id" backreferenceName="CultureCriteriaAnswers"/>
</TABLE>
<SEARCH type="All" paramFilter="tl_culture_criteria_answer.object_id is not null" orderBy="tl_culture_criteria_answer.object_id" />
</BUSINESSCLASS>
</ROOT>
\ No newline at end of file
package performa.orm;
import java.io.*;
import java.util.*;
import java.sql.ResultSet;
import java.sql.SQLException;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.objstore.assocs.*;
import oneit.objstore.rdbms.*;
import oneit.objstore.utils.*;
import oneit.sql.*;
import oneit.utils.resource.*;
import oneit.utils.*;
import oneit.utils.threading.*;
/**
* IMPORTANT!!!! Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2[oneit.objstore.PersistenceMgrTemplate.xsl]
*/
public class CultureCriteriaAnswerPersistenceMgr extends ObjectPersistenceMgr
{
private static final LoggingArea CultureCriteriaAnswerPersistence = LoggingArea.createLoggingArea(ObjectPersistenceMgr.OBJECT_PERSISTENCE, "CultureCriteriaAnswer");
// Private attributes corresponding to business object data
// Static constants corresponding to attribute helpers
public CultureCriteriaAnswerPersistenceMgr ()
{
}
private String SELECT_COLUMNS = "{PREFIX}tl_culture_criteria_answer.object_id as id, {PREFIX}tl_culture_criteria_answer.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_culture_criteria_answer.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_culture_criteria_answer.culture_criteria_id, {PREFIX}tl_culture_criteria_answer.selected_question_id, {PREFIX}tl_culture_criteria_answer.job_application_id, 1 AS commasafe ";
private String SELECT_JOINS = "";
public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
Set<BaseBusinessClass> resultByIDs = fetchByIDs(Collections.singleton (id), allPSets, context, sqlMgr);
if (resultByIDs.isEmpty ())
{
return null;
}
else if (resultByIDs.size () > 1)
{
throw new StorageException ("Multiple results for id:" + id);
}
else
{
return resultByIDs.iterator ().next ();
}
}
public Set<BaseBusinessClass> fetchByIDs(Set<ObjectID> ids, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
Set<BaseBusinessClass> results = new HashSet ();
Set<Long> idsToFetch = new HashSet ();
for (ObjectID id : ids)
{
if (context.containsObject(id)) // Check for cached version
{
BaseBusinessClass objectToReturn = context.getObjectToReplace(id, CultureCriteriaAnswer.REFERENCE_CultureCriteriaAnswer);
if (objectToReturn instanceof CultureCriteriaAnswer)
{
LogMgr.log (CultureCriteriaAnswerPersistence, LogLevel.TRACE, "Cache hit for id:", id);
results.add (objectToReturn);
}
else
{
throw new StorageException ("Cache collision for id:" + id + " with object " + objectToReturn + "while fetching a CultureCriteriaAnswer");
}
}
PersistentSet tl_culture_criteria_answerPSet = allPSets.getPersistentSet(id, "tl_culture_criteria_answer", PersistentSetStatus.FETCHED);
// Check for persistent sets already prefetched
if (false || !tl_culture_criteria_answerPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!tl_culture_criteria_answerPSet.containsAttrib(CultureCriteriaAnswer.SINGLEREFERENCE_CultureCriteria)||
!tl_culture_criteria_answerPSet.containsAttrib(CultureCriteriaAnswer.SINGLEREFERENCE_SelectedQuestion)||
!tl_culture_criteria_answerPSet.containsAttrib(CultureCriteriaAnswer.SINGLEREFERENCE_JobApplication))
{
// We will need to retrieve it
idsToFetch.add (id.longValue());
}
else
{
LogMgr.log (CultureCriteriaAnswerPersistence, LogLevel.DEBUG2, "Persistent set preloaded id:", id);
/* Non Polymorphic */
CultureCriteriaAnswer result = new CultureCriteriaAnswer ();
result.setFromPersistentSets(id, allPSets);
context.addRetrievedObject(result);
results.add (result);
}
}
if (idsToFetch.size () > 0)
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_culture_criteria_answer " +
"WHERE " + SELECT_JOINS + "{PREFIX}tl_culture_criteria_answer.object_id IN ?";
BaseBusinessClass[] resultsFetched = loadQuery (allPSets, sqlMgr, context, query, new Object[] { idsToFetch }, null, false);
for (BaseBusinessClass objFetched : resultsFetched)
{
results.add (objFetched);
}
}
return results;
}
public BaseBusinessClass[] getReferencedObjects(ObjectID _objectID, String refName, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
if (false)
{
throw new RuntimeException ();
}
else if (refName.equals (CultureCriteriaAnswer.SINGLEREFERENCE_JobApplication))
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_culture_criteria_answer " +
"WHERE " + SELECT_JOINS + "job_application_id = ?";
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, new Object[] { _objectID.longID () }, null, false);
return results;
}
else
{
throw new IllegalArgumentException ("Illegal reference type:" + refName);
}
}
public void update(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, ConcurrentUpdateConflictException, StorageException
{
EqualityResult test = EqualityResult.compare (obj, obj.getBackup ());
ObjectID objectID = obj.getID ();
if (!test.areAttributesEqual () || !test.areSingleAssocsEqual () || obj.getForcedSave())
{
PersistentSet tl_culture_criteria_answerPSet = allPSets.getPersistentSet(objectID, "tl_culture_criteria_answer");
if (tl_culture_criteria_answerPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_culture_criteria_answerPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}tl_culture_criteria_answer " +
"SET culture_criteria_id = ? , selected_question_id = ? , job_application_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE tl_culture_criteria_answer.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (SQLManager.CheckNull((Long)(tl_culture_criteria_answerPSet.getAttrib (CultureCriteriaAnswer.SINGLEREFERENCE_CultureCriteria)))).listEntry (SQLManager.CheckNull((Long)(tl_culture_criteria_answerPSet.getAttrib (CultureCriteriaAnswer.SINGLEREFERENCE_SelectedQuestion)))).listEntry (SQLManager.CheckNull((Long)(tl_culture_criteria_answerPSet.getAttrib (CultureCriteriaAnswer.SINGLEREFERENCE_JobApplication)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
if (rowsUpdated != 1)
{
// Error, either a concurrency error or a not-exists error
ResultSet r = executeQuery (sqlMgr,
"SELECT object_id, object_LAST_UPDATED_DATE FROM {PREFIX}tl_culture_criteria_answer WHERE object_id = ?",
new Object[] { objectID.longID () });
if (r.next ())
{
Date d = new java.util.Date (r.getTimestamp (2).getTime());
String errorMsg = QueryBuilder.buildQueryString ("Concurrent update error:[?] for row:[?] objDate:[?] dbDate:[?]",
new Object[] { "tl_culture_criteria_answer", objectID.longID (), obj.getObjectLastModified (), d },
sqlMgr.getPortabilityServices ());
LogMgr.log (CultureCriteriaAnswerPersistence, LogLevel.BUSINESS1, errorMsg);
throw new ConcurrentUpdateConflictException (obj, "tl_culture_criteria_answer");
}
else
{
String errorMsg = "Attempt to update nonexistent row in table:tl_culture_criteria_answer for row:" + objectID + " objDate:" + obj.getObjectLastModified ();
LogMgr.log (CultureCriteriaAnswerPersistence, LogLevel.BUSINESS1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
tl_culture_criteria_answerPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
else
{
LogMgr.log (CultureCriteriaAnswerPersistence, LogLevel.DEBUG1, "Skipping update since no attribs or simple assocs changed on ", objectID);
}
}
public void delete(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, ConcurrentUpdateConflictException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet tl_culture_criteria_answerPSet = allPSets.getPersistentSet(objectID, "tl_culture_criteria_answer");
LogMgr.log (CultureCriteriaAnswerPersistence, LogLevel.DEBUG2, "Deleting:", objectID);
if (tl_culture_criteria_answerPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_culture_criteria_answerPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsDeleted = executeStatement (sqlMgr,
"DELETE " +
"FROM {PREFIX}tl_culture_criteria_answer " +
"WHERE tl_culture_criteria_answer.object_id = ? AND " + sqlMgr.getPortabilityServices ().getTruncatedTimestampColumn ("object_LAST_UPDATED_DATE") + " = " + sqlMgr.getPortabilityServices ().getTruncatedTimestampParam("?") + " ",
new Object[] { objectID.longID(), obj.getObjectLastModified () });
if (rowsDeleted != 1)
{
// Error, either a concurrency error or a not-exists error
ResultSet r = executeQuery (sqlMgr,
"SELECT object_id FROM {PREFIX}tl_culture_criteria_answer WHERE object_id = ?",
new Object[] { objectID.longID() });
if (r.next ())
{
throw new ConcurrentUpdateConflictException (obj, "tl_culture_criteria_answer");
}
else
{
String errorMsg = "Attempt to delete nonexistent row in table:tl_culture_criteria_answer for row:" + objectID;
LogMgr.log (CultureCriteriaAnswerPersistence, LogLevel.SYSTEMERROR1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
tl_culture_criteria_answerPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
public ResultSet executeSearchQueryAll (SQLManager sqlMgr) throws SQLException
{
throw new RuntimeException ("NOT implemented: executeSearchQueryAll");
}
public BaseBusinessClass[] loadQuery (PersistentSetCollection allPSets, SQLManager sqlMgr, RDBMSPersistenceContext context, String query, Object[] params, Integer maxRows, boolean truncateExtra) throws SQLException, StorageException
{
LinkedHashMap<ObjectID, CultureCriteriaAnswer> results = new LinkedHashMap ();
ResultSet r = executeQuery (sqlMgr, query, params);
while (r.next())
{
ThreadUtils.checkInterrupted ();
ObjectID objectID = new ObjectID (CultureCriteriaAnswer.REFERENCE_CultureCriteriaAnswer.getObjectIDSpace (), r.getLong ("id"));
CultureCriteriaAnswer resultElement;
if (maxRows != null && !results.containsKey (objectID) && results.size () >= maxRows)
{
if (truncateExtra)
{
break;
}
else
{
throw new SearchRowsExceededException ("Maximum rows exceeded:" + maxRows);
}
}
if (context.containsObject(objectID))
{
BaseBusinessClass cachedElement = context.getObjectToReplace(objectID, CultureCriteriaAnswer.REFERENCE_CultureCriteriaAnswer);
if (cachedElement instanceof CultureCriteriaAnswer)
{
LogMgr.log (CultureCriteriaAnswerPersistence, LogLevel.TRACE, "Cache hit for id:", objectID);
resultElement = (CultureCriteriaAnswer)cachedElement;
}
else
{
throw new StorageException ("Cache collision for id:" + objectID + " with object " + cachedElement + "while fetching a CultureCriteriaAnswer");
}
}
else
{
PersistentSet tl_culture_criteria_answerPSet = allPSets.getPersistentSet(objectID, "tl_culture_criteria_answer", PersistentSetStatus.FETCHED);
createPersistentSetFromRS(allPSets, r, objectID);
resultElement = new CultureCriteriaAnswer ();
resultElement.setFromPersistentSets(objectID, allPSets);
context.addRetrievedObject(resultElement);
}
results.put (objectID, resultElement);
}
BaseBusinessClass[] resultsArr = new BaseBusinessClass[results.size ()];
return results.values ().toArray (resultsArr);
}
public BaseBusinessClass[] find(String searchType, PersistentSetCollection allPSets, Hashtable criteria, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
LogMgr.log (CultureCriteriaAnswerPersistence, LogLevel.DEBUG2, "Search executing:", searchType, " criteria:", criteria);
String customParamFilter = (String)criteria.get (SEARCH_CustomFilter);
String customOrderBy = (String)criteria.get (SEARCH_OrderBy);
String customTables = (String)criteria.get (SEARCH_CustomExtraTables);
Boolean noCommaBeforeCustomExtraTables = (Boolean)criteria.get (SEARCH_CustomExtraTablesNoComma);
if (searchType.equals (SEARCH_CustomSQL))
{
Set<ObjectID> processedIDs = new HashSet();
SearchParamTransform tx = new SearchParamTransform (criteria);
Object[] searchParams;
customParamFilter = StringUtils.replaceParams (customParamFilter, tx);
searchParams = tx.getParamsArray();
if (customOrderBy != null)
{
customOrderBy = " ORDER BY " + customOrderBy;
}
else
{
customOrderBy = "";
}
ResultSet r;
String concatCustomTableWith = CollectionUtils.equals(noCommaBeforeCustomExtraTables, true) ? " " : ", ";
String tables = StringUtils.subBlanks(customTables) == null ? " " : concatCustomTableWith + customTables + " ";
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_culture_criteria_answer " + tables +
"WHERE " + SELECT_JOINS + " " + customParamFilter + customOrderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, null, false);
return results;
}
else if (searchType.equals (CultureCriteriaAnswer.SEARCH_All))
{
// Local scope for transformed variables
{
}
String orderBy = " ORDER BY tl_culture_criteria_answer.object_id";
String tables = " ";
Set<String> joinTableSet = new HashSet<String>();
String filter;
Object[] searchParams; // paramFilter: tl_culture_criteria_answer.object_id is not null
String preFilter = "(tl_culture_criteria_answer.object_id is not null)"
+ " ";
preFilter += context.getLoadingAttributes ().getCustomSQL() ;
SearchParamTransform tx = new SearchParamTransform (criteria);
filter = StringUtils.replaceParams (preFilter, tx);
searchParams = tx.getParamsArray();
Integer maxRows = context.getLoadingAttributes ().getMaxRows ();
boolean truncateExtra = !context.getLoadingAttributes ().isFailIfMaxExceeded();
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_culture_criteria_answer " + tables + tableSetToSQL(joinTableSet) +
"WHERE " + SELECT_JOINS + " " + filter + orderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, maxRows, truncateExtra);
return results;
}
else
{
throw new IllegalArgumentException ("Illegal search type:" + searchType);
}
}
private void createPersistentSetFromRS(PersistentSetCollection allPSets, ResultSet r, ObjectID objectID) throws SQLException
{
PersistentSet tl_culture_criteria_answerPSet = allPSets.getPersistentSet(objectID, "tl_culture_criteria_answer", PersistentSetStatus.FETCHED);
// Object Modified
tl_culture_criteria_answerPSet.setAttrib(BaseBusinessClass.FIELD_ObjectLastModified, r.getTimestamp ("LAST_UPDATED_DATE"));
// Object Created
tl_culture_criteria_answerPSet.setAttrib(BaseBusinessClass.FIELD_ObjectCreated, r.getTimestamp ("CREATED_DATE"));
tl_culture_criteria_answerPSet.setAttrib(CultureCriteriaAnswer.SINGLEREFERENCE_CultureCriteria, r.getObject ("culture_criteria_id"));
tl_culture_criteria_answerPSet.setAttrib(CultureCriteriaAnswer.SINGLEREFERENCE_SelectedQuestion, r.getObject ("selected_question_id"));
tl_culture_criteria_answerPSet.setAttrib(CultureCriteriaAnswer.SINGLEREFERENCE_JobApplication, r.getObject ("job_application_id"));
}
public void create(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet tl_culture_criteria_answerPSet = allPSets.getPersistentSet(objectID, "tl_culture_criteria_answer");
if (tl_culture_criteria_answerPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_culture_criteria_answerPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
executeStatement (sqlMgr,
"INSERT INTO {PREFIX}tl_culture_criteria_answer " +
" ( culture_criteria_id, selected_question_id, job_application_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " +
" ( ?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils .listEntry (SQLManager.CheckNull((Long)(tl_culture_criteria_answerPSet.getAttrib (CultureCriteriaAnswer.SINGLEREFERENCE_CultureCriteria)))).listEntry (SQLManager.CheckNull((Long)(tl_culture_criteria_answerPSet.getAttrib (CultureCriteriaAnswer.SINGLEREFERENCE_SelectedQuestion)))).listEntry (SQLManager.CheckNull((Long)(tl_culture_criteria_answerPSet.getAttrib (CultureCriteriaAnswer.SINGLEREFERENCE_JobApplication)))) .listEntry (objectID.longID ()).toList().toArray());
tl_culture_criteria_answerPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
}
package performa.orm;
import java.io.*;
import java.util.*;
import java.sql.ResultSet;
import java.sql.SQLException;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.objstore.assocs.*;
import oneit.objstore.rdbms.*;
import oneit.objstore.utils.*;
import oneit.sql.*;
import oneit.utils.resource.*;
import oneit.utils.*;
import oneit.utils.threading.*;
import performa.orm.types.*;
/**
* IMPORTANT!!!! Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2[oneit.objstore.PersistenceMgrTemplate.xsl]
*/
public class CultureCriteriaPersistenceMgr extends ObjectPersistenceMgr
{
private static final LoggingArea CultureCriteriaPersistence = LoggingArea.createLoggingArea(ObjectPersistenceMgr.OBJECT_PERSISTENCE, "CultureCriteria");
// Private attributes corresponding to business object data
private Importance dummyImportance;
// Static constants corresponding to attribute helpers
private static final EnumeratedAttributeHelper HELPER_Importance = new EnumeratedAttributeHelper (Importance.FACTORY_Importance);
public CultureCriteriaPersistenceMgr ()
{
dummyImportance = (Importance)(HELPER_Importance.initialise (dummyImportance));
}
private String SELECT_COLUMNS = "{PREFIX}tl_culture_criteria.object_id as id, {PREFIX}tl_culture_criteria.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_culture_criteria.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_culture_criteria.importance, {PREFIX}tl_culture_criteria.culture_element_id, {PREFIX}tl_culture_criteria.culture_element_rating_id, {PREFIX}tl_culture_criteria.job_id, 1 AS commasafe ";
private String SELECT_JOINS = "";
public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
Set<BaseBusinessClass> resultByIDs = fetchByIDs(Collections.singleton (id), allPSets, context, sqlMgr);
if (resultByIDs.isEmpty ())
{
return null;
}
else if (resultByIDs.size () > 1)
{
throw new StorageException ("Multiple results for id:" + id);
}
else
{
return resultByIDs.iterator ().next ();
}
}
public Set<BaseBusinessClass> fetchByIDs(Set<ObjectID> ids, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
Set<BaseBusinessClass> results = new HashSet ();
Set<Long> idsToFetch = new HashSet ();
for (ObjectID id : ids)
{
if (context.containsObject(id)) // Check for cached version
{
BaseBusinessClass objectToReturn = context.getObjectToReplace(id, CultureCriteria.REFERENCE_CultureCriteria);
if (objectToReturn instanceof CultureCriteria)
{
LogMgr.log (CultureCriteriaPersistence, LogLevel.TRACE, "Cache hit for id:", id);
results.add (objectToReturn);
}
else
{
throw new StorageException ("Cache collision for id:" + id + " with object " + objectToReturn + "while fetching a CultureCriteria");
}
}
PersistentSet tl_culture_criteriaPSet = allPSets.getPersistentSet(id, "tl_culture_criteria", PersistentSetStatus.FETCHED);
// Check for persistent sets already prefetched
if (false || !tl_culture_criteriaPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!tl_culture_criteriaPSet.containsAttrib(CultureCriteria.FIELD_Importance)||
!tl_culture_criteriaPSet.containsAttrib(CultureCriteria.SINGLEREFERENCE_CultureElement)||
!tl_culture_criteriaPSet.containsAttrib(CultureCriteria.SINGLEREFERENCE_CultureElementRating)||
!tl_culture_criteriaPSet.containsAttrib(CultureCriteria.SINGLEREFERENCE_Job))
{
// We will need to retrieve it
idsToFetch.add (id.longValue());
}
else
{
LogMgr.log (CultureCriteriaPersistence, LogLevel.DEBUG2, "Persistent set preloaded id:", id);
/* Non Polymorphic */
CultureCriteria result = new CultureCriteria ();
result.setFromPersistentSets(id, allPSets);
context.addRetrievedObject(result);
results.add (result);
}
}
if (idsToFetch.size () > 0)
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_culture_criteria " +
"WHERE " + SELECT_JOINS + "{PREFIX}tl_culture_criteria.object_id IN ?";
BaseBusinessClass[] resultsFetched = loadQuery (allPSets, sqlMgr, context, query, new Object[] { idsToFetch }, null, false);
for (BaseBusinessClass objFetched : resultsFetched)
{
results.add (objFetched);
}
}
return results;
}
public BaseBusinessClass[] getReferencedObjects(ObjectID _objectID, String refName, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
if (false)
{
throw new RuntimeException ();
}
else if (refName.equals (CultureCriteria.SINGLEREFERENCE_Job))
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_culture_criteria " +
"WHERE " + SELECT_JOINS + "job_id = ?";
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, new Object[] { _objectID.longID () }, null, false);
return results;
}
else
{
throw new IllegalArgumentException ("Illegal reference type:" + refName);
}
}
public void update(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, ConcurrentUpdateConflictException, StorageException
{
EqualityResult test = EqualityResult.compare (obj, obj.getBackup ());
ObjectID objectID = obj.getID ();
if (!test.areAttributesEqual () || !test.areSingleAssocsEqual () || obj.getForcedSave())
{
PersistentSet tl_culture_criteriaPSet = allPSets.getPersistentSet(objectID, "tl_culture_criteria");
if (tl_culture_criteriaPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_culture_criteriaPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}tl_culture_criteria " +
"SET importance = ?, culture_element_id = ? , culture_element_rating_id = ? , job_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE tl_culture_criteria.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_Importance.getForSQL(dummyImportance, tl_culture_criteriaPSet.getAttrib (CultureCriteria.FIELD_Importance))).listEntry (SQLManager.CheckNull((Long)(tl_culture_criteriaPSet.getAttrib (CultureCriteria.SINGLEREFERENCE_CultureElement)))).listEntry (SQLManager.CheckNull((Long)(tl_culture_criteriaPSet.getAttrib (CultureCriteria.SINGLEREFERENCE_CultureElementRating)))).listEntry (SQLManager.CheckNull((Long)(tl_culture_criteriaPSet.getAttrib (CultureCriteria.SINGLEREFERENCE_Job)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
if (rowsUpdated != 1)
{
// Error, either a concurrency error or a not-exists error
ResultSet r = executeQuery (sqlMgr,
"SELECT object_id, object_LAST_UPDATED_DATE FROM {PREFIX}tl_culture_criteria WHERE object_id = ?",
new Object[] { objectID.longID () });
if (r.next ())
{
Date d = new java.util.Date (r.getTimestamp (2).getTime());
String errorMsg = QueryBuilder.buildQueryString ("Concurrent update error:[?] for row:[?] objDate:[?] dbDate:[?]",
new Object[] { "tl_culture_criteria", objectID.longID (), obj.getObjectLastModified (), d },
sqlMgr.getPortabilityServices ());
LogMgr.log (CultureCriteriaPersistence, LogLevel.BUSINESS1, errorMsg);
throw new ConcurrentUpdateConflictException (obj, "tl_culture_criteria");
}
else
{
String errorMsg = "Attempt to update nonexistent row in table:tl_culture_criteria for row:" + objectID + " objDate:" + obj.getObjectLastModified ();
LogMgr.log (CultureCriteriaPersistence, LogLevel.BUSINESS1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
tl_culture_criteriaPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
else
{
LogMgr.log (CultureCriteriaPersistence, LogLevel.DEBUG1, "Skipping update since no attribs or simple assocs changed on ", objectID);
}
}
public void delete(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, ConcurrentUpdateConflictException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet tl_culture_criteriaPSet = allPSets.getPersistentSet(objectID, "tl_culture_criteria");
LogMgr.log (CultureCriteriaPersistence, LogLevel.DEBUG2, "Deleting:", objectID);
if (tl_culture_criteriaPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_culture_criteriaPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsDeleted = executeStatement (sqlMgr,
"DELETE " +
"FROM {PREFIX}tl_culture_criteria " +
"WHERE tl_culture_criteria.object_id = ? AND " + sqlMgr.getPortabilityServices ().getTruncatedTimestampColumn ("object_LAST_UPDATED_DATE") + " = " + sqlMgr.getPortabilityServices ().getTruncatedTimestampParam("?") + " ",
new Object[] { objectID.longID(), obj.getObjectLastModified () });
if (rowsDeleted != 1)
{
// Error, either a concurrency error or a not-exists error
ResultSet r = executeQuery (sqlMgr,
"SELECT object_id FROM {PREFIX}tl_culture_criteria WHERE object_id = ?",
new Object[] { objectID.longID() });
if (r.next ())
{
throw new ConcurrentUpdateConflictException (obj, "tl_culture_criteria");
}
else
{
String errorMsg = "Attempt to delete nonexistent row in table:tl_culture_criteria for row:" + objectID;
LogMgr.log (CultureCriteriaPersistence, LogLevel.SYSTEMERROR1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
tl_culture_criteriaPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
public ResultSet executeSearchQueryAll (SQLManager sqlMgr) throws SQLException
{
throw new RuntimeException ("NOT implemented: executeSearchQueryAll");
}
public BaseBusinessClass[] loadQuery (PersistentSetCollection allPSets, SQLManager sqlMgr, RDBMSPersistenceContext context, String query, Object[] params, Integer maxRows, boolean truncateExtra) throws SQLException, StorageException
{
LinkedHashMap<ObjectID, CultureCriteria> results = new LinkedHashMap ();
ResultSet r = executeQuery (sqlMgr, query, params);
while (r.next())
{
ThreadUtils.checkInterrupted ();
ObjectID objectID = new ObjectID (CultureCriteria.REFERENCE_CultureCriteria.getObjectIDSpace (), r.getLong ("id"));
CultureCriteria resultElement;
if (maxRows != null && !results.containsKey (objectID) && results.size () >= maxRows)
{
if (truncateExtra)
{
break;
}
else
{
throw new SearchRowsExceededException ("Maximum rows exceeded:" + maxRows);
}
}
if (context.containsObject(objectID))
{
BaseBusinessClass cachedElement = context.getObjectToReplace(objectID, CultureCriteria.REFERENCE_CultureCriteria);
if (cachedElement instanceof CultureCriteria)
{
LogMgr.log (CultureCriteriaPersistence, LogLevel.TRACE, "Cache hit for id:", objectID);
resultElement = (CultureCriteria)cachedElement;
}
else
{
throw new StorageException ("Cache collision for id:" + objectID + " with object " + cachedElement + "while fetching a CultureCriteria");
}
}
else
{
PersistentSet tl_culture_criteriaPSet = allPSets.getPersistentSet(objectID, "tl_culture_criteria", PersistentSetStatus.FETCHED);
createPersistentSetFromRS(allPSets, r, objectID);
resultElement = new CultureCriteria ();
resultElement.setFromPersistentSets(objectID, allPSets);
context.addRetrievedObject(resultElement);
}
results.put (objectID, resultElement);
}
BaseBusinessClass[] resultsArr = new BaseBusinessClass[results.size ()];
return results.values ().toArray (resultsArr);
}
public BaseBusinessClass[] find(String searchType, PersistentSetCollection allPSets, Hashtable criteria, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
LogMgr.log (CultureCriteriaPersistence, LogLevel.DEBUG2, "Search executing:", searchType, " criteria:", criteria);
String customParamFilter = (String)criteria.get (SEARCH_CustomFilter);
String customOrderBy = (String)criteria.get (SEARCH_OrderBy);
String customTables = (String)criteria.get (SEARCH_CustomExtraTables);
Boolean noCommaBeforeCustomExtraTables = (Boolean)criteria.get (SEARCH_CustomExtraTablesNoComma);
if (searchType.equals (SEARCH_CustomSQL))
{
Set<ObjectID> processedIDs = new HashSet();
SearchParamTransform tx = new SearchParamTransform (criteria);
Object[] searchParams;
customParamFilter = StringUtils.replaceParams (customParamFilter, tx);
searchParams = tx.getParamsArray();
if (customOrderBy != null)
{
customOrderBy = " ORDER BY " + customOrderBy;
}
else
{
customOrderBy = "";
}
ResultSet r;
String concatCustomTableWith = CollectionUtils.equals(noCommaBeforeCustomExtraTables, true) ? " " : ", ";
String tables = StringUtils.subBlanks(customTables) == null ? " " : concatCustomTableWith + customTables + " ";
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_culture_criteria " + tables +
"WHERE " + SELECT_JOINS + " " + customParamFilter + customOrderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, null, false);
return results;
}
else if (searchType.equals (CultureCriteria.SEARCH_All))
{
// Local scope for transformed variables
{
}
String orderBy = " ORDER BY tl_culture_criteria.object_id";
String tables = " ";
Set<String> joinTableSet = new HashSet<String>();
String filter;
Object[] searchParams; // paramFilter: tl_culture_criteria.object_id is not null
String preFilter = "(tl_culture_criteria.object_id is not null)"
+ " ";
preFilter += context.getLoadingAttributes ().getCustomSQL() ;
SearchParamTransform tx = new SearchParamTransform (criteria);
filter = StringUtils.replaceParams (preFilter, tx);
searchParams = tx.getParamsArray();
Integer maxRows = context.getLoadingAttributes ().getMaxRows ();
boolean truncateExtra = !context.getLoadingAttributes ().isFailIfMaxExceeded();
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_culture_criteria " + tables + tableSetToSQL(joinTableSet) +
"WHERE " + SELECT_JOINS + " " + filter + orderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, maxRows, truncateExtra);
return results;
}
else
{
throw new IllegalArgumentException ("Illegal search type:" + searchType);
}
}
private void createPersistentSetFromRS(PersistentSetCollection allPSets, ResultSet r, ObjectID objectID) throws SQLException
{
PersistentSet tl_culture_criteriaPSet = allPSets.getPersistentSet(objectID, "tl_culture_criteria", PersistentSetStatus.FETCHED);
// Object Modified
tl_culture_criteriaPSet.setAttrib(BaseBusinessClass.FIELD_ObjectLastModified, r.getTimestamp ("LAST_UPDATED_DATE"));
// Object Created
tl_culture_criteriaPSet.setAttrib(BaseBusinessClass.FIELD_ObjectCreated, r.getTimestamp ("CREATED_DATE"));
tl_culture_criteriaPSet.setAttrib(CultureCriteria.FIELD_Importance, HELPER_Importance.getFromRS(dummyImportance, r, "importance"));
tl_culture_criteriaPSet.setAttrib(CultureCriteria.SINGLEREFERENCE_CultureElement, r.getObject ("culture_element_id"));
tl_culture_criteriaPSet.setAttrib(CultureCriteria.SINGLEREFERENCE_CultureElementRating, r.getObject ("culture_element_rating_id"));
tl_culture_criteriaPSet.setAttrib(CultureCriteria.SINGLEREFERENCE_Job, r.getObject ("job_id"));
}
public void create(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet tl_culture_criteriaPSet = allPSets.getPersistentSet(objectID, "tl_culture_criteria");
if (tl_culture_criteriaPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_culture_criteriaPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
executeStatement (sqlMgr,
"INSERT INTO {PREFIX}tl_culture_criteria " +
" (importance, culture_element_id, culture_element_rating_id, job_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " +
" (?, ?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_Importance.getForSQL(dummyImportance, tl_culture_criteriaPSet.getAttrib (CultureCriteria.FIELD_Importance))) .listEntry (SQLManager.CheckNull((Long)(tl_culture_criteriaPSet.getAttrib (CultureCriteria.SINGLEREFERENCE_CultureElement)))).listEntry (SQLManager.CheckNull((Long)(tl_culture_criteriaPSet.getAttrib (CultureCriteria.SINGLEREFERENCE_CultureElementRating)))).listEntry (SQLManager.CheckNull((Long)(tl_culture_criteriaPSet.getAttrib (CultureCriteria.SINGLEREFERENCE_Job)))) .listEntry (objectID.longID ()).toList().toArray());
tl_culture_criteriaPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
}
package performa.orm;
public class Job extends BaseJob
{
private static final long serialVersionUID = 0L;
// This constructor should not be called
public Job ()
{
// Do not add any code to this, always put it in initialiseNewObject
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='http://www.oneit.com.au/schemas/5.2/BusinessObject.xsd'>
<BUSINESSCLASS name="Job" package="performa.orm">
<IMPORT value="performa.orm.types.*"/>
<IMPORT value="oneit.security.*"/>
<MULTIPLEREFERENCE name="JobApplications" type="JobApplication" backreferenceName="Job" />
<MULTIPLEREFERENCE name="AssessmentCriterias" type="AssessmentCriteria" backreferenceName="Job" />
<MULTIPLEREFERENCE name="CultureCriterias" type="CultureCriteria" backreferenceName="Job" />
<TABLE name="tl_job" tablePrefix="object" polymorphic="FALSE">
<ATTRIB name="JobTitle" type="String" dbcol="job_title" length="500"/>
<ATTRIB name="JobDescription" type="String" dbcol="job_description"/>
<ATTRIB name="JobStatus" type="JobStatus" dbcol="job_status" attribHelper="EnumeratedAttributeHelper" />
<ATTRIB name="ApplyBy" type="Date" dbcol="apply_by"/>
<ATTRIB name="IncludeAssessmentCriteria" type="Boolean" dbcol="include_assessment_criteria"/>
<ATTRIB name="AssessmentType" type="AssessmentType" dbcol="assessment_type" attribHelper="EnumeratedAttributeHelper" />
<ATTRIB name="JobLink" type="String" dbcol="job_link" length="100"/>
<SINGLEREFERENCE name="Level" type="Level" dbcol="level_id" />
<SINGLEREFERENCE name="SecUser" type="SecUser" dbcol="secuser_id" />
</TABLE>
<SEARCH type="All" paramFilter="tl_job.object_id is not null" orderBy="tl_job.object_id" />
</BUSINESSCLASS>
</ROOT>
\ No newline at end of file
package performa.orm;
public class JobApplication extends BaseJobApplication
{
private static final long serialVersionUID = 0L;
// This constructor should not be called
public JobApplication ()
{
// Do not add any code to this, always put it in initialiseNewObject
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='http://www.oneit.com.au/schemas/5.2/BusinessObject.xsd'>
<BUSINESSCLASS name="JobApplication" package="performa.orm">
<MULTIPLEREFERENCE name="AssessmentCriteriaAnswers" type="AssessmentCriteriaAnswer" backreferenceName="JobApplication" />
<MULTIPLEREFERENCE name="CultureCriteriaAnswers" type="CultureCriteriaAnswer" backreferenceName="JobApplication" />
<TABLE name="tl_job_application" tablePrefix="object" polymorphic="FALSE">
<ATTRIB name="CV" type="BinaryContent" dbcol="cv" binaryHandler="loggedin" attribHelper="BLOBAttributeHelper" attribHelperInstance="BLOBAttributeHelper.INSTANCE"/>
<SINGLEREFERENCE name="Candidate" type="Candidate" dbcol="candidate_id" backreferenceName="JobApplications"/>
<SINGLEREFERENCE name="Job" type="Job" dbcol="job_id" backreferenceName="JobApplications"/>
</TABLE>
<SEARCH type="All" paramFilter="tl_job_application.object_id is not null" orderBy="tl_job_application.object_id" />
</BUSINESSCLASS>
</ROOT>
\ No newline at end of file
package performa.orm;
import java.io.*;
import java.util.*;
import java.sql.ResultSet;
import java.sql.SQLException;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.objstore.assocs.*;
import oneit.objstore.rdbms.*;
import oneit.objstore.utils.*;
import oneit.sql.*;
import oneit.utils.resource.*;
import oneit.utils.*;
import oneit.utils.threading.*;
/**
* IMPORTANT!!!! Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2[oneit.objstore.PersistenceMgrTemplate.xsl]
*/
public class JobApplicationPersistenceMgr extends ObjectPersistenceMgr
{
private static final LoggingArea JobApplicationPersistence = LoggingArea.createLoggingArea(ObjectPersistenceMgr.OBJECT_PERSISTENCE, "JobApplication");
// Private attributes corresponding to business object data
private BinaryContent dummyCV;
// Static constants corresponding to attribute helpers
private static final BLOBAttributeHelper HELPER_CV = BLOBAttributeHelper.INSTANCE;
public JobApplicationPersistenceMgr ()
{
dummyCV = (BinaryContent)(HELPER_CV.initialise (dummyCV));
}
private String SELECT_COLUMNS = "{PREFIX}tl_job_application.object_id as id, {PREFIX}tl_job_application.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_job_application.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_job_application.cv, {PREFIX}tl_job_application.candidate_id, {PREFIX}tl_job_application.job_id, 1 AS commasafe ";
private String SELECT_JOINS = "";
public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
Set<BaseBusinessClass> resultByIDs = fetchByIDs(Collections.singleton (id), allPSets, context, sqlMgr);
if (resultByIDs.isEmpty ())
{
return null;
}
else if (resultByIDs.size () > 1)
{
throw new StorageException ("Multiple results for id:" + id);
}
else
{
return resultByIDs.iterator ().next ();
}
}
public Set<BaseBusinessClass> fetchByIDs(Set<ObjectID> ids, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
Set<BaseBusinessClass> results = new HashSet ();
Set<Long> idsToFetch = new HashSet ();
for (ObjectID id : ids)
{
if (context.containsObject(id)) // Check for cached version
{
BaseBusinessClass objectToReturn = context.getObjectToReplace(id, JobApplication.REFERENCE_JobApplication);
if (objectToReturn instanceof JobApplication)
{
LogMgr.log (JobApplicationPersistence, LogLevel.TRACE, "Cache hit for id:", id);
results.add (objectToReturn);
}
else
{
throw new StorageException ("Cache collision for id:" + id + " with object " + objectToReturn + "while fetching a JobApplication");
}
}
PersistentSet tl_job_applicationPSet = allPSets.getPersistentSet(id, "tl_job_application", PersistentSetStatus.FETCHED);
// Check for persistent sets already prefetched
if (false || !tl_job_applicationPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!tl_job_applicationPSet.containsAttrib(JobApplication.FIELD_CV)||
!tl_job_applicationPSet.containsAttrib(JobApplication.SINGLEREFERENCE_Candidate)||
!tl_job_applicationPSet.containsAttrib(JobApplication.SINGLEREFERENCE_Job))
{
// We will need to retrieve it
idsToFetch.add (id.longValue());
}
else
{
LogMgr.log (JobApplicationPersistence, LogLevel.DEBUG2, "Persistent set preloaded id:", id);
/* Non Polymorphic */
JobApplication result = new JobApplication ();
result.setFromPersistentSets(id, allPSets);
context.addRetrievedObject(result);
results.add (result);
}
}
if (idsToFetch.size () > 0)
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_job_application " +
"WHERE " + SELECT_JOINS + "{PREFIX}tl_job_application.object_id IN ?";
BaseBusinessClass[] resultsFetched = loadQuery (allPSets, sqlMgr, context, query, new Object[] { idsToFetch }, null, false);
for (BaseBusinessClass objFetched : resultsFetched)
{
results.add (objFetched);
}
}
return results;
}
public BaseBusinessClass[] getReferencedObjects(ObjectID _objectID, String refName, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
if (false)
{
throw new RuntimeException ();
}
else if (refName.equals (JobApplication.SINGLEREFERENCE_Candidate))
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_job_application " +
"WHERE " + SELECT_JOINS + "candidate_id = ?";
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, new Object[] { _objectID.longID () }, null, false);
return results;
}
else if (refName.equals (JobApplication.SINGLEREFERENCE_Job))
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_job_application " +
"WHERE " + SELECT_JOINS + "job_id = ?";
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, new Object[] { _objectID.longID () }, null, false);
return results;
}
else
{
throw new IllegalArgumentException ("Illegal reference type:" + refName);
}
}
public void update(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, ConcurrentUpdateConflictException, StorageException
{
EqualityResult test = EqualityResult.compare (obj, obj.getBackup ());
ObjectID objectID = obj.getID ();
if (!test.areAttributesEqual () || !test.areSingleAssocsEqual () || obj.getForcedSave())
{
PersistentSet tl_job_applicationPSet = allPSets.getPersistentSet(objectID, "tl_job_application");
if (tl_job_applicationPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_job_applicationPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}tl_job_application " +
"SET cv = ?, candidate_id = ? , job_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE tl_job_application.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_CV.getForSQL(dummyCV, tl_job_applicationPSet.getAttrib (JobApplication.FIELD_CV))).listEntry (SQLManager.CheckNull((Long)(tl_job_applicationPSet.getAttrib (JobApplication.SINGLEREFERENCE_Candidate)))).listEntry (SQLManager.CheckNull((Long)(tl_job_applicationPSet.getAttrib (JobApplication.SINGLEREFERENCE_Job)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
if (rowsUpdated != 1)
{
// Error, either a concurrency error or a not-exists error
ResultSet r = executeQuery (sqlMgr,
"SELECT object_id, object_LAST_UPDATED_DATE FROM {PREFIX}tl_job_application WHERE object_id = ?",
new Object[] { objectID.longID () });
if (r.next ())
{
Date d = new java.util.Date (r.getTimestamp (2).getTime());
String errorMsg = QueryBuilder.buildQueryString ("Concurrent update error:[?] for row:[?] objDate:[?] dbDate:[?]",
new Object[] { "tl_job_application", objectID.longID (), obj.getObjectLastModified (), d },
sqlMgr.getPortabilityServices ());
LogMgr.log (JobApplicationPersistence, LogLevel.BUSINESS1, errorMsg);
throw new ConcurrentUpdateConflictException (obj, "tl_job_application");
}
else
{
String errorMsg = "Attempt to update nonexistent row in table:tl_job_application for row:" + objectID + " objDate:" + obj.getObjectLastModified ();
LogMgr.log (JobApplicationPersistence, LogLevel.BUSINESS1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
tl_job_applicationPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
else
{
LogMgr.log (JobApplicationPersistence, LogLevel.DEBUG1, "Skipping update since no attribs or simple assocs changed on ", objectID);
}
}
public void delete(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, ConcurrentUpdateConflictException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet tl_job_applicationPSet = allPSets.getPersistentSet(objectID, "tl_job_application");
LogMgr.log (JobApplicationPersistence, LogLevel.DEBUG2, "Deleting:", objectID);
if (tl_job_applicationPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_job_applicationPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsDeleted = executeStatement (sqlMgr,
"DELETE " +
"FROM {PREFIX}tl_job_application " +
"WHERE tl_job_application.object_id = ? AND " + sqlMgr.getPortabilityServices ().getTruncatedTimestampColumn ("object_LAST_UPDATED_DATE") + " = " + sqlMgr.getPortabilityServices ().getTruncatedTimestampParam("?") + " ",
new Object[] { objectID.longID(), obj.getObjectLastModified () });
if (rowsDeleted != 1)
{
// Error, either a concurrency error or a not-exists error
ResultSet r = executeQuery (sqlMgr,
"SELECT object_id FROM {PREFIX}tl_job_application WHERE object_id = ?",
new Object[] { objectID.longID() });
if (r.next ())
{
throw new ConcurrentUpdateConflictException (obj, "tl_job_application");
}
else
{
String errorMsg = "Attempt to delete nonexistent row in table:tl_job_application for row:" + objectID;
LogMgr.log (JobApplicationPersistence, LogLevel.SYSTEMERROR1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
tl_job_applicationPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
public ResultSet executeSearchQueryAll (SQLManager sqlMgr) throws SQLException
{
throw new RuntimeException ("NOT implemented: executeSearchQueryAll");
}
public BaseBusinessClass[] loadQuery (PersistentSetCollection allPSets, SQLManager sqlMgr, RDBMSPersistenceContext context, String query, Object[] params, Integer maxRows, boolean truncateExtra) throws SQLException, StorageException
{
LinkedHashMap<ObjectID, JobApplication> results = new LinkedHashMap ();
ResultSet r = executeQuery (sqlMgr, query, params);
while (r.next())
{
ThreadUtils.checkInterrupted ();
ObjectID objectID = new ObjectID (JobApplication.REFERENCE_JobApplication.getObjectIDSpace (), r.getLong ("id"));
JobApplication resultElement;
if (maxRows != null && !results.containsKey (objectID) && results.size () >= maxRows)
{
if (truncateExtra)
{
break;
}
else
{
throw new SearchRowsExceededException ("Maximum rows exceeded:" + maxRows);
}
}
if (context.containsObject(objectID))
{
BaseBusinessClass cachedElement = context.getObjectToReplace(objectID, JobApplication.REFERENCE_JobApplication);
if (cachedElement instanceof JobApplication)
{
LogMgr.log (JobApplicationPersistence, LogLevel.TRACE, "Cache hit for id:", objectID);
resultElement = (JobApplication)cachedElement;
}
else
{
throw new StorageException ("Cache collision for id:" + objectID + " with object " + cachedElement + "while fetching a JobApplication");
}
}
else
{
PersistentSet tl_job_applicationPSet = allPSets.getPersistentSet(objectID, "tl_job_application", PersistentSetStatus.FETCHED);
createPersistentSetFromRS(allPSets, r, objectID);
resultElement = new JobApplication ();
resultElement.setFromPersistentSets(objectID, allPSets);
context.addRetrievedObject(resultElement);
}
results.put (objectID, resultElement);
}
BaseBusinessClass[] resultsArr = new BaseBusinessClass[results.size ()];
return results.values ().toArray (resultsArr);
}
public BaseBusinessClass[] find(String searchType, PersistentSetCollection allPSets, Hashtable criteria, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
LogMgr.log (JobApplicationPersistence, LogLevel.DEBUG2, "Search executing:", searchType, " criteria:", criteria);
String customParamFilter = (String)criteria.get (SEARCH_CustomFilter);
String customOrderBy = (String)criteria.get (SEARCH_OrderBy);
String customTables = (String)criteria.get (SEARCH_CustomExtraTables);
Boolean noCommaBeforeCustomExtraTables = (Boolean)criteria.get (SEARCH_CustomExtraTablesNoComma);
if (searchType.equals (SEARCH_CustomSQL))
{
Set<ObjectID> processedIDs = new HashSet();
SearchParamTransform tx = new SearchParamTransform (criteria);
Object[] searchParams;
customParamFilter = StringUtils.replaceParams (customParamFilter, tx);
searchParams = tx.getParamsArray();
if (customOrderBy != null)
{
customOrderBy = " ORDER BY " + customOrderBy;
}
else
{
customOrderBy = "";
}
ResultSet r;
String concatCustomTableWith = CollectionUtils.equals(noCommaBeforeCustomExtraTables, true) ? " " : ", ";
String tables = StringUtils.subBlanks(customTables) == null ? " " : concatCustomTableWith + customTables + " ";
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_job_application " + tables +
"WHERE " + SELECT_JOINS + " " + customParamFilter + customOrderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, null, false);
return results;
}
else if (searchType.equals (JobApplication.SEARCH_All))
{
// Local scope for transformed variables
{
}
String orderBy = " ORDER BY tl_job_application.object_id";
String tables = " ";
Set<String> joinTableSet = new HashSet<String>();
String filter;
Object[] searchParams; // paramFilter: tl_job_application.object_id is not null
String preFilter = "(tl_job_application.object_id is not null)"
+ " ";
preFilter += context.getLoadingAttributes ().getCustomSQL() ;
SearchParamTransform tx = new SearchParamTransform (criteria);
filter = StringUtils.replaceParams (preFilter, tx);
searchParams = tx.getParamsArray();
Integer maxRows = context.getLoadingAttributes ().getMaxRows ();
boolean truncateExtra = !context.getLoadingAttributes ().isFailIfMaxExceeded();
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_job_application " + tables + tableSetToSQL(joinTableSet) +
"WHERE " + SELECT_JOINS + " " + filter + orderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, maxRows, truncateExtra);
return results;
}
else
{
throw new IllegalArgumentException ("Illegal search type:" + searchType);
}
}
private void createPersistentSetFromRS(PersistentSetCollection allPSets, ResultSet r, ObjectID objectID) throws SQLException
{
PersistentSet tl_job_applicationPSet = allPSets.getPersistentSet(objectID, "tl_job_application", PersistentSetStatus.FETCHED);
// Object Modified
tl_job_applicationPSet.setAttrib(BaseBusinessClass.FIELD_ObjectLastModified, r.getTimestamp ("LAST_UPDATED_DATE"));
// Object Created
tl_job_applicationPSet.setAttrib(BaseBusinessClass.FIELD_ObjectCreated, r.getTimestamp ("CREATED_DATE"));
tl_job_applicationPSet.setAttrib(JobApplication.FIELD_CV, HELPER_CV.getFromRS(dummyCV, r, "cv"));
tl_job_applicationPSet.setAttrib(JobApplication.SINGLEREFERENCE_Candidate, r.getObject ("candidate_id"));
tl_job_applicationPSet.setAttrib(JobApplication.SINGLEREFERENCE_Job, r.getObject ("job_id"));
}
public void create(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet tl_job_applicationPSet = allPSets.getPersistentSet(objectID, "tl_job_application");
if (tl_job_applicationPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_job_applicationPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
executeStatement (sqlMgr,
"INSERT INTO {PREFIX}tl_job_application " +
" (cv, candidate_id, job_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " +
" (?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_CV.getForSQL(dummyCV, tl_job_applicationPSet.getAttrib (JobApplication.FIELD_CV))) .listEntry (SQLManager.CheckNull((Long)(tl_job_applicationPSet.getAttrib (JobApplication.SINGLEREFERENCE_Candidate)))).listEntry (SQLManager.CheckNull((Long)(tl_job_applicationPSet.getAttrib (JobApplication.SINGLEREFERENCE_Job)))) .listEntry (objectID.longID ()).toList().toArray());
tl_job_applicationPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
}
package performa.orm;
import java.io.*;
import java.util.*;
import java.sql.ResultSet;
import java.sql.SQLException;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.objstore.assocs.*;
import oneit.objstore.rdbms.*;
import oneit.objstore.utils.*;
import oneit.sql.*;
import oneit.utils.resource.*;
import oneit.utils.*;
import oneit.utils.threading.*;
import performa.orm.types.*;
import oneit.security.*;
/**
* IMPORTANT!!!! Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2[oneit.objstore.PersistenceMgrTemplate.xsl]
*/
public class JobPersistenceMgr extends ObjectPersistenceMgr
{
private static final LoggingArea JobPersistence = LoggingArea.createLoggingArea(ObjectPersistenceMgr.OBJECT_PERSISTENCE, "Job");
// Private attributes corresponding to business object data
private String dummyJobTitle;
private String dummyJobDescription;
private JobStatus dummyJobStatus;
private Date dummyApplyBy;
private Boolean dummyIncludeAssessmentCriteria;
private AssessmentType dummyAssessmentType;
private String dummyJobLink;
// Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper HELPER_JobTitle = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_JobDescription = DefaultAttributeHelper.INSTANCE;
private static final EnumeratedAttributeHelper HELPER_JobStatus = new EnumeratedAttributeHelper (JobStatus.FACTORY_JobStatus);
private static final DefaultAttributeHelper HELPER_ApplyBy = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_IncludeAssessmentCriteria = DefaultAttributeHelper.INSTANCE;
private static final EnumeratedAttributeHelper HELPER_AssessmentType = new EnumeratedAttributeHelper (AssessmentType.FACTORY_AssessmentType);
private static final DefaultAttributeHelper HELPER_JobLink = DefaultAttributeHelper.INSTANCE;
public JobPersistenceMgr ()
{
dummyJobTitle = (String)(HELPER_JobTitle.initialise (dummyJobTitle));
dummyJobDescription = (String)(HELPER_JobDescription.initialise (dummyJobDescription));
dummyJobStatus = (JobStatus)(HELPER_JobStatus.initialise (dummyJobStatus));
dummyApplyBy = (Date)(HELPER_ApplyBy.initialise (dummyApplyBy));
dummyIncludeAssessmentCriteria = (Boolean)(HELPER_IncludeAssessmentCriteria.initialise (dummyIncludeAssessmentCriteria));
dummyAssessmentType = (AssessmentType)(HELPER_AssessmentType.initialise (dummyAssessmentType));
dummyJobLink = (String)(HELPER_JobLink.initialise (dummyJobLink));
}
private String SELECT_COLUMNS = "{PREFIX}tl_job.object_id as id, {PREFIX}tl_job.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_job.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_job.job_title, {PREFIX}tl_job.job_description, {PREFIX}tl_job.job_status, {PREFIX}tl_job.apply_by, {PREFIX}tl_job.include_assessment_criteria, {PREFIX}tl_job.assessment_type, {PREFIX}tl_job.job_link, {PREFIX}tl_job.level_id, {PREFIX}tl_job.secuser_id, 1 AS commasafe ";
private String SELECT_JOINS = "";
public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
Set<BaseBusinessClass> resultByIDs = fetchByIDs(Collections.singleton (id), allPSets, context, sqlMgr);
if (resultByIDs.isEmpty ())
{
return null;
}
else if (resultByIDs.size () > 1)
{
throw new StorageException ("Multiple results for id:" + id);
}
else
{
return resultByIDs.iterator ().next ();
}
}
public Set<BaseBusinessClass> fetchByIDs(Set<ObjectID> ids, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
Set<BaseBusinessClass> results = new HashSet ();
Set<Long> idsToFetch = new HashSet ();
for (ObjectID id : ids)
{
if (context.containsObject(id)) // Check for cached version
{
BaseBusinessClass objectToReturn = context.getObjectToReplace(id, Job.REFERENCE_Job);
if (objectToReturn instanceof Job)
{
LogMgr.log (JobPersistence, LogLevel.TRACE, "Cache hit for id:", id);
results.add (objectToReturn);
}
else
{
throw new StorageException ("Cache collision for id:" + id + " with object " + objectToReturn + "while fetching a Job");
}
}
PersistentSet tl_jobPSet = allPSets.getPersistentSet(id, "tl_job", PersistentSetStatus.FETCHED);
// Check for persistent sets already prefetched
if (false || !tl_jobPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!tl_jobPSet.containsAttrib(Job.FIELD_JobTitle)||
!tl_jobPSet.containsAttrib(Job.FIELD_JobDescription)||
!tl_jobPSet.containsAttrib(Job.FIELD_JobStatus)||
!tl_jobPSet.containsAttrib(Job.FIELD_ApplyBy)||
!tl_jobPSet.containsAttrib(Job.FIELD_IncludeAssessmentCriteria)||
!tl_jobPSet.containsAttrib(Job.FIELD_AssessmentType)||
!tl_jobPSet.containsAttrib(Job.FIELD_JobLink)||
!tl_jobPSet.containsAttrib(Job.SINGLEREFERENCE_Level)||
!tl_jobPSet.containsAttrib(Job.SINGLEREFERENCE_SecUser))
{
// We will need to retrieve it
idsToFetch.add (id.longValue());
}
else
{
LogMgr.log (JobPersistence, LogLevel.DEBUG2, "Persistent set preloaded id:", id);
/* Non Polymorphic */
Job result = new Job ();
result.setFromPersistentSets(id, allPSets);
context.addRetrievedObject(result);
results.add (result);
}
}
if (idsToFetch.size () > 0)
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_job " +
"WHERE " + SELECT_JOINS + "{PREFIX}tl_job.object_id IN ?";
BaseBusinessClass[] resultsFetched = loadQuery (allPSets, sqlMgr, context, query, new Object[] { idsToFetch }, null, false);
for (BaseBusinessClass objFetched : resultsFetched)
{
results.add (objFetched);
}
}
return results;
}
public BaseBusinessClass[] getReferencedObjects(ObjectID _objectID, String refName, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
if (false)
{
throw new RuntimeException ();
}
else
{
throw new IllegalArgumentException ("Illegal reference type:" + refName);
}
}
public void update(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, ConcurrentUpdateConflictException, StorageException
{
EqualityResult test = EqualityResult.compare (obj, obj.getBackup ());
ObjectID objectID = obj.getID ();
if (!test.areAttributesEqual () || !test.areSingleAssocsEqual () || obj.getForcedSave())
{
PersistentSet tl_jobPSet = allPSets.getPersistentSet(objectID, "tl_job");
if (tl_jobPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_jobPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}tl_job " +
"SET job_title = ?, job_description = ?, job_status = ?, apply_by = ?, include_assessment_criteria = ?, assessment_type = ?, job_link = ?, level_id = ? , secuser_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE tl_job.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_JobTitle.getForSQL(dummyJobTitle, tl_jobPSet.getAttrib (Job.FIELD_JobTitle))).listEntry (HELPER_JobDescription.getForSQL(dummyJobDescription, tl_jobPSet.getAttrib (Job.FIELD_JobDescription))).listEntry (HELPER_JobStatus.getForSQL(dummyJobStatus, tl_jobPSet.getAttrib (Job.FIELD_JobStatus))).listEntry (HELPER_ApplyBy.getForSQL(dummyApplyBy, tl_jobPSet.getAttrib (Job.FIELD_ApplyBy))).listEntry (HELPER_IncludeAssessmentCriteria.getForSQL(dummyIncludeAssessmentCriteria, tl_jobPSet.getAttrib (Job.FIELD_IncludeAssessmentCriteria))).listEntry (HELPER_AssessmentType.getForSQL(dummyAssessmentType, tl_jobPSet.getAttrib (Job.FIELD_AssessmentType))).listEntry (HELPER_JobLink.getForSQL(dummyJobLink, tl_jobPSet.getAttrib (Job.FIELD_JobLink))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_Level)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_SecUser)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
if (rowsUpdated != 1)
{
// Error, either a concurrency error or a not-exists error
ResultSet r = executeQuery (sqlMgr,
"SELECT object_id, object_LAST_UPDATED_DATE FROM {PREFIX}tl_job WHERE object_id = ?",
new Object[] { objectID.longID () });
if (r.next ())
{
Date d = new java.util.Date (r.getTimestamp (2).getTime());
String errorMsg = QueryBuilder.buildQueryString ("Concurrent update error:[?] for row:[?] objDate:[?] dbDate:[?]",
new Object[] { "tl_job", objectID.longID (), obj.getObjectLastModified (), d },
sqlMgr.getPortabilityServices ());
LogMgr.log (JobPersistence, LogLevel.BUSINESS1, errorMsg);
throw new ConcurrentUpdateConflictException (obj, "tl_job");
}
else
{
String errorMsg = "Attempt to update nonexistent row in table:tl_job for row:" + objectID + " objDate:" + obj.getObjectLastModified ();
LogMgr.log (JobPersistence, LogLevel.BUSINESS1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
tl_jobPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
else
{
LogMgr.log (JobPersistence, LogLevel.DEBUG1, "Skipping update since no attribs or simple assocs changed on ", objectID);
}
}
public void delete(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, ConcurrentUpdateConflictException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet tl_jobPSet = allPSets.getPersistentSet(objectID, "tl_job");
LogMgr.log (JobPersistence, LogLevel.DEBUG2, "Deleting:", objectID);
if (tl_jobPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_jobPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsDeleted = executeStatement (sqlMgr,
"DELETE " +
"FROM {PREFIX}tl_job " +
"WHERE tl_job.object_id = ? AND " + sqlMgr.getPortabilityServices ().getTruncatedTimestampColumn ("object_LAST_UPDATED_DATE") + " = " + sqlMgr.getPortabilityServices ().getTruncatedTimestampParam("?") + " ",
new Object[] { objectID.longID(), obj.getObjectLastModified () });
if (rowsDeleted != 1)
{
// Error, either a concurrency error or a not-exists error
ResultSet r = executeQuery (sqlMgr,
"SELECT object_id FROM {PREFIX}tl_job WHERE object_id = ?",
new Object[] { objectID.longID() });
if (r.next ())
{
throw new ConcurrentUpdateConflictException (obj, "tl_job");
}
else
{
String errorMsg = "Attempt to delete nonexistent row in table:tl_job for row:" + objectID;
LogMgr.log (JobPersistence, LogLevel.SYSTEMERROR1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
tl_jobPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
public ResultSet executeSearchQueryAll (SQLManager sqlMgr) throws SQLException
{
throw new RuntimeException ("NOT implemented: executeSearchQueryAll");
}
public BaseBusinessClass[] loadQuery (PersistentSetCollection allPSets, SQLManager sqlMgr, RDBMSPersistenceContext context, String query, Object[] params, Integer maxRows, boolean truncateExtra) throws SQLException, StorageException
{
LinkedHashMap<ObjectID, Job> results = new LinkedHashMap ();
ResultSet r = executeQuery (sqlMgr, query, params);
while (r.next())
{
ThreadUtils.checkInterrupted ();
ObjectID objectID = new ObjectID (Job.REFERENCE_Job.getObjectIDSpace (), r.getLong ("id"));
Job resultElement;
if (maxRows != null && !results.containsKey (objectID) && results.size () >= maxRows)
{
if (truncateExtra)
{
break;
}
else
{
throw new SearchRowsExceededException ("Maximum rows exceeded:" + maxRows);
}
}
if (context.containsObject(objectID))
{
BaseBusinessClass cachedElement = context.getObjectToReplace(objectID, Job.REFERENCE_Job);
if (cachedElement instanceof Job)
{
LogMgr.log (JobPersistence, LogLevel.TRACE, "Cache hit for id:", objectID);
resultElement = (Job)cachedElement;
}
else
{
throw new StorageException ("Cache collision for id:" + objectID + " with object " + cachedElement + "while fetching a Job");
}
}
else
{
PersistentSet tl_jobPSet = allPSets.getPersistentSet(objectID, "tl_job", PersistentSetStatus.FETCHED);
createPersistentSetFromRS(allPSets, r, objectID);
resultElement = new Job ();
resultElement.setFromPersistentSets(objectID, allPSets);
context.addRetrievedObject(resultElement);
}
results.put (objectID, resultElement);
}
BaseBusinessClass[] resultsArr = new BaseBusinessClass[results.size ()];
return results.values ().toArray (resultsArr);
}
public BaseBusinessClass[] find(String searchType, PersistentSetCollection allPSets, Hashtable criteria, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
LogMgr.log (JobPersistence, LogLevel.DEBUG2, "Search executing:", searchType, " criteria:", criteria);
String customParamFilter = (String)criteria.get (SEARCH_CustomFilter);
String customOrderBy = (String)criteria.get (SEARCH_OrderBy);
String customTables = (String)criteria.get (SEARCH_CustomExtraTables);
Boolean noCommaBeforeCustomExtraTables = (Boolean)criteria.get (SEARCH_CustomExtraTablesNoComma);
if (searchType.equals (SEARCH_CustomSQL))
{
Set<ObjectID> processedIDs = new HashSet();
SearchParamTransform tx = new SearchParamTransform (criteria);
Object[] searchParams;
customParamFilter = StringUtils.replaceParams (customParamFilter, tx);
searchParams = tx.getParamsArray();
if (customOrderBy != null)
{
customOrderBy = " ORDER BY " + customOrderBy;
}
else
{
customOrderBy = "";
}
ResultSet r;
String concatCustomTableWith = CollectionUtils.equals(noCommaBeforeCustomExtraTables, true) ? " " : ", ";
String tables = StringUtils.subBlanks(customTables) == null ? " " : concatCustomTableWith + customTables + " ";
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_job " + tables +
"WHERE " + SELECT_JOINS + " " + customParamFilter + customOrderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, null, false);
return results;
}
else if (searchType.equals (Job.SEARCH_All))
{
// Local scope for transformed variables
{
}
String orderBy = " ORDER BY tl_job.object_id";
String tables = " ";
Set<String> joinTableSet = new HashSet<String>();
String filter;
Object[] searchParams; // paramFilter: tl_job.object_id is not null
String preFilter = "(tl_job.object_id is not null)"
+ " ";
preFilter += context.getLoadingAttributes ().getCustomSQL() ;
SearchParamTransform tx = new SearchParamTransform (criteria);
filter = StringUtils.replaceParams (preFilter, tx);
searchParams = tx.getParamsArray();
Integer maxRows = context.getLoadingAttributes ().getMaxRows ();
boolean truncateExtra = !context.getLoadingAttributes ().isFailIfMaxExceeded();
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_job " + tables + tableSetToSQL(joinTableSet) +
"WHERE " + SELECT_JOINS + " " + filter + orderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, maxRows, truncateExtra);
return results;
}
else
{
throw new IllegalArgumentException ("Illegal search type:" + searchType);
}
}
private void createPersistentSetFromRS(PersistentSetCollection allPSets, ResultSet r, ObjectID objectID) throws SQLException
{
PersistentSet tl_jobPSet = allPSets.getPersistentSet(objectID, "tl_job", PersistentSetStatus.FETCHED);
// Object Modified
tl_jobPSet.setAttrib(BaseBusinessClass.FIELD_ObjectLastModified, r.getTimestamp ("LAST_UPDATED_DATE"));
// Object Created
tl_jobPSet.setAttrib(BaseBusinessClass.FIELD_ObjectCreated, r.getTimestamp ("CREATED_DATE"));
tl_jobPSet.setAttrib(Job.FIELD_JobTitle, HELPER_JobTitle.getFromRS(dummyJobTitle, r, "job_title"));
tl_jobPSet.setAttrib(Job.FIELD_JobDescription, HELPER_JobDescription.getFromRS(dummyJobDescription, r, "job_description"));
tl_jobPSet.setAttrib(Job.FIELD_JobStatus, HELPER_JobStatus.getFromRS(dummyJobStatus, r, "job_status"));
tl_jobPSet.setAttrib(Job.FIELD_ApplyBy, HELPER_ApplyBy.getFromRS(dummyApplyBy, r, "apply_by"));
tl_jobPSet.setAttrib(Job.FIELD_IncludeAssessmentCriteria, HELPER_IncludeAssessmentCriteria.getFromRS(dummyIncludeAssessmentCriteria, r, "include_assessment_criteria"));
tl_jobPSet.setAttrib(Job.FIELD_AssessmentType, HELPER_AssessmentType.getFromRS(dummyAssessmentType, r, "assessment_type"));
tl_jobPSet.setAttrib(Job.FIELD_JobLink, HELPER_JobLink.getFromRS(dummyJobLink, r, "job_link"));
tl_jobPSet.setAttrib(Job.SINGLEREFERENCE_Level, r.getObject ("level_id"));
tl_jobPSet.setAttrib(Job.SINGLEREFERENCE_SecUser, r.getObject ("secuser_id"));
}
public void create(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet tl_jobPSet = allPSets.getPersistentSet(objectID, "tl_job");
if (tl_jobPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_jobPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
executeStatement (sqlMgr,
"INSERT INTO {PREFIX}tl_job " +
" (job_title, job_description, job_status, apply_by, include_assessment_criteria, assessment_type, job_link, level_id, secuser_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " +
" (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_JobTitle.getForSQL(dummyJobTitle, tl_jobPSet.getAttrib (Job.FIELD_JobTitle))).listEntry (HELPER_JobDescription.getForSQL(dummyJobDescription, tl_jobPSet.getAttrib (Job.FIELD_JobDescription))).listEntry (HELPER_JobStatus.getForSQL(dummyJobStatus, tl_jobPSet.getAttrib (Job.FIELD_JobStatus))).listEntry (HELPER_ApplyBy.getForSQL(dummyApplyBy, tl_jobPSet.getAttrib (Job.FIELD_ApplyBy))).listEntry (HELPER_IncludeAssessmentCriteria.getForSQL(dummyIncludeAssessmentCriteria, tl_jobPSet.getAttrib (Job.FIELD_IncludeAssessmentCriteria))).listEntry (HELPER_AssessmentType.getForSQL(dummyAssessmentType, tl_jobPSet.getAttrib (Job.FIELD_AssessmentType))).listEntry (HELPER_JobLink.getForSQL(dummyJobLink, tl_jobPSet.getAttrib (Job.FIELD_JobLink))) .listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_Level)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_SecUser)))) .listEntry (objectID.longID ()).toList().toArray());
tl_jobPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
}
package performa.orm.types;
import java.util.*;
import oneit.utils.*;
/**
* This class was generated using constGen.bat.
* DO NOT MODIFY THIS CODE.
* Edit the associated .xml file, and regenerate this file
* constGen (directory) (file minus extension)
* e.g. constGen C:\...\sql FieldType
*/
public class AssessmentType extends AbstractEnumerated
{
public static final EnumeratedFactory FACTORY_AssessmentType = new AssessmentTypeFactory();
public static final AssessmentType SKILL = new AssessmentType ("SKILL", "SKILL", "Skill", false);
public static final AssessmentType QUALIFICATION = new AssessmentType ("QUALIFICATION", "QUALIFICATION", "Qualification", false);
public static final AssessmentType EXPERIENCE = new AssessmentType ("EXPERIENCE", "EXPERIENCE", "Experience", false);
public static final AssessmentType KNOWLEDGE = new AssessmentType ("KNOWLEDGE", "KNOWLEDGE", "Knowledge", false);
private static final AssessmentType[] allAssessmentTypes =
new AssessmentType[] { SKILL,QUALIFICATION,EXPERIENCE,KNOWLEDGE};
private static AssessmentType[] getAllAssessmentTypes ()
{
return allAssessmentTypes;
}
private AssessmentType (String name, String value, String description, boolean disabled)
{
super (name, value, description, disabled);
}
public static final Comparator COMPARE_BY_POSITION = new CompareEnumByPosition (allAssessmentTypes);
static
{
defineAdditionalData ();
}
public boolean isEqual (AssessmentType other)
{
return this.name.equals (other.name);
}
public Enumeration getAllInstances ()
{
return AssessmentType.getAll ();
}
private Object readResolve() throws java.io.ObjectStreamException
{
return AssessmentType.forName (this.name);
}
public EnumeratedFactory getFactory ()
{
return FACTORY_AssessmentType;
}
public static AssessmentType forName (String name)
{
if (name == null) { return null; }
AssessmentType[] all = getAllAssessmentTypes();
int enumIndex = AbstractEnumerated.getIndexForName (all, name);
return all[enumIndex];
}
public static AssessmentType forValue (String value)
{
if (value == null) { return null; }
AssessmentType[] all = getAllAssessmentTypes();
int enumIndex = AbstractEnumerated.getIndexForValue (getAllAssessmentTypes (), value);
return all[enumIndex];
}
public static java.util.Enumeration getAll ()
{
return AbstractEnumerated.getAll (getAllAssessmentTypes());
}
public static AssessmentType[] getAssessmentTypeArray ()
{
return (AssessmentType[])getAllAssessmentTypes().clone ();
}
public static void defineAdditionalData ()
{
}
static class AssessmentTypeFactory implements EnumeratedFactory
{
public AbstractEnumerated getForName (String name)
{
return AssessmentType.forName (name);
}
public AbstractEnumerated getForValue (String name)
{
return AssessmentType.forValue (name);
}
public Enumeration getAll ()
{
return AssessmentType.getAll ();
}
}
public Map getAdditionalAttributes ()
{
Map attribs = new HashMap ();
return attribs;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<ROOT>
<CONSTANT package="performa.orm.types" name="AssessmentType">
<VALUE name="SKILL" value="SKILL" description="Skill"/>
<VALUE name="QUALIFICATION" value="QUALIFICATION" description="Qualification"/>
<VALUE name="EXPERIENCE" value="EXPERIENCE" description="Experience"/>
<VALUE name="KNOWLEDGE" value="KNOWLEDGE" description="Knowledge"/>
</CONSTANT>
</ROOT>
\ No newline at end of file
package performa.orm.types;
import java.util.*;
import oneit.utils.*;
/**
* This class was generated using constGen.bat.
* DO NOT MODIFY THIS CODE.
* Edit the associated .xml file, and regenerate this file
* constGen (directory) (file minus extension)
* e.g. constGen C:\...\sql FieldType
*/
public class Importance extends AbstractEnumerated
{
public static final EnumeratedFactory FACTORY_Importance = new ImportanceFactory();
public static final Importance ESSENTIAL = new Importance ("ESSENTIAL", "OPEN", "Essential", false);
public static final Importance HIGHLY_DESIRABLE = new Importance ("HIGHLY_DESIRABLE", "HIGHLY_DESIRABLE", "Highly Desirable", false);
public static final Importance DESIRABLE = new Importance ("DESIRABLE", "DESIRABLE", "Desirable", false);
private static final Importance[] allImportances =
new Importance[] { ESSENTIAL,HIGHLY_DESIRABLE,DESIRABLE};
private static Importance[] getAllImportances ()
{
return allImportances;
}
private Importance (String name, String value, String description, boolean disabled)
{
super (name, value, description, disabled);
}
public static final Comparator COMPARE_BY_POSITION = new CompareEnumByPosition (allImportances);
static
{
defineAdditionalData ();
}
public boolean isEqual (Importance other)
{
return this.name.equals (other.name);
}
public Enumeration getAllInstances ()
{
return Importance.getAll ();
}
private Object readResolve() throws java.io.ObjectStreamException
{
return Importance.forName (this.name);
}
public EnumeratedFactory getFactory ()
{
return FACTORY_Importance;
}
public static Importance forName (String name)
{
if (name == null) { return null; }
Importance[] all = getAllImportances();
int enumIndex = AbstractEnumerated.getIndexForName (all, name);
return all[enumIndex];
}
public static Importance forValue (String value)
{
if (value == null) { return null; }
Importance[] all = getAllImportances();
int enumIndex = AbstractEnumerated.getIndexForValue (getAllImportances (), value);
return all[enumIndex];
}
public static java.util.Enumeration getAll ()
{
return AbstractEnumerated.getAll (getAllImportances());
}
public static Importance[] getImportanceArray ()
{
return (Importance[])getAllImportances().clone ();
}
public static void defineAdditionalData ()
{
}
static class ImportanceFactory implements EnumeratedFactory
{
public AbstractEnumerated getForName (String name)
{
return Importance.forName (name);
}
public AbstractEnumerated getForValue (String name)
{
return Importance.forValue (name);
}
public Enumeration getAll ()
{
return Importance.getAll ();
}
}
public Map getAdditionalAttributes ()
{
Map attribs = new HashMap ();
return attribs;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<ROOT>
<CONSTANT package="performa.orm.types" name="Importance">
<VALUE name="ESSENTIAL" value="OPEN" description="Essential"/>
<VALUE name="HIGHLY_DESIRABLE" value="HIGHLY_DESIRABLE" description="Highly Desirable"/>
<VALUE name="DESIRABLE" value="DESIRABLE" description="Desirable"/>
</CONSTANT>
</ROOT>
\ No newline at end of file
package performa.orm.types;
import java.util.*;
import oneit.utils.*;
/**
* This class was generated using constGen.bat.
* DO NOT MODIFY THIS CODE.
* Edit the associated .xml file, and regenerate this file
* constGen (directory) (file minus extension)
* e.g. constGen C:\...\sql FieldType
*/
public class JobStatus extends AbstractEnumerated
{
public static final EnumeratedFactory FACTORY_JobStatus = new JobStatusFactory();
public static final JobStatus OPEN = new JobStatus ("OPEN", "OPEN", "Open", false);
public static final JobStatus COMPLETE = new JobStatus ("COMPLETE", "COMPLETE", "Complete", false);
public static final JobStatus DRAFT = new JobStatus ("DRAFT", "DRAFT", "Draft", false);
private static final JobStatus[] allJobStatuss =
new JobStatus[] { OPEN,COMPLETE,DRAFT};
private static JobStatus[] getAllJobStatuss ()
{
return allJobStatuss;
}
private JobStatus (String name, String value, String description, boolean disabled)
{
super (name, value, description, disabled);
}
public static final Comparator COMPARE_BY_POSITION = new CompareEnumByPosition (allJobStatuss);
static
{
defineAdditionalData ();
}
public boolean isEqual (JobStatus other)
{
return this.name.equals (other.name);
}
public Enumeration getAllInstances ()
{
return JobStatus.getAll ();
}
private Object readResolve() throws java.io.ObjectStreamException
{
return JobStatus.forName (this.name);
}
public EnumeratedFactory getFactory ()
{
return FACTORY_JobStatus;
}
public static JobStatus forName (String name)
{
if (name == null) { return null; }
JobStatus[] all = getAllJobStatuss();
int enumIndex = AbstractEnumerated.getIndexForName (all, name);
return all[enumIndex];
}
public static JobStatus forValue (String value)
{
if (value == null) { return null; }
JobStatus[] all = getAllJobStatuss();
int enumIndex = AbstractEnumerated.getIndexForValue (getAllJobStatuss (), value);
return all[enumIndex];
}
public static java.util.Enumeration getAll ()
{
return AbstractEnumerated.getAll (getAllJobStatuss());
}
public static JobStatus[] getJobStatusArray ()
{
return (JobStatus[])getAllJobStatuss().clone ();
}
public static void defineAdditionalData ()
{
}
static class JobStatusFactory implements EnumeratedFactory
{
public AbstractEnumerated getForName (String name)
{
return JobStatus.forName (name);
}
public AbstractEnumerated getForValue (String name)
{
return JobStatus.forValue (name);
}
public Enumeration getAll ()
{
return JobStatus.getAll ();
}
}
public Map getAdditionalAttributes ()
{
Map attribs = new HashMap ();
return attribs;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<ROOT>
<CONSTANT package="performa.orm.types" name="JobStatus">
<VALUE name="OPEN" value="OPEN" description="Open"/>
<VALUE name="COMPLETE" value="COMPLETE" description="Complete"/>
<VALUE name="DRAFT" value="DRAFT" description="Draft"/>
</CONSTANT>
</ROOT>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun -->
<OBJECTS name="" xmlns:oneit="http://www.1iT.com.au"><NODE name="Script" factory="Vector">
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.DefineTableOperation">
<tableName factory="String">tl_assessment_criteria</tableName>
<column name="object_id" type="Long" nullable="false" length="11"/>
<column name="object_last_updated_date" type="Date" nullable="false" length="22"/>
<column name="object_created_date" type="Date" nullable="false" length="22"/>
<column name="name" type="String" nullable="true" length="200"/>
<column name="importance" type="String" nullable="true" length="200"/>
<column name="assessment_type" type="String" nullable="true" length="200"/>
<column name="job_id" type="Long" length="11" nullable="true"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_assessment_criteria" indexName="idx_tl_assessment_criteria_job_id" isUnique="false"><column name="job_id"/></NODE>
</NODE></OBJECTS>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun -->
<OBJECTS name="" xmlns:oneit="http://www.1iT.com.au"><NODE name="Script" factory="Vector">
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.DefineTableOperation">
<tableName factory="String">tl_assessment_criteria_answer</tableName>
<column name="object_id" type="Long" nullable="false" length="11"/>
<column name="object_last_updated_date" type="Date" nullable="false" length="22"/>
<column name="object_created_date" type="Date" nullable="false" length="22"/>
<column name="answer" type="Boolean" nullable="true"/>
<column name="notes" type="CLOB" nullable="true"/>
<column name="assessment_criteria_id" type="Long" length="11" nullable="true"/>
<column name="job_application_id" type="Long" length="11" nullable="true"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_assessment_criteria_answer" indexName="idx_tl_assessment_criteria_answer_job_application_id" isUnique="false"><column name="job_application_id"/></NODE>
</NODE></OBJECTS>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun -->
<OBJECTS name="" xmlns:oneit="http://www.1iT.com.au"><NODE name="Script" factory="Vector">
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.DefineTableOperation">
<tableName factory="String">tl_culture_criteria</tableName>
<column name="object_id" type="Long" nullable="false" length="11"/>
<column name="object_last_updated_date" type="Date" nullable="false" length="22"/>
<column name="object_created_date" type="Date" nullable="false" length="22"/>
<column name="importance" type="String" nullable="true" length="200"/>
<column name="culture_element_id" type="Long" length="11" nullable="true"/>
<column name="culture_element_rating_id" type="Long" length="11" nullable="true"/>
<column name="job_id" type="Long" length="11" nullable="true"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_culture_criteria" indexName="idx_tl_culture_criteria_job_id" isUnique="false"><column name="job_id"/></NODE>
</NODE></OBJECTS>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun -->
<OBJECTS name="" xmlns:oneit="http://www.1iT.com.au"><NODE name="Script" factory="Vector">
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.DefineTableOperation">
<tableName factory="String">tl_culture_criteria_answer</tableName>
<column name="object_id" type="Long" nullable="false" length="11"/>
<column name="object_last_updated_date" type="Date" nullable="false" length="22"/>
<column name="object_created_date" type="Date" nullable="false" length="22"/>
<column name="culture_criteria_id" type="Long" length="11" nullable="true"/>
<column name="selected_question_id" type="Long" length="11" nullable="true"/>
<column name="job_application_id" type="Long" length="11" nullable="true"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_culture_criteria_answer" indexName="idx_tl_culture_criteria_answer_job_application_id" isUnique="false"><column name="job_application_id"/></NODE>
</NODE></OBJECTS>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun -->
<OBJECTS name="" xmlns:oneit="http://www.1iT.com.au"><NODE name="Script" factory="Vector">
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.DefineTableOperation">
<tableName factory="String">tl_job</tableName>
<column name="object_id" type="Long" nullable="false" length="11"/>
<column name="object_last_updated_date" type="Date" nullable="false" length="22"/>
<column name="object_created_date" type="Date" nullable="false" length="22"/>
<column name="job_title" type="String" nullable="true" length="500"/>
<column name="job_description" type="CLOB" nullable="true"/>
<column name="job_status" type="String" nullable="true" length="200"/>
<column name="apply_by" type="Date" nullable="true"/>
<column name="include_assessment_criteria" type="Boolean" nullable="true"/>
<column name="assessment_type" type="String" nullable="true" length="200"/>
<column name="job_link" type="String" nullable="true" length="100"/>
<column name="level_id" type="Long" length="11" nullable="true"/>
<column name="secuser_id" type="Long" length="11" nullable="true"/>
</NODE>
</NODE></OBJECTS>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun -->
<OBJECTS name="" xmlns:oneit="http://www.1iT.com.au"><NODE name="Script" factory="Vector">
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.DefineTableOperation">
<tableName factory="String">tl_job_application</tableName>
<column name="object_id" type="Long" nullable="false" length="11"/>
<column name="object_last_updated_date" type="Date" nullable="false" length="22"/>
<column name="object_created_date" type="Date" nullable="false" length="22"/>
<column name="cv" type="BLOB" nullable="true"/>
<column name="candidate_id" type="Long" length="11" nullable="true"/>
<column name="job_id" type="Long" length="11" nullable="true"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_job_application" indexName="idx_tl_job_application_candidate_id" isUnique="false"><column name="candidate_id"/></NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_job_application" indexName="idx_tl_job_application_job_id" isUnique="false"><column name="job_id"/></NODE>
</NODE></OBJECTS>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment