Commit 74734ff8 by chenith Committed by Harsh Shah

Updated Answer BO with JobApplication. AnalysisEngine, TestInput and TestAnalysisFP updated.

parent 8c9043a8
......@@ -10,10 +10,10 @@
<column name="object_created_date" type="Date" nullable="false" length="22"/>
<column name="answer_number" type="Long" nullable="true"/>
<column name="section_number" type="Long" length="11" nullable="true"/>
<column name="candidate_id" type="Long" length="11" nullable="true"/>
<column name="job_application_id" type="Long" length="11" nullable="true"/>
<column name="quest_number" type="Long" length="11" nullable="true"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_answer" indexName="idx_tl_answer_candidate_id" isUnique="false"><column name="candidate_id"/></NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_answer" indexName="idx_tl_answer_job_application_id" isUnique="false"><column name="job_application_id"/></NODE>
</NODE></OBJECTS>
\ No newline at end of file
......@@ -10,7 +10,7 @@ CREATE TABLE tl_answer (
,
answer_number numeric(12) NULL,
section_number numeric(12) NULL,
candidate_id numeric(12) NULL,
job_application_id numeric(12) NULL,
quest_number numeric(12) NULL
);
......@@ -24,5 +24,5 @@ ALTER TABLE tl_answer ADD
CREATE INDEX idx_tl_answer_candidate_id
ON tl_answer (candidate_id);
CREATE INDEX idx_tl_answer_job_application_id
ON tl_answer (job_application_id);
......@@ -11,7 +11,7 @@ CREATE TABLE tl_answer (
,
answer_number number(12) NULL,
section_number number(12) NULL,
candidate_id number(12) NULL,
job_application_id number(12) NULL,
quest_number number(12) NULL
);
......@@ -25,5 +25,5 @@ ALTER TABLE tl_answer ADD
CREATE INDEX idx_tl_answer_candidate_id
ON tl_answer (candidate_id);
CREATE INDEX idx_tl_answer_job_application_id
ON tl_answer (job_application_id);
......@@ -11,7 +11,7 @@ CREATE TABLE tl_answer (
,
answer_number numeric(12) NULL,
section_number numeric(12) NULL,
candidate_id numeric(12) NULL,
job_application_id numeric(12) NULL,
quest_number numeric(12) NULL
);
......@@ -25,5 +25,5 @@ ALTER TABLE tl_answer ADD
CREATE INDEX idx_tl_answer_candidate_id
ON tl_answer (candidate_id);
CREATE INDEX idx_tl_answer_job_application_id
ON tl_answer (job_application_id);
......@@ -169,7 +169,8 @@ public class TestAnalysisFP extends ORMProcessFormProcessor
answer.setAnswerNo(Integer.parseInt(values[i]));
answer.setQuestion(question);
testInput.getCandidatesAt(i -1).addToAnswers(answer);
//TODO: UPDATED - MOVE ANSWER FROM CANDIDATE TO JOB_APPLICATION
//testInput.getCandidatesAt(i -1).addToAnswers(answer);
}
}
}
......
......@@ -9,7 +9,7 @@
<ATTRIB name="AnswerNo" type="Integer" dbcol="answer_number"/>
<SINGLEREFERENCE name="Section" type="Section" dbcol="section_number" />
<SINGLEREFERENCE name="Candidate" type="Candidate" dbcol="candidate_id" backreferenceName="Answers"/>
<SINGLEREFERENCE name="JobApplication" type="JobApplication" dbcol="job_application_id" backreferenceName="ProfileAssessmentAnswers"/>
<SINGLEREFERENCE name="Question" type="Question" dbcol="quest_number" />
</TABLE>
......
......@@ -41,7 +41,7 @@ public class AnswerPersistenceMgr extends ObjectPersistenceMgr
}
private String SELECT_COLUMNS = "{PREFIX}tl_answer.object_id as id, {PREFIX}tl_answer.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_answer.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_answer.answer_number, {PREFIX}tl_answer.section_number, {PREFIX}tl_answer.candidate_id, {PREFIX}tl_answer.quest_number, 1 AS commasafe ";
private String SELECT_COLUMNS = "{PREFIX}tl_answer.object_id as id, {PREFIX}tl_answer.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_answer.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_answer.answer_number, {PREFIX}tl_answer.section_number, {PREFIX}tl_answer.job_application_id, {PREFIX}tl_answer.quest_number, 1 AS commasafe ";
private String SELECT_JOINS = "";
public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
......@@ -94,7 +94,7 @@ public class AnswerPersistenceMgr extends ObjectPersistenceMgr
if (false || !tl_answerPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!tl_answerPSet.containsAttrib(Answer.FIELD_AnswerNo)||
!tl_answerPSet.containsAttrib(Answer.SINGLEREFERENCE_Section)||
!tl_answerPSet.containsAttrib(Answer.SINGLEREFERENCE_Candidate)||
!tl_answerPSet.containsAttrib(Answer.SINGLEREFERENCE_JobApplication)||
!tl_answerPSet.containsAttrib(Answer.SINGLEREFERENCE_Question))
{
// We will need to retrieve it
......@@ -141,11 +141,11 @@ public class AnswerPersistenceMgr extends ObjectPersistenceMgr
{
throw new RuntimeException ();
}
else if (refName.equals (Answer.SINGLEREFERENCE_Candidate))
else if (refName.equals (Answer.SINGLEREFERENCE_JobApplication))
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_answer " +
"WHERE " + SELECT_JOINS + "candidate_id = ?";
"WHERE " + SELECT_JOINS + "job_application_id = ?";
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, new Object[] { _objectID.longID () }, null, false);
......@@ -175,10 +175,10 @@ public class AnswerPersistenceMgr extends ObjectPersistenceMgr
{
int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}tl_answer " +
"SET answer_number = ?, section_number = ? , candidate_id = ? , quest_number = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"SET answer_number = ?, section_number = ? , job_application_id = ? , quest_number = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE tl_answer.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_AnswerNo.getForSQL(dummyAnswerNo, tl_answerPSet.getAttrib (Answer.FIELD_AnswerNo))).listEntry (SQLManager.CheckNull((Long)(tl_answerPSet.getAttrib (Answer.SINGLEREFERENCE_Section)))).listEntry (SQLManager.CheckNull((Long)(tl_answerPSet.getAttrib (Answer.SINGLEREFERENCE_Candidate)))).listEntry (SQLManager.CheckNull((Long)(tl_answerPSet.getAttrib (Answer.SINGLEREFERENCE_Question)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
CollectionUtils.listEntry (HELPER_AnswerNo.getForSQL(dummyAnswerNo, tl_answerPSet.getAttrib (Answer.FIELD_AnswerNo))).listEntry (SQLManager.CheckNull((Long)(tl_answerPSet.getAttrib (Answer.SINGLEREFERENCE_Section)))).listEntry (SQLManager.CheckNull((Long)(tl_answerPSet.getAttrib (Answer.SINGLEREFERENCE_JobApplication)))).listEntry (SQLManager.CheckNull((Long)(tl_answerPSet.getAttrib (Answer.SINGLEREFERENCE_Question)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
if (rowsUpdated != 1)
{
......@@ -437,7 +437,7 @@ public class AnswerPersistenceMgr extends ObjectPersistenceMgr
tl_answerPSet.setAttrib(Answer.FIELD_AnswerNo, HELPER_AnswerNo.getFromRS(dummyAnswerNo, r, "answer_number"));
tl_answerPSet.setAttrib(Answer.SINGLEREFERENCE_Section, r.getObject ("section_number"));
tl_answerPSet.setAttrib(Answer.SINGLEREFERENCE_Candidate, r.getObject ("candidate_id"));
tl_answerPSet.setAttrib(Answer.SINGLEREFERENCE_JobApplication, r.getObject ("job_application_id"));
tl_answerPSet.setAttrib(Answer.SINGLEREFERENCE_Question, r.getObject ("quest_number"));
}
......@@ -455,10 +455,10 @@ public class AnswerPersistenceMgr extends ObjectPersistenceMgr
{
executeStatement (sqlMgr,
"INSERT INTO {PREFIX}tl_answer " +
" (answer_number, section_number, candidate_id, quest_number, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
" (answer_number, section_number, job_application_id, quest_number, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " +
" (?, ?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_AnswerNo.getForSQL(dummyAnswerNo, tl_answerPSet.getAttrib (Answer.FIELD_AnswerNo))) .listEntry (SQLManager.CheckNull((Long)(tl_answerPSet.getAttrib (Answer.SINGLEREFERENCE_Section)))).listEntry (SQLManager.CheckNull((Long)(tl_answerPSet.getAttrib (Answer.SINGLEREFERENCE_Candidate)))).listEntry (SQLManager.CheckNull((Long)(tl_answerPSet.getAttrib (Answer.SINGLEREFERENCE_Question)))) .listEntry (objectID.longID ()).toList().toArray());
CollectionUtils.listEntry (HELPER_AnswerNo.getForSQL(dummyAnswerNo, tl_answerPSet.getAttrib (Answer.FIELD_AnswerNo))) .listEntry (SQLManager.CheckNull((Long)(tl_answerPSet.getAttrib (Answer.SINGLEREFERENCE_Section)))).listEntry (SQLManager.CheckNull((Long)(tl_answerPSet.getAttrib (Answer.SINGLEREFERENCE_JobApplication)))).listEntry (SQLManager.CheckNull((Long)(tl_answerPSet.getAttrib (Answer.SINGLEREFERENCE_Question)))) .listEntry (objectID.longID ()).toList().toArray());
tl_answerPSet.setStatus (PersistentSetStatus.PROCESSED);
}
......
......@@ -40,8 +40,8 @@ public abstract class BaseAnswer extends BaseBusinessClass
public static final String FIELD_AnswerNo = "AnswerNo";
public static final String SINGLEREFERENCE_Section = "Section";
public static final String SINGLEREFERENCE_Candidate = "Candidate";
public static final String BACKREF_Candidate = "";
public static final String SINGLEREFERENCE_JobApplication = "JobApplication";
public static final String BACKREF_JobApplication = "";
public static final String SINGLEREFERENCE_Question = "Question";
// Static constants corresponding to searches
......@@ -58,7 +58,7 @@ public abstract class BaseAnswer extends BaseBusinessClass
// Private attributes corresponding to single references
private SingleAssociation<Answer, Section> _Section;
private SingleAssociation<Answer, Candidate> _Candidate;
private SingleAssociation<Answer, JobApplication> _JobApplication;
private SingleAssociation<Answer, Question> _Question;
......@@ -80,12 +80,12 @@ public abstract class BaseAnswer extends BaseBusinessClass
try
{
String tmp_Candidate = Candidate.BACKREF_Answers;
String tmp_JobApplication = JobApplication.BACKREF_ProfileAssessmentAnswers;
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
setupAssocMetaData_Section();
setupAssocMetaData_Candidate();
setupAssocMetaData_JobApplication();
setupAssocMetaData_Question();
FIELD_AnswerNo_Validators = (AttributeValidator[])setupAttribMetaData_AnswerNo(validatorMapping).toArray (new AttributeValidator[0]);
......@@ -117,17 +117,17 @@ public abstract class BaseAnswer extends BaseBusinessClass
// Meta Info setup
private static void setupAssocMetaData_Candidate()
private static void setupAssocMetaData_JobApplication()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "Answers");
metaInfo.put ("dbcol", "candidate_id");
metaInfo.put ("name", "Candidate");
metaInfo.put ("type", "Candidate");
metaInfo.put ("backreferenceName", "ProfileAssessmentAnswers");
metaInfo.put ("dbcol", "job_application_id");
metaInfo.put ("name", "JobApplication");
metaInfo.put ("type", "JobApplication");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Answer.Candidate:", metaInfo);
ATTRIBUTES_METADATA_Answer.put (SINGLEREFERENCE_Candidate, Collections.unmodifiableMap (metaInfo));
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Answer.JobApplication:", metaInfo);
ATTRIBUTES_METADATA_Answer.put (SINGLEREFERENCE_JobApplication, Collections.unmodifiableMap (metaInfo));
}
......@@ -200,7 +200,7 @@ public abstract class BaseAnswer extends BaseBusinessClass
super._initialiseAssociations ();
_Section = new SingleAssociation<Answer, Section> (this, SINGLEREFERENCE_Section, null, Section.REFERENCE_Section, "tl_answer");
_Candidate = new SingleAssociation<Answer, Candidate> (this, SINGLEREFERENCE_Candidate, Candidate.MULTIPLEREFERENCE_Answers, Candidate.REFERENCE_Candidate, "tl_answer");
_JobApplication = new SingleAssociation<Answer, JobApplication> (this, SINGLEREFERENCE_JobApplication, JobApplication.MULTIPLEREFERENCE_ProfileAssessmentAnswers, JobApplication.REFERENCE_JobApplication, "tl_answer");
_Question = new SingleAssociation<Answer, Question> (this, SINGLEREFERENCE_Question, null, Question.REFERENCE_Question, "tl_answer");
}
......@@ -212,7 +212,7 @@ public abstract class BaseAnswer extends BaseBusinessClass
super.initialiseReference ();
_Section = new SingleAssociation<Answer, Section> (this, SINGLEREFERENCE_Section, null, Section.REFERENCE_Section, "tl_answer");
_Candidate = new SingleAssociation<Answer, Candidate> (this, SINGLEREFERENCE_Candidate, Candidate.MULTIPLEREFERENCE_Answers, Candidate.REFERENCE_Candidate, "tl_answer");
_JobApplication = new SingleAssociation<Answer, JobApplication> (this, SINGLEREFERENCE_JobApplication, JobApplication.MULTIPLEREFERENCE_ProfileAssessmentAnswers, JobApplication.REFERENCE_JobApplication, "tl_answer");
_Question = new SingleAssociation<Answer, Question> (this, SINGLEREFERENCE_Question, null, Question.REFERENCE_Question, "tl_answer");
......@@ -331,7 +331,7 @@ public abstract class BaseAnswer extends BaseBusinessClass
result.add("Section");
result.add("Candidate");
result.add("JobApplication");
result.add("Question");
......@@ -349,9 +349,9 @@ public abstract class BaseAnswer extends BaseBusinessClass
else if (assocName.equals (SINGLEREFERENCE_Section))
{
return _Section.getReferencedType ();
}else if (assocName.equals (SINGLEREFERENCE_Candidate))
}else if (assocName.equals (SINGLEREFERENCE_JobApplication))
{
return _Candidate.getReferencedType ();
return _JobApplication.getReferencedType ();
}else if (assocName.equals (SINGLEREFERENCE_Question))
{
return _Question.getReferencedType ();
......@@ -372,9 +372,9 @@ public abstract class BaseAnswer extends BaseBusinessClass
else if (assocName.equals (SINGLEREFERENCE_Section))
{
return null ;
}else if (assocName.equals (SINGLEREFERENCE_Candidate))
}else if (assocName.equals (SINGLEREFERENCE_JobApplication))
{
return Candidate.MULTIPLEREFERENCE_Answers ;
return JobApplication.MULTIPLEREFERENCE_ProfileAssessmentAnswers ;
}else if (assocName.equals (SINGLEREFERENCE_Question))
{
return null ;
......@@ -395,9 +395,9 @@ public abstract class BaseAnswer extends BaseBusinessClass
else if (assocName.equals (SINGLEREFERENCE_Section))
{
return getSection ();
}else if (assocName.equals (SINGLEREFERENCE_Candidate))
}else if (assocName.equals (SINGLEREFERENCE_JobApplication))
{
return getCandidate ();
return getJobApplication ();
}else if (assocName.equals (SINGLEREFERENCE_Question))
{
return getQuestion ();
......@@ -418,9 +418,9 @@ public abstract class BaseAnswer extends BaseBusinessClass
else if (assocName.equals (SINGLEREFERENCE_Section))
{
return getSection (getType);
}else if (assocName.equals (SINGLEREFERENCE_Candidate))
}else if (assocName.equals (SINGLEREFERENCE_JobApplication))
{
return getCandidate (getType);
return getJobApplication (getType);
}else if (assocName.equals (SINGLEREFERENCE_Question))
{
return getQuestion (getType);
......@@ -441,9 +441,9 @@ public abstract class BaseAnswer extends BaseBusinessClass
else if (assocName.equals (SINGLEREFERENCE_Section))
{
return getSectionID ();
}else if (assocName.equals (SINGLEREFERENCE_Candidate))
}else if (assocName.equals (SINGLEREFERENCE_JobApplication))
{
return getCandidateID ();
return getJobApplicationID ();
}else if (assocName.equals (SINGLEREFERENCE_Question))
{
return getQuestionID ();
......@@ -464,9 +464,9 @@ public abstract class BaseAnswer extends BaseBusinessClass
else if (assocName.equals (SINGLEREFERENCE_Section))
{
setSection ((Section)(newValue));
}else if (assocName.equals (SINGLEREFERENCE_Candidate))
}else if (assocName.equals (SINGLEREFERENCE_JobApplication))
{
setCandidate ((Candidate)(newValue));
setJobApplication ((JobApplication)(newValue));
}else if (assocName.equals (SINGLEREFERENCE_Question))
{
setQuestion ((Question)(newValue));
......@@ -574,20 +574,20 @@ public abstract class BaseAnswer extends BaseBusinessClass
}
/**
* Get the reference Candidate
* Get the reference JobApplication
*/
public Candidate getCandidate () throws StorageException
public JobApplication getJobApplication () throws StorageException
{
assertValid();
try
{
return (Candidate)(_Candidate.get ());
return (JobApplication)(_JobApplication.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in Answer:", this.getObjectID (), ", was trying to get Candidate:", getCandidateID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _Candidate.get ().getClass ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in Answer:", this.getObjectID (), ", was trying to get JobApplication:", getJobApplicationID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _JobApplication.get ().getClass ());
throw e;
}
}
......@@ -596,27 +596,27 @@ public abstract class BaseAnswer extends BaseBusinessClass
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Candidate getCandidate (Get getType) throws StorageException
public JobApplication getJobApplication (Get getType) throws StorageException
{
assertValid();
return _Candidate.get(getType);
return _JobApplication.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getCandidateID ()
public Long getJobApplicationID ()
{
assertValid();
if (_Candidate == null)
if (_JobApplication == null)
{
return null;
}
else
{
return _Candidate.getID ();
return _JobApplication.getID ();
}
}
......@@ -624,7 +624,7 @@ public abstract class BaseAnswer extends BaseBusinessClass
* 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
protected void preJobApplicationChange (JobApplication newJobApplication) throws FieldException
{
}
......@@ -634,49 +634,49 @@ public abstract class BaseAnswer extends BaseBusinessClass
* 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
protected void postJobApplicationChange () throws FieldException
{
}
public FieldWriteability getWriteability_Candidate ()
public FieldWriteability getWriteability_JobApplication ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference Candidate. Checks to ensure a new value
* 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 setCandidate (Candidate newCandidate) throws StorageException, FieldException
public void setJobApplication (JobApplication newJobApplication) throws StorageException, FieldException
{
if (_Candidate.wouldReferencedChange (newCandidate))
if (_JobApplication.wouldReferencedChange (newJobApplication))
{
assertValid();
Debug.assertion (getWriteability_Candidate () != FieldWriteability.FALSE, "Assoc Candidate is not writeable");
preCandidateChange (newCandidate);
Candidate oldCandidate = getCandidate ();
Debug.assertion (getWriteability_JobApplication () != FieldWriteability.FALSE, "Assoc JobApplication is not writeable");
preJobApplicationChange (newJobApplication);
JobApplication oldJobApplication = getJobApplication ();
if (oldCandidate != null)
if (oldJobApplication != null)
{
// This is to stop validation from triggering when we are removed
_Candidate.set (null);
oldCandidate.removeFromAnswers ((Answer)(this));
_JobApplication.set (null);
oldJobApplication.removeFromProfileAssessmentAnswers ((Answer)(this));
}
_Candidate.set (newCandidate);
_JobApplication.set (newJobApplication);
if (newCandidate != null)
if (newJobApplication != null)
{
newCandidate.addToAnswers ((Answer)(this));
newJobApplication.addToProfileAssessmentAnswers ((Answer)(this));
}
postCandidateChange ();
postJobApplicationChange ();
}
}
......@@ -873,16 +873,16 @@ public abstract class BaseAnswer extends BaseBusinessClass
try
{
// Ensure we are removed from any loaded multi-associations that aren't mandatory
if (_Candidate.isLoaded () || getTransaction ().isObjectLoaded (_Candidate.getReferencedType (), getCandidateID ()))
if (_JobApplication.isLoaded () || getTransaction ().isObjectLoaded (_JobApplication.getReferencedType (), getJobApplicationID ()))
{
Candidate referenced = getCandidate ();
JobApplication referenced = getJobApplication ();
if (referenced != null)
{
// Stop the callback
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null Answers from ", getObjectID (), " to ", referenced.getObjectID ());
_Candidate.set (null);
referenced.removeFromAnswers ((Answer)this);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null ProfileAssessmentAnswers from ", getObjectID (), " to ", referenced.getObjectID ());
_JobApplication.set (null);
referenced.removeFromProfileAssessmentAnswers ((Answer)this);
}
}
......@@ -948,7 +948,7 @@ public abstract class BaseAnswer extends BaseBusinessClass
tl_answerPSet.setAttrib (FIELD_ObjectID, myID);
tl_answerPSet.setAttrib (FIELD_AnswerNo, HELPER_AnswerNo.toObject (_AnswerNo)); //
_Section.getPersistentSets (allSets);
_Candidate.getPersistentSets (allSets);
_JobApplication.getPersistentSets (allSets);
_Question.getPersistentSets (allSets);
}
......@@ -966,7 +966,7 @@ public abstract class BaseAnswer extends BaseBusinessClass
_AnswerNo = (Integer)(HELPER_AnswerNo.fromObject (_AnswerNo, tl_answerPSet.getAttrib (FIELD_AnswerNo))); //
_Section.setFromPersistentSets (objectID, allSets);
_Candidate.setFromPersistentSets (objectID, allSets);
_JobApplication.setFromPersistentSets (objectID, allSets);
_Question.setFromPersistentSets (objectID, allSets);
}
......@@ -1025,7 +1025,7 @@ public abstract class BaseAnswer extends BaseBusinessClass
BaseAnswer sourceAnswer = (BaseAnswer)(source);
_Section.copyFrom (sourceAnswer._Section, linkToGhosts);
_Candidate.copyFrom (sourceAnswer._Candidate, linkToGhosts);
_JobApplication.copyFrom (sourceAnswer._JobApplication, linkToGhosts);
_Question.copyFrom (sourceAnswer._Question, linkToGhosts);
}
......@@ -1065,7 +1065,7 @@ public abstract class BaseAnswer extends BaseBusinessClass
_AnswerNo = (Integer)(HELPER_AnswerNo.readExternal (_AnswerNo, vals.get(FIELD_AnswerNo))); //
_Section.readExternalData(vals.get(SINGLEREFERENCE_Section));
_Candidate.readExternalData(vals.get(SINGLEREFERENCE_Candidate));
_JobApplication.readExternalData(vals.get(SINGLEREFERENCE_JobApplication));
_Question.readExternalData(vals.get(SINGLEREFERENCE_Question));
}
......@@ -1080,7 +1080,7 @@ public abstract class BaseAnswer extends BaseBusinessClass
vals.put (FIELD_AnswerNo, HELPER_AnswerNo.writeExternal (_AnswerNo));
vals.put (SINGLEREFERENCE_Section, _Section.writeExternalData());
vals.put (SINGLEREFERENCE_Candidate, _Candidate.writeExternalData());
vals.put (SINGLEREFERENCE_JobApplication, _JobApplication.writeExternalData());
vals.put (SINGLEREFERENCE_Question, _Question.writeExternalData());
}
......@@ -1102,7 +1102,7 @@ public abstract class BaseAnswer extends BaseBusinessClass
// Compare single assocs
_Section.compare (otherAnswer._Section, listener);
_Candidate.compare (otherAnswer._Candidate, listener);
_JobApplication.compare (otherAnswer._JobApplication, listener);
_Question.compare (otherAnswer._Question, listener);
......@@ -1126,7 +1126,7 @@ public abstract class BaseAnswer extends BaseBusinessClass
visitor.visitField(this, FIELD_AnswerNo, HELPER_AnswerNo.toObject(getAnswerNo()));
visitor.visitAssociation (_Section);
visitor.visitAssociation (_Candidate);
visitor.visitAssociation (_JobApplication);
visitor.visitAssociation (_Question);
}
......@@ -1140,9 +1140,9 @@ public abstract class BaseAnswer extends BaseBusinessClass
{
visitor.visit (_Section);
}
if (scope.includes (_Candidate))
if (scope.includes (_JobApplication))
{
visitor.visit (_Candidate);
visitor.visit (_JobApplication);
}
if (scope.includes (_Question))
{
......@@ -1181,9 +1181,9 @@ public abstract class BaseAnswer extends BaseBusinessClass
{
return filter.matches (getSection ());
}
else if (attribName.equals (SINGLEREFERENCE_Candidate))
else if (attribName.equals (SINGLEREFERENCE_JobApplication))
{
return filter.matches (getCandidate ());
return filter.matches (getJobApplication ());
}
else if (attribName.equals (SINGLEREFERENCE_Question))
{
......@@ -1232,9 +1232,9 @@ public abstract class BaseAnswer extends BaseBusinessClass
return this;
}
public SearchAll andCandidate (QueryFilter<Candidate> filter)
public SearchAll andJobApplication (QueryFilter<JobApplication> filter)
{
filter.addFilter (context, "tl_answer.candidate_id", "Candidate");
filter.addFilter (context, "tl_answer.job_application_id", "JobApplication");
return this;
}
......@@ -1345,9 +1345,9 @@ public abstract class BaseAnswer extends BaseBusinessClass
{
return getWriteability_Section ();
}
else if (fieldName.equals (SINGLEREFERENCE_Candidate))
else if (fieldName.equals (SINGLEREFERENCE_JobApplication))
{
return getWriteability_Candidate ();
return getWriteability_JobApplication ();
}
else if (fieldName.equals (SINGLEREFERENCE_Question))
{
......@@ -1506,9 +1506,9 @@ public abstract class BaseAnswer extends BaseBusinessClass
{
return toSection ();
}
if (name.equals ("Candidate"))
if (name.equals ("JobApplication"))
{
return toCandidate ();
return toJobApplication ();
}
if (name.equals ("Question"))
{
......@@ -1527,11 +1527,11 @@ public abstract class BaseAnswer extends BaseBusinessClass
{
return Section.REFERENCE_Section.new SectionPipeLineFactory<From, Section> (this, new ORMSingleAssocPipe<Me, Section>(SINGLEREFERENCE_Section, filter));
}
public Candidate.CandidatePipeLineFactory<From, Candidate> toCandidate () { return toCandidate (Filter.ALL); }
public JobApplication.JobApplicationPipeLineFactory<From, JobApplication> toJobApplication () { return toJobApplication (Filter.ALL); }
public Candidate.CandidatePipeLineFactory<From, Candidate> toCandidate (Filter<Candidate> filter)
public JobApplication.JobApplicationPipeLineFactory<From, JobApplication> toJobApplication (Filter<JobApplication> filter)
{
return Candidate.REFERENCE_Candidate.new CandidatePipeLineFactory<From, Candidate> (this, new ORMSingleAssocPipe<Me, Candidate>(SINGLEREFERENCE_Candidate, filter));
return JobApplication.REFERENCE_JobApplication.new JobApplicationPipeLineFactory<From, JobApplication> (this, new ORMSingleAssocPipe<Me, JobApplication>(SINGLEREFERENCE_JobApplication, filter));
}
public Question.QuestionPipeLineFactory<From, Question> toQuestion () { return toQuestion (Filter.ALL); }
......@@ -1584,18 +1584,18 @@ class DummyAnswer extends Answer
return Section.DUMMY_Section.getObjectID();
}
public Candidate getCandidate () throws StorageException
public JobApplication getJobApplication () throws StorageException
{
return (Candidate)(Candidate.DUMMY_Candidate);
return (JobApplication)(JobApplication.DUMMY_JobApplication);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getCandidateID ()
public Long getJobApplicationID ()
{
return Candidate.DUMMY_Candidate.getObjectID();
return JobApplication.DUMMY_JobApplication.getObjectID();
}
public Question getQuestion () throws StorageException
......
......@@ -45,8 +45,6 @@ public abstract class BaseCandidate extends SecUserExtension
public static final String BACKREF_TestInput = "";
public static final String MULTIPLEREFERENCE_TestAnalysises = "TestAnalysises";
public static final String BACKREF_TestAnalysises = "";
public static final String MULTIPLEREFERENCE_Answers = "Answers";
public static final String BACKREF_Answers = "";
public static final String MULTIPLEREFERENCE_JobApplications = "JobApplications";
public static final String BACKREF_JobApplications = "";
......@@ -67,7 +65,6 @@ public abstract class BaseCandidate extends SecUserExtension
// Private attributes corresponding to multiple references
private MultipleAssociation<Candidate, TestAnalysis> _TestAnalysises;
private MultipleAssociation<Candidate, Answer> _Answers;
private MultipleAssociation<Candidate, JobApplication> _JobApplications;
......@@ -87,14 +84,12 @@ public abstract class BaseCandidate extends SecUserExtension
{
String tmp_TestAnalysises = TestAnalysis.BACKREF_Candidate;
String tmp_Answers = Answer.BACKREF_Candidate;
String tmp_JobApplications = JobApplication.BACKREF_Candidate;
String tmp_TestInput = TestInput.BACKREF_Candidates;
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
setupAssocMetaData_TestAnalysises();
setupAssocMetaData_Answers();
setupAssocMetaData_JobApplications();
setupAssocMetaData_TestInput();
FIELD_Phone_Validators = (AttributeValidator[])setupAttribMetaData_Phone(validatorMapping).toArray (new AttributeValidator[0]);
......@@ -127,20 +122,6 @@ public abstract class BaseCandidate extends SecUserExtension
// Meta Info setup
private static void setupAssocMetaData_Answers()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "Candidate");
metaInfo.put ("name", "Answers");
metaInfo.put ("type", "Answer");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Candidate.Answers:", metaInfo);
ATTRIBUTES_METADATA_Candidate.put (MULTIPLEREFERENCE_Answers, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static void setupAssocMetaData_JobApplications()
{
Map metaInfo = new HashMap ();
......@@ -226,7 +207,6 @@ public abstract class BaseCandidate extends SecUserExtension
_TestInput = new SingleAssociation<Candidate, TestInput> (this, SINGLEREFERENCE_TestInput, TestInput.MULTIPLEREFERENCE_Candidates, TestInput.REFERENCE_TestInput, "oneit_sec_user_extension");
_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);
_JobApplications = new MultipleAssociation<Candidate, JobApplication> (this, MULTIPLEREFERENCE_JobApplications, JobApplication.SINGLEREFERENCE_Candidate, JobApplication.REFERENCE_JobApplication);
}
......@@ -239,7 +219,6 @@ public abstract class BaseCandidate extends SecUserExtension
_TestInput = new SingleAssociation<Candidate, TestInput> (this, SINGLEREFERENCE_TestInput, TestInput.MULTIPLEREFERENCE_Candidates, TestInput.REFERENCE_TestInput, "oneit_sec_user_extension");
_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);
_JobApplications = new MultipleAssociation<Candidate, JobApplication> (this, MULTIPLEREFERENCE_JobApplications, JobApplication.SINGLEREFERENCE_Candidate, JobApplication.REFERENCE_JobApplication);
......@@ -583,8 +562,6 @@ public abstract class BaseCandidate extends SecUserExtension
result.add("TestAnalysises");
result.add("Answers");
result.add("JobApplications");
......@@ -603,11 +580,6 @@ public abstract class BaseCandidate extends SecUserExtension
return TestAnalysis.REFERENCE_TestAnalysis ;
}
if (MULTIPLEREFERENCE_Answers.equals(attribName))
{
return Answer.REFERENCE_Answer ;
}
if (MULTIPLEREFERENCE_JobApplications.equals(attribName))
{
return JobApplication.REFERENCE_JobApplication ;
......@@ -626,11 +598,6 @@ public abstract class BaseCandidate extends SecUserExtension
return TestAnalysis.SINGLEREFERENCE_Candidate ;
}
if (MULTIPLEREFERENCE_Answers.equals(attribName))
{
return Answer.SINGLEREFERENCE_Candidate ;
}
if (MULTIPLEREFERENCE_JobApplications.equals(attribName))
{
return JobApplication.SINGLEREFERENCE_Candidate ;
......@@ -652,11 +619,6 @@ public abstract class BaseCandidate extends SecUserExtension
return this.getTestAnalysisesCount();
}
if (MULTIPLEREFERENCE_Answers.equals(attribName))
{
return this.getAnswersCount();
}
if (MULTIPLEREFERENCE_JobApplications.equals(attribName))
{
return this.getJobApplicationsCount();
......@@ -678,11 +640,6 @@ public abstract class BaseCandidate extends SecUserExtension
return this.getTestAnalysisesAt(index);
}
if (MULTIPLEREFERENCE_Answers.equals(attribName))
{
return this.getAnswersAt(index);
}
if (MULTIPLEREFERENCE_JobApplications.equals(attribName))
{
return this.getJobApplicationsAt(index);
......@@ -706,13 +663,6 @@ public abstract class BaseCandidate extends SecUserExtension
return;
}
if (MULTIPLEREFERENCE_Answers.equals(attribName))
{
addToAnswers((Answer)newElement);
return;
}
if (MULTIPLEREFERENCE_JobApplications.equals(attribName))
{
addToJobApplications((JobApplication)newElement);
......@@ -737,13 +687,6 @@ public abstract class BaseCandidate extends SecUserExtension
return;
}
if (MULTIPLEREFERENCE_Answers.equals(attribName))
{
removeFromAnswers((Answer)oldElement);
return;
}
if (MULTIPLEREFERENCE_JobApplications.equals(attribName))
{
removeFromJobApplications((JobApplication)oldElement);
......@@ -765,12 +708,6 @@ public abstract class BaseCandidate extends SecUserExtension
return;
}
if (MULTIPLEREFERENCE_Answers.equals(attribName))
{
_Answers.__loadAssociation (elements);
return;
}
if (MULTIPLEREFERENCE_JobApplications.equals(attribName))
{
_JobApplications.__loadAssociation (elements);
......@@ -790,11 +727,6 @@ public abstract class BaseCandidate extends SecUserExtension
return _TestAnalysises.isLoaded ();
}
if (MULTIPLEREFERENCE_Answers.equals(attribName))
{
return _Answers.isLoaded ();
}
if (MULTIPLEREFERENCE_JobApplications.equals(attribName))
{
return _JobApplications.isLoaded ();
......@@ -875,75 +807,6 @@ public abstract class BaseCandidate extends SecUserExtension
return _TestAnalysises.getSet ();
}
public FieldWriteability getWriteability_Answers ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
public int getAnswersCount () throws StorageException
{
assertValid();
return _Answers.getReferencedObjectsCount ();
}
public void addToAnswers (Answer newElement) throws StorageException
{
if (_Answers.wouldAddChange (newElement))
{
assertValid();
Debug.assertion (getWriteability_Answers () != FieldWriteability.FALSE, "MultiAssoc Answers is not writeable (add)");
_Answers.appendElement (newElement);
try
{
if (newElement.getCandidate () != this)
{
newElement.setCandidate ((Candidate)(this));
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
}
}
public void removeFromAnswers (Answer elementToRemove) throws StorageException
{
if (_Answers.wouldRemoveChange (elementToRemove))
{
assertValid();
Debug.assertion (getWriteability_Answers () != FieldWriteability.FALSE, "MultiAssoc Answers is not writeable (remove)");
_Answers.removeElement (elementToRemove);
try
{
if (elementToRemove.getCandidate () != null)
{
elementToRemove.setCandidate (null);
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
}
}
public Answer getAnswersAt (int index) throws StorageException
{
return (Answer)(_Answers.getElementAt (index));
}
public SortedSet<Answer> getAnswersSet () throws StorageException
{
return _Answers.getSet ();
}
public FieldWriteability getWriteability_JobApplications ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
......@@ -1039,12 +902,6 @@ public abstract class BaseCandidate extends SecUserExtension
referenced.setCandidate(null);
}
for(Answer referenced : CollectionUtils.reverse(getAnswersSet()))
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null Candidate from ", getObjectID (), " to ", referenced.getObjectID ());
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 ());
......@@ -1203,7 +1060,6 @@ public abstract class BaseCandidate extends SecUserExtension
BaseCandidate sourceCandidate = (BaseCandidate)(source);
_TestAnalysises.copyFrom (sourceCandidate._TestAnalysises, linkToGhosts);
_Answers.copyFrom (sourceCandidate._Answers, linkToGhosts);
_JobApplications.copyFrom (sourceCandidate._JobApplications, linkToGhosts);
}
......@@ -1228,7 +1084,6 @@ public abstract class BaseCandidate extends SecUserExtension
_Phone = (String)(HELPER_Phone.readExternal (_Phone, vals.get(FIELD_Phone))); //
_TestInput.readExternalData(vals.get(SINGLEREFERENCE_TestInput));
_TestAnalysises.readExternalData(vals.get(MULTIPLEREFERENCE_TestAnalysises));
_Answers.readExternalData(vals.get(MULTIPLEREFERENCE_Answers));
_JobApplications.readExternalData(vals.get(MULTIPLEREFERENCE_JobApplications));
}
......@@ -1244,7 +1099,6 @@ public abstract class BaseCandidate extends SecUserExtension
vals.put (FIELD_Phone, HELPER_Phone.writeExternal (_Phone));
vals.put (SINGLEREFERENCE_TestInput, _TestInput.writeExternalData());
vals.put (MULTIPLEREFERENCE_TestAnalysises, _TestAnalysises.writeExternalData());
vals.put (MULTIPLEREFERENCE_Answers, _Answers.writeExternalData());
vals.put (MULTIPLEREFERENCE_JobApplications, _JobApplications.writeExternalData());
}
......@@ -1270,7 +1124,6 @@ public abstract class BaseCandidate extends SecUserExtension
// Compare multiple assocs
_TestAnalysises.compare (otherCandidate._TestAnalysises, listener);
_Answers.compare (otherCandidate._Answers, listener);
_JobApplications.compare (otherCandidate._JobApplications, listener);
}
......@@ -1292,7 +1145,6 @@ public abstract class BaseCandidate extends SecUserExtension
visitor.visitField(this, FIELD_Phone, HELPER_Phone.toObject(getPhone()));
visitor.visitAssociation (_TestInput);
visitor.visitAssociation (_TestAnalysises);
visitor.visitAssociation (_Answers);
visitor.visitAssociation (_JobApplications);
}
......@@ -1310,10 +1162,6 @@ public abstract class BaseCandidate extends SecUserExtension
{
visitor.visit (_TestAnalysises);
}
if (scope.includes (_Answers))
{
visitor.visit (_Answers);
}
if (scope.includes (_JobApplications))
{
visitor.visit (_JobApplications);
......@@ -1432,10 +1280,6 @@ public abstract class BaseCandidate extends SecUserExtension
{
return getWriteability_TestAnalysises ();
}
else if (fieldName.equals (MULTIPLEREFERENCE_Answers))
{
return getWriteability_Answers ();
}
else if (fieldName.equals (MULTIPLEREFERENCE_JobApplications))
{
return getWriteability_JobApplications ();
......@@ -1593,10 +1437,6 @@ public abstract class BaseCandidate extends SecUserExtension
{
return toTestAnalysises ();
}
if (name.equals ("Answers"))
{
return toAnswers ();
}
if (name.equals ("JobApplications"))
{
return toJobApplications ();
......@@ -1628,12 +1468,6 @@ public abstract class BaseCandidate extends SecUserExtension
{
return TestAnalysis.REFERENCE_TestAnalysis.new TestAnalysisPipeLineFactory<From, TestAnalysis> (this, new ORMMultiAssocPipe<Me, TestAnalysis>(MULTIPLEREFERENCE_TestAnalysises, filter));
}
public Answer.AnswerPipeLineFactory<From, Answer> toAnswers () { return toAnswers(Filter.ALL); }
public Answer.AnswerPipeLineFactory<From, Answer> toAnswers (Filter<Answer> 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)
......@@ -1702,23 +1536,6 @@ class DummyCandidate extends Candidate
return new TreeSet();
}
public int getAnswersCount () throws StorageException
{
return 0;
}
public Answer getAnswersAt (int index) throws StorageException
{
throw new RuntimeException ("No elements in a dummy object in association Answers");
}
public SortedSet getAnswersSet () throws StorageException
{
return new TreeSet();
}
public int getJobApplicationsCount () throws StorageException
{
return 0;
......
......@@ -47,6 +47,8 @@ public abstract class BaseJobApplication extends BaseBusinessClass
public static final String BACKREF_AssessmentCriteriaAnswers = "";
public static final String MULTIPLEREFERENCE_CultureCriteriaAnswers = "CultureCriteriaAnswers";
public static final String BACKREF_CultureCriteriaAnswers = "";
public static final String MULTIPLEREFERENCE_ProfileAssessmentAnswers = "ProfileAssessmentAnswers";
public static final String BACKREF_ProfileAssessmentAnswers = "";
// Static constants corresponding to searches
public static final String SEARCH_All = "All";
......@@ -69,6 +71,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass
// Private attributes corresponding to multiple references
private MultipleAssociation<JobApplication, AssessmentCriteriaAnswer> _AssessmentCriteriaAnswers;
private MultipleAssociation<JobApplication, CultureCriteriaAnswer> _CultureCriteriaAnswers;
private MultipleAssociation<JobApplication, Answer> _ProfileAssessmentAnswers;
// Map of maps of metadata
......@@ -88,6 +91,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass
String tmp_AssessmentCriteriaAnswers = AssessmentCriteriaAnswer.BACKREF_JobApplication;
String tmp_CultureCriteriaAnswers = CultureCriteriaAnswer.BACKREF_JobApplication;
String tmp_ProfileAssessmentAnswers = Answer.BACKREF_JobApplication;
String tmp_Candidate = Candidate.BACKREF_JobApplications;
String tmp_Job = Job.BACKREF_JobApplications;
......@@ -95,6 +99,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass
setupAssocMetaData_AssessmentCriteriaAnswers();
setupAssocMetaData_CultureCriteriaAnswers();
setupAssocMetaData_ProfileAssessmentAnswers();
setupAssocMetaData_Candidate();
setupAssocMetaData_Job();
FIELD_CV_Validators = (AttributeValidator[])setupAttribMetaData_CV(validatorMapping).toArray (new AttributeValidator[0]);
......@@ -141,6 +146,20 @@ public abstract class BaseJobApplication extends BaseBusinessClass
// Meta Info setup
private static void setupAssocMetaData_ProfileAssessmentAnswers()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "JobApplication");
metaInfo.put ("name", "ProfileAssessmentAnswers");
metaInfo.put ("type", "Answer");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for JobApplication.ProfileAssessmentAnswers:", metaInfo);
ATTRIBUTES_METADATA_JobApplication.put (MULTIPLEREFERENCE_ProfileAssessmentAnswers, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static void setupAssocMetaData_Candidate()
{
Map metaInfo = new HashMap ();
......@@ -234,6 +253,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass
_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);
_ProfileAssessmentAnswers = new MultipleAssociation<JobApplication, Answer> (this, MULTIPLEREFERENCE_ProfileAssessmentAnswers, Answer.SINGLEREFERENCE_JobApplication, Answer.REFERENCE_Answer);
}
......@@ -247,6 +267,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass
_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);
_ProfileAssessmentAnswers = new MultipleAssociation<JobApplication, Answer> (this, MULTIPLEREFERENCE_ProfileAssessmentAnswers, Answer.SINGLEREFERENCE_JobApplication, Answer.REFERENCE_Answer);
return this;
......@@ -721,6 +742,8 @@ public abstract class BaseJobApplication extends BaseBusinessClass
result.add("CultureCriteriaAnswers");
result.add("ProfileAssessmentAnswers");
return result;
}
......@@ -742,6 +765,11 @@ public abstract class BaseJobApplication extends BaseBusinessClass
return CultureCriteriaAnswer.REFERENCE_CultureCriteriaAnswer ;
}
if (MULTIPLEREFERENCE_ProfileAssessmentAnswers.equals(attribName))
{
return Answer.REFERENCE_Answer ;
}
return super.getMultiAssocReferenceInstance(attribName);
}
......@@ -760,6 +788,11 @@ public abstract class BaseJobApplication extends BaseBusinessClass
return CultureCriteriaAnswer.SINGLEREFERENCE_JobApplication ;
}
if (MULTIPLEREFERENCE_ProfileAssessmentAnswers.equals(attribName))
{
return Answer.SINGLEREFERENCE_JobApplication ;
}
return super.getMultiAssocBackReference(attribName);
}
......@@ -781,6 +814,11 @@ public abstract class BaseJobApplication extends BaseBusinessClass
return this.getCultureCriteriaAnswersCount();
}
if (MULTIPLEREFERENCE_ProfileAssessmentAnswers.equals(attribName))
{
return this.getProfileAssessmentAnswersCount();
}
return super.getMultiAssocCount(attribName);
}
......@@ -802,6 +840,11 @@ public abstract class BaseJobApplication extends BaseBusinessClass
return this.getCultureCriteriaAnswersAt(index);
}
if (MULTIPLEREFERENCE_ProfileAssessmentAnswers.equals(attribName))
{
return this.getProfileAssessmentAnswersAt(index);
}
return super.getMultiAssocAt(attribName, index);
}
......@@ -827,6 +870,13 @@ public abstract class BaseJobApplication extends BaseBusinessClass
return;
}
if (MULTIPLEREFERENCE_ProfileAssessmentAnswers.equals(attribName))
{
addToProfileAssessmentAnswers((Answer)newElement);
return;
}
super.addToMultiAssoc(attribName, newElement);
}
......@@ -851,6 +901,13 @@ public abstract class BaseJobApplication extends BaseBusinessClass
return;
}
if (MULTIPLEREFERENCE_ProfileAssessmentAnswers.equals(attribName))
{
removeFromProfileAssessmentAnswers((Answer)oldElement);
return;
}
super.removeFromMultiAssoc(attribName, oldElement);
}
......@@ -871,6 +928,12 @@ public abstract class BaseJobApplication extends BaseBusinessClass
return;
}
if (MULTIPLEREFERENCE_ProfileAssessmentAnswers.equals(attribName))
{
_ProfileAssessmentAnswers.__loadAssociation (elements);
return;
}
super.__loadMultiAssoc(attribName, elements);
}
......@@ -889,6 +952,11 @@ public abstract class BaseJobApplication extends BaseBusinessClass
return _CultureCriteriaAnswers.isLoaded ();
}
if (MULTIPLEREFERENCE_ProfileAssessmentAnswers.equals(attribName))
{
return _ProfileAssessmentAnswers.isLoaded ();
}
return super.__isMultiAssocLoaded(attribName);
}
......@@ -1033,6 +1101,75 @@ public abstract class BaseJobApplication extends BaseBusinessClass
return _CultureCriteriaAnswers.getSet ();
}
public FieldWriteability getWriteability_ProfileAssessmentAnswers ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
public int getProfileAssessmentAnswersCount () throws StorageException
{
assertValid();
return _ProfileAssessmentAnswers.getReferencedObjectsCount ();
}
public void addToProfileAssessmentAnswers (Answer newElement) throws StorageException
{
if (_ProfileAssessmentAnswers.wouldAddChange (newElement))
{
assertValid();
Debug.assertion (getWriteability_ProfileAssessmentAnswers () != FieldWriteability.FALSE, "MultiAssoc ProfileAssessmentAnswers is not writeable (add)");
_ProfileAssessmentAnswers.appendElement (newElement);
try
{
if (newElement.getJobApplication () != this)
{
newElement.setJobApplication ((JobApplication)(this));
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
}
}
public void removeFromProfileAssessmentAnswers (Answer elementToRemove) throws StorageException
{
if (_ProfileAssessmentAnswers.wouldRemoveChange (elementToRemove))
{
assertValid();
Debug.assertion (getWriteability_ProfileAssessmentAnswers () != FieldWriteability.FALSE, "MultiAssoc ProfileAssessmentAnswers is not writeable (remove)");
_ProfileAssessmentAnswers.removeElement (elementToRemove);
try
{
if (elementToRemove.getJobApplication () != null)
{
elementToRemove.setJobApplication (null);
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
}
}
public Answer getProfileAssessmentAnswersAt (int index) throws StorageException
{
return (Answer)(_ProfileAssessmentAnswers.getElementAt (index));
}
public SortedSet<Answer> getProfileAssessmentAnswersSet () throws StorageException
{
return _ProfileAssessmentAnswers.getSet ();
}
public void onDelete ()
......@@ -1079,6 +1216,12 @@ public abstract class BaseJobApplication extends BaseBusinessClass
referenced.setJobApplication(null);
}
for(Answer referenced : CollectionUtils.reverse(getProfileAssessmentAnswersSet()))
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null JobApplication from ", getObjectID (), " to ", referenced.getObjectID ());
referenced.setJobApplication(null);
}
}
catch (Exception e)
{
......@@ -1235,6 +1378,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass
_AssessmentCriteriaAnswers.copyFrom (sourceJobApplication._AssessmentCriteriaAnswers, linkToGhosts);
_CultureCriteriaAnswers.copyFrom (sourceJobApplication._CultureCriteriaAnswers, linkToGhosts);
_ProfileAssessmentAnswers.copyFrom (sourceJobApplication._ProfileAssessmentAnswers, linkToGhosts);
}
}
......@@ -1264,6 +1408,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass
_Job.readExternalData(vals.get(SINGLEREFERENCE_Job));
_AssessmentCriteriaAnswers.readExternalData(vals.get(MULTIPLEREFERENCE_AssessmentCriteriaAnswers));
_CultureCriteriaAnswers.readExternalData(vals.get(MULTIPLEREFERENCE_CultureCriteriaAnswers));
_ProfileAssessmentAnswers.readExternalData(vals.get(MULTIPLEREFERENCE_ProfileAssessmentAnswers));
}
......@@ -1280,6 +1425,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass
vals.put (SINGLEREFERENCE_Job, _Job.writeExternalData());
vals.put (MULTIPLEREFERENCE_AssessmentCriteriaAnswers, _AssessmentCriteriaAnswers.writeExternalData());
vals.put (MULTIPLEREFERENCE_CultureCriteriaAnswers, _CultureCriteriaAnswers.writeExternalData());
vals.put (MULTIPLEREFERENCE_ProfileAssessmentAnswers, _ProfileAssessmentAnswers.writeExternalData());
}
......@@ -1306,6 +1452,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass
// Compare multiple assocs
_AssessmentCriteriaAnswers.compare (otherJobApplication._AssessmentCriteriaAnswers, listener);
_CultureCriteriaAnswers.compare (otherJobApplication._CultureCriteriaAnswers, listener);
_ProfileAssessmentAnswers.compare (otherJobApplication._ProfileAssessmentAnswers, listener);
}
}
......@@ -1328,6 +1475,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass
visitor.visitAssociation (_Job);
visitor.visitAssociation (_AssessmentCriteriaAnswers);
visitor.visitAssociation (_CultureCriteriaAnswers);
visitor.visitAssociation (_ProfileAssessmentAnswers);
}
......@@ -1352,6 +1500,10 @@ public abstract class BaseJobApplication extends BaseBusinessClass
{
visitor.visit (_CultureCriteriaAnswers);
}
if (scope.includes (_ProfileAssessmentAnswers))
{
visitor.visit (_ProfileAssessmentAnswers);
}
}
......@@ -1624,6 +1776,10 @@ public abstract class BaseJobApplication extends BaseBusinessClass
{
return getWriteability_CultureCriteriaAnswers ();
}
else if (fieldName.equals (MULTIPLEREFERENCE_ProfileAssessmentAnswers))
{
return getWriteability_ProfileAssessmentAnswers ();
}
else if (fieldName.equals (SINGLEREFERENCE_Candidate))
{
return getWriteability_Candidate ();
......@@ -1803,6 +1959,10 @@ public abstract class BaseJobApplication extends BaseBusinessClass
{
return toCultureCriteriaAnswers ();
}
if (name.equals ("ProfileAssessmentAnswers"))
{
return toProfileAssessmentAnswers ();
}
if (name.equals ("CV"))
{
return toCV ();
......@@ -1846,6 +2006,12 @@ public abstract class BaseJobApplication extends BaseBusinessClass
{
return CultureCriteriaAnswer.REFERENCE_CultureCriteriaAnswer.new CultureCriteriaAnswerPipeLineFactory<From, CultureCriteriaAnswer> (this, new ORMMultiAssocPipe<Me, CultureCriteriaAnswer>(MULTIPLEREFERENCE_CultureCriteriaAnswers, filter));
}
public Answer.AnswerPipeLineFactory<From, Answer> toProfileAssessmentAnswers () { return toProfileAssessmentAnswers(Filter.ALL); }
public Answer.AnswerPipeLineFactory<From, Answer> toProfileAssessmentAnswers (Filter<Answer> filter)
{
return Answer.REFERENCE_Answer.new AnswerPipeLineFactory<From, Answer> (this, new ORMMultiAssocPipe<Me, Answer>(MULTIPLEREFERENCE_ProfileAssessmentAnswers, filter));
}
}
......@@ -1939,6 +2105,23 @@ class DummyJobApplication extends JobApplication
return new TreeSet();
}
public int getProfileAssessmentAnswersCount () throws StorageException
{
return 0;
}
public Answer getProfileAssessmentAnswersAt (int index) throws StorageException
{
throw new RuntimeException ("No elements in a dummy object in association ProfileAssessmentAnswers");
}
public SortedSet getProfileAssessmentAnswersSet () throws StorageException
{
return new TreeSet();
}
}
......@@ -7,7 +7,6 @@
<IMPORT value="oneit.security.*" />
<MULTIPLEREFERENCE name="TestAnalysises" type="TestAnalysis" backreferenceName="Candidate" />
<MULTIPLEREFERENCE name="Answers" type="Answer" backreferenceName="Candidate" />
<MULTIPLEREFERENCE name="JobApplications" type="JobApplication" backreferenceName="Candidate" />
<TABLE name="oneit_sec_user_extension" tablePrefix="object" polymorphic="TRUE">
......
package performa.orm;
import java.util.Collection;
import java.util.Comparator;
import oneit.logging.LogLevel;
import oneit.logging.LogMgr;
import oneit.logging.LoggingArea;
import oneit.objstore.StorageException;
import oneit.objstore.rdbms.filters.EqualsFilter;
import oneit.objstore.utils.ObjstoreUtils;
import oneit.utils.CollectionUtils;
import oneit.utils.ObjectTransform;
import oneit.utils.filter.CollectionFilter;
import oneit.utils.filter.Filter;
import oneit.utils.parsers.FieldException;
......@@ -89,4 +93,13 @@ public class JobApplication extends BaseJobApplication
return Boolean.FALSE;
}
public Collection<Question> getFactorQuestions()
{
Filter filter = Question.SearchByAll().andIsRightQuestion(new EqualsFilter<>(Boolean.FALSE));
return ObjstoreUtils.sort(this.pipelineJobApplication().toJob().toLevel().toFactors().toFactor().toQuestions().toQuestion(filter).vals(),
new ObjectTransform[] {Question.pipesQuestion().toSection().toDescription()},
new Comparator[]{CollectionUtils.DEFAULT_COMPARATOR});
}
}
\ No newline at end of file
......@@ -6,6 +6,7 @@
<MULTIPLEREFERENCE name="AssessmentCriteriaAnswers" type="AssessmentCriteriaAnswer" backreferenceName="JobApplication" />
<MULTIPLEREFERENCE name="CultureCriteriaAnswers" type="CultureCriteriaAnswer" backreferenceName="JobApplication" />
<MULTIPLEREFERENCE name="ProfileAssessmentAnswers" type="Answer" backreferenceName="JobApplication" />
<TABLE name="tl_job_application" tablePrefix="object" polymorphic="FALSE">
......
......@@ -23,7 +23,7 @@ public class TestInput extends BaseTestInput
Set<Factor> levelFactors = pipelineTestInput().toLevel().toFactors().toFactor().uniqueVals();
Filter<FactorQuestionLink> factorFilter = FactorQuestionLink.SearchByAll().andFactor(new InFilter(levelFactors));
return ObjstoreUtils.sort(pipelineTestInput().toCandidates().toAnswers().toQuestion().toFactors(factorFilter).toFactor().uniqueVals(),
return ObjstoreUtils.sort(pipelineTestInput().toCandidates().toJobApplications().toProfileAssessmentAnswers().toQuestion().toFactors(factorFilter).toFactor().uniqueVals(),
new ObjectTransform[]{Factor.pipesFactor().toDescription()},
new Comparator[]{CollectionUtils.DEFAULT_COMPARATOR});
}
......
......@@ -24,8 +24,8 @@ public class AnalysisEngine
Filter<FactorQuestionLink> factorFilter = FactorQuestionLink.SearchByAll().andFactor(new InFilter(levelFactors));
//Preloading Data
testInput.pipelineTestInput().toCandidates().toAnswers().toQuestion().toSection().uniqueVals();
testInput.pipelineTestInput().toCandidates().toAnswers().toQuestion().toFactors().toFactor().uniqueVals();
testInput.pipelineTestInput().toCandidates().toJobApplications().toProfileAssessmentAnswers().toQuestion().toSection().uniqueVals();
testInput.pipelineTestInput().toCandidates().toJobApplications().toProfileAssessmentAnswers().toQuestion().toFactors().toFactor().uniqueVals();
Factor.pipesFactor(levelFactors).toResults().uniqueVals();
for (Candidate candidate : testInput.getCandidatesSet())
......@@ -34,7 +34,9 @@ public class AnalysisEngine
Map<Factor, Integer> factorScoreMap = new HashMap();
for (Answer answer : candidate.getAnswersSet())
for(JobApplication application: candidate.getJobApplicationsSet())
{
for (Answer answer : application.getProfileAssessmentAnswersSet())
{
Set<FactorQuestionLink> links = answer.pipelineAnswer().toQuestion().toFactors(factorFilter).uniqueVals();
......@@ -66,6 +68,7 @@ public class AnalysisEngine
factorScoreMap.put(factor, factorScore);
}
}
}
TestAnalysis testAnalysis = TestAnalysis.createTestAnalysis(objTran);
testInput.getLevel().addToTestAnalysises(testAnalysis);
......
......@@ -18,7 +18,7 @@
<div class="main-application-outline">
<div class="selection-aust-logo">
<img src="images/australia-post.png" />
<span>Australia Post Chief Executive Officer</span>
<span><oneit:toString value="<%= job.getJobTitle() %>" mode="EscapeHTML"/></span>
</div>
<div class="show-mobile-title">
<div class="mobile-title-page">Section 3 - Job Match Assessment</div>
......
<?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_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_number" type="Long" nullable="true"/>
<column name="section_number" type="Long" length="11" nullable="true"/>
<column name="job_application_id" type="Long" length="11" nullable="true"/>
<column name="quest_number" type="Long" length="11" nullable="true"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_answer" indexName="idx_tl_answer_job_application_id" isUnique="false"><column name="job_application_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