Commit 6881ffbc by nilu

diversity changes

parent ed157008
<?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_option</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="candidate_answer_id" type="Long" length="11" nullable="false"/>
<column name="answer_id" type="Long" length="11" nullable="false"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_answer_option" indexName="idx_tl_answer_option_candidate_answer_id" isUnique="false"><column name="candidate_answer_id"/></NODE>
</NODE></OBJECTS>
\ No newline at end of file
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
<column name="object_id" type="Long" nullable="false" length="11"/> <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_last_updated_date" type="Date" nullable="false" length="22"/>
<column name="object_created_date" type="Date" nullable="false" length="22"/> <column name="object_created_date" type="Date" nullable="false" length="22"/>
<column name="answer_id" type="Long" length="11" nullable="false"/>
<column name="question_id" type="Long" length="11" nullable="false"/> <column name="question_id" type="Long" length="11" nullable="false"/>
<column name="candidate_id" type="Long" length="11" nullable="false"/> <column name="candidate_id" type="Long" length="11" nullable="false"/>
</NODE> </NODE>
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
<column name="question_code" type="CLOB" nullable="false"/> <column name="question_code" type="CLOB" nullable="false"/>
<column name="question_text" type="CLOB" nullable="false"/> <column name="question_text" type="CLOB" nullable="false"/>
<column name="australia_only" type="Boolean" nullable="true"/> <column name="australia_only" type="Boolean" nullable="true"/>
<column name="multiple_answers" type="Boolean" nullable="true"/>
</NODE> </NODE>
</NODE></OBJECTS> </NODE></OBJECTS>
\ No newline at end of file
-- DROP TABLE tl_answer_option;
CREATE TABLE tl_answer_option (
object_id int NOT NULL ,
object_last_updated_date datetime DEFAULT getdate() NOT NULL ,
object_created_date datetime DEFAULT getdate() NOT NULL
,
candidate_answer_id numeric(12) NOT NULL,
answer_id numeric(12) NOT NULL
);
ALTER TABLE tl_answer_option ADD
CONSTRAINT PK_tl_answer_option PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_answer_option_candidate_answer_id
ON tl_answer_option (candidate_answer_id);
...@@ -8,7 +8,6 @@ CREATE TABLE tl_candidate_diversity_answer ( ...@@ -8,7 +8,6 @@ CREATE TABLE tl_candidate_diversity_answer (
object_last_updated_date datetime DEFAULT getdate() NOT NULL , object_last_updated_date datetime DEFAULT getdate() NOT NULL ,
object_created_date datetime DEFAULT getdate() NOT NULL object_created_date datetime DEFAULT getdate() NOT NULL
, ,
answer_id numeric(12) NOT NULL,
question_id numeric(12) NOT NULL, question_id numeric(12) NOT NULL,
candidate_id numeric(12) NOT NULL candidate_id numeric(12) NOT NULL
); );
......
...@@ -10,7 +10,8 @@ CREATE TABLE tl_diversity_question ( ...@@ -10,7 +10,8 @@ CREATE TABLE tl_diversity_question (
, ,
question_code text NOT NULL, question_code text NOT NULL,
question_text text NOT NULL, question_text text NOT NULL,
australia_only char(1) NULL australia_only char(1) NULL,
multiple_answers char(1) NULL
); );
......
-- DROP TABLE tl_answer_option;
CREATE TABLE tl_answer_option (
object_id number(12) NOT NULL ,
object_last_updated_date date DEFAULT SYSDATE NOT NULL ,
object_created_date date DEFAULT SYSDATE NOT NULL
,
candidate_answer_id number(12) NOT NULL,
answer_id number(12) NOT NULL
);
ALTER TABLE tl_answer_option ADD
CONSTRAINT PK_tl_answer_option PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_answer_option_candidate_answer_id
ON tl_answer_option (candidate_answer_id);
...@@ -9,7 +9,6 @@ CREATE TABLE tl_candidate_diversity_answer ( ...@@ -9,7 +9,6 @@ CREATE TABLE tl_candidate_diversity_answer (
object_last_updated_date date DEFAULT SYSDATE NOT NULL , object_last_updated_date date DEFAULT SYSDATE NOT NULL ,
object_created_date date DEFAULT SYSDATE NOT NULL object_created_date date DEFAULT SYSDATE NOT NULL
, ,
answer_id number(12) NOT NULL,
question_id number(12) NOT NULL, question_id number(12) NOT NULL,
candidate_id number(12) NOT NULL candidate_id number(12) NOT NULL
); );
......
...@@ -11,7 +11,8 @@ CREATE TABLE tl_diversity_question ( ...@@ -11,7 +11,8 @@ CREATE TABLE tl_diversity_question (
, ,
question_code clob NOT NULL, question_code clob NOT NULL,
question_text clob NOT NULL, question_text clob NOT NULL,
australia_only char(1) NULL australia_only char(1) NULL,
multiple_answers char(1) NULL
); );
......
-- @AutoRun
-- drop table tl_answer_option;
CREATE TABLE tl_answer_option (
object_id numeric(12) NOT NULL ,
object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
object_created_date timestamp DEFAULT NOW() NOT NULL
,
candidate_answer_id numeric(12) NOT NULL,
answer_id numeric(12) NOT NULL
);
ALTER TABLE tl_answer_option ADD
CONSTRAINT pk_tl_answer_option PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_answer_option_candidate_answer_id
ON tl_answer_option (candidate_answer_id);
...@@ -9,7 +9,6 @@ CREATE TABLE tl_candidate_diversity_answer ( ...@@ -9,7 +9,6 @@ CREATE TABLE tl_candidate_diversity_answer (
object_last_updated_date timestamp DEFAULT NOW() NOT NULL , object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
object_created_date timestamp DEFAULT NOW() NOT NULL object_created_date timestamp DEFAULT NOW() NOT NULL
, ,
answer_id numeric(12) NOT NULL,
question_id numeric(12) NOT NULL, question_id numeric(12) NOT NULL,
candidate_id numeric(12) NOT NULL candidate_id numeric(12) NOT NULL
); );
......
...@@ -11,7 +11,8 @@ CREATE TABLE tl_diversity_question ( ...@@ -11,7 +11,8 @@ CREATE TABLE tl_diversity_question (
, ,
question_code text NOT NULL, question_code text NOT NULL,
question_text text NOT NULL, question_text text NOT NULL,
australia_only char(1) NULL australia_only char(1) NULL,
multiple_answers char(1) NULL
); );
......
...@@ -8,6 +8,7 @@ import oneit.logging.*; ...@@ -8,6 +8,7 @@ import oneit.logging.*;
import oneit.objstore.ObjectTransaction; import oneit.objstore.ObjectTransaction;
import oneit.objstore.StorageException; import oneit.objstore.StorageException;
import oneit.objstore.parser.BusinessObjectParser; import oneit.objstore.parser.BusinessObjectParser;
import oneit.objstore.rdbms.filters.EqualsFilter;
import oneit.security.SecUser; import oneit.security.SecUser;
import oneit.servlets.forms.*; import oneit.servlets.forms.*;
import oneit.servlets.process.*; import oneit.servlets.process.*;
...@@ -64,6 +65,14 @@ public class SendVerificationMailFP extends SaveFP ...@@ -64,6 +65,14 @@ public class SendVerificationMailFP extends SaveFP
BusinessObjectParser.assertFieldCondition(candidate.getGoogleAddressText() != null, candidate, Candidate.FIELD_GoogleAddressText, "mandatory", exceptions, true, request); BusinessObjectParser.assertFieldCondition(candidate.getGoogleAddressText() != null, candidate, Candidate.FIELD_GoogleAddressText, "mandatory", exceptions, true, request);
BusinessObjectParser.assertFieldCondition(candidate.isTrue(candidate.getHasValidAddress()), candidate, Candidate.FIELD_GoogleAddressText, "invalid", exceptions, true, request); BusinessObjectParser.assertFieldCondition(candidate.isTrue(candidate.getHasValidAddress()), candidate, Candidate.FIELD_GoogleAddressText, "invalid", exceptions, true, request);
if(candidate.getAnsweredDiversity())
{
for(HTDiversityQuestion htQuestion : job.getDiversityQuestions())
{
BusinessObjectParser.assertFieldCondition(candidate.hasAnswer(htQuestion), candidate, Candidate.MULTIPLEREFERENCE_DiversityAnswers, "mandatory", exceptions, true, request);
}
}
} }
super.validate(process, submission, exceptions, params); super.validate(process, submission, exceptions, params);
......
package performa.orm;
import java.io.*;
import java.util.*;
import oneit.appservices.config.*;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.utils.*;
public class AnswerOption extends BaseAnswerOption
{
private static final long serialVersionUID = 0L;
// This constructor should not be called
public AnswerOption ()
{
// Do not add any code to this, always put it in initialiseNewObject
}
}
<?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="AnswerOption" package="performa.orm">
<TABLE name="tl_answer_option" tablePrefix="object" polymorphic="FALSE">
<SINGLEREFERENCE name="CandidateAnswer" type="CandidateDiversityAnswer" dbcol="candidate_answer_id" mandatory="true" backreferenceName="Answers"/>
<SINGLEREFERENCE name="Answer" type="DiversityAnswer" dbcol="answer_id" mandatory="true" />
</TABLE>
<SEARCH type="All" paramFilter="tl_answer_option.object_id is not null" orderBy="tl_answer_option.object_id" />
</BUSINESSCLASS>
</ROOT>
\ No newline at end of file
...@@ -216,4 +216,11 @@ public class Candidate extends BaseCandidate ...@@ -216,4 +216,11 @@ public class Candidate extends BaseCandidate
return Boolean.FALSE; return Boolean.FALSE;
} }
public Boolean hasAnswer(HTDiversityQuestion htQuestion)
{
return Boolean.FALSE;
}
} }
\ No newline at end of file
package performa.orm; package performa.orm;
import oneit.utils.CollectionUtils;
public class CandidateDiversityAnswer extends BaseCandidateDiversityAnswer public class CandidateDiversityAnswer extends BaseCandidateDiversityAnswer
{ {
...@@ -10,4 +12,24 @@ public class CandidateDiversityAnswer extends BaseCandidateDiversityAnswer ...@@ -10,4 +12,24 @@ public class CandidateDiversityAnswer extends BaseCandidateDiversityAnswer
{ {
// Do not add any code to this, always put it in initialiseNewObject // Do not add any code to this, always put it in initialiseNewObject
} }
public CandidateDiversityAnswer getAnswerForQuestion(HTDiversityQuestion htQuestion)
{
CandidateDiversityAnswer answer = null;
if(htQuestion != null)
{
for(CultureCriteria cc: htQuestion.getQ)
{
if(CollectionUtils.equals(cc.getCultureElement(), getCultureElement()))
{
criteria = cc;
break;
}
}
}
return answer;
}
} }
\ No newline at end of file
...@@ -4,9 +4,10 @@ ...@@ -4,9 +4,10 @@
<BUSINESSCLASS name="CandidateDiversityAnswer" package="performa.orm"> <BUSINESSCLASS name="CandidateDiversityAnswer" package="performa.orm">
<MULTIPLEREFERENCE name="Answers" type="AnswerOption" backreferenceName="CandidateAnswer" />
<TABLE name="tl_candidate_diversity_answer" tablePrefix="object" polymorphic="FALSE"> <TABLE name="tl_candidate_diversity_answer" tablePrefix="object" polymorphic="FALSE">
<SINGLEREFERENCE name="Answer" type="DiversityAnswer" dbcol="answer_id" mandatory="true" />
<SINGLEREFERENCE name="Question" type="DiversityQuestion" dbcol="question_id" mandatory="true" /> <SINGLEREFERENCE name="Question" type="DiversityQuestion" dbcol="question_id" mandatory="true" />
<SINGLEREFERENCE name="Candidate" type="Candidate" dbcol="candidate_id" mandatory="true" backreferenceName="DiversityAnswers" /> <SINGLEREFERENCE name="Candidate" type="Candidate" dbcol="candidate_id" mandatory="true" backreferenceName="DiversityAnswers" />
......
...@@ -38,7 +38,7 @@ public class CandidateDiversityAnswerPersistenceMgr extends ObjectPersistenceMgr ...@@ -38,7 +38,7 @@ public class CandidateDiversityAnswerPersistenceMgr extends ObjectPersistenceMgr
} }
private String SELECT_COLUMNS = "{PREFIX}tl_candidate_diversity_answer.object_id as id, {PREFIX}tl_candidate_diversity_answer.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_candidate_diversity_answer.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_candidate_diversity_answer.answer_id, {PREFIX}tl_candidate_diversity_answer.question_id, {PREFIX}tl_candidate_diversity_answer.candidate_id, 1 AS commasafe "; private String SELECT_COLUMNS = "{PREFIX}tl_candidate_diversity_answer.object_id as id, {PREFIX}tl_candidate_diversity_answer.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_candidate_diversity_answer.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_candidate_diversity_answer.question_id, {PREFIX}tl_candidate_diversity_answer.candidate_id, 1 AS commasafe ";
private String SELECT_JOINS = ""; private String SELECT_JOINS = "";
public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
...@@ -89,7 +89,6 @@ public class CandidateDiversityAnswerPersistenceMgr extends ObjectPersistenceMgr ...@@ -89,7 +89,6 @@ public class CandidateDiversityAnswerPersistenceMgr extends ObjectPersistenceMgr
// Check for persistent sets already prefetched // Check for persistent sets already prefetched
if (false || !tl_candidate_diversity_answerPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) || if (false || !tl_candidate_diversity_answerPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!tl_candidate_diversity_answerPSet.containsAttrib(CandidateDiversityAnswer.SINGLEREFERENCE_Answer)||
!tl_candidate_diversity_answerPSet.containsAttrib(CandidateDiversityAnswer.SINGLEREFERENCE_Question)|| !tl_candidate_diversity_answerPSet.containsAttrib(CandidateDiversityAnswer.SINGLEREFERENCE_Question)||
!tl_candidate_diversity_answerPSet.containsAttrib(CandidateDiversityAnswer.SINGLEREFERENCE_Candidate)) !tl_candidate_diversity_answerPSet.containsAttrib(CandidateDiversityAnswer.SINGLEREFERENCE_Candidate))
{ {
...@@ -171,10 +170,10 @@ public class CandidateDiversityAnswerPersistenceMgr extends ObjectPersistenceMgr ...@@ -171,10 +170,10 @@ public class CandidateDiversityAnswerPersistenceMgr extends ObjectPersistenceMgr
{ {
int rowsUpdated = executeStatement (sqlMgr, int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}tl_candidate_diversity_answer " + "UPDATE {PREFIX}tl_candidate_diversity_answer " +
"SET answer_id = ? , question_id = ? , candidate_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " + "SET question_id = ? , candidate_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE tl_candidate_diversity_answer.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ", "WHERE tl_candidate_diversity_answer.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (SQLManager.CheckNull((Long)(tl_candidate_diversity_answerPSet.getAttrib (CandidateDiversityAnswer.SINGLEREFERENCE_Answer)))).listEntry (SQLManager.CheckNull((Long)(tl_candidate_diversity_answerPSet.getAttrib (CandidateDiversityAnswer.SINGLEREFERENCE_Question)))).listEntry (SQLManager.CheckNull((Long)(tl_candidate_diversity_answerPSet.getAttrib (CandidateDiversityAnswer.SINGLEREFERENCE_Candidate)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray()); CollectionUtils.listEntry (SQLManager.CheckNull((Long)(tl_candidate_diversity_answerPSet.getAttrib (CandidateDiversityAnswer.SINGLEREFERENCE_Question)))).listEntry (SQLManager.CheckNull((Long)(tl_candidate_diversity_answerPSet.getAttrib (CandidateDiversityAnswer.SINGLEREFERENCE_Candidate)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
if (rowsUpdated != 1) if (rowsUpdated != 1)
{ {
...@@ -431,7 +430,6 @@ public class CandidateDiversityAnswerPersistenceMgr extends ObjectPersistenceMgr ...@@ -431,7 +430,6 @@ public class CandidateDiversityAnswerPersistenceMgr extends ObjectPersistenceMgr
tl_candidate_diversity_answerPSet.setAttrib(BaseBusinessClass.FIELD_ObjectCreated, r.getTimestamp ("CREATED_DATE")); tl_candidate_diversity_answerPSet.setAttrib(BaseBusinessClass.FIELD_ObjectCreated, r.getTimestamp ("CREATED_DATE"));
tl_candidate_diversity_answerPSet.setAttrib(CandidateDiversityAnswer.SINGLEREFERENCE_Answer, r.getObject ("answer_id"));
tl_candidate_diversity_answerPSet.setAttrib(CandidateDiversityAnswer.SINGLEREFERENCE_Question, r.getObject ("question_id")); tl_candidate_diversity_answerPSet.setAttrib(CandidateDiversityAnswer.SINGLEREFERENCE_Question, r.getObject ("question_id"));
tl_candidate_diversity_answerPSet.setAttrib(CandidateDiversityAnswer.SINGLEREFERENCE_Candidate, r.getObject ("candidate_id")); tl_candidate_diversity_answerPSet.setAttrib(CandidateDiversityAnswer.SINGLEREFERENCE_Candidate, r.getObject ("candidate_id"));
...@@ -450,10 +448,10 @@ public class CandidateDiversityAnswerPersistenceMgr extends ObjectPersistenceMgr ...@@ -450,10 +448,10 @@ public class CandidateDiversityAnswerPersistenceMgr extends ObjectPersistenceMgr
{ {
executeStatement (sqlMgr, executeStatement (sqlMgr,
"INSERT INTO {PREFIX}tl_candidate_diversity_answer " + "INSERT INTO {PREFIX}tl_candidate_diversity_answer " +
" ( answer_id, question_id, candidate_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " + " ( question_id, candidate_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " + "VALUES " +
" ( ?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")", " ( ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils .listEntry (SQLManager.CheckNull((Long)(tl_candidate_diversity_answerPSet.getAttrib (CandidateDiversityAnswer.SINGLEREFERENCE_Answer)))).listEntry (SQLManager.CheckNull((Long)(tl_candidate_diversity_answerPSet.getAttrib (CandidateDiversityAnswer.SINGLEREFERENCE_Question)))).listEntry (SQLManager.CheckNull((Long)(tl_candidate_diversity_answerPSet.getAttrib (CandidateDiversityAnswer.SINGLEREFERENCE_Candidate)))) .listEntry (objectID.longID ()).toList().toArray()); CollectionUtils .listEntry (SQLManager.CheckNull((Long)(tl_candidate_diversity_answerPSet.getAttrib (CandidateDiversityAnswer.SINGLEREFERENCE_Question)))).listEntry (SQLManager.CheckNull((Long)(tl_candidate_diversity_answerPSet.getAttrib (CandidateDiversityAnswer.SINGLEREFERENCE_Candidate)))) .listEntry (objectID.longID ()).toList().toArray());
tl_candidate_diversity_answerPSet.setStatus (PersistentSetStatus.PROCESSED); tl_candidate_diversity_answerPSet.setStatus (PersistentSetStatus.PROCESSED);
} }
......
...@@ -8,9 +8,10 @@ ...@@ -8,9 +8,10 @@
<TABLE name="tl_diversity_question" tablePrefix="object" polymorphic="FALSE"> <TABLE name="tl_diversity_question" tablePrefix="object" polymorphic="FALSE">
<ATTRIB name="Code" type="String" dbcol="question_code" mandatory="true"/> <ATTRIB name="Code" type="String" dbcol="question_code" mandatory="true"/>
<ATTRIB name="QuestionText" type="String" dbcol="question_text" mandatory="true"/> <ATTRIB name="QuestionText" type="String" dbcol="question_text" mandatory="true"/>
<ATTRIB name="AustraliaOnly" type="Boolean" dbcol="australia_only" defaultValue="Boolean.FALSE" /> <ATTRIB name="AustraliaOnly" type="Boolean" dbcol="australia_only" defaultValue="Boolean.FALSE" />
<ATTRIB name="MultipleAnswers" type="Boolean" dbcol="multiple_answers" defaultValue="Boolean.FALSE" />
</TABLE> </TABLE>
......
...@@ -29,12 +29,14 @@ public class DiversityQuestionPersistenceMgr extends ObjectPersistenceMgr ...@@ -29,12 +29,14 @@ public class DiversityQuestionPersistenceMgr extends ObjectPersistenceMgr
private String dummyCode; private String dummyCode;
private String dummyQuestionText; private String dummyQuestionText;
private Boolean dummyAustraliaOnly; private Boolean dummyAustraliaOnly;
private Boolean dummyMultipleAnswers;
// Static constants corresponding to attribute helpers // Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper HELPER_Code = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper HELPER_Code = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_QuestionText = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper HELPER_QuestionText = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_AustraliaOnly = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper HELPER_AustraliaOnly = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_MultipleAnswers = DefaultAttributeHelper.INSTANCE;
...@@ -44,10 +46,11 @@ public class DiversityQuestionPersistenceMgr extends ObjectPersistenceMgr ...@@ -44,10 +46,11 @@ public class DiversityQuestionPersistenceMgr extends ObjectPersistenceMgr
dummyCode = (String)(HELPER_Code.initialise (dummyCode)); dummyCode = (String)(HELPER_Code.initialise (dummyCode));
dummyQuestionText = (String)(HELPER_QuestionText.initialise (dummyQuestionText)); dummyQuestionText = (String)(HELPER_QuestionText.initialise (dummyQuestionText));
dummyAustraliaOnly = (Boolean)(HELPER_AustraliaOnly.initialise (dummyAustraliaOnly)); dummyAustraliaOnly = (Boolean)(HELPER_AustraliaOnly.initialise (dummyAustraliaOnly));
dummyMultipleAnswers = (Boolean)(HELPER_MultipleAnswers.initialise (dummyMultipleAnswers));
} }
private String SELECT_COLUMNS = "{PREFIX}tl_diversity_question.object_id as id, {PREFIX}tl_diversity_question.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_diversity_question.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_diversity_question.question_code, {PREFIX}tl_diversity_question.question_text, {PREFIX}tl_diversity_question.australia_only, 1 AS commasafe "; private String SELECT_COLUMNS = "{PREFIX}tl_diversity_question.object_id as id, {PREFIX}tl_diversity_question.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_diversity_question.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_diversity_question.question_code, {PREFIX}tl_diversity_question.question_text, {PREFIX}tl_diversity_question.australia_only, {PREFIX}tl_diversity_question.multiple_answers, 1 AS commasafe ";
private String SELECT_JOINS = ""; private String SELECT_JOINS = "";
public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
...@@ -100,7 +103,8 @@ public class DiversityQuestionPersistenceMgr extends ObjectPersistenceMgr ...@@ -100,7 +103,8 @@ public class DiversityQuestionPersistenceMgr extends ObjectPersistenceMgr
if (false || !tl_diversity_questionPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) || if (false || !tl_diversity_questionPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!tl_diversity_questionPSet.containsAttrib(DiversityQuestion.FIELD_Code)|| !tl_diversity_questionPSet.containsAttrib(DiversityQuestion.FIELD_Code)||
!tl_diversity_questionPSet.containsAttrib(DiversityQuestion.FIELD_QuestionText)|| !tl_diversity_questionPSet.containsAttrib(DiversityQuestion.FIELD_QuestionText)||
!tl_diversity_questionPSet.containsAttrib(DiversityQuestion.FIELD_AustraliaOnly)) !tl_diversity_questionPSet.containsAttrib(DiversityQuestion.FIELD_AustraliaOnly)||
!tl_diversity_questionPSet.containsAttrib(DiversityQuestion.FIELD_MultipleAnswers))
{ {
// We will need to retrieve it // We will need to retrieve it
idsToFetch.add (id.longValue()); idsToFetch.add (id.longValue());
...@@ -170,10 +174,10 @@ public class DiversityQuestionPersistenceMgr extends ObjectPersistenceMgr ...@@ -170,10 +174,10 @@ public class DiversityQuestionPersistenceMgr extends ObjectPersistenceMgr
{ {
int rowsUpdated = executeStatement (sqlMgr, int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}tl_diversity_question " + "UPDATE {PREFIX}tl_diversity_question " +
"SET question_code = ?, question_text = ?, australia_only = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " + "SET question_code = ?, question_text = ?, australia_only = ?, multiple_answers = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE tl_diversity_question.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ", "WHERE tl_diversity_question.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_Code.getForSQL(dummyCode, tl_diversity_questionPSet.getAttrib (DiversityQuestion.FIELD_Code))).listEntry (HELPER_QuestionText.getForSQL(dummyQuestionText, tl_diversity_questionPSet.getAttrib (DiversityQuestion.FIELD_QuestionText))).listEntry (HELPER_AustraliaOnly.getForSQL(dummyAustraliaOnly, tl_diversity_questionPSet.getAttrib (DiversityQuestion.FIELD_AustraliaOnly))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray()); CollectionUtils.listEntry (HELPER_Code.getForSQL(dummyCode, tl_diversity_questionPSet.getAttrib (DiversityQuestion.FIELD_Code))).listEntry (HELPER_QuestionText.getForSQL(dummyQuestionText, tl_diversity_questionPSet.getAttrib (DiversityQuestion.FIELD_QuestionText))).listEntry (HELPER_AustraliaOnly.getForSQL(dummyAustraliaOnly, tl_diversity_questionPSet.getAttrib (DiversityQuestion.FIELD_AustraliaOnly))).listEntry (HELPER_MultipleAnswers.getForSQL(dummyMultipleAnswers, tl_diversity_questionPSet.getAttrib (DiversityQuestion.FIELD_MultipleAnswers))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
if (rowsUpdated != 1) if (rowsUpdated != 1)
{ {
...@@ -432,6 +436,7 @@ public class DiversityQuestionPersistenceMgr extends ObjectPersistenceMgr ...@@ -432,6 +436,7 @@ public class DiversityQuestionPersistenceMgr extends ObjectPersistenceMgr
tl_diversity_questionPSet.setAttrib(DiversityQuestion.FIELD_Code, HELPER_Code.getFromRS(dummyCode, r, "question_code")); tl_diversity_questionPSet.setAttrib(DiversityQuestion.FIELD_Code, HELPER_Code.getFromRS(dummyCode, r, "question_code"));
tl_diversity_questionPSet.setAttrib(DiversityQuestion.FIELD_QuestionText, HELPER_QuestionText.getFromRS(dummyQuestionText, r, "question_text")); tl_diversity_questionPSet.setAttrib(DiversityQuestion.FIELD_QuestionText, HELPER_QuestionText.getFromRS(dummyQuestionText, r, "question_text"));
tl_diversity_questionPSet.setAttrib(DiversityQuestion.FIELD_AustraliaOnly, HELPER_AustraliaOnly.getFromRS(dummyAustraliaOnly, r, "australia_only")); tl_diversity_questionPSet.setAttrib(DiversityQuestion.FIELD_AustraliaOnly, HELPER_AustraliaOnly.getFromRS(dummyAustraliaOnly, r, "australia_only"));
tl_diversity_questionPSet.setAttrib(DiversityQuestion.FIELD_MultipleAnswers, HELPER_MultipleAnswers.getFromRS(dummyMultipleAnswers, r, "multiple_answers"));
} }
...@@ -449,10 +454,10 @@ public class DiversityQuestionPersistenceMgr extends ObjectPersistenceMgr ...@@ -449,10 +454,10 @@ public class DiversityQuestionPersistenceMgr extends ObjectPersistenceMgr
{ {
executeStatement (sqlMgr, executeStatement (sqlMgr,
"INSERT INTO {PREFIX}tl_diversity_question " + "INSERT INTO {PREFIX}tl_diversity_question " +
" (question_code, question_text, australia_only, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " + " (question_code, question_text, australia_only, multiple_answers, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " + "VALUES " +
" (?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")", " (?, ?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_Code.getForSQL(dummyCode, tl_diversity_questionPSet.getAttrib (DiversityQuestion.FIELD_Code))).listEntry (HELPER_QuestionText.getForSQL(dummyQuestionText, tl_diversity_questionPSet.getAttrib (DiversityQuestion.FIELD_QuestionText))).listEntry (HELPER_AustraliaOnly.getForSQL(dummyAustraliaOnly, tl_diversity_questionPSet.getAttrib (DiversityQuestion.FIELD_AustraliaOnly))) .listEntry (objectID.longID ()).toList().toArray()); CollectionUtils.listEntry (HELPER_Code.getForSQL(dummyCode, tl_diversity_questionPSet.getAttrib (DiversityQuestion.FIELD_Code))).listEntry (HELPER_QuestionText.getForSQL(dummyQuestionText, tl_diversity_questionPSet.getAttrib (DiversityQuestion.FIELD_QuestionText))).listEntry (HELPER_AustraliaOnly.getForSQL(dummyAustraliaOnly, tl_diversity_questionPSet.getAttrib (DiversityQuestion.FIELD_AustraliaOnly))).listEntry (HELPER_MultipleAnswers.getForSQL(dummyMultipleAnswers, tl_diversity_questionPSet.getAttrib (DiversityQuestion.FIELD_MultipleAnswers))) .listEntry (objectID.longID ()).toList().toArray());
tl_diversity_questionPSet.setStatus (PersistentSetStatus.PROCESSED); tl_diversity_questionPSet.setStatus (PersistentSetStatus.PROCESSED);
} }
......
...@@ -817,5 +817,14 @@ public class Job extends BaseJob ...@@ -817,5 +817,14 @@ public class Job extends BaseJob
return getDiversityIncluded() && getHiringTeam().showHasDiversity() && pipelineJob().toHiringTeam().toDiversityQuestions(filter).uniqueVals().size() > 0; return getDiversityIncluded() && getHiringTeam().showHasDiversity() && pipelineJob().toHiringTeam().toDiversityQuestions(filter).uniqueVals().size() > 0;
} }
public Set<HTDiversityQuestion> getDiversityQuestions()
{
if(getDiversityIncluded())
{
return pipelineJob().toHiringTeam().toDiversityQuestions(HTDiversityQuestion.SearchByAll().andIsApplicable(new EqualsFilter<>(Boolean.TRUE))).uniqueVals();
}
return null;
}
} }
\ No newline at end of file
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
<column name="object_id" type="Long" nullable="false" length="11"/> <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_last_updated_date" type="Date" nullable="false" length="22"/>
<column name="object_created_date" type="Date" nullable="false" length="22"/> <column name="object_created_date" type="Date" nullable="false" length="22"/>
<column name="answer_id" type="Long" length="11" nullable="false"/>
<column name="question_id" type="Long" length="11" nullable="false"/> <column name="question_id" type="Long" length="11" nullable="false"/>
<column name="candidate_id" type="Long" length="11" nullable="false"/> <column name="candidate_id" type="Long" length="11" nullable="false"/>
</NODE> </NODE>
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
<column name="question_code" type="CLOB" nullable="false"/> <column name="question_code" type="CLOB" nullable="false"/>
<column name="question_text" type="CLOB" nullable="false"/> <column name="question_text" type="CLOB" nullable="false"/>
<column name="australia_only" type="Boolean" nullable="true"/> <column name="australia_only" type="Boolean" nullable="true"/>
<column name="multiple_answers" type="Boolean" nullable="true"/>
</NODE> </NODE>
</NODE> </NODE>
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
<value name='object_last_updated_date' class="oneit.sql.transfer.DBTransferer$Timestamp"/> <value name='object_last_updated_date' class="oneit.sql.transfer.DBTransferer$Timestamp"/>
<value name='object_created_date' class="oneit.sql.transfer.DBTransferer$Timestamp"/> <value name='object_created_date' class="oneit.sql.transfer.DBTransferer$Timestamp"/>
<value name='australia_only' factory='Boolean'>true</value> <value name='australia_only' factory='Boolean'>true</value>
<value name='multiple_answers' factory='Boolean'>true</value>
<value name='question_text' factory='String'>Do you identify as a person of Aboriginal or Torres Strait Islander origin?</value> <value name='question_text' factory='String'>Do you identify as a person of Aboriginal or Torres Strait Islander origin?</value>
<value name='question_code' factory='String'>ATSI</value> <value name='question_code' factory='String'>ATSI</value>
</NODE> </NODE>
...@@ -18,6 +19,7 @@ ...@@ -18,6 +19,7 @@
<value name='object_last_updated_date' class="oneit.sql.transfer.DBTransferer$Timestamp"/> <value name='object_last_updated_date' class="oneit.sql.transfer.DBTransferer$Timestamp"/>
<value name='object_created_date' class="oneit.sql.transfer.DBTransferer$Timestamp"/> <value name='object_created_date' class="oneit.sql.transfer.DBTransferer$Timestamp"/>
<value name='australia_only' factory='Boolean'>false</value> <value name='australia_only' factory='Boolean'>false</value>
<value name='multiple_answers' factory='Boolean'>false</value>
<value name='question_text' factory='String'>Do you identify as a person living with a disability?</value> <value name='question_text' factory='String'>Do you identify as a person living with a disability?</value>
<value name='question_code' factory='String'>DISABLED</value> <value name='question_code' factory='String'>DISABLED</value>
</NODE> </NODE>
...@@ -27,6 +29,7 @@ ...@@ -27,6 +29,7 @@
<value name='object_last_updated_date' class="oneit.sql.transfer.DBTransferer$Timestamp"/> <value name='object_last_updated_date' class="oneit.sql.transfer.DBTransferer$Timestamp"/>
<value name='object_created_date' class="oneit.sql.transfer.DBTransferer$Timestamp"/> <value name='object_created_date' class="oneit.sql.transfer.DBTransferer$Timestamp"/>
<value name='australia_only' factory='Boolean'>false</value> <value name='australia_only' factory='Boolean'>false</value>
<value name='multiple_answers' factory='Boolean'>false</value>
<value name='question_text' factory='String'>I identify by gender as</value> <value name='question_text' factory='String'>I identify by gender as</value>
<value name='question_code' factory='String'>GENDER</value> <value name='question_code' factory='String'>GENDER</value>
</NODE> </NODE>
......
<?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_option</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="candidate_answer_id" type="Long" length="11" nullable="false"/>
<column name="answer_id" type="Long" length="11" nullable="false"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_answer_option" indexName="idx_tl_answer_option_candidate_answer_id" isUnique="false">
<column name="candidate_answer_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