Commit 509ebddb by nilu

Finish Feature-Diversity

parents ba473fef 883d6caf
<?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="is_selected" type="Boolean" nullable="true"/>
<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
<?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_candidate_diversity_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="question_id" type="Long" length="11" nullable="false"/>
<column name="candidate_id" type="Long" length="11" nullable="false"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_candidate_diversity_answer" indexName="idx_tl_candidate_diversity_answer_candidate_id" isUnique="false"><column name="candidate_id"/></NODE>
</NODE></OBJECTS>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun -->
<OBJECTS name="" xmlns:oneit="http://www.1iT.com.au"><NODE name="Script" factory="Vector">
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.DefineTableOperation">
<tableName factory="String">tl_diversity_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_code" type="CLOB" nullable="false"/>
<column name="answer" type="CLOB" nullable="false"/>
<column name="question_id" type="Long" length="11" nullable="false"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_diversity_answer" indexName="idx_tl_diversity_answer_question_id" isUnique="false"><column name="question_id"/></NODE>
</NODE></OBJECTS>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun -->
<OBJECTS name="" xmlns:oneit="http://www.1iT.com.au"><NODE name="Script" factory="Vector">
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.DefineTableOperation">
<tableName factory="String">tl_diversity_question</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="question_code" type="CLOB" nullable="false"/>
<column name="question_text" type="CLOB" nullable="false"/>
<column name="australia_only" type="Boolean" nullable="true"/>
<column name="multiple_answers" type="Boolean" nullable="true"/>
</NODE>
</NODE></OBJECTS>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun -->
<OBJECTS name="" xmlns:oneit="http://www.1iT.com.au"><NODE name="Script" factory="Vector">
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.DefineTableOperation">
<tableName factory="String">tl_ht_diversity_question</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="question_text" type="CLOB" nullable="false"/>
<column name="is_applicable" type="Boolean" nullable="true"/>
<column name="question_id" type="Long" length="11" nullable="false"/>
<column name="hiring_team_id" type="Long" length="11" nullable="false"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_ht_diversity_question" indexName="idx_tl_ht_diversity_question_hiring_team_id" isUnique="false"><column name="hiring_team_id"/></NODE>
</NODE></OBJECTS>
\ No newline at end of file
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
<column name="post_code" type="String" nullable="true" length="10"/> <column name="post_code" type="String" nullable="true" length="10"/>
<column name="city" type="String" nullable="true" length="100"/> <column name="city" type="String" nullable="true" length="100"/>
<column name="has_client_support" type="Boolean" nullable="true"/> <column name="has_client_support" type="Boolean" nullable="true"/>
<column name="has_diversity" type="Boolean" nullable="true"/>
<column name="manage_own_billing" type="Boolean" nullable="true"/> <column name="manage_own_billing" type="Boolean" nullable="true"/>
<column name="stripe_reference" type="String" nullable="true" length="100"/> <column name="stripe_reference" type="String" nullable="true" length="100"/>
<column name="stripe_subscription" type="String" nullable="true" length="100"/> <column name="stripe_subscription" type="String" nullable="true" length="100"/>
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
<column name="culture_statement" type="String" nullable="true" length="2000"/> <column name="culture_statement" type="String" nullable="true" length="2000"/>
<column name="draft_location" type="String" nullable="true" length="200"/> <column name="draft_location" type="String" nullable="true" length="200"/>
<column name="google_address_text" type="String" nullable="false" length="300"/> <column name="google_address_text" type="String" nullable="false" length="300"/>
<column name="diversity_included" type="Boolean" nullable="true"/>
<column name="level_id" type="Long" length="11" nullable="true"/> <column name="level_id" type="Long" length="11" nullable="true"/>
<column name="client_id" type="Long" length="11" nullable="true"/> <column name="client_id" type="Long" length="11" nullable="true"/>
<column name="job_owner_id" type="Long" length="11" nullable="true"/> <column name="job_owner_id" type="Long" length="11" nullable="true"/>
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
<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="xxxx" type="CLOB" nullable="true"/> <column name="xxxx" type="CLOB" nullable="true"/>
<column name="xxxx" type="String" nullable="true" length="200"/>
<column name="xxxx" type="Long" length="11" nullable="true"/> <column name="xxxx" type="Long" length="11" nullable="true"/>
</NODE> </NODE>
......
-- 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
,
is_selected char(1) 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);
-- DROP TABLE tl_candidate_diversity_answer;
CREATE TABLE tl_candidate_diversity_answer (
object_id int NOT NULL ,
object_last_updated_date datetime DEFAULT getdate() NOT NULL ,
object_created_date datetime DEFAULT getdate() NOT NULL
,
question_id numeric(12) NOT NULL,
candidate_id numeric(12) NOT NULL
);
ALTER TABLE tl_candidate_diversity_answer ADD
CONSTRAINT PK_tl_candidate_diversity_answer PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_candidate_diversity_answer_candidate_id
ON tl_candidate_diversity_answer (candidate_id);
-- DROP TABLE tl_diversity_answer;
CREATE TABLE tl_diversity_answer (
object_id int NOT NULL ,
object_last_updated_date datetime DEFAULT getdate() NOT NULL ,
object_created_date datetime DEFAULT getdate() NOT NULL
,
answer_code text NOT NULL,
answer text NOT NULL,
question_id numeric(12) NOT NULL
);
ALTER TABLE tl_diversity_answer ADD
CONSTRAINT PK_tl_diversity_answer PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_diversity_answer_question_id
ON tl_diversity_answer (question_id);
-- DROP TABLE tl_diversity_question;
CREATE TABLE tl_diversity_question (
object_id int NOT NULL ,
object_last_updated_date datetime DEFAULT getdate() NOT NULL ,
object_created_date datetime DEFAULT getdate() NOT NULL
,
question_code text NOT NULL,
question_text text NOT NULL,
australia_only char(1) NULL,
multiple_answers char(1) NULL
);
ALTER TABLE tl_diversity_question ADD
CONSTRAINT PK_tl_diversity_question PRIMARY KEY
(
object_id
) ;
\ No newline at end of file
-- DROP TABLE tl_ht_diversity_question;
CREATE TABLE tl_ht_diversity_question (
object_id int NOT NULL ,
object_last_updated_date datetime DEFAULT getdate() NOT NULL ,
object_created_date datetime DEFAULT getdate() NOT NULL
,
question_text text NOT NULL,
is_applicable char(1) NULL,
question_id numeric(12) NOT NULL,
hiring_team_id numeric(12) NOT NULL
);
ALTER TABLE tl_ht_diversity_question ADD
CONSTRAINT PK_tl_ht_diversity_question PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_ht_diversity_question_hiring_team_id
ON tl_ht_diversity_question (hiring_team_id);
...@@ -18,6 +18,7 @@ CREATE TABLE tl_hiring_team ( ...@@ -18,6 +18,7 @@ CREATE TABLE tl_hiring_team (
post_code varchar(10) NULL, post_code varchar(10) NULL,
city varchar(100) NULL, city varchar(100) NULL,
has_client_support char(1) NULL, has_client_support char(1) NULL,
has_diversity char(1) NULL,
manage_own_billing char(1) NULL, manage_own_billing char(1) NULL,
stripe_reference varchar(100) NULL, stripe_reference varchar(100) NULL,
stripe_subscription varchar(100) NULL, stripe_subscription varchar(100) NULL,
......
...@@ -34,6 +34,7 @@ CREATE TABLE tl_job ( ...@@ -34,6 +34,7 @@ CREATE TABLE tl_job (
culture_statement varchar(2000) NULL, culture_statement varchar(2000) NULL,
draft_location varchar(200) NULL, draft_location varchar(200) NULL,
google_address_text varchar(300) NOT NULL, google_address_text varchar(300) NOT NULL,
diversity_included char(1) NULL,
level_id numeric(12) NULL, level_id numeric(12) NULL,
client_id numeric(12) NULL, client_id numeric(12) NULL,
job_owner_id numeric(12) NULL, job_owner_id numeric(12) NULL,
......
...@@ -9,6 +9,7 @@ CREATE TABLE it_does_not_matter ( ...@@ -9,6 +9,7 @@ CREATE TABLE it_does_not_matter (
object_created_date datetime DEFAULT getdate() NOT NULL object_created_date datetime DEFAULT getdate() NOT NULL
, ,
xxxx text NULL, xxxx text NULL,
xxxx varchar(200) NULL,
xxxx numeric(12) NULL xxxx numeric(12) 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
,
is_selected char(1) 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);
-- DROP TABLE tl_candidate_diversity_answer;
CREATE TABLE tl_candidate_diversity_answer (
object_id number(12) NOT NULL ,
object_last_updated_date date DEFAULT SYSDATE NOT NULL ,
object_created_date date DEFAULT SYSDATE NOT NULL
,
question_id number(12) NOT NULL,
candidate_id number(12) NOT NULL
);
ALTER TABLE tl_candidate_diversity_answer ADD
CONSTRAINT PK_tl_candidate_diversity_answer PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_candidate_diversity_answer_candidate_id
ON tl_candidate_diversity_answer (candidate_id);
-- DROP TABLE tl_diversity_answer;
CREATE TABLE tl_diversity_answer (
object_id number(12) NOT NULL ,
object_last_updated_date date DEFAULT SYSDATE NOT NULL ,
object_created_date date DEFAULT SYSDATE NOT NULL
,
answer_code clob NOT NULL,
answer clob NOT NULL,
question_id number(12) NOT NULL
);
ALTER TABLE tl_diversity_answer ADD
CONSTRAINT PK_tl_diversity_answer PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_diversity_answer_question_id
ON tl_diversity_answer (question_id);
-- DROP TABLE tl_diversity_question;
CREATE TABLE tl_diversity_question (
object_id number(12) NOT NULL ,
object_last_updated_date date DEFAULT SYSDATE NOT NULL ,
object_created_date date DEFAULT SYSDATE NOT NULL
,
question_code clob NOT NULL,
question_text clob NOT NULL,
australia_only char(1) NULL,
multiple_answers char(1) NULL
);
ALTER TABLE tl_diversity_question ADD
CONSTRAINT PK_tl_diversity_question PRIMARY KEY
(
object_id
) ;
\ No newline at end of file
-- DROP TABLE tl_ht_diversity_question;
CREATE TABLE tl_ht_diversity_question (
object_id number(12) NOT NULL ,
object_last_updated_date date DEFAULT SYSDATE NOT NULL ,
object_created_date date DEFAULT SYSDATE NOT NULL
,
question_text clob NOT NULL,
is_applicable char(1) NULL,
question_id number(12) NOT NULL,
hiring_team_id number(12) NOT NULL
);
ALTER TABLE tl_ht_diversity_question ADD
CONSTRAINT PK_tl_ht_diversity_question PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_ht_diversity_question_hiring_team_id
ON tl_ht_diversity_question (hiring_team_id);
...@@ -19,6 +19,7 @@ CREATE TABLE tl_hiring_team ( ...@@ -19,6 +19,7 @@ CREATE TABLE tl_hiring_team (
post_code varchar2(10) NULL, post_code varchar2(10) NULL,
city varchar2(100) NULL, city varchar2(100) NULL,
has_client_support char(1) NULL, has_client_support char(1) NULL,
has_diversity char(1) NULL,
manage_own_billing char(1) NULL, manage_own_billing char(1) NULL,
stripe_reference varchar2(100) NULL, stripe_reference varchar2(100) NULL,
stripe_subscription varchar2(100) NULL, stripe_subscription varchar2(100) NULL,
......
...@@ -35,6 +35,7 @@ CREATE TABLE tl_job ( ...@@ -35,6 +35,7 @@ CREATE TABLE tl_job (
culture_statement varchar2(2000) NULL, culture_statement varchar2(2000) NULL,
draft_location varchar2(200) NULL, draft_location varchar2(200) NULL,
google_address_text varchar2(300) NOT NULL, google_address_text varchar2(300) NOT NULL,
diversity_included char(1) NULL,
level_id number(12) NULL, level_id number(12) NULL,
client_id number(12) NULL, client_id number(12) NULL,
job_owner_id number(12) NULL, job_owner_id number(12) NULL,
......
...@@ -10,6 +10,7 @@ CREATE TABLE it_does_not_matter ( ...@@ -10,6 +10,7 @@ CREATE TABLE it_does_not_matter (
object_created_date date DEFAULT SYSDATE NOT NULL object_created_date date DEFAULT SYSDATE NOT NULL
, ,
xxxx clob NULL, xxxx clob NULL,
xxxx varchar2(200) NULL,
xxxx number(12) NULL xxxx number(12) 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
,
is_selected char(1) 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);
-- @AutoRun
-- drop table tl_candidate_diversity_answer;
CREATE TABLE tl_candidate_diversity_answer (
object_id numeric(12) NOT NULL ,
object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
object_created_date timestamp DEFAULT NOW() NOT NULL
,
question_id numeric(12) NOT NULL,
candidate_id numeric(12) NOT NULL
);
ALTER TABLE tl_candidate_diversity_answer ADD
CONSTRAINT pk_tl_candidate_diversity_answer PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_candidate_diversity_answer_candidate_id
ON tl_candidate_diversity_answer (candidate_id);
-- @AutoRun
-- drop table tl_diversity_answer;
CREATE TABLE tl_diversity_answer (
object_id numeric(12) NOT NULL ,
object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
object_created_date timestamp DEFAULT NOW() NOT NULL
,
answer_code text NOT NULL,
answer text NOT NULL,
question_id numeric(12) NOT NULL
);
ALTER TABLE tl_diversity_answer ADD
CONSTRAINT pk_tl_diversity_answer PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_diversity_answer_question_id
ON tl_diversity_answer (question_id);
-- @AutoRun
-- drop table tl_diversity_question;
CREATE TABLE tl_diversity_question (
object_id numeric(12) NOT NULL ,
object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
object_created_date timestamp DEFAULT NOW() NOT NULL
,
question_code text NOT NULL,
question_text text NOT NULL,
australia_only char(1) NULL,
multiple_answers char(1) NULL
);
ALTER TABLE tl_diversity_question ADD
CONSTRAINT pk_tl_diversity_question PRIMARY KEY
(
object_id
) ;
\ No newline at end of file
-- @AutoRun
-- drop table tl_ht_diversity_question;
CREATE TABLE tl_ht_diversity_question (
object_id numeric(12) NOT NULL ,
object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
object_created_date timestamp DEFAULT NOW() NOT NULL
,
question_text text NOT NULL,
is_applicable char(1) NULL,
question_id numeric(12) NOT NULL,
hiring_team_id numeric(12) NOT NULL
);
ALTER TABLE tl_ht_diversity_question ADD
CONSTRAINT pk_tl_ht_diversity_question PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_ht_diversity_question_hiring_team_id
ON tl_ht_diversity_question (hiring_team_id);
...@@ -19,6 +19,7 @@ CREATE TABLE tl_hiring_team ( ...@@ -19,6 +19,7 @@ CREATE TABLE tl_hiring_team (
post_code varchar(10) NULL, post_code varchar(10) NULL,
city varchar(100) NULL, city varchar(100) NULL,
has_client_support char(1) NULL, has_client_support char(1) NULL,
has_diversity char(1) NULL,
manage_own_billing char(1) NULL, manage_own_billing char(1) NULL,
stripe_reference varchar(100) NULL, stripe_reference varchar(100) NULL,
stripe_subscription varchar(100) NULL, stripe_subscription varchar(100) NULL,
......
...@@ -35,6 +35,7 @@ CREATE TABLE tl_job ( ...@@ -35,6 +35,7 @@ CREATE TABLE tl_job (
culture_statement varchar(2000) NULL, culture_statement varchar(2000) NULL,
draft_location varchar(200) NULL, draft_location varchar(200) NULL,
google_address_text varchar(300) NOT NULL, google_address_text varchar(300) NOT NULL,
diversity_included char(1) NULL,
level_id numeric(12) NULL, level_id numeric(12) NULL,
client_id numeric(12) NULL, client_id numeric(12) NULL,
job_owner_id numeric(12) NULL, job_owner_id numeric(12) NULL,
......
...@@ -10,6 +10,7 @@ CREATE TABLE it_does_not_matter ( ...@@ -10,6 +10,7 @@ CREATE TABLE it_does_not_matter (
object_created_date timestamp DEFAULT NOW() NOT NULL object_created_date timestamp DEFAULT NOW() NOT NULL
, ,
xxxx text NULL, xxxx text NULL,
xxxx varchar(200) NULL,
xxxx numeric(12) NULL xxxx numeric(12) NULL
); );
......
package performa.form;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import oneit.logging.LogLevel;
import oneit.logging.LogMgr;
import oneit.objstore.ObjectTransaction;
import oneit.objstore.StorageException;
import oneit.servlets.forms.RedisplayResult;
import oneit.servlets.forms.SubmissionDetails;
import oneit.servlets.forms.SuccessfulResult;
import oneit.servlets.process.ORMProcessFormProcessor;
import oneit.servlets.process.ORMProcessState;
import oneit.utils.BusinessException;
import performa.orm.DiversityQuestion;
import performa.orm.HTDiversityQuestion;
import performa.orm.HiringTeam;
import performa.orm.types.Countries;
public class ChangeDiversityFP extends ORMProcessFormProcessor
{
@Override
public SuccessfulResult processForm(ORMProcessState process, SubmissionDetails submission, Map params) throws BusinessException, StorageException
{
HttpServletRequest request = submission.getRequest();
ObjectTransaction objTran = process.getTransaction();
HiringTeam hiringTeam = (HiringTeam) request.getAttribute("HiringTeam");
LogMgr.log(HiringTeam.LOG, LogLevel.PROCESSING1, "Inside ChangeDiversityFP for ", hiringTeam , " Has Diversity:", hiringTeam.getHasDiversity());
if(hiringTeam.showHasDiversity())
{
if(hiringTeam.getDiversityQuestionsCount() == 0)
{
for(DiversityQuestion question : DiversityQuestion.searchAll(objTran))
{
if(hiringTeam.getCountry() != Countries.AU && question.getAustraliaOnly())
{
continue;
}
HTDiversityQuestion htDiversityQuestion = HTDiversityQuestion.createHTDiversityQuestion(objTran);
htDiversityQuestion.setQuestion(question);
htDiversityQuestion.setQuestionText(question.getQuestionText());
htDiversityQuestion.setHiringTeam(hiringTeam);
LogMgr.log(HiringTeam.LOG, LogLevel.PROCESSING1, "ChangeDiversityFP created diversity question : ", htDiversityQuestion);
}
}
}
LogMgr.log(HiringTeam.LOG, LogLevel.PROCESSING1, "ChangeDiversityFP completed for ", hiringTeam);
return RedisplayResult.getInstance();
}
}
...@@ -72,6 +72,14 @@ public class SaveCompanyFP extends SaveFP ...@@ -72,6 +72,14 @@ public class SaveCompanyFP extends SaveFP
} }
} }
if(!hiringTeam.showHasDiversity())
{
hiringTeam.getDiversityQuestionsSet().forEach((question) -> {
LogMgr.log(HiringTeam.LOG, LogLevel.PROCESSING1,"In SaveCompanyFP deleting diversity question : ", question );
question.delete();
});
}
//Set attribute IsHTLogoPresent false when HT logo is not uploaded or deleted //Set attribute IsHTLogoPresent false when HT logo is not uploaded or deleted
if(hiringTeam.getHiringTeamLogo() == null && !isHTLogoPresent) if(hiringTeam.getHiringTeamLogo() == null && !isHTLogoPresent)
......
package performa.form;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import oneit.logging.LogLevel;
import oneit.logging.LogMgr;
import oneit.objstore.StorageException;
import oneit.objstore.parser.BusinessObjectParser;
import oneit.objstore.rdbms.filters.EqualsFilter;
import oneit.servlets.forms.SubmissionDetails;
import oneit.servlets.forms.SuccessfulResult;
import oneit.servlets.process.ORMProcessState;
import oneit.servlets.process.SaveFP;
import oneit.utils.BusinessException;
import oneit.utils.MultiException;
import oneit.utils.filter.Filter;
import performa.orm.AnswerOption;
import performa.orm.Candidate;
import performa.orm.CandidateDiversityAnswer;
import performa.orm.HTDiversityQuestion;
import performa.orm.Job;
import performa.orm.JobApplication;
public class SaveDiversityAnswersFP extends SaveFP
{
@Override
public SuccessfulResult processForm(ORMProcessState process, SubmissionDetails submission, Map params) throws BusinessException, StorageException
{
HttpServletRequest request = submission.getRequest();
JobApplication jobApplication = (JobApplication) request.getAttribute("JobApplication");
LogMgr.log(JobApplication.LOG, LogLevel.PROCESSING1,"In SaveDiversityAnswersFP saving job application: ", jobApplication );
Candidate candidate = jobApplication.getCandidate();
Job job = jobApplication.getJob();
for(HTDiversityQuestion htQuestion : job.getDiversityQuestions())
{
CandidateDiversityAnswer diversityAnswer = candidate.getDiversityAnswerByQuestion(htQuestion.getQuestion());
if(htQuestion.getQuestion().getMultipleAnswers())
{
for(AnswerOption answer : diversityAnswer.getAnswersSet())
{
if(!answer.isTrue(answer.getIsSelected()))
{
LogMgr.log(JobApplication.LOG, LogLevel.PROCESSING1,"In SaveDiversityAnswersFP for multiple answer questions deleting AnswerOption : ", answer );
answer.delete();
}
}
}
else if(diversityAnswer.pipelineCandidateDiversityAnswer().toAnswers(AnswerOption.SearchByAll().andIsSelected(new EqualsFilter<>(Boolean.TRUE))).uniqueVals().isEmpty())
{
AnswerOption answerOption = diversityAnswer.pipelineCandidateDiversityAnswer().toAnswers().val();
if(answerOption == null)
{
answerOption = AnswerOption.createAnswerOption(process.getTransaction());
}
diversityAnswer.addToAnswers(answerOption);
answerOption.setAnswer(diversityAnswer.getAnswerOption());
answerOption.setIsSelected(Boolean.TRUE);
LogMgr.log(JobApplication.LOG, LogLevel.PROCESSING1,"In SaveDiversityAnswersFP created AnswerOption : ", answerOption);
}
}
return super.processForm(process, submission, params);
}
@Override
public void validate(ORMProcessState process, SubmissionDetails submission, MultiException exceptions, Map params) throws StorageException
{
HttpServletRequest request = submission.getRequest();
JobApplication jobApplication = (JobApplication) request.getAttribute("JobApplication");
Candidate candidate = jobApplication.getCandidate();
Job job = jobApplication.getJob();
for(HTDiversityQuestion htQuestion : job.getDiversityQuestions())
{
CandidateDiversityAnswer diversityAnswer = candidate.getDiversityAnswerByQuestion(htQuestion.getQuestion());
if(htQuestion.getQuestion().getMultipleAnswers())
{
Filter<AnswerOption> filter = AnswerOption.SearchByAll().andIsSelected(new EqualsFilter<>(Boolean.TRUE));
BusinessObjectParser.assertFieldCondition(diversityAnswer.pipelineCandidateDiversityAnswer().toAnswers(filter).uniqueVals().size() >= 1 , diversityAnswer, CandidateDiversityAnswer.MULTIPLEREFERENCE_Answers, "atleastOneAnswer", exceptions, true, request);
}
else
{
BusinessObjectParser.assertFieldCondition(diversityAnswer.getAnswerOption() != null , diversityAnswer, CandidateDiversityAnswer.SINGLEREFERENCE_AnswerOption, "mandatory", exceptions, true, request);
}
}
super.validate(process, submission, exceptions, params);
}
}
\ No newline at end of file
...@@ -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,7 @@ public class SendVerificationMailFP extends SaveFP ...@@ -64,6 +65,7 @@ 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);
} }
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">
<ATTRIB name="IsSelected" type="Boolean" dbcol="is_selected" defaultValue="Boolean.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
package performa.orm;
import java.io.*;
import java.util.*;
import java.sql.ResultSet;
import java.sql.SQLException;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.objstore.assocs.*;
import oneit.objstore.rdbms.*;
import oneit.objstore.utils.*;
import oneit.sql.*;
import oneit.utils.resource.*;
import oneit.utils.*;
import oneit.utils.threading.*;
/**
* IMPORTANT!!!! Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2[oneit.objstore.PersistenceMgrTemplate.xsl]
*/
public class AnswerOptionPersistenceMgr extends ObjectPersistenceMgr
{
private static final LoggingArea AnswerOptionPersistence = LoggingArea.createLoggingArea(ObjectPersistenceMgr.OBJECT_PERSISTENCE, "AnswerOption");
// Private attributes corresponding to business object data
private Boolean dummyIsSelected;
// Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper HELPER_IsSelected = DefaultAttributeHelper.INSTANCE;
public AnswerOptionPersistenceMgr ()
{
dummyIsSelected = (Boolean)(HELPER_IsSelected.initialise (dummyIsSelected));
}
private String SELECT_COLUMNS = "{PREFIX}tl_answer_option.object_id as id, {PREFIX}tl_answer_option.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_answer_option.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_answer_option.is_selected, {PREFIX}tl_answer_option.candidate_answer_id, {PREFIX}tl_answer_option.answer_id, 1 AS commasafe ";
private String SELECT_JOINS = "";
public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
Set<BaseBusinessClass> resultByIDs = fetchByIDs(Collections.singleton (id), allPSets, context, sqlMgr);
if (resultByIDs.isEmpty ())
{
return null;
}
else if (resultByIDs.size () > 1)
{
throw new StorageException ("Multiple results for id:" + id);
}
else
{
return resultByIDs.iterator ().next ();
}
}
public Set<BaseBusinessClass> fetchByIDs(Set<ObjectID> ids, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
Set<BaseBusinessClass> results = new HashSet ();
Set<Long> idsToFetch = new HashSet ();
for (ObjectID id : ids)
{
if (context.containsObject(id)) // Check for cached version
{
BaseBusinessClass objectToReturn = context.getObjectToReplace(id, AnswerOption.REFERENCE_AnswerOption);
if (objectToReturn instanceof AnswerOption)
{
LogMgr.log (AnswerOptionPersistence, LogLevel.TRACE, "Cache hit for id:", id);
results.add (objectToReturn);
}
else
{
throw new StorageException ("Cache collision for id:" + id + " with object " + objectToReturn + "while fetching a AnswerOption");
}
}
PersistentSet tl_answer_optionPSet = allPSets.getPersistentSet(id, "tl_answer_option", PersistentSetStatus.FETCHED);
// Check for persistent sets already prefetched
if (false || !tl_answer_optionPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!tl_answer_optionPSet.containsAttrib(AnswerOption.FIELD_IsSelected)||
!tl_answer_optionPSet.containsAttrib(AnswerOption.SINGLEREFERENCE_CandidateAnswer)||
!tl_answer_optionPSet.containsAttrib(AnswerOption.SINGLEREFERENCE_Answer))
{
// We will need to retrieve it
idsToFetch.add (id.longValue());
}
else
{
LogMgr.log (AnswerOptionPersistence, LogLevel.DEBUG2, "Persistent set preloaded id:", id);
/* Non Polymorphic */
AnswerOption result = new AnswerOption ();
result.setFromPersistentSets(id, allPSets);
context.addRetrievedObject(result);
results.add (result);
}
}
if (idsToFetch.size () > 0)
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_answer_option " +
"WHERE " + SELECT_JOINS + "{PREFIX}tl_answer_option.object_id IN ?";
BaseBusinessClass[] resultsFetched = loadQuery (allPSets, sqlMgr, context, query, new Object[] { idsToFetch }, null, false);
for (BaseBusinessClass objFetched : resultsFetched)
{
results.add (objFetched);
}
}
return results;
}
public BaseBusinessClass[] getReferencedObjects(ObjectID _objectID, String refName, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
if (false)
{
throw new RuntimeException ();
}
else if (refName.equals (AnswerOption.SINGLEREFERENCE_CandidateAnswer))
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_answer_option " +
"WHERE " + SELECT_JOINS + "candidate_answer_id = ?";
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, new Object[] { _objectID.longID () }, null, false);
return results;
}
else
{
throw new IllegalArgumentException ("Illegal reference type:" + refName);
}
}
public void update(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, ConcurrentUpdateConflictException, StorageException
{
EqualityResult test = EqualityResult.compare (obj, obj.getBackup ());
ObjectID objectID = obj.getID ();
if (!test.areAttributesEqual () || !test.areSingleAssocsEqual () || obj.getForcedSave())
{
PersistentSet tl_answer_optionPSet = allPSets.getPersistentSet(objectID, "tl_answer_option");
if (tl_answer_optionPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_answer_optionPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}tl_answer_option " +
"SET is_selected = ?, candidate_answer_id = ? , answer_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE tl_answer_option.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_IsSelected.getForSQL(dummyIsSelected, tl_answer_optionPSet.getAttrib (AnswerOption.FIELD_IsSelected))).listEntry (SQLManager.CheckNull((Long)(tl_answer_optionPSet.getAttrib (AnswerOption.SINGLEREFERENCE_CandidateAnswer)))).listEntry (SQLManager.CheckNull((Long)(tl_answer_optionPSet.getAttrib (AnswerOption.SINGLEREFERENCE_Answer)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
if (rowsUpdated != 1)
{
// Error, either a concurrency error or a not-exists error
ResultSet r = executeQuery (sqlMgr,
"SELECT object_id, object_LAST_UPDATED_DATE FROM {PREFIX}tl_answer_option WHERE object_id = ?",
new Object[] { objectID.longID () });
if (r.next ())
{
Date d = new java.util.Date (r.getTimestamp (2).getTime());
String errorMsg = QueryBuilder.buildQueryString ("Concurrent update error:[?] for row:[?] objDate:[?] dbDate:[?]",
new Object[] { "tl_answer_option", objectID.longID (), obj.getObjectLastModified (), d },
sqlMgr.getPortabilityServices ());
LogMgr.log (AnswerOptionPersistence, LogLevel.BUSINESS1, errorMsg);
throw new ConcurrentUpdateConflictException (obj, "tl_answer_option");
}
else
{
String errorMsg = "Attempt to update nonexistent row in table:tl_answer_option for row:" + objectID + " objDate:" + obj.getObjectLastModified ();
LogMgr.log (AnswerOptionPersistence, LogLevel.BUSINESS1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
tl_answer_optionPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
else
{
LogMgr.log (AnswerOptionPersistence, LogLevel.DEBUG1, "Skipping update since no attribs or simple assocs changed on ", objectID);
}
}
public void delete(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, ConcurrentUpdateConflictException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet tl_answer_optionPSet = allPSets.getPersistentSet(objectID, "tl_answer_option");
LogMgr.log (AnswerOptionPersistence, LogLevel.DEBUG2, "Deleting:", objectID);
if (tl_answer_optionPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_answer_optionPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsDeleted = executeStatement (sqlMgr,
"DELETE " +
"FROM {PREFIX}tl_answer_option " +
"WHERE tl_answer_option.object_id = ? AND " + sqlMgr.getPortabilityServices ().getTruncatedTimestampColumn ("object_LAST_UPDATED_DATE") + " = " + sqlMgr.getPortabilityServices ().getTruncatedTimestampParam("?") + " ",
new Object[] { objectID.longID(), obj.getObjectLastModified () });
if (rowsDeleted != 1)
{
// Error, either a concurrency error or a not-exists error
ResultSet r = executeQuery (sqlMgr,
"SELECT object_id FROM {PREFIX}tl_answer_option WHERE object_id = ?",
new Object[] { objectID.longID() });
if (r.next ())
{
throw new ConcurrentUpdateConflictException (obj, "tl_answer_option");
}
else
{
String errorMsg = "Attempt to delete nonexistent row in table:tl_answer_option for row:" + objectID;
LogMgr.log (AnswerOptionPersistence, LogLevel.SYSTEMERROR1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
tl_answer_optionPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
public ResultSet executeSearchQueryAll (SQLManager sqlMgr) throws SQLException
{
throw new RuntimeException ("NOT implemented: executeSearchQueryAll");
}
public BaseBusinessClass[] loadQuery (PersistentSetCollection allPSets, SQLManager sqlMgr, RDBMSPersistenceContext context, String query, Object[] params, Integer maxRows, boolean truncateExtra) throws SQLException, StorageException
{
LinkedHashMap<ObjectID, AnswerOption> results = new LinkedHashMap ();
ResultSet r = executeQuery (sqlMgr, query, params);
while (r.next())
{
ThreadUtils.checkInterrupted ();
ObjectID objectID = new ObjectID (AnswerOption.REFERENCE_AnswerOption.getObjectIDSpace (), r.getLong ("id"));
AnswerOption resultElement;
if (maxRows != null && !results.containsKey (objectID) && results.size () >= maxRows)
{
if (truncateExtra)
{
break;
}
else
{
throw new SearchRowsExceededException ("Maximum rows exceeded:" + maxRows);
}
}
if (context.containsObject(objectID))
{
BaseBusinessClass cachedElement = context.getObjectToReplace(objectID, AnswerOption.REFERENCE_AnswerOption);
if (cachedElement instanceof AnswerOption)
{
LogMgr.log (AnswerOptionPersistence, LogLevel.TRACE, "Cache hit for id:", objectID);
resultElement = (AnswerOption)cachedElement;
}
else
{
throw new StorageException ("Cache collision for id:" + objectID + " with object " + cachedElement + "while fetching a AnswerOption");
}
}
else
{
PersistentSet tl_answer_optionPSet = allPSets.getPersistentSet(objectID, "tl_answer_option", PersistentSetStatus.FETCHED);
createPersistentSetFromRS(allPSets, r, objectID);
resultElement = new AnswerOption ();
resultElement.setFromPersistentSets(objectID, allPSets);
context.addRetrievedObject(resultElement);
}
results.put (objectID, resultElement);
}
BaseBusinessClass[] resultsArr = new BaseBusinessClass[results.size ()];
return results.values ().toArray (resultsArr);
}
public BaseBusinessClass[] find(String searchType, PersistentSetCollection allPSets, Hashtable criteria, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
LogMgr.log (AnswerOptionPersistence, LogLevel.DEBUG2, "Search executing:", searchType, " criteria:", criteria);
String customParamFilter = (String)criteria.get (SEARCH_CustomFilter);
String customOrderBy = (String)criteria.get (SEARCH_OrderBy);
String customTables = (String)criteria.get (SEARCH_CustomExtraTables);
Boolean noCommaBeforeCustomExtraTables = (Boolean)criteria.get (SEARCH_CustomExtraTablesNoComma);
if (searchType.equals (SEARCH_CustomSQL))
{
Set<ObjectID> processedIDs = new HashSet();
SearchParamTransform tx = new SearchParamTransform (criteria);
Object[] searchParams;
customParamFilter = StringUtils.replaceParams (customParamFilter, tx);
searchParams = tx.getParamsArray();
if (customOrderBy != null)
{
customOrderBy = " ORDER BY " + customOrderBy;
}
else
{
customOrderBy = "";
}
ResultSet r;
String concatCustomTableWith = CollectionUtils.equals(noCommaBeforeCustomExtraTables, true) ? " " : ", ";
String tables = StringUtils.subBlanks(customTables) == null ? " " : concatCustomTableWith + customTables + " ";
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_answer_option " + tables +
"WHERE " + SELECT_JOINS + " " + customParamFilter + customOrderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, null, false);
return results;
}
else if (searchType.equals (AnswerOption.SEARCH_All))
{
// Local scope for transformed variables
{
}
String orderBy = " ORDER BY tl_answer_option.object_id";
String tables = " ";
Set<String> joinTableSet = new HashSet<String>();
String filter;
Object[] searchParams; // paramFilter: tl_answer_option.object_id is not null
String preFilter = "(tl_answer_option.object_id is not null)"
+ " ";
preFilter += context.getLoadingAttributes ().getCustomSQL() ;
SearchParamTransform tx = new SearchParamTransform (criteria);
filter = StringUtils.replaceParams (preFilter, tx);
searchParams = tx.getParamsArray();
Integer maxRows = context.getLoadingAttributes ().getMaxRows ();
boolean truncateExtra = !context.getLoadingAttributes ().isFailIfMaxExceeded();
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_answer_option " + tables + tableSetToSQL(joinTableSet) +
"WHERE " + SELECT_JOINS + " " + filter + orderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, maxRows, truncateExtra);
return results;
}
else
{
throw new IllegalArgumentException ("Illegal search type:" + searchType);
}
}
private void createPersistentSetFromRS(PersistentSetCollection allPSets, ResultSet r, ObjectID objectID) throws SQLException
{
PersistentSet tl_answer_optionPSet = allPSets.getPersistentSet(objectID, "tl_answer_option", PersistentSetStatus.FETCHED);
// Object Modified
tl_answer_optionPSet.setAttrib(BaseBusinessClass.FIELD_ObjectLastModified, r.getTimestamp ("LAST_UPDATED_DATE"));
// Object Created
tl_answer_optionPSet.setAttrib(BaseBusinessClass.FIELD_ObjectCreated, r.getTimestamp ("CREATED_DATE"));
tl_answer_optionPSet.setAttrib(AnswerOption.FIELD_IsSelected, HELPER_IsSelected.getFromRS(dummyIsSelected, r, "is_selected"));
tl_answer_optionPSet.setAttrib(AnswerOption.SINGLEREFERENCE_CandidateAnswer, r.getObject ("candidate_answer_id"));
tl_answer_optionPSet.setAttrib(AnswerOption.SINGLEREFERENCE_Answer, r.getObject ("answer_id"));
}
public void create(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet tl_answer_optionPSet = allPSets.getPersistentSet(objectID, "tl_answer_option");
if (tl_answer_optionPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_answer_optionPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
executeStatement (sqlMgr,
"INSERT INTO {PREFIX}tl_answer_option " +
" (is_selected, candidate_answer_id, answer_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " +
" (?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_IsSelected.getForSQL(dummyIsSelected, tl_answer_optionPSet.getAttrib (AnswerOption.FIELD_IsSelected))) .listEntry (SQLManager.CheckNull((Long)(tl_answer_optionPSet.getAttrib (AnswerOption.SINGLEREFERENCE_CandidateAnswer)))).listEntry (SQLManager.CheckNull((Long)(tl_answer_optionPSet.getAttrib (AnswerOption.SINGLEREFERENCE_Answer)))) .listEntry (objectID.longID ()).toList().toArray());
tl_answer_optionPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
}
/*
* IMPORTANT!!!! XSL Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2 rev3 [oneit.objstore.BusinessObjectTemplate.xsl]
*
* Version: 1.0
* Vendor: Apache Software Foundation (Xalan XSLTC)
* Vendor URL: http://xml.apache.org/xalan-j
*/
package performa.orm;
import java.io.*;
import java.util.*;
import oneit.appservices.config.*;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.objstore.assocs.*;
import oneit.objstore.attributes.*;
import oneit.objstore.rdbms.filters.*;
import oneit.objstore.parser.*;
import oneit.objstore.validator.*;
import oneit.objstore.utils.*;
import oneit.utils.*;
import oneit.utils.filter.Filter;
import oneit.utils.transform.*;
import oneit.utils.parsers.FieldException;
public abstract class BaseAnswerOption extends BaseBusinessClass
{
// Reference instance for the object
public static final AnswerOption REFERENCE_AnswerOption = new AnswerOption ();
// Reference instance for the object
public static final AnswerOption DUMMY_AnswerOption = new DummyAnswerOption ();
// Static constants corresponding to field names
public static final String FIELD_IsSelected = "IsSelected";
public static final String SINGLEREFERENCE_CandidateAnswer = "CandidateAnswer";
public static final String BACKREF_CandidateAnswer = "";
public static final String SINGLEREFERENCE_Answer = "Answer";
// Static constants corresponding to searches
public static final String SEARCH_All = "All";
// Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper<AnswerOption> HELPER_IsSelected = DefaultAttributeHelper.INSTANCE;
// Private attributes corresponding to business object data
private Boolean _IsSelected;
// Private attributes corresponding to single references
private SingleAssociation<AnswerOption, CandidateDiversityAnswer> _CandidateAnswer;
private SingleAssociation<AnswerOption, DiversityAnswer> _Answer;
// Private attributes corresponding to multiple references
// Map of maps of metadata
private static final Map ATTRIBUTES_METADATA_AnswerOption = new HashMap ();
// Arrays of validators for each attribute
private static final AttributeValidator[] FIELD_IsSelected_Validators;
// Arrays of behaviour decorators
private static final AnswerOptionBehaviourDecorator[] AnswerOption_BehaviourDecorators;
static
{
try
{
String tmp_CandidateAnswer = CandidateDiversityAnswer.BACKREF_Answers;
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
setupAssocMetaData_CandidateAnswer();
setupAssocMetaData_Answer();
FIELD_IsSelected_Validators = (AttributeValidator[])setupAttribMetaData_IsSelected(validatorMapping).toArray (new AttributeValidator[0]);
REFERENCE_AnswerOption.initialiseReference ();
DUMMY_AnswerOption.initialiseReference ();
AnswerOption_BehaviourDecorators = BaseBusinessClass.getBBCBehaviours(AnswerOption.class).toArray(new AnswerOptionBehaviourDecorator[0]);
}
catch (RuntimeException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR1, e, "Error initialising");
throw e;
}
}
// Meta Info setup
private static void setupAssocMetaData_CandidateAnswer()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "Answers");
metaInfo.put ("dbcol", "candidate_answer_id");
metaInfo.put ("mandatory", "true");
metaInfo.put ("name", "CandidateAnswer");
metaInfo.put ("type", "CandidateDiversityAnswer");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for AnswerOption.CandidateAnswer:", metaInfo);
ATTRIBUTES_METADATA_AnswerOption.put (SINGLEREFERENCE_CandidateAnswer, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static void setupAssocMetaData_Answer()
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "answer_id");
metaInfo.put ("mandatory", "true");
metaInfo.put ("name", "Answer");
metaInfo.put ("type", "DiversityAnswer");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for AnswerOption.Answer:", metaInfo);
ATTRIBUTES_METADATA_AnswerOption.put (SINGLEREFERENCE_Answer, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static List setupAttribMetaData_IsSelected(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "is_selected");
metaInfo.put ("defaultValue", "Boolean.FALSE");
metaInfo.put ("name", "IsSelected");
metaInfo.put ("type", "Boolean");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for AnswerOption.IsSelected:", metaInfo);
ATTRIBUTES_METADATA_AnswerOption.put (FIELD_IsSelected, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(AnswerOption.class, "IsSelected", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for AnswerOption.IsSelected:", validators);
return validators;
}
// END OF STATIC METADATA DEFINITION
// This constructor should not be called
protected BaseAnswerOption ()
{
}
protected BBCBehaviourDecorator[] getBehaviours()
{
return AnswerOption_BehaviourDecorators;
}
// Initialise the attributes
protected void _initialiseNewObjAttributes (ObjectTransaction transaction) throws StorageException
{
super._initialiseNewObjAttributes (transaction);
_IsSelected = (Boolean)(Boolean.FALSE);
}
// Initialise the associations
protected void _initialiseAssociations ()
{
super._initialiseAssociations ();
_CandidateAnswer = new SingleAssociation<AnswerOption, CandidateDiversityAnswer> (this, SINGLEREFERENCE_CandidateAnswer, CandidateDiversityAnswer.MULTIPLEREFERENCE_Answers, CandidateDiversityAnswer.REFERENCE_CandidateDiversityAnswer, "tl_answer_option");
_Answer = new SingleAssociation<AnswerOption, DiversityAnswer> (this, SINGLEREFERENCE_Answer, null, DiversityAnswer.REFERENCE_DiversityAnswer, "tl_answer_option");
}
// Initialise the associations
protected BaseBusinessClass initialiseReference ()
{
super.initialiseReference ();
_CandidateAnswer = new SingleAssociation<AnswerOption, CandidateDiversityAnswer> (this, SINGLEREFERENCE_CandidateAnswer, CandidateDiversityAnswer.MULTIPLEREFERENCE_Answers, CandidateDiversityAnswer.REFERENCE_CandidateDiversityAnswer, "tl_answer_option");
_Answer = new SingleAssociation<AnswerOption, DiversityAnswer> (this, SINGLEREFERENCE_Answer, null, DiversityAnswer.REFERENCE_DiversityAnswer, "tl_answer_option");
return this;
}
/**
* Get the attribute IsSelected
*/
public Boolean getIsSelected ()
{
assertValid();
Boolean valToReturn = _IsSelected;
for (AnswerOptionBehaviourDecorator bhd : AnswerOption_BehaviourDecorators)
{
valToReturn = bhd.getIsSelected ((AnswerOption)this, valToReturn);
}
return valToReturn;
}
/**
* Called prior to the attribute changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preIsSelectedChange (Boolean newIsSelected) throws FieldException
{
}
/**
* Called after the attribute changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postIsSelectedChange () throws FieldException
{
}
public FieldWriteability getWriteability_IsSelected ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute IsSelected. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setIsSelected (Boolean newIsSelected) throws FieldException
{
boolean oldAndNewIdentical = HELPER_IsSelected.compare (_IsSelected, newIsSelected);
try
{
for (AnswerOptionBehaviourDecorator bhd : AnswerOption_BehaviourDecorators)
{
newIsSelected = bhd.setIsSelected ((AnswerOption)this, newIsSelected);
oldAndNewIdentical = HELPER_IsSelected.compare (_IsSelected, newIsSelected);
}
if (FIELD_IsSelected_Validators.length > 0)
{
Object newIsSelectedObj = HELPER_IsSelected.toObject (newIsSelected);
if (newIsSelectedObj != null)
{
int loopMax = FIELD_IsSelected_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_AnswerOption.get (FIELD_IsSelected);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_IsSelected_Validators[v].checkAttribute (this, FIELD_IsSelected, metadata, newIsSelectedObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_IsSelected () != FieldWriteability.FALSE, "Field IsSelected is not writeable");
preIsSelectedChange (newIsSelected);
markFieldChange (FIELD_IsSelected);
_IsSelected = newIsSelected;
postFieldChange (FIELD_IsSelected);
postIsSelectedChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getSingleAssocs()
{
List result = super.getSingleAssocs ();
result.add("CandidateAnswer");
result.add("Answer");
return result;
}
public BaseBusinessClass getSingleAssocReferenceInstance (String assocName)
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_CandidateAnswer))
{
return _CandidateAnswer.getReferencedType ();
}else if (assocName.equals (SINGLEREFERENCE_Answer))
{
return _Answer.getReferencedType ();
}
else
{
return super.getSingleAssocReferenceInstance (assocName);
}
}
public String getSingleAssocBackReference(String assocName)
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_CandidateAnswer))
{
return CandidateDiversityAnswer.MULTIPLEREFERENCE_Answers ;
}else if (assocName.equals (SINGLEREFERENCE_Answer))
{
return null ;
}
else
{
return super.getSingleAssocBackReference (assocName);
}
}
public BaseBusinessClass getSingleAssoc (String assocName) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_CandidateAnswer))
{
return getCandidateAnswer ();
}else if (assocName.equals (SINGLEREFERENCE_Answer))
{
return getAnswer ();
}
else
{
return super.getSingleAssoc (assocName);
}
}
public BaseBusinessClass getSingleAssoc (String assocName, Get getType) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_CandidateAnswer))
{
return getCandidateAnswer (getType);
}else if (assocName.equals (SINGLEREFERENCE_Answer))
{
return getAnswer (getType);
}
else
{
return super.getSingleAssoc (assocName, getType);
}
}
public Long getSingleAssocID (String assocName) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_CandidateAnswer))
{
return getCandidateAnswerID ();
}else if (assocName.equals (SINGLEREFERENCE_Answer))
{
return getAnswerID ();
}
else
{
return super.getSingleAssocID (assocName);
}
}
public void setSingleAssoc (String assocName, BaseBusinessClass newValue) throws StorageException, FieldException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_CandidateAnswer))
{
setCandidateAnswer ((CandidateDiversityAnswer)(newValue));
}else if (assocName.equals (SINGLEREFERENCE_Answer))
{
setAnswer ((DiversityAnswer)(newValue));
}
else
{
super.setSingleAssoc (assocName, newValue);
}
}
/**
* Get the reference CandidateAnswer
*/
public CandidateDiversityAnswer getCandidateAnswer () throws StorageException
{
assertValid();
try
{
return (CandidateDiversityAnswer)(_CandidateAnswer.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in AnswerOption:", this.getObjectID (), ", was trying to get CandidateDiversityAnswer:", getCandidateAnswerID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _CandidateAnswer.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public CandidateDiversityAnswer getCandidateAnswer (Get getType) throws StorageException
{
assertValid();
return _CandidateAnswer.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getCandidateAnswerID ()
{
assertValid();
if (_CandidateAnswer == null)
{
return null;
}
else
{
return _CandidateAnswer.getID ();
}
}
/**
* Called prior to the assoc changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preCandidateAnswerChange (CandidateDiversityAnswer newCandidateAnswer) throws FieldException
{
}
/**
* Called after the assoc changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postCandidateAnswerChange () throws FieldException
{
}
public FieldWriteability getWriteability_CandidateAnswer ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference CandidateAnswer. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setCandidateAnswer (CandidateDiversityAnswer newCandidateAnswer) throws StorageException, FieldException
{
BusinessObjectParser.assertFieldCondition (newCandidateAnswer != null, this, SINGLEREFERENCE_CandidateAnswer, "mandatory");
if (_CandidateAnswer.wouldReferencedChange (newCandidateAnswer))
{
assertValid();
Debug.assertion (getWriteability_CandidateAnswer () != FieldWriteability.FALSE, "Assoc CandidateAnswer is not writeable");
preCandidateAnswerChange (newCandidateAnswer);
CandidateDiversityAnswer oldCandidateAnswer = getCandidateAnswer ();
if (oldCandidateAnswer != null)
{
// This is to stop validation from triggering when we are removed
_CandidateAnswer.set (null);
oldCandidateAnswer.removeFromAnswers ((AnswerOption)(this));
}
_CandidateAnswer.set (newCandidateAnswer);
if (newCandidateAnswer != null)
{
newCandidateAnswer.addToAnswers ((AnswerOption)(this));
}
postCandidateAnswerChange ();
}
}
/**
* Get the reference Answer
*/
public DiversityAnswer getAnswer () throws StorageException
{
assertValid();
try
{
return (DiversityAnswer)(_Answer.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in AnswerOption:", this.getObjectID (), ", was trying to get DiversityAnswer:", getAnswerID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _Answer.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public DiversityAnswer getAnswer (Get getType) throws StorageException
{
assertValid();
return _Answer.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getAnswerID ()
{
assertValid();
if (_Answer == null)
{
return null;
}
else
{
return _Answer.getID ();
}
}
/**
* Called prior to the assoc changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preAnswerChange (DiversityAnswer newAnswer) throws FieldException
{
}
/**
* Called after the assoc changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postAnswerChange () throws FieldException
{
}
public FieldWriteability getWriteability_Answer ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference Answer. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setAnswer (DiversityAnswer newAnswer) throws StorageException, FieldException
{
BusinessObjectParser.assertFieldCondition (newAnswer != null, this, SINGLEREFERENCE_Answer, "mandatory");
if (_Answer.wouldReferencedChange (newAnswer))
{
assertValid();
Debug.assertion (getWriteability_Answer () != FieldWriteability.FALSE, "Assoc Answer is not writeable");
preAnswerChange (newAnswer);
_Answer.set (newAnswer);
postAnswerChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getMultiAssocs()
{
List result = super.getMultiAssocs ();
return result;
}
/**
* Get the reference instance for the multi assoc name.
*/
public BaseBusinessClass getMultiAssocReferenceInstance(String attribName)
{
return super.getMultiAssocReferenceInstance(attribName);
}
public String getMultiAssocBackReference(String attribName)
{
return super.getMultiAssocBackReference(attribName);
}
/**
* Get the assoc count for the multi assoc name.
*/
public int getMultiAssocCount(String attribName) throws StorageException
{
return super.getMultiAssocCount(attribName);
}
/**
* Get the assoc at a particular index
*/
public BaseBusinessClass getMultiAssocAt(String attribName, int index) throws StorageException
{
return super.getMultiAssocAt(attribName, index);
}
/**
* Add to a multi assoc by attribute name
*/
public void addToMultiAssoc(String attribName, BaseBusinessClass newElement) throws StorageException
{
super.addToMultiAssoc(attribName, newElement);
}
/**
* Remove from a multi assoc by attribute name
*/
public void removeFromMultiAssoc(String attribName, BaseBusinessClass oldElement) throws StorageException
{
super.removeFromMultiAssoc(attribName, oldElement);
}
protected void __loadMultiAssoc (String attribName, BaseBusinessClass[] elements)
{
super.__loadMultiAssoc(attribName, elements);
}
protected boolean __isMultiAssocLoaded (String attribName)
{
return super.__isMultiAssocLoaded(attribName);
}
public void onDelete ()
{
try
{
// Ensure we are removed from any loaded multi-associations that aren't mandatory
if (_CandidateAnswer.isLoaded () || getTransaction ().isObjectLoaded (_CandidateAnswer.getReferencedType (), getCandidateAnswerID ()))
{
CandidateDiversityAnswer referenced = getCandidateAnswer ();
if (referenced != null)
{
// Stop the callback
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null Answers from ", getObjectID (), " to ", referenced.getObjectID ());
_CandidateAnswer.set (null);
referenced.removeFromAnswers ((AnswerOption)this);
}
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
super.onDelete ();
}
public AnswerOption newInstance ()
{
return new AnswerOption ();
}
public AnswerOption referenceInstance ()
{
return REFERENCE_AnswerOption;
}
public AnswerOption getInTransaction (ObjectTransaction t) throws StorageException
{
return getAnswerOptionByID (t, getObjectID());
}
public BaseBusinessClass dummyInstance ()
{
return DUMMY_AnswerOption;
}
public String getBaseSetName ()
{
return "tl_answer_option";
}
/**
* This is where an object returns the Persistent sets that will
* store it into the database.
* The should be entered into allSets
*/
public void getPersistentSets (PersistentSetCollection allSets)
{
ObjectStatus myStatus = getStatus ();
PersistentSetStatus myPSetStatus = myStatus.getPSetStatus();
ObjectID myID = getID();
super.getPersistentSets (allSets);
PersistentSet tl_answer_optionPSet = allSets.getPersistentSet (myID, "tl_answer_option", myPSetStatus);
tl_answer_optionPSet.setAttrib (FIELD_ObjectID, myID);
tl_answer_optionPSet.setAttrib (FIELD_IsSelected, HELPER_IsSelected.toObject (_IsSelected)); //
_CandidateAnswer.getPersistentSets (allSets);
_Answer.getPersistentSets (allSets);
}
/**
* Sets the objects state based on Persistent sets.
*/
public void setFromPersistentSets (ObjectID objectID, PersistentSetCollection allSets)
{
super.setFromPersistentSets (objectID, allSets);
PersistentSet tl_answer_optionPSet = allSets.getPersistentSet (objectID, "tl_answer_option");
_IsSelected = (Boolean)(HELPER_IsSelected.fromObject (_IsSelected, tl_answer_optionPSet.getAttrib (FIELD_IsSelected))); //
_CandidateAnswer.setFromPersistentSets (objectID, allSets);
_Answer.setFromPersistentSets (objectID, allSets);
}
public void setAttributesFrom (BaseBusinessClass other, MultiException e)
{
super.setAttributesFrom (other, e);
if (other instanceof AnswerOption)
{
AnswerOption otherAnswerOption = (AnswerOption)other;
try
{
setIsSelected (otherAnswerOption.getIsSelected ());
}
catch (FieldException ex)
{
e.addException (ex);
}
}
}
/**
* Set the attributes in this to copies of the attributes in source.
*/
public void copyAttributesFrom (BaseBusinessClass source)
{
super.copyAttributesFrom (source);
if (source instanceof BaseAnswerOption)
{
BaseAnswerOption sourceAnswerOption = (BaseAnswerOption)(source);
_IsSelected = sourceAnswerOption._IsSelected;
}
}
/**
* Set the associations in this to copies of the attributes in source.
*/
public void copySingleAssociationsFrom (BaseBusinessClass source, boolean linkToGhosts)
{
super.copySingleAssociationsFrom (source, linkToGhosts);
if (source instanceof BaseAnswerOption)
{
BaseAnswerOption sourceAnswerOption = (BaseAnswerOption)(source);
_CandidateAnswer.copyFrom (sourceAnswerOption._CandidateAnswer, linkToGhosts);
_Answer.copyFrom (sourceAnswerOption._Answer, linkToGhosts);
}
}
/**
* Set the associations in this to copies of the attributes in source.
*/
public void copyAssociationsFrom (BaseBusinessClass source, boolean linkToGhosts)
{
super.copyAssociationsFrom (source, linkToGhosts);
if (source instanceof BaseAnswerOption)
{
BaseAnswerOption sourceAnswerOption = (BaseAnswerOption)(source);
}
}
public void validate (ValidationContext context)
{
super.validate (context);
context.check (getCandidateAnswerID() != null, this, SINGLEREFERENCE_CandidateAnswer, "mandatory");
context.check (getAnswerID() != null, this, SINGLEREFERENCE_Answer, "mandatory");
}
/**
* Subclasses must override this to read in their attributes
*/
protected void readExternalData(Map<String, Object> vals) throws IOException, ClassNotFoundException
{
super.readExternalData(vals);
_IsSelected = (Boolean)(HELPER_IsSelected.readExternal (_IsSelected, vals.get(FIELD_IsSelected))); //
_CandidateAnswer.readExternalData(vals.get(SINGLEREFERENCE_CandidateAnswer));
_Answer.readExternalData(vals.get(SINGLEREFERENCE_Answer));
}
/**
* Subclasses must override this to write out their attributes
*/
protected void writeExternalData(Map<String, Object> vals) throws IOException
{
super.writeExternalData(vals);
vals.put (FIELD_IsSelected, HELPER_IsSelected.writeExternal (_IsSelected));
vals.put (SINGLEREFERENCE_CandidateAnswer, _CandidateAnswer.writeExternalData());
vals.put (SINGLEREFERENCE_Answer, _Answer.writeExternalData());
}
public void compare (BaseBusinessClass other, AttributeChangeListener listener) throws StorageException
{
super.compare (other, listener);
if (other instanceof BaseAnswerOption)
{
BaseAnswerOption otherAnswerOption = (BaseAnswerOption)(other);
if (!HELPER_IsSelected.compare(this._IsSelected, otherAnswerOption._IsSelected))
{
listener.notifyFieldChange(this, other, FIELD_IsSelected, HELPER_IsSelected.toObject(this._IsSelected), HELPER_IsSelected.toObject(otherAnswerOption._IsSelected));
}
// Compare single assocs
_CandidateAnswer.compare (otherAnswerOption._CandidateAnswer, listener);
_Answer.compare (otherAnswerOption._Answer, listener);
// Compare multiple assocs
}
}
public void visitTransients (AttributeVisitor visitor) throws StorageException
{
super.visitAttributes (visitor);
}
public void visitAttributes (AttributeVisitor visitor) throws StorageException
{
super.visitAttributes (visitor);
visitor.visitField(this, FIELD_IsSelected, HELPER_IsSelected.toObject(getIsSelected()));
visitor.visitAssociation (_CandidateAnswer);
visitor.visitAssociation (_Answer);
}
public void visitAssociations (AssociationVisitor visitor, AssociatedScope scope) throws StorageException
{
super.visitAssociations (visitor, scope);
if (scope.includes (_CandidateAnswer))
{
visitor.visit (_CandidateAnswer);
}
if (scope.includes (_Answer))
{
visitor.visit (_Answer);
}
}
public static AnswerOption createAnswerOption (ObjectTransaction transaction) throws StorageException
{
AnswerOption result = new AnswerOption ();
result.initialiseNewObject (transaction);
return result;
}
public static AnswerOption getAnswerOptionByID (ObjectTransaction transaction, Long objectID) throws StorageException
{
return (AnswerOption)(transaction.getObjectByID (REFERENCE_AnswerOption, objectID));
}
public boolean testFilter (String attribName, QueryFilter filter) throws StorageException
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_IsSelected))
{
return filter.matches (getIsSelected ());
}
else if (attribName.equals (SINGLEREFERENCE_CandidateAnswer))
{
return filter.matches (getCandidateAnswer ());
}
else if (attribName.equals (SINGLEREFERENCE_Answer))
{
return filter.matches (getAnswer ());
}
else
{
return super.testFilter (attribName, filter);
}
}
public static SearchAll SearchByAll () { return new SearchAll (); }
public static class SearchAll extends SearchObject<AnswerOption>
{
public SearchAll andObjectID (QueryFilter<Long> filter)
{
filter.addFilter (context, "tl_answer_option.object_id", FIELD_ObjectID);
return this;
}
public SearchAll andObjectCreated (QueryFilter<Date> filter)
{
filter.addFilter (context, "tl_answer_option.object_created_date", FIELD_ObjectCreated);
return this;
}
public SearchAll andObjectLastModified (QueryFilter<Date> filter)
{
filter.addFilter (context, "tl_answer_option.object_last_updated_date", FIELD_ObjectLastModified);
return this;
}
public SearchAll andIsSelected (QueryFilter<Boolean> filter)
{
filter.addFilter (context, "tl_answer_option.is_selected", "IsSelected");
return this;
}
public SearchAll andCandidateAnswer (QueryFilter<CandidateDiversityAnswer> filter)
{
filter.addFilter (context, "tl_answer_option.candidate_answer_id", "CandidateAnswer");
return this;
}
public SearchAll andAnswer (QueryFilter<DiversityAnswer> filter)
{
filter.addFilter (context, "tl_answer_option.answer_id", "Answer");
return this;
}
public AnswerOption[]
search (ObjectTransaction transaction) throws StorageException
{
BaseBusinessClass[] results = super.search (transaction, REFERENCE_AnswerOption, SEARCH_All, criteria);
Set<AnswerOption> typedResults = new LinkedHashSet <AnswerOption> ();
for (BaseBusinessClass bbcResult : results)
{
AnswerOption aResult = (AnswerOption)bbcResult;
typedResults.add (aResult);
}
return ObjstoreUtils.removeDeleted(transaction, typedResults).toArray (new AnswerOption[0]);
}
}
public static AnswerOption[]
searchAll (ObjectTransaction transaction) throws StorageException
{
return SearchByAll ()
.search (transaction);
}
public Object getAttribute (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_IsSelected))
{
return HELPER_IsSelected.toObject (getIsSelected ());
}
else
{
return super.getAttribute (attribName);
}
}
public AttributeHelper getAttributeHelper (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_IsSelected))
{
return HELPER_IsSelected;
}
else
{
return super.getAttributeHelper (attribName);
}
}
public void setAttribute (String attribName, Object attribValue) throws FieldException
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_IsSelected))
{
setIsSelected ((Boolean)(HELPER_IsSelected.fromObject (_IsSelected, attribValue)));
}
else
{
super.setAttribute (attribName, attribValue);
}
}
public boolean isWriteable (String fieldName)
{
return getWriteable (fieldName) == FieldWriteability.TRUE;
}
public FieldWriteability getWriteable (String fieldName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (fieldName.equals (FIELD_IsSelected))
{
return getWriteability_IsSelected ();
}
else if (fieldName.equals (SINGLEREFERENCE_CandidateAnswer))
{
return getWriteability_CandidateAnswer ();
}
else if (fieldName.equals (SINGLEREFERENCE_Answer))
{
return getWriteability_Answer ();
}
else
{
return super.getWriteable (fieldName);
}
}
public void putUnwriteable (Set<String> fields)
{
if (getWriteability_IsSelected () != FieldWriteability.TRUE)
{
fields.add (FIELD_IsSelected);
}
super.putUnwriteable (fields);
}
public List<AbstractAttribute> getAttributes ()
{
List result = super.getAttributes ();
result.add(HELPER_IsSelected.getAttribObject (getClass (), _IsSelected, false, FIELD_IsSelected));
return result;
}
public Map getAttributeMetadata (String attribute)
{
if (ATTRIBUTES_METADATA_AnswerOption.containsKey (attribute))
{
return (Map)ATTRIBUTES_METADATA_AnswerOption.get (attribute);
}
else
{
return super.getAttributeMetadata (attribute);
}
}
public Object getAttributeMetadata (String attribute, String metadata)
{
if (ATTRIBUTES_METADATA_AnswerOption.containsKey (attribute))
{
return ((Map)ATTRIBUTES_METADATA_AnswerOption.get (attribute)).get(metadata);
}
else
{
return super.getAttributeMetadata (attribute, metadata);
}
}
public void preCommit (boolean willBeStored) throws Exception
{
super.preCommit(willBeStored);
if(willBeStored)
{
}
}
public oneit.servlets.objstore.binary.BinaryContentHandler getBinaryContentHandler(String attribName)
{
return super.getBinaryContentHandler(attribName);
}
public static class AnswerOptionBehaviourDecorator extends BaseBusinessClass.BBCBehaviourDecorator<AnswerOption>
{
/**
* Get the attribute IsSelected
*/
public Boolean getIsSelected (AnswerOption obj, Boolean original)
{
return original;
}
/**
* Change the value set for attribute IsSelected.
* May modify the field beforehand
* Occurs before validation.
*/
public Boolean setIsSelected (AnswerOption obj, Boolean newIsSelected) throws FieldException
{
return newIsSelected;
}
}
public ORMPipeLine pipes()
{
return new AnswerOptionPipeLineFactory<AnswerOption, AnswerOption> ((AnswerOption)this);
}
/**
* Use this instead of pipes() to get rid of type casting.
*/
public AnswerOptionPipeLineFactory<AnswerOption, AnswerOption> pipelineAnswerOption()
{
return (AnswerOptionPipeLineFactory<AnswerOption, AnswerOption>) pipes();
}
public static AnswerOptionPipeLineFactory<AnswerOption, AnswerOption> pipesAnswerOption(Collection<AnswerOption> items)
{
return REFERENCE_AnswerOption.new AnswerOptionPipeLineFactory<AnswerOption, AnswerOption> (items);
}
public static AnswerOptionPipeLineFactory<AnswerOption, AnswerOption> pipesAnswerOption(AnswerOption[] _items)
{
return pipesAnswerOption(Arrays.asList (_items));
}
public static AnswerOptionPipeLineFactory<AnswerOption, AnswerOption> pipesAnswerOption()
{
return pipesAnswerOption((Collection)null);
}
public class AnswerOptionPipeLineFactory<From extends BaseBusinessClass, Me extends AnswerOption> extends BaseBusinessClass.ORMPipeLine<From, Me>
{
public <Prev> AnswerOptionPipeLineFactory (PipeLine<From, Prev> pipeLine, Pipe<Prev, Me> nextPipe)
{
super (pipeLine, nextPipe);
}
public AnswerOptionPipeLineFactory (From seed)
{
super(seed);
}
public AnswerOptionPipeLineFactory (Collection<From> seed)
{
super(seed);
}
public PipeLine<From, ? extends Object> to(String name)
{
if (name.equals ("IsSelected"))
{
return toIsSelected ();
}
if (name.equals ("CandidateAnswer"))
{
return toCandidateAnswer ();
}
if (name.equals ("Answer"))
{
return toAnswer ();
}
return super.to(name);
}
public PipeLine<From, Boolean> toIsSelected () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_IsSelected)); }
public CandidateDiversityAnswer.CandidateDiversityAnswerPipeLineFactory<From, CandidateDiversityAnswer> toCandidateAnswer () { return toCandidateAnswer (Filter.ALL); }
public CandidateDiversityAnswer.CandidateDiversityAnswerPipeLineFactory<From, CandidateDiversityAnswer> toCandidateAnswer (Filter<CandidateDiversityAnswer> filter)
{
return CandidateDiversityAnswer.REFERENCE_CandidateDiversityAnswer.new CandidateDiversityAnswerPipeLineFactory<From, CandidateDiversityAnswer> (this, new ORMSingleAssocPipe<Me, CandidateDiversityAnswer>(SINGLEREFERENCE_CandidateAnswer, filter));
}
public DiversityAnswer.DiversityAnswerPipeLineFactory<From, DiversityAnswer> toAnswer () { return toAnswer (Filter.ALL); }
public DiversityAnswer.DiversityAnswerPipeLineFactory<From, DiversityAnswer> toAnswer (Filter<DiversityAnswer> filter)
{
return DiversityAnswer.REFERENCE_DiversityAnswer.new DiversityAnswerPipeLineFactory<From, DiversityAnswer> (this, new ORMSingleAssocPipe<Me, DiversityAnswer>(SINGLEREFERENCE_Answer, filter));
}
}
public boolean isTransientAttrib(String attribName)
{
return super.isTransientAttrib(attribName);
}
public boolean isTransientSingleReference(String assocName)
{
return super.isTransientSingleReference(assocName);
}
}
class DummyAnswerOption extends AnswerOption
{
// Default constructor primarily to support Externalisable
public DummyAnswerOption()
{
super();
}
public void assertValid ()
{
}
public CandidateDiversityAnswer getCandidateAnswer () throws StorageException
{
return (CandidateDiversityAnswer)(CandidateDiversityAnswer.DUMMY_CandidateDiversityAnswer);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getCandidateAnswerID ()
{
return CandidateDiversityAnswer.DUMMY_CandidateDiversityAnswer.getObjectID();
}
public DiversityAnswer getAnswer () throws StorageException
{
return (DiversityAnswer)(DiversityAnswer.DUMMY_DiversityAnswer);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getAnswerID ()
{
return DiversityAnswer.DUMMY_DiversityAnswer.getObjectID();
}
}
...@@ -64,6 +64,8 @@ public abstract class BaseCandidate extends SecUserExtension ...@@ -64,6 +64,8 @@ public abstract class BaseCandidate extends SecUserExtension
public static final String BACKREF_CultureCriteriaAnswers = ""; public static final String BACKREF_CultureCriteriaAnswers = "";
public static final String MULTIPLEREFERENCE_ProfileAssessmentAnswers = "ProfileAssessmentAnswers"; public static final String MULTIPLEREFERENCE_ProfileAssessmentAnswers = "ProfileAssessmentAnswers";
public static final String BACKREF_ProfileAssessmentAnswers = ""; public static final String BACKREF_ProfileAssessmentAnswers = "";
public static final String MULTIPLEREFERENCE_DiversityAnswers = "DiversityAnswers";
public static final String BACKREF_DiversityAnswers = "";
// Static constants corresponding to searches // Static constants corresponding to searches
public static final String SEARCH_All = "All"; public static final String SEARCH_All = "All";
...@@ -114,6 +116,7 @@ public abstract class BaseCandidate extends SecUserExtension ...@@ -114,6 +116,7 @@ public abstract class BaseCandidate extends SecUserExtension
private MultipleAssociation<Candidate, JobApplication> _JobApplications; private MultipleAssociation<Candidate, JobApplication> _JobApplications;
private MultipleAssociation<Candidate, CultureCriteriaAnswer> _CultureCriteriaAnswers; private MultipleAssociation<Candidate, CultureCriteriaAnswer> _CultureCriteriaAnswers;
private MultipleAssociation<Candidate, Answer> _ProfileAssessmentAnswers; private MultipleAssociation<Candidate, Answer> _ProfileAssessmentAnswers;
private MultipleAssociation<Candidate, CandidateDiversityAnswer> _DiversityAnswers;
// Map of maps of metadata // Map of maps of metadata
...@@ -148,6 +151,7 @@ public abstract class BaseCandidate extends SecUserExtension ...@@ -148,6 +151,7 @@ public abstract class BaseCandidate extends SecUserExtension
String tmp_JobApplications = JobApplication.BACKREF_Candidate; String tmp_JobApplications = JobApplication.BACKREF_Candidate;
String tmp_CultureCriteriaAnswers = CultureCriteriaAnswer.BACKREF_Candidate; String tmp_CultureCriteriaAnswers = CultureCriteriaAnswer.BACKREF_Candidate;
String tmp_ProfileAssessmentAnswers = Answer.BACKREF_Candidate; String tmp_ProfileAssessmentAnswers = Answer.BACKREF_Candidate;
String tmp_DiversityAnswers = CandidateDiversityAnswer.BACKREF_Candidate;
String tmp_TestInput = TestInput.BACKREF_Candidates; String tmp_TestInput = TestInput.BACKREF_Candidates;
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping")); Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
...@@ -156,6 +160,7 @@ public abstract class BaseCandidate extends SecUserExtension ...@@ -156,6 +160,7 @@ public abstract class BaseCandidate extends SecUserExtension
setupAssocMetaData_JobApplications(); setupAssocMetaData_JobApplications();
setupAssocMetaData_CultureCriteriaAnswers(); setupAssocMetaData_CultureCriteriaAnswers();
setupAssocMetaData_ProfileAssessmentAnswers(); setupAssocMetaData_ProfileAssessmentAnswers();
setupAssocMetaData_DiversityAnswers();
setupAssocMetaData_TestInput(); setupAssocMetaData_TestInput();
FIELD_PrivacyPolicyAgreed_Validators = (AttributeValidator[])setupAttribMetaData_PrivacyPolicyAgreed(validatorMapping).toArray (new AttributeValidator[0]); FIELD_PrivacyPolicyAgreed_Validators = (AttributeValidator[])setupAttribMetaData_PrivacyPolicyAgreed(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_ConditionsAgreed_Validators = (AttributeValidator[])setupAttribMetaData_ConditionsAgreed(validatorMapping).toArray (new AttributeValidator[0]); FIELD_ConditionsAgreed_Validators = (AttributeValidator[])setupAttribMetaData_ConditionsAgreed(validatorMapping).toArray (new AttributeValidator[0]);
...@@ -242,6 +247,20 @@ public abstract class BaseCandidate extends SecUserExtension ...@@ -242,6 +247,20 @@ public abstract class BaseCandidate extends SecUserExtension
// Meta Info setup // Meta Info setup
private static void setupAssocMetaData_DiversityAnswers()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "Candidate");
metaInfo.put ("name", "DiversityAnswers");
metaInfo.put ("type", "CandidateDiversityAnswer");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Candidate.DiversityAnswers:", metaInfo);
ATTRIBUTES_METADATA_Candidate.put (MULTIPLEREFERENCE_DiversityAnswers, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static void setupAssocMetaData_TestInput() private static void setupAssocMetaData_TestInput()
{ {
Map metaInfo = new HashMap (); Map metaInfo = new HashMap ();
...@@ -571,6 +590,7 @@ public abstract class BaseCandidate extends SecUserExtension ...@@ -571,6 +590,7 @@ public abstract class BaseCandidate extends SecUserExtension
_JobApplications = new MultipleAssociation<Candidate, JobApplication> (this, MULTIPLEREFERENCE_JobApplications, JobApplication.SINGLEREFERENCE_Candidate, JobApplication.REFERENCE_JobApplication); _JobApplications = new MultipleAssociation<Candidate, JobApplication> (this, MULTIPLEREFERENCE_JobApplications, JobApplication.SINGLEREFERENCE_Candidate, JobApplication.REFERENCE_JobApplication);
_CultureCriteriaAnswers = new MultipleAssociation<Candidate, CultureCriteriaAnswer> (this, MULTIPLEREFERENCE_CultureCriteriaAnswers, CultureCriteriaAnswer.SINGLEREFERENCE_Candidate, CultureCriteriaAnswer.REFERENCE_CultureCriteriaAnswer); _CultureCriteriaAnswers = new MultipleAssociation<Candidate, CultureCriteriaAnswer> (this, MULTIPLEREFERENCE_CultureCriteriaAnswers, CultureCriteriaAnswer.SINGLEREFERENCE_Candidate, CultureCriteriaAnswer.REFERENCE_CultureCriteriaAnswer);
_ProfileAssessmentAnswers = new MultipleAssociation<Candidate, Answer> (this, MULTIPLEREFERENCE_ProfileAssessmentAnswers, Answer.SINGLEREFERENCE_Candidate, Answer.REFERENCE_Answer); _ProfileAssessmentAnswers = new MultipleAssociation<Candidate, Answer> (this, MULTIPLEREFERENCE_ProfileAssessmentAnswers, Answer.SINGLEREFERENCE_Candidate, Answer.REFERENCE_Answer);
_DiversityAnswers = new MultipleAssociation<Candidate, CandidateDiversityAnswer> (this, MULTIPLEREFERENCE_DiversityAnswers, CandidateDiversityAnswer.SINGLEREFERENCE_Candidate, CandidateDiversityAnswer.REFERENCE_CandidateDiversityAnswer);
} }
...@@ -585,6 +605,7 @@ public abstract class BaseCandidate extends SecUserExtension ...@@ -585,6 +605,7 @@ public abstract class BaseCandidate extends SecUserExtension
_JobApplications = new MultipleAssociation<Candidate, JobApplication> (this, MULTIPLEREFERENCE_JobApplications, JobApplication.SINGLEREFERENCE_Candidate, JobApplication.REFERENCE_JobApplication); _JobApplications = new MultipleAssociation<Candidate, JobApplication> (this, MULTIPLEREFERENCE_JobApplications, JobApplication.SINGLEREFERENCE_Candidate, JobApplication.REFERENCE_JobApplication);
_CultureCriteriaAnswers = new MultipleAssociation<Candidate, CultureCriteriaAnswer> (this, MULTIPLEREFERENCE_CultureCriteriaAnswers, CultureCriteriaAnswer.SINGLEREFERENCE_Candidate, CultureCriteriaAnswer.REFERENCE_CultureCriteriaAnswer); _CultureCriteriaAnswers = new MultipleAssociation<Candidate, CultureCriteriaAnswer> (this, MULTIPLEREFERENCE_CultureCriteriaAnswers, CultureCriteriaAnswer.SINGLEREFERENCE_Candidate, CultureCriteriaAnswer.REFERENCE_CultureCriteriaAnswer);
_ProfileAssessmentAnswers = new MultipleAssociation<Candidate, Answer> (this, MULTIPLEREFERENCE_ProfileAssessmentAnswers, Answer.SINGLEREFERENCE_Candidate, Answer.REFERENCE_Answer); _ProfileAssessmentAnswers = new MultipleAssociation<Candidate, Answer> (this, MULTIPLEREFERENCE_ProfileAssessmentAnswers, Answer.SINGLEREFERENCE_Candidate, Answer.REFERENCE_Answer);
_DiversityAnswers = new MultipleAssociation<Candidate, CandidateDiversityAnswer> (this, MULTIPLEREFERENCE_DiversityAnswers, CandidateDiversityAnswer.SINGLEREFERENCE_Candidate, CandidateDiversityAnswer.REFERENCE_CandidateDiversityAnswer);
return this; return this;
...@@ -2207,6 +2228,8 @@ public abstract class BaseCandidate extends SecUserExtension ...@@ -2207,6 +2228,8 @@ public abstract class BaseCandidate extends SecUserExtension
result.add("ProfileAssessmentAnswers"); result.add("ProfileAssessmentAnswers");
result.add("DiversityAnswers");
return result; return result;
} }
...@@ -2238,6 +2261,11 @@ public abstract class BaseCandidate extends SecUserExtension ...@@ -2238,6 +2261,11 @@ public abstract class BaseCandidate extends SecUserExtension
return Answer.REFERENCE_Answer ; return Answer.REFERENCE_Answer ;
} }
if (MULTIPLEREFERENCE_DiversityAnswers.equals(attribName))
{
return CandidateDiversityAnswer.REFERENCE_CandidateDiversityAnswer ;
}
return super.getMultiAssocReferenceInstance(attribName); return super.getMultiAssocReferenceInstance(attribName);
} }
...@@ -2266,6 +2294,11 @@ public abstract class BaseCandidate extends SecUserExtension ...@@ -2266,6 +2294,11 @@ public abstract class BaseCandidate extends SecUserExtension
return Answer.SINGLEREFERENCE_Candidate ; return Answer.SINGLEREFERENCE_Candidate ;
} }
if (MULTIPLEREFERENCE_DiversityAnswers.equals(attribName))
{
return CandidateDiversityAnswer.SINGLEREFERENCE_Candidate ;
}
return super.getMultiAssocBackReference(attribName); return super.getMultiAssocBackReference(attribName);
} }
...@@ -2297,6 +2330,11 @@ public abstract class BaseCandidate extends SecUserExtension ...@@ -2297,6 +2330,11 @@ public abstract class BaseCandidate extends SecUserExtension
return this.getProfileAssessmentAnswersCount(); return this.getProfileAssessmentAnswersCount();
} }
if (MULTIPLEREFERENCE_DiversityAnswers.equals(attribName))
{
return this.getDiversityAnswersCount();
}
return super.getMultiAssocCount(attribName); return super.getMultiAssocCount(attribName);
} }
...@@ -2328,6 +2366,11 @@ public abstract class BaseCandidate extends SecUserExtension ...@@ -2328,6 +2366,11 @@ public abstract class BaseCandidate extends SecUserExtension
return this.getProfileAssessmentAnswersAt(index); return this.getProfileAssessmentAnswersAt(index);
} }
if (MULTIPLEREFERENCE_DiversityAnswers.equals(attribName))
{
return this.getDiversityAnswersAt(index);
}
return super.getMultiAssocAt(attribName, index); return super.getMultiAssocAt(attribName, index);
} }
...@@ -2367,6 +2410,13 @@ public abstract class BaseCandidate extends SecUserExtension ...@@ -2367,6 +2410,13 @@ public abstract class BaseCandidate extends SecUserExtension
return; return;
} }
if (MULTIPLEREFERENCE_DiversityAnswers.equals(attribName))
{
addToDiversityAnswers((CandidateDiversityAnswer)newElement);
return;
}
super.addToMultiAssoc(attribName, newElement); super.addToMultiAssoc(attribName, newElement);
} }
...@@ -2405,6 +2455,13 @@ public abstract class BaseCandidate extends SecUserExtension ...@@ -2405,6 +2455,13 @@ public abstract class BaseCandidate extends SecUserExtension
return; return;
} }
if (MULTIPLEREFERENCE_DiversityAnswers.equals(attribName))
{
removeFromDiversityAnswers((CandidateDiversityAnswer)oldElement);
return;
}
super.removeFromMultiAssoc(attribName, oldElement); super.removeFromMultiAssoc(attribName, oldElement);
} }
...@@ -2437,6 +2494,12 @@ public abstract class BaseCandidate extends SecUserExtension ...@@ -2437,6 +2494,12 @@ public abstract class BaseCandidate extends SecUserExtension
return; return;
} }
if (MULTIPLEREFERENCE_DiversityAnswers.equals(attribName))
{
_DiversityAnswers.__loadAssociation (elements);
return;
}
super.__loadMultiAssoc(attribName, elements); super.__loadMultiAssoc(attribName, elements);
} }
...@@ -2465,6 +2528,11 @@ public abstract class BaseCandidate extends SecUserExtension ...@@ -2465,6 +2528,11 @@ public abstract class BaseCandidate extends SecUserExtension
return _ProfileAssessmentAnswers.isLoaded (); return _ProfileAssessmentAnswers.isLoaded ();
} }
if (MULTIPLEREFERENCE_DiversityAnswers.equals(attribName))
{
return _DiversityAnswers.isLoaded ();
}
return super.__isMultiAssocLoaded(attribName); return super.__isMultiAssocLoaded(attribName);
} }
...@@ -2747,6 +2815,75 @@ public abstract class BaseCandidate extends SecUserExtension ...@@ -2747,6 +2815,75 @@ public abstract class BaseCandidate extends SecUserExtension
return _ProfileAssessmentAnswers.getSet (); return _ProfileAssessmentAnswers.getSet ();
} }
public FieldWriteability getWriteability_DiversityAnswers ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
public int getDiversityAnswersCount () throws StorageException
{
assertValid();
return _DiversityAnswers.getReferencedObjectsCount ();
}
public void addToDiversityAnswers (CandidateDiversityAnswer newElement) throws StorageException
{
if (_DiversityAnswers.wouldAddChange (newElement))
{
assertValid();
Debug.assertion (getWriteability_DiversityAnswers () != FieldWriteability.FALSE, "MultiAssoc DiversityAnswers is not writeable (add)");
_DiversityAnswers.appendElement (newElement);
try
{
if (newElement.getCandidate () != this)
{
newElement.setCandidate ((Candidate)(this));
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
}
}
public void removeFromDiversityAnswers (CandidateDiversityAnswer elementToRemove) throws StorageException
{
if (_DiversityAnswers.wouldRemoveChange (elementToRemove))
{
assertValid();
Debug.assertion (getWriteability_DiversityAnswers () != FieldWriteability.FALSE, "MultiAssoc DiversityAnswers is not writeable (remove)");
_DiversityAnswers.removeElement (elementToRemove);
try
{
if (elementToRemove.getCandidate () != null)
{
elementToRemove.setCandidate (null);
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
}
}
public CandidateDiversityAnswer getDiversityAnswersAt (int index) throws StorageException
{
return (CandidateDiversityAnswer)(_DiversityAnswers.getElementAt (index));
}
public SortedSet<CandidateDiversityAnswer> getDiversityAnswersSet () throws StorageException
{
return _DiversityAnswers.getSet ();
}
public void onDelete () public void onDelete ()
...@@ -2791,6 +2928,12 @@ public abstract class BaseCandidate extends SecUserExtension ...@@ -2791,6 +2928,12 @@ public abstract class BaseCandidate extends SecUserExtension
referenced.setCandidate(null); referenced.setCandidate(null);
} }
for(CandidateDiversityAnswer referenced : CollectionUtils.reverse(getDiversityAnswersSet()))
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null Candidate from ", getObjectID (), " to ", referenced.getObjectID ());
referenced.setCandidate(null);
}
} }
catch (Exception e) catch (Exception e)
{ {
...@@ -3069,6 +3212,7 @@ public abstract class BaseCandidate extends SecUserExtension ...@@ -3069,6 +3212,7 @@ public abstract class BaseCandidate extends SecUserExtension
_JobApplications.copyFrom (sourceCandidate._JobApplications, linkToGhosts); _JobApplications.copyFrom (sourceCandidate._JobApplications, linkToGhosts);
_CultureCriteriaAnswers.copyFrom (sourceCandidate._CultureCriteriaAnswers, linkToGhosts); _CultureCriteriaAnswers.copyFrom (sourceCandidate._CultureCriteriaAnswers, linkToGhosts);
_ProfileAssessmentAnswers.copyFrom (sourceCandidate._ProfileAssessmentAnswers, linkToGhosts); _ProfileAssessmentAnswers.copyFrom (sourceCandidate._ProfileAssessmentAnswers, linkToGhosts);
_DiversityAnswers.copyFrom (sourceCandidate._DiversityAnswers, linkToGhosts);
} }
} }
...@@ -3108,6 +3252,7 @@ public abstract class BaseCandidate extends SecUserExtension ...@@ -3108,6 +3252,7 @@ public abstract class BaseCandidate extends SecUserExtension
_JobApplications.readExternalData(vals.get(MULTIPLEREFERENCE_JobApplications)); _JobApplications.readExternalData(vals.get(MULTIPLEREFERENCE_JobApplications));
_CultureCriteriaAnswers.readExternalData(vals.get(MULTIPLEREFERENCE_CultureCriteriaAnswers)); _CultureCriteriaAnswers.readExternalData(vals.get(MULTIPLEREFERENCE_CultureCriteriaAnswers));
_ProfileAssessmentAnswers.readExternalData(vals.get(MULTIPLEREFERENCE_ProfileAssessmentAnswers)); _ProfileAssessmentAnswers.readExternalData(vals.get(MULTIPLEREFERENCE_ProfileAssessmentAnswers));
_DiversityAnswers.readExternalData(vals.get(MULTIPLEREFERENCE_DiversityAnswers));
} }
...@@ -3138,6 +3283,7 @@ public abstract class BaseCandidate extends SecUserExtension ...@@ -3138,6 +3283,7 @@ public abstract class BaseCandidate extends SecUserExtension
vals.put (MULTIPLEREFERENCE_JobApplications, _JobApplications.writeExternalData()); vals.put (MULTIPLEREFERENCE_JobApplications, _JobApplications.writeExternalData());
vals.put (MULTIPLEREFERENCE_CultureCriteriaAnswers, _CultureCriteriaAnswers.writeExternalData()); vals.put (MULTIPLEREFERENCE_CultureCriteriaAnswers, _CultureCriteriaAnswers.writeExternalData());
vals.put (MULTIPLEREFERENCE_ProfileAssessmentAnswers, _ProfileAssessmentAnswers.writeExternalData()); vals.put (MULTIPLEREFERENCE_ProfileAssessmentAnswers, _ProfileAssessmentAnswers.writeExternalData());
vals.put (MULTIPLEREFERENCE_DiversityAnswers, _DiversityAnswers.writeExternalData());
} }
...@@ -3205,6 +3351,7 @@ public abstract class BaseCandidate extends SecUserExtension ...@@ -3205,6 +3351,7 @@ public abstract class BaseCandidate extends SecUserExtension
_JobApplications.compare (otherCandidate._JobApplications, listener); _JobApplications.compare (otherCandidate._JobApplications, listener);
_CultureCriteriaAnswers.compare (otherCandidate._CultureCriteriaAnswers, listener); _CultureCriteriaAnswers.compare (otherCandidate._CultureCriteriaAnswers, listener);
_ProfileAssessmentAnswers.compare (otherCandidate._ProfileAssessmentAnswers, listener); _ProfileAssessmentAnswers.compare (otherCandidate._ProfileAssessmentAnswers, listener);
_DiversityAnswers.compare (otherCandidate._DiversityAnswers, listener);
} }
} }
...@@ -3241,6 +3388,7 @@ public abstract class BaseCandidate extends SecUserExtension ...@@ -3241,6 +3388,7 @@ public abstract class BaseCandidate extends SecUserExtension
visitor.visitAssociation (_JobApplications); visitor.visitAssociation (_JobApplications);
visitor.visitAssociation (_CultureCriteriaAnswers); visitor.visitAssociation (_CultureCriteriaAnswers);
visitor.visitAssociation (_ProfileAssessmentAnswers); visitor.visitAssociation (_ProfileAssessmentAnswers);
visitor.visitAssociation (_DiversityAnswers);
} }
...@@ -3269,6 +3417,10 @@ public abstract class BaseCandidate extends SecUserExtension ...@@ -3269,6 +3417,10 @@ public abstract class BaseCandidate extends SecUserExtension
{ {
visitor.visit (_ProfileAssessmentAnswers); visitor.visit (_ProfileAssessmentAnswers);
} }
if (scope.includes (_DiversityAnswers))
{
visitor.visit (_DiversityAnswers);
}
} }
...@@ -3938,6 +4090,10 @@ public abstract class BaseCandidate extends SecUserExtension ...@@ -3938,6 +4090,10 @@ public abstract class BaseCandidate extends SecUserExtension
{ {
return getWriteability_ProfileAssessmentAnswers (); return getWriteability_ProfileAssessmentAnswers ();
} }
else if (fieldName.equals (MULTIPLEREFERENCE_DiversityAnswers))
{
return getWriteability_DiversityAnswers ();
}
else if (fieldName.equals (SINGLEREFERENCE_TestInput)) else if (fieldName.equals (SINGLEREFERENCE_TestInput))
{ {
return getWriteability_TestInput (); return getWriteability_TestInput ();
...@@ -4427,6 +4583,10 @@ public abstract class BaseCandidate extends SecUserExtension ...@@ -4427,6 +4583,10 @@ public abstract class BaseCandidate extends SecUserExtension
{ {
return toProfileAssessmentAnswers (); return toProfileAssessmentAnswers ();
} }
if (name.equals ("DiversityAnswers"))
{
return toDiversityAnswers ();
}
if (name.equals ("PrivacyPolicyAgreed")) if (name.equals ("PrivacyPolicyAgreed"))
{ {
return toPrivacyPolicyAgreed (); return toPrivacyPolicyAgreed ();
...@@ -4550,6 +4710,12 @@ public abstract class BaseCandidate extends SecUserExtension ...@@ -4550,6 +4710,12 @@ public abstract class BaseCandidate extends SecUserExtension
{ {
return Answer.REFERENCE_Answer.new AnswerPipeLineFactory<From, Answer> (this, new ORMMultiAssocPipe<Me, Answer>(MULTIPLEREFERENCE_ProfileAssessmentAnswers, filter)); return Answer.REFERENCE_Answer.new AnswerPipeLineFactory<From, Answer> (this, new ORMMultiAssocPipe<Me, Answer>(MULTIPLEREFERENCE_ProfileAssessmentAnswers, filter));
} }
public CandidateDiversityAnswer.CandidateDiversityAnswerPipeLineFactory<From, CandidateDiversityAnswer> toDiversityAnswers () { return toDiversityAnswers(Filter.ALL); }
public CandidateDiversityAnswer.CandidateDiversityAnswerPipeLineFactory<From, CandidateDiversityAnswer> toDiversityAnswers (Filter<CandidateDiversityAnswer> filter)
{
return CandidateDiversityAnswer.REFERENCE_CandidateDiversityAnswer.new CandidateDiversityAnswerPipeLineFactory<From, CandidateDiversityAnswer> (this, new ORMMultiAssocPipe<Me, CandidateDiversityAnswer>(MULTIPLEREFERENCE_DiversityAnswers, filter));
}
} }
...@@ -4678,6 +4844,23 @@ class DummyCandidate extends Candidate ...@@ -4678,6 +4844,23 @@ class DummyCandidate extends Candidate
return new TreeSet(); return new TreeSet();
} }
public int getDiversityAnswersCount () throws StorageException
{
return 0;
}
public CandidateDiversityAnswer getDiversityAnswersAt (int index) throws StorageException
{
throw new RuntimeException ("No elements in a dummy object in association DiversityAnswers");
}
public SortedSet getDiversityAnswersSet () throws StorageException
{
return new TreeSet();
}
} }
/*
* IMPORTANT!!!! XSL Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2 rev3 [oneit.objstore.BusinessObjectTemplate.xsl]
*
* Version: 1.0
* Vendor: Apache Software Foundation (Xalan XSLTC)
* Vendor URL: http://xml.apache.org/xalan-j
*/
package performa.orm;
import java.io.*;
import java.util.*;
import oneit.appservices.config.*;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.objstore.assocs.*;
import oneit.objstore.attributes.*;
import oneit.objstore.rdbms.filters.*;
import oneit.objstore.parser.*;
import oneit.objstore.validator.*;
import oneit.objstore.utils.*;
import oneit.utils.*;
import oneit.utils.filter.Filter;
import oneit.utils.transform.*;
import oneit.utils.parsers.FieldException;
public abstract class BaseCandidateDiversityAnswer extends BaseBusinessClass
{
// Reference instance for the object
public static final CandidateDiversityAnswer REFERENCE_CandidateDiversityAnswer = new CandidateDiversityAnswer ();
// Reference instance for the object
public static final CandidateDiversityAnswer DUMMY_CandidateDiversityAnswer = new DummyCandidateDiversityAnswer ();
// Static constants corresponding to field names
public static final String SINGLEREFERENCE_AnswerOption = "AnswerOption";
public static final String SINGLEREFERENCE_Question = "Question";
public static final String SINGLEREFERENCE_Candidate = "Candidate";
public static final String BACKREF_Candidate = "";
public static final String MULTIPLEREFERENCE_Answers = "Answers";
public static final String BACKREF_Answers = "";
// Static constants corresponding to searches
public static final String SEARCH_All = "All";
// Static constants corresponding to attribute helpers
// Private attributes corresponding to business object data
// Private attributes corresponding to single references
private SingleAssociation<CandidateDiversityAnswer, DiversityAnswer> _AnswerOption;
private SingleAssociation<CandidateDiversityAnswer, DiversityQuestion> _Question;
private SingleAssociation<CandidateDiversityAnswer, Candidate> _Candidate;
// Private attributes corresponding to multiple references
private MultipleAssociation<CandidateDiversityAnswer, AnswerOption> _Answers;
// Map of maps of metadata
private static final Map ATTRIBUTES_METADATA_CandidateDiversityAnswer = new HashMap ();
// Arrays of validators for each attribute
// Arrays of behaviour decorators
private static final CandidateDiversityAnswerBehaviourDecorator[] CandidateDiversityAnswer_BehaviourDecorators;
static
{
try
{
String tmp_Answers = AnswerOption.BACKREF_CandidateAnswer;
String tmp_Candidate = Candidate.BACKREF_DiversityAnswers;
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
setupAssocMetaData_AnswerOption();
setupAssocMetaData_Answers();
setupAssocMetaData_Question();
setupAssocMetaData_Candidate();
REFERENCE_CandidateDiversityAnswer.initialiseReference ();
DUMMY_CandidateDiversityAnswer.initialiseReference ();
CandidateDiversityAnswer_BehaviourDecorators = BaseBusinessClass.getBBCBehaviours(CandidateDiversityAnswer.class).toArray(new CandidateDiversityAnswerBehaviourDecorator[0]);
}
catch (RuntimeException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR1, e, "Error initialising");
throw e;
}
}
// Meta Info setup
private static void setupAssocMetaData_AnswerOption()
{
Map metaInfo = new HashMap ();
metaInfo.put ("name", "AnswerOption");
metaInfo.put ("type", "DiversityAnswer");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for CandidateDiversityAnswer.AnswerOption:", metaInfo);
ATTRIBUTES_METADATA_CandidateDiversityAnswer.put (SINGLEREFERENCE_AnswerOption, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static void setupAssocMetaData_Answers()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "CandidateAnswer");
metaInfo.put ("name", "Answers");
metaInfo.put ("type", "AnswerOption");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for CandidateDiversityAnswer.Answers:", metaInfo);
ATTRIBUTES_METADATA_CandidateDiversityAnswer.put (MULTIPLEREFERENCE_Answers, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static void setupAssocMetaData_Question()
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "question_id");
metaInfo.put ("mandatory", "true");
metaInfo.put ("name", "Question");
metaInfo.put ("type", "DiversityQuestion");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for CandidateDiversityAnswer.Question:", metaInfo);
ATTRIBUTES_METADATA_CandidateDiversityAnswer.put (SINGLEREFERENCE_Question, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static void setupAssocMetaData_Candidate()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "DiversityAnswers");
metaInfo.put ("dbcol", "candidate_id");
metaInfo.put ("mandatory", "true");
metaInfo.put ("name", "Candidate");
metaInfo.put ("type", "Candidate");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for CandidateDiversityAnswer.Candidate:", metaInfo);
ATTRIBUTES_METADATA_CandidateDiversityAnswer.put (SINGLEREFERENCE_Candidate, Collections.unmodifiableMap (metaInfo));
}
// END OF STATIC METADATA DEFINITION
// This constructor should not be called
protected BaseCandidateDiversityAnswer ()
{
}
protected BBCBehaviourDecorator[] getBehaviours()
{
return CandidateDiversityAnswer_BehaviourDecorators;
}
// Initialise the attributes
protected void _initialiseNewObjAttributes (ObjectTransaction transaction) throws StorageException
{
super._initialiseNewObjAttributes (transaction);
}
// Initialise the associations
protected void _initialiseAssociations ()
{
super._initialiseAssociations ();
_AnswerOption = new SingleAssociation<CandidateDiversityAnswer, DiversityAnswer> (this, SINGLEREFERENCE_AnswerOption, null, DiversityAnswer.REFERENCE_DiversityAnswer, "");
_Question = new SingleAssociation<CandidateDiversityAnswer, DiversityQuestion> (this, SINGLEREFERENCE_Question, null, DiversityQuestion.REFERENCE_DiversityQuestion, "tl_candidate_diversity_answer");
_Candidate = new SingleAssociation<CandidateDiversityAnswer, Candidate> (this, SINGLEREFERENCE_Candidate, Candidate.MULTIPLEREFERENCE_DiversityAnswers, Candidate.REFERENCE_Candidate, "tl_candidate_diversity_answer");
_Answers = new MultipleAssociation<CandidateDiversityAnswer, AnswerOption> (this, MULTIPLEREFERENCE_Answers, AnswerOption.SINGLEREFERENCE_CandidateAnswer, AnswerOption.REFERENCE_AnswerOption);
}
// Initialise the associations
protected BaseBusinessClass initialiseReference ()
{
super.initialiseReference ();
_AnswerOption = new SingleAssociation<CandidateDiversityAnswer, DiversityAnswer> (this, SINGLEREFERENCE_AnswerOption, null, DiversityAnswer.REFERENCE_DiversityAnswer, "");
_Question = new SingleAssociation<CandidateDiversityAnswer, DiversityQuestion> (this, SINGLEREFERENCE_Question, null, DiversityQuestion.REFERENCE_DiversityQuestion, "tl_candidate_diversity_answer");
_Candidate = new SingleAssociation<CandidateDiversityAnswer, Candidate> (this, SINGLEREFERENCE_Candidate, Candidate.MULTIPLEREFERENCE_DiversityAnswers, Candidate.REFERENCE_Candidate, "tl_candidate_diversity_answer");
_Answers = new MultipleAssociation<CandidateDiversityAnswer, AnswerOption> (this, MULTIPLEREFERENCE_Answers, AnswerOption.SINGLEREFERENCE_CandidateAnswer, AnswerOption.REFERENCE_AnswerOption);
return this;
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getSingleAssocs()
{
List result = super.getSingleAssocs ();
result.add("AnswerOption");
result.add("Question");
result.add("Candidate");
return result;
}
public BaseBusinessClass getSingleAssocReferenceInstance (String assocName)
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_AnswerOption))
{
return _AnswerOption.getReferencedType ();
}else if (assocName.equals (SINGLEREFERENCE_Question))
{
return _Question.getReferencedType ();
}else if (assocName.equals (SINGLEREFERENCE_Candidate))
{
return _Candidate.getReferencedType ();
}
else
{
return super.getSingleAssocReferenceInstance (assocName);
}
}
public String getSingleAssocBackReference(String assocName)
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Question))
{
return null ;
}else if (assocName.equals (SINGLEREFERENCE_Candidate))
{
return Candidate.MULTIPLEREFERENCE_DiversityAnswers ;
}
else
{
return super.getSingleAssocBackReference (assocName);
}
}
public BaseBusinessClass getSingleAssoc (String assocName) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_AnswerOption))
{
return getAnswerOption ();
}else if (assocName.equals (SINGLEREFERENCE_Question))
{
return getQuestion ();
}else if (assocName.equals (SINGLEREFERENCE_Candidate))
{
return getCandidate ();
}
else
{
return super.getSingleAssoc (assocName);
}
}
public BaseBusinessClass getSingleAssoc (String assocName, Get getType) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_AnswerOption))
{
return getAnswerOption (getType);
}else if (assocName.equals (SINGLEREFERENCE_Question))
{
return getQuestion (getType);
}else if (assocName.equals (SINGLEREFERENCE_Candidate))
{
return getCandidate (getType);
}
else
{
return super.getSingleAssoc (assocName, getType);
}
}
public Long getSingleAssocID (String assocName) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_AnswerOption))
{
return getAnswerOptionID ();
}else if (assocName.equals (SINGLEREFERENCE_Question))
{
return getQuestionID ();
}else if (assocName.equals (SINGLEREFERENCE_Candidate))
{
return getCandidateID ();
}
else
{
return super.getSingleAssocID (assocName);
}
}
public void setSingleAssoc (String assocName, BaseBusinessClass newValue) throws StorageException, FieldException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_AnswerOption))
{
setAnswerOption ((DiversityAnswer)(newValue));
}else if (assocName.equals (SINGLEREFERENCE_Question))
{
setQuestion ((DiversityQuestion)(newValue));
}else if (assocName.equals (SINGLEREFERENCE_Candidate))
{
setCandidate ((Candidate)(newValue));
}
else
{
super.setSingleAssoc (assocName, newValue);
}
}
/**
* Get the reference AnswerOption
*/
public DiversityAnswer getAnswerOption () throws StorageException
{
assertValid();
try
{
return (DiversityAnswer)(_AnswerOption.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in CandidateDiversityAnswer:", this.getObjectID (), ", was trying to get DiversityAnswer:", getAnswerOptionID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _AnswerOption.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public DiversityAnswer getAnswerOption (Get getType) throws StorageException
{
assertValid();
return _AnswerOption.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getAnswerOptionID ()
{
assertValid();
if (_AnswerOption == null)
{
return null;
}
else
{
return _AnswerOption.getID ();
}
}
/**
* Called prior to the assoc changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preAnswerOptionChange (DiversityAnswer newAnswerOption) throws FieldException
{
}
/**
* Called after the assoc changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postAnswerOptionChange () throws FieldException
{
}
public FieldWriteability getWriteability_AnswerOption ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference AnswerOption. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setAnswerOption (DiversityAnswer newAnswerOption) throws StorageException, FieldException
{
if (_AnswerOption.wouldReferencedChange (newAnswerOption))
{
assertValid();
Debug.assertion (getWriteability_AnswerOption () != FieldWriteability.FALSE, "Assoc AnswerOption is not writeable");
preAnswerOptionChange (newAnswerOption);
_AnswerOption.set (newAnswerOption);
postAnswerOptionChange ();
}
}
/**
* Get the reference Question
*/
public DiversityQuestion getQuestion () throws StorageException
{
assertValid();
try
{
return (DiversityQuestion)(_Question.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in CandidateDiversityAnswer:", this.getObjectID (), ", was trying to get DiversityQuestion:", getQuestionID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _Question.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public DiversityQuestion getQuestion (Get getType) throws StorageException
{
assertValid();
return _Question.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getQuestionID ()
{
assertValid();
if (_Question == null)
{
return null;
}
else
{
return _Question.getID ();
}
}
/**
* Called prior to the assoc changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preQuestionChange (DiversityQuestion newQuestion) throws FieldException
{
}
/**
* Called after the assoc changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postQuestionChange () throws FieldException
{
}
public FieldWriteability getWriteability_Question ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference Question. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setQuestion (DiversityQuestion newQuestion) throws StorageException, FieldException
{
BusinessObjectParser.assertFieldCondition (newQuestion != null, this, SINGLEREFERENCE_Question, "mandatory");
if (_Question.wouldReferencedChange (newQuestion))
{
assertValid();
Debug.assertion (getWriteability_Question () != FieldWriteability.FALSE, "Assoc Question is not writeable");
preQuestionChange (newQuestion);
_Question.set (newQuestion);
postQuestionChange ();
}
}
/**
* Get the reference Candidate
*/
public Candidate getCandidate () throws StorageException
{
assertValid();
try
{
return (Candidate)(_Candidate.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in CandidateDiversityAnswer:", this.getObjectID (), ", was trying to get Candidate:", getCandidateID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _Candidate.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Candidate getCandidate (Get getType) throws StorageException
{
assertValid();
return _Candidate.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getCandidateID ()
{
assertValid();
if (_Candidate == null)
{
return null;
}
else
{
return _Candidate.getID ();
}
}
/**
* Called prior to the assoc changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preCandidateChange (Candidate newCandidate) throws FieldException
{
}
/**
* Called after the assoc changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postCandidateChange () throws FieldException
{
}
public FieldWriteability getWriteability_Candidate ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference Candidate. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setCandidate (Candidate newCandidate) throws StorageException, FieldException
{
BusinessObjectParser.assertFieldCondition (newCandidate != null, this, SINGLEREFERENCE_Candidate, "mandatory");
if (_Candidate.wouldReferencedChange (newCandidate))
{
assertValid();
Debug.assertion (getWriteability_Candidate () != FieldWriteability.FALSE, "Assoc Candidate is not writeable");
preCandidateChange (newCandidate);
Candidate oldCandidate = getCandidate ();
if (oldCandidate != null)
{
// This is to stop validation from triggering when we are removed
_Candidate.set (null);
oldCandidate.removeFromDiversityAnswers ((CandidateDiversityAnswer)(this));
}
_Candidate.set (newCandidate);
if (newCandidate != null)
{
newCandidate.addToDiversityAnswers ((CandidateDiversityAnswer)(this));
}
postCandidateChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getMultiAssocs()
{
List result = super.getMultiAssocs ();
result.add("Answers");
return result;
}
/**
* Get the reference instance for the multi assoc name.
*/
public BaseBusinessClass getMultiAssocReferenceInstance(String attribName)
{
if (MULTIPLEREFERENCE_Answers.equals(attribName))
{
return AnswerOption.REFERENCE_AnswerOption ;
}
return super.getMultiAssocReferenceInstance(attribName);
}
public String getMultiAssocBackReference(String attribName)
{
if (MULTIPLEREFERENCE_Answers.equals(attribName))
{
return AnswerOption.SINGLEREFERENCE_CandidateAnswer ;
}
return super.getMultiAssocBackReference(attribName);
}
/**
* Get the assoc count for the multi assoc name.
*/
public int getMultiAssocCount(String attribName) throws StorageException
{
if (MULTIPLEREFERENCE_Answers.equals(attribName))
{
return this.getAnswersCount();
}
return super.getMultiAssocCount(attribName);
}
/**
* Get the assoc at a particular index
*/
public BaseBusinessClass getMultiAssocAt(String attribName, int index) throws StorageException
{
if (MULTIPLEREFERENCE_Answers.equals(attribName))
{
return this.getAnswersAt(index);
}
return super.getMultiAssocAt(attribName, index);
}
/**
* Add to a multi assoc by attribute name
*/
public void addToMultiAssoc(String attribName, BaseBusinessClass newElement) throws StorageException
{
if (MULTIPLEREFERENCE_Answers.equals(attribName))
{
addToAnswers((AnswerOption)newElement);
return;
}
super.addToMultiAssoc(attribName, newElement);
}
/**
* Remove from a multi assoc by attribute name
*/
public void removeFromMultiAssoc(String attribName, BaseBusinessClass oldElement) throws StorageException
{
if (MULTIPLEREFERENCE_Answers.equals(attribName))
{
removeFromAnswers((AnswerOption)oldElement);
return;
}
super.removeFromMultiAssoc(attribName, oldElement);
}
protected void __loadMultiAssoc (String attribName, BaseBusinessClass[] elements)
{
if (MULTIPLEREFERENCE_Answers.equals(attribName))
{
_Answers.__loadAssociation (elements);
return;
}
super.__loadMultiAssoc(attribName, elements);
}
protected boolean __isMultiAssocLoaded (String attribName)
{
if (MULTIPLEREFERENCE_Answers.equals(attribName))
{
return _Answers.isLoaded ();
}
return super.__isMultiAssocLoaded(attribName);
}
public FieldWriteability getWriteability_Answers ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
public int getAnswersCount () throws StorageException
{
assertValid();
return _Answers.getReferencedObjectsCount ();
}
public void addToAnswers (AnswerOption 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.getCandidateAnswer () != this)
{
newElement.setCandidateAnswer ((CandidateDiversityAnswer)(this));
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
}
}
public void removeFromAnswers (AnswerOption 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.getCandidateAnswer () != null)
{
elementToRemove.setCandidateAnswer (null);
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
}
}
public AnswerOption getAnswersAt (int index) throws StorageException
{
return (AnswerOption)(_Answers.getElementAt (index));
}
public SortedSet<AnswerOption> getAnswersSet () throws StorageException
{
return _Answers.getSet ();
}
public void onDelete ()
{
try
{
// Ensure we are removed from any loaded multi-associations that aren't mandatory
if (_Candidate.isLoaded () || getTransaction ().isObjectLoaded (_Candidate.getReferencedType (), getCandidateID ()))
{
Candidate referenced = getCandidate ();
if (referenced != null)
{
// Stop the callback
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null DiversityAnswers from ", getObjectID (), " to ", referenced.getObjectID ());
_Candidate.set (null);
referenced.removeFromDiversityAnswers ((CandidateDiversityAnswer)this);
}
}
for(AnswerOption referenced : CollectionUtils.reverse(getAnswersSet()))
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null CandidateAnswer from ", getObjectID (), " to ", referenced.getObjectID ());
referenced.setCandidateAnswer(null);
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
super.onDelete ();
}
public CandidateDiversityAnswer newInstance ()
{
return new CandidateDiversityAnswer ();
}
public CandidateDiversityAnswer referenceInstance ()
{
return REFERENCE_CandidateDiversityAnswer;
}
public CandidateDiversityAnswer getInTransaction (ObjectTransaction t) throws StorageException
{
return getCandidateDiversityAnswerByID (t, getObjectID());
}
public BaseBusinessClass dummyInstance ()
{
return DUMMY_CandidateDiversityAnswer;
}
public String getBaseSetName ()
{
return "tl_candidate_diversity_answer";
}
/**
* This is where an object returns the Persistent sets that will
* store it into the database.
* The should be entered into allSets
*/
public void getPersistentSets (PersistentSetCollection allSets)
{
ObjectStatus myStatus = getStatus ();
PersistentSetStatus myPSetStatus = myStatus.getPSetStatus();
ObjectID myID = getID();
super.getPersistentSets (allSets);
PersistentSet tl_candidate_diversity_answerPSet = allSets.getPersistentSet (myID, "tl_candidate_diversity_answer", myPSetStatus);
tl_candidate_diversity_answerPSet.setAttrib (FIELD_ObjectID, myID);
_Question.getPersistentSets (allSets);
_Candidate.getPersistentSets (allSets);
}
/**
* Sets the objects state based on Persistent sets.
*/
public void setFromPersistentSets (ObjectID objectID, PersistentSetCollection allSets)
{
super.setFromPersistentSets (objectID, allSets);
PersistentSet tl_candidate_diversity_answerPSet = allSets.getPersistentSet (objectID, "tl_candidate_diversity_answer");
_Question.setFromPersistentSets (objectID, allSets);
_Candidate.setFromPersistentSets (objectID, allSets);
}
public void setAttributesFrom (BaseBusinessClass other, MultiException e)
{
super.setAttributesFrom (other, e);
if (other instanceof CandidateDiversityAnswer)
{
CandidateDiversityAnswer otherCandidateDiversityAnswer = (CandidateDiversityAnswer)other;
}
}
/**
* Set the attributes in this to copies of the attributes in source.
*/
public void copyAttributesFrom (BaseBusinessClass source)
{
super.copyAttributesFrom (source);
if (source instanceof BaseCandidateDiversityAnswer)
{
BaseCandidateDiversityAnswer sourceCandidateDiversityAnswer = (BaseCandidateDiversityAnswer)(source);
}
}
/**
* Set the associations in this to copies of the attributes in source.
*/
public void copySingleAssociationsFrom (BaseBusinessClass source, boolean linkToGhosts)
{
super.copySingleAssociationsFrom (source, linkToGhosts);
if (source instanceof BaseCandidateDiversityAnswer)
{
BaseCandidateDiversityAnswer sourceCandidateDiversityAnswer = (BaseCandidateDiversityAnswer)(source);
_AnswerOption.copyFrom (sourceCandidateDiversityAnswer._AnswerOption, linkToGhosts);
_Question.copyFrom (sourceCandidateDiversityAnswer._Question, linkToGhosts);
_Candidate.copyFrom (sourceCandidateDiversityAnswer._Candidate, linkToGhosts);
}
}
/**
* Set the associations in this to copies of the attributes in source.
*/
public void copyAssociationsFrom (BaseBusinessClass source, boolean linkToGhosts)
{
super.copyAssociationsFrom (source, linkToGhosts);
if (source instanceof BaseCandidateDiversityAnswer)
{
BaseCandidateDiversityAnswer sourceCandidateDiversityAnswer = (BaseCandidateDiversityAnswer)(source);
_Answers.copyFrom (sourceCandidateDiversityAnswer._Answers, linkToGhosts);
}
}
public void validate (ValidationContext context)
{
super.validate (context);
context.check (getQuestionID() != null, this, SINGLEREFERENCE_Question, "mandatory");
context.check (getCandidateID() != null, this, SINGLEREFERENCE_Candidate, "mandatory");
}
/**
* Subclasses must override this to read in their attributes
*/
protected void readExternalData(Map<String, Object> vals) throws IOException, ClassNotFoundException
{
super.readExternalData(vals);
_AnswerOption.readExternalData(vals.get(SINGLEREFERENCE_AnswerOption));
_Question.readExternalData(vals.get(SINGLEREFERENCE_Question));
_Candidate.readExternalData(vals.get(SINGLEREFERENCE_Candidate));
_Answers.readExternalData(vals.get(MULTIPLEREFERENCE_Answers));
}
/**
* Subclasses must override this to write out their attributes
*/
protected void writeExternalData(Map<String, Object> vals) throws IOException
{
super.writeExternalData(vals);
vals.put (SINGLEREFERENCE_AnswerOption, _AnswerOption.writeExternalData());
vals.put (SINGLEREFERENCE_Question, _Question.writeExternalData());
vals.put (SINGLEREFERENCE_Candidate, _Candidate.writeExternalData());
vals.put (MULTIPLEREFERENCE_Answers, _Answers.writeExternalData());
}
public void compare (BaseBusinessClass other, AttributeChangeListener listener) throws StorageException
{
super.compare (other, listener);
if (other instanceof BaseCandidateDiversityAnswer)
{
BaseCandidateDiversityAnswer otherCandidateDiversityAnswer = (BaseCandidateDiversityAnswer)(other);
// Compare single assocs
_AnswerOption.compare (otherCandidateDiversityAnswer._AnswerOption, listener);
_Question.compare (otherCandidateDiversityAnswer._Question, listener);
_Candidate.compare (otherCandidateDiversityAnswer._Candidate, listener);
// Compare multiple assocs
_Answers.compare (otherCandidateDiversityAnswer._Answers, listener);
}
}
public void visitTransients (AttributeVisitor visitor) throws StorageException
{
super.visitAttributes (visitor);
}
public void visitAttributes (AttributeVisitor visitor) throws StorageException
{
super.visitAttributes (visitor);
visitor.visitAssociation (_AnswerOption);
visitor.visitAssociation (_Question);
visitor.visitAssociation (_Candidate);
visitor.visitAssociation (_Answers);
}
public void visitAssociations (AssociationVisitor visitor, AssociatedScope scope) throws StorageException
{
super.visitAssociations (visitor, scope);
if (scope.includes (_AnswerOption))
{
visitor.visit (_AnswerOption);
}
if (scope.includes (_Question))
{
visitor.visit (_Question);
}
if (scope.includes (_Candidate))
{
visitor.visit (_Candidate);
}
if (scope.includes (_Answers))
{
visitor.visit (_Answers);
}
}
public static CandidateDiversityAnswer createCandidateDiversityAnswer (ObjectTransaction transaction) throws StorageException
{
CandidateDiversityAnswer result = new CandidateDiversityAnswer ();
result.initialiseNewObject (transaction);
return result;
}
public static CandidateDiversityAnswer getCandidateDiversityAnswerByID (ObjectTransaction transaction, Long objectID) throws StorageException
{
return (CandidateDiversityAnswer)(transaction.getObjectByID (REFERENCE_CandidateDiversityAnswer, objectID));
}
public boolean testFilter (String attribName, QueryFilter filter) throws StorageException
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (SINGLEREFERENCE_Question))
{
return filter.matches (getQuestion ());
}
else if (attribName.equals (SINGLEREFERENCE_Candidate))
{
return filter.matches (getCandidate ());
}
else
{
return super.testFilter (attribName, filter);
}
}
public static SearchAll SearchByAll () { return new SearchAll (); }
public static class SearchAll extends SearchObject<CandidateDiversityAnswer>
{
public SearchAll andObjectID (QueryFilter<Long> filter)
{
filter.addFilter (context, "tl_candidate_diversity_answer.object_id", FIELD_ObjectID);
return this;
}
public SearchAll andObjectCreated (QueryFilter<Date> filter)
{
filter.addFilter (context, "tl_candidate_diversity_answer.object_created_date", FIELD_ObjectCreated);
return this;
}
public SearchAll andObjectLastModified (QueryFilter<Date> filter)
{
filter.addFilter (context, "tl_candidate_diversity_answer.object_last_updated_date", FIELD_ObjectLastModified);
return this;
}
public SearchAll andQuestion (QueryFilter<DiversityQuestion> filter)
{
filter.addFilter (context, "tl_candidate_diversity_answer.question_id", "Question");
return this;
}
public SearchAll andCandidate (QueryFilter<Candidate> filter)
{
filter.addFilter (context, "tl_candidate_diversity_answer.candidate_id", "Candidate");
return this;
}
public CandidateDiversityAnswer[]
search (ObjectTransaction transaction) throws StorageException
{
BaseBusinessClass[] results = super.search (transaction, REFERENCE_CandidateDiversityAnswer, SEARCH_All, criteria);
Set<CandidateDiversityAnswer> typedResults = new LinkedHashSet <CandidateDiversityAnswer> ();
for (BaseBusinessClass bbcResult : results)
{
CandidateDiversityAnswer aResult = (CandidateDiversityAnswer)bbcResult;
typedResults.add (aResult);
}
return ObjstoreUtils.removeDeleted(transaction, typedResults).toArray (new CandidateDiversityAnswer[0]);
}
}
public static CandidateDiversityAnswer[]
searchAll (ObjectTransaction transaction) throws StorageException
{
return SearchByAll ()
.search (transaction);
}
public Object getAttribute (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else
{
return super.getAttribute (attribName);
}
}
public AttributeHelper getAttributeHelper (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else
{
return super.getAttributeHelper (attribName);
}
}
public void setAttribute (String attribName, Object attribValue) throws FieldException
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else
{
super.setAttribute (attribName, attribValue);
}
}
public boolean isWriteable (String fieldName)
{
return getWriteable (fieldName) == FieldWriteability.TRUE;
}
public FieldWriteability getWriteable (String fieldName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (fieldName.equals (MULTIPLEREFERENCE_Answers))
{
return getWriteability_Answers ();
}
else if (fieldName.equals (SINGLEREFERENCE_Question))
{
return getWriteability_Question ();
}
else if (fieldName.equals (SINGLEREFERENCE_Candidate))
{
return getWriteability_Candidate ();
}
else if (fieldName.equals (SINGLEREFERENCE_AnswerOption))
{
return getWriteability_AnswerOption ();
}
else
{
return super.getWriteable (fieldName);
}
}
public void putUnwriteable (Set<String> fields)
{
super.putUnwriteable (fields);
}
public List<AbstractAttribute> getAttributes ()
{
List result = super.getAttributes ();
return result;
}
public Map getAttributeMetadata (String attribute)
{
if (ATTRIBUTES_METADATA_CandidateDiversityAnswer.containsKey (attribute))
{
return (Map)ATTRIBUTES_METADATA_CandidateDiversityAnswer.get (attribute);
}
else
{
return super.getAttributeMetadata (attribute);
}
}
public Object getAttributeMetadata (String attribute, String metadata)
{
if (ATTRIBUTES_METADATA_CandidateDiversityAnswer.containsKey (attribute))
{
return ((Map)ATTRIBUTES_METADATA_CandidateDiversityAnswer.get (attribute)).get(metadata);
}
else
{
return super.getAttributeMetadata (attribute, metadata);
}
}
public void preCommit (boolean willBeStored) throws Exception
{
super.preCommit(willBeStored);
if(willBeStored)
{
}
}
public oneit.servlets.objstore.binary.BinaryContentHandler getBinaryContentHandler(String attribName)
{
return super.getBinaryContentHandler(attribName);
}
public static class CandidateDiversityAnswerBehaviourDecorator extends BaseBusinessClass.BBCBehaviourDecorator<CandidateDiversityAnswer>
{
}
public ORMPipeLine pipes()
{
return new CandidateDiversityAnswerPipeLineFactory<CandidateDiversityAnswer, CandidateDiversityAnswer> ((CandidateDiversityAnswer)this);
}
/**
* Use this instead of pipes() to get rid of type casting.
*/
public CandidateDiversityAnswerPipeLineFactory<CandidateDiversityAnswer, CandidateDiversityAnswer> pipelineCandidateDiversityAnswer()
{
return (CandidateDiversityAnswerPipeLineFactory<CandidateDiversityAnswer, CandidateDiversityAnswer>) pipes();
}
public static CandidateDiversityAnswerPipeLineFactory<CandidateDiversityAnswer, CandidateDiversityAnswer> pipesCandidateDiversityAnswer(Collection<CandidateDiversityAnswer> items)
{
return REFERENCE_CandidateDiversityAnswer.new CandidateDiversityAnswerPipeLineFactory<CandidateDiversityAnswer, CandidateDiversityAnswer> (items);
}
public static CandidateDiversityAnswerPipeLineFactory<CandidateDiversityAnswer, CandidateDiversityAnswer> pipesCandidateDiversityAnswer(CandidateDiversityAnswer[] _items)
{
return pipesCandidateDiversityAnswer(Arrays.asList (_items));
}
public static CandidateDiversityAnswerPipeLineFactory<CandidateDiversityAnswer, CandidateDiversityAnswer> pipesCandidateDiversityAnswer()
{
return pipesCandidateDiversityAnswer((Collection)null);
}
public class CandidateDiversityAnswerPipeLineFactory<From extends BaseBusinessClass, Me extends CandidateDiversityAnswer> extends BaseBusinessClass.ORMPipeLine<From, Me>
{
public <Prev> CandidateDiversityAnswerPipeLineFactory (PipeLine<From, Prev> pipeLine, Pipe<Prev, Me> nextPipe)
{
super (pipeLine, nextPipe);
}
public CandidateDiversityAnswerPipeLineFactory (From seed)
{
super(seed);
}
public CandidateDiversityAnswerPipeLineFactory (Collection<From> seed)
{
super(seed);
}
public PipeLine<From, ? extends Object> to(String name)
{
if (name.equals ("AnswerOption"))
{
return toAnswerOption ();
}
if (name.equals ("Answers"))
{
return toAnswers ();
}
if (name.equals ("Question"))
{
return toQuestion ();
}
if (name.equals ("Candidate"))
{
return toCandidate ();
}
return super.to(name);
}
public DiversityAnswer.DiversityAnswerPipeLineFactory<From, DiversityAnswer> toAnswerOption () { return toAnswerOption (Filter.ALL); }
public DiversityAnswer.DiversityAnswerPipeLineFactory<From, DiversityAnswer> toAnswerOption (Filter<DiversityAnswer> filter)
{
return DiversityAnswer.REFERENCE_DiversityAnswer.new DiversityAnswerPipeLineFactory<From, DiversityAnswer> (this, new ORMSingleAssocPipe<Me, DiversityAnswer>(SINGLEREFERENCE_AnswerOption, filter));
}
public DiversityQuestion.DiversityQuestionPipeLineFactory<From, DiversityQuestion> toQuestion () { return toQuestion (Filter.ALL); }
public DiversityQuestion.DiversityQuestionPipeLineFactory<From, DiversityQuestion> toQuestion (Filter<DiversityQuestion> filter)
{
return DiversityQuestion.REFERENCE_DiversityQuestion.new DiversityQuestionPipeLineFactory<From, DiversityQuestion> (this, new ORMSingleAssocPipe<Me, DiversityQuestion>(SINGLEREFERENCE_Question, filter));
}
public Candidate.CandidatePipeLineFactory<From, Candidate> toCandidate () { return toCandidate (Filter.ALL); }
public Candidate.CandidatePipeLineFactory<From, Candidate> toCandidate (Filter<Candidate> filter)
{
return Candidate.REFERENCE_Candidate.new CandidatePipeLineFactory<From, Candidate> (this, new ORMSingleAssocPipe<Me, Candidate>(SINGLEREFERENCE_Candidate, filter));
}
public AnswerOption.AnswerOptionPipeLineFactory<From, AnswerOption> toAnswers () { return toAnswers(Filter.ALL); }
public AnswerOption.AnswerOptionPipeLineFactory<From, AnswerOption> toAnswers (Filter<AnswerOption> filter)
{
return AnswerOption.REFERENCE_AnswerOption.new AnswerOptionPipeLineFactory<From, AnswerOption> (this, new ORMMultiAssocPipe<Me, AnswerOption>(MULTIPLEREFERENCE_Answers, filter));
}
}
public boolean isTransientAttrib(String attribName)
{
return super.isTransientAttrib(attribName);
}
public boolean isTransientSingleReference(String assocName)
{
if(CollectionUtils.equals(assocName, "AnswerOption"))
{
return true;
}
return super.isTransientSingleReference(assocName);
}
}
class DummyCandidateDiversityAnswer extends CandidateDiversityAnswer
{
// Default constructor primarily to support Externalisable
public DummyCandidateDiversityAnswer()
{
super();
}
public void assertValid ()
{
}
public DiversityAnswer getAnswerOption () throws StorageException
{
return (DiversityAnswer)(DiversityAnswer.DUMMY_DiversityAnswer);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getAnswerOptionID ()
{
return DiversityAnswer.DUMMY_DiversityAnswer.getObjectID();
}
public DiversityQuestion getQuestion () throws StorageException
{
return (DiversityQuestion)(DiversityQuestion.DUMMY_DiversityQuestion);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getQuestionID ()
{
return DiversityQuestion.DUMMY_DiversityQuestion.getObjectID();
}
public Candidate getCandidate () throws StorageException
{
return (Candidate)(Candidate.DUMMY_Candidate);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getCandidateID ()
{
return Candidate.DUMMY_Candidate.getObjectID();
}
public int getAnswersCount () throws StorageException
{
return 0;
}
public AnswerOption 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();
}
}
/*
* IMPORTANT!!!! XSL Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2 rev3 [oneit.objstore.BusinessObjectTemplate.xsl]
*
* Version: 1.0
* Vendor: Apache Software Foundation (Xalan XSLTC)
* Vendor URL: http://xml.apache.org/xalan-j
*/
package performa.orm;
import java.io.*;
import java.util.*;
import oneit.appservices.config.*;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.objstore.assocs.*;
import oneit.objstore.attributes.*;
import oneit.objstore.rdbms.filters.*;
import oneit.objstore.parser.*;
import oneit.objstore.validator.*;
import oneit.objstore.utils.*;
import oneit.utils.*;
import oneit.utils.filter.Filter;
import oneit.utils.transform.*;
import oneit.utils.parsers.FieldException;
public abstract class BaseDiversityAnswer extends BaseBusinessClass
{
// Reference instance for the object
public static final DiversityAnswer REFERENCE_DiversityAnswer = new DiversityAnswer ();
// Reference instance for the object
public static final DiversityAnswer DUMMY_DiversityAnswer = new DummyDiversityAnswer ();
// Static constants corresponding to field names
public static final String FIELD_Code = "Code";
public static final String FIELD_Answer = "Answer";
public static final String SINGLEREFERENCE_Question = "Question";
public static final String BACKREF_Question = "";
// Static constants corresponding to searches
public static final String SEARCH_All = "All";
// Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper<DiversityAnswer> HELPER_Code = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<DiversityAnswer> HELPER_Answer = DefaultAttributeHelper.INSTANCE;
// Private attributes corresponding to business object data
private String _Code;
private String _Answer;
// Private attributes corresponding to single references
private SingleAssociation<DiversityAnswer, DiversityQuestion> _Question;
// Private attributes corresponding to multiple references
// Map of maps of metadata
private static final Map ATTRIBUTES_METADATA_DiversityAnswer = new HashMap ();
// Arrays of validators for each attribute
private static final AttributeValidator[] FIELD_Code_Validators;
private static final AttributeValidator[] FIELD_Answer_Validators;
// Arrays of behaviour decorators
private static final DiversityAnswerBehaviourDecorator[] DiversityAnswer_BehaviourDecorators;
static
{
try
{
String tmp_Question = DiversityQuestion.BACKREF_Answers;
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
setupAssocMetaData_Question();
FIELD_Code_Validators = (AttributeValidator[])setupAttribMetaData_Code(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_Answer_Validators = (AttributeValidator[])setupAttribMetaData_Answer(validatorMapping).toArray (new AttributeValidator[0]);
REFERENCE_DiversityAnswer.initialiseReference ();
DUMMY_DiversityAnswer.initialiseReference ();
DiversityAnswer_BehaviourDecorators = BaseBusinessClass.getBBCBehaviours(DiversityAnswer.class).toArray(new DiversityAnswerBehaviourDecorator[0]);
}
catch (RuntimeException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR1, e, "Error initialising");
throw e;
}
}
// Meta Info setup
private static void setupAssocMetaData_Question()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "Answers");
metaInfo.put ("dbcol", "question_id");
metaInfo.put ("mandatory", "true");
metaInfo.put ("name", "Question");
metaInfo.put ("type", "DiversityQuestion");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for DiversityAnswer.Question:", metaInfo);
ATTRIBUTES_METADATA_DiversityAnswer.put (SINGLEREFERENCE_Question, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static List setupAttribMetaData_Code(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "answer_code");
metaInfo.put ("mandatory", "true");
metaInfo.put ("name", "Code");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for DiversityAnswer.Code:", metaInfo);
ATTRIBUTES_METADATA_DiversityAnswer.put (FIELD_Code, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(DiversityAnswer.class, "Code", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for DiversityAnswer.Code:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_Answer(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "answer");
metaInfo.put ("mandatory", "true");
metaInfo.put ("name", "Answer");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for DiversityAnswer.Answer:", metaInfo);
ATTRIBUTES_METADATA_DiversityAnswer.put (FIELD_Answer, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(DiversityAnswer.class, "Answer", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for DiversityAnswer.Answer:", validators);
return validators;
}
// END OF STATIC METADATA DEFINITION
// This constructor should not be called
protected BaseDiversityAnswer ()
{
}
protected BBCBehaviourDecorator[] getBehaviours()
{
return DiversityAnswer_BehaviourDecorators;
}
// Initialise the attributes
protected void _initialiseNewObjAttributes (ObjectTransaction transaction) throws StorageException
{
super._initialiseNewObjAttributes (transaction);
_Code = (String)(HELPER_Code.initialise (_Code));
_Answer = (String)(HELPER_Answer.initialise (_Answer));
}
// Initialise the associations
protected void _initialiseAssociations ()
{
super._initialiseAssociations ();
_Question = new SingleAssociation<DiversityAnswer, DiversityQuestion> (this, SINGLEREFERENCE_Question, DiversityQuestion.MULTIPLEREFERENCE_Answers, DiversityQuestion.REFERENCE_DiversityQuestion, "tl_diversity_answer");
}
// Initialise the associations
protected BaseBusinessClass initialiseReference ()
{
super.initialiseReference ();
_Question = new SingleAssociation<DiversityAnswer, DiversityQuestion> (this, SINGLEREFERENCE_Question, DiversityQuestion.MULTIPLEREFERENCE_Answers, DiversityQuestion.REFERENCE_DiversityQuestion, "tl_diversity_answer");
return this;
}
/**
* Get the attribute Code
*/
public String getCode ()
{
assertValid();
String valToReturn = _Code;
for (DiversityAnswerBehaviourDecorator bhd : DiversityAnswer_BehaviourDecorators)
{
valToReturn = bhd.getCode ((DiversityAnswer)this, valToReturn);
}
return valToReturn;
}
/**
* Called prior to the attribute changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preCodeChange (String newCode) throws FieldException
{
}
/**
* Called after the attribute changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postCodeChange () throws FieldException
{
}
public FieldWriteability getWriteability_Code ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute Code. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setCode (String newCode) throws FieldException
{
boolean oldAndNewIdentical = HELPER_Code.compare (_Code, newCode);
try
{
for (DiversityAnswerBehaviourDecorator bhd : DiversityAnswer_BehaviourDecorators)
{
newCode = bhd.setCode ((DiversityAnswer)this, newCode);
oldAndNewIdentical = HELPER_Code.compare (_Code, newCode);
}
BusinessObjectParser.assertFieldCondition (newCode != null, this, FIELD_Code, "mandatory");
if (FIELD_Code_Validators.length > 0)
{
Object newCodeObj = HELPER_Code.toObject (newCode);
if (newCodeObj != null)
{
int loopMax = FIELD_Code_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_DiversityAnswer.get (FIELD_Code);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_Code_Validators[v].checkAttribute (this, FIELD_Code, metadata, newCodeObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_Code () != FieldWriteability.FALSE, "Field Code is not writeable");
preCodeChange (newCode);
markFieldChange (FIELD_Code);
_Code = newCode;
postFieldChange (FIELD_Code);
postCodeChange ();
}
}
/**
* Get the attribute Answer
*/
public String getAnswer ()
{
assertValid();
String valToReturn = _Answer;
for (DiversityAnswerBehaviourDecorator bhd : DiversityAnswer_BehaviourDecorators)
{
valToReturn = bhd.getAnswer ((DiversityAnswer)this, valToReturn);
}
return valToReturn;
}
/**
* Called prior to the attribute changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preAnswerChange (String newAnswer) throws FieldException
{
}
/**
* Called after the attribute changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postAnswerChange () throws FieldException
{
}
public FieldWriteability getWriteability_Answer ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute Answer. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setAnswer (String newAnswer) throws FieldException
{
boolean oldAndNewIdentical = HELPER_Answer.compare (_Answer, newAnswer);
try
{
for (DiversityAnswerBehaviourDecorator bhd : DiversityAnswer_BehaviourDecorators)
{
newAnswer = bhd.setAnswer ((DiversityAnswer)this, newAnswer);
oldAndNewIdentical = HELPER_Answer.compare (_Answer, newAnswer);
}
BusinessObjectParser.assertFieldCondition (newAnswer != null, this, FIELD_Answer, "mandatory");
if (FIELD_Answer_Validators.length > 0)
{
Object newAnswerObj = HELPER_Answer.toObject (newAnswer);
if (newAnswerObj != null)
{
int loopMax = FIELD_Answer_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_DiversityAnswer.get (FIELD_Answer);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_Answer_Validators[v].checkAttribute (this, FIELD_Answer, metadata, newAnswerObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_Answer () != FieldWriteability.FALSE, "Field Answer is not writeable");
preAnswerChange (newAnswer);
markFieldChange (FIELD_Answer);
_Answer = newAnswer;
postFieldChange (FIELD_Answer);
postAnswerChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getSingleAssocs()
{
List result = super.getSingleAssocs ();
result.add("Question");
return result;
}
public BaseBusinessClass getSingleAssocReferenceInstance (String assocName)
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Question))
{
return _Question.getReferencedType ();
}
else
{
return super.getSingleAssocReferenceInstance (assocName);
}
}
public String getSingleAssocBackReference(String assocName)
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Question))
{
return DiversityQuestion.MULTIPLEREFERENCE_Answers ;
}
else
{
return super.getSingleAssocBackReference (assocName);
}
}
public BaseBusinessClass getSingleAssoc (String assocName) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Question))
{
return getQuestion ();
}
else
{
return super.getSingleAssoc (assocName);
}
}
public BaseBusinessClass getSingleAssoc (String assocName, Get getType) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Question))
{
return getQuestion (getType);
}
else
{
return super.getSingleAssoc (assocName, getType);
}
}
public Long getSingleAssocID (String assocName) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Question))
{
return getQuestionID ();
}
else
{
return super.getSingleAssocID (assocName);
}
}
public void setSingleAssoc (String assocName, BaseBusinessClass newValue) throws StorageException, FieldException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Question))
{
setQuestion ((DiversityQuestion)(newValue));
}
else
{
super.setSingleAssoc (assocName, newValue);
}
}
/**
* Get the reference Question
*/
public DiversityQuestion getQuestion () throws StorageException
{
assertValid();
try
{
return (DiversityQuestion)(_Question.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in DiversityAnswer:", this.getObjectID (), ", was trying to get DiversityQuestion:", getQuestionID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _Question.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public DiversityQuestion getQuestion (Get getType) throws StorageException
{
assertValid();
return _Question.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getQuestionID ()
{
assertValid();
if (_Question == null)
{
return null;
}
else
{
return _Question.getID ();
}
}
/**
* Called prior to the assoc changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preQuestionChange (DiversityQuestion newQuestion) throws FieldException
{
}
/**
* Called after the assoc changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postQuestionChange () throws FieldException
{
}
public FieldWriteability getWriteability_Question ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference Question. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setQuestion (DiversityQuestion newQuestion) throws StorageException, FieldException
{
BusinessObjectParser.assertFieldCondition (newQuestion != null, this, SINGLEREFERENCE_Question, "mandatory");
if (_Question.wouldReferencedChange (newQuestion))
{
assertValid();
Debug.assertion (getWriteability_Question () != FieldWriteability.FALSE, "Assoc Question is not writeable");
preQuestionChange (newQuestion);
DiversityQuestion oldQuestion = getQuestion ();
if (oldQuestion != null)
{
// This is to stop validation from triggering when we are removed
_Question.set (null);
oldQuestion.removeFromAnswers ((DiversityAnswer)(this));
}
_Question.set (newQuestion);
if (newQuestion != null)
{
newQuestion.addToAnswers ((DiversityAnswer)(this));
}
postQuestionChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getMultiAssocs()
{
List result = super.getMultiAssocs ();
return result;
}
/**
* Get the reference instance for the multi assoc name.
*/
public BaseBusinessClass getMultiAssocReferenceInstance(String attribName)
{
return super.getMultiAssocReferenceInstance(attribName);
}
public String getMultiAssocBackReference(String attribName)
{
return super.getMultiAssocBackReference(attribName);
}
/**
* Get the assoc count for the multi assoc name.
*/
public int getMultiAssocCount(String attribName) throws StorageException
{
return super.getMultiAssocCount(attribName);
}
/**
* Get the assoc at a particular index
*/
public BaseBusinessClass getMultiAssocAt(String attribName, int index) throws StorageException
{
return super.getMultiAssocAt(attribName, index);
}
/**
* Add to a multi assoc by attribute name
*/
public void addToMultiAssoc(String attribName, BaseBusinessClass newElement) throws StorageException
{
super.addToMultiAssoc(attribName, newElement);
}
/**
* Remove from a multi assoc by attribute name
*/
public void removeFromMultiAssoc(String attribName, BaseBusinessClass oldElement) throws StorageException
{
super.removeFromMultiAssoc(attribName, oldElement);
}
protected void __loadMultiAssoc (String attribName, BaseBusinessClass[] elements)
{
super.__loadMultiAssoc(attribName, elements);
}
protected boolean __isMultiAssocLoaded (String attribName)
{
return super.__isMultiAssocLoaded(attribName);
}
public void onDelete ()
{
try
{
// Ensure we are removed from any loaded multi-associations that aren't mandatory
if (_Question.isLoaded () || getTransaction ().isObjectLoaded (_Question.getReferencedType (), getQuestionID ()))
{
DiversityQuestion referenced = getQuestion ();
if (referenced != null)
{
// Stop the callback
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null Answers from ", getObjectID (), " to ", referenced.getObjectID ());
_Question.set (null);
referenced.removeFromAnswers ((DiversityAnswer)this);
}
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
super.onDelete ();
}
public DiversityAnswer newInstance ()
{
return new DiversityAnswer ();
}
public DiversityAnswer referenceInstance ()
{
return REFERENCE_DiversityAnswer;
}
public DiversityAnswer getInTransaction (ObjectTransaction t) throws StorageException
{
return getDiversityAnswerByID (t, getObjectID());
}
public BaseBusinessClass dummyInstance ()
{
return DUMMY_DiversityAnswer;
}
public String getBaseSetName ()
{
return "tl_diversity_answer";
}
/**
* This is where an object returns the Persistent sets that will
* store it into the database.
* The should be entered into allSets
*/
public void getPersistentSets (PersistentSetCollection allSets)
{
ObjectStatus myStatus = getStatus ();
PersistentSetStatus myPSetStatus = myStatus.getPSetStatus();
ObjectID myID = getID();
super.getPersistentSets (allSets);
PersistentSet tl_diversity_answerPSet = allSets.getPersistentSet (myID, "tl_diversity_answer", myPSetStatus);
tl_diversity_answerPSet.setAttrib (FIELD_ObjectID, myID);
tl_diversity_answerPSet.setAttrib (FIELD_Code, HELPER_Code.toObject (_Code)); //
tl_diversity_answerPSet.setAttrib (FIELD_Answer, HELPER_Answer.toObject (_Answer)); //
_Question.getPersistentSets (allSets);
}
/**
* Sets the objects state based on Persistent sets.
*/
public void setFromPersistentSets (ObjectID objectID, PersistentSetCollection allSets)
{
super.setFromPersistentSets (objectID, allSets);
PersistentSet tl_diversity_answerPSet = allSets.getPersistentSet (objectID, "tl_diversity_answer");
_Code = (String)(HELPER_Code.fromObject (_Code, tl_diversity_answerPSet.getAttrib (FIELD_Code))); //
_Answer = (String)(HELPER_Answer.fromObject (_Answer, tl_diversity_answerPSet.getAttrib (FIELD_Answer))); //
_Question.setFromPersistentSets (objectID, allSets);
}
public void setAttributesFrom (BaseBusinessClass other, MultiException e)
{
super.setAttributesFrom (other, e);
if (other instanceof DiversityAnswer)
{
DiversityAnswer otherDiversityAnswer = (DiversityAnswer)other;
try
{
setCode (otherDiversityAnswer.getCode ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setAnswer (otherDiversityAnswer.getAnswer ());
}
catch (FieldException ex)
{
e.addException (ex);
}
}
}
/**
* Set the attributes in this to copies of the attributes in source.
*/
public void copyAttributesFrom (BaseBusinessClass source)
{
super.copyAttributesFrom (source);
if (source instanceof BaseDiversityAnswer)
{
BaseDiversityAnswer sourceDiversityAnswer = (BaseDiversityAnswer)(source);
_Code = sourceDiversityAnswer._Code;
_Answer = sourceDiversityAnswer._Answer;
}
}
/**
* Set the associations in this to copies of the attributes in source.
*/
public void copySingleAssociationsFrom (BaseBusinessClass source, boolean linkToGhosts)
{
super.copySingleAssociationsFrom (source, linkToGhosts);
if (source instanceof BaseDiversityAnswer)
{
BaseDiversityAnswer sourceDiversityAnswer = (BaseDiversityAnswer)(source);
_Question.copyFrom (sourceDiversityAnswer._Question, linkToGhosts);
}
}
/**
* Set the associations in this to copies of the attributes in source.
*/
public void copyAssociationsFrom (BaseBusinessClass source, boolean linkToGhosts)
{
super.copyAssociationsFrom (source, linkToGhosts);
if (source instanceof BaseDiversityAnswer)
{
BaseDiversityAnswer sourceDiversityAnswer = (BaseDiversityAnswer)(source);
}
}
public void validate (ValidationContext context)
{
super.validate (context);
context.check (getQuestionID() != null, this, SINGLEREFERENCE_Question, "mandatory");
}
/**
* Subclasses must override this to read in their attributes
*/
protected void readExternalData(Map<String, Object> vals) throws IOException, ClassNotFoundException
{
super.readExternalData(vals);
_Code = (String)(HELPER_Code.readExternal (_Code, vals.get(FIELD_Code))); //
_Answer = (String)(HELPER_Answer.readExternal (_Answer, vals.get(FIELD_Answer))); //
_Question.readExternalData(vals.get(SINGLEREFERENCE_Question));
}
/**
* Subclasses must override this to write out their attributes
*/
protected void writeExternalData(Map<String, Object> vals) throws IOException
{
super.writeExternalData(vals);
vals.put (FIELD_Code, HELPER_Code.writeExternal (_Code));
vals.put (FIELD_Answer, HELPER_Answer.writeExternal (_Answer));
vals.put (SINGLEREFERENCE_Question, _Question.writeExternalData());
}
public void compare (BaseBusinessClass other, AttributeChangeListener listener) throws StorageException
{
super.compare (other, listener);
if (other instanceof BaseDiversityAnswer)
{
BaseDiversityAnswer otherDiversityAnswer = (BaseDiversityAnswer)(other);
if (!HELPER_Code.compare(this._Code, otherDiversityAnswer._Code))
{
listener.notifyFieldChange(this, other, FIELD_Code, HELPER_Code.toObject(this._Code), HELPER_Code.toObject(otherDiversityAnswer._Code));
}
if (!HELPER_Answer.compare(this._Answer, otherDiversityAnswer._Answer))
{
listener.notifyFieldChange(this, other, FIELD_Answer, HELPER_Answer.toObject(this._Answer), HELPER_Answer.toObject(otherDiversityAnswer._Answer));
}
// Compare single assocs
_Question.compare (otherDiversityAnswer._Question, listener);
// Compare multiple assocs
}
}
public void visitTransients (AttributeVisitor visitor) throws StorageException
{
super.visitAttributes (visitor);
}
public void visitAttributes (AttributeVisitor visitor) throws StorageException
{
super.visitAttributes (visitor);
visitor.visitField(this, FIELD_Code, HELPER_Code.toObject(getCode()));
visitor.visitField(this, FIELD_Answer, HELPER_Answer.toObject(getAnswer()));
visitor.visitAssociation (_Question);
}
public void visitAssociations (AssociationVisitor visitor, AssociatedScope scope) throws StorageException
{
super.visitAssociations (visitor, scope);
if (scope.includes (_Question))
{
visitor.visit (_Question);
}
}
public static DiversityAnswer createDiversityAnswer (ObjectTransaction transaction) throws StorageException
{
DiversityAnswer result = new DiversityAnswer ();
result.initialiseNewObject (transaction);
return result;
}
public static DiversityAnswer getDiversityAnswerByID (ObjectTransaction transaction, Long objectID) throws StorageException
{
return (DiversityAnswer)(transaction.getObjectByID (REFERENCE_DiversityAnswer, objectID));
}
public boolean testFilter (String attribName, QueryFilter filter) throws StorageException
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_Code))
{
return filter.matches (getCode ());
}
else if (attribName.equals (FIELD_Answer))
{
return filter.matches (getAnswer ());
}
else if (attribName.equals (SINGLEREFERENCE_Question))
{
return filter.matches (getQuestion ());
}
else
{
return super.testFilter (attribName, filter);
}
}
public static SearchAll SearchByAll () { return new SearchAll (); }
public static class SearchAll extends SearchObject<DiversityAnswer>
{
public SearchAll andObjectID (QueryFilter<Long> filter)
{
filter.addFilter (context, "tl_diversity_answer.object_id", FIELD_ObjectID);
return this;
}
public SearchAll andObjectCreated (QueryFilter<Date> filter)
{
filter.addFilter (context, "tl_diversity_answer.object_created_date", FIELD_ObjectCreated);
return this;
}
public SearchAll andObjectLastModified (QueryFilter<Date> filter)
{
filter.addFilter (context, "tl_diversity_answer.object_last_updated_date", FIELD_ObjectLastModified);
return this;
}
public SearchAll andCode (QueryFilter<String> filter)
{
filter.addFilter (context, "tl_diversity_answer.answer_code", "Code");
return this;
}
public SearchAll andAnswer (QueryFilter<String> filter)
{
filter.addFilter (context, "tl_diversity_answer.answer", "Answer");
return this;
}
public SearchAll andQuestion (QueryFilter<DiversityQuestion> filter)
{
filter.addFilter (context, "tl_diversity_answer.question_id", "Question");
return this;
}
public DiversityAnswer[]
search (ObjectTransaction transaction) throws StorageException
{
BaseBusinessClass[] results = super.search (transaction, REFERENCE_DiversityAnswer, SEARCH_All, criteria);
Set<DiversityAnswer> typedResults = new LinkedHashSet <DiversityAnswer> ();
for (BaseBusinessClass bbcResult : results)
{
DiversityAnswer aResult = (DiversityAnswer)bbcResult;
typedResults.add (aResult);
}
return ObjstoreUtils.removeDeleted(transaction, typedResults).toArray (new DiversityAnswer[0]);
}
}
public static DiversityAnswer[]
searchAll (ObjectTransaction transaction) throws StorageException
{
return SearchByAll ()
.search (transaction);
}
public Object getAttribute (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_Code))
{
return HELPER_Code.toObject (getCode ());
}
else if (attribName.equals (FIELD_Answer))
{
return HELPER_Answer.toObject (getAnswer ());
}
else
{
return super.getAttribute (attribName);
}
}
public AttributeHelper getAttributeHelper (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_Code))
{
return HELPER_Code;
}
else if (attribName.equals (FIELD_Answer))
{
return HELPER_Answer;
}
else
{
return super.getAttributeHelper (attribName);
}
}
public void setAttribute (String attribName, Object attribValue) throws FieldException
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_Code))
{
setCode ((String)(HELPER_Code.fromObject (_Code, attribValue)));
}
else if (attribName.equals (FIELD_Answer))
{
setAnswer ((String)(HELPER_Answer.fromObject (_Answer, attribValue)));
}
else
{
super.setAttribute (attribName, attribValue);
}
}
public boolean isWriteable (String fieldName)
{
return getWriteable (fieldName) == FieldWriteability.TRUE;
}
public FieldWriteability getWriteable (String fieldName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (fieldName.equals (FIELD_Code))
{
return getWriteability_Code ();
}
else if (fieldName.equals (FIELD_Answer))
{
return getWriteability_Answer ();
}
else if (fieldName.equals (SINGLEREFERENCE_Question))
{
return getWriteability_Question ();
}
else
{
return super.getWriteable (fieldName);
}
}
public void putUnwriteable (Set<String> fields)
{
if (getWriteability_Code () != FieldWriteability.TRUE)
{
fields.add (FIELD_Code);
}
if (getWriteability_Answer () != FieldWriteability.TRUE)
{
fields.add (FIELD_Answer);
}
super.putUnwriteable (fields);
}
public List<AbstractAttribute> getAttributes ()
{
List result = super.getAttributes ();
result.add(HELPER_Code.getAttribObject (getClass (), _Code, true, FIELD_Code));
result.add(HELPER_Answer.getAttribObject (getClass (), _Answer, true, FIELD_Answer));
return result;
}
public Map getAttributeMetadata (String attribute)
{
if (ATTRIBUTES_METADATA_DiversityAnswer.containsKey (attribute))
{
return (Map)ATTRIBUTES_METADATA_DiversityAnswer.get (attribute);
}
else
{
return super.getAttributeMetadata (attribute);
}
}
public Object getAttributeMetadata (String attribute, String metadata)
{
if (ATTRIBUTES_METADATA_DiversityAnswer.containsKey (attribute))
{
return ((Map)ATTRIBUTES_METADATA_DiversityAnswer.get (attribute)).get(metadata);
}
else
{
return super.getAttributeMetadata (attribute, metadata);
}
}
public void preCommit (boolean willBeStored) throws Exception
{
super.preCommit(willBeStored);
if(willBeStored)
{
}
}
public oneit.servlets.objstore.binary.BinaryContentHandler getBinaryContentHandler(String attribName)
{
return super.getBinaryContentHandler(attribName);
}
public static class DiversityAnswerBehaviourDecorator extends BaseBusinessClass.BBCBehaviourDecorator<DiversityAnswer>
{
/**
* Get the attribute Code
*/
public String getCode (DiversityAnswer obj, String original)
{
return original;
}
/**
* Change the value set for attribute Code.
* May modify the field beforehand
* Occurs before validation.
*/
public String setCode (DiversityAnswer obj, String newCode) throws FieldException
{
return newCode;
}
/**
* Get the attribute Answer
*/
public String getAnswer (DiversityAnswer obj, String original)
{
return original;
}
/**
* Change the value set for attribute Answer.
* May modify the field beforehand
* Occurs before validation.
*/
public String setAnswer (DiversityAnswer obj, String newAnswer) throws FieldException
{
return newAnswer;
}
}
public ORMPipeLine pipes()
{
return new DiversityAnswerPipeLineFactory<DiversityAnswer, DiversityAnswer> ((DiversityAnswer)this);
}
/**
* Use this instead of pipes() to get rid of type casting.
*/
public DiversityAnswerPipeLineFactory<DiversityAnswer, DiversityAnswer> pipelineDiversityAnswer()
{
return (DiversityAnswerPipeLineFactory<DiversityAnswer, DiversityAnswer>) pipes();
}
public static DiversityAnswerPipeLineFactory<DiversityAnswer, DiversityAnswer> pipesDiversityAnswer(Collection<DiversityAnswer> items)
{
return REFERENCE_DiversityAnswer.new DiversityAnswerPipeLineFactory<DiversityAnswer, DiversityAnswer> (items);
}
public static DiversityAnswerPipeLineFactory<DiversityAnswer, DiversityAnswer> pipesDiversityAnswer(DiversityAnswer[] _items)
{
return pipesDiversityAnswer(Arrays.asList (_items));
}
public static DiversityAnswerPipeLineFactory<DiversityAnswer, DiversityAnswer> pipesDiversityAnswer()
{
return pipesDiversityAnswer((Collection)null);
}
public class DiversityAnswerPipeLineFactory<From extends BaseBusinessClass, Me extends DiversityAnswer> extends BaseBusinessClass.ORMPipeLine<From, Me>
{
public <Prev> DiversityAnswerPipeLineFactory (PipeLine<From, Prev> pipeLine, Pipe<Prev, Me> nextPipe)
{
super (pipeLine, nextPipe);
}
public DiversityAnswerPipeLineFactory (From seed)
{
super(seed);
}
public DiversityAnswerPipeLineFactory (Collection<From> seed)
{
super(seed);
}
public PipeLine<From, ? extends Object> to(String name)
{
if (name.equals ("Code"))
{
return toCode ();
}
if (name.equals ("Answer"))
{
return toAnswer ();
}
if (name.equals ("Question"))
{
return toQuestion ();
}
return super.to(name);
}
public PipeLine<From, String> toCode () { return pipe(new ORMAttributePipe<Me, String>(FIELD_Code)); }
public PipeLine<From, String> toAnswer () { return pipe(new ORMAttributePipe<Me, String>(FIELD_Answer)); }
public DiversityQuestion.DiversityQuestionPipeLineFactory<From, DiversityQuestion> toQuestion () { return toQuestion (Filter.ALL); }
public DiversityQuestion.DiversityQuestionPipeLineFactory<From, DiversityQuestion> toQuestion (Filter<DiversityQuestion> filter)
{
return DiversityQuestion.REFERENCE_DiversityQuestion.new DiversityQuestionPipeLineFactory<From, DiversityQuestion> (this, new ORMSingleAssocPipe<Me, DiversityQuestion>(SINGLEREFERENCE_Question, filter));
}
}
public boolean isTransientAttrib(String attribName)
{
return super.isTransientAttrib(attribName);
}
public boolean isTransientSingleReference(String assocName)
{
return super.isTransientSingleReference(assocName);
}
}
class DummyDiversityAnswer extends DiversityAnswer
{
// Default constructor primarily to support Externalisable
public DummyDiversityAnswer()
{
super();
}
public void assertValid ()
{
}
public DiversityQuestion getQuestion () throws StorageException
{
return (DiversityQuestion)(DiversityQuestion.DUMMY_DiversityQuestion);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getQuestionID ()
{
return DiversityQuestion.DUMMY_DiversityQuestion.getObjectID();
}
}
/*
* IMPORTANT!!!! XSL Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2 rev3 [oneit.objstore.BusinessObjectTemplate.xsl]
*
* Version: 1.0
* Vendor: Apache Software Foundation (Xalan XSLTC)
* Vendor URL: http://xml.apache.org/xalan-j
*/
package performa.orm;
import java.io.*;
import java.util.*;
import oneit.appservices.config.*;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.objstore.assocs.*;
import oneit.objstore.attributes.*;
import oneit.objstore.rdbms.filters.*;
import oneit.objstore.parser.*;
import oneit.objstore.validator.*;
import oneit.objstore.utils.*;
import oneit.utils.*;
import oneit.utils.filter.Filter;
import oneit.utils.transform.*;
import oneit.utils.parsers.FieldException;
public abstract class BaseDiversityQuestion extends BaseBusinessClass
{
// Reference instance for the object
public static final DiversityQuestion REFERENCE_DiversityQuestion = new DiversityQuestion ();
// Reference instance for the object
public static final DiversityQuestion DUMMY_DiversityQuestion = new DummyDiversityQuestion ();
// Static constants corresponding to field names
public static final String FIELD_Code = "Code";
public static final String FIELD_QuestionText = "QuestionText";
public static final String FIELD_AustraliaOnly = "AustraliaOnly";
public static final String FIELD_MultipleAnswers = "MultipleAnswers";
public static final String MULTIPLEREFERENCE_Answers = "Answers";
public static final String BACKREF_Answers = "";
// Static constants corresponding to searches
public static final String SEARCH_All = "All";
// Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper<DiversityQuestion> HELPER_Code = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<DiversityQuestion> HELPER_QuestionText = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<DiversityQuestion> HELPER_AustraliaOnly = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<DiversityQuestion> HELPER_MultipleAnswers = DefaultAttributeHelper.INSTANCE;
// Private attributes corresponding to business object data
private String _Code;
private String _QuestionText;
private Boolean _AustraliaOnly;
private Boolean _MultipleAnswers;
// Private attributes corresponding to single references
// Private attributes corresponding to multiple references
private MultipleAssociation<DiversityQuestion, DiversityAnswer> _Answers;
// Map of maps of metadata
private static final Map ATTRIBUTES_METADATA_DiversityQuestion = new HashMap ();
// Arrays of validators for each attribute
private static final AttributeValidator[] FIELD_Code_Validators;
private static final AttributeValidator[] FIELD_QuestionText_Validators;
private static final AttributeValidator[] FIELD_AustraliaOnly_Validators;
private static final AttributeValidator[] FIELD_MultipleAnswers_Validators;
// Arrays of behaviour decorators
private static final DiversityQuestionBehaviourDecorator[] DiversityQuestion_BehaviourDecorators;
static
{
try
{
String tmp_Answers = DiversityAnswer.BACKREF_Question;
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
setupAssocMetaData_Answers();
FIELD_Code_Validators = (AttributeValidator[])setupAttribMetaData_Code(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_QuestionText_Validators = (AttributeValidator[])setupAttribMetaData_QuestionText(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_AustraliaOnly_Validators = (AttributeValidator[])setupAttribMetaData_AustraliaOnly(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_MultipleAnswers_Validators = (AttributeValidator[])setupAttribMetaData_MultipleAnswers(validatorMapping).toArray (new AttributeValidator[0]);
REFERENCE_DiversityQuestion.initialiseReference ();
DUMMY_DiversityQuestion.initialiseReference ();
DiversityQuestion_BehaviourDecorators = BaseBusinessClass.getBBCBehaviours(DiversityQuestion.class).toArray(new DiversityQuestionBehaviourDecorator[0]);
}
catch (RuntimeException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR1, e, "Error initialising");
throw e;
}
}
// Meta Info setup
private static void setupAssocMetaData_Answers()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "Question");
metaInfo.put ("name", "Answers");
metaInfo.put ("type", "DiversityAnswer");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for DiversityQuestion.Answers:", metaInfo);
ATTRIBUTES_METADATA_DiversityQuestion.put (MULTIPLEREFERENCE_Answers, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static List setupAttribMetaData_Code(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "question_code");
metaInfo.put ("mandatory", "true");
metaInfo.put ("name", "Code");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for DiversityQuestion.Code:", metaInfo);
ATTRIBUTES_METADATA_DiversityQuestion.put (FIELD_Code, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(DiversityQuestion.class, "Code", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for DiversityQuestion.Code:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_QuestionText(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "question_text");
metaInfo.put ("mandatory", "true");
metaInfo.put ("name", "QuestionText");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for DiversityQuestion.QuestionText:", metaInfo);
ATTRIBUTES_METADATA_DiversityQuestion.put (FIELD_QuestionText, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(DiversityQuestion.class, "QuestionText", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for DiversityQuestion.QuestionText:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_AustraliaOnly(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "australia_only");
metaInfo.put ("defaultValue", "Boolean.FALSE");
metaInfo.put ("name", "AustraliaOnly");
metaInfo.put ("type", "Boolean");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for DiversityQuestion.AustraliaOnly:", metaInfo);
ATTRIBUTES_METADATA_DiversityQuestion.put (FIELD_AustraliaOnly, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(DiversityQuestion.class, "AustraliaOnly", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for DiversityQuestion.AustraliaOnly:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_MultipleAnswers(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "multiple_answers");
metaInfo.put ("defaultValue", "Boolean.FALSE");
metaInfo.put ("name", "MultipleAnswers");
metaInfo.put ("type", "Boolean");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for DiversityQuestion.MultipleAnswers:", metaInfo);
ATTRIBUTES_METADATA_DiversityQuestion.put (FIELD_MultipleAnswers, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(DiversityQuestion.class, "MultipleAnswers", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for DiversityQuestion.MultipleAnswers:", validators);
return validators;
}
// END OF STATIC METADATA DEFINITION
// This constructor should not be called
protected BaseDiversityQuestion ()
{
}
protected BBCBehaviourDecorator[] getBehaviours()
{
return DiversityQuestion_BehaviourDecorators;
}
// Initialise the attributes
protected void _initialiseNewObjAttributes (ObjectTransaction transaction) throws StorageException
{
super._initialiseNewObjAttributes (transaction);
_Code = (String)(HELPER_Code.initialise (_Code));
_QuestionText = (String)(HELPER_QuestionText.initialise (_QuestionText));
_AustraliaOnly = (Boolean)(Boolean.FALSE);
_MultipleAnswers = (Boolean)(Boolean.FALSE);
}
// Initialise the associations
protected void _initialiseAssociations ()
{
super._initialiseAssociations ();
_Answers = new MultipleAssociation<DiversityQuestion, DiversityAnswer> (this, MULTIPLEREFERENCE_Answers, DiversityAnswer.SINGLEREFERENCE_Question, DiversityAnswer.REFERENCE_DiversityAnswer);
}
// Initialise the associations
protected BaseBusinessClass initialiseReference ()
{
super.initialiseReference ();
_Answers = new MultipleAssociation<DiversityQuestion, DiversityAnswer> (this, MULTIPLEREFERENCE_Answers, DiversityAnswer.SINGLEREFERENCE_Question, DiversityAnswer.REFERENCE_DiversityAnswer);
return this;
}
/**
* Get the attribute Code
*/
public String getCode ()
{
assertValid();
String valToReturn = _Code;
for (DiversityQuestionBehaviourDecorator bhd : DiversityQuestion_BehaviourDecorators)
{
valToReturn = bhd.getCode ((DiversityQuestion)this, valToReturn);
}
return valToReturn;
}
/**
* Called prior to the attribute changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preCodeChange (String newCode) throws FieldException
{
}
/**
* Called after the attribute changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postCodeChange () throws FieldException
{
}
public FieldWriteability getWriteability_Code ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute Code. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setCode (String newCode) throws FieldException
{
boolean oldAndNewIdentical = HELPER_Code.compare (_Code, newCode);
try
{
for (DiversityQuestionBehaviourDecorator bhd : DiversityQuestion_BehaviourDecorators)
{
newCode = bhd.setCode ((DiversityQuestion)this, newCode);
oldAndNewIdentical = HELPER_Code.compare (_Code, newCode);
}
BusinessObjectParser.assertFieldCondition (newCode != null, this, FIELD_Code, "mandatory");
if (FIELD_Code_Validators.length > 0)
{
Object newCodeObj = HELPER_Code.toObject (newCode);
if (newCodeObj != null)
{
int loopMax = FIELD_Code_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_DiversityQuestion.get (FIELD_Code);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_Code_Validators[v].checkAttribute (this, FIELD_Code, metadata, newCodeObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_Code () != FieldWriteability.FALSE, "Field Code is not writeable");
preCodeChange (newCode);
markFieldChange (FIELD_Code);
_Code = newCode;
postFieldChange (FIELD_Code);
postCodeChange ();
}
}
/**
* Get the attribute QuestionText
*/
public String getQuestionText ()
{
assertValid();
String valToReturn = _QuestionText;
for (DiversityQuestionBehaviourDecorator bhd : DiversityQuestion_BehaviourDecorators)
{
valToReturn = bhd.getQuestionText ((DiversityQuestion)this, valToReturn);
}
return valToReturn;
}
/**
* Called prior to the attribute changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preQuestionTextChange (String newQuestionText) throws FieldException
{
}
/**
* Called after the attribute changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postQuestionTextChange () throws FieldException
{
}
public FieldWriteability getWriteability_QuestionText ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute QuestionText. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setQuestionText (String newQuestionText) throws FieldException
{
boolean oldAndNewIdentical = HELPER_QuestionText.compare (_QuestionText, newQuestionText);
try
{
for (DiversityQuestionBehaviourDecorator bhd : DiversityQuestion_BehaviourDecorators)
{
newQuestionText = bhd.setQuestionText ((DiversityQuestion)this, newQuestionText);
oldAndNewIdentical = HELPER_QuestionText.compare (_QuestionText, newQuestionText);
}
BusinessObjectParser.assertFieldCondition (newQuestionText != null, this, FIELD_QuestionText, "mandatory");
if (FIELD_QuestionText_Validators.length > 0)
{
Object newQuestionTextObj = HELPER_QuestionText.toObject (newQuestionText);
if (newQuestionTextObj != null)
{
int loopMax = FIELD_QuestionText_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_DiversityQuestion.get (FIELD_QuestionText);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_QuestionText_Validators[v].checkAttribute (this, FIELD_QuestionText, metadata, newQuestionTextObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_QuestionText () != FieldWriteability.FALSE, "Field QuestionText is not writeable");
preQuestionTextChange (newQuestionText);
markFieldChange (FIELD_QuestionText);
_QuestionText = newQuestionText;
postFieldChange (FIELD_QuestionText);
postQuestionTextChange ();
}
}
/**
* Get the attribute AustraliaOnly
*/
public Boolean getAustraliaOnly ()
{
assertValid();
Boolean valToReturn = _AustraliaOnly;
for (DiversityQuestionBehaviourDecorator bhd : DiversityQuestion_BehaviourDecorators)
{
valToReturn = bhd.getAustraliaOnly ((DiversityQuestion)this, valToReturn);
}
return valToReturn;
}
/**
* Called prior to the attribute changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preAustraliaOnlyChange (Boolean newAustraliaOnly) throws FieldException
{
}
/**
* Called after the attribute changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postAustraliaOnlyChange () throws FieldException
{
}
public FieldWriteability getWriteability_AustraliaOnly ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute AustraliaOnly. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setAustraliaOnly (Boolean newAustraliaOnly) throws FieldException
{
boolean oldAndNewIdentical = HELPER_AustraliaOnly.compare (_AustraliaOnly, newAustraliaOnly);
try
{
for (DiversityQuestionBehaviourDecorator bhd : DiversityQuestion_BehaviourDecorators)
{
newAustraliaOnly = bhd.setAustraliaOnly ((DiversityQuestion)this, newAustraliaOnly);
oldAndNewIdentical = HELPER_AustraliaOnly.compare (_AustraliaOnly, newAustraliaOnly);
}
if (FIELD_AustraliaOnly_Validators.length > 0)
{
Object newAustraliaOnlyObj = HELPER_AustraliaOnly.toObject (newAustraliaOnly);
if (newAustraliaOnlyObj != null)
{
int loopMax = FIELD_AustraliaOnly_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_DiversityQuestion.get (FIELD_AustraliaOnly);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_AustraliaOnly_Validators[v].checkAttribute (this, FIELD_AustraliaOnly, metadata, newAustraliaOnlyObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_AustraliaOnly () != FieldWriteability.FALSE, "Field AustraliaOnly is not writeable");
preAustraliaOnlyChange (newAustraliaOnly);
markFieldChange (FIELD_AustraliaOnly);
_AustraliaOnly = newAustraliaOnly;
postFieldChange (FIELD_AustraliaOnly);
postAustraliaOnlyChange ();
}
}
/**
* Get the attribute MultipleAnswers
*/
public Boolean getMultipleAnswers ()
{
assertValid();
Boolean valToReturn = _MultipleAnswers;
for (DiversityQuestionBehaviourDecorator bhd : DiversityQuestion_BehaviourDecorators)
{
valToReturn = bhd.getMultipleAnswers ((DiversityQuestion)this, valToReturn);
}
return valToReturn;
}
/**
* Called prior to the attribute changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preMultipleAnswersChange (Boolean newMultipleAnswers) throws FieldException
{
}
/**
* Called after the attribute changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postMultipleAnswersChange () throws FieldException
{
}
public FieldWriteability getWriteability_MultipleAnswers ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute MultipleAnswers. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setMultipleAnswers (Boolean newMultipleAnswers) throws FieldException
{
boolean oldAndNewIdentical = HELPER_MultipleAnswers.compare (_MultipleAnswers, newMultipleAnswers);
try
{
for (DiversityQuestionBehaviourDecorator bhd : DiversityQuestion_BehaviourDecorators)
{
newMultipleAnswers = bhd.setMultipleAnswers ((DiversityQuestion)this, newMultipleAnswers);
oldAndNewIdentical = HELPER_MultipleAnswers.compare (_MultipleAnswers, newMultipleAnswers);
}
if (FIELD_MultipleAnswers_Validators.length > 0)
{
Object newMultipleAnswersObj = HELPER_MultipleAnswers.toObject (newMultipleAnswers);
if (newMultipleAnswersObj != null)
{
int loopMax = FIELD_MultipleAnswers_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_DiversityQuestion.get (FIELD_MultipleAnswers);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_MultipleAnswers_Validators[v].checkAttribute (this, FIELD_MultipleAnswers, metadata, newMultipleAnswersObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_MultipleAnswers () != FieldWriteability.FALSE, "Field MultipleAnswers is not writeable");
preMultipleAnswersChange (newMultipleAnswers);
markFieldChange (FIELD_MultipleAnswers);
_MultipleAnswers = newMultipleAnswers;
postFieldChange (FIELD_MultipleAnswers);
postMultipleAnswersChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getSingleAssocs()
{
List result = super.getSingleAssocs ();
return result;
}
public BaseBusinessClass getSingleAssocReferenceInstance (String assocName)
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else
{
return super.getSingleAssocReferenceInstance (assocName);
}
}
public String getSingleAssocBackReference(String assocName)
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else
{
return super.getSingleAssocBackReference (assocName);
}
}
public BaseBusinessClass getSingleAssoc (String assocName) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else
{
return super.getSingleAssoc (assocName);
}
}
public BaseBusinessClass getSingleAssoc (String assocName, Get getType) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else
{
return super.getSingleAssoc (assocName, getType);
}
}
public Long getSingleAssocID (String assocName) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else
{
return super.getSingleAssocID (assocName);
}
}
public void setSingleAssoc (String assocName, BaseBusinessClass newValue) throws StorageException, FieldException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else
{
super.setSingleAssoc (assocName, newValue);
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getMultiAssocs()
{
List result = super.getMultiAssocs ();
result.add("Answers");
return result;
}
/**
* Get the reference instance for the multi assoc name.
*/
public BaseBusinessClass getMultiAssocReferenceInstance(String attribName)
{
if (MULTIPLEREFERENCE_Answers.equals(attribName))
{
return DiversityAnswer.REFERENCE_DiversityAnswer ;
}
return super.getMultiAssocReferenceInstance(attribName);
}
public String getMultiAssocBackReference(String attribName)
{
if (MULTIPLEREFERENCE_Answers.equals(attribName))
{
return DiversityAnswer.SINGLEREFERENCE_Question ;
}
return super.getMultiAssocBackReference(attribName);
}
/**
* Get the assoc count for the multi assoc name.
*/
public int getMultiAssocCount(String attribName) throws StorageException
{
if (MULTIPLEREFERENCE_Answers.equals(attribName))
{
return this.getAnswersCount();
}
return super.getMultiAssocCount(attribName);
}
/**
* Get the assoc at a particular index
*/
public BaseBusinessClass getMultiAssocAt(String attribName, int index) throws StorageException
{
if (MULTIPLEREFERENCE_Answers.equals(attribName))
{
return this.getAnswersAt(index);
}
return super.getMultiAssocAt(attribName, index);
}
/**
* Add to a multi assoc by attribute name
*/
public void addToMultiAssoc(String attribName, BaseBusinessClass newElement) throws StorageException
{
if (MULTIPLEREFERENCE_Answers.equals(attribName))
{
addToAnswers((DiversityAnswer)newElement);
return;
}
super.addToMultiAssoc(attribName, newElement);
}
/**
* Remove from a multi assoc by attribute name
*/
public void removeFromMultiAssoc(String attribName, BaseBusinessClass oldElement) throws StorageException
{
if (MULTIPLEREFERENCE_Answers.equals(attribName))
{
removeFromAnswers((DiversityAnswer)oldElement);
return;
}
super.removeFromMultiAssoc(attribName, oldElement);
}
protected void __loadMultiAssoc (String attribName, BaseBusinessClass[] elements)
{
if (MULTIPLEREFERENCE_Answers.equals(attribName))
{
_Answers.__loadAssociation (elements);
return;
}
super.__loadMultiAssoc(attribName, elements);
}
protected boolean __isMultiAssocLoaded (String attribName)
{
if (MULTIPLEREFERENCE_Answers.equals(attribName))
{
return _Answers.isLoaded ();
}
return super.__isMultiAssocLoaded(attribName);
}
public FieldWriteability getWriteability_Answers ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
public int getAnswersCount () throws StorageException
{
assertValid();
return _Answers.getReferencedObjectsCount ();
}
public void addToAnswers (DiversityAnswer 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.getQuestion () != this)
{
newElement.setQuestion ((DiversityQuestion)(this));
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
}
}
public void removeFromAnswers (DiversityAnswer 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.getQuestion () != null)
{
elementToRemove.setQuestion (null);
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
}
}
public DiversityAnswer getAnswersAt (int index) throws StorageException
{
return (DiversityAnswer)(_Answers.getElementAt (index));
}
public SortedSet<DiversityAnswer> getAnswersSet () throws StorageException
{
return _Answers.getSet ();
}
public void onDelete ()
{
try
{
for(DiversityAnswer referenced : CollectionUtils.reverse(getAnswersSet()))
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null Question from ", getObjectID (), " to ", referenced.getObjectID ());
referenced.setQuestion(null);
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
super.onDelete ();
}
public DiversityQuestion newInstance ()
{
return new DiversityQuestion ();
}
public DiversityQuestion referenceInstance ()
{
return REFERENCE_DiversityQuestion;
}
public DiversityQuestion getInTransaction (ObjectTransaction t) throws StorageException
{
return getDiversityQuestionByID (t, getObjectID());
}
public BaseBusinessClass dummyInstance ()
{
return DUMMY_DiversityQuestion;
}
public String getBaseSetName ()
{
return "tl_diversity_question";
}
/**
* This is where an object returns the Persistent sets that will
* store it into the database.
* The should be entered into allSets
*/
public void getPersistentSets (PersistentSetCollection allSets)
{
ObjectStatus myStatus = getStatus ();
PersistentSetStatus myPSetStatus = myStatus.getPSetStatus();
ObjectID myID = getID();
super.getPersistentSets (allSets);
PersistentSet tl_diversity_questionPSet = allSets.getPersistentSet (myID, "tl_diversity_question", myPSetStatus);
tl_diversity_questionPSet.setAttrib (FIELD_ObjectID, myID);
tl_diversity_questionPSet.setAttrib (FIELD_Code, HELPER_Code.toObject (_Code)); //
tl_diversity_questionPSet.setAttrib (FIELD_QuestionText, HELPER_QuestionText.toObject (_QuestionText)); //
tl_diversity_questionPSet.setAttrib (FIELD_AustraliaOnly, HELPER_AustraliaOnly.toObject (_AustraliaOnly)); //
tl_diversity_questionPSet.setAttrib (FIELD_MultipleAnswers, HELPER_MultipleAnswers.toObject (_MultipleAnswers)); //
}
/**
* Sets the objects state based on Persistent sets.
*/
public void setFromPersistentSets (ObjectID objectID, PersistentSetCollection allSets)
{
super.setFromPersistentSets (objectID, allSets);
PersistentSet tl_diversity_questionPSet = allSets.getPersistentSet (objectID, "tl_diversity_question");
_Code = (String)(HELPER_Code.fromObject (_Code, tl_diversity_questionPSet.getAttrib (FIELD_Code))); //
_QuestionText = (String)(HELPER_QuestionText.fromObject (_QuestionText, tl_diversity_questionPSet.getAttrib (FIELD_QuestionText))); //
_AustraliaOnly = (Boolean)(HELPER_AustraliaOnly.fromObject (_AustraliaOnly, tl_diversity_questionPSet.getAttrib (FIELD_AustraliaOnly))); //
_MultipleAnswers = (Boolean)(HELPER_MultipleAnswers.fromObject (_MultipleAnswers, tl_diversity_questionPSet.getAttrib (FIELD_MultipleAnswers))); //
}
public void setAttributesFrom (BaseBusinessClass other, MultiException e)
{
super.setAttributesFrom (other, e);
if (other instanceof DiversityQuestion)
{
DiversityQuestion otherDiversityQuestion = (DiversityQuestion)other;
try
{
setCode (otherDiversityQuestion.getCode ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setQuestionText (otherDiversityQuestion.getQuestionText ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setAustraliaOnly (otherDiversityQuestion.getAustraliaOnly ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setMultipleAnswers (otherDiversityQuestion.getMultipleAnswers ());
}
catch (FieldException ex)
{
e.addException (ex);
}
}
}
/**
* Set the attributes in this to copies of the attributes in source.
*/
public void copyAttributesFrom (BaseBusinessClass source)
{
super.copyAttributesFrom (source);
if (source instanceof BaseDiversityQuestion)
{
BaseDiversityQuestion sourceDiversityQuestion = (BaseDiversityQuestion)(source);
_Code = sourceDiversityQuestion._Code;
_QuestionText = sourceDiversityQuestion._QuestionText;
_AustraliaOnly = sourceDiversityQuestion._AustraliaOnly;
_MultipleAnswers = sourceDiversityQuestion._MultipleAnswers;
}
}
/**
* Set the associations in this to copies of the attributes in source.
*/
public void copySingleAssociationsFrom (BaseBusinessClass source, boolean linkToGhosts)
{
super.copySingleAssociationsFrom (source, linkToGhosts);
if (source instanceof BaseDiversityQuestion)
{
BaseDiversityQuestion sourceDiversityQuestion = (BaseDiversityQuestion)(source);
}
}
/**
* Set the associations in this to copies of the attributes in source.
*/
public void copyAssociationsFrom (BaseBusinessClass source, boolean linkToGhosts)
{
super.copyAssociationsFrom (source, linkToGhosts);
if (source instanceof BaseDiversityQuestion)
{
BaseDiversityQuestion sourceDiversityQuestion = (BaseDiversityQuestion)(source);
_Answers.copyFrom (sourceDiversityQuestion._Answers, linkToGhosts);
}
}
public void validate (ValidationContext context)
{
super.validate (context);
}
/**
* Subclasses must override this to read in their attributes
*/
protected void readExternalData(Map<String, Object> vals) throws IOException, ClassNotFoundException
{
super.readExternalData(vals);
_Code = (String)(HELPER_Code.readExternal (_Code, vals.get(FIELD_Code))); //
_QuestionText = (String)(HELPER_QuestionText.readExternal (_QuestionText, vals.get(FIELD_QuestionText))); //
_AustraliaOnly = (Boolean)(HELPER_AustraliaOnly.readExternal (_AustraliaOnly, vals.get(FIELD_AustraliaOnly))); //
_MultipleAnswers = (Boolean)(HELPER_MultipleAnswers.readExternal (_MultipleAnswers, vals.get(FIELD_MultipleAnswers))); //
_Answers.readExternalData(vals.get(MULTIPLEREFERENCE_Answers));
}
/**
* Subclasses must override this to write out their attributes
*/
protected void writeExternalData(Map<String, Object> vals) throws IOException
{
super.writeExternalData(vals);
vals.put (FIELD_Code, HELPER_Code.writeExternal (_Code));
vals.put (FIELD_QuestionText, HELPER_QuestionText.writeExternal (_QuestionText));
vals.put (FIELD_AustraliaOnly, HELPER_AustraliaOnly.writeExternal (_AustraliaOnly));
vals.put (FIELD_MultipleAnswers, HELPER_MultipleAnswers.writeExternal (_MultipleAnswers));
vals.put (MULTIPLEREFERENCE_Answers, _Answers.writeExternalData());
}
public void compare (BaseBusinessClass other, AttributeChangeListener listener) throws StorageException
{
super.compare (other, listener);
if (other instanceof BaseDiversityQuestion)
{
BaseDiversityQuestion otherDiversityQuestion = (BaseDiversityQuestion)(other);
if (!HELPER_Code.compare(this._Code, otherDiversityQuestion._Code))
{
listener.notifyFieldChange(this, other, FIELD_Code, HELPER_Code.toObject(this._Code), HELPER_Code.toObject(otherDiversityQuestion._Code));
}
if (!HELPER_QuestionText.compare(this._QuestionText, otherDiversityQuestion._QuestionText))
{
listener.notifyFieldChange(this, other, FIELD_QuestionText, HELPER_QuestionText.toObject(this._QuestionText), HELPER_QuestionText.toObject(otherDiversityQuestion._QuestionText));
}
if (!HELPER_AustraliaOnly.compare(this._AustraliaOnly, otherDiversityQuestion._AustraliaOnly))
{
listener.notifyFieldChange(this, other, FIELD_AustraliaOnly, HELPER_AustraliaOnly.toObject(this._AustraliaOnly), HELPER_AustraliaOnly.toObject(otherDiversityQuestion._AustraliaOnly));
}
if (!HELPER_MultipleAnswers.compare(this._MultipleAnswers, otherDiversityQuestion._MultipleAnswers))
{
listener.notifyFieldChange(this, other, FIELD_MultipleAnswers, HELPER_MultipleAnswers.toObject(this._MultipleAnswers), HELPER_MultipleAnswers.toObject(otherDiversityQuestion._MultipleAnswers));
}
// Compare single assocs
// Compare multiple assocs
_Answers.compare (otherDiversityQuestion._Answers, listener);
}
}
public void visitTransients (AttributeVisitor visitor) throws StorageException
{
super.visitAttributes (visitor);
}
public void visitAttributes (AttributeVisitor visitor) throws StorageException
{
super.visitAttributes (visitor);
visitor.visitField(this, FIELD_Code, HELPER_Code.toObject(getCode()));
visitor.visitField(this, FIELD_QuestionText, HELPER_QuestionText.toObject(getQuestionText()));
visitor.visitField(this, FIELD_AustraliaOnly, HELPER_AustraliaOnly.toObject(getAustraliaOnly()));
visitor.visitField(this, FIELD_MultipleAnswers, HELPER_MultipleAnswers.toObject(getMultipleAnswers()));
visitor.visitAssociation (_Answers);
}
public void visitAssociations (AssociationVisitor visitor, AssociatedScope scope) throws StorageException
{
super.visitAssociations (visitor, scope);
if (scope.includes (_Answers))
{
visitor.visit (_Answers);
}
}
public static DiversityQuestion createDiversityQuestion (ObjectTransaction transaction) throws StorageException
{
DiversityQuestion result = new DiversityQuestion ();
result.initialiseNewObject (transaction);
return result;
}
public static DiversityQuestion getDiversityQuestionByID (ObjectTransaction transaction, Long objectID) throws StorageException
{
return (DiversityQuestion)(transaction.getObjectByID (REFERENCE_DiversityQuestion, objectID));
}
public boolean testFilter (String attribName, QueryFilter filter) throws StorageException
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_Code))
{
return filter.matches (getCode ());
}
else if (attribName.equals (FIELD_QuestionText))
{
return filter.matches (getQuestionText ());
}
else if (attribName.equals (FIELD_AustraliaOnly))
{
return filter.matches (getAustraliaOnly ());
}
else if (attribName.equals (FIELD_MultipleAnswers))
{
return filter.matches (getMultipleAnswers ());
}
else
{
return super.testFilter (attribName, filter);
}
}
public static SearchAll SearchByAll () { return new SearchAll (); }
public static class SearchAll extends SearchObject<DiversityQuestion>
{
public SearchAll andObjectID (QueryFilter<Long> filter)
{
filter.addFilter (context, "tl_diversity_question.object_id", FIELD_ObjectID);
return this;
}
public SearchAll andObjectCreated (QueryFilter<Date> filter)
{
filter.addFilter (context, "tl_diversity_question.object_created_date", FIELD_ObjectCreated);
return this;
}
public SearchAll andObjectLastModified (QueryFilter<Date> filter)
{
filter.addFilter (context, "tl_diversity_question.object_last_updated_date", FIELD_ObjectLastModified);
return this;
}
public SearchAll andCode (QueryFilter<String> filter)
{
filter.addFilter (context, "tl_diversity_question.question_code", "Code");
return this;
}
public SearchAll andQuestionText (QueryFilter<String> filter)
{
filter.addFilter (context, "tl_diversity_question.question_text", "QuestionText");
return this;
}
public SearchAll andAustraliaOnly (QueryFilter<Boolean> filter)
{
filter.addFilter (context, "tl_diversity_question.australia_only", "AustraliaOnly");
return this;
}
public SearchAll andMultipleAnswers (QueryFilter<Boolean> filter)
{
filter.addFilter (context, "tl_diversity_question.multiple_answers", "MultipleAnswers");
return this;
}
public DiversityQuestion[]
search (ObjectTransaction transaction) throws StorageException
{
BaseBusinessClass[] results = super.search (transaction, REFERENCE_DiversityQuestion, SEARCH_All, criteria);
Set<DiversityQuestion> typedResults = new LinkedHashSet <DiversityQuestion> ();
for (BaseBusinessClass bbcResult : results)
{
DiversityQuestion aResult = (DiversityQuestion)bbcResult;
typedResults.add (aResult);
}
return ObjstoreUtils.removeDeleted(transaction, typedResults).toArray (new DiversityQuestion[0]);
}
}
public static DiversityQuestion[]
searchAll (ObjectTransaction transaction) throws StorageException
{
return SearchByAll ()
.search (transaction);
}
public Object getAttribute (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_Code))
{
return HELPER_Code.toObject (getCode ());
}
else if (attribName.equals (FIELD_QuestionText))
{
return HELPER_QuestionText.toObject (getQuestionText ());
}
else if (attribName.equals (FIELD_AustraliaOnly))
{
return HELPER_AustraliaOnly.toObject (getAustraliaOnly ());
}
else if (attribName.equals (FIELD_MultipleAnswers))
{
return HELPER_MultipleAnswers.toObject (getMultipleAnswers ());
}
else
{
return super.getAttribute (attribName);
}
}
public AttributeHelper getAttributeHelper (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_Code))
{
return HELPER_Code;
}
else if (attribName.equals (FIELD_QuestionText))
{
return HELPER_QuestionText;
}
else if (attribName.equals (FIELD_AustraliaOnly))
{
return HELPER_AustraliaOnly;
}
else if (attribName.equals (FIELD_MultipleAnswers))
{
return HELPER_MultipleAnswers;
}
else
{
return super.getAttributeHelper (attribName);
}
}
public void setAttribute (String attribName, Object attribValue) throws FieldException
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_Code))
{
setCode ((String)(HELPER_Code.fromObject (_Code, attribValue)));
}
else if (attribName.equals (FIELD_QuestionText))
{
setQuestionText ((String)(HELPER_QuestionText.fromObject (_QuestionText, attribValue)));
}
else if (attribName.equals (FIELD_AustraliaOnly))
{
setAustraliaOnly ((Boolean)(HELPER_AustraliaOnly.fromObject (_AustraliaOnly, attribValue)));
}
else if (attribName.equals (FIELD_MultipleAnswers))
{
setMultipleAnswers ((Boolean)(HELPER_MultipleAnswers.fromObject (_MultipleAnswers, attribValue)));
}
else
{
super.setAttribute (attribName, attribValue);
}
}
public boolean isWriteable (String fieldName)
{
return getWriteable (fieldName) == FieldWriteability.TRUE;
}
public FieldWriteability getWriteable (String fieldName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (fieldName.equals (FIELD_Code))
{
return getWriteability_Code ();
}
else if (fieldName.equals (FIELD_QuestionText))
{
return getWriteability_QuestionText ();
}
else if (fieldName.equals (FIELD_AustraliaOnly))
{
return getWriteability_AustraliaOnly ();
}
else if (fieldName.equals (FIELD_MultipleAnswers))
{
return getWriteability_MultipleAnswers ();
}
else if (fieldName.equals (MULTIPLEREFERENCE_Answers))
{
return getWriteability_Answers ();
}
else
{
return super.getWriteable (fieldName);
}
}
public void putUnwriteable (Set<String> fields)
{
if (getWriteability_Code () != FieldWriteability.TRUE)
{
fields.add (FIELD_Code);
}
if (getWriteability_QuestionText () != FieldWriteability.TRUE)
{
fields.add (FIELD_QuestionText);
}
if (getWriteability_AustraliaOnly () != FieldWriteability.TRUE)
{
fields.add (FIELD_AustraliaOnly);
}
if (getWriteability_MultipleAnswers () != FieldWriteability.TRUE)
{
fields.add (FIELD_MultipleAnswers);
}
super.putUnwriteable (fields);
}
public List<AbstractAttribute> getAttributes ()
{
List result = super.getAttributes ();
result.add(HELPER_Code.getAttribObject (getClass (), _Code, true, FIELD_Code));
result.add(HELPER_QuestionText.getAttribObject (getClass (), _QuestionText, true, FIELD_QuestionText));
result.add(HELPER_AustraliaOnly.getAttribObject (getClass (), _AustraliaOnly, false, FIELD_AustraliaOnly));
result.add(HELPER_MultipleAnswers.getAttribObject (getClass (), _MultipleAnswers, false, FIELD_MultipleAnswers));
return result;
}
public Map getAttributeMetadata (String attribute)
{
if (ATTRIBUTES_METADATA_DiversityQuestion.containsKey (attribute))
{
return (Map)ATTRIBUTES_METADATA_DiversityQuestion.get (attribute);
}
else
{
return super.getAttributeMetadata (attribute);
}
}
public Object getAttributeMetadata (String attribute, String metadata)
{
if (ATTRIBUTES_METADATA_DiversityQuestion.containsKey (attribute))
{
return ((Map)ATTRIBUTES_METADATA_DiversityQuestion.get (attribute)).get(metadata);
}
else
{
return super.getAttributeMetadata (attribute, metadata);
}
}
public void preCommit (boolean willBeStored) throws Exception
{
super.preCommit(willBeStored);
if(willBeStored)
{
}
}
public oneit.servlets.objstore.binary.BinaryContentHandler getBinaryContentHandler(String attribName)
{
return super.getBinaryContentHandler(attribName);
}
public static class DiversityQuestionBehaviourDecorator extends BaseBusinessClass.BBCBehaviourDecorator<DiversityQuestion>
{
/**
* Get the attribute Code
*/
public String getCode (DiversityQuestion obj, String original)
{
return original;
}
/**
* Change the value set for attribute Code.
* May modify the field beforehand
* Occurs before validation.
*/
public String setCode (DiversityQuestion obj, String newCode) throws FieldException
{
return newCode;
}
/**
* Get the attribute QuestionText
*/
public String getQuestionText (DiversityQuestion obj, String original)
{
return original;
}
/**
* Change the value set for attribute QuestionText.
* May modify the field beforehand
* Occurs before validation.
*/
public String setQuestionText (DiversityQuestion obj, String newQuestionText) throws FieldException
{
return newQuestionText;
}
/**
* Get the attribute AustraliaOnly
*/
public Boolean getAustraliaOnly (DiversityQuestion obj, Boolean original)
{
return original;
}
/**
* Change the value set for attribute AustraliaOnly.
* May modify the field beforehand
* Occurs before validation.
*/
public Boolean setAustraliaOnly (DiversityQuestion obj, Boolean newAustraliaOnly) throws FieldException
{
return newAustraliaOnly;
}
/**
* Get the attribute MultipleAnswers
*/
public Boolean getMultipleAnswers (DiversityQuestion obj, Boolean original)
{
return original;
}
/**
* Change the value set for attribute MultipleAnswers.
* May modify the field beforehand
* Occurs before validation.
*/
public Boolean setMultipleAnswers (DiversityQuestion obj, Boolean newMultipleAnswers) throws FieldException
{
return newMultipleAnswers;
}
}
public ORMPipeLine pipes()
{
return new DiversityQuestionPipeLineFactory<DiversityQuestion, DiversityQuestion> ((DiversityQuestion)this);
}
/**
* Use this instead of pipes() to get rid of type casting.
*/
public DiversityQuestionPipeLineFactory<DiversityQuestion, DiversityQuestion> pipelineDiversityQuestion()
{
return (DiversityQuestionPipeLineFactory<DiversityQuestion, DiversityQuestion>) pipes();
}
public static DiversityQuestionPipeLineFactory<DiversityQuestion, DiversityQuestion> pipesDiversityQuestion(Collection<DiversityQuestion> items)
{
return REFERENCE_DiversityQuestion.new DiversityQuestionPipeLineFactory<DiversityQuestion, DiversityQuestion> (items);
}
public static DiversityQuestionPipeLineFactory<DiversityQuestion, DiversityQuestion> pipesDiversityQuestion(DiversityQuestion[] _items)
{
return pipesDiversityQuestion(Arrays.asList (_items));
}
public static DiversityQuestionPipeLineFactory<DiversityQuestion, DiversityQuestion> pipesDiversityQuestion()
{
return pipesDiversityQuestion((Collection)null);
}
public class DiversityQuestionPipeLineFactory<From extends BaseBusinessClass, Me extends DiversityQuestion> extends BaseBusinessClass.ORMPipeLine<From, Me>
{
public <Prev> DiversityQuestionPipeLineFactory (PipeLine<From, Prev> pipeLine, Pipe<Prev, Me> nextPipe)
{
super (pipeLine, nextPipe);
}
public DiversityQuestionPipeLineFactory (From seed)
{
super(seed);
}
public DiversityQuestionPipeLineFactory (Collection<From> seed)
{
super(seed);
}
public PipeLine<From, ? extends Object> to(String name)
{
if (name.equals ("Answers"))
{
return toAnswers ();
}
if (name.equals ("Code"))
{
return toCode ();
}
if (name.equals ("QuestionText"))
{
return toQuestionText ();
}
if (name.equals ("AustraliaOnly"))
{
return toAustraliaOnly ();
}
if (name.equals ("MultipleAnswers"))
{
return toMultipleAnswers ();
}
return super.to(name);
}
public PipeLine<From, String> toCode () { return pipe(new ORMAttributePipe<Me, String>(FIELD_Code)); }
public PipeLine<From, String> toQuestionText () { return pipe(new ORMAttributePipe<Me, String>(FIELD_QuestionText)); }
public PipeLine<From, Boolean> toAustraliaOnly () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_AustraliaOnly)); }
public PipeLine<From, Boolean> toMultipleAnswers () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_MultipleAnswers)); }
public DiversityAnswer.DiversityAnswerPipeLineFactory<From, DiversityAnswer> toAnswers () { return toAnswers(Filter.ALL); }
public DiversityAnswer.DiversityAnswerPipeLineFactory<From, DiversityAnswer> toAnswers (Filter<DiversityAnswer> filter)
{
return DiversityAnswer.REFERENCE_DiversityAnswer.new DiversityAnswerPipeLineFactory<From, DiversityAnswer> (this, new ORMMultiAssocPipe<Me, DiversityAnswer>(MULTIPLEREFERENCE_Answers, filter));
}
}
public boolean isTransientAttrib(String attribName)
{
return super.isTransientAttrib(attribName);
}
public boolean isTransientSingleReference(String assocName)
{
return super.isTransientSingleReference(assocName);
}
}
class DummyDiversityQuestion extends DiversityQuestion
{
// Default constructor primarily to support Externalisable
public DummyDiversityQuestion()
{
super();
}
public void assertValid ()
{
}
public int getAnswersCount () throws StorageException
{
return 0;
}
public DiversityAnswer 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();
}
}
/*
* IMPORTANT!!!! XSL Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2 rev3 [oneit.objstore.BusinessObjectTemplate.xsl]
*
* Version: 1.0
* Vendor: Apache Software Foundation (Xalan XSLTC)
* Vendor URL: http://xml.apache.org/xalan-j
*/
package performa.orm;
import java.io.*;
import java.util.*;
import oneit.appservices.config.*;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.objstore.assocs.*;
import oneit.objstore.attributes.*;
import oneit.objstore.rdbms.filters.*;
import oneit.objstore.parser.*;
import oneit.objstore.validator.*;
import oneit.objstore.utils.*;
import oneit.utils.*;
import oneit.utils.filter.Filter;
import oneit.utils.transform.*;
import oneit.utils.parsers.FieldException;
public abstract class BaseHTDiversityQuestion extends BaseBusinessClass
{
// Reference instance for the object
public static final HTDiversityQuestion REFERENCE_HTDiversityQuestion = new HTDiversityQuestion ();
// Reference instance for the object
public static final HTDiversityQuestion DUMMY_HTDiversityQuestion = new DummyHTDiversityQuestion ();
// Static constants corresponding to field names
public static final String FIELD_QuestionText = "QuestionText";
public static final String FIELD_IsApplicable = "IsApplicable";
public static final String SINGLEREFERENCE_Question = "Question";
public static final String SINGLEREFERENCE_HiringTeam = "HiringTeam";
public static final String BACKREF_HiringTeam = "";
// Static constants corresponding to searches
public static final String SEARCH_All = "All";
// Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper<HTDiversityQuestion> HELPER_QuestionText = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<HTDiversityQuestion> HELPER_IsApplicable = DefaultAttributeHelper.INSTANCE;
// Private attributes corresponding to business object data
private String _QuestionText;
private Boolean _IsApplicable;
// Private attributes corresponding to single references
private SingleAssociation<HTDiversityQuestion, DiversityQuestion> _Question;
private SingleAssociation<HTDiversityQuestion, HiringTeam> _HiringTeam;
// Private attributes corresponding to multiple references
// Map of maps of metadata
private static final Map ATTRIBUTES_METADATA_HTDiversityQuestion = new HashMap ();
// Arrays of validators for each attribute
private static final AttributeValidator[] FIELD_QuestionText_Validators;
private static final AttributeValidator[] FIELD_IsApplicable_Validators;
// Arrays of behaviour decorators
private static final HTDiversityQuestionBehaviourDecorator[] HTDiversityQuestion_BehaviourDecorators;
static
{
try
{
String tmp_HiringTeam = HiringTeam.BACKREF_DiversityQuestions;
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
setupAssocMetaData_Question();
setupAssocMetaData_HiringTeam();
FIELD_QuestionText_Validators = (AttributeValidator[])setupAttribMetaData_QuestionText(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_IsApplicable_Validators = (AttributeValidator[])setupAttribMetaData_IsApplicable(validatorMapping).toArray (new AttributeValidator[0]);
REFERENCE_HTDiversityQuestion.initialiseReference ();
DUMMY_HTDiversityQuestion.initialiseReference ();
HTDiversityQuestion_BehaviourDecorators = BaseBusinessClass.getBBCBehaviours(HTDiversityQuestion.class).toArray(new HTDiversityQuestionBehaviourDecorator[0]);
}
catch (RuntimeException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR1, e, "Error initialising");
throw e;
}
}
// Meta Info setup
private static void setupAssocMetaData_Question()
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "question_id");
metaInfo.put ("mandatory", "true");
metaInfo.put ("name", "Question");
metaInfo.put ("type", "DiversityQuestion");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for HTDiversityQuestion.Question:", metaInfo);
ATTRIBUTES_METADATA_HTDiversityQuestion.put (SINGLEREFERENCE_Question, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static void setupAssocMetaData_HiringTeam()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "DiversityQuestions");
metaInfo.put ("dbcol", "hiring_team_id");
metaInfo.put ("mandatory", "true");
metaInfo.put ("name", "HiringTeam");
metaInfo.put ("type", "HiringTeam");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for HTDiversityQuestion.HiringTeam:", metaInfo);
ATTRIBUTES_METADATA_HTDiversityQuestion.put (SINGLEREFERENCE_HiringTeam, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static List setupAttribMetaData_QuestionText(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "question_text");
metaInfo.put ("mandatory", "true");
metaInfo.put ("name", "QuestionText");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for HTDiversityQuestion.QuestionText:", metaInfo);
ATTRIBUTES_METADATA_HTDiversityQuestion.put (FIELD_QuestionText, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(HTDiversityQuestion.class, "QuestionText", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for HTDiversityQuestion.QuestionText:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_IsApplicable(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "is_applicable");
metaInfo.put ("defaultValue", "Boolean.TRUE");
metaInfo.put ("name", "IsApplicable");
metaInfo.put ("type", "Boolean");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for HTDiversityQuestion.IsApplicable:", metaInfo);
ATTRIBUTES_METADATA_HTDiversityQuestion.put (FIELD_IsApplicable, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(HTDiversityQuestion.class, "IsApplicable", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for HTDiversityQuestion.IsApplicable:", validators);
return validators;
}
// END OF STATIC METADATA DEFINITION
// This constructor should not be called
protected BaseHTDiversityQuestion ()
{
}
protected BBCBehaviourDecorator[] getBehaviours()
{
return HTDiversityQuestion_BehaviourDecorators;
}
// Initialise the attributes
protected void _initialiseNewObjAttributes (ObjectTransaction transaction) throws StorageException
{
super._initialiseNewObjAttributes (transaction);
_QuestionText = (String)(HELPER_QuestionText.initialise (_QuestionText));
_IsApplicable = (Boolean)(Boolean.TRUE);
}
// Initialise the associations
protected void _initialiseAssociations ()
{
super._initialiseAssociations ();
_Question = new SingleAssociation<HTDiversityQuestion, DiversityQuestion> (this, SINGLEREFERENCE_Question, null, DiversityQuestion.REFERENCE_DiversityQuestion, "tl_ht_diversity_question");
_HiringTeam = new SingleAssociation<HTDiversityQuestion, HiringTeam> (this, SINGLEREFERENCE_HiringTeam, HiringTeam.MULTIPLEREFERENCE_DiversityQuestions, HiringTeam.REFERENCE_HiringTeam, "tl_ht_diversity_question");
}
// Initialise the associations
protected BaseBusinessClass initialiseReference ()
{
super.initialiseReference ();
_Question = new SingleAssociation<HTDiversityQuestion, DiversityQuestion> (this, SINGLEREFERENCE_Question, null, DiversityQuestion.REFERENCE_DiversityQuestion, "tl_ht_diversity_question");
_HiringTeam = new SingleAssociation<HTDiversityQuestion, HiringTeam> (this, SINGLEREFERENCE_HiringTeam, HiringTeam.MULTIPLEREFERENCE_DiversityQuestions, HiringTeam.REFERENCE_HiringTeam, "tl_ht_diversity_question");
return this;
}
/**
* Get the attribute QuestionText
*/
public String getQuestionText ()
{
assertValid();
String valToReturn = _QuestionText;
for (HTDiversityQuestionBehaviourDecorator bhd : HTDiversityQuestion_BehaviourDecorators)
{
valToReturn = bhd.getQuestionText ((HTDiversityQuestion)this, valToReturn);
}
return valToReturn;
}
/**
* Called prior to the attribute changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preQuestionTextChange (String newQuestionText) throws FieldException
{
}
/**
* Called after the attribute changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postQuestionTextChange () throws FieldException
{
}
public FieldWriteability getWriteability_QuestionText ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute QuestionText. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setQuestionText (String newQuestionText) throws FieldException
{
boolean oldAndNewIdentical = HELPER_QuestionText.compare (_QuestionText, newQuestionText);
try
{
for (HTDiversityQuestionBehaviourDecorator bhd : HTDiversityQuestion_BehaviourDecorators)
{
newQuestionText = bhd.setQuestionText ((HTDiversityQuestion)this, newQuestionText);
oldAndNewIdentical = HELPER_QuestionText.compare (_QuestionText, newQuestionText);
}
BusinessObjectParser.assertFieldCondition (newQuestionText != null, this, FIELD_QuestionText, "mandatory");
if (FIELD_QuestionText_Validators.length > 0)
{
Object newQuestionTextObj = HELPER_QuestionText.toObject (newQuestionText);
if (newQuestionTextObj != null)
{
int loopMax = FIELD_QuestionText_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_HTDiversityQuestion.get (FIELD_QuestionText);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_QuestionText_Validators[v].checkAttribute (this, FIELD_QuestionText, metadata, newQuestionTextObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_QuestionText () != FieldWriteability.FALSE, "Field QuestionText is not writeable");
preQuestionTextChange (newQuestionText);
markFieldChange (FIELD_QuestionText);
_QuestionText = newQuestionText;
postFieldChange (FIELD_QuestionText);
postQuestionTextChange ();
}
}
/**
* Get the attribute IsApplicable
*/
public Boolean getIsApplicable ()
{
assertValid();
Boolean valToReturn = _IsApplicable;
for (HTDiversityQuestionBehaviourDecorator bhd : HTDiversityQuestion_BehaviourDecorators)
{
valToReturn = bhd.getIsApplicable ((HTDiversityQuestion)this, valToReturn);
}
return valToReturn;
}
/**
* Called prior to the attribute changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preIsApplicableChange (Boolean newIsApplicable) throws FieldException
{
}
/**
* Called after the attribute changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postIsApplicableChange () throws FieldException
{
}
public FieldWriteability getWriteability_IsApplicable ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute IsApplicable. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setIsApplicable (Boolean newIsApplicable) throws FieldException
{
boolean oldAndNewIdentical = HELPER_IsApplicable.compare (_IsApplicable, newIsApplicable);
try
{
for (HTDiversityQuestionBehaviourDecorator bhd : HTDiversityQuestion_BehaviourDecorators)
{
newIsApplicable = bhd.setIsApplicable ((HTDiversityQuestion)this, newIsApplicable);
oldAndNewIdentical = HELPER_IsApplicable.compare (_IsApplicable, newIsApplicable);
}
if (FIELD_IsApplicable_Validators.length > 0)
{
Object newIsApplicableObj = HELPER_IsApplicable.toObject (newIsApplicable);
if (newIsApplicableObj != null)
{
int loopMax = FIELD_IsApplicable_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_HTDiversityQuestion.get (FIELD_IsApplicable);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_IsApplicable_Validators[v].checkAttribute (this, FIELD_IsApplicable, metadata, newIsApplicableObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_IsApplicable () != FieldWriteability.FALSE, "Field IsApplicable is not writeable");
preIsApplicableChange (newIsApplicable);
markFieldChange (FIELD_IsApplicable);
_IsApplicable = newIsApplicable;
postFieldChange (FIELD_IsApplicable);
postIsApplicableChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getSingleAssocs()
{
List result = super.getSingleAssocs ();
result.add("Question");
result.add("HiringTeam");
return result;
}
public BaseBusinessClass getSingleAssocReferenceInstance (String assocName)
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Question))
{
return _Question.getReferencedType ();
}else if (assocName.equals (SINGLEREFERENCE_HiringTeam))
{
return _HiringTeam.getReferencedType ();
}
else
{
return super.getSingleAssocReferenceInstance (assocName);
}
}
public String getSingleAssocBackReference(String assocName)
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Question))
{
return null ;
}else if (assocName.equals (SINGLEREFERENCE_HiringTeam))
{
return HiringTeam.MULTIPLEREFERENCE_DiversityQuestions ;
}
else
{
return super.getSingleAssocBackReference (assocName);
}
}
public BaseBusinessClass getSingleAssoc (String assocName) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Question))
{
return getQuestion ();
}else if (assocName.equals (SINGLEREFERENCE_HiringTeam))
{
return getHiringTeam ();
}
else
{
return super.getSingleAssoc (assocName);
}
}
public BaseBusinessClass getSingleAssoc (String assocName, Get getType) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Question))
{
return getQuestion (getType);
}else if (assocName.equals (SINGLEREFERENCE_HiringTeam))
{
return getHiringTeam (getType);
}
else
{
return super.getSingleAssoc (assocName, getType);
}
}
public Long getSingleAssocID (String assocName) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Question))
{
return getQuestionID ();
}else if (assocName.equals (SINGLEREFERENCE_HiringTeam))
{
return getHiringTeamID ();
}
else
{
return super.getSingleAssocID (assocName);
}
}
public void setSingleAssoc (String assocName, BaseBusinessClass newValue) throws StorageException, FieldException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Question))
{
setQuestion ((DiversityQuestion)(newValue));
}else if (assocName.equals (SINGLEREFERENCE_HiringTeam))
{
setHiringTeam ((HiringTeam)(newValue));
}
else
{
super.setSingleAssoc (assocName, newValue);
}
}
/**
* Get the reference Question
*/
public DiversityQuestion getQuestion () throws StorageException
{
assertValid();
try
{
return (DiversityQuestion)(_Question.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in HTDiversityQuestion:", this.getObjectID (), ", was trying to get DiversityQuestion:", getQuestionID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _Question.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public DiversityQuestion getQuestion (Get getType) throws StorageException
{
assertValid();
return _Question.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getQuestionID ()
{
assertValid();
if (_Question == null)
{
return null;
}
else
{
return _Question.getID ();
}
}
/**
* Called prior to the assoc changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preQuestionChange (DiversityQuestion newQuestion) throws FieldException
{
}
/**
* Called after the assoc changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postQuestionChange () throws FieldException
{
}
public FieldWriteability getWriteability_Question ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference Question. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setQuestion (DiversityQuestion newQuestion) throws StorageException, FieldException
{
BusinessObjectParser.assertFieldCondition (newQuestion != null, this, SINGLEREFERENCE_Question, "mandatory");
if (_Question.wouldReferencedChange (newQuestion))
{
assertValid();
Debug.assertion (getWriteability_Question () != FieldWriteability.FALSE, "Assoc Question is not writeable");
preQuestionChange (newQuestion);
_Question.set (newQuestion);
postQuestionChange ();
}
}
/**
* Get the reference HiringTeam
*/
public HiringTeam getHiringTeam () throws StorageException
{
assertValid();
try
{
return (HiringTeam)(_HiringTeam.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in HTDiversityQuestion:", this.getObjectID (), ", was trying to get HiringTeam:", getHiringTeamID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _HiringTeam.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public HiringTeam getHiringTeam (Get getType) throws StorageException
{
assertValid();
return _HiringTeam.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getHiringTeamID ()
{
assertValid();
if (_HiringTeam == null)
{
return null;
}
else
{
return _HiringTeam.getID ();
}
}
/**
* Called prior to the assoc changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preHiringTeamChange (HiringTeam newHiringTeam) throws FieldException
{
}
/**
* Called after the assoc changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postHiringTeamChange () throws FieldException
{
}
public FieldWriteability getWriteability_HiringTeam ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference HiringTeam. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setHiringTeam (HiringTeam newHiringTeam) throws StorageException, FieldException
{
BusinessObjectParser.assertFieldCondition (newHiringTeam != null, this, SINGLEREFERENCE_HiringTeam, "mandatory");
if (_HiringTeam.wouldReferencedChange (newHiringTeam))
{
assertValid();
Debug.assertion (getWriteability_HiringTeam () != FieldWriteability.FALSE, "Assoc HiringTeam is not writeable");
preHiringTeamChange (newHiringTeam);
HiringTeam oldHiringTeam = getHiringTeam ();
if (oldHiringTeam != null)
{
// This is to stop validation from triggering when we are removed
_HiringTeam.set (null);
oldHiringTeam.removeFromDiversityQuestions ((HTDiversityQuestion)(this));
}
_HiringTeam.set (newHiringTeam);
if (newHiringTeam != null)
{
newHiringTeam.addToDiversityQuestions ((HTDiversityQuestion)(this));
}
postHiringTeamChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getMultiAssocs()
{
List result = super.getMultiAssocs ();
return result;
}
/**
* Get the reference instance for the multi assoc name.
*/
public BaseBusinessClass getMultiAssocReferenceInstance(String attribName)
{
return super.getMultiAssocReferenceInstance(attribName);
}
public String getMultiAssocBackReference(String attribName)
{
return super.getMultiAssocBackReference(attribName);
}
/**
* Get the assoc count for the multi assoc name.
*/
public int getMultiAssocCount(String attribName) throws StorageException
{
return super.getMultiAssocCount(attribName);
}
/**
* Get the assoc at a particular index
*/
public BaseBusinessClass getMultiAssocAt(String attribName, int index) throws StorageException
{
return super.getMultiAssocAt(attribName, index);
}
/**
* Add to a multi assoc by attribute name
*/
public void addToMultiAssoc(String attribName, BaseBusinessClass newElement) throws StorageException
{
super.addToMultiAssoc(attribName, newElement);
}
/**
* Remove from a multi assoc by attribute name
*/
public void removeFromMultiAssoc(String attribName, BaseBusinessClass oldElement) throws StorageException
{
super.removeFromMultiAssoc(attribName, oldElement);
}
protected void __loadMultiAssoc (String attribName, BaseBusinessClass[] elements)
{
super.__loadMultiAssoc(attribName, elements);
}
protected boolean __isMultiAssocLoaded (String attribName)
{
return super.__isMultiAssocLoaded(attribName);
}
public void onDelete ()
{
try
{
// Ensure we are removed from any loaded multi-associations that aren't mandatory
if (_HiringTeam.isLoaded () || getTransaction ().isObjectLoaded (_HiringTeam.getReferencedType (), getHiringTeamID ()))
{
HiringTeam referenced = getHiringTeam ();
if (referenced != null)
{
// Stop the callback
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null DiversityQuestions from ", getObjectID (), " to ", referenced.getObjectID ());
_HiringTeam.set (null);
referenced.removeFromDiversityQuestions ((HTDiversityQuestion)this);
}
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
super.onDelete ();
}
public HTDiversityQuestion newInstance ()
{
return new HTDiversityQuestion ();
}
public HTDiversityQuestion referenceInstance ()
{
return REFERENCE_HTDiversityQuestion;
}
public HTDiversityQuestion getInTransaction (ObjectTransaction t) throws StorageException
{
return getHTDiversityQuestionByID (t, getObjectID());
}
public BaseBusinessClass dummyInstance ()
{
return DUMMY_HTDiversityQuestion;
}
public String getBaseSetName ()
{
return "tl_ht_diversity_question";
}
/**
* This is where an object returns the Persistent sets that will
* store it into the database.
* The should be entered into allSets
*/
public void getPersistentSets (PersistentSetCollection allSets)
{
ObjectStatus myStatus = getStatus ();
PersistentSetStatus myPSetStatus = myStatus.getPSetStatus();
ObjectID myID = getID();
super.getPersistentSets (allSets);
PersistentSet tl_ht_diversity_questionPSet = allSets.getPersistentSet (myID, "tl_ht_diversity_question", myPSetStatus);
tl_ht_diversity_questionPSet.setAttrib (FIELD_ObjectID, myID);
tl_ht_diversity_questionPSet.setAttrib (FIELD_QuestionText, HELPER_QuestionText.toObject (_QuestionText)); //
tl_ht_diversity_questionPSet.setAttrib (FIELD_IsApplicable, HELPER_IsApplicable.toObject (_IsApplicable)); //
_Question.getPersistentSets (allSets);
_HiringTeam.getPersistentSets (allSets);
}
/**
* Sets the objects state based on Persistent sets.
*/
public void setFromPersistentSets (ObjectID objectID, PersistentSetCollection allSets)
{
super.setFromPersistentSets (objectID, allSets);
PersistentSet tl_ht_diversity_questionPSet = allSets.getPersistentSet (objectID, "tl_ht_diversity_question");
_QuestionText = (String)(HELPER_QuestionText.fromObject (_QuestionText, tl_ht_diversity_questionPSet.getAttrib (FIELD_QuestionText))); //
_IsApplicable = (Boolean)(HELPER_IsApplicable.fromObject (_IsApplicable, tl_ht_diversity_questionPSet.getAttrib (FIELD_IsApplicable))); //
_Question.setFromPersistentSets (objectID, allSets);
_HiringTeam.setFromPersistentSets (objectID, allSets);
}
public void setAttributesFrom (BaseBusinessClass other, MultiException e)
{
super.setAttributesFrom (other, e);
if (other instanceof HTDiversityQuestion)
{
HTDiversityQuestion otherHTDiversityQuestion = (HTDiversityQuestion)other;
try
{
setQuestionText (otherHTDiversityQuestion.getQuestionText ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setIsApplicable (otherHTDiversityQuestion.getIsApplicable ());
}
catch (FieldException ex)
{
e.addException (ex);
}
}
}
/**
* Set the attributes in this to copies of the attributes in source.
*/
public void copyAttributesFrom (BaseBusinessClass source)
{
super.copyAttributesFrom (source);
if (source instanceof BaseHTDiversityQuestion)
{
BaseHTDiversityQuestion sourceHTDiversityQuestion = (BaseHTDiversityQuestion)(source);
_QuestionText = sourceHTDiversityQuestion._QuestionText;
_IsApplicable = sourceHTDiversityQuestion._IsApplicable;
}
}
/**
* Set the associations in this to copies of the attributes in source.
*/
public void copySingleAssociationsFrom (BaseBusinessClass source, boolean linkToGhosts)
{
super.copySingleAssociationsFrom (source, linkToGhosts);
if (source instanceof BaseHTDiversityQuestion)
{
BaseHTDiversityQuestion sourceHTDiversityQuestion = (BaseHTDiversityQuestion)(source);
_Question.copyFrom (sourceHTDiversityQuestion._Question, linkToGhosts);
_HiringTeam.copyFrom (sourceHTDiversityQuestion._HiringTeam, linkToGhosts);
}
}
/**
* Set the associations in this to copies of the attributes in source.
*/
public void copyAssociationsFrom (BaseBusinessClass source, boolean linkToGhosts)
{
super.copyAssociationsFrom (source, linkToGhosts);
if (source instanceof BaseHTDiversityQuestion)
{
BaseHTDiversityQuestion sourceHTDiversityQuestion = (BaseHTDiversityQuestion)(source);
}
}
public void validate (ValidationContext context)
{
super.validate (context);
context.check (getQuestionID() != null, this, SINGLEREFERENCE_Question, "mandatory");
context.check (getHiringTeamID() != null, this, SINGLEREFERENCE_HiringTeam, "mandatory");
}
/**
* Subclasses must override this to read in their attributes
*/
protected void readExternalData(Map<String, Object> vals) throws IOException, ClassNotFoundException
{
super.readExternalData(vals);
_QuestionText = (String)(HELPER_QuestionText.readExternal (_QuestionText, vals.get(FIELD_QuestionText))); //
_IsApplicable = (Boolean)(HELPER_IsApplicable.readExternal (_IsApplicable, vals.get(FIELD_IsApplicable))); //
_Question.readExternalData(vals.get(SINGLEREFERENCE_Question));
_HiringTeam.readExternalData(vals.get(SINGLEREFERENCE_HiringTeam));
}
/**
* Subclasses must override this to write out their attributes
*/
protected void writeExternalData(Map<String, Object> vals) throws IOException
{
super.writeExternalData(vals);
vals.put (FIELD_QuestionText, HELPER_QuestionText.writeExternal (_QuestionText));
vals.put (FIELD_IsApplicable, HELPER_IsApplicable.writeExternal (_IsApplicable));
vals.put (SINGLEREFERENCE_Question, _Question.writeExternalData());
vals.put (SINGLEREFERENCE_HiringTeam, _HiringTeam.writeExternalData());
}
public void compare (BaseBusinessClass other, AttributeChangeListener listener) throws StorageException
{
super.compare (other, listener);
if (other instanceof BaseHTDiversityQuestion)
{
BaseHTDiversityQuestion otherHTDiversityQuestion = (BaseHTDiversityQuestion)(other);
if (!HELPER_QuestionText.compare(this._QuestionText, otherHTDiversityQuestion._QuestionText))
{
listener.notifyFieldChange(this, other, FIELD_QuestionText, HELPER_QuestionText.toObject(this._QuestionText), HELPER_QuestionText.toObject(otherHTDiversityQuestion._QuestionText));
}
if (!HELPER_IsApplicable.compare(this._IsApplicable, otherHTDiversityQuestion._IsApplicable))
{
listener.notifyFieldChange(this, other, FIELD_IsApplicable, HELPER_IsApplicable.toObject(this._IsApplicable), HELPER_IsApplicable.toObject(otherHTDiversityQuestion._IsApplicable));
}
// Compare single assocs
_Question.compare (otherHTDiversityQuestion._Question, listener);
_HiringTeam.compare (otherHTDiversityQuestion._HiringTeam, listener);
// Compare multiple assocs
}
}
public void visitTransients (AttributeVisitor visitor) throws StorageException
{
super.visitAttributes (visitor);
}
public void visitAttributes (AttributeVisitor visitor) throws StorageException
{
super.visitAttributes (visitor);
visitor.visitField(this, FIELD_QuestionText, HELPER_QuestionText.toObject(getQuestionText()));
visitor.visitField(this, FIELD_IsApplicable, HELPER_IsApplicable.toObject(getIsApplicable()));
visitor.visitAssociation (_Question);
visitor.visitAssociation (_HiringTeam);
}
public void visitAssociations (AssociationVisitor visitor, AssociatedScope scope) throws StorageException
{
super.visitAssociations (visitor, scope);
if (scope.includes (_Question))
{
visitor.visit (_Question);
}
if (scope.includes (_HiringTeam))
{
visitor.visit (_HiringTeam);
}
}
public static HTDiversityQuestion createHTDiversityQuestion (ObjectTransaction transaction) throws StorageException
{
HTDiversityQuestion result = new HTDiversityQuestion ();
result.initialiseNewObject (transaction);
return result;
}
public static HTDiversityQuestion getHTDiversityQuestionByID (ObjectTransaction transaction, Long objectID) throws StorageException
{
return (HTDiversityQuestion)(transaction.getObjectByID (REFERENCE_HTDiversityQuestion, objectID));
}
public boolean testFilter (String attribName, QueryFilter filter) throws StorageException
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_QuestionText))
{
return filter.matches (getQuestionText ());
}
else if (attribName.equals (FIELD_IsApplicable))
{
return filter.matches (getIsApplicable ());
}
else if (attribName.equals (SINGLEREFERENCE_Question))
{
return filter.matches (getQuestion ());
}
else if (attribName.equals (SINGLEREFERENCE_HiringTeam))
{
return filter.matches (getHiringTeam ());
}
else
{
return super.testFilter (attribName, filter);
}
}
public static SearchAll SearchByAll () { return new SearchAll (); }
public static class SearchAll extends SearchObject<HTDiversityQuestion>
{
public SearchAll andObjectID (QueryFilter<Long> filter)
{
filter.addFilter (context, "tl_ht_diversity_question.object_id", FIELD_ObjectID);
return this;
}
public SearchAll andObjectCreated (QueryFilter<Date> filter)
{
filter.addFilter (context, "tl_ht_diversity_question.object_created_date", FIELD_ObjectCreated);
return this;
}
public SearchAll andObjectLastModified (QueryFilter<Date> filter)
{
filter.addFilter (context, "tl_ht_diversity_question.object_last_updated_date", FIELD_ObjectLastModified);
return this;
}
public SearchAll andQuestionText (QueryFilter<String> filter)
{
filter.addFilter (context, "tl_ht_diversity_question.question_text", "QuestionText");
return this;
}
public SearchAll andIsApplicable (QueryFilter<Boolean> filter)
{
filter.addFilter (context, "tl_ht_diversity_question.is_applicable", "IsApplicable");
return this;
}
public SearchAll andQuestion (QueryFilter<DiversityQuestion> filter)
{
filter.addFilter (context, "tl_ht_diversity_question.question_id", "Question");
return this;
}
public SearchAll andHiringTeam (QueryFilter<HiringTeam> filter)
{
filter.addFilter (context, "tl_ht_diversity_question.hiring_team_id", "HiringTeam");
return this;
}
public HTDiversityQuestion[]
search (ObjectTransaction transaction) throws StorageException
{
BaseBusinessClass[] results = super.search (transaction, REFERENCE_HTDiversityQuestion, SEARCH_All, criteria);
Set<HTDiversityQuestion> typedResults = new LinkedHashSet <HTDiversityQuestion> ();
for (BaseBusinessClass bbcResult : results)
{
HTDiversityQuestion aResult = (HTDiversityQuestion)bbcResult;
typedResults.add (aResult);
}
return ObjstoreUtils.removeDeleted(transaction, typedResults).toArray (new HTDiversityQuestion[0]);
}
}
public static HTDiversityQuestion[]
searchAll (ObjectTransaction transaction) throws StorageException
{
return SearchByAll ()
.search (transaction);
}
public Object getAttribute (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_QuestionText))
{
return HELPER_QuestionText.toObject (getQuestionText ());
}
else if (attribName.equals (FIELD_IsApplicable))
{
return HELPER_IsApplicable.toObject (getIsApplicable ());
}
else
{
return super.getAttribute (attribName);
}
}
public AttributeHelper getAttributeHelper (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_QuestionText))
{
return HELPER_QuestionText;
}
else if (attribName.equals (FIELD_IsApplicable))
{
return HELPER_IsApplicable;
}
else
{
return super.getAttributeHelper (attribName);
}
}
public void setAttribute (String attribName, Object attribValue) throws FieldException
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_QuestionText))
{
setQuestionText ((String)(HELPER_QuestionText.fromObject (_QuestionText, attribValue)));
}
else if (attribName.equals (FIELD_IsApplicable))
{
setIsApplicable ((Boolean)(HELPER_IsApplicable.fromObject (_IsApplicable, attribValue)));
}
else
{
super.setAttribute (attribName, attribValue);
}
}
public boolean isWriteable (String fieldName)
{
return getWriteable (fieldName) == FieldWriteability.TRUE;
}
public FieldWriteability getWriteable (String fieldName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (fieldName.equals (FIELD_QuestionText))
{
return getWriteability_QuestionText ();
}
else if (fieldName.equals (FIELD_IsApplicable))
{
return getWriteability_IsApplicable ();
}
else if (fieldName.equals (SINGLEREFERENCE_Question))
{
return getWriteability_Question ();
}
else if (fieldName.equals (SINGLEREFERENCE_HiringTeam))
{
return getWriteability_HiringTeam ();
}
else
{
return super.getWriteable (fieldName);
}
}
public void putUnwriteable (Set<String> fields)
{
if (getWriteability_QuestionText () != FieldWriteability.TRUE)
{
fields.add (FIELD_QuestionText);
}
if (getWriteability_IsApplicable () != FieldWriteability.TRUE)
{
fields.add (FIELD_IsApplicable);
}
super.putUnwriteable (fields);
}
public List<AbstractAttribute> getAttributes ()
{
List result = super.getAttributes ();
result.add(HELPER_QuestionText.getAttribObject (getClass (), _QuestionText, true, FIELD_QuestionText));
result.add(HELPER_IsApplicable.getAttribObject (getClass (), _IsApplicable, false, FIELD_IsApplicable));
return result;
}
public Map getAttributeMetadata (String attribute)
{
if (ATTRIBUTES_METADATA_HTDiversityQuestion.containsKey (attribute))
{
return (Map)ATTRIBUTES_METADATA_HTDiversityQuestion.get (attribute);
}
else
{
return super.getAttributeMetadata (attribute);
}
}
public Object getAttributeMetadata (String attribute, String metadata)
{
if (ATTRIBUTES_METADATA_HTDiversityQuestion.containsKey (attribute))
{
return ((Map)ATTRIBUTES_METADATA_HTDiversityQuestion.get (attribute)).get(metadata);
}
else
{
return super.getAttributeMetadata (attribute, metadata);
}
}
public void preCommit (boolean willBeStored) throws Exception
{
super.preCommit(willBeStored);
if(willBeStored)
{
}
}
public oneit.servlets.objstore.binary.BinaryContentHandler getBinaryContentHandler(String attribName)
{
return super.getBinaryContentHandler(attribName);
}
public static class HTDiversityQuestionBehaviourDecorator extends BaseBusinessClass.BBCBehaviourDecorator<HTDiversityQuestion>
{
/**
* Get the attribute QuestionText
*/
public String getQuestionText (HTDiversityQuestion obj, String original)
{
return original;
}
/**
* Change the value set for attribute QuestionText.
* May modify the field beforehand
* Occurs before validation.
*/
public String setQuestionText (HTDiversityQuestion obj, String newQuestionText) throws FieldException
{
return newQuestionText;
}
/**
* Get the attribute IsApplicable
*/
public Boolean getIsApplicable (HTDiversityQuestion obj, Boolean original)
{
return original;
}
/**
* Change the value set for attribute IsApplicable.
* May modify the field beforehand
* Occurs before validation.
*/
public Boolean setIsApplicable (HTDiversityQuestion obj, Boolean newIsApplicable) throws FieldException
{
return newIsApplicable;
}
}
public ORMPipeLine pipes()
{
return new HTDiversityQuestionPipeLineFactory<HTDiversityQuestion, HTDiversityQuestion> ((HTDiversityQuestion)this);
}
/**
* Use this instead of pipes() to get rid of type casting.
*/
public HTDiversityQuestionPipeLineFactory<HTDiversityQuestion, HTDiversityQuestion> pipelineHTDiversityQuestion()
{
return (HTDiversityQuestionPipeLineFactory<HTDiversityQuestion, HTDiversityQuestion>) pipes();
}
public static HTDiversityQuestionPipeLineFactory<HTDiversityQuestion, HTDiversityQuestion> pipesHTDiversityQuestion(Collection<HTDiversityQuestion> items)
{
return REFERENCE_HTDiversityQuestion.new HTDiversityQuestionPipeLineFactory<HTDiversityQuestion, HTDiversityQuestion> (items);
}
public static HTDiversityQuestionPipeLineFactory<HTDiversityQuestion, HTDiversityQuestion> pipesHTDiversityQuestion(HTDiversityQuestion[] _items)
{
return pipesHTDiversityQuestion(Arrays.asList (_items));
}
public static HTDiversityQuestionPipeLineFactory<HTDiversityQuestion, HTDiversityQuestion> pipesHTDiversityQuestion()
{
return pipesHTDiversityQuestion((Collection)null);
}
public class HTDiversityQuestionPipeLineFactory<From extends BaseBusinessClass, Me extends HTDiversityQuestion> extends BaseBusinessClass.ORMPipeLine<From, Me>
{
public <Prev> HTDiversityQuestionPipeLineFactory (PipeLine<From, Prev> pipeLine, Pipe<Prev, Me> nextPipe)
{
super (pipeLine, nextPipe);
}
public HTDiversityQuestionPipeLineFactory (From seed)
{
super(seed);
}
public HTDiversityQuestionPipeLineFactory (Collection<From> seed)
{
super(seed);
}
public PipeLine<From, ? extends Object> to(String name)
{
if (name.equals ("QuestionText"))
{
return toQuestionText ();
}
if (name.equals ("IsApplicable"))
{
return toIsApplicable ();
}
if (name.equals ("Question"))
{
return toQuestion ();
}
if (name.equals ("HiringTeam"))
{
return toHiringTeam ();
}
return super.to(name);
}
public PipeLine<From, String> toQuestionText () { return pipe(new ORMAttributePipe<Me, String>(FIELD_QuestionText)); }
public PipeLine<From, Boolean> toIsApplicable () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_IsApplicable)); }
public DiversityQuestion.DiversityQuestionPipeLineFactory<From, DiversityQuestion> toQuestion () { return toQuestion (Filter.ALL); }
public DiversityQuestion.DiversityQuestionPipeLineFactory<From, DiversityQuestion> toQuestion (Filter<DiversityQuestion> filter)
{
return DiversityQuestion.REFERENCE_DiversityQuestion.new DiversityQuestionPipeLineFactory<From, DiversityQuestion> (this, new ORMSingleAssocPipe<Me, DiversityQuestion>(SINGLEREFERENCE_Question, filter));
}
public HiringTeam.HiringTeamPipeLineFactory<From, HiringTeam> toHiringTeam () { return toHiringTeam (Filter.ALL); }
public HiringTeam.HiringTeamPipeLineFactory<From, HiringTeam> toHiringTeam (Filter<HiringTeam> filter)
{
return HiringTeam.REFERENCE_HiringTeam.new HiringTeamPipeLineFactory<From, HiringTeam> (this, new ORMSingleAssocPipe<Me, HiringTeam>(SINGLEREFERENCE_HiringTeam, filter));
}
}
public boolean isTransientAttrib(String attribName)
{
return super.isTransientAttrib(attribName);
}
public boolean isTransientSingleReference(String assocName)
{
return super.isTransientSingleReference(assocName);
}
}
class DummyHTDiversityQuestion extends HTDiversityQuestion
{
// Default constructor primarily to support Externalisable
public DummyHTDiversityQuestion()
{
super();
}
public void assertValid ()
{
}
public DiversityQuestion getQuestion () throws StorageException
{
return (DiversityQuestion)(DiversityQuestion.DUMMY_DiversityQuestion);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getQuestionID ()
{
return DiversityQuestion.DUMMY_DiversityQuestion.getObjectID();
}
public HiringTeam getHiringTeam () throws StorageException
{
return (HiringTeam)(HiringTeam.DUMMY_HiringTeam);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getHiringTeamID ()
{
return HiringTeam.DUMMY_HiringTeam.getObjectID();
}
}
...@@ -52,6 +52,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -52,6 +52,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
public static final String FIELD_PostCode = "PostCode"; public static final String FIELD_PostCode = "PostCode";
public static final String FIELD_City = "City"; public static final String FIELD_City = "City";
public static final String FIELD_HasClientSupport = "HasClientSupport"; public static final String FIELD_HasClientSupport = "HasClientSupport";
public static final String FIELD_HasDiversity = "HasDiversity";
public static final String FIELD_ManageOwnBilling = "ManageOwnBilling"; public static final String FIELD_ManageOwnBilling = "ManageOwnBilling";
public static final String FIELD_StripeReference = "StripeReference"; public static final String FIELD_StripeReference = "StripeReference";
public static final String FIELD_StripeSubscription = "StripeSubscription"; public static final String FIELD_StripeSubscription = "StripeSubscription";
...@@ -91,6 +92,8 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -91,6 +92,8 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
public static final String BACKREF_Clients = ""; public static final String BACKREF_Clients = "";
public static final String MULTIPLEREFERENCE_BillingTeams = "BillingTeams"; public static final String MULTIPLEREFERENCE_BillingTeams = "BillingTeams";
public static final String BACKREF_BillingTeams = ""; public static final String BACKREF_BillingTeams = "";
public static final String MULTIPLEREFERENCE_DiversityQuestions = "DiversityQuestions";
public static final String BACKREF_DiversityQuestions = "";
// Static constants corresponding to searches // Static constants corresponding to searches
public static final String SEARCH_All = "All"; public static final String SEARCH_All = "All";
...@@ -108,6 +111,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -108,6 +111,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
private static final DefaultAttributeHelper<HiringTeam> HELPER_PostCode = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper<HiringTeam> HELPER_PostCode = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<HiringTeam> HELPER_City = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper<HiringTeam> HELPER_City = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<HiringTeam> HELPER_HasClientSupport = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper<HiringTeam> HELPER_HasClientSupport = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<HiringTeam> HELPER_HasDiversity = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<HiringTeam> HELPER_ManageOwnBilling = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper<HiringTeam> HELPER_ManageOwnBilling = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<HiringTeam> HELPER_StripeReference = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper<HiringTeam> HELPER_StripeReference = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<HiringTeam> HELPER_StripeSubscription = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper<HiringTeam> HELPER_StripeSubscription = DefaultAttributeHelper.INSTANCE;
...@@ -147,6 +151,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -147,6 +151,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
private String _PostCode; private String _PostCode;
private String _City; private String _City;
private Boolean _HasClientSupport; private Boolean _HasClientSupport;
private Boolean _HasDiversity;
private Boolean _ManageOwnBilling; private Boolean _ManageOwnBilling;
private String _StripeReference; private String _StripeReference;
private String _StripeSubscription; private String _StripeSubscription;
...@@ -187,6 +192,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -187,6 +192,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
private MultipleAssociation<HiringTeam, CompanyUserHiringTeamLink> _Users; private MultipleAssociation<HiringTeam, CompanyUserHiringTeamLink> _Users;
private MultipleAssociation<HiringTeam, Client> _Clients; private MultipleAssociation<HiringTeam, Client> _Clients;
private MultipleAssociation<HiringTeam, HiringTeam> _BillingTeams; private MultipleAssociation<HiringTeam, HiringTeam> _BillingTeams;
private MultipleAssociation<HiringTeam, HTDiversityQuestion> _DiversityQuestions;
// Map of maps of metadata // Map of maps of metadata
...@@ -207,6 +213,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -207,6 +213,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
private static final AttributeValidator[] FIELD_PostCode_Validators; private static final AttributeValidator[] FIELD_PostCode_Validators;
private static final AttributeValidator[] FIELD_City_Validators; private static final AttributeValidator[] FIELD_City_Validators;
private static final AttributeValidator[] FIELD_HasClientSupport_Validators; private static final AttributeValidator[] FIELD_HasClientSupport_Validators;
private static final AttributeValidator[] FIELD_HasDiversity_Validators;
private static final AttributeValidator[] FIELD_ManageOwnBilling_Validators; private static final AttributeValidator[] FIELD_ManageOwnBilling_Validators;
private static final AttributeValidator[] FIELD_StripeReference_Validators; private static final AttributeValidator[] FIELD_StripeReference_Validators;
private static final AttributeValidator[] FIELD_StripeSubscription_Validators; private static final AttributeValidator[] FIELD_StripeSubscription_Validators;
...@@ -242,6 +249,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -242,6 +249,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
String tmp_Users = CompanyUserHiringTeamLink.BACKREF_HiringTeam; String tmp_Users = CompanyUserHiringTeamLink.BACKREF_HiringTeam;
String tmp_Clients = Client.BACKREF_HiringTeam; String tmp_Clients = Client.BACKREF_HiringTeam;
String tmp_BillingTeams = HiringTeam.BACKREF_BilledByTeam; String tmp_BillingTeams = HiringTeam.BACKREF_BilledByTeam;
String tmp_DiversityQuestions = HTDiversityQuestion.BACKREF_HiringTeam;
String tmp_Company = Company.BACKREF_HiringTeams; String tmp_Company = Company.BACKREF_HiringTeams;
String tmp_BilledByTeam = HiringTeam.BACKREF_BillingTeams; String tmp_BilledByTeam = HiringTeam.BACKREF_BillingTeams;
...@@ -250,6 +258,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -250,6 +258,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
setupAssocMetaData_Users(); setupAssocMetaData_Users();
setupAssocMetaData_Clients(); setupAssocMetaData_Clients();
setupAssocMetaData_BillingTeams(); setupAssocMetaData_BillingTeams();
setupAssocMetaData_DiversityQuestions();
setupAssocMetaData_Company(); setupAssocMetaData_Company();
setupAssocMetaData_BilledByTeam(); setupAssocMetaData_BilledByTeam();
setupAssocMetaData_AddedByUser(); setupAssocMetaData_AddedByUser();
...@@ -269,6 +278,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -269,6 +278,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
FIELD_PostCode_Validators = (AttributeValidator[])setupAttribMetaData_PostCode(validatorMapping).toArray (new AttributeValidator[0]); FIELD_PostCode_Validators = (AttributeValidator[])setupAttribMetaData_PostCode(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_City_Validators = (AttributeValidator[])setupAttribMetaData_City(validatorMapping).toArray (new AttributeValidator[0]); FIELD_City_Validators = (AttributeValidator[])setupAttribMetaData_City(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_HasClientSupport_Validators = (AttributeValidator[])setupAttribMetaData_HasClientSupport(validatorMapping).toArray (new AttributeValidator[0]); FIELD_HasClientSupport_Validators = (AttributeValidator[])setupAttribMetaData_HasClientSupport(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_HasDiversity_Validators = (AttributeValidator[])setupAttribMetaData_HasDiversity(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_ManageOwnBilling_Validators = (AttributeValidator[])setupAttribMetaData_ManageOwnBilling(validatorMapping).toArray (new AttributeValidator[0]); FIELD_ManageOwnBilling_Validators = (AttributeValidator[])setupAttribMetaData_ManageOwnBilling(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_StripeReference_Validators = (AttributeValidator[])setupAttribMetaData_StripeReference(validatorMapping).toArray (new AttributeValidator[0]); FIELD_StripeReference_Validators = (AttributeValidator[])setupAttribMetaData_StripeReference(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_StripeSubscription_Validators = (AttributeValidator[])setupAttribMetaData_StripeSubscription(validatorMapping).toArray (new AttributeValidator[0]); FIELD_StripeSubscription_Validators = (AttributeValidator[])setupAttribMetaData_StripeSubscription(validatorMapping).toArray (new AttributeValidator[0]);
...@@ -348,6 +358,20 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -348,6 +358,20 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
// Meta Info setup // Meta Info setup
private static void setupAssocMetaData_DiversityQuestions()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "HiringTeam");
metaInfo.put ("name", "DiversityQuestions");
metaInfo.put ("type", "HTDiversityQuestion");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for HiringTeam.DiversityQuestions:", metaInfo);
ATTRIBUTES_METADATA_HiringTeam.put (MULTIPLEREFERENCE_DiversityQuestions, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static void setupAssocMetaData_Company() private static void setupAssocMetaData_Company()
{ {
Map metaInfo = new HashMap (); Map metaInfo = new HashMap ();
...@@ -698,6 +722,26 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -698,6 +722,26 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
} }
// Meta Info setup // Meta Info setup
private static List setupAttribMetaData_HasDiversity(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "has_diversity");
metaInfo.put ("defaultValue", "Boolean.FALSE");
metaInfo.put ("mandatory", "false");
metaInfo.put ("name", "HasDiversity");
metaInfo.put ("type", "Boolean");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for HiringTeam.HasDiversity:", metaInfo);
ATTRIBUTES_METADATA_HiringTeam.put (FIELD_HasDiversity, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(HiringTeam.class, "HasDiversity", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for HiringTeam.HasDiversity:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_ManageOwnBilling(Map validatorMapping) private static List setupAttribMetaData_ManageOwnBilling(Map validatorMapping)
{ {
Map metaInfo = new HashMap (); Map metaInfo = new HashMap ();
...@@ -1145,6 +1189,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -1145,6 +1189,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
_PostCode = (String)(HELPER_PostCode.initialise (_PostCode)); _PostCode = (String)(HELPER_PostCode.initialise (_PostCode));
_City = (String)(HELPER_City.initialise (_City)); _City = (String)(HELPER_City.initialise (_City));
_HasClientSupport = (Boolean)(Boolean.FALSE); _HasClientSupport = (Boolean)(Boolean.FALSE);
_HasDiversity = (Boolean)(Boolean.FALSE);
_ManageOwnBilling = (Boolean)(Boolean.TRUE); _ManageOwnBilling = (Boolean)(Boolean.TRUE);
_StripeReference = (String)(HELPER_StripeReference.initialise (_StripeReference)); _StripeReference = (String)(HELPER_StripeReference.initialise (_StripeReference));
_StripeSubscription = (String)(HELPER_StripeSubscription.initialise (_StripeSubscription)); _StripeSubscription = (String)(HELPER_StripeSubscription.initialise (_StripeSubscription));
...@@ -1187,6 +1232,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -1187,6 +1232,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
_Users = new MultipleAssociation<HiringTeam, CompanyUserHiringTeamLink> (this, MULTIPLEREFERENCE_Users, CompanyUserHiringTeamLink.SINGLEREFERENCE_HiringTeam, CompanyUserHiringTeamLink.REFERENCE_CompanyUserHiringTeamLink); _Users = new MultipleAssociation<HiringTeam, CompanyUserHiringTeamLink> (this, MULTIPLEREFERENCE_Users, CompanyUserHiringTeamLink.SINGLEREFERENCE_HiringTeam, CompanyUserHiringTeamLink.REFERENCE_CompanyUserHiringTeamLink);
_Clients = new MultipleAssociation<HiringTeam, Client> (this, MULTIPLEREFERENCE_Clients, Client.SINGLEREFERENCE_HiringTeam, Client.REFERENCE_Client); _Clients = new MultipleAssociation<HiringTeam, Client> (this, MULTIPLEREFERENCE_Clients, Client.SINGLEREFERENCE_HiringTeam, Client.REFERENCE_Client);
_BillingTeams = new MultipleAssociation<HiringTeam, HiringTeam> (this, MULTIPLEREFERENCE_BillingTeams, HiringTeam.SINGLEREFERENCE_BilledByTeam, HiringTeam.REFERENCE_HiringTeam); _BillingTeams = new MultipleAssociation<HiringTeam, HiringTeam> (this, MULTIPLEREFERENCE_BillingTeams, HiringTeam.SINGLEREFERENCE_BilledByTeam, HiringTeam.REFERENCE_HiringTeam);
_DiversityQuestions = new MultipleAssociation<HiringTeam, HTDiversityQuestion> (this, MULTIPLEREFERENCE_DiversityQuestions, HTDiversityQuestion.SINGLEREFERENCE_HiringTeam, HTDiversityQuestion.REFERENCE_HTDiversityQuestion);
} }
...@@ -1204,6 +1250,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -1204,6 +1250,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
_Users = new MultipleAssociation<HiringTeam, CompanyUserHiringTeamLink> (this, MULTIPLEREFERENCE_Users, CompanyUserHiringTeamLink.SINGLEREFERENCE_HiringTeam, CompanyUserHiringTeamLink.REFERENCE_CompanyUserHiringTeamLink); _Users = new MultipleAssociation<HiringTeam, CompanyUserHiringTeamLink> (this, MULTIPLEREFERENCE_Users, CompanyUserHiringTeamLink.SINGLEREFERENCE_HiringTeam, CompanyUserHiringTeamLink.REFERENCE_CompanyUserHiringTeamLink);
_Clients = new MultipleAssociation<HiringTeam, Client> (this, MULTIPLEREFERENCE_Clients, Client.SINGLEREFERENCE_HiringTeam, Client.REFERENCE_Client); _Clients = new MultipleAssociation<HiringTeam, Client> (this, MULTIPLEREFERENCE_Clients, Client.SINGLEREFERENCE_HiringTeam, Client.REFERENCE_Client);
_BillingTeams = new MultipleAssociation<HiringTeam, HiringTeam> (this, MULTIPLEREFERENCE_BillingTeams, HiringTeam.SINGLEREFERENCE_BilledByTeam, HiringTeam.REFERENCE_HiringTeam); _BillingTeams = new MultipleAssociation<HiringTeam, HiringTeam> (this, MULTIPLEREFERENCE_BillingTeams, HiringTeam.SINGLEREFERENCE_BilledByTeam, HiringTeam.REFERENCE_HiringTeam);
_DiversityQuestions = new MultipleAssociation<HiringTeam, HTDiversityQuestion> (this, MULTIPLEREFERENCE_DiversityQuestions, HTDiversityQuestion.SINGLEREFERENCE_HiringTeam, HTDiversityQuestion.REFERENCE_HTDiversityQuestion);
return this; return this;
...@@ -2193,6 +2240,104 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -2193,6 +2240,104 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
} }
/** /**
* Get the attribute HasDiversity
*/
public Boolean getHasDiversity ()
{
assertValid();
Boolean valToReturn = _HasDiversity;
for (HiringTeamBehaviourDecorator bhd : HiringTeam_BehaviourDecorators)
{
valToReturn = bhd.getHasDiversity ((HiringTeam)this, valToReturn);
}
return valToReturn;
}
/**
* Called prior to the attribute changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preHasDiversityChange (Boolean newHasDiversity) throws FieldException
{
}
/**
* Called after the attribute changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postHasDiversityChange () throws FieldException
{
}
public FieldWriteability getWriteability_HasDiversity ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute HasDiversity. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setHasDiversity (Boolean newHasDiversity) throws FieldException
{
boolean oldAndNewIdentical = HELPER_HasDiversity.compare (_HasDiversity, newHasDiversity);
try
{
for (HiringTeamBehaviourDecorator bhd : HiringTeam_BehaviourDecorators)
{
newHasDiversity = bhd.setHasDiversity ((HiringTeam)this, newHasDiversity);
oldAndNewIdentical = HELPER_HasDiversity.compare (_HasDiversity, newHasDiversity);
}
if (FIELD_HasDiversity_Validators.length > 0)
{
Object newHasDiversityObj = HELPER_HasDiversity.toObject (newHasDiversity);
if (newHasDiversityObj != null)
{
int loopMax = FIELD_HasDiversity_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_HiringTeam.get (FIELD_HasDiversity);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_HasDiversity_Validators[v].checkAttribute (this, FIELD_HasDiversity, metadata, newHasDiversityObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_HasDiversity () != FieldWriteability.FALSE, "Field HasDiversity is not writeable");
preHasDiversityChange (newHasDiversity);
markFieldChange (FIELD_HasDiversity);
_HasDiversity = newHasDiversity;
postFieldChange (FIELD_HasDiversity);
postHasDiversityChange ();
}
}
/**
* Get the attribute ManageOwnBilling * Get the attribute ManageOwnBilling
*/ */
public Boolean getManageOwnBilling () public Boolean getManageOwnBilling ()
...@@ -5452,6 +5597,8 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -5452,6 +5597,8 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
result.add("BillingTeams"); result.add("BillingTeams");
result.add("DiversityQuestions");
return result; return result;
} }
...@@ -5478,6 +5625,11 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -5478,6 +5625,11 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
return HiringTeam.REFERENCE_HiringTeam ; return HiringTeam.REFERENCE_HiringTeam ;
} }
if (MULTIPLEREFERENCE_DiversityQuestions.equals(attribName))
{
return HTDiversityQuestion.REFERENCE_HTDiversityQuestion ;
}
return super.getMultiAssocReferenceInstance(attribName); return super.getMultiAssocReferenceInstance(attribName);
} }
...@@ -5501,6 +5653,11 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -5501,6 +5653,11 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
return HiringTeam.SINGLEREFERENCE_BilledByTeam ; return HiringTeam.SINGLEREFERENCE_BilledByTeam ;
} }
if (MULTIPLEREFERENCE_DiversityQuestions.equals(attribName))
{
return HTDiversityQuestion.SINGLEREFERENCE_HiringTeam ;
}
return super.getMultiAssocBackReference(attribName); return super.getMultiAssocBackReference(attribName);
} }
...@@ -5527,6 +5684,11 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -5527,6 +5684,11 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
return this.getBillingTeamsCount(); return this.getBillingTeamsCount();
} }
if (MULTIPLEREFERENCE_DiversityQuestions.equals(attribName))
{
return this.getDiversityQuestionsCount();
}
return super.getMultiAssocCount(attribName); return super.getMultiAssocCount(attribName);
} }
...@@ -5553,6 +5715,11 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -5553,6 +5715,11 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
return this.getBillingTeamsAt(index); return this.getBillingTeamsAt(index);
} }
if (MULTIPLEREFERENCE_DiversityQuestions.equals(attribName))
{
return this.getDiversityQuestionsAt(index);
}
return super.getMultiAssocAt(attribName, index); return super.getMultiAssocAt(attribName, index);
} }
...@@ -5585,6 +5752,13 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -5585,6 +5752,13 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
return; return;
} }
if (MULTIPLEREFERENCE_DiversityQuestions.equals(attribName))
{
addToDiversityQuestions((HTDiversityQuestion)newElement);
return;
}
super.addToMultiAssoc(attribName, newElement); super.addToMultiAssoc(attribName, newElement);
} }
...@@ -5616,6 +5790,13 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -5616,6 +5790,13 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
return; return;
} }
if (MULTIPLEREFERENCE_DiversityQuestions.equals(attribName))
{
removeFromDiversityQuestions((HTDiversityQuestion)oldElement);
return;
}
super.removeFromMultiAssoc(attribName, oldElement); super.removeFromMultiAssoc(attribName, oldElement);
} }
...@@ -5642,6 +5823,12 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -5642,6 +5823,12 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
return; return;
} }
if (MULTIPLEREFERENCE_DiversityQuestions.equals(attribName))
{
_DiversityQuestions.__loadAssociation (elements);
return;
}
super.__loadMultiAssoc(attribName, elements); super.__loadMultiAssoc(attribName, elements);
} }
...@@ -5665,6 +5852,11 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -5665,6 +5852,11 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
return _BillingTeams.isLoaded (); return _BillingTeams.isLoaded ();
} }
if (MULTIPLEREFERENCE_DiversityQuestions.equals(attribName))
{
return _DiversityQuestions.isLoaded ();
}
return super.__isMultiAssocLoaded(attribName); return super.__isMultiAssocLoaded(attribName);
} }
...@@ -5878,6 +6070,75 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -5878,6 +6070,75 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
return _BillingTeams.getSet (); return _BillingTeams.getSet ();
} }
public FieldWriteability getWriteability_DiversityQuestions ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
public int getDiversityQuestionsCount () throws StorageException
{
assertValid();
return _DiversityQuestions.getReferencedObjectsCount ();
}
public void addToDiversityQuestions (HTDiversityQuestion newElement) throws StorageException
{
if (_DiversityQuestions.wouldAddChange (newElement))
{
assertValid();
Debug.assertion (getWriteability_DiversityQuestions () != FieldWriteability.FALSE, "MultiAssoc DiversityQuestions is not writeable (add)");
_DiversityQuestions.appendElement (newElement);
try
{
if (newElement.getHiringTeam () != this)
{
newElement.setHiringTeam ((HiringTeam)(this));
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
}
}
public void removeFromDiversityQuestions (HTDiversityQuestion elementToRemove) throws StorageException
{
if (_DiversityQuestions.wouldRemoveChange (elementToRemove))
{
assertValid();
Debug.assertion (getWriteability_DiversityQuestions () != FieldWriteability.FALSE, "MultiAssoc DiversityQuestions is not writeable (remove)");
_DiversityQuestions.removeElement (elementToRemove);
try
{
if (elementToRemove.getHiringTeam () != null)
{
elementToRemove.setHiringTeam (null);
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
}
}
public HTDiversityQuestion getDiversityQuestionsAt (int index) throws StorageException
{
return (HTDiversityQuestion)(_DiversityQuestions.getElementAt (index));
}
public SortedSet<HTDiversityQuestion> getDiversityQuestionsSet () throws StorageException
{
return _DiversityQuestions.getSet ();
}
public void onDelete () public void onDelete ()
...@@ -5930,6 +6191,12 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -5930,6 +6191,12 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
referenced.setBilledByTeam(null); referenced.setBilledByTeam(null);
} }
for(HTDiversityQuestion referenced : CollectionUtils.reverse(getDiversityQuestionsSet()))
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null HiringTeam from ", getObjectID (), " to ", referenced.getObjectID ());
referenced.setHiringTeam(null);
}
} }
catch (Exception e) catch (Exception e)
{ {
...@@ -6000,6 +6267,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -6000,6 +6267,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
tl_hiring_teamPSet.setAttrib (FIELD_PostCode, HELPER_PostCode.toObject (_PostCode)); // tl_hiring_teamPSet.setAttrib (FIELD_PostCode, HELPER_PostCode.toObject (_PostCode)); //
tl_hiring_teamPSet.setAttrib (FIELD_City, HELPER_City.toObject (_City)); // tl_hiring_teamPSet.setAttrib (FIELD_City, HELPER_City.toObject (_City)); //
tl_hiring_teamPSet.setAttrib (FIELD_HasClientSupport, HELPER_HasClientSupport.toObject (_HasClientSupport)); // tl_hiring_teamPSet.setAttrib (FIELD_HasClientSupport, HELPER_HasClientSupport.toObject (_HasClientSupport)); //
tl_hiring_teamPSet.setAttrib (FIELD_HasDiversity, HELPER_HasDiversity.toObject (_HasDiversity)); //
tl_hiring_teamPSet.setAttrib (FIELD_ManageOwnBilling, HELPER_ManageOwnBilling.toObject (_ManageOwnBilling)); // tl_hiring_teamPSet.setAttrib (FIELD_ManageOwnBilling, HELPER_ManageOwnBilling.toObject (_ManageOwnBilling)); //
tl_hiring_teamPSet.setAttrib (FIELD_StripeReference, HELPER_StripeReference.toObject (_StripeReference)); // tl_hiring_teamPSet.setAttrib (FIELD_StripeReference, HELPER_StripeReference.toObject (_StripeReference)); //
tl_hiring_teamPSet.setAttrib (FIELD_StripeSubscription, HELPER_StripeSubscription.toObject (_StripeSubscription)); // tl_hiring_teamPSet.setAttrib (FIELD_StripeSubscription, HELPER_StripeSubscription.toObject (_StripeSubscription)); //
...@@ -6051,6 +6319,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -6051,6 +6319,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
_PostCode = (String)(HELPER_PostCode.fromObject (_PostCode, tl_hiring_teamPSet.getAttrib (FIELD_PostCode))); // _PostCode = (String)(HELPER_PostCode.fromObject (_PostCode, tl_hiring_teamPSet.getAttrib (FIELD_PostCode))); //
_City = (String)(HELPER_City.fromObject (_City, tl_hiring_teamPSet.getAttrib (FIELD_City))); // _City = (String)(HELPER_City.fromObject (_City, tl_hiring_teamPSet.getAttrib (FIELD_City))); //
_HasClientSupport = (Boolean)(HELPER_HasClientSupport.fromObject (_HasClientSupport, tl_hiring_teamPSet.getAttrib (FIELD_HasClientSupport))); // _HasClientSupport = (Boolean)(HELPER_HasClientSupport.fromObject (_HasClientSupport, tl_hiring_teamPSet.getAttrib (FIELD_HasClientSupport))); //
_HasDiversity = (Boolean)(HELPER_HasDiversity.fromObject (_HasDiversity, tl_hiring_teamPSet.getAttrib (FIELD_HasDiversity))); //
_ManageOwnBilling = (Boolean)(HELPER_ManageOwnBilling.fromObject (_ManageOwnBilling, tl_hiring_teamPSet.getAttrib (FIELD_ManageOwnBilling))); // _ManageOwnBilling = (Boolean)(HELPER_ManageOwnBilling.fromObject (_ManageOwnBilling, tl_hiring_teamPSet.getAttrib (FIELD_ManageOwnBilling))); //
_StripeReference = (String)(HELPER_StripeReference.fromObject (_StripeReference, tl_hiring_teamPSet.getAttrib (FIELD_StripeReference))); // _StripeReference = (String)(HELPER_StripeReference.fromObject (_StripeReference, tl_hiring_teamPSet.getAttrib (FIELD_StripeReference))); //
_StripeSubscription = (String)(HELPER_StripeSubscription.fromObject (_StripeSubscription, tl_hiring_teamPSet.getAttrib (FIELD_StripeSubscription))); // _StripeSubscription = (String)(HELPER_StripeSubscription.fromObject (_StripeSubscription, tl_hiring_teamPSet.getAttrib (FIELD_StripeSubscription))); //
...@@ -6185,6 +6454,15 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -6185,6 +6454,15 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
try try
{ {
setHasDiversity (otherHiringTeam.getHasDiversity ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setManageOwnBilling (otherHiringTeam.getManageOwnBilling ()); setManageOwnBilling (otherHiringTeam.getManageOwnBilling ());
} }
catch (FieldException ex) catch (FieldException ex)
...@@ -6406,6 +6684,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -6406,6 +6684,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
_PostCode = sourceHiringTeam._PostCode; _PostCode = sourceHiringTeam._PostCode;
_City = sourceHiringTeam._City; _City = sourceHiringTeam._City;
_HasClientSupport = sourceHiringTeam._HasClientSupport; _HasClientSupport = sourceHiringTeam._HasClientSupport;
_HasDiversity = sourceHiringTeam._HasDiversity;
_ManageOwnBilling = sourceHiringTeam._ManageOwnBilling; _ManageOwnBilling = sourceHiringTeam._ManageOwnBilling;
_StripeReference = sourceHiringTeam._StripeReference; _StripeReference = sourceHiringTeam._StripeReference;
_StripeSubscription = sourceHiringTeam._StripeSubscription; _StripeSubscription = sourceHiringTeam._StripeSubscription;
...@@ -6472,6 +6751,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -6472,6 +6751,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
_Users.copyFrom (sourceHiringTeam._Users, linkToGhosts); _Users.copyFrom (sourceHiringTeam._Users, linkToGhosts);
_Clients.copyFrom (sourceHiringTeam._Clients, linkToGhosts); _Clients.copyFrom (sourceHiringTeam._Clients, linkToGhosts);
_BillingTeams.copyFrom (sourceHiringTeam._BillingTeams, linkToGhosts); _BillingTeams.copyFrom (sourceHiringTeam._BillingTeams, linkToGhosts);
_DiversityQuestions.copyFrom (sourceHiringTeam._DiversityQuestions, linkToGhosts);
} }
} }
...@@ -6506,6 +6786,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -6506,6 +6786,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
_PostCode = (String)(HELPER_PostCode.readExternal (_PostCode, vals.get(FIELD_PostCode))); // _PostCode = (String)(HELPER_PostCode.readExternal (_PostCode, vals.get(FIELD_PostCode))); //
_City = (String)(HELPER_City.readExternal (_City, vals.get(FIELD_City))); // _City = (String)(HELPER_City.readExternal (_City, vals.get(FIELD_City))); //
_HasClientSupport = (Boolean)(HELPER_HasClientSupport.readExternal (_HasClientSupport, vals.get(FIELD_HasClientSupport))); // _HasClientSupport = (Boolean)(HELPER_HasClientSupport.readExternal (_HasClientSupport, vals.get(FIELD_HasClientSupport))); //
_HasDiversity = (Boolean)(HELPER_HasDiversity.readExternal (_HasDiversity, vals.get(FIELD_HasDiversity))); //
_ManageOwnBilling = (Boolean)(HELPER_ManageOwnBilling.readExternal (_ManageOwnBilling, vals.get(FIELD_ManageOwnBilling))); // _ManageOwnBilling = (Boolean)(HELPER_ManageOwnBilling.readExternal (_ManageOwnBilling, vals.get(FIELD_ManageOwnBilling))); //
_StripeReference = (String)(HELPER_StripeReference.readExternal (_StripeReference, vals.get(FIELD_StripeReference))); // _StripeReference = (String)(HELPER_StripeReference.readExternal (_StripeReference, vals.get(FIELD_StripeReference))); //
_StripeSubscription = (String)(HELPER_StripeSubscription.readExternal (_StripeSubscription, vals.get(FIELD_StripeSubscription))); // _StripeSubscription = (String)(HELPER_StripeSubscription.readExternal (_StripeSubscription, vals.get(FIELD_StripeSubscription))); //
...@@ -6540,6 +6821,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -6540,6 +6821,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
_Users.readExternalData(vals.get(MULTIPLEREFERENCE_Users)); _Users.readExternalData(vals.get(MULTIPLEREFERENCE_Users));
_Clients.readExternalData(vals.get(MULTIPLEREFERENCE_Clients)); _Clients.readExternalData(vals.get(MULTIPLEREFERENCE_Clients));
_BillingTeams.readExternalData(vals.get(MULTIPLEREFERENCE_BillingTeams)); _BillingTeams.readExternalData(vals.get(MULTIPLEREFERENCE_BillingTeams));
_DiversityQuestions.readExternalData(vals.get(MULTIPLEREFERENCE_DiversityQuestions));
} }
...@@ -6561,6 +6843,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -6561,6 +6843,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
vals.put (FIELD_PostCode, HELPER_PostCode.writeExternal (_PostCode)); vals.put (FIELD_PostCode, HELPER_PostCode.writeExternal (_PostCode));
vals.put (FIELD_City, HELPER_City.writeExternal (_City)); vals.put (FIELD_City, HELPER_City.writeExternal (_City));
vals.put (FIELD_HasClientSupport, HELPER_HasClientSupport.writeExternal (_HasClientSupport)); vals.put (FIELD_HasClientSupport, HELPER_HasClientSupport.writeExternal (_HasClientSupport));
vals.put (FIELD_HasDiversity, HELPER_HasDiversity.writeExternal (_HasDiversity));
vals.put (FIELD_ManageOwnBilling, HELPER_ManageOwnBilling.writeExternal (_ManageOwnBilling)); vals.put (FIELD_ManageOwnBilling, HELPER_ManageOwnBilling.writeExternal (_ManageOwnBilling));
vals.put (FIELD_StripeReference, HELPER_StripeReference.writeExternal (_StripeReference)); vals.put (FIELD_StripeReference, HELPER_StripeReference.writeExternal (_StripeReference));
vals.put (FIELD_StripeSubscription, HELPER_StripeSubscription.writeExternal (_StripeSubscription)); vals.put (FIELD_StripeSubscription, HELPER_StripeSubscription.writeExternal (_StripeSubscription));
...@@ -6595,6 +6878,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -6595,6 +6878,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
vals.put (MULTIPLEREFERENCE_Users, _Users.writeExternalData()); vals.put (MULTIPLEREFERENCE_Users, _Users.writeExternalData());
vals.put (MULTIPLEREFERENCE_Clients, _Clients.writeExternalData()); vals.put (MULTIPLEREFERENCE_Clients, _Clients.writeExternalData());
vals.put (MULTIPLEREFERENCE_BillingTeams, _BillingTeams.writeExternalData()); vals.put (MULTIPLEREFERENCE_BillingTeams, _BillingTeams.writeExternalData());
vals.put (MULTIPLEREFERENCE_DiversityQuestions, _DiversityQuestions.writeExternalData());
} }
...@@ -6648,6 +6932,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -6648,6 +6932,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{ {
listener.notifyFieldChange(this, other, FIELD_HasClientSupport, HELPER_HasClientSupport.toObject(this._HasClientSupport), HELPER_HasClientSupport.toObject(otherHiringTeam._HasClientSupport)); listener.notifyFieldChange(this, other, FIELD_HasClientSupport, HELPER_HasClientSupport.toObject(this._HasClientSupport), HELPER_HasClientSupport.toObject(otherHiringTeam._HasClientSupport));
} }
if (!HELPER_HasDiversity.compare(this._HasDiversity, otherHiringTeam._HasDiversity))
{
listener.notifyFieldChange(this, other, FIELD_HasDiversity, HELPER_HasDiversity.toObject(this._HasDiversity), HELPER_HasDiversity.toObject(otherHiringTeam._HasDiversity));
}
if (!HELPER_ManageOwnBilling.compare(this._ManageOwnBilling, otherHiringTeam._ManageOwnBilling)) if (!HELPER_ManageOwnBilling.compare(this._ManageOwnBilling, otherHiringTeam._ManageOwnBilling))
{ {
listener.notifyFieldChange(this, other, FIELD_ManageOwnBilling, HELPER_ManageOwnBilling.toObject(this._ManageOwnBilling), HELPER_ManageOwnBilling.toObject(otherHiringTeam._ManageOwnBilling)); listener.notifyFieldChange(this, other, FIELD_ManageOwnBilling, HELPER_ManageOwnBilling.toObject(this._ManageOwnBilling), HELPER_ManageOwnBilling.toObject(otherHiringTeam._ManageOwnBilling));
...@@ -6749,6 +7037,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -6749,6 +7037,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
_Users.compare (otherHiringTeam._Users, listener); _Users.compare (otherHiringTeam._Users, listener);
_Clients.compare (otherHiringTeam._Clients, listener); _Clients.compare (otherHiringTeam._Clients, listener);
_BillingTeams.compare (otherHiringTeam._BillingTeams, listener); _BillingTeams.compare (otherHiringTeam._BillingTeams, listener);
_DiversityQuestions.compare (otherHiringTeam._DiversityQuestions, listener);
} }
} }
...@@ -6780,6 +7069,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -6780,6 +7069,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
visitor.visitField(this, FIELD_PostCode, HELPER_PostCode.toObject(getPostCode())); visitor.visitField(this, FIELD_PostCode, HELPER_PostCode.toObject(getPostCode()));
visitor.visitField(this, FIELD_City, HELPER_City.toObject(getCity())); visitor.visitField(this, FIELD_City, HELPER_City.toObject(getCity()));
visitor.visitField(this, FIELD_HasClientSupport, HELPER_HasClientSupport.toObject(getHasClientSupport())); visitor.visitField(this, FIELD_HasClientSupport, HELPER_HasClientSupport.toObject(getHasClientSupport()));
visitor.visitField(this, FIELD_HasDiversity, HELPER_HasDiversity.toObject(getHasDiversity()));
visitor.visitField(this, FIELD_ManageOwnBilling, HELPER_ManageOwnBilling.toObject(getManageOwnBilling())); visitor.visitField(this, FIELD_ManageOwnBilling, HELPER_ManageOwnBilling.toObject(getManageOwnBilling()));
visitor.visitField(this, FIELD_StripeReference, HELPER_StripeReference.toObject(getStripeReference())); visitor.visitField(this, FIELD_StripeReference, HELPER_StripeReference.toObject(getStripeReference()));
visitor.visitField(this, FIELD_StripeSubscription, HELPER_StripeSubscription.toObject(getStripeSubscription())); visitor.visitField(this, FIELD_StripeSubscription, HELPER_StripeSubscription.toObject(getStripeSubscription()));
...@@ -6810,6 +7100,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -6810,6 +7100,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
visitor.visitAssociation (_Users); visitor.visitAssociation (_Users);
visitor.visitAssociation (_Clients); visitor.visitAssociation (_Clients);
visitor.visitAssociation (_BillingTeams); visitor.visitAssociation (_BillingTeams);
visitor.visitAssociation (_DiversityQuestions);
} }
...@@ -6850,6 +7141,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -6850,6 +7141,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{ {
visitor.visit (_BillingTeams); visitor.visit (_BillingTeams);
} }
if (scope.includes (_DiversityQuestions))
{
visitor.visit (_DiversityQuestions);
}
} }
...@@ -6915,6 +7210,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -6915,6 +7210,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{ {
return filter.matches (getHasClientSupport ()); return filter.matches (getHasClientSupport ());
} }
else if (attribName.equals (FIELD_HasDiversity))
{
return filter.matches (getHasDiversity ());
}
else if (attribName.equals (FIELD_ManageOwnBilling)) else if (attribName.equals (FIELD_ManageOwnBilling))
{ {
return filter.matches (getManageOwnBilling ()); return filter.matches (getManageOwnBilling ());
...@@ -7114,6 +7413,12 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -7114,6 +7413,12 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
return this; return this;
} }
public SearchAll andHasDiversity (QueryFilter<Boolean> filter)
{
filter.addFilter (context, "tl_hiring_team.has_diversity", "HasDiversity");
return this;
}
public SearchAll andManageOwnBilling (QueryFilter<Boolean> filter) public SearchAll andManageOwnBilling (QueryFilter<Boolean> filter)
{ {
filter.addFilter (context, "tl_hiring_team.manage_own_billing", "ManageOwnBilling"); filter.addFilter (context, "tl_hiring_team.manage_own_billing", "ManageOwnBilling");
...@@ -7387,6 +7692,12 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -7387,6 +7692,12 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
return this; return this;
} }
public SearchBillingTeams andHasDiversity (QueryFilter<Boolean> filter)
{
filter.addFilter (context, "tl_hiring_team.has_diversity", "HasDiversity");
return this;
}
public SearchBillingTeams andManageOwnBilling (QueryFilter<Boolean> filter) public SearchBillingTeams andManageOwnBilling (QueryFilter<Boolean> filter)
{ {
filter.addFilter (context, "tl_hiring_team.manage_own_billing", "ManageOwnBilling"); filter.addFilter (context, "tl_hiring_team.manage_own_billing", "ManageOwnBilling");
...@@ -7624,6 +7935,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -7624,6 +7935,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{ {
return HELPER_HasClientSupport.toObject (getHasClientSupport ()); return HELPER_HasClientSupport.toObject (getHasClientSupport ());
} }
else if (attribName.equals (FIELD_HasDiversity))
{
return HELPER_HasDiversity.toObject (getHasDiversity ());
}
else if (attribName.equals (FIELD_ManageOwnBilling)) else if (attribName.equals (FIELD_ManageOwnBilling))
{ {
return HELPER_ManageOwnBilling.toObject (getManageOwnBilling ()); return HELPER_ManageOwnBilling.toObject (getManageOwnBilling ());
...@@ -7781,6 +8096,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -7781,6 +8096,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{ {
return HELPER_HasClientSupport; return HELPER_HasClientSupport;
} }
else if (attribName.equals (FIELD_HasDiversity))
{
return HELPER_HasDiversity;
}
else if (attribName.equals (FIELD_ManageOwnBilling)) else if (attribName.equals (FIELD_ManageOwnBilling))
{ {
return HELPER_ManageOwnBilling; return HELPER_ManageOwnBilling;
...@@ -7938,6 +8257,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -7938,6 +8257,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{ {
setHasClientSupport ((Boolean)(HELPER_HasClientSupport.fromObject (_HasClientSupport, attribValue))); setHasClientSupport ((Boolean)(HELPER_HasClientSupport.fromObject (_HasClientSupport, attribValue)));
} }
else if (attribName.equals (FIELD_HasDiversity))
{
setHasDiversity ((Boolean)(HELPER_HasDiversity.fromObject (_HasDiversity, attribValue)));
}
else if (attribName.equals (FIELD_ManageOwnBilling)) else if (attribName.equals (FIELD_ManageOwnBilling))
{ {
setManageOwnBilling ((Boolean)(HELPER_ManageOwnBilling.fromObject (_ManageOwnBilling, attribValue))); setManageOwnBilling ((Boolean)(HELPER_ManageOwnBilling.fromObject (_ManageOwnBilling, attribValue)));
...@@ -8102,6 +8425,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -8102,6 +8425,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{ {
return getWriteability_HasClientSupport (); return getWriteability_HasClientSupport ();
} }
else if (fieldName.equals (FIELD_HasDiversity))
{
return getWriteability_HasDiversity ();
}
else if (fieldName.equals (FIELD_ManageOwnBilling)) else if (fieldName.equals (FIELD_ManageOwnBilling))
{ {
return getWriteability_ManageOwnBilling (); return getWriteability_ManageOwnBilling ();
...@@ -8202,6 +8529,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -8202,6 +8529,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{ {
return getWriteability_BillingTeams (); return getWriteability_BillingTeams ();
} }
else if (fieldName.equals (MULTIPLEREFERENCE_DiversityQuestions))
{
return getWriteability_DiversityQuestions ();
}
else if (fieldName.equals (SINGLEREFERENCE_Company)) else if (fieldName.equals (SINGLEREFERENCE_Company))
{ {
return getWriteability_Company (); return getWriteability_Company ();
...@@ -8298,6 +8629,11 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -8298,6 +8629,11 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
fields.add (FIELD_HasClientSupport); fields.add (FIELD_HasClientSupport);
} }
if (getWriteability_HasDiversity () != FieldWriteability.TRUE)
{
fields.add (FIELD_HasDiversity);
}
if (getWriteability_ManageOwnBilling () != FieldWriteability.TRUE) if (getWriteability_ManageOwnBilling () != FieldWriteability.TRUE)
{ {
fields.add (FIELD_ManageOwnBilling); fields.add (FIELD_ManageOwnBilling);
...@@ -8447,6 +8783,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -8447,6 +8783,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
result.add(HELPER_PostCode.getAttribObject (getClass (), _PostCode, false, FIELD_PostCode)); result.add(HELPER_PostCode.getAttribObject (getClass (), _PostCode, false, FIELD_PostCode));
result.add(HELPER_City.getAttribObject (getClass (), _City, false, FIELD_City)); result.add(HELPER_City.getAttribObject (getClass (), _City, false, FIELD_City));
result.add(HELPER_HasClientSupport.getAttribObject (getClass (), _HasClientSupport, false, FIELD_HasClientSupport)); result.add(HELPER_HasClientSupport.getAttribObject (getClass (), _HasClientSupport, false, FIELD_HasClientSupport));
result.add(HELPER_HasDiversity.getAttribObject (getClass (), _HasDiversity, false, FIELD_HasDiversity));
result.add(HELPER_ManageOwnBilling.getAttribObject (getClass (), _ManageOwnBilling, false, FIELD_ManageOwnBilling)); result.add(HELPER_ManageOwnBilling.getAttribObject (getClass (), _ManageOwnBilling, false, FIELD_ManageOwnBilling));
result.add(HELPER_StripeReference.getAttribObject (getClass (), _StripeReference, false, FIELD_StripeReference)); result.add(HELPER_StripeReference.getAttribObject (getClass (), _StripeReference, false, FIELD_StripeReference));
result.add(HELPER_StripeSubscription.getAttribObject (getClass (), _StripeSubscription, false, FIELD_StripeSubscription)); result.add(HELPER_StripeSubscription.getAttribObject (getClass (), _StripeSubscription, false, FIELD_StripeSubscription));
...@@ -8722,6 +9059,24 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -8722,6 +9059,24 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
} }
/** /**
* Get the attribute HasDiversity
*/
public Boolean getHasDiversity (HiringTeam obj, Boolean original)
{
return original;
}
/**
* Change the value set for attribute HasDiversity.
* May modify the field beforehand
* Occurs before validation.
*/
public Boolean setHasDiversity (HiringTeam obj, Boolean newHasDiversity) throws FieldException
{
return newHasDiversity;
}
/**
* Get the attribute ManageOwnBilling * Get the attribute ManageOwnBilling
*/ */
public Boolean getManageOwnBilling (HiringTeam obj, Boolean original) public Boolean getManageOwnBilling (HiringTeam obj, Boolean original)
...@@ -9253,6 +9608,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -9253,6 +9608,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{ {
return toBillingTeams (); return toBillingTeams ();
} }
if (name.equals ("DiversityQuestions"))
{
return toDiversityQuestions ();
}
if (name.equals ("IsLogoDeleted")) if (name.equals ("IsLogoDeleted"))
{ {
return toIsLogoDeleted (); return toIsLogoDeleted ();
...@@ -9309,6 +9668,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -9309,6 +9668,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{ {
return toHasClientSupport (); return toHasClientSupport ();
} }
if (name.equals ("HasDiversity"))
{
return toHasDiversity ();
}
if (name.equals ("ManageOwnBilling")) if (name.equals ("ManageOwnBilling"))
{ {
return toManageOwnBilling (); return toManageOwnBilling ();
...@@ -9451,6 +9814,8 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -9451,6 +9814,8 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
public PipeLine<From, Boolean> toHasClientSupport () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_HasClientSupport)); } public PipeLine<From, Boolean> toHasClientSupport () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_HasClientSupport)); }
public PipeLine<From, Boolean> toHasDiversity () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_HasDiversity)); }
public PipeLine<From, Boolean> toManageOwnBilling () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_ManageOwnBilling)); } public PipeLine<From, Boolean> toManageOwnBilling () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_ManageOwnBilling)); }
public PipeLine<From, String> toStripeReference () { return pipe(new ORMAttributePipe<Me, String>(FIELD_StripeReference)); } public PipeLine<From, String> toStripeReference () { return pipe(new ORMAttributePipe<Me, String>(FIELD_StripeReference)); }
...@@ -9542,6 +9907,12 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -9542,6 +9907,12 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{ {
return HiringTeam.REFERENCE_HiringTeam.new HiringTeamPipeLineFactory<From, HiringTeam> (this, new ORMMultiAssocPipe<Me, HiringTeam>(MULTIPLEREFERENCE_BillingTeams, filter)); return HiringTeam.REFERENCE_HiringTeam.new HiringTeamPipeLineFactory<From, HiringTeam> (this, new ORMMultiAssocPipe<Me, HiringTeam>(MULTIPLEREFERENCE_BillingTeams, filter));
} }
public HTDiversityQuestion.HTDiversityQuestionPipeLineFactory<From, HTDiversityQuestion> toDiversityQuestions () { return toDiversityQuestions(Filter.ALL); }
public HTDiversityQuestion.HTDiversityQuestionPipeLineFactory<From, HTDiversityQuestion> toDiversityQuestions (Filter<HTDiversityQuestion> filter)
{
return HTDiversityQuestion.REFERENCE_HTDiversityQuestion.new HTDiversityQuestionPipeLineFactory<From, HTDiversityQuestion> (this, new ORMMultiAssocPipe<Me, HTDiversityQuestion>(MULTIPLEREFERENCE_DiversityQuestions, filter));
}
} }
...@@ -9714,6 +10085,23 @@ class DummyHiringTeam extends HiringTeam ...@@ -9714,6 +10085,23 @@ class DummyHiringTeam extends HiringTeam
return new TreeSet(); return new TreeSet();
} }
public int getDiversityQuestionsCount () throws StorageException
{
return 0;
}
public HTDiversityQuestion getDiversityQuestionsAt (int index) throws StorageException
{
throw new RuntimeException ("No elements in a dummy object in association DiversityQuestions");
}
public SortedSet getDiversityQuestionsSet () throws StorageException
{
return new TreeSet();
}
} }
...@@ -68,6 +68,7 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -68,6 +68,7 @@ public abstract class BaseJob extends BaseBusinessClass
public static final String FIELD_CultureStatement = "CultureStatement"; public static final String FIELD_CultureStatement = "CultureStatement";
public static final String FIELD_DraftLocation = "DraftLocation"; public static final String FIELD_DraftLocation = "DraftLocation";
public static final String FIELD_GoogleAddressText = "GoogleAddressText"; public static final String FIELD_GoogleAddressText = "GoogleAddressText";
public static final String FIELD_DiversityIncluded = "DiversityIncluded";
public static final String FIELD_Email = "Email"; public static final String FIELD_Email = "Email";
public static final String FIELD_Password = "Password"; public static final String FIELD_Password = "Password";
public static final String FIELD_ConfirmPassword = "ConfirmPassword"; public static final String FIELD_ConfirmPassword = "ConfirmPassword";
...@@ -139,6 +140,7 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -139,6 +140,7 @@ public abstract class BaseJob extends BaseBusinessClass
private static final DefaultAttributeHelper<Job> HELPER_CultureStatement = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper<Job> HELPER_CultureStatement = DefaultAttributeHelper.INSTANCE;
private static final EnumeratedAttributeHelper<Job, DraftLocation> HELPER_DraftLocation = new EnumeratedAttributeHelper<Job, DraftLocation> (DraftLocation.FACTORY_DraftLocation); private static final EnumeratedAttributeHelper<Job, DraftLocation> HELPER_DraftLocation = new EnumeratedAttributeHelper<Job, DraftLocation> (DraftLocation.FACTORY_DraftLocation);
private static final DefaultAttributeHelper<Job> HELPER_GoogleAddressText = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper<Job> HELPER_GoogleAddressText = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Job> HELPER_DiversityIncluded = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Job> HELPER_Email = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper<Job> HELPER_Email = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Job> HELPER_Password = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper<Job> HELPER_Password = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Job> HELPER_ConfirmPassword = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper<Job> HELPER_ConfirmPassword = DefaultAttributeHelper.INSTANCE;
...@@ -183,6 +185,7 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -183,6 +185,7 @@ public abstract class BaseJob extends BaseBusinessClass
private String _CultureStatement; private String _CultureStatement;
private DraftLocation _DraftLocation; private DraftLocation _DraftLocation;
private String _GoogleAddressText; private String _GoogleAddressText;
private Boolean _DiversityIncluded;
private String _Email; private String _Email;
private String _Password; private String _Password;
private String _ConfirmPassword; private String _ConfirmPassword;
...@@ -267,6 +270,7 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -267,6 +270,7 @@ public abstract class BaseJob extends BaseBusinessClass
private static final AttributeValidator[] FIELD_CultureStatement_Validators; private static final AttributeValidator[] FIELD_CultureStatement_Validators;
private static final AttributeValidator[] FIELD_DraftLocation_Validators; private static final AttributeValidator[] FIELD_DraftLocation_Validators;
private static final AttributeValidator[] FIELD_GoogleAddressText_Validators; private static final AttributeValidator[] FIELD_GoogleAddressText_Validators;
private static final AttributeValidator[] FIELD_DiversityIncluded_Validators;
// Arrays of behaviour decorators // Arrays of behaviour decorators
...@@ -342,6 +346,7 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -342,6 +346,7 @@ public abstract class BaseJob extends BaseBusinessClass
FIELD_CultureStatement_Validators = (AttributeValidator[])setupAttribMetaData_CultureStatement(validatorMapping).toArray (new AttributeValidator[0]); FIELD_CultureStatement_Validators = (AttributeValidator[])setupAttribMetaData_CultureStatement(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_DraftLocation_Validators = (AttributeValidator[])setupAttribMetaData_DraftLocation(validatorMapping).toArray (new AttributeValidator[0]); FIELD_DraftLocation_Validators = (AttributeValidator[])setupAttribMetaData_DraftLocation(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_GoogleAddressText_Validators = (AttributeValidator[])setupAttribMetaData_GoogleAddressText(validatorMapping).toArray (new AttributeValidator[0]); FIELD_GoogleAddressText_Validators = (AttributeValidator[])setupAttribMetaData_GoogleAddressText(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_DiversityIncluded_Validators = (AttributeValidator[])setupAttribMetaData_DiversityIncluded(validatorMapping).toArray (new AttributeValidator[0]);
REFERENCE_Job.initialiseReference (); REFERENCE_Job.initialiseReference ();
...@@ -1350,6 +1355,25 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -1350,6 +1355,25 @@ public abstract class BaseJob extends BaseBusinessClass
return validators; return validators;
} }
// Meta Info setup
private static List setupAttribMetaData_DiversityIncluded(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "diversity_included");
metaInfo.put ("defaultValue", "Boolean.FALSE");
metaInfo.put ("name", "DiversityIncluded");
metaInfo.put ("type", "Boolean");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Job.DiversityIncluded:", metaInfo);
ATTRIBUTES_METADATA_Job.put (FIELD_DiversityIncluded, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(Job.class, "DiversityIncluded", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for Job.DiversityIncluded:", validators);
return validators;
}
// END OF STATIC METADATA DEFINITION // END OF STATIC METADATA DEFINITION
...@@ -1403,6 +1427,7 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -1403,6 +1427,7 @@ public abstract class BaseJob extends BaseBusinessClass
_CultureStatement = (String)(HELPER_CultureStatement.initialise (_CultureStatement)); _CultureStatement = (String)(HELPER_CultureStatement.initialise (_CultureStatement));
_DraftLocation = (DraftLocation)(HELPER_DraftLocation.initialise (_DraftLocation)); _DraftLocation = (DraftLocation)(HELPER_DraftLocation.initialise (_DraftLocation));
_GoogleAddressText = (String)(HELPER_GoogleAddressText.initialise (_GoogleAddressText)); _GoogleAddressText = (String)(HELPER_GoogleAddressText.initialise (_GoogleAddressText));
_DiversityIncluded = (Boolean)(Boolean.FALSE);
_Email = (String)(HELPER_Email.initialise (_Email)); _Email = (String)(HELPER_Email.initialise (_Email));
_Password = (String)(HELPER_Password.initialise (_Password)); _Password = (String)(HELPER_Password.initialise (_Password));
_ConfirmPassword = (String)(HELPER_ConfirmPassword.initialise (_ConfirmPassword)); _ConfirmPassword = (String)(HELPER_ConfirmPassword.initialise (_ConfirmPassword));
...@@ -4033,6 +4058,104 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -4033,6 +4058,104 @@ public abstract class BaseJob extends BaseBusinessClass
} }
/** /**
* Get the attribute DiversityIncluded
*/
public Boolean getDiversityIncluded ()
{
assertValid();
Boolean valToReturn = _DiversityIncluded;
for (JobBehaviourDecorator bhd : Job_BehaviourDecorators)
{
valToReturn = bhd.getDiversityIncluded ((Job)this, valToReturn);
}
return valToReturn;
}
/**
* Called prior to the attribute changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preDiversityIncludedChange (Boolean newDiversityIncluded) throws FieldException
{
}
/**
* Called after the attribute changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postDiversityIncludedChange () throws FieldException
{
}
public FieldWriteability getWriteability_DiversityIncluded ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute DiversityIncluded. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setDiversityIncluded (Boolean newDiversityIncluded) throws FieldException
{
boolean oldAndNewIdentical = HELPER_DiversityIncluded.compare (_DiversityIncluded, newDiversityIncluded);
try
{
for (JobBehaviourDecorator bhd : Job_BehaviourDecorators)
{
newDiversityIncluded = bhd.setDiversityIncluded ((Job)this, newDiversityIncluded);
oldAndNewIdentical = HELPER_DiversityIncluded.compare (_DiversityIncluded, newDiversityIncluded);
}
if (FIELD_DiversityIncluded_Validators.length > 0)
{
Object newDiversityIncludedObj = HELPER_DiversityIncluded.toObject (newDiversityIncluded);
if (newDiversityIncludedObj != null)
{
int loopMax = FIELD_DiversityIncluded_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_Job.get (FIELD_DiversityIncluded);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_DiversityIncluded_Validators[v].checkAttribute (this, FIELD_DiversityIncluded, metadata, newDiversityIncludedObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_DiversityIncluded () != FieldWriteability.FALSE, "Field DiversityIncluded is not writeable");
preDiversityIncludedChange (newDiversityIncluded);
markFieldChange (FIELD_DiversityIncluded);
_DiversityIncluded = newDiversityIncluded;
postFieldChange (FIELD_DiversityIncluded);
postDiversityIncludedChange ();
}
}
/**
* Get the attribute Email * Get the attribute Email
*/ */
public String getEmail () public String getEmail ()
...@@ -7662,6 +7785,7 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -7662,6 +7785,7 @@ public abstract class BaseJob extends BaseBusinessClass
tl_jobPSet.setAttrib (FIELD_CultureStatement, HELPER_CultureStatement.toObject (_CultureStatement)); // tl_jobPSet.setAttrib (FIELD_CultureStatement, HELPER_CultureStatement.toObject (_CultureStatement)); //
tl_jobPSet.setAttrib (FIELD_DraftLocation, HELPER_DraftLocation.toObject (_DraftLocation)); // tl_jobPSet.setAttrib (FIELD_DraftLocation, HELPER_DraftLocation.toObject (_DraftLocation)); //
tl_jobPSet.setAttrib (FIELD_GoogleAddressText, HELPER_GoogleAddressText.toObject (_GoogleAddressText)); // tl_jobPSet.setAttrib (FIELD_GoogleAddressText, HELPER_GoogleAddressText.toObject (_GoogleAddressText)); //
tl_jobPSet.setAttrib (FIELD_DiversityIncluded, HELPER_DiversityIncluded.toObject (_DiversityIncluded)); //
_Level.getPersistentSets (allSets); _Level.getPersistentSets (allSets);
_Client.getPersistentSets (allSets); _Client.getPersistentSets (allSets);
_JobOwner.getPersistentSets (allSets); _JobOwner.getPersistentSets (allSets);
...@@ -7711,6 +7835,7 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -7711,6 +7835,7 @@ public abstract class BaseJob extends BaseBusinessClass
_CultureStatement = (String)(HELPER_CultureStatement.fromObject (_CultureStatement, tl_jobPSet.getAttrib (FIELD_CultureStatement))); // _CultureStatement = (String)(HELPER_CultureStatement.fromObject (_CultureStatement, tl_jobPSet.getAttrib (FIELD_CultureStatement))); //
_DraftLocation = (DraftLocation)(HELPER_DraftLocation.fromObject (_DraftLocation, tl_jobPSet.getAttrib (FIELD_DraftLocation))); // _DraftLocation = (DraftLocation)(HELPER_DraftLocation.fromObject (_DraftLocation, tl_jobPSet.getAttrib (FIELD_DraftLocation))); //
_GoogleAddressText = (String)(HELPER_GoogleAddressText.fromObject (_GoogleAddressText, tl_jobPSet.getAttrib (FIELD_GoogleAddressText))); // _GoogleAddressText = (String)(HELPER_GoogleAddressText.fromObject (_GoogleAddressText, tl_jobPSet.getAttrib (FIELD_GoogleAddressText))); //
_DiversityIncluded = (Boolean)(HELPER_DiversityIncluded.fromObject (_DiversityIncluded, tl_jobPSet.getAttrib (FIELD_DiversityIncluded))); //
_Level.setFromPersistentSets (objectID, allSets); _Level.setFromPersistentSets (objectID, allSets);
_Client.setFromPersistentSets (objectID, allSets); _Client.setFromPersistentSets (objectID, allSets);
_JobOwner.setFromPersistentSets (objectID, allSets); _JobOwner.setFromPersistentSets (objectID, allSets);
...@@ -7969,6 +8094,15 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -7969,6 +8094,15 @@ public abstract class BaseJob extends BaseBusinessClass
e.addException (ex); e.addException (ex);
} }
try
{
setDiversityIncluded (otherJob.getDiversityIncluded ());
}
catch (FieldException ex)
{
e.addException (ex);
}
} }
} }
...@@ -8010,6 +8144,7 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -8010,6 +8144,7 @@ public abstract class BaseJob extends BaseBusinessClass
_CultureStatement = sourceJob._CultureStatement; _CultureStatement = sourceJob._CultureStatement;
_DraftLocation = sourceJob._DraftLocation; _DraftLocation = sourceJob._DraftLocation;
_GoogleAddressText = sourceJob._GoogleAddressText; _GoogleAddressText = sourceJob._GoogleAddressText;
_DiversityIncluded = sourceJob._DiversityIncluded;
_Email = sourceJob._Email; _Email = sourceJob._Email;
_Password = sourceJob._Password; _Password = sourceJob._Password;
_ConfirmPassword = sourceJob._ConfirmPassword; _ConfirmPassword = sourceJob._ConfirmPassword;
...@@ -8123,6 +8258,7 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -8123,6 +8258,7 @@ public abstract class BaseJob extends BaseBusinessClass
_CultureStatement = (String)(HELPER_CultureStatement.readExternal (_CultureStatement, vals.get(FIELD_CultureStatement))); // _CultureStatement = (String)(HELPER_CultureStatement.readExternal (_CultureStatement, vals.get(FIELD_CultureStatement))); //
_DraftLocation = (DraftLocation)(HELPER_DraftLocation.readExternal (_DraftLocation, vals.get(FIELD_DraftLocation))); // _DraftLocation = (DraftLocation)(HELPER_DraftLocation.readExternal (_DraftLocation, vals.get(FIELD_DraftLocation))); //
_GoogleAddressText = (String)(HELPER_GoogleAddressText.readExternal (_GoogleAddressText, vals.get(FIELD_GoogleAddressText))); // _GoogleAddressText = (String)(HELPER_GoogleAddressText.readExternal (_GoogleAddressText, vals.get(FIELD_GoogleAddressText))); //
_DiversityIncluded = (Boolean)(HELPER_DiversityIncluded.readExternal (_DiversityIncluded, vals.get(FIELD_DiversityIncluded))); //
_Email = (String)(HELPER_Email.readExternal (_Email, vals.get(FIELD_Email))); // _Email = (String)(HELPER_Email.readExternal (_Email, vals.get(FIELD_Email))); //
_Password = (String)(HELPER_Password.readExternal (_Password, vals.get(FIELD_Password))); // _Password = (String)(HELPER_Password.readExternal (_Password, vals.get(FIELD_Password))); //
_ConfirmPassword = (String)(HELPER_ConfirmPassword.readExternal (_ConfirmPassword, vals.get(FIELD_ConfirmPassword))); // _ConfirmPassword = (String)(HELPER_ConfirmPassword.readExternal (_ConfirmPassword, vals.get(FIELD_ConfirmPassword))); //
...@@ -8191,6 +8327,7 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -8191,6 +8327,7 @@ public abstract class BaseJob extends BaseBusinessClass
vals.put (FIELD_CultureStatement, HELPER_CultureStatement.writeExternal (_CultureStatement)); vals.put (FIELD_CultureStatement, HELPER_CultureStatement.writeExternal (_CultureStatement));
vals.put (FIELD_DraftLocation, HELPER_DraftLocation.writeExternal (_DraftLocation)); vals.put (FIELD_DraftLocation, HELPER_DraftLocation.writeExternal (_DraftLocation));
vals.put (FIELD_GoogleAddressText, HELPER_GoogleAddressText.writeExternal (_GoogleAddressText)); vals.put (FIELD_GoogleAddressText, HELPER_GoogleAddressText.writeExternal (_GoogleAddressText));
vals.put (FIELD_DiversityIncluded, HELPER_DiversityIncluded.writeExternal (_DiversityIncluded));
vals.put (FIELD_Email, HELPER_Email.writeExternal (_Email)); vals.put (FIELD_Email, HELPER_Email.writeExternal (_Email));
vals.put (FIELD_Password, HELPER_Password.writeExternal (_Password)); vals.put (FIELD_Password, HELPER_Password.writeExternal (_Password));
vals.put (FIELD_ConfirmPassword, HELPER_ConfirmPassword.writeExternal (_ConfirmPassword)); vals.put (FIELD_ConfirmPassword, HELPER_ConfirmPassword.writeExternal (_ConfirmPassword));
...@@ -8339,6 +8476,10 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -8339,6 +8476,10 @@ public abstract class BaseJob extends BaseBusinessClass
{ {
listener.notifyFieldChange(this, other, FIELD_GoogleAddressText, HELPER_GoogleAddressText.toObject(this._GoogleAddressText), HELPER_GoogleAddressText.toObject(otherJob._GoogleAddressText)); listener.notifyFieldChange(this, other, FIELD_GoogleAddressText, HELPER_GoogleAddressText.toObject(this._GoogleAddressText), HELPER_GoogleAddressText.toObject(otherJob._GoogleAddressText));
} }
if (!HELPER_DiversityIncluded.compare(this._DiversityIncluded, otherJob._DiversityIncluded))
{
listener.notifyFieldChange(this, other, FIELD_DiversityIncluded, HELPER_DiversityIncluded.toObject(this._DiversityIncluded), HELPER_DiversityIncluded.toObject(otherJob._DiversityIncluded));
}
// Compare single assocs // Compare single assocs
_CultureTemplate.compare (otherJob._CultureTemplate, listener); _CultureTemplate.compare (otherJob._CultureTemplate, listener);
...@@ -8418,6 +8559,7 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -8418,6 +8559,7 @@ public abstract class BaseJob extends BaseBusinessClass
visitor.visitField(this, FIELD_CultureStatement, HELPER_CultureStatement.toObject(getCultureStatement())); visitor.visitField(this, FIELD_CultureStatement, HELPER_CultureStatement.toObject(getCultureStatement()));
visitor.visitField(this, FIELD_DraftLocation, HELPER_DraftLocation.toObject(getDraftLocation())); visitor.visitField(this, FIELD_DraftLocation, HELPER_DraftLocation.toObject(getDraftLocation()));
visitor.visitField(this, FIELD_GoogleAddressText, HELPER_GoogleAddressText.toObject(getGoogleAddressText())); visitor.visitField(this, FIELD_GoogleAddressText, HELPER_GoogleAddressText.toObject(getGoogleAddressText()));
visitor.visitField(this, FIELD_DiversityIncluded, HELPER_DiversityIncluded.toObject(getDiversityIncluded()));
visitor.visitAssociation (_CultureTemplate); visitor.visitAssociation (_CultureTemplate);
visitor.visitAssociation (_JobTemplate); visitor.visitAssociation (_JobTemplate);
visitor.visitAssociation (_AppStatusWorkFlow); visitor.visitAssociation (_AppStatusWorkFlow);
...@@ -8635,6 +8777,10 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -8635,6 +8777,10 @@ public abstract class BaseJob extends BaseBusinessClass
{ {
return filter.matches (getGoogleAddressText ()); return filter.matches (getGoogleAddressText ());
} }
else if (attribName.equals (FIELD_DiversityIncluded))
{
return filter.matches (getDiversityIncluded ());
}
else if (attribName.equals (SINGLEREFERENCE_Level)) else if (attribName.equals (SINGLEREFERENCE_Level))
{ {
return filter.matches (getLevel ()); return filter.matches (getLevel ());
...@@ -8858,6 +9004,12 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -8858,6 +9004,12 @@ public abstract class BaseJob extends BaseBusinessClass
return this; return this;
} }
public SearchAll andDiversityIncluded (QueryFilter<Boolean> filter)
{
filter.addFilter (context, "tl_job.diversity_included", "DiversityIncluded");
return this;
}
public SearchAll andLevel (QueryFilter<Level> filter) public SearchAll andLevel (QueryFilter<Level> filter)
{ {
filter.addFilter (context, "tl_job.level_id", "Level"); filter.addFilter (context, "tl_job.level_id", "Level");
...@@ -9131,6 +9283,12 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -9131,6 +9283,12 @@ public abstract class BaseJob extends BaseBusinessClass
return this; return this;
} }
public SearchJobKey andDiversityIncluded (QueryFilter<Boolean> filter)
{
filter.addFilter (context, "tl_job.diversity_included", "DiversityIncluded");
return this;
}
public SearchJobKey andLevel (QueryFilter<Level> filter) public SearchJobKey andLevel (QueryFilter<Level> filter)
{ {
filter.addFilter (context, "tl_job.level_id", "Level"); filter.addFilter (context, "tl_job.level_id", "Level");
...@@ -9398,6 +9556,12 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -9398,6 +9556,12 @@ public abstract class BaseJob extends BaseBusinessClass
return this; return this;
} }
public SearchCompany andDiversityIncluded (QueryFilter<Boolean> filter)
{
filter.addFilter (context, "tl_job.diversity_included", "DiversityIncluded");
return this;
}
public SearchCompany andLevel (QueryFilter<Level> filter) public SearchCompany andLevel (QueryFilter<Level> filter)
{ {
filter.addFilter (context, "tl_job.level_id", "Level"); filter.addFilter (context, "tl_job.level_id", "Level");
...@@ -9666,6 +9830,12 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -9666,6 +9830,12 @@ public abstract class BaseJob extends BaseBusinessClass
return this; return this;
} }
public SearchDetails andDiversityIncluded (QueryFilter<Boolean> filter)
{
filter.addFilter (context, "tl_job.diversity_included", "DiversityIncluded");
return this;
}
public SearchDetails andLevel (QueryFilter<Level> filter) public SearchDetails andLevel (QueryFilter<Level> filter)
{ {
filter.addFilter (context, "tl_job.level_id", "Level"); filter.addFilter (context, "tl_job.level_id", "Level");
...@@ -9860,6 +10030,10 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -9860,6 +10030,10 @@ public abstract class BaseJob extends BaseBusinessClass
{ {
return HELPER_GoogleAddressText.toObject (getGoogleAddressText ()); return HELPER_GoogleAddressText.toObject (getGoogleAddressText ());
} }
else if (attribName.equals (FIELD_DiversityIncluded))
{
return HELPER_DiversityIncluded.toObject (getDiversityIncluded ());
}
else if (attribName.equals (FIELD_Email)) else if (attribName.equals (FIELD_Email))
{ {
return HELPER_Email.toObject (getEmail ()); return HELPER_Email.toObject (getEmail ());
...@@ -10037,6 +10211,10 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -10037,6 +10211,10 @@ public abstract class BaseJob extends BaseBusinessClass
{ {
return HELPER_GoogleAddressText; return HELPER_GoogleAddressText;
} }
else if (attribName.equals (FIELD_DiversityIncluded))
{
return HELPER_DiversityIncluded;
}
else if (attribName.equals (FIELD_Email)) else if (attribName.equals (FIELD_Email))
{ {
return HELPER_Email; return HELPER_Email;
...@@ -10214,6 +10392,10 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -10214,6 +10392,10 @@ public abstract class BaseJob extends BaseBusinessClass
{ {
setGoogleAddressText ((String)(HELPER_GoogleAddressText.fromObject (_GoogleAddressText, attribValue))); setGoogleAddressText ((String)(HELPER_GoogleAddressText.fromObject (_GoogleAddressText, attribValue)));
} }
else if (attribName.equals (FIELD_DiversityIncluded))
{
setDiversityIncluded ((Boolean)(HELPER_DiversityIncluded.fromObject (_DiversityIncluded, attribValue)));
}
else if (attribName.equals (FIELD_Email)) else if (attribName.equals (FIELD_Email))
{ {
setEmail ((String)(HELPER_Email.fromObject (_Email, attribValue))); setEmail ((String)(HELPER_Email.fromObject (_Email, attribValue)));
...@@ -10398,6 +10580,10 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -10398,6 +10580,10 @@ public abstract class BaseJob extends BaseBusinessClass
{ {
return getWriteability_GoogleAddressText (); return getWriteability_GoogleAddressText ();
} }
else if (fieldName.equals (FIELD_DiversityIncluded))
{
return getWriteability_DiversityIncluded ();
}
else if (fieldName.equals (MULTIPLEREFERENCE_JobApplications)) else if (fieldName.equals (MULTIPLEREFERENCE_JobApplications))
{ {
return getWriteability_JobApplications (); return getWriteability_JobApplications ();
...@@ -10662,6 +10848,11 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -10662,6 +10848,11 @@ public abstract class BaseJob extends BaseBusinessClass
fields.add (FIELD_GoogleAddressText); fields.add (FIELD_GoogleAddressText);
} }
if (getWriteability_DiversityIncluded () != FieldWriteability.TRUE)
{
fields.add (FIELD_DiversityIncluded);
}
if (getWriteability_Email () != FieldWriteability.TRUE) if (getWriteability_Email () != FieldWriteability.TRUE)
{ {
fields.add (FIELD_Email); fields.add (FIELD_Email);
...@@ -10772,6 +10963,7 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -10772,6 +10963,7 @@ public abstract class BaseJob extends BaseBusinessClass
result.add(HELPER_CultureStatement.getAttribObject (getClass (), _CultureStatement, false, FIELD_CultureStatement)); result.add(HELPER_CultureStatement.getAttribObject (getClass (), _CultureStatement, false, FIELD_CultureStatement));
result.add(HELPER_DraftLocation.getAttribObject (getClass (), _DraftLocation, false, FIELD_DraftLocation)); result.add(HELPER_DraftLocation.getAttribObject (getClass (), _DraftLocation, false, FIELD_DraftLocation));
result.add(HELPER_GoogleAddressText.getAttribObject (getClass (), _GoogleAddressText, true, FIELD_GoogleAddressText)); result.add(HELPER_GoogleAddressText.getAttribObject (getClass (), _GoogleAddressText, true, FIELD_GoogleAddressText));
result.add(HELPER_DiversityIncluded.getAttribObject (getClass (), _DiversityIncluded, false, FIELD_DiversityIncluded));
result.add(HELPER_Email.getAttribObject (getClass (), _Email, false, FIELD_Email)); result.add(HELPER_Email.getAttribObject (getClass (), _Email, false, FIELD_Email));
result.add(HELPER_Password.getAttribObject (getClass (), _Password, false, FIELD_Password)); result.add(HELPER_Password.getAttribObject (getClass (), _Password, false, FIELD_Password));
result.add(HELPER_ConfirmPassword.getAttribObject (getClass (), _ConfirmPassword, false, FIELD_ConfirmPassword)); result.add(HELPER_ConfirmPassword.getAttribObject (getClass (), _ConfirmPassword, false, FIELD_ConfirmPassword));
...@@ -11306,6 +11498,24 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -11306,6 +11498,24 @@ public abstract class BaseJob extends BaseBusinessClass
} }
/** /**
* Get the attribute DiversityIncluded
*/
public Boolean getDiversityIncluded (Job obj, Boolean original)
{
return original;
}
/**
* Change the value set for attribute DiversityIncluded.
* May modify the field beforehand
* Occurs before validation.
*/
public Boolean setDiversityIncluded (Job obj, Boolean newDiversityIncluded) throws FieldException
{
return newDiversityIncluded;
}
/**
* Get the attribute Email * Get the attribute Email
*/ */
public String getEmail (Job obj, String original) public String getEmail (Job obj, String original)
...@@ -11819,6 +12029,10 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -11819,6 +12029,10 @@ public abstract class BaseJob extends BaseBusinessClass
{ {
return toGoogleAddressText (); return toGoogleAddressText ();
} }
if (name.equals ("DiversityIncluded"))
{
return toDiversityIncluded ();
}
if (name.equals ("Level")) if (name.equals ("Level"))
{ {
return toLevel (); return toLevel ();
...@@ -11942,6 +12156,8 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -11942,6 +12156,8 @@ public abstract class BaseJob extends BaseBusinessClass
public PipeLine<From, DraftLocation> toDraftLocation () { return pipe(new ORMAttributePipe<Me, DraftLocation>(FIELD_DraftLocation)); } public PipeLine<From, DraftLocation> toDraftLocation () { return pipe(new ORMAttributePipe<Me, DraftLocation>(FIELD_DraftLocation)); }
public PipeLine<From, String> toGoogleAddressText () { return pipe(new ORMAttributePipe<Me, String>(FIELD_GoogleAddressText)); } public PipeLine<From, String> toGoogleAddressText () { return pipe(new ORMAttributePipe<Me, String>(FIELD_GoogleAddressText)); }
public PipeLine<From, Boolean> toDiversityIncluded () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_DiversityIncluded)); }
public CultureCriteriaTemplate.CultureCriteriaTemplatePipeLineFactory<From, CultureCriteriaTemplate> toCultureTemplate () { return toCultureTemplate (Filter.ALL); } public CultureCriteriaTemplate.CultureCriteriaTemplatePipeLineFactory<From, CultureCriteriaTemplate> toCultureTemplate () { return toCultureTemplate (Filter.ALL); }
public CultureCriteriaTemplate.CultureCriteriaTemplatePipeLineFactory<From, CultureCriteriaTemplate> toCultureTemplate (Filter<CultureCriteriaTemplate> filter) public CultureCriteriaTemplate.CultureCriteriaTemplatePipeLineFactory<From, CultureCriteriaTemplate> toCultureTemplate (Filter<CultureCriteriaTemplate> filter)
......
...@@ -112,6 +112,20 @@ public class Candidate extends BaseCandidate ...@@ -112,6 +112,20 @@ public class Candidate extends BaseCandidate
} }
public boolean diversityCompleted(Job job)
{
Set<AnswerOption> selectedAnswers = pipelineCandidate().toDiversityAnswers().toAnswers(AnswerOption.SearchByAll().andAnswer(new IsNotNullFilter<>()).andIsSelected(new EqualsFilter<>(Boolean.TRUE))).uniqueVals();
Set<DiversityQuestion> answeredQuestions = AnswerOption.pipesAnswerOption(selectedAnswers).toCandidateAnswer().toQuestion().uniqueVals();
Set<DiversityQuestion> applicableQuestions = HTDiversityQuestion.pipesHTDiversityQuestion(job.getDiversityQuestions()).toQuestion().uniqueVals();
return answeredQuestions.containsAll(applicableQuestions);
}
public CandidateDiversityAnswer getDiversityAnswerByQuestion(DiversityQuestion question)
{
return pipelineCandidate().toDiversityAnswers(CandidateDiversityAnswer.SearchByAll().andQuestion(new EqualsFilter<>(question))).val();
}
public boolean cultureCompleted(Job job) public boolean cultureCompleted(Job job)
{ {
if(!job.showCultureCriteriaSection()) if(!job.showCultureCriteriaSection())
...@@ -235,4 +249,9 @@ public class Candidate extends BaseCandidate ...@@ -235,4 +249,9 @@ 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
...@@ -8,8 +8,9 @@ ...@@ -8,8 +8,9 @@
<MULTIPLEREFERENCE name="TestAnalysises" type="TestAnalysis" backreferenceName="Candidate" /> <MULTIPLEREFERENCE name="TestAnalysises" type="TestAnalysis" backreferenceName="Candidate" />
<MULTIPLEREFERENCE name="JobApplications" type="JobApplication" backreferenceName="Candidate" /> <MULTIPLEREFERENCE name="JobApplications" type="JobApplication" backreferenceName="Candidate" />
<MULTIPLEREFERENCE name="CultureCriteriaAnswers" type="CultureCriteriaAnswer" backreferenceName="Candidate" /> <MULTIPLEREFERENCE name="CultureCriteriaAnswers" type="CultureCriteriaAnswer" backreferenceName="Candidate" />
<MULTIPLEREFERENCE name="ProfileAssessmentAnswers" type="Answer" backreferenceName="Candidate" /> <MULTIPLEREFERENCE name="ProfileAssessmentAnswers" type="Answer" backreferenceName="Candidate" />
<MULTIPLEREFERENCE name="DiversityAnswers" type="CandidateDiversityAnswer" backreferenceName="Candidate" />
<TRANSIENT name="PrivacyPolicyAgreed" type="Boolean" defaultValue="Boolean.FALSE"/> <TRANSIENT name="PrivacyPolicyAgreed" type="Boolean" defaultValue="Boolean.FALSE"/>
<TRANSIENT name="ConditionsAgreed" type="Boolean" defaultValue="Boolean.FALSE"/> <TRANSIENT name="ConditionsAgreed" type="Boolean" defaultValue="Boolean.FALSE"/>
......
package performa.orm;
public class CandidateDiversityAnswer extends BaseCandidateDiversityAnswer
{
private static final long serialVersionUID = 0L;
// This constructor should not be called
public CandidateDiversityAnswer ()
{
// Do not add any code to this, always put it in initialiseNewObject
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='http://www.oneit.com.au/schemas/5.2/BusinessObject.xsd'>
<BUSINESSCLASS name="CandidateDiversityAnswer" package="performa.orm">
<TRANSIENTSINGLE name="AnswerOption" type="DiversityAnswer" />
<MULTIPLEREFERENCE name="Answers" type="AnswerOption" backreferenceName="CandidateAnswer" />
<TABLE name="tl_candidate_diversity_answer" tablePrefix="object" polymorphic="FALSE">
<SINGLEREFERENCE name="Question" type="DiversityQuestion" dbcol="question_id" mandatory="true" />
<SINGLEREFERENCE name="Candidate" type="Candidate" dbcol="candidate_id" mandatory="true" backreferenceName="DiversityAnswers" />
</TABLE>
<SEARCH type="All" paramFilter="tl_candidate_diversity_answer.object_id is not null" orderBy="tl_candidate_diversity_answer.object_id" />
</BUSINESSCLASS>
</ROOT>
\ No newline at end of file
package performa.orm;
import java.io.*;
import java.util.*;
import java.sql.ResultSet;
import java.sql.SQLException;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.objstore.assocs.*;
import oneit.objstore.rdbms.*;
import oneit.objstore.utils.*;
import oneit.sql.*;
import oneit.utils.resource.*;
import oneit.utils.*;
import oneit.utils.threading.*;
/**
* IMPORTANT!!!! Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2[oneit.objstore.PersistenceMgrTemplate.xsl]
*/
public class CandidateDiversityAnswerPersistenceMgr extends ObjectPersistenceMgr
{
private static final LoggingArea CandidateDiversityAnswerPersistence = LoggingArea.createLoggingArea(ObjectPersistenceMgr.OBJECT_PERSISTENCE, "CandidateDiversityAnswer");
// Private attributes corresponding to business object data
// Static constants corresponding to attribute helpers
public CandidateDiversityAnswerPersistenceMgr ()
{
}
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 = "";
public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
Set<BaseBusinessClass> resultByIDs = fetchByIDs(Collections.singleton (id), allPSets, context, sqlMgr);
if (resultByIDs.isEmpty ())
{
return null;
}
else if (resultByIDs.size () > 1)
{
throw new StorageException ("Multiple results for id:" + id);
}
else
{
return resultByIDs.iterator ().next ();
}
}
public Set<BaseBusinessClass> fetchByIDs(Set<ObjectID> ids, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
Set<BaseBusinessClass> results = new HashSet ();
Set<Long> idsToFetch = new HashSet ();
for (ObjectID id : ids)
{
if (context.containsObject(id)) // Check for cached version
{
BaseBusinessClass objectToReturn = context.getObjectToReplace(id, CandidateDiversityAnswer.REFERENCE_CandidateDiversityAnswer);
if (objectToReturn instanceof CandidateDiversityAnswer)
{
LogMgr.log (CandidateDiversityAnswerPersistence, LogLevel.TRACE, "Cache hit for id:", id);
results.add (objectToReturn);
}
else
{
throw new StorageException ("Cache collision for id:" + id + " with object " + objectToReturn + "while fetching a CandidateDiversityAnswer");
}
}
PersistentSet tl_candidate_diversity_answerPSet = allPSets.getPersistentSet(id, "tl_candidate_diversity_answer", PersistentSetStatus.FETCHED);
// Check for persistent sets already prefetched
if (false || !tl_candidate_diversity_answerPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!tl_candidate_diversity_answerPSet.containsAttrib(CandidateDiversityAnswer.SINGLEREFERENCE_Question)||
!tl_candidate_diversity_answerPSet.containsAttrib(CandidateDiversityAnswer.SINGLEREFERENCE_Candidate))
{
// We will need to retrieve it
idsToFetch.add (id.longValue());
}
else
{
LogMgr.log (CandidateDiversityAnswerPersistence, LogLevel.DEBUG2, "Persistent set preloaded id:", id);
/* Non Polymorphic */
CandidateDiversityAnswer result = new CandidateDiversityAnswer ();
result.setFromPersistentSets(id, allPSets);
context.addRetrievedObject(result);
results.add (result);
}
}
if (idsToFetch.size () > 0)
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_candidate_diversity_answer " +
"WHERE " + SELECT_JOINS + "{PREFIX}tl_candidate_diversity_answer.object_id IN ?";
BaseBusinessClass[] resultsFetched = loadQuery (allPSets, sqlMgr, context, query, new Object[] { idsToFetch }, null, false);
for (BaseBusinessClass objFetched : resultsFetched)
{
results.add (objFetched);
}
}
return results;
}
public BaseBusinessClass[] getReferencedObjects(ObjectID _objectID, String refName, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
if (false)
{
throw new RuntimeException ();
}
else if (refName.equals (CandidateDiversityAnswer.SINGLEREFERENCE_Candidate))
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_candidate_diversity_answer " +
"WHERE " + SELECT_JOINS + "candidate_id = ?";
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, new Object[] { _objectID.longID () }, null, false);
return results;
}
else
{
throw new IllegalArgumentException ("Illegal reference type:" + refName);
}
}
public void update(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, ConcurrentUpdateConflictException, StorageException
{
EqualityResult test = EqualityResult.compare (obj, obj.getBackup ());
ObjectID objectID = obj.getID ();
if (!test.areAttributesEqual () || !test.areSingleAssocsEqual () || obj.getForcedSave())
{
PersistentSet tl_candidate_diversity_answerPSet = allPSets.getPersistentSet(objectID, "tl_candidate_diversity_answer");
if (tl_candidate_diversity_answerPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_candidate_diversity_answerPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}tl_candidate_diversity_answer " +
"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 ()) + " ",
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)
{
// Error, either a concurrency error or a not-exists error
ResultSet r = executeQuery (sqlMgr,
"SELECT object_id, object_LAST_UPDATED_DATE FROM {PREFIX}tl_candidate_diversity_answer WHERE object_id = ?",
new Object[] { objectID.longID () });
if (r.next ())
{
Date d = new java.util.Date (r.getTimestamp (2).getTime());
String errorMsg = QueryBuilder.buildQueryString ("Concurrent update error:[?] for row:[?] objDate:[?] dbDate:[?]",
new Object[] { "tl_candidate_diversity_answer", objectID.longID (), obj.getObjectLastModified (), d },
sqlMgr.getPortabilityServices ());
LogMgr.log (CandidateDiversityAnswerPersistence, LogLevel.BUSINESS1, errorMsg);
throw new ConcurrentUpdateConflictException (obj, "tl_candidate_diversity_answer");
}
else
{
String errorMsg = "Attempt to update nonexistent row in table:tl_candidate_diversity_answer for row:" + objectID + " objDate:" + obj.getObjectLastModified ();
LogMgr.log (CandidateDiversityAnswerPersistence, LogLevel.BUSINESS1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
tl_candidate_diversity_answerPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
else
{
LogMgr.log (CandidateDiversityAnswerPersistence, LogLevel.DEBUG1, "Skipping update since no attribs or simple assocs changed on ", objectID);
}
}
public void delete(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, ConcurrentUpdateConflictException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet tl_candidate_diversity_answerPSet = allPSets.getPersistentSet(objectID, "tl_candidate_diversity_answer");
LogMgr.log (CandidateDiversityAnswerPersistence, LogLevel.DEBUG2, "Deleting:", objectID);
if (tl_candidate_diversity_answerPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_candidate_diversity_answerPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsDeleted = executeStatement (sqlMgr,
"DELETE " +
"FROM {PREFIX}tl_candidate_diversity_answer " +
"WHERE tl_candidate_diversity_answer.object_id = ? AND " + sqlMgr.getPortabilityServices ().getTruncatedTimestampColumn ("object_LAST_UPDATED_DATE") + " = " + sqlMgr.getPortabilityServices ().getTruncatedTimestampParam("?") + " ",
new Object[] { objectID.longID(), obj.getObjectLastModified () });
if (rowsDeleted != 1)
{
// Error, either a concurrency error or a not-exists error
ResultSet r = executeQuery (sqlMgr,
"SELECT object_id FROM {PREFIX}tl_candidate_diversity_answer WHERE object_id = ?",
new Object[] { objectID.longID() });
if (r.next ())
{
throw new ConcurrentUpdateConflictException (obj, "tl_candidate_diversity_answer");
}
else
{
String errorMsg = "Attempt to delete nonexistent row in table:tl_candidate_diversity_answer for row:" + objectID;
LogMgr.log (CandidateDiversityAnswerPersistence, LogLevel.SYSTEMERROR1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
tl_candidate_diversity_answerPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
public ResultSet executeSearchQueryAll (SQLManager sqlMgr) throws SQLException
{
throw new RuntimeException ("NOT implemented: executeSearchQueryAll");
}
public BaseBusinessClass[] loadQuery (PersistentSetCollection allPSets, SQLManager sqlMgr, RDBMSPersistenceContext context, String query, Object[] params, Integer maxRows, boolean truncateExtra) throws SQLException, StorageException
{
LinkedHashMap<ObjectID, CandidateDiversityAnswer> results = new LinkedHashMap ();
ResultSet r = executeQuery (sqlMgr, query, params);
while (r.next())
{
ThreadUtils.checkInterrupted ();
ObjectID objectID = new ObjectID (CandidateDiversityAnswer.REFERENCE_CandidateDiversityAnswer.getObjectIDSpace (), r.getLong ("id"));
CandidateDiversityAnswer resultElement;
if (maxRows != null && !results.containsKey (objectID) && results.size () >= maxRows)
{
if (truncateExtra)
{
break;
}
else
{
throw new SearchRowsExceededException ("Maximum rows exceeded:" + maxRows);
}
}
if (context.containsObject(objectID))
{
BaseBusinessClass cachedElement = context.getObjectToReplace(objectID, CandidateDiversityAnswer.REFERENCE_CandidateDiversityAnswer);
if (cachedElement instanceof CandidateDiversityAnswer)
{
LogMgr.log (CandidateDiversityAnswerPersistence, LogLevel.TRACE, "Cache hit for id:", objectID);
resultElement = (CandidateDiversityAnswer)cachedElement;
}
else
{
throw new StorageException ("Cache collision for id:" + objectID + " with object " + cachedElement + "while fetching a CandidateDiversityAnswer");
}
}
else
{
PersistentSet tl_candidate_diversity_answerPSet = allPSets.getPersistentSet(objectID, "tl_candidate_diversity_answer", PersistentSetStatus.FETCHED);
createPersistentSetFromRS(allPSets, r, objectID);
resultElement = new CandidateDiversityAnswer ();
resultElement.setFromPersistentSets(objectID, allPSets);
context.addRetrievedObject(resultElement);
}
results.put (objectID, resultElement);
}
BaseBusinessClass[] resultsArr = new BaseBusinessClass[results.size ()];
return results.values ().toArray (resultsArr);
}
public BaseBusinessClass[] find(String searchType, PersistentSetCollection allPSets, Hashtable criteria, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
LogMgr.log (CandidateDiversityAnswerPersistence, LogLevel.DEBUG2, "Search executing:", searchType, " criteria:", criteria);
String customParamFilter = (String)criteria.get (SEARCH_CustomFilter);
String customOrderBy = (String)criteria.get (SEARCH_OrderBy);
String customTables = (String)criteria.get (SEARCH_CustomExtraTables);
Boolean noCommaBeforeCustomExtraTables = (Boolean)criteria.get (SEARCH_CustomExtraTablesNoComma);
if (searchType.equals (SEARCH_CustomSQL))
{
Set<ObjectID> processedIDs = new HashSet();
SearchParamTransform tx = new SearchParamTransform (criteria);
Object[] searchParams;
customParamFilter = StringUtils.replaceParams (customParamFilter, tx);
searchParams = tx.getParamsArray();
if (customOrderBy != null)
{
customOrderBy = " ORDER BY " + customOrderBy;
}
else
{
customOrderBy = "";
}
ResultSet r;
String concatCustomTableWith = CollectionUtils.equals(noCommaBeforeCustomExtraTables, true) ? " " : ", ";
String tables = StringUtils.subBlanks(customTables) == null ? " " : concatCustomTableWith + customTables + " ";
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_candidate_diversity_answer " + tables +
"WHERE " + SELECT_JOINS + " " + customParamFilter + customOrderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, null, false);
return results;
}
else if (searchType.equals (CandidateDiversityAnswer.SEARCH_All))
{
// Local scope for transformed variables
{
}
String orderBy = " ORDER BY tl_candidate_diversity_answer.object_id";
String tables = " ";
Set<String> joinTableSet = new HashSet<String>();
String filter;
Object[] searchParams; // paramFilter: tl_candidate_diversity_answer.object_id is not null
String preFilter = "(tl_candidate_diversity_answer.object_id is not null)"
+ " ";
preFilter += context.getLoadingAttributes ().getCustomSQL() ;
SearchParamTransform tx = new SearchParamTransform (criteria);
filter = StringUtils.replaceParams (preFilter, tx);
searchParams = tx.getParamsArray();
Integer maxRows = context.getLoadingAttributes ().getMaxRows ();
boolean truncateExtra = !context.getLoadingAttributes ().isFailIfMaxExceeded();
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_candidate_diversity_answer " + tables + tableSetToSQL(joinTableSet) +
"WHERE " + SELECT_JOINS + " " + filter + orderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, maxRows, truncateExtra);
return results;
}
else
{
throw new IllegalArgumentException ("Illegal search type:" + searchType);
}
}
private void createPersistentSetFromRS(PersistentSetCollection allPSets, ResultSet r, ObjectID objectID) throws SQLException
{
PersistentSet tl_candidate_diversity_answerPSet = allPSets.getPersistentSet(objectID, "tl_candidate_diversity_answer", PersistentSetStatus.FETCHED);
// Object Modified
tl_candidate_diversity_answerPSet.setAttrib(BaseBusinessClass.FIELD_ObjectLastModified, r.getTimestamp ("LAST_UPDATED_DATE"));
// Object Created
tl_candidate_diversity_answerPSet.setAttrib(BaseBusinessClass.FIELD_ObjectCreated, r.getTimestamp ("CREATED_DATE"));
tl_candidate_diversity_answerPSet.setAttrib(CandidateDiversityAnswer.SINGLEREFERENCE_Question, r.getObject ("question_id"));
tl_candidate_diversity_answerPSet.setAttrib(CandidateDiversityAnswer.SINGLEREFERENCE_Candidate, r.getObject ("candidate_id"));
}
public void create(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet tl_candidate_diversity_answerPSet = allPSets.getPersistentSet(objectID, "tl_candidate_diversity_answer");
if (tl_candidate_diversity_answerPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_candidate_diversity_answerPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
executeStatement (sqlMgr,
"INSERT INTO {PREFIX}tl_candidate_diversity_answer " +
" ( question_id, candidate_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " +
" ( ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
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);
}
}
}
package performa.orm;
public class DiversityAnswer extends BaseDiversityAnswer
{
private static final long serialVersionUID = 0L;
// This constructor should not be called
public DiversityAnswer ()
{
// Do not add any code to this, always put it in initialiseNewObject
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='http://www.oneit.com.au/schemas/5.2/BusinessObject.xsd'>
<BUSINESSCLASS name="DiversityAnswer" package="performa.orm">
<TABLE name="tl_diversity_answer" tablePrefix="object" polymorphic="FALSE">
<ATTRIB name="Code" type="String" dbcol="answer_code" mandatory="true"/>
<ATTRIB name="Answer" type="String" dbcol="answer" mandatory="true"/>
<SINGLEREFERENCE name="Question" type="DiversityQuestion" dbcol="question_id" backreferenceName="Answers" mandatory="true"/>
</TABLE>
<SEARCH type="All" paramFilter="tl_diversity_answer.object_id is not null" orderBy="tl_diversity_answer.object_id" />
</BUSINESSCLASS>
</ROOT>
\ No newline at end of file
package performa.orm;
import java.io.*;
import java.util.*;
import java.sql.ResultSet;
import java.sql.SQLException;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.objstore.assocs.*;
import oneit.objstore.rdbms.*;
import oneit.objstore.utils.*;
import oneit.sql.*;
import oneit.utils.resource.*;
import oneit.utils.*;
import oneit.utils.threading.*;
/**
* IMPORTANT!!!! Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2[oneit.objstore.PersistenceMgrTemplate.xsl]
*/
public class DiversityAnswerPersistenceMgr extends ObjectPersistenceMgr
{
private static final LoggingArea DiversityAnswerPersistence = LoggingArea.createLoggingArea(ObjectPersistenceMgr.OBJECT_PERSISTENCE, "DiversityAnswer");
// Private attributes corresponding to business object data
private String dummyCode;
private String dummyAnswer;
// Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper HELPER_Code = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_Answer = DefaultAttributeHelper.INSTANCE;
public DiversityAnswerPersistenceMgr ()
{
dummyCode = (String)(HELPER_Code.initialise (dummyCode));
dummyAnswer = (String)(HELPER_Answer.initialise (dummyAnswer));
}
private String SELECT_COLUMNS = "{PREFIX}tl_diversity_answer.object_id as id, {PREFIX}tl_diversity_answer.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_diversity_answer.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_diversity_answer.answer_code, {PREFIX}tl_diversity_answer.answer, {PREFIX}tl_diversity_answer.question_id, 1 AS commasafe ";
private String SELECT_JOINS = "";
public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
Set<BaseBusinessClass> resultByIDs = fetchByIDs(Collections.singleton (id), allPSets, context, sqlMgr);
if (resultByIDs.isEmpty ())
{
return null;
}
else if (resultByIDs.size () > 1)
{
throw new StorageException ("Multiple results for id:" + id);
}
else
{
return resultByIDs.iterator ().next ();
}
}
public Set<BaseBusinessClass> fetchByIDs(Set<ObjectID> ids, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
Set<BaseBusinessClass> results = new HashSet ();
Set<Long> idsToFetch = new HashSet ();
for (ObjectID id : ids)
{
if (context.containsObject(id)) // Check for cached version
{
BaseBusinessClass objectToReturn = context.getObjectToReplace(id, DiversityAnswer.REFERENCE_DiversityAnswer);
if (objectToReturn instanceof DiversityAnswer)
{
LogMgr.log (DiversityAnswerPersistence, LogLevel.TRACE, "Cache hit for id:", id);
results.add (objectToReturn);
}
else
{
throw new StorageException ("Cache collision for id:" + id + " with object " + objectToReturn + "while fetching a DiversityAnswer");
}
}
PersistentSet tl_diversity_answerPSet = allPSets.getPersistentSet(id, "tl_diversity_answer", PersistentSetStatus.FETCHED);
// Check for persistent sets already prefetched
if (false || !tl_diversity_answerPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!tl_diversity_answerPSet.containsAttrib(DiversityAnswer.FIELD_Code)||
!tl_diversity_answerPSet.containsAttrib(DiversityAnswer.FIELD_Answer)||
!tl_diversity_answerPSet.containsAttrib(DiversityAnswer.SINGLEREFERENCE_Question))
{
// We will need to retrieve it
idsToFetch.add (id.longValue());
}
else
{
LogMgr.log (DiversityAnswerPersistence, LogLevel.DEBUG2, "Persistent set preloaded id:", id);
/* Non Polymorphic */
DiversityAnswer result = new DiversityAnswer ();
result.setFromPersistentSets(id, allPSets);
context.addRetrievedObject(result);
results.add (result);
}
}
if (idsToFetch.size () > 0)
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_diversity_answer " +
"WHERE " + SELECT_JOINS + "{PREFIX}tl_diversity_answer.object_id IN ?";
BaseBusinessClass[] resultsFetched = loadQuery (allPSets, sqlMgr, context, query, new Object[] { idsToFetch }, null, false);
for (BaseBusinessClass objFetched : resultsFetched)
{
results.add (objFetched);
}
}
return results;
}
public BaseBusinessClass[] getReferencedObjects(ObjectID _objectID, String refName, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
if (false)
{
throw new RuntimeException ();
}
else if (refName.equals (DiversityAnswer.SINGLEREFERENCE_Question))
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_diversity_answer " +
"WHERE " + SELECT_JOINS + "question_id = ?";
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, new Object[] { _objectID.longID () }, null, false);
return results;
}
else
{
throw new IllegalArgumentException ("Illegal reference type:" + refName);
}
}
public void update(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, ConcurrentUpdateConflictException, StorageException
{
EqualityResult test = EqualityResult.compare (obj, obj.getBackup ());
ObjectID objectID = obj.getID ();
if (!test.areAttributesEqual () || !test.areSingleAssocsEqual () || obj.getForcedSave())
{
PersistentSet tl_diversity_answerPSet = allPSets.getPersistentSet(objectID, "tl_diversity_answer");
if (tl_diversity_answerPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_diversity_answerPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}tl_diversity_answer " +
"SET answer_code = ?, answer = ?, question_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE tl_diversity_answer.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_Code.getForSQL(dummyCode, tl_diversity_answerPSet.getAttrib (DiversityAnswer.FIELD_Code))).listEntry (HELPER_Answer.getForSQL(dummyAnswer, tl_diversity_answerPSet.getAttrib (DiversityAnswer.FIELD_Answer))).listEntry (SQLManager.CheckNull((Long)(tl_diversity_answerPSet.getAttrib (DiversityAnswer.SINGLEREFERENCE_Question)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
if (rowsUpdated != 1)
{
// Error, either a concurrency error or a not-exists error
ResultSet r = executeQuery (sqlMgr,
"SELECT object_id, object_LAST_UPDATED_DATE FROM {PREFIX}tl_diversity_answer WHERE object_id = ?",
new Object[] { objectID.longID () });
if (r.next ())
{
Date d = new java.util.Date (r.getTimestamp (2).getTime());
String errorMsg = QueryBuilder.buildQueryString ("Concurrent update error:[?] for row:[?] objDate:[?] dbDate:[?]",
new Object[] { "tl_diversity_answer", objectID.longID (), obj.getObjectLastModified (), d },
sqlMgr.getPortabilityServices ());
LogMgr.log (DiversityAnswerPersistence, LogLevel.BUSINESS1, errorMsg);
throw new ConcurrentUpdateConflictException (obj, "tl_diversity_answer");
}
else
{
String errorMsg = "Attempt to update nonexistent row in table:tl_diversity_answer for row:" + objectID + " objDate:" + obj.getObjectLastModified ();
LogMgr.log (DiversityAnswerPersistence, LogLevel.BUSINESS1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
tl_diversity_answerPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
else
{
LogMgr.log (DiversityAnswerPersistence, LogLevel.DEBUG1, "Skipping update since no attribs or simple assocs changed on ", objectID);
}
}
public void delete(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, ConcurrentUpdateConflictException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet tl_diversity_answerPSet = allPSets.getPersistentSet(objectID, "tl_diversity_answer");
LogMgr.log (DiversityAnswerPersistence, LogLevel.DEBUG2, "Deleting:", objectID);
if (tl_diversity_answerPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_diversity_answerPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsDeleted = executeStatement (sqlMgr,
"DELETE " +
"FROM {PREFIX}tl_diversity_answer " +
"WHERE tl_diversity_answer.object_id = ? AND " + sqlMgr.getPortabilityServices ().getTruncatedTimestampColumn ("object_LAST_UPDATED_DATE") + " = " + sqlMgr.getPortabilityServices ().getTruncatedTimestampParam("?") + " ",
new Object[] { objectID.longID(), obj.getObjectLastModified () });
if (rowsDeleted != 1)
{
// Error, either a concurrency error or a not-exists error
ResultSet r = executeQuery (sqlMgr,
"SELECT object_id FROM {PREFIX}tl_diversity_answer WHERE object_id = ?",
new Object[] { objectID.longID() });
if (r.next ())
{
throw new ConcurrentUpdateConflictException (obj, "tl_diversity_answer");
}
else
{
String errorMsg = "Attempt to delete nonexistent row in table:tl_diversity_answer for row:" + objectID;
LogMgr.log (DiversityAnswerPersistence, LogLevel.SYSTEMERROR1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
tl_diversity_answerPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
public ResultSet executeSearchQueryAll (SQLManager sqlMgr) throws SQLException
{
throw new RuntimeException ("NOT implemented: executeSearchQueryAll");
}
public BaseBusinessClass[] loadQuery (PersistentSetCollection allPSets, SQLManager sqlMgr, RDBMSPersistenceContext context, String query, Object[] params, Integer maxRows, boolean truncateExtra) throws SQLException, StorageException
{
LinkedHashMap<ObjectID, DiversityAnswer> results = new LinkedHashMap ();
ResultSet r = executeQuery (sqlMgr, query, params);
while (r.next())
{
ThreadUtils.checkInterrupted ();
ObjectID objectID = new ObjectID (DiversityAnswer.REFERENCE_DiversityAnswer.getObjectIDSpace (), r.getLong ("id"));
DiversityAnswer resultElement;
if (maxRows != null && !results.containsKey (objectID) && results.size () >= maxRows)
{
if (truncateExtra)
{
break;
}
else
{
throw new SearchRowsExceededException ("Maximum rows exceeded:" + maxRows);
}
}
if (context.containsObject(objectID))
{
BaseBusinessClass cachedElement = context.getObjectToReplace(objectID, DiversityAnswer.REFERENCE_DiversityAnswer);
if (cachedElement instanceof DiversityAnswer)
{
LogMgr.log (DiversityAnswerPersistence, LogLevel.TRACE, "Cache hit for id:", objectID);
resultElement = (DiversityAnswer)cachedElement;
}
else
{
throw new StorageException ("Cache collision for id:" + objectID + " with object " + cachedElement + "while fetching a DiversityAnswer");
}
}
else
{
PersistentSet tl_diversity_answerPSet = allPSets.getPersistentSet(objectID, "tl_diversity_answer", PersistentSetStatus.FETCHED);
createPersistentSetFromRS(allPSets, r, objectID);
resultElement = new DiversityAnswer ();
resultElement.setFromPersistentSets(objectID, allPSets);
context.addRetrievedObject(resultElement);
}
results.put (objectID, resultElement);
}
BaseBusinessClass[] resultsArr = new BaseBusinessClass[results.size ()];
return results.values ().toArray (resultsArr);
}
public BaseBusinessClass[] find(String searchType, PersistentSetCollection allPSets, Hashtable criteria, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
LogMgr.log (DiversityAnswerPersistence, LogLevel.DEBUG2, "Search executing:", searchType, " criteria:", criteria);
String customParamFilter = (String)criteria.get (SEARCH_CustomFilter);
String customOrderBy = (String)criteria.get (SEARCH_OrderBy);
String customTables = (String)criteria.get (SEARCH_CustomExtraTables);
Boolean noCommaBeforeCustomExtraTables = (Boolean)criteria.get (SEARCH_CustomExtraTablesNoComma);
if (searchType.equals (SEARCH_CustomSQL))
{
Set<ObjectID> processedIDs = new HashSet();
SearchParamTransform tx = new SearchParamTransform (criteria);
Object[] searchParams;
customParamFilter = StringUtils.replaceParams (customParamFilter, tx);
searchParams = tx.getParamsArray();
if (customOrderBy != null)
{
customOrderBy = " ORDER BY " + customOrderBy;
}
else
{
customOrderBy = "";
}
ResultSet r;
String concatCustomTableWith = CollectionUtils.equals(noCommaBeforeCustomExtraTables, true) ? " " : ", ";
String tables = StringUtils.subBlanks(customTables) == null ? " " : concatCustomTableWith + customTables + " ";
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_diversity_answer " + tables +
"WHERE " + SELECT_JOINS + " " + customParamFilter + customOrderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, null, false);
return results;
}
else if (searchType.equals (DiversityAnswer.SEARCH_All))
{
// Local scope for transformed variables
{
}
String orderBy = " ORDER BY tl_diversity_answer.object_id";
String tables = " ";
Set<String> joinTableSet = new HashSet<String>();
String filter;
Object[] searchParams; // paramFilter: tl_diversity_answer.object_id is not null
String preFilter = "(tl_diversity_answer.object_id is not null)"
+ " ";
preFilter += context.getLoadingAttributes ().getCustomSQL() ;
SearchParamTransform tx = new SearchParamTransform (criteria);
filter = StringUtils.replaceParams (preFilter, tx);
searchParams = tx.getParamsArray();
Integer maxRows = context.getLoadingAttributes ().getMaxRows ();
boolean truncateExtra = !context.getLoadingAttributes ().isFailIfMaxExceeded();
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_diversity_answer " + tables + tableSetToSQL(joinTableSet) +
"WHERE " + SELECT_JOINS + " " + filter + orderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, maxRows, truncateExtra);
return results;
}
else
{
throw new IllegalArgumentException ("Illegal search type:" + searchType);
}
}
private void createPersistentSetFromRS(PersistentSetCollection allPSets, ResultSet r, ObjectID objectID) throws SQLException
{
PersistentSet tl_diversity_answerPSet = allPSets.getPersistentSet(objectID, "tl_diversity_answer", PersistentSetStatus.FETCHED);
// Object Modified
tl_diversity_answerPSet.setAttrib(BaseBusinessClass.FIELD_ObjectLastModified, r.getTimestamp ("LAST_UPDATED_DATE"));
// Object Created
tl_diversity_answerPSet.setAttrib(BaseBusinessClass.FIELD_ObjectCreated, r.getTimestamp ("CREATED_DATE"));
tl_diversity_answerPSet.setAttrib(DiversityAnswer.FIELD_Code, HELPER_Code.getFromRS(dummyCode, r, "answer_code"));
tl_diversity_answerPSet.setAttrib(DiversityAnswer.FIELD_Answer, HELPER_Answer.getFromRS(dummyAnswer, r, "answer"));
tl_diversity_answerPSet.setAttrib(DiversityAnswer.SINGLEREFERENCE_Question, r.getObject ("question_id"));
}
public void create(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet tl_diversity_answerPSet = allPSets.getPersistentSet(objectID, "tl_diversity_answer");
if (tl_diversity_answerPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_diversity_answerPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
executeStatement (sqlMgr,
"INSERT INTO {PREFIX}tl_diversity_answer " +
" (answer_code, answer, question_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " +
" (?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_Code.getForSQL(dummyCode, tl_diversity_answerPSet.getAttrib (DiversityAnswer.FIELD_Code))).listEntry (HELPER_Answer.getForSQL(dummyAnswer, tl_diversity_answerPSet.getAttrib (DiversityAnswer.FIELD_Answer))) .listEntry (SQLManager.CheckNull((Long)(tl_diversity_answerPSet.getAttrib (DiversityAnswer.SINGLEREFERENCE_Question)))) .listEntry (objectID.longID ()).toList().toArray());
tl_diversity_answerPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
}
package performa.orm;
public class DiversityQuestion extends BaseDiversityQuestion
{
private static final long serialVersionUID = 0L;
// This constructor should not be called
public DiversityQuestion ()
{
// Do not add any code to this, always put it in initialiseNewObject
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='http://www.oneit.com.au/schemas/5.2/BusinessObject.xsd'>
<BUSINESSCLASS name="DiversityQuestion" package="performa.orm">
<MULTIPLEREFERENCE name="Answers" type="DiversityAnswer" backreferenceName="Question" />
<TABLE name="tl_diversity_question" tablePrefix="object" polymorphic="FALSE">
<ATTRIB name="Code" type="String" dbcol="question_code" 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="MultipleAnswers" type="Boolean" dbcol="multiple_answers" defaultValue="Boolean.FALSE" />
</TABLE>
<SEARCH type="All" paramFilter="tl_diversity_question.object_id is not null" orderBy="tl_diversity_question.object_id" />
</BUSINESSCLASS>
</ROOT>
\ No newline at end of file
package performa.orm;
import java.io.*;
import java.util.*;
import java.sql.ResultSet;
import java.sql.SQLException;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.objstore.assocs.*;
import oneit.objstore.rdbms.*;
import oneit.objstore.utils.*;
import oneit.sql.*;
import oneit.utils.resource.*;
import oneit.utils.*;
import oneit.utils.threading.*;
/**
* IMPORTANT!!!! Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2[oneit.objstore.PersistenceMgrTemplate.xsl]
*/
public class DiversityQuestionPersistenceMgr extends ObjectPersistenceMgr
{
private static final LoggingArea DiversityQuestionPersistence = LoggingArea.createLoggingArea(ObjectPersistenceMgr.OBJECT_PERSISTENCE, "DiversityQuestion");
// Private attributes corresponding to business object data
private String dummyCode;
private String dummyQuestionText;
private Boolean dummyAustraliaOnly;
private Boolean dummyMultipleAnswers;
// Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper HELPER_Code = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_QuestionText = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_AustraliaOnly = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_MultipleAnswers = DefaultAttributeHelper.INSTANCE;
public DiversityQuestionPersistenceMgr ()
{
dummyCode = (String)(HELPER_Code.initialise (dummyCode));
dummyQuestionText = (String)(HELPER_QuestionText.initialise (dummyQuestionText));
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, {PREFIX}tl_diversity_question.multiple_answers, 1 AS commasafe ";
private String SELECT_JOINS = "";
public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
Set<BaseBusinessClass> resultByIDs = fetchByIDs(Collections.singleton (id), allPSets, context, sqlMgr);
if (resultByIDs.isEmpty ())
{
return null;
}
else if (resultByIDs.size () > 1)
{
throw new StorageException ("Multiple results for id:" + id);
}
else
{
return resultByIDs.iterator ().next ();
}
}
public Set<BaseBusinessClass> fetchByIDs(Set<ObjectID> ids, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
Set<BaseBusinessClass> results = new HashSet ();
Set<Long> idsToFetch = new HashSet ();
for (ObjectID id : ids)
{
if (context.containsObject(id)) // Check for cached version
{
BaseBusinessClass objectToReturn = context.getObjectToReplace(id, DiversityQuestion.REFERENCE_DiversityQuestion);
if (objectToReturn instanceof DiversityQuestion)
{
LogMgr.log (DiversityQuestionPersistence, LogLevel.TRACE, "Cache hit for id:", id);
results.add (objectToReturn);
}
else
{
throw new StorageException ("Cache collision for id:" + id + " with object " + objectToReturn + "while fetching a DiversityQuestion");
}
}
PersistentSet tl_diversity_questionPSet = allPSets.getPersistentSet(id, "tl_diversity_question", PersistentSetStatus.FETCHED);
// Check for persistent sets already prefetched
if (false || !tl_diversity_questionPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!tl_diversity_questionPSet.containsAttrib(DiversityQuestion.FIELD_Code)||
!tl_diversity_questionPSet.containsAttrib(DiversityQuestion.FIELD_QuestionText)||
!tl_diversity_questionPSet.containsAttrib(DiversityQuestion.FIELD_AustraliaOnly)||
!tl_diversity_questionPSet.containsAttrib(DiversityQuestion.FIELD_MultipleAnswers))
{
// We will need to retrieve it
idsToFetch.add (id.longValue());
}
else
{
LogMgr.log (DiversityQuestionPersistence, LogLevel.DEBUG2, "Persistent set preloaded id:", id);
/* Non Polymorphic */
DiversityQuestion result = new DiversityQuestion ();
result.setFromPersistentSets(id, allPSets);
context.addRetrievedObject(result);
results.add (result);
}
}
if (idsToFetch.size () > 0)
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_diversity_question " +
"WHERE " + SELECT_JOINS + "{PREFIX}tl_diversity_question.object_id IN ?";
BaseBusinessClass[] resultsFetched = loadQuery (allPSets, sqlMgr, context, query, new Object[] { idsToFetch }, null, false);
for (BaseBusinessClass objFetched : resultsFetched)
{
results.add (objFetched);
}
}
return results;
}
public BaseBusinessClass[] getReferencedObjects(ObjectID _objectID, String refName, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
if (false)
{
throw new RuntimeException ();
}
else
{
throw new IllegalArgumentException ("Illegal reference type:" + refName);
}
}
public void update(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, ConcurrentUpdateConflictException, StorageException
{
EqualityResult test = EqualityResult.compare (obj, obj.getBackup ());
ObjectID objectID = obj.getID ();
if (!test.areAttributesEqual () || !test.areSingleAssocsEqual () || obj.getForcedSave())
{
PersistentSet tl_diversity_questionPSet = allPSets.getPersistentSet(objectID, "tl_diversity_question");
if (tl_diversity_questionPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_diversity_questionPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}tl_diversity_question " +
"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 ()) + " ",
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)
{
// Error, either a concurrency error or a not-exists error
ResultSet r = executeQuery (sqlMgr,
"SELECT object_id, object_LAST_UPDATED_DATE FROM {PREFIX}tl_diversity_question WHERE object_id = ?",
new Object[] { objectID.longID () });
if (r.next ())
{
Date d = new java.util.Date (r.getTimestamp (2).getTime());
String errorMsg = QueryBuilder.buildQueryString ("Concurrent update error:[?] for row:[?] objDate:[?] dbDate:[?]",
new Object[] { "tl_diversity_question", objectID.longID (), obj.getObjectLastModified (), d },
sqlMgr.getPortabilityServices ());
LogMgr.log (DiversityQuestionPersistence, LogLevel.BUSINESS1, errorMsg);
throw new ConcurrentUpdateConflictException (obj, "tl_diversity_question");
}
else
{
String errorMsg = "Attempt to update nonexistent row in table:tl_diversity_question for row:" + objectID + " objDate:" + obj.getObjectLastModified ();
LogMgr.log (DiversityQuestionPersistence, LogLevel.BUSINESS1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
tl_diversity_questionPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
else
{
LogMgr.log (DiversityQuestionPersistence, LogLevel.DEBUG1, "Skipping update since no attribs or simple assocs changed on ", objectID);
}
}
public void delete(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, ConcurrentUpdateConflictException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet tl_diversity_questionPSet = allPSets.getPersistentSet(objectID, "tl_diversity_question");
LogMgr.log (DiversityQuestionPersistence, LogLevel.DEBUG2, "Deleting:", objectID);
if (tl_diversity_questionPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_diversity_questionPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsDeleted = executeStatement (sqlMgr,
"DELETE " +
"FROM {PREFIX}tl_diversity_question " +
"WHERE tl_diversity_question.object_id = ? AND " + sqlMgr.getPortabilityServices ().getTruncatedTimestampColumn ("object_LAST_UPDATED_DATE") + " = " + sqlMgr.getPortabilityServices ().getTruncatedTimestampParam("?") + " ",
new Object[] { objectID.longID(), obj.getObjectLastModified () });
if (rowsDeleted != 1)
{
// Error, either a concurrency error or a not-exists error
ResultSet r = executeQuery (sqlMgr,
"SELECT object_id FROM {PREFIX}tl_diversity_question WHERE object_id = ?",
new Object[] { objectID.longID() });
if (r.next ())
{
throw new ConcurrentUpdateConflictException (obj, "tl_diversity_question");
}
else
{
String errorMsg = "Attempt to delete nonexistent row in table:tl_diversity_question for row:" + objectID;
LogMgr.log (DiversityQuestionPersistence, LogLevel.SYSTEMERROR1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
tl_diversity_questionPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
public ResultSet executeSearchQueryAll (SQLManager sqlMgr) throws SQLException
{
throw new RuntimeException ("NOT implemented: executeSearchQueryAll");
}
public BaseBusinessClass[] loadQuery (PersistentSetCollection allPSets, SQLManager sqlMgr, RDBMSPersistenceContext context, String query, Object[] params, Integer maxRows, boolean truncateExtra) throws SQLException, StorageException
{
LinkedHashMap<ObjectID, DiversityQuestion> results = new LinkedHashMap ();
ResultSet r = executeQuery (sqlMgr, query, params);
while (r.next())
{
ThreadUtils.checkInterrupted ();
ObjectID objectID = new ObjectID (DiversityQuestion.REFERENCE_DiversityQuestion.getObjectIDSpace (), r.getLong ("id"));
DiversityQuestion resultElement;
if (maxRows != null && !results.containsKey (objectID) && results.size () >= maxRows)
{
if (truncateExtra)
{
break;
}
else
{
throw new SearchRowsExceededException ("Maximum rows exceeded:" + maxRows);
}
}
if (context.containsObject(objectID))
{
BaseBusinessClass cachedElement = context.getObjectToReplace(objectID, DiversityQuestion.REFERENCE_DiversityQuestion);
if (cachedElement instanceof DiversityQuestion)
{
LogMgr.log (DiversityQuestionPersistence, LogLevel.TRACE, "Cache hit for id:", objectID);
resultElement = (DiversityQuestion)cachedElement;
}
else
{
throw new StorageException ("Cache collision for id:" + objectID + " with object " + cachedElement + "while fetching a DiversityQuestion");
}
}
else
{
PersistentSet tl_diversity_questionPSet = allPSets.getPersistentSet(objectID, "tl_diversity_question", PersistentSetStatus.FETCHED);
createPersistentSetFromRS(allPSets, r, objectID);
resultElement = new DiversityQuestion ();
resultElement.setFromPersistentSets(objectID, allPSets);
context.addRetrievedObject(resultElement);
}
results.put (objectID, resultElement);
}
BaseBusinessClass[] resultsArr = new BaseBusinessClass[results.size ()];
return results.values ().toArray (resultsArr);
}
public BaseBusinessClass[] find(String searchType, PersistentSetCollection allPSets, Hashtable criteria, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
LogMgr.log (DiversityQuestionPersistence, LogLevel.DEBUG2, "Search executing:", searchType, " criteria:", criteria);
String customParamFilter = (String)criteria.get (SEARCH_CustomFilter);
String customOrderBy = (String)criteria.get (SEARCH_OrderBy);
String customTables = (String)criteria.get (SEARCH_CustomExtraTables);
Boolean noCommaBeforeCustomExtraTables = (Boolean)criteria.get (SEARCH_CustomExtraTablesNoComma);
if (searchType.equals (SEARCH_CustomSQL))
{
Set<ObjectID> processedIDs = new HashSet();
SearchParamTransform tx = new SearchParamTransform (criteria);
Object[] searchParams;
customParamFilter = StringUtils.replaceParams (customParamFilter, tx);
searchParams = tx.getParamsArray();
if (customOrderBy != null)
{
customOrderBy = " ORDER BY " + customOrderBy;
}
else
{
customOrderBy = "";
}
ResultSet r;
String concatCustomTableWith = CollectionUtils.equals(noCommaBeforeCustomExtraTables, true) ? " " : ", ";
String tables = StringUtils.subBlanks(customTables) == null ? " " : concatCustomTableWith + customTables + " ";
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_diversity_question " + tables +
"WHERE " + SELECT_JOINS + " " + customParamFilter + customOrderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, null, false);
return results;
}
else if (searchType.equals (DiversityQuestion.SEARCH_All))
{
// Local scope for transformed variables
{
}
String orderBy = " ORDER BY tl_diversity_question.object_id";
String tables = " ";
Set<String> joinTableSet = new HashSet<String>();
String filter;
Object[] searchParams; // paramFilter: tl_diversity_question.object_id is not null
String preFilter = "(tl_diversity_question.object_id is not null)"
+ " ";
preFilter += context.getLoadingAttributes ().getCustomSQL() ;
SearchParamTransform tx = new SearchParamTransform (criteria);
filter = StringUtils.replaceParams (preFilter, tx);
searchParams = tx.getParamsArray();
Integer maxRows = context.getLoadingAttributes ().getMaxRows ();
boolean truncateExtra = !context.getLoadingAttributes ().isFailIfMaxExceeded();
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_diversity_question " + tables + tableSetToSQL(joinTableSet) +
"WHERE " + SELECT_JOINS + " " + filter + orderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, maxRows, truncateExtra);
return results;
}
else
{
throw new IllegalArgumentException ("Illegal search type:" + searchType);
}
}
private void createPersistentSetFromRS(PersistentSetCollection allPSets, ResultSet r, ObjectID objectID) throws SQLException
{
PersistentSet tl_diversity_questionPSet = allPSets.getPersistentSet(objectID, "tl_diversity_question", PersistentSetStatus.FETCHED);
// Object Modified
tl_diversity_questionPSet.setAttrib(BaseBusinessClass.FIELD_ObjectLastModified, r.getTimestamp ("LAST_UPDATED_DATE"));
// Object Created
tl_diversity_questionPSet.setAttrib(BaseBusinessClass.FIELD_ObjectCreated, r.getTimestamp ("CREATED_DATE"));
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_AustraliaOnly, HELPER_AustraliaOnly.getFromRS(dummyAustraliaOnly, r, "australia_only"));
tl_diversity_questionPSet.setAttrib(DiversityQuestion.FIELD_MultipleAnswers, HELPER_MultipleAnswers.getFromRS(dummyMultipleAnswers, r, "multiple_answers"));
}
public void create(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet tl_diversity_questionPSet = allPSets.getPersistentSet(objectID, "tl_diversity_question");
if (tl_diversity_questionPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_diversity_questionPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
executeStatement (sqlMgr,
"INSERT INTO {PREFIX}tl_diversity_question " +
" (question_code, question_text, australia_only, multiple_answers, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " +
" (?, ?, ?, ?, ?, " + 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 (HELPER_MultipleAnswers.getForSQL(dummyMultipleAnswers, tl_diversity_questionPSet.getAttrib (DiversityQuestion.FIELD_MultipleAnswers))) .listEntry (objectID.longID ()).toList().toArray());
tl_diversity_questionPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
}
package performa.orm;
public class HTDiversityQuestion extends BaseHTDiversityQuestion
{
private static final long serialVersionUID = 0L;
// This constructor should not be called
public HTDiversityQuestion ()
{
// Do not add any code to this, always put it in initialiseNewObject
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='http://www.oneit.com.au/schemas/5.2/BusinessObject.xsd'>
<BUSINESSCLASS name="HTDiversityQuestion" package="performa.orm">
<TABLE name="tl_ht_diversity_question" tablePrefix="object" polymorphic="FALSE">
<ATTRIB name="QuestionText" type="String" dbcol="question_text" mandatory="true"/>
<ATTRIB name="IsApplicable" type="Boolean" dbcol="is_applicable" defaultValue="Boolean.TRUE" />
<SINGLEREFERENCE name="Question" type="DiversityQuestion" dbcol="question_id" mandatory="true"/>
<SINGLEREFERENCE name="HiringTeam" type="HiringTeam" dbcol="hiring_team_id" backreferenceName="DiversityQuestions" mandatory="true"/>
</TABLE>
<SEARCH type="All" paramFilter="tl_ht_diversity_question.object_id is not null" orderBy="tl_ht_diversity_question.object_id" />
</BUSINESSCLASS>
</ROOT>
\ No newline at end of file
package performa.orm;
import java.io.*;
import java.util.*;
import java.sql.ResultSet;
import java.sql.SQLException;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.objstore.assocs.*;
import oneit.objstore.rdbms.*;
import oneit.objstore.utils.*;
import oneit.sql.*;
import oneit.utils.resource.*;
import oneit.utils.*;
import oneit.utils.threading.*;
/**
* IMPORTANT!!!! Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2[oneit.objstore.PersistenceMgrTemplate.xsl]
*/
public class HTDiversityQuestionPersistenceMgr extends ObjectPersistenceMgr
{
private static final LoggingArea HTDiversityQuestionPersistence = LoggingArea.createLoggingArea(ObjectPersistenceMgr.OBJECT_PERSISTENCE, "HTDiversityQuestion");
// Private attributes corresponding to business object data
private String dummyQuestionText;
private Boolean dummyIsApplicable;
// Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper HELPER_QuestionText = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_IsApplicable = DefaultAttributeHelper.INSTANCE;
public HTDiversityQuestionPersistenceMgr ()
{
dummyQuestionText = (String)(HELPER_QuestionText.initialise (dummyQuestionText));
dummyIsApplicable = (Boolean)(HELPER_IsApplicable.initialise (dummyIsApplicable));
}
private String SELECT_COLUMNS = "{PREFIX}tl_ht_diversity_question.object_id as id, {PREFIX}tl_ht_diversity_question.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_ht_diversity_question.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_ht_diversity_question.question_text, {PREFIX}tl_ht_diversity_question.is_applicable, {PREFIX}tl_ht_diversity_question.question_id, {PREFIX}tl_ht_diversity_question.hiring_team_id, 1 AS commasafe ";
private String SELECT_JOINS = "";
public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
Set<BaseBusinessClass> resultByIDs = fetchByIDs(Collections.singleton (id), allPSets, context, sqlMgr);
if (resultByIDs.isEmpty ())
{
return null;
}
else if (resultByIDs.size () > 1)
{
throw new StorageException ("Multiple results for id:" + id);
}
else
{
return resultByIDs.iterator ().next ();
}
}
public Set<BaseBusinessClass> fetchByIDs(Set<ObjectID> ids, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
Set<BaseBusinessClass> results = new HashSet ();
Set<Long> idsToFetch = new HashSet ();
for (ObjectID id : ids)
{
if (context.containsObject(id)) // Check for cached version
{
BaseBusinessClass objectToReturn = context.getObjectToReplace(id, HTDiversityQuestion.REFERENCE_HTDiversityQuestion);
if (objectToReturn instanceof HTDiversityQuestion)
{
LogMgr.log (HTDiversityQuestionPersistence, LogLevel.TRACE, "Cache hit for id:", id);
results.add (objectToReturn);
}
else
{
throw new StorageException ("Cache collision for id:" + id + " with object " + objectToReturn + "while fetching a HTDiversityQuestion");
}
}
PersistentSet tl_ht_diversity_questionPSet = allPSets.getPersistentSet(id, "tl_ht_diversity_question", PersistentSetStatus.FETCHED);
// Check for persistent sets already prefetched
if (false || !tl_ht_diversity_questionPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!tl_ht_diversity_questionPSet.containsAttrib(HTDiversityQuestion.FIELD_QuestionText)||
!tl_ht_diversity_questionPSet.containsAttrib(HTDiversityQuestion.FIELD_IsApplicable)||
!tl_ht_diversity_questionPSet.containsAttrib(HTDiversityQuestion.SINGLEREFERENCE_Question)||
!tl_ht_diversity_questionPSet.containsAttrib(HTDiversityQuestion.SINGLEREFERENCE_HiringTeam))
{
// We will need to retrieve it
idsToFetch.add (id.longValue());
}
else
{
LogMgr.log (HTDiversityQuestionPersistence, LogLevel.DEBUG2, "Persistent set preloaded id:", id);
/* Non Polymorphic */
HTDiversityQuestion result = new HTDiversityQuestion ();
result.setFromPersistentSets(id, allPSets);
context.addRetrievedObject(result);
results.add (result);
}
}
if (idsToFetch.size () > 0)
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_ht_diversity_question " +
"WHERE " + SELECT_JOINS + "{PREFIX}tl_ht_diversity_question.object_id IN ?";
BaseBusinessClass[] resultsFetched = loadQuery (allPSets, sqlMgr, context, query, new Object[] { idsToFetch }, null, false);
for (BaseBusinessClass objFetched : resultsFetched)
{
results.add (objFetched);
}
}
return results;
}
public BaseBusinessClass[] getReferencedObjects(ObjectID _objectID, String refName, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
if (false)
{
throw new RuntimeException ();
}
else if (refName.equals (HTDiversityQuestion.SINGLEREFERENCE_HiringTeam))
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_ht_diversity_question " +
"WHERE " + SELECT_JOINS + "hiring_team_id = ?";
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, new Object[] { _objectID.longID () }, null, false);
return results;
}
else
{
throw new IllegalArgumentException ("Illegal reference type:" + refName);
}
}
public void update(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, ConcurrentUpdateConflictException, StorageException
{
EqualityResult test = EqualityResult.compare (obj, obj.getBackup ());
ObjectID objectID = obj.getID ();
if (!test.areAttributesEqual () || !test.areSingleAssocsEqual () || obj.getForcedSave())
{
PersistentSet tl_ht_diversity_questionPSet = allPSets.getPersistentSet(objectID, "tl_ht_diversity_question");
if (tl_ht_diversity_questionPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_ht_diversity_questionPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}tl_ht_diversity_question " +
"SET question_text = ?, is_applicable = ?, question_id = ? , hiring_team_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE tl_ht_diversity_question.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_QuestionText.getForSQL(dummyQuestionText, tl_ht_diversity_questionPSet.getAttrib (HTDiversityQuestion.FIELD_QuestionText))).listEntry (HELPER_IsApplicable.getForSQL(dummyIsApplicable, tl_ht_diversity_questionPSet.getAttrib (HTDiversityQuestion.FIELD_IsApplicable))).listEntry (SQLManager.CheckNull((Long)(tl_ht_diversity_questionPSet.getAttrib (HTDiversityQuestion.SINGLEREFERENCE_Question)))).listEntry (SQLManager.CheckNull((Long)(tl_ht_diversity_questionPSet.getAttrib (HTDiversityQuestion.SINGLEREFERENCE_HiringTeam)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
if (rowsUpdated != 1)
{
// Error, either a concurrency error or a not-exists error
ResultSet r = executeQuery (sqlMgr,
"SELECT object_id, object_LAST_UPDATED_DATE FROM {PREFIX}tl_ht_diversity_question WHERE object_id = ?",
new Object[] { objectID.longID () });
if (r.next ())
{
Date d = new java.util.Date (r.getTimestamp (2).getTime());
String errorMsg = QueryBuilder.buildQueryString ("Concurrent update error:[?] for row:[?] objDate:[?] dbDate:[?]",
new Object[] { "tl_ht_diversity_question", objectID.longID (), obj.getObjectLastModified (), d },
sqlMgr.getPortabilityServices ());
LogMgr.log (HTDiversityQuestionPersistence, LogLevel.BUSINESS1, errorMsg);
throw new ConcurrentUpdateConflictException (obj, "tl_ht_diversity_question");
}
else
{
String errorMsg = "Attempt to update nonexistent row in table:tl_ht_diversity_question for row:" + objectID + " objDate:" + obj.getObjectLastModified ();
LogMgr.log (HTDiversityQuestionPersistence, LogLevel.BUSINESS1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
tl_ht_diversity_questionPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
else
{
LogMgr.log (HTDiversityQuestionPersistence, LogLevel.DEBUG1, "Skipping update since no attribs or simple assocs changed on ", objectID);
}
}
public void delete(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, ConcurrentUpdateConflictException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet tl_ht_diversity_questionPSet = allPSets.getPersistentSet(objectID, "tl_ht_diversity_question");
LogMgr.log (HTDiversityQuestionPersistence, LogLevel.DEBUG2, "Deleting:", objectID);
if (tl_ht_diversity_questionPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_ht_diversity_questionPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsDeleted = executeStatement (sqlMgr,
"DELETE " +
"FROM {PREFIX}tl_ht_diversity_question " +
"WHERE tl_ht_diversity_question.object_id = ? AND " + sqlMgr.getPortabilityServices ().getTruncatedTimestampColumn ("object_LAST_UPDATED_DATE") + " = " + sqlMgr.getPortabilityServices ().getTruncatedTimestampParam("?") + " ",
new Object[] { objectID.longID(), obj.getObjectLastModified () });
if (rowsDeleted != 1)
{
// Error, either a concurrency error or a not-exists error
ResultSet r = executeQuery (sqlMgr,
"SELECT object_id FROM {PREFIX}tl_ht_diversity_question WHERE object_id = ?",
new Object[] { objectID.longID() });
if (r.next ())
{
throw new ConcurrentUpdateConflictException (obj, "tl_ht_diversity_question");
}
else
{
String errorMsg = "Attempt to delete nonexistent row in table:tl_ht_diversity_question for row:" + objectID;
LogMgr.log (HTDiversityQuestionPersistence, LogLevel.SYSTEMERROR1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
tl_ht_diversity_questionPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
public ResultSet executeSearchQueryAll (SQLManager sqlMgr) throws SQLException
{
throw new RuntimeException ("NOT implemented: executeSearchQueryAll");
}
public BaseBusinessClass[] loadQuery (PersistentSetCollection allPSets, SQLManager sqlMgr, RDBMSPersistenceContext context, String query, Object[] params, Integer maxRows, boolean truncateExtra) throws SQLException, StorageException
{
LinkedHashMap<ObjectID, HTDiversityQuestion> results = new LinkedHashMap ();
ResultSet r = executeQuery (sqlMgr, query, params);
while (r.next())
{
ThreadUtils.checkInterrupted ();
ObjectID objectID = new ObjectID (HTDiversityQuestion.REFERENCE_HTDiversityQuestion.getObjectIDSpace (), r.getLong ("id"));
HTDiversityQuestion resultElement;
if (maxRows != null && !results.containsKey (objectID) && results.size () >= maxRows)
{
if (truncateExtra)
{
break;
}
else
{
throw new SearchRowsExceededException ("Maximum rows exceeded:" + maxRows);
}
}
if (context.containsObject(objectID))
{
BaseBusinessClass cachedElement = context.getObjectToReplace(objectID, HTDiversityQuestion.REFERENCE_HTDiversityQuestion);
if (cachedElement instanceof HTDiversityQuestion)
{
LogMgr.log (HTDiversityQuestionPersistence, LogLevel.TRACE, "Cache hit for id:", objectID);
resultElement = (HTDiversityQuestion)cachedElement;
}
else
{
throw new StorageException ("Cache collision for id:" + objectID + " with object " + cachedElement + "while fetching a HTDiversityQuestion");
}
}
else
{
PersistentSet tl_ht_diversity_questionPSet = allPSets.getPersistentSet(objectID, "tl_ht_diversity_question", PersistentSetStatus.FETCHED);
createPersistentSetFromRS(allPSets, r, objectID);
resultElement = new HTDiversityQuestion ();
resultElement.setFromPersistentSets(objectID, allPSets);
context.addRetrievedObject(resultElement);
}
results.put (objectID, resultElement);
}
BaseBusinessClass[] resultsArr = new BaseBusinessClass[results.size ()];
return results.values ().toArray (resultsArr);
}
public BaseBusinessClass[] find(String searchType, PersistentSetCollection allPSets, Hashtable criteria, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
LogMgr.log (HTDiversityQuestionPersistence, LogLevel.DEBUG2, "Search executing:", searchType, " criteria:", criteria);
String customParamFilter = (String)criteria.get (SEARCH_CustomFilter);
String customOrderBy = (String)criteria.get (SEARCH_OrderBy);
String customTables = (String)criteria.get (SEARCH_CustomExtraTables);
Boolean noCommaBeforeCustomExtraTables = (Boolean)criteria.get (SEARCH_CustomExtraTablesNoComma);
if (searchType.equals (SEARCH_CustomSQL))
{
Set<ObjectID> processedIDs = new HashSet();
SearchParamTransform tx = new SearchParamTransform (criteria);
Object[] searchParams;
customParamFilter = StringUtils.replaceParams (customParamFilter, tx);
searchParams = tx.getParamsArray();
if (customOrderBy != null)
{
customOrderBy = " ORDER BY " + customOrderBy;
}
else
{
customOrderBy = "";
}
ResultSet r;
String concatCustomTableWith = CollectionUtils.equals(noCommaBeforeCustomExtraTables, true) ? " " : ", ";
String tables = StringUtils.subBlanks(customTables) == null ? " " : concatCustomTableWith + customTables + " ";
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_ht_diversity_question " + tables +
"WHERE " + SELECT_JOINS + " " + customParamFilter + customOrderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, null, false);
return results;
}
else if (searchType.equals (HTDiversityQuestion.SEARCH_All))
{
// Local scope for transformed variables
{
}
String orderBy = " ORDER BY tl_ht_diversity_question.object_id";
String tables = " ";
Set<String> joinTableSet = new HashSet<String>();
String filter;
Object[] searchParams; // paramFilter: tl_ht_diversity_question.object_id is not null
String preFilter = "(tl_ht_diversity_question.object_id is not null)"
+ " ";
preFilter += context.getLoadingAttributes ().getCustomSQL() ;
SearchParamTransform tx = new SearchParamTransform (criteria);
filter = StringUtils.replaceParams (preFilter, tx);
searchParams = tx.getParamsArray();
Integer maxRows = context.getLoadingAttributes ().getMaxRows ();
boolean truncateExtra = !context.getLoadingAttributes ().isFailIfMaxExceeded();
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_ht_diversity_question " + tables + tableSetToSQL(joinTableSet) +
"WHERE " + SELECT_JOINS + " " + filter + orderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, maxRows, truncateExtra);
return results;
}
else
{
throw new IllegalArgumentException ("Illegal search type:" + searchType);
}
}
private void createPersistentSetFromRS(PersistentSetCollection allPSets, ResultSet r, ObjectID objectID) throws SQLException
{
PersistentSet tl_ht_diversity_questionPSet = allPSets.getPersistentSet(objectID, "tl_ht_diversity_question", PersistentSetStatus.FETCHED);
// Object Modified
tl_ht_diversity_questionPSet.setAttrib(BaseBusinessClass.FIELD_ObjectLastModified, r.getTimestamp ("LAST_UPDATED_DATE"));
// Object Created
tl_ht_diversity_questionPSet.setAttrib(BaseBusinessClass.FIELD_ObjectCreated, r.getTimestamp ("CREATED_DATE"));
tl_ht_diversity_questionPSet.setAttrib(HTDiversityQuestion.FIELD_QuestionText, HELPER_QuestionText.getFromRS(dummyQuestionText, r, "question_text"));
tl_ht_diversity_questionPSet.setAttrib(HTDiversityQuestion.FIELD_IsApplicable, HELPER_IsApplicable.getFromRS(dummyIsApplicable, r, "is_applicable"));
tl_ht_diversity_questionPSet.setAttrib(HTDiversityQuestion.SINGLEREFERENCE_Question, r.getObject ("question_id"));
tl_ht_diversity_questionPSet.setAttrib(HTDiversityQuestion.SINGLEREFERENCE_HiringTeam, r.getObject ("hiring_team_id"));
}
public void create(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet tl_ht_diversity_questionPSet = allPSets.getPersistentSet(objectID, "tl_ht_diversity_question");
if (tl_ht_diversity_questionPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_ht_diversity_questionPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
executeStatement (sqlMgr,
"INSERT INTO {PREFIX}tl_ht_diversity_question " +
" (question_text, is_applicable, question_id, hiring_team_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " +
" (?, ?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_QuestionText.getForSQL(dummyQuestionText, tl_ht_diversity_questionPSet.getAttrib (HTDiversityQuestion.FIELD_QuestionText))).listEntry (HELPER_IsApplicable.getForSQL(dummyIsApplicable, tl_ht_diversity_questionPSet.getAttrib (HTDiversityQuestion.FIELD_IsApplicable))) .listEntry (SQLManager.CheckNull((Long)(tl_ht_diversity_questionPSet.getAttrib (HTDiversityQuestion.SINGLEREFERENCE_Question)))).listEntry (SQLManager.CheckNull((Long)(tl_ht_diversity_questionPSet.getAttrib (HTDiversityQuestion.SINGLEREFERENCE_HiringTeam)))) .listEntry (objectID.longID ()).toList().toArray());
tl_ht_diversity_questionPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
}
...@@ -6,7 +6,6 @@ import java.util.Date; ...@@ -6,7 +6,6 @@ import java.util.Date;
import java.util.Set; import java.util.Set;
import oneit.logging.LoggingArea; import oneit.logging.LoggingArea;
import oneit.objstore.FieldWriteability; import oneit.objstore.FieldWriteability;
import oneit.objstore.ValidationContext;
import oneit.objstore.rdbms.filters.EqualsFilter; import oneit.objstore.rdbms.filters.EqualsFilter;
import oneit.security.SecUser; import oneit.security.SecUser;
import oneit.utils.BusinessException; import oneit.utils.BusinessException;
...@@ -38,6 +37,11 @@ public class HiringTeam extends BaseHiringTeam ...@@ -38,6 +37,11 @@ public class HiringTeam extends BaseHiringTeam
return isTrue(getHasClientSupport()); return isTrue(getHasClientSupport());
} }
public boolean showHasDiversity()
{
return isTrue(getHasDiversity());
}
@Override @Override
public String getToString() public String getToString()
{ {
......
...@@ -7,9 +7,10 @@ ...@@ -7,9 +7,10 @@
<IMPORT value="performa.orm.types.*"/> <IMPORT value="performa.orm.types.*"/>
<IMPORT value="performa.orm.types.TimeZone"/> <IMPORT value="performa.orm.types.TimeZone"/>
<MULTIPLEREFERENCE name="Users" type="CompanyUserHiringTeamLink" backreferenceName="HiringTeam" /> <MULTIPLEREFERENCE name="Users" type="CompanyUserHiringTeamLink" backreferenceName="HiringTeam" />
<MULTIPLEREFERENCE name="Clients" type="Client" backreferenceName="HiringTeam" /> <MULTIPLEREFERENCE name="Clients" type="Client" backreferenceName="HiringTeam" />
<MULTIPLEREFERENCE name="BillingTeams" type="HiringTeam" backreferenceName="BilledByTeam" /> <MULTIPLEREFERENCE name="BillingTeams" type="HiringTeam" backreferenceName="BilledByTeam" />
<MULTIPLEREFERENCE name="DiversityQuestions" type="HTDiversityQuestion" backreferenceName="HiringTeam" />
<TRANSIENT name="IsLogoDeleted" type="Boolean" defaultValue="Boolean.FALSE"/> <TRANSIENT name="IsLogoDeleted" type="Boolean" defaultValue="Boolean.FALSE"/>
<TRANSIENT name="CouponCode" type="String" length="20"/> <TRANSIENT name="CouponCode" type="String" length="20"/>
...@@ -28,6 +29,7 @@ ...@@ -28,6 +29,7 @@
<ATTRIB name="PostCode" type="String" dbcol="post_code" mandatory="false" length="10"/> <ATTRIB name="PostCode" type="String" dbcol="post_code" mandatory="false" length="10"/>
<ATTRIB name="City" type="String" dbcol="city" mandatory="false" length="100"/> <ATTRIB name="City" type="String" dbcol="city" mandatory="false" length="100"/>
<ATTRIB name="HasClientSupport" type="Boolean" dbcol="has_client_support" mandatory="false" defaultValue="Boolean.FALSE"/> <ATTRIB name="HasClientSupport" type="Boolean" dbcol="has_client_support" mandatory="false" defaultValue="Boolean.FALSE"/>
<ATTRIB name="HasDiversity" type="Boolean" dbcol="has_diversity" mandatory="false" defaultValue="Boolean.FALSE"/>
<ATTRIB name="ManageOwnBilling" type="Boolean" dbcol="manage_own_billing" mandatory="false" defaultValue="Boolean.TRUE"/> <ATTRIB name="ManageOwnBilling" type="Boolean" dbcol="manage_own_billing" mandatory="false" defaultValue="Boolean.TRUE"/>
<ATTRIB name="StripeReference" type="String" dbcol="stripe_reference" length="100" /> <ATTRIB name="StripeReference" type="String" dbcol="stripe_reference" length="100" />
<ATTRIB name="StripeSubscription" type="String" dbcol="stripe_subscription" length="100" /> <ATTRIB name="StripeSubscription" type="String" dbcol="stripe_subscription" length="100" />
......
...@@ -38,6 +38,7 @@ public class HiringTeamPersistenceMgr extends ObjectPersistenceMgr ...@@ -38,6 +38,7 @@ public class HiringTeamPersistenceMgr extends ObjectPersistenceMgr
private String dummyPostCode; private String dummyPostCode;
private String dummyCity; private String dummyCity;
private Boolean dummyHasClientSupport; private Boolean dummyHasClientSupport;
private Boolean dummyHasDiversity;
private Boolean dummyManageOwnBilling; private Boolean dummyManageOwnBilling;
private String dummyStripeReference; private String dummyStripeReference;
private String dummyStripeSubscription; private String dummyStripeSubscription;
...@@ -73,6 +74,7 @@ public class HiringTeamPersistenceMgr extends ObjectPersistenceMgr ...@@ -73,6 +74,7 @@ public class HiringTeamPersistenceMgr extends ObjectPersistenceMgr
private static final DefaultAttributeHelper HELPER_PostCode = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper HELPER_PostCode = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_City = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper HELPER_City = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_HasClientSupport = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper HELPER_HasClientSupport = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_HasDiversity = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_ManageOwnBilling = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper HELPER_ManageOwnBilling = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_StripeReference = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper HELPER_StripeReference = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_StripeSubscription = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper HELPER_StripeSubscription = DefaultAttributeHelper.INSTANCE;
...@@ -111,6 +113,7 @@ public class HiringTeamPersistenceMgr extends ObjectPersistenceMgr ...@@ -111,6 +113,7 @@ public class HiringTeamPersistenceMgr extends ObjectPersistenceMgr
dummyPostCode = (String)(HELPER_PostCode.initialise (dummyPostCode)); dummyPostCode = (String)(HELPER_PostCode.initialise (dummyPostCode));
dummyCity = (String)(HELPER_City.initialise (dummyCity)); dummyCity = (String)(HELPER_City.initialise (dummyCity));
dummyHasClientSupport = (Boolean)(HELPER_HasClientSupport.initialise (dummyHasClientSupport)); dummyHasClientSupport = (Boolean)(HELPER_HasClientSupport.initialise (dummyHasClientSupport));
dummyHasDiversity = (Boolean)(HELPER_HasDiversity.initialise (dummyHasDiversity));
dummyManageOwnBilling = (Boolean)(HELPER_ManageOwnBilling.initialise (dummyManageOwnBilling)); dummyManageOwnBilling = (Boolean)(HELPER_ManageOwnBilling.initialise (dummyManageOwnBilling));
dummyStripeReference = (String)(HELPER_StripeReference.initialise (dummyStripeReference)); dummyStripeReference = (String)(HELPER_StripeReference.initialise (dummyStripeReference));
dummyStripeSubscription = (String)(HELPER_StripeSubscription.initialise (dummyStripeSubscription)); dummyStripeSubscription = (String)(HELPER_StripeSubscription.initialise (dummyStripeSubscription));
...@@ -136,7 +139,7 @@ public class HiringTeamPersistenceMgr extends ObjectPersistenceMgr ...@@ -136,7 +139,7 @@ public class HiringTeamPersistenceMgr extends ObjectPersistenceMgr
} }
private String SELECT_COLUMNS = "{PREFIX}tl_hiring_team.object_id as id, {PREFIX}tl_hiring_team.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_hiring_team.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_hiring_team.hiring_team_name, {PREFIX}tl_hiring_team.hiring_team_logo, {PREFIX}tl_hiring_team.hiring_team_type, {PREFIX}tl_hiring_team.industry, {PREFIX}tl_hiring_team.time_zone, {PREFIX}tl_hiring_team.state, {PREFIX}tl_hiring_team.country, {PREFIX}tl_hiring_team.post_code, {PREFIX}tl_hiring_team.city, {PREFIX}tl_hiring_team.has_client_support, {PREFIX}tl_hiring_team.manage_own_billing, {PREFIX}tl_hiring_team.stripe_reference, {PREFIX}tl_hiring_team.stripe_subscription, {PREFIX}tl_hiring_team.stripe_fixed_sub_item, {PREFIX}tl_hiring_team.stripe_metered_sub_item, {PREFIX}tl_hiring_team.name_on_card, {PREFIX}tl_hiring_team.card_post_code, {PREFIX}tl_hiring_team.card_id, {PREFIX}tl_hiring_team.plan_renewed_on, {PREFIX}tl_hiring_team.ppj_credits, {PREFIX}tl_hiring_team.used_credits, {PREFIX}tl_hiring_team.available_credits, {PREFIX}tl_hiring_team.is_ppj, {PREFIX}tl_hiring_team.has_cap, {PREFIX}tl_hiring_team.max_cap, {PREFIX}tl_hiring_team.coupon_expiry_date, {PREFIX}tl_hiring_team.last_plan_amount, {PREFIX}tl_hiring_team.google_address_text, {PREFIX}tl_hiring_team.plan_cancelled, {PREFIX}tl_hiring_team.on_trial, {PREFIX}tl_hiring_team.trial_job_count, {PREFIX}tl_hiring_team.message_id, {PREFIX}tl_hiring_team.company_id, {PREFIX}tl_hiring_team.billing_team_id, {PREFIX}tl_hiring_team.added_by_user_id, {PREFIX}tl_hiring_team.payment_plan_id, {PREFIX}tl_hiring_team.coupon_id, 1 AS commasafe "; private String SELECT_COLUMNS = "{PREFIX}tl_hiring_team.object_id as id, {PREFIX}tl_hiring_team.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_hiring_team.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_hiring_team.hiring_team_name, {PREFIX}tl_hiring_team.hiring_team_logo, {PREFIX}tl_hiring_team.hiring_team_type, {PREFIX}tl_hiring_team.industry, {PREFIX}tl_hiring_team.time_zone, {PREFIX}tl_hiring_team.state, {PREFIX}tl_hiring_team.country, {PREFIX}tl_hiring_team.post_code, {PREFIX}tl_hiring_team.city, {PREFIX}tl_hiring_team.has_client_support, {PREFIX}tl_hiring_team.has_diversity, {PREFIX}tl_hiring_team.manage_own_billing, {PREFIX}tl_hiring_team.stripe_reference, {PREFIX}tl_hiring_team.stripe_subscription, {PREFIX}tl_hiring_team.stripe_fixed_sub_item, {PREFIX}tl_hiring_team.stripe_metered_sub_item, {PREFIX}tl_hiring_team.name_on_card, {PREFIX}tl_hiring_team.card_post_code, {PREFIX}tl_hiring_team.card_id, {PREFIX}tl_hiring_team.plan_renewed_on, {PREFIX}tl_hiring_team.ppj_credits, {PREFIX}tl_hiring_team.used_credits, {PREFIX}tl_hiring_team.available_credits, {PREFIX}tl_hiring_team.is_ppj, {PREFIX}tl_hiring_team.has_cap, {PREFIX}tl_hiring_team.max_cap, {PREFIX}tl_hiring_team.coupon_expiry_date, {PREFIX}tl_hiring_team.last_plan_amount, {PREFIX}tl_hiring_team.google_address_text, {PREFIX}tl_hiring_team.plan_cancelled, {PREFIX}tl_hiring_team.on_trial, {PREFIX}tl_hiring_team.trial_job_count, {PREFIX}tl_hiring_team.message_id, {PREFIX}tl_hiring_team.company_id, {PREFIX}tl_hiring_team.billing_team_id, {PREFIX}tl_hiring_team.added_by_user_id, {PREFIX}tl_hiring_team.payment_plan_id, {PREFIX}tl_hiring_team.coupon_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
...@@ -197,6 +200,7 @@ public class HiringTeamPersistenceMgr extends ObjectPersistenceMgr ...@@ -197,6 +200,7 @@ public class HiringTeamPersistenceMgr extends ObjectPersistenceMgr
!tl_hiring_teamPSet.containsAttrib(HiringTeam.FIELD_PostCode)|| !tl_hiring_teamPSet.containsAttrib(HiringTeam.FIELD_PostCode)||
!tl_hiring_teamPSet.containsAttrib(HiringTeam.FIELD_City)|| !tl_hiring_teamPSet.containsAttrib(HiringTeam.FIELD_City)||
!tl_hiring_teamPSet.containsAttrib(HiringTeam.FIELD_HasClientSupport)|| !tl_hiring_teamPSet.containsAttrib(HiringTeam.FIELD_HasClientSupport)||
!tl_hiring_teamPSet.containsAttrib(HiringTeam.FIELD_HasDiversity)||
!tl_hiring_teamPSet.containsAttrib(HiringTeam.FIELD_ManageOwnBilling)|| !tl_hiring_teamPSet.containsAttrib(HiringTeam.FIELD_ManageOwnBilling)||
!tl_hiring_teamPSet.containsAttrib(HiringTeam.FIELD_StripeReference)|| !tl_hiring_teamPSet.containsAttrib(HiringTeam.FIELD_StripeReference)||
!tl_hiring_teamPSet.containsAttrib(HiringTeam.FIELD_StripeSubscription)|| !tl_hiring_teamPSet.containsAttrib(HiringTeam.FIELD_StripeSubscription)||
...@@ -313,10 +317,10 @@ public class HiringTeamPersistenceMgr extends ObjectPersistenceMgr ...@@ -313,10 +317,10 @@ public class HiringTeamPersistenceMgr extends ObjectPersistenceMgr
{ {
int rowsUpdated = executeStatement (sqlMgr, int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}tl_hiring_team " + "UPDATE {PREFIX}tl_hiring_team " +
"SET hiring_team_name = ?, hiring_team_logo = ?, hiring_team_type = ?, industry = ?, time_zone = ?, state = ?, country = ?, post_code = ?, city = ?, has_client_support = ?, manage_own_billing = ?, stripe_reference = ?, stripe_subscription = ?, stripe_fixed_sub_item = ?, stripe_metered_sub_item = ?, name_on_card = ?, card_post_code = ?, card_id = ?, plan_renewed_on = ?, ppj_credits = ?, used_credits = ?, available_credits = ?, is_ppj = ?, has_cap = ?, max_cap = ?, coupon_expiry_date = ?, last_plan_amount = ?, google_address_text = ?, plan_cancelled = ?, on_trial = ?, trial_job_count = ?, message_id = ?, company_id = ? , billing_team_id = ? , added_by_user_id = ? , payment_plan_id = ? , coupon_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " + "SET hiring_team_name = ?, hiring_team_logo = ?, hiring_team_type = ?, industry = ?, time_zone = ?, state = ?, country = ?, post_code = ?, city = ?, has_client_support = ?, has_diversity = ?, manage_own_billing = ?, stripe_reference = ?, stripe_subscription = ?, stripe_fixed_sub_item = ?, stripe_metered_sub_item = ?, name_on_card = ?, card_post_code = ?, card_id = ?, plan_renewed_on = ?, ppj_credits = ?, used_credits = ?, available_credits = ?, is_ppj = ?, has_cap = ?, max_cap = ?, coupon_expiry_date = ?, last_plan_amount = ?, google_address_text = ?, plan_cancelled = ?, on_trial = ?, trial_job_count = ?, message_id = ?, company_id = ? , billing_team_id = ? , added_by_user_id = ? , payment_plan_id = ? , coupon_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE tl_hiring_team.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ", "WHERE tl_hiring_team.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_HiringTeamName.getForSQL(dummyHiringTeamName, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HiringTeamName))).listEntry (HELPER_HiringTeamLogo.getForSQL(dummyHiringTeamLogo, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HiringTeamLogo))).listEntry (HELPER_HiringTeamType.getForSQL(dummyHiringTeamType, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HiringTeamType))).listEntry (HELPER_Industry.getForSQL(dummyIndustry, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_Industry))).listEntry (HELPER_TimeZone.getForSQL(dummyTimeZone, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_TimeZone))).listEntry (HELPER_State.getForSQL(dummyState, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_State))).listEntry (HELPER_Country.getForSQL(dummyCountry, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_Country))).listEntry (HELPER_PostCode.getForSQL(dummyPostCode, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_PostCode))).listEntry (HELPER_City.getForSQL(dummyCity, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_City))).listEntry (HELPER_HasClientSupport.getForSQL(dummyHasClientSupport, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HasClientSupport))).listEntry (HELPER_ManageOwnBilling.getForSQL(dummyManageOwnBilling, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_ManageOwnBilling))).listEntry (HELPER_StripeReference.getForSQL(dummyStripeReference, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_StripeReference))).listEntry (HELPER_StripeSubscription.getForSQL(dummyStripeSubscription, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_StripeSubscription))).listEntry (HELPER_StripeFixedSubItem.getForSQL(dummyStripeFixedSubItem, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_StripeFixedSubItem))).listEntry (HELPER_StripeMeteredSubItem.getForSQL(dummyStripeMeteredSubItem, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_StripeMeteredSubItem))).listEntry (HELPER_NameOnCard.getForSQL(dummyNameOnCard, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_NameOnCard))).listEntry (HELPER_CardPostCode.getForSQL(dummyCardPostCode, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_CardPostCode))).listEntry (HELPER_CardID.getForSQL(dummyCardID, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_CardID))).listEntry (HELPER_PlanRenewedOn.getForSQL(dummyPlanRenewedOn, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_PlanRenewedOn))).listEntry (HELPER_PPJCredits.getForSQL(dummyPPJCredits, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_PPJCredits))).listEntry (HELPER_UsedCredits.getForSQL(dummyUsedCredits, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_UsedCredits))).listEntry (HELPER_AvailableCredits.getForSQL(dummyAvailableCredits, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_AvailableCredits))).listEntry (HELPER_IsPPJ.getForSQL(dummyIsPPJ, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_IsPPJ))).listEntry (HELPER_HasCap.getForSQL(dummyHasCap, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HasCap))).listEntry (HELPER_MaxCap.getForSQL(dummyMaxCap, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_MaxCap))).listEntry (HELPER_CouponExpiryDate.getForSQL(dummyCouponExpiryDate, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_CouponExpiryDate))).listEntry (HELPER_LastPlanAmount.getForSQL(dummyLastPlanAmount, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_LastPlanAmount))).listEntry (HELPER_GoogleAddressText.getForSQL(dummyGoogleAddressText, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_GoogleAddressText))).listEntry (HELPER_PlanCancelled.getForSQL(dummyPlanCancelled, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_PlanCancelled))).listEntry (HELPER_OnTrial.getForSQL(dummyOnTrial, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_OnTrial))).listEntry (HELPER_TrialJobCount.getForSQL(dummyTrialJobCount, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_TrialJobCount))).listEntry (HELPER_MessageID.getForSQL(dummyMessageID, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_MessageID))).listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_Company)))).listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_BilledByTeam)))).listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_AddedByUser)))).listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_PaymentPlan)))).listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_Coupon)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray()); CollectionUtils.listEntry (HELPER_HiringTeamName.getForSQL(dummyHiringTeamName, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HiringTeamName))).listEntry (HELPER_HiringTeamLogo.getForSQL(dummyHiringTeamLogo, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HiringTeamLogo))).listEntry (HELPER_HiringTeamType.getForSQL(dummyHiringTeamType, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HiringTeamType))).listEntry (HELPER_Industry.getForSQL(dummyIndustry, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_Industry))).listEntry (HELPER_TimeZone.getForSQL(dummyTimeZone, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_TimeZone))).listEntry (HELPER_State.getForSQL(dummyState, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_State))).listEntry (HELPER_Country.getForSQL(dummyCountry, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_Country))).listEntry (HELPER_PostCode.getForSQL(dummyPostCode, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_PostCode))).listEntry (HELPER_City.getForSQL(dummyCity, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_City))).listEntry (HELPER_HasClientSupport.getForSQL(dummyHasClientSupport, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HasClientSupport))).listEntry (HELPER_HasDiversity.getForSQL(dummyHasDiversity, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HasDiversity))).listEntry (HELPER_ManageOwnBilling.getForSQL(dummyManageOwnBilling, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_ManageOwnBilling))).listEntry (HELPER_StripeReference.getForSQL(dummyStripeReference, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_StripeReference))).listEntry (HELPER_StripeSubscription.getForSQL(dummyStripeSubscription, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_StripeSubscription))).listEntry (HELPER_StripeFixedSubItem.getForSQL(dummyStripeFixedSubItem, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_StripeFixedSubItem))).listEntry (HELPER_StripeMeteredSubItem.getForSQL(dummyStripeMeteredSubItem, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_StripeMeteredSubItem))).listEntry (HELPER_NameOnCard.getForSQL(dummyNameOnCard, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_NameOnCard))).listEntry (HELPER_CardPostCode.getForSQL(dummyCardPostCode, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_CardPostCode))).listEntry (HELPER_CardID.getForSQL(dummyCardID, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_CardID))).listEntry (HELPER_PlanRenewedOn.getForSQL(dummyPlanRenewedOn, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_PlanRenewedOn))).listEntry (HELPER_PPJCredits.getForSQL(dummyPPJCredits, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_PPJCredits))).listEntry (HELPER_UsedCredits.getForSQL(dummyUsedCredits, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_UsedCredits))).listEntry (HELPER_AvailableCredits.getForSQL(dummyAvailableCredits, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_AvailableCredits))).listEntry (HELPER_IsPPJ.getForSQL(dummyIsPPJ, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_IsPPJ))).listEntry (HELPER_HasCap.getForSQL(dummyHasCap, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HasCap))).listEntry (HELPER_MaxCap.getForSQL(dummyMaxCap, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_MaxCap))).listEntry (HELPER_CouponExpiryDate.getForSQL(dummyCouponExpiryDate, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_CouponExpiryDate))).listEntry (HELPER_LastPlanAmount.getForSQL(dummyLastPlanAmount, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_LastPlanAmount))).listEntry (HELPER_GoogleAddressText.getForSQL(dummyGoogleAddressText, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_GoogleAddressText))).listEntry (HELPER_PlanCancelled.getForSQL(dummyPlanCancelled, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_PlanCancelled))).listEntry (HELPER_OnTrial.getForSQL(dummyOnTrial, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_OnTrial))).listEntry (HELPER_TrialJobCount.getForSQL(dummyTrialJobCount, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_TrialJobCount))).listEntry (HELPER_MessageID.getForSQL(dummyMessageID, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_MessageID))).listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_Company)))).listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_BilledByTeam)))).listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_AddedByUser)))).listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_PaymentPlan)))).listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_Coupon)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
if (rowsUpdated != 1) if (rowsUpdated != 1)
{ {
...@@ -624,6 +628,7 @@ public class HiringTeamPersistenceMgr extends ObjectPersistenceMgr ...@@ -624,6 +628,7 @@ public class HiringTeamPersistenceMgr extends ObjectPersistenceMgr
tl_hiring_teamPSet.setAttrib(HiringTeam.FIELD_PostCode, HELPER_PostCode.getFromRS(dummyPostCode, r, "post_code")); tl_hiring_teamPSet.setAttrib(HiringTeam.FIELD_PostCode, HELPER_PostCode.getFromRS(dummyPostCode, r, "post_code"));
tl_hiring_teamPSet.setAttrib(HiringTeam.FIELD_City, HELPER_City.getFromRS(dummyCity, r, "city")); tl_hiring_teamPSet.setAttrib(HiringTeam.FIELD_City, HELPER_City.getFromRS(dummyCity, r, "city"));
tl_hiring_teamPSet.setAttrib(HiringTeam.FIELD_HasClientSupport, HELPER_HasClientSupport.getFromRS(dummyHasClientSupport, r, "has_client_support")); tl_hiring_teamPSet.setAttrib(HiringTeam.FIELD_HasClientSupport, HELPER_HasClientSupport.getFromRS(dummyHasClientSupport, r, "has_client_support"));
tl_hiring_teamPSet.setAttrib(HiringTeam.FIELD_HasDiversity, HELPER_HasDiversity.getFromRS(dummyHasDiversity, r, "has_diversity"));
tl_hiring_teamPSet.setAttrib(HiringTeam.FIELD_ManageOwnBilling, HELPER_ManageOwnBilling.getFromRS(dummyManageOwnBilling, r, "manage_own_billing")); tl_hiring_teamPSet.setAttrib(HiringTeam.FIELD_ManageOwnBilling, HELPER_ManageOwnBilling.getFromRS(dummyManageOwnBilling, r, "manage_own_billing"));
tl_hiring_teamPSet.setAttrib(HiringTeam.FIELD_StripeReference, HELPER_StripeReference.getFromRS(dummyStripeReference, r, "stripe_reference")); tl_hiring_teamPSet.setAttrib(HiringTeam.FIELD_StripeReference, HELPER_StripeReference.getFromRS(dummyStripeReference, r, "stripe_reference"));
tl_hiring_teamPSet.setAttrib(HiringTeam.FIELD_StripeSubscription, HELPER_StripeSubscription.getFromRS(dummyStripeSubscription, r, "stripe_subscription")); tl_hiring_teamPSet.setAttrib(HiringTeam.FIELD_StripeSubscription, HELPER_StripeSubscription.getFromRS(dummyStripeSubscription, r, "stripe_subscription"));
...@@ -668,10 +673,10 @@ public class HiringTeamPersistenceMgr extends ObjectPersistenceMgr ...@@ -668,10 +673,10 @@ public class HiringTeamPersistenceMgr extends ObjectPersistenceMgr
{ {
executeStatement (sqlMgr, executeStatement (sqlMgr,
"INSERT INTO {PREFIX}tl_hiring_team " + "INSERT INTO {PREFIX}tl_hiring_team " +
" (hiring_team_name, hiring_team_logo, hiring_team_type, industry, time_zone, state, country, post_code, city, has_client_support, manage_own_billing, stripe_reference, stripe_subscription, stripe_fixed_sub_item, stripe_metered_sub_item, name_on_card, card_post_code, card_id, plan_renewed_on, ppj_credits, used_credits, available_credits, is_ppj, has_cap, max_cap, coupon_expiry_date, last_plan_amount, google_address_text, plan_cancelled, on_trial, trial_job_count, message_id, company_id, billing_team_id, added_by_user_id, payment_plan_id, coupon_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " + " (hiring_team_name, hiring_team_logo, hiring_team_type, industry, time_zone, state, country, post_code, city, has_client_support, has_diversity, manage_own_billing, stripe_reference, stripe_subscription, stripe_fixed_sub_item, stripe_metered_sub_item, name_on_card, card_post_code, card_id, plan_renewed_on, ppj_credits, used_credits, available_credits, is_ppj, has_cap, max_cap, coupon_expiry_date, last_plan_amount, google_address_text, plan_cancelled, on_trial, trial_job_count, message_id, company_id, billing_team_id, added_by_user_id, payment_plan_id, coupon_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 (HELPER_HiringTeamName.getForSQL(dummyHiringTeamName, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HiringTeamName))).listEntry (HELPER_HiringTeamLogo.getForSQL(dummyHiringTeamLogo, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HiringTeamLogo))).listEntry (HELPER_HiringTeamType.getForSQL(dummyHiringTeamType, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HiringTeamType))).listEntry (HELPER_Industry.getForSQL(dummyIndustry, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_Industry))).listEntry (HELPER_TimeZone.getForSQL(dummyTimeZone, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_TimeZone))).listEntry (HELPER_State.getForSQL(dummyState, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_State))).listEntry (HELPER_Country.getForSQL(dummyCountry, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_Country))).listEntry (HELPER_PostCode.getForSQL(dummyPostCode, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_PostCode))).listEntry (HELPER_City.getForSQL(dummyCity, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_City))).listEntry (HELPER_HasClientSupport.getForSQL(dummyHasClientSupport, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HasClientSupport))).listEntry (HELPER_ManageOwnBilling.getForSQL(dummyManageOwnBilling, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_ManageOwnBilling))).listEntry (HELPER_StripeReference.getForSQL(dummyStripeReference, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_StripeReference))).listEntry (HELPER_StripeSubscription.getForSQL(dummyStripeSubscription, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_StripeSubscription))).listEntry (HELPER_StripeFixedSubItem.getForSQL(dummyStripeFixedSubItem, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_StripeFixedSubItem))).listEntry (HELPER_StripeMeteredSubItem.getForSQL(dummyStripeMeteredSubItem, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_StripeMeteredSubItem))).listEntry (HELPER_NameOnCard.getForSQL(dummyNameOnCard, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_NameOnCard))).listEntry (HELPER_CardPostCode.getForSQL(dummyCardPostCode, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_CardPostCode))).listEntry (HELPER_CardID.getForSQL(dummyCardID, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_CardID))).listEntry (HELPER_PlanRenewedOn.getForSQL(dummyPlanRenewedOn, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_PlanRenewedOn))).listEntry (HELPER_PPJCredits.getForSQL(dummyPPJCredits, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_PPJCredits))).listEntry (HELPER_UsedCredits.getForSQL(dummyUsedCredits, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_UsedCredits))).listEntry (HELPER_AvailableCredits.getForSQL(dummyAvailableCredits, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_AvailableCredits))).listEntry (HELPER_IsPPJ.getForSQL(dummyIsPPJ, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_IsPPJ))).listEntry (HELPER_HasCap.getForSQL(dummyHasCap, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HasCap))).listEntry (HELPER_MaxCap.getForSQL(dummyMaxCap, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_MaxCap))).listEntry (HELPER_CouponExpiryDate.getForSQL(dummyCouponExpiryDate, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_CouponExpiryDate))).listEntry (HELPER_LastPlanAmount.getForSQL(dummyLastPlanAmount, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_LastPlanAmount))).listEntry (HELPER_GoogleAddressText.getForSQL(dummyGoogleAddressText, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_GoogleAddressText))).listEntry (HELPER_PlanCancelled.getForSQL(dummyPlanCancelled, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_PlanCancelled))).listEntry (HELPER_OnTrial.getForSQL(dummyOnTrial, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_OnTrial))).listEntry (HELPER_TrialJobCount.getForSQL(dummyTrialJobCount, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_TrialJobCount))).listEntry (HELPER_MessageID.getForSQL(dummyMessageID, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_MessageID))) .listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_Company)))).listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_BilledByTeam)))).listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_AddedByUser)))).listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_PaymentPlan)))).listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_Coupon)))) .listEntry (objectID.longID ()).toList().toArray()); CollectionUtils.listEntry (HELPER_HiringTeamName.getForSQL(dummyHiringTeamName, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HiringTeamName))).listEntry (HELPER_HiringTeamLogo.getForSQL(dummyHiringTeamLogo, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HiringTeamLogo))).listEntry (HELPER_HiringTeamType.getForSQL(dummyHiringTeamType, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HiringTeamType))).listEntry (HELPER_Industry.getForSQL(dummyIndustry, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_Industry))).listEntry (HELPER_TimeZone.getForSQL(dummyTimeZone, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_TimeZone))).listEntry (HELPER_State.getForSQL(dummyState, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_State))).listEntry (HELPER_Country.getForSQL(dummyCountry, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_Country))).listEntry (HELPER_PostCode.getForSQL(dummyPostCode, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_PostCode))).listEntry (HELPER_City.getForSQL(dummyCity, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_City))).listEntry (HELPER_HasClientSupport.getForSQL(dummyHasClientSupport, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HasClientSupport))).listEntry (HELPER_HasDiversity.getForSQL(dummyHasDiversity, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HasDiversity))).listEntry (HELPER_ManageOwnBilling.getForSQL(dummyManageOwnBilling, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_ManageOwnBilling))).listEntry (HELPER_StripeReference.getForSQL(dummyStripeReference, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_StripeReference))).listEntry (HELPER_StripeSubscription.getForSQL(dummyStripeSubscription, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_StripeSubscription))).listEntry (HELPER_StripeFixedSubItem.getForSQL(dummyStripeFixedSubItem, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_StripeFixedSubItem))).listEntry (HELPER_StripeMeteredSubItem.getForSQL(dummyStripeMeteredSubItem, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_StripeMeteredSubItem))).listEntry (HELPER_NameOnCard.getForSQL(dummyNameOnCard, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_NameOnCard))).listEntry (HELPER_CardPostCode.getForSQL(dummyCardPostCode, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_CardPostCode))).listEntry (HELPER_CardID.getForSQL(dummyCardID, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_CardID))).listEntry (HELPER_PlanRenewedOn.getForSQL(dummyPlanRenewedOn, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_PlanRenewedOn))).listEntry (HELPER_PPJCredits.getForSQL(dummyPPJCredits, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_PPJCredits))).listEntry (HELPER_UsedCredits.getForSQL(dummyUsedCredits, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_UsedCredits))).listEntry (HELPER_AvailableCredits.getForSQL(dummyAvailableCredits, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_AvailableCredits))).listEntry (HELPER_IsPPJ.getForSQL(dummyIsPPJ, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_IsPPJ))).listEntry (HELPER_HasCap.getForSQL(dummyHasCap, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HasCap))).listEntry (HELPER_MaxCap.getForSQL(dummyMaxCap, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_MaxCap))).listEntry (HELPER_CouponExpiryDate.getForSQL(dummyCouponExpiryDate, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_CouponExpiryDate))).listEntry (HELPER_LastPlanAmount.getForSQL(dummyLastPlanAmount, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_LastPlanAmount))).listEntry (HELPER_GoogleAddressText.getForSQL(dummyGoogleAddressText, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_GoogleAddressText))).listEntry (HELPER_PlanCancelled.getForSQL(dummyPlanCancelled, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_PlanCancelled))).listEntry (HELPER_OnTrial.getForSQL(dummyOnTrial, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_OnTrial))).listEntry (HELPER_TrialJobCount.getForSQL(dummyTrialJobCount, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_TrialJobCount))).listEntry (HELPER_MessageID.getForSQL(dummyMessageID, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_MessageID))) .listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_Company)))).listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_BilledByTeam)))).listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_AddedByUser)))).listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_PaymentPlan)))).listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_Coupon)))) .listEntry (objectID.longID ()).toList().toArray());
tl_hiring_teamPSet.setStatus (PersistentSetStatus.PROCESSED); tl_hiring_teamPSet.setStatus (PersistentSetStatus.PROCESSED);
} }
......
...@@ -88,6 +88,11 @@ public class Job extends BaseJob ...@@ -88,6 +88,11 @@ public class Job extends BaseJob
{ {
setGoogleAddressText(hiringTeam.getGoogleAddressText()); setGoogleAddressText(hiringTeam.getGoogleAddressText());
} }
if(hiringTeam.showHasDiversity())
{
setDiversityIncluded(Boolean.TRUE);
}
} }
...@@ -805,7 +810,24 @@ public class Job extends BaseJob ...@@ -805,7 +810,24 @@ public class Job extends BaseJob
{ {
return getOccupation(); return getOccupation();
} }
public boolean hasDiversityQuestions()
{
Filter<HTDiversityQuestion> filter = HTDiversityQuestion.SearchByAll().andIsApplicable(new EqualsFilter<>(Boolean.TRUE));
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 new HashSet();
}
public int getApplicableCultureCount() public int getApplicableCultureCount()
{ {
Filter<CultureCriteria> filter = CultureCriteria.SearchByAll().andIsApplicable(new EqualsFilter<>(Boolean.TRUE)); Filter<CultureCriteria> filter = CultureCriteria.SearchByAll().andIsApplicable(new EqualsFilter<>(Boolean.TRUE));
...@@ -819,4 +841,16 @@ public class Job extends BaseJob ...@@ -819,4 +841,16 @@ public class Job extends BaseJob
return pipelineJob().toCultureCriterias(filter).uniqueVals(); return pipelineJob().toCultureCriterias(filter).uniqueVals();
} }
public DiversityQuestion getQuestionByFilter(AppFilter filter)
{
if(hasDiversityQuestions())
{
Filter<DiversityQuestion> diversityFilter = DiversityQuestion.SearchByAll().andCode(new EqualsFilter<>(filter.getName()));
return pipelineJob().toHiringTeam().toDiversityQuestions().toQuestion(diversityFilter).val();
}
return null;
}
} }
\ No newline at end of file
...@@ -59,6 +59,7 @@ ...@@ -59,6 +59,7 @@
<ATTRIB name="CultureStatement" type="String" dbcol="culture_statement" length="2000"/> <ATTRIB name="CultureStatement" type="String" dbcol="culture_statement" length="2000"/>
<ATTRIB name="DraftLocation" type="DraftLocation" dbcol="draft_location" attribHelper="EnumeratedAttributeHelper"/> <ATTRIB name="DraftLocation" type="DraftLocation" dbcol="draft_location" attribHelper="EnumeratedAttributeHelper"/>
<ATTRIB name="GoogleAddressText" type="String" dbcol="google_address_text" mandatory="true" length="300" /> <ATTRIB name="GoogleAddressText" type="String" dbcol="google_address_text" mandatory="true" length="300" />
<ATTRIB name="DiversityIncluded" type="Boolean" dbcol="diversity_included" defaultValue="Boolean.FALSE"/>
<SINGLEREFERENCE name="Level" type="Level" dbcol="level_id" mandatory="false"/> <SINGLEREFERENCE name="Level" type="Level" dbcol="level_id" mandatory="false"/>
<SINGLEREFERENCE name="Client" type="Client" dbcol="client_id" backreferenceName="Jobs"/> <SINGLEREFERENCE name="Client" type="Client" dbcol="client_id" backreferenceName="Jobs"/>
......
...@@ -199,6 +199,71 @@ public class JobApplication extends BaseJobApplication ...@@ -199,6 +199,71 @@ public class JobApplication extends BaseJobApplication
return safeRedirect; return safeRedirect;
} }
public boolean createDiversityAnswerObjects() throws FieldException
{
boolean safeRedirect = false;
Candidate candidate = getCandidate();
//to skip diversity test
if(!isDiversityIncluded() || diversityCompleted())
{
return safeRedirect;
}
for(HTDiversityQuestion htQuestion : getJob().getDiversityQuestions())
{
DiversityQuestion question = htQuestion.getQuestion();
boolean available = false;
for(CandidateDiversityAnswer answer : getCandidate().getDiversityAnswersSet())
{
if(answer.getQuestion().equals(question))
{
available = true;
break;
}
}
if(!available)
{
CandidateDiversityAnswer answer = CandidateDiversityAnswer.createCandidateDiversityAnswer(getTransaction());
if(question.getMultipleAnswers())
{
for(DiversityAnswer diversityAnswer : question.getAnswersSet())
{
AnswerOption answerOption = AnswerOption.createAnswerOption(getTransaction());
answer.addToAnswers(answerOption);
answerOption.setAnswer(diversityAnswer);
}
}
candidate.addToDiversityAnswers(answer);
answer.setQuestion(question);
safeRedirect = true;
}
}
return safeRedirect;
}
public void setDiversityAnswerOptions() throws StorageException, FieldException
{
for(CandidateDiversityAnswer candidateAnswer : pipelineJobApplication().toCandidate().toDiversityAnswers().uniqueVals())
{
if(!candidateAnswer.getQuestion().getMultipleAnswers())
{
AnswerOption answerOption = candidateAnswer.pipelineCandidateDiversityAnswer().toAnswers().val();
if(answerOption != null && answerOption.getAnswer() != null && answerOption.isTrue(answerOption.getIsSelected()))
{
candidateAnswer.setAnswerOption(answerOption.getAnswer());
}
}
}
}
public Answer getAnswerForQuestion(Question question) throws FieldException public Answer getAnswerForQuestion(Question question) throws FieldException
{ {
...@@ -254,6 +319,11 @@ public class JobApplication extends BaseJobApplication ...@@ -254,6 +319,11 @@ public class JobApplication extends BaseJobApplication
return isIncludeCultureCriteria() ? getCandidate().cultureCompleted(getJob()) : true; return isIncludeCultureCriteria() ? getCandidate().cultureCompleted(getJob()) : true;
} }
public boolean diversityCompleted()
{
return getCandidate().diversityCompleted(getJob());
}
public boolean assessmentCompleted() //role public boolean assessmentCompleted() //role
{ {
...@@ -287,6 +357,11 @@ public class JobApplication extends BaseJobApplication ...@@ -287,6 +357,11 @@ public class JobApplication extends BaseJobApplication
{ {
return getJob() != null && isTrue(getJob().getIncludeCulture()); return getJob() != null && isTrue(getJob().getIncludeCulture());
} }
public boolean isDiversityIncluded()
{
return getJob() != null && getJob().hasDiversityQuestions();
}
@Override @Override
public Map getRoleFit() public Map getRoleFit()
......
...@@ -54,6 +54,7 @@ public class JobPersistenceMgr extends ObjectPersistenceMgr ...@@ -54,6 +54,7 @@ public class JobPersistenceMgr extends ObjectPersistenceMgr
private String dummyCultureStatement; private String dummyCultureStatement;
private DraftLocation dummyDraftLocation; private DraftLocation dummyDraftLocation;
private String dummyGoogleAddressText; private String dummyGoogleAddressText;
private Boolean dummyDiversityIncluded;
// Static constants corresponding to attribute helpers // Static constants corresponding to attribute helpers
...@@ -83,6 +84,7 @@ public class JobPersistenceMgr extends ObjectPersistenceMgr ...@@ -83,6 +84,7 @@ public class JobPersistenceMgr extends ObjectPersistenceMgr
private static final DefaultAttributeHelper HELPER_CultureStatement = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper HELPER_CultureStatement = DefaultAttributeHelper.INSTANCE;
private static final EnumeratedAttributeHelper HELPER_DraftLocation = new EnumeratedAttributeHelper (DraftLocation.FACTORY_DraftLocation); private static final EnumeratedAttributeHelper HELPER_DraftLocation = new EnumeratedAttributeHelper (DraftLocation.FACTORY_DraftLocation);
private static final DefaultAttributeHelper HELPER_GoogleAddressText = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper HELPER_GoogleAddressText = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_DiversityIncluded = DefaultAttributeHelper.INSTANCE;
...@@ -115,10 +117,11 @@ public class JobPersistenceMgr extends ObjectPersistenceMgr ...@@ -115,10 +117,11 @@ public class JobPersistenceMgr extends ObjectPersistenceMgr
dummyCultureStatement = (String)(HELPER_CultureStatement.initialise (dummyCultureStatement)); dummyCultureStatement = (String)(HELPER_CultureStatement.initialise (dummyCultureStatement));
dummyDraftLocation = (DraftLocation)(HELPER_DraftLocation.initialise (dummyDraftLocation)); dummyDraftLocation = (DraftLocation)(HELPER_DraftLocation.initialise (dummyDraftLocation));
dummyGoogleAddressText = (String)(HELPER_GoogleAddressText.initialise (dummyGoogleAddressText)); dummyGoogleAddressText = (String)(HELPER_GoogleAddressText.initialise (dummyGoogleAddressText));
dummyDiversityIncluded = (Boolean)(HELPER_DiversityIncluded.initialise (dummyDiversityIncluded));
} }
private String SELECT_COLUMNS = "{PREFIX}tl_job.object_id as id, {PREFIX}tl_job.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_job.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_job.job_title, {PREFIX}tl_job.job_description, {PREFIX}tl_job.job_status, {PREFIX}tl_job.open_date, {PREFIX}tl_job.apply_by, {PREFIX}tl_job.include_assessment_criteria, {PREFIX}tl_job.include_culture, {PREFIX}tl_job.assessment_type, {PREFIX}tl_job.random_key, {PREFIX}tl_job.job_type, {PREFIX}tl_job.ref_number, {PREFIX}tl_job.last_status_change_date, {PREFIX}tl_job.remote, {PREFIX}tl_job.city, {PREFIX}tl_job.postcode, {PREFIX}tl_job.location_radius, {PREFIX}tl_job.state, {PREFIX}tl_job.country, {PREFIX}tl_job.require_cv, {PREFIX}tl_job.manually_closed, {PREFIX}tl_job.last_edited, {PREFIX}tl_job.is_ppj, {PREFIX}tl_job.industry, {PREFIX}tl_job.culture_statement, {PREFIX}tl_job.draft_location, {PREFIX}tl_job.google_address_text, {PREFIX}tl_job.level_id, {PREFIX}tl_job.client_id, {PREFIX}tl_job.job_owner_id, {PREFIX}tl_job.company_user_id, {PREFIX}tl_job.hiring_team_id, {PREFIX}tl_job.occupation_id, {PREFIX}tl_job.shortened_url_id, {PREFIX}tl_job.template_id, {PREFIX}tl_job.job_title_id, 1 AS commasafe "; private String SELECT_COLUMNS = "{PREFIX}tl_job.object_id as id, {PREFIX}tl_job.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_job.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_job.job_title, {PREFIX}tl_job.job_description, {PREFIX}tl_job.job_status, {PREFIX}tl_job.open_date, {PREFIX}tl_job.apply_by, {PREFIX}tl_job.include_assessment_criteria, {PREFIX}tl_job.include_culture, {PREFIX}tl_job.assessment_type, {PREFIX}tl_job.random_key, {PREFIX}tl_job.job_type, {PREFIX}tl_job.ref_number, {PREFIX}tl_job.last_status_change_date, {PREFIX}tl_job.remote, {PREFIX}tl_job.city, {PREFIX}tl_job.postcode, {PREFIX}tl_job.location_radius, {PREFIX}tl_job.state, {PREFIX}tl_job.country, {PREFIX}tl_job.require_cv, {PREFIX}tl_job.manually_closed, {PREFIX}tl_job.last_edited, {PREFIX}tl_job.is_ppj, {PREFIX}tl_job.industry, {PREFIX}tl_job.culture_statement, {PREFIX}tl_job.draft_location, {PREFIX}tl_job.google_address_text, {PREFIX}tl_job.diversity_included, {PREFIX}tl_job.level_id, {PREFIX}tl_job.client_id, {PREFIX}tl_job.job_owner_id, {PREFIX}tl_job.company_user_id, {PREFIX}tl_job.hiring_team_id, {PREFIX}tl_job.occupation_id, {PREFIX}tl_job.shortened_url_id, {PREFIX}tl_job.template_id, {PREFIX}tl_job.job_title_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
...@@ -195,6 +198,7 @@ public class JobPersistenceMgr extends ObjectPersistenceMgr ...@@ -195,6 +198,7 @@ public class JobPersistenceMgr extends ObjectPersistenceMgr
!tl_jobPSet.containsAttrib(Job.FIELD_CultureStatement)|| !tl_jobPSet.containsAttrib(Job.FIELD_CultureStatement)||
!tl_jobPSet.containsAttrib(Job.FIELD_DraftLocation)|| !tl_jobPSet.containsAttrib(Job.FIELD_DraftLocation)||
!tl_jobPSet.containsAttrib(Job.FIELD_GoogleAddressText)|| !tl_jobPSet.containsAttrib(Job.FIELD_GoogleAddressText)||
!tl_jobPSet.containsAttrib(Job.FIELD_DiversityIncluded)||
!tl_jobPSet.containsAttrib(Job.SINGLEREFERENCE_Level)|| !tl_jobPSet.containsAttrib(Job.SINGLEREFERENCE_Level)||
!tl_jobPSet.containsAttrib(Job.SINGLEREFERENCE_Client)|| !tl_jobPSet.containsAttrib(Job.SINGLEREFERENCE_Client)||
!tl_jobPSet.containsAttrib(Job.SINGLEREFERENCE_JobOwner)|| !tl_jobPSet.containsAttrib(Job.SINGLEREFERENCE_JobOwner)||
...@@ -283,10 +287,10 @@ public class JobPersistenceMgr extends ObjectPersistenceMgr ...@@ -283,10 +287,10 @@ public class JobPersistenceMgr extends ObjectPersistenceMgr
{ {
int rowsUpdated = executeStatement (sqlMgr, int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}tl_job " + "UPDATE {PREFIX}tl_job " +
"SET job_title = ?, job_description = ?, job_status = ?, open_date = ?, apply_by = ?, include_assessment_criteria = ?, include_culture = ?, assessment_type = ?, random_key = ?, job_type = ?, ref_number = ?, last_status_change_date = ?, remote = ?, city = ?, postcode = ?, location_radius = ?, state = ?, country = ?, require_cv = ?, manually_closed = ?, last_edited = ?, is_ppj = ?, industry = ?, culture_statement = ?, draft_location = ?, google_address_text = ?, level_id = ? , client_id = ? , job_owner_id = ? , company_user_id = ? , hiring_team_id = ? , occupation_id = ? , shortened_url_id = ? , template_id = ? , job_title_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " + "SET job_title = ?, job_description = ?, job_status = ?, open_date = ?, apply_by = ?, include_assessment_criteria = ?, include_culture = ?, assessment_type = ?, random_key = ?, job_type = ?, ref_number = ?, last_status_change_date = ?, remote = ?, city = ?, postcode = ?, location_radius = ?, state = ?, country = ?, require_cv = ?, manually_closed = ?, last_edited = ?, is_ppj = ?, industry = ?, culture_statement = ?, draft_location = ?, google_address_text = ?, diversity_included = ?, level_id = ? , client_id = ? , job_owner_id = ? , company_user_id = ? , hiring_team_id = ? , occupation_id = ? , shortened_url_id = ? , template_id = ? , job_title_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE tl_job.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ", "WHERE tl_job.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_JobTitle.getForSQL(dummyJobTitle, tl_jobPSet.getAttrib (Job.FIELD_JobTitle))).listEntry (HELPER_JobDescription.getForSQL(dummyJobDescription, tl_jobPSet.getAttrib (Job.FIELD_JobDescription))).listEntry (HELPER_JobStatus.getForSQL(dummyJobStatus, tl_jobPSet.getAttrib (Job.FIELD_JobStatus))).listEntry (HELPER_OpenDate.getForSQL(dummyOpenDate, tl_jobPSet.getAttrib (Job.FIELD_OpenDate))).listEntry (HELPER_ApplyBy.getForSQL(dummyApplyBy, tl_jobPSet.getAttrib (Job.FIELD_ApplyBy))).listEntry (HELPER_IncludeAssessmentCriteria.getForSQL(dummyIncludeAssessmentCriteria, tl_jobPSet.getAttrib (Job.FIELD_IncludeAssessmentCriteria))).listEntry (HELPER_IncludeCulture.getForSQL(dummyIncludeCulture, tl_jobPSet.getAttrib (Job.FIELD_IncludeCulture))).listEntry (HELPER_AssessmentType.getForSQL(dummyAssessmentType, tl_jobPSet.getAttrib (Job.FIELD_AssessmentType))).listEntry (HELPER_RandomKey.getForSQL(dummyRandomKey, tl_jobPSet.getAttrib (Job.FIELD_RandomKey))).listEntry (HELPER_JobType.getForSQL(dummyJobType, tl_jobPSet.getAttrib (Job.FIELD_JobType))).listEntry (HELPER_ReferenceNumber.getForSQL(dummyReferenceNumber, tl_jobPSet.getAttrib (Job.FIELD_ReferenceNumber))).listEntry (HELPER_LastStatusChangeDate.getForSQL(dummyLastStatusChangeDate, tl_jobPSet.getAttrib (Job.FIELD_LastStatusChangeDate))).listEntry (HELPER_Remote.getForSQL(dummyRemote, tl_jobPSet.getAttrib (Job.FIELD_Remote))).listEntry (HELPER_City.getForSQL(dummyCity, tl_jobPSet.getAttrib (Job.FIELD_City))).listEntry (HELPER_PostCode.getForSQL(dummyPostCode, tl_jobPSet.getAttrib (Job.FIELD_PostCode))).listEntry (HELPER_ExpectedCandidateRadius.getForSQL(dummyExpectedCandidateRadius, tl_jobPSet.getAttrib (Job.FIELD_ExpectedCandidateRadius))).listEntry (HELPER_State.getForSQL(dummyState, tl_jobPSet.getAttrib (Job.FIELD_State))).listEntry (HELPER_Country.getForSQL(dummyCountry, tl_jobPSet.getAttrib (Job.FIELD_Country))).listEntry (HELPER_RequireCV.getForSQL(dummyRequireCV, tl_jobPSet.getAttrib (Job.FIELD_RequireCV))).listEntry (HELPER_IsManuallyClosed.getForSQL(dummyIsManuallyClosed, tl_jobPSet.getAttrib (Job.FIELD_IsManuallyClosed))).listEntry (HELPER_LastEdited.getForSQL(dummyLastEdited, tl_jobPSet.getAttrib (Job.FIELD_LastEdited))).listEntry (HELPER_IsPPJ.getForSQL(dummyIsPPJ, tl_jobPSet.getAttrib (Job.FIELD_IsPPJ))).listEntry (HELPER_Industry.getForSQL(dummyIndustry, tl_jobPSet.getAttrib (Job.FIELD_Industry))).listEntry (HELPER_CultureStatement.getForSQL(dummyCultureStatement, tl_jobPSet.getAttrib (Job.FIELD_CultureStatement))).listEntry (HELPER_DraftLocation.getForSQL(dummyDraftLocation, tl_jobPSet.getAttrib (Job.FIELD_DraftLocation))).listEntry (HELPER_GoogleAddressText.getForSQL(dummyGoogleAddressText, tl_jobPSet.getAttrib (Job.FIELD_GoogleAddressText))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_Level)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_Client)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_JobOwner)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_CreatedBy)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_HiringTeam)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_Occupation)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_ShortenedURL)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_AssessmentTemplate)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_ILOJobTitle)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray()); CollectionUtils.listEntry (HELPER_JobTitle.getForSQL(dummyJobTitle, tl_jobPSet.getAttrib (Job.FIELD_JobTitle))).listEntry (HELPER_JobDescription.getForSQL(dummyJobDescription, tl_jobPSet.getAttrib (Job.FIELD_JobDescription))).listEntry (HELPER_JobStatus.getForSQL(dummyJobStatus, tl_jobPSet.getAttrib (Job.FIELD_JobStatus))).listEntry (HELPER_OpenDate.getForSQL(dummyOpenDate, tl_jobPSet.getAttrib (Job.FIELD_OpenDate))).listEntry (HELPER_ApplyBy.getForSQL(dummyApplyBy, tl_jobPSet.getAttrib (Job.FIELD_ApplyBy))).listEntry (HELPER_IncludeAssessmentCriteria.getForSQL(dummyIncludeAssessmentCriteria, tl_jobPSet.getAttrib (Job.FIELD_IncludeAssessmentCriteria))).listEntry (HELPER_IncludeCulture.getForSQL(dummyIncludeCulture, tl_jobPSet.getAttrib (Job.FIELD_IncludeCulture))).listEntry (HELPER_AssessmentType.getForSQL(dummyAssessmentType, tl_jobPSet.getAttrib (Job.FIELD_AssessmentType))).listEntry (HELPER_RandomKey.getForSQL(dummyRandomKey, tl_jobPSet.getAttrib (Job.FIELD_RandomKey))).listEntry (HELPER_JobType.getForSQL(dummyJobType, tl_jobPSet.getAttrib (Job.FIELD_JobType))).listEntry (HELPER_ReferenceNumber.getForSQL(dummyReferenceNumber, tl_jobPSet.getAttrib (Job.FIELD_ReferenceNumber))).listEntry (HELPER_LastStatusChangeDate.getForSQL(dummyLastStatusChangeDate, tl_jobPSet.getAttrib (Job.FIELD_LastStatusChangeDate))).listEntry (HELPER_Remote.getForSQL(dummyRemote, tl_jobPSet.getAttrib (Job.FIELD_Remote))).listEntry (HELPER_City.getForSQL(dummyCity, tl_jobPSet.getAttrib (Job.FIELD_City))).listEntry (HELPER_PostCode.getForSQL(dummyPostCode, tl_jobPSet.getAttrib (Job.FIELD_PostCode))).listEntry (HELPER_ExpectedCandidateRadius.getForSQL(dummyExpectedCandidateRadius, tl_jobPSet.getAttrib (Job.FIELD_ExpectedCandidateRadius))).listEntry (HELPER_State.getForSQL(dummyState, tl_jobPSet.getAttrib (Job.FIELD_State))).listEntry (HELPER_Country.getForSQL(dummyCountry, tl_jobPSet.getAttrib (Job.FIELD_Country))).listEntry (HELPER_RequireCV.getForSQL(dummyRequireCV, tl_jobPSet.getAttrib (Job.FIELD_RequireCV))).listEntry (HELPER_IsManuallyClosed.getForSQL(dummyIsManuallyClosed, tl_jobPSet.getAttrib (Job.FIELD_IsManuallyClosed))).listEntry (HELPER_LastEdited.getForSQL(dummyLastEdited, tl_jobPSet.getAttrib (Job.FIELD_LastEdited))).listEntry (HELPER_IsPPJ.getForSQL(dummyIsPPJ, tl_jobPSet.getAttrib (Job.FIELD_IsPPJ))).listEntry (HELPER_Industry.getForSQL(dummyIndustry, tl_jobPSet.getAttrib (Job.FIELD_Industry))).listEntry (HELPER_CultureStatement.getForSQL(dummyCultureStatement, tl_jobPSet.getAttrib (Job.FIELD_CultureStatement))).listEntry (HELPER_DraftLocation.getForSQL(dummyDraftLocation, tl_jobPSet.getAttrib (Job.FIELD_DraftLocation))).listEntry (HELPER_GoogleAddressText.getForSQL(dummyGoogleAddressText, tl_jobPSet.getAttrib (Job.FIELD_GoogleAddressText))).listEntry (HELPER_DiversityIncluded.getForSQL(dummyDiversityIncluded, tl_jobPSet.getAttrib (Job.FIELD_DiversityIncluded))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_Level)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_Client)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_JobOwner)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_CreatedBy)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_HiringTeam)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_Occupation)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_ShortenedURL)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_AssessmentTemplate)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_ILOJobTitle)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
if (rowsUpdated != 1) if (rowsUpdated != 1)
{ {
...@@ -732,6 +736,7 @@ public class JobPersistenceMgr extends ObjectPersistenceMgr ...@@ -732,6 +736,7 @@ public class JobPersistenceMgr extends ObjectPersistenceMgr
tl_jobPSet.setAttrib(Job.FIELD_CultureStatement, HELPER_CultureStatement.getFromRS(dummyCultureStatement, r, "culture_statement")); tl_jobPSet.setAttrib(Job.FIELD_CultureStatement, HELPER_CultureStatement.getFromRS(dummyCultureStatement, r, "culture_statement"));
tl_jobPSet.setAttrib(Job.FIELD_DraftLocation, HELPER_DraftLocation.getFromRS(dummyDraftLocation, r, "draft_location")); tl_jobPSet.setAttrib(Job.FIELD_DraftLocation, HELPER_DraftLocation.getFromRS(dummyDraftLocation, r, "draft_location"));
tl_jobPSet.setAttrib(Job.FIELD_GoogleAddressText, HELPER_GoogleAddressText.getFromRS(dummyGoogleAddressText, r, "google_address_text")); tl_jobPSet.setAttrib(Job.FIELD_GoogleAddressText, HELPER_GoogleAddressText.getFromRS(dummyGoogleAddressText, r, "google_address_text"));
tl_jobPSet.setAttrib(Job.FIELD_DiversityIncluded, HELPER_DiversityIncluded.getFromRS(dummyDiversityIncluded, r, "diversity_included"));
tl_jobPSet.setAttrib(Job.SINGLEREFERENCE_Level, r.getObject ("level_id")); tl_jobPSet.setAttrib(Job.SINGLEREFERENCE_Level, r.getObject ("level_id"));
tl_jobPSet.setAttrib(Job.SINGLEREFERENCE_Client, r.getObject ("client_id")); tl_jobPSet.setAttrib(Job.SINGLEREFERENCE_Client, r.getObject ("client_id"));
...@@ -758,10 +763,10 @@ public class JobPersistenceMgr extends ObjectPersistenceMgr ...@@ -758,10 +763,10 @@ public class JobPersistenceMgr extends ObjectPersistenceMgr
{ {
executeStatement (sqlMgr, executeStatement (sqlMgr,
"INSERT INTO {PREFIX}tl_job " + "INSERT INTO {PREFIX}tl_job " +
" (job_title, job_description, job_status, open_date, apply_by, include_assessment_criteria, include_culture, assessment_type, random_key, job_type, ref_number, last_status_change_date, remote, city, postcode, location_radius, state, country, require_cv, manually_closed, last_edited, is_ppj, industry, culture_statement, draft_location, google_address_text, level_id, client_id, job_owner_id, company_user_id, hiring_team_id, occupation_id, shortened_url_id, template_id, job_title_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " + " (job_title, job_description, job_status, open_date, apply_by, include_assessment_criteria, include_culture, assessment_type, random_key, job_type, ref_number, last_status_change_date, remote, city, postcode, location_radius, state, country, require_cv, manually_closed, last_edited, is_ppj, industry, culture_statement, draft_location, google_address_text, diversity_included, level_id, client_id, job_owner_id, company_user_id, hiring_team_id, occupation_id, shortened_url_id, template_id, job_title_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 (HELPER_JobTitle.getForSQL(dummyJobTitle, tl_jobPSet.getAttrib (Job.FIELD_JobTitle))).listEntry (HELPER_JobDescription.getForSQL(dummyJobDescription, tl_jobPSet.getAttrib (Job.FIELD_JobDescription))).listEntry (HELPER_JobStatus.getForSQL(dummyJobStatus, tl_jobPSet.getAttrib (Job.FIELD_JobStatus))).listEntry (HELPER_OpenDate.getForSQL(dummyOpenDate, tl_jobPSet.getAttrib (Job.FIELD_OpenDate))).listEntry (HELPER_ApplyBy.getForSQL(dummyApplyBy, tl_jobPSet.getAttrib (Job.FIELD_ApplyBy))).listEntry (HELPER_IncludeAssessmentCriteria.getForSQL(dummyIncludeAssessmentCriteria, tl_jobPSet.getAttrib (Job.FIELD_IncludeAssessmentCriteria))).listEntry (HELPER_IncludeCulture.getForSQL(dummyIncludeCulture, tl_jobPSet.getAttrib (Job.FIELD_IncludeCulture))).listEntry (HELPER_AssessmentType.getForSQL(dummyAssessmentType, tl_jobPSet.getAttrib (Job.FIELD_AssessmentType))).listEntry (HELPER_RandomKey.getForSQL(dummyRandomKey, tl_jobPSet.getAttrib (Job.FIELD_RandomKey))).listEntry (HELPER_JobType.getForSQL(dummyJobType, tl_jobPSet.getAttrib (Job.FIELD_JobType))).listEntry (HELPER_ReferenceNumber.getForSQL(dummyReferenceNumber, tl_jobPSet.getAttrib (Job.FIELD_ReferenceNumber))).listEntry (HELPER_LastStatusChangeDate.getForSQL(dummyLastStatusChangeDate, tl_jobPSet.getAttrib (Job.FIELD_LastStatusChangeDate))).listEntry (HELPER_Remote.getForSQL(dummyRemote, tl_jobPSet.getAttrib (Job.FIELD_Remote))).listEntry (HELPER_City.getForSQL(dummyCity, tl_jobPSet.getAttrib (Job.FIELD_City))).listEntry (HELPER_PostCode.getForSQL(dummyPostCode, tl_jobPSet.getAttrib (Job.FIELD_PostCode))).listEntry (HELPER_ExpectedCandidateRadius.getForSQL(dummyExpectedCandidateRadius, tl_jobPSet.getAttrib (Job.FIELD_ExpectedCandidateRadius))).listEntry (HELPER_State.getForSQL(dummyState, tl_jobPSet.getAttrib (Job.FIELD_State))).listEntry (HELPER_Country.getForSQL(dummyCountry, tl_jobPSet.getAttrib (Job.FIELD_Country))).listEntry (HELPER_RequireCV.getForSQL(dummyRequireCV, tl_jobPSet.getAttrib (Job.FIELD_RequireCV))).listEntry (HELPER_IsManuallyClosed.getForSQL(dummyIsManuallyClosed, tl_jobPSet.getAttrib (Job.FIELD_IsManuallyClosed))).listEntry (HELPER_LastEdited.getForSQL(dummyLastEdited, tl_jobPSet.getAttrib (Job.FIELD_LastEdited))).listEntry (HELPER_IsPPJ.getForSQL(dummyIsPPJ, tl_jobPSet.getAttrib (Job.FIELD_IsPPJ))).listEntry (HELPER_Industry.getForSQL(dummyIndustry, tl_jobPSet.getAttrib (Job.FIELD_Industry))).listEntry (HELPER_CultureStatement.getForSQL(dummyCultureStatement, tl_jobPSet.getAttrib (Job.FIELD_CultureStatement))).listEntry (HELPER_DraftLocation.getForSQL(dummyDraftLocation, tl_jobPSet.getAttrib (Job.FIELD_DraftLocation))).listEntry (HELPER_GoogleAddressText.getForSQL(dummyGoogleAddressText, tl_jobPSet.getAttrib (Job.FIELD_GoogleAddressText))) .listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_Level)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_Client)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_JobOwner)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_CreatedBy)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_HiringTeam)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_Occupation)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_ShortenedURL)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_AssessmentTemplate)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_ILOJobTitle)))) .listEntry (objectID.longID ()).toList().toArray()); CollectionUtils.listEntry (HELPER_JobTitle.getForSQL(dummyJobTitle, tl_jobPSet.getAttrib (Job.FIELD_JobTitle))).listEntry (HELPER_JobDescription.getForSQL(dummyJobDescription, tl_jobPSet.getAttrib (Job.FIELD_JobDescription))).listEntry (HELPER_JobStatus.getForSQL(dummyJobStatus, tl_jobPSet.getAttrib (Job.FIELD_JobStatus))).listEntry (HELPER_OpenDate.getForSQL(dummyOpenDate, tl_jobPSet.getAttrib (Job.FIELD_OpenDate))).listEntry (HELPER_ApplyBy.getForSQL(dummyApplyBy, tl_jobPSet.getAttrib (Job.FIELD_ApplyBy))).listEntry (HELPER_IncludeAssessmentCriteria.getForSQL(dummyIncludeAssessmentCriteria, tl_jobPSet.getAttrib (Job.FIELD_IncludeAssessmentCriteria))).listEntry (HELPER_IncludeCulture.getForSQL(dummyIncludeCulture, tl_jobPSet.getAttrib (Job.FIELD_IncludeCulture))).listEntry (HELPER_AssessmentType.getForSQL(dummyAssessmentType, tl_jobPSet.getAttrib (Job.FIELD_AssessmentType))).listEntry (HELPER_RandomKey.getForSQL(dummyRandomKey, tl_jobPSet.getAttrib (Job.FIELD_RandomKey))).listEntry (HELPER_JobType.getForSQL(dummyJobType, tl_jobPSet.getAttrib (Job.FIELD_JobType))).listEntry (HELPER_ReferenceNumber.getForSQL(dummyReferenceNumber, tl_jobPSet.getAttrib (Job.FIELD_ReferenceNumber))).listEntry (HELPER_LastStatusChangeDate.getForSQL(dummyLastStatusChangeDate, tl_jobPSet.getAttrib (Job.FIELD_LastStatusChangeDate))).listEntry (HELPER_Remote.getForSQL(dummyRemote, tl_jobPSet.getAttrib (Job.FIELD_Remote))).listEntry (HELPER_City.getForSQL(dummyCity, tl_jobPSet.getAttrib (Job.FIELD_City))).listEntry (HELPER_PostCode.getForSQL(dummyPostCode, tl_jobPSet.getAttrib (Job.FIELD_PostCode))).listEntry (HELPER_ExpectedCandidateRadius.getForSQL(dummyExpectedCandidateRadius, tl_jobPSet.getAttrib (Job.FIELD_ExpectedCandidateRadius))).listEntry (HELPER_State.getForSQL(dummyState, tl_jobPSet.getAttrib (Job.FIELD_State))).listEntry (HELPER_Country.getForSQL(dummyCountry, tl_jobPSet.getAttrib (Job.FIELD_Country))).listEntry (HELPER_RequireCV.getForSQL(dummyRequireCV, tl_jobPSet.getAttrib (Job.FIELD_RequireCV))).listEntry (HELPER_IsManuallyClosed.getForSQL(dummyIsManuallyClosed, tl_jobPSet.getAttrib (Job.FIELD_IsManuallyClosed))).listEntry (HELPER_LastEdited.getForSQL(dummyLastEdited, tl_jobPSet.getAttrib (Job.FIELD_LastEdited))).listEntry (HELPER_IsPPJ.getForSQL(dummyIsPPJ, tl_jobPSet.getAttrib (Job.FIELD_IsPPJ))).listEntry (HELPER_Industry.getForSQL(dummyIndustry, tl_jobPSet.getAttrib (Job.FIELD_Industry))).listEntry (HELPER_CultureStatement.getForSQL(dummyCultureStatement, tl_jobPSet.getAttrib (Job.FIELD_CultureStatement))).listEntry (HELPER_DraftLocation.getForSQL(dummyDraftLocation, tl_jobPSet.getAttrib (Job.FIELD_DraftLocation))).listEntry (HELPER_GoogleAddressText.getForSQL(dummyGoogleAddressText, tl_jobPSet.getAttrib (Job.FIELD_GoogleAddressText))).listEntry (HELPER_DiversityIncluded.getForSQL(dummyDiversityIncluded, tl_jobPSet.getAttrib (Job.FIELD_DiversityIncluded))) .listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_Level)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_Client)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_JobOwner)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_CreatedBy)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_HiringTeam)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_Occupation)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_ShortenedURL)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_AssessmentTemplate)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_ILOJobTitle)))) .listEntry (objectID.longID ()).toList().toArray());
tl_jobPSet.setStatus (PersistentSetStatus.PROCESSED); tl_jobPSet.setStatus (PersistentSetStatus.PROCESSED);
} }
......
package performa.orm.types;
import java.util.*;
import oneit.utils.*;
/**
* This class was generated using constGen.bat.
* DO NOT MODIFY THIS CODE.
* Edit the associated .xml file, and regenerate this file
* constGen (directory) (file minus extension)
* e.g. constGen C:\...\sql FieldType
*/
public class AppFilter extends AbstractEnumerated
{
public static final EnumeratedFactory FACTORY_AppFilter = new AppFilterFactory();
public static final AppFilter REQ = new AppFilter ("REQ", "REQ", "Requirements", false);
public static final AppFilter REQ_MET = new AppFilter ("REQ_MET", "REQ_MET", "Met", false);
public static final AppFilter REQ_NOT_MET = new AppFilter ("REQ_NOT_MET", "REQ_NOT_MET", "Not Met", false);
public static final AppFilter GENDER = new AppFilter ("GENDER", "GENDER", "Gender", false);
public static final AppFilter GENDER_MAN = new AppFilter ("GENDER_MAN", "GENDER_MAN", "Man", false);
public static final AppFilter GENDER_WOMAN = new AppFilter ("GENDER_WOMAN", "GENDER_WOMAN", "Woman", false);
public static final AppFilter GENDER_OTHER = new AppFilter ("GENDER_OTHER", "GENDER_OTHER", "Other", false);
public static final AppFilter ATSI = new AppFilter ("ATSI", "ATSI", "ATSI", false);
public static final AppFilter ATSI_ABORIGINAL = new AppFilter ("ATSI_ABORIGINAL", "ATSI_ABORIGINAL", "Aboriginal", false);
public static final AppFilter ATSI_TSI = new AppFilter ("ATSI_TSI", "ATSI_TSI", "Torres Strait Islander", false);
public static final AppFilter ATSI_BOTH = new AppFilter ("ATSI_BOTH", "ATSI_BOTH", "Both", false);
public static final AppFilter DISABLED = new AppFilter ("DISABLED", "DISABLED", "Disability", false);
public static final AppFilter DISABLED_HEARING = new AppFilter ("DISABLED_HEARING", "DISABLED_HEARING", "Hearing", false);
public static final AppFilter DISABLED_LEARNING = new AppFilter ("DISABLED_LEARNING", "DISABLED_LEARNING", "Learning", false);
public static final AppFilter DISABLED_MEDICAL = new AppFilter ("DISABLED_MEDICAL", "DISABLED_MEDICAL", "Medical / Physical / Psychiatric", false);
public static final AppFilter DISABLED_SIGHT = new AppFilter ("DISABLED_SIGHT", "DISABLED_SIGHT", "Sight", false);
public static final AppFilter DISABLED_SPEECH = new AppFilter ("DISABLED_SPEECH", "DISABLED_SPEECH", "Speech", false);
public static final AppFilter DISABLED_ARMS = new AppFilter ("DISABLED_ARMS", "DISABLED_ARMS", "Use of Arms and Hands", false);
public static final AppFilter DISABLED_LEGS = new AppFilter ("DISABLED_LEGS", "DISABLED_LEGS", "Use of Legs", false);
public static final AppFilter DISABLED_OTHER = new AppFilter ("DISABLED_OTHER", "DISABLED_OTHER", "Other", false);
private static final AppFilter[] allAppFilters =
new AppFilter[] { REQ,REQ_MET,REQ_NOT_MET,GENDER,GENDER_MAN,GENDER_WOMAN,GENDER_OTHER,ATSI,ATSI_ABORIGINAL,ATSI_TSI,ATSI_BOTH,DISABLED,DISABLED_HEARING,DISABLED_LEARNING,DISABLED_MEDICAL,DISABLED_SIGHT,DISABLED_SPEECH,DISABLED_ARMS,DISABLED_LEGS,DISABLED_OTHER};
private static AppFilter[] getAllAppFilters ()
{
return allAppFilters;
}
private transient Boolean IsRoot;
private transient AppFilter[] ChildNodes;
private transient AppFilter ParentNode;
private AppFilter (String name, String value, String description, boolean disabled)
{
super (name, value, description, disabled);
}
public Boolean getIsRoot()
{
return IsRoot;
}
public AppFilter[] getChildNodes()
{
return ChildNodes;
}
public AppFilter getParentNode()
{
return ParentNode;
}
public static final Comparator COMPARE_BY_POSITION = new CompareEnumByPosition (allAppFilters);
static
{
defineAdditionalData ();
}
public boolean isEqual (AppFilter other)
{
return this.name.equals (other.name);
}
public Enumeration getAllInstances ()
{
return AppFilter.getAll ();
}
private Object readResolve() throws java.io.ObjectStreamException
{
return AppFilter.forName (this.name);
}
public EnumeratedFactory getFactory ()
{
return FACTORY_AppFilter;
}
public static AppFilter forName (String name)
{
if (name == null) { return null; }
AppFilter[] all = getAllAppFilters();
int enumIndex = AbstractEnumerated.getIndexForName (all, name);
return all[enumIndex];
}
public static AppFilter forValue (String value)
{
if (value == null) { return null; }
AppFilter[] all = getAllAppFilters();
int enumIndex = AbstractEnumerated.getIndexForValue (getAllAppFilters (), value);
return all[enumIndex];
}
public static java.util.Enumeration getAll ()
{
return AbstractEnumerated.getAll (getAllAppFilters());
}
public static AppFilter[] getAppFilterArray ()
{
return (AppFilter[])getAllAppFilters().clone ();
}
public static void defineAdditionalData ()
{
REQ.IsRoot = Boolean.TRUE;
REQ.ChildNodes = new AppFilter[] {AppFilter.REQ_MET, AppFilter.REQ_NOT_MET};
REQ_MET.IsRoot = Boolean.FALSE;
REQ_MET.ChildNodes = new AppFilter[] {};
REQ_MET.ParentNode = AppFilter.REQ;
REQ_NOT_MET.IsRoot = Boolean.FALSE;
REQ_NOT_MET.ChildNodes = new AppFilter[] {};
REQ_NOT_MET.ParentNode = AppFilter.REQ;
GENDER.IsRoot = Boolean.TRUE;
GENDER.ChildNodes = new AppFilter[] {AppFilter.GENDER_MAN, AppFilter.GENDER_WOMAN, AppFilter.GENDER_OTHER};
GENDER_MAN.IsRoot = Boolean.FALSE;
GENDER_MAN.ChildNodes = new AppFilter[] {};
GENDER_MAN.ParentNode = AppFilter.GENDER;
GENDER_WOMAN.IsRoot = Boolean.FALSE;
GENDER_WOMAN.ChildNodes = new AppFilter[] {};
GENDER_WOMAN.ParentNode = AppFilter.GENDER;
GENDER_OTHER.IsRoot = Boolean.FALSE;
GENDER_OTHER.ChildNodes = new AppFilter[] {};
GENDER_OTHER.ParentNode = AppFilter.GENDER;
ATSI.IsRoot = Boolean.TRUE;
ATSI.ChildNodes = new AppFilter[] {AppFilter.ATSI_ABORIGINAL, AppFilter.ATSI_TSI, AppFilter.ATSI_BOTH};
ATSI_ABORIGINAL.IsRoot = Boolean.FALSE;
ATSI_ABORIGINAL.ChildNodes = new AppFilter[] {};
ATSI_ABORIGINAL.ParentNode = AppFilter.ATSI;
ATSI_TSI.IsRoot = Boolean.FALSE;
ATSI_TSI.ChildNodes = new AppFilter[] {};
ATSI_TSI.ParentNode = AppFilter.ATSI;
ATSI_BOTH.IsRoot = Boolean.FALSE;
ATSI_BOTH.ChildNodes = new AppFilter[] {};
ATSI_BOTH.ParentNode = AppFilter.ATSI;
DISABLED.IsRoot = Boolean.TRUE;
DISABLED.ChildNodes = new AppFilter[] {AppFilter.DISABLED_HEARING, AppFilter.DISABLED_LEARNING, AppFilter.DISABLED_MEDICAL, AppFilter.DISABLED_SIGHT, AppFilter.DISABLED_SPEECH , AppFilter.DISABLED_ARMS , AppFilter.DISABLED_LEGS , AppFilter.DISABLED_OTHER };
DISABLED_HEARING.IsRoot = Boolean.FALSE;
DISABLED_HEARING.ChildNodes = new AppFilter[] {};
DISABLED_HEARING.ParentNode = AppFilter.DISABLED;
DISABLED_LEARNING.IsRoot = Boolean.FALSE;
DISABLED_LEARNING.ChildNodes = new AppFilter[] {};
DISABLED_LEARNING.ParentNode = AppFilter.DISABLED;
DISABLED_MEDICAL.IsRoot = Boolean.FALSE;
DISABLED_MEDICAL.ChildNodes = new AppFilter[] {};
DISABLED_MEDICAL.ParentNode = AppFilter.DISABLED;
DISABLED_SIGHT.IsRoot = Boolean.FALSE;
DISABLED_SIGHT.ChildNodes = new AppFilter[] {};
DISABLED_SIGHT.ParentNode = AppFilter.DISABLED;
DISABLED_SPEECH.IsRoot = Boolean.FALSE;
DISABLED_SPEECH.ChildNodes = new AppFilter[] {};
DISABLED_SPEECH.ParentNode = AppFilter.DISABLED;
DISABLED_ARMS.IsRoot = Boolean.FALSE;
DISABLED_ARMS.ChildNodes = new AppFilter[] {};
DISABLED_ARMS.ParentNode = AppFilter.DISABLED;
DISABLED_LEGS.IsRoot = Boolean.FALSE;
DISABLED_LEGS.ChildNodes = new AppFilter[] {};
DISABLED_LEGS.ParentNode = AppFilter.DISABLED;
DISABLED_OTHER.IsRoot = Boolean.FALSE;
DISABLED_OTHER.ChildNodes = new AppFilter[] {};
DISABLED_OTHER.ParentNode = AppFilter.DISABLED;
}
static class AppFilterFactory implements EnumeratedFactory
{
public AbstractEnumerated getForName (String name)
{
return AppFilter.forName (name);
}
public AbstractEnumerated getForValue (String name)
{
return AppFilter.forValue (name);
}
public Enumeration getAll ()
{
return AppFilter.getAll ();
}
}
public Map getAdditionalAttributes ()
{
Map attribs = new HashMap ();
attribs.put ("IsRoot", ArrayFormatter.toObject(getIsRoot()));
attribs.put ("ChildNodes", ArrayFormatter.toObject(getChildNodes()));
attribs.put ("ParentNode", ArrayFormatter.toObject(getParentNode()));
return attribs;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<ROOT>
<CONSTANT package="performa.orm.types" name="AppFilter">
<DATA name="IsRoot" type="Boolean"/>
<DATA name="ChildNodes" type="AppFilter[]"/>
<DATA name="ParentNode" type="AppFilter"/>
<VALUE name="REQ" description="Requirements" IsRoot="Boolean.TRUE" ChildNodes='new AppFilter[] {AppFilter.REQ_MET, AppFilter.REQ_NOT_MET}'/>
<VALUE name="REQ_MET" description="Met" IsRoot="Boolean.FALSE" ChildNodes='new AppFilter[] {}' ParentNode="AppFilter.REQ"/>
<VALUE name="REQ_NOT_MET" description="Not Met" IsRoot="Boolean.FALSE" ChildNodes='new AppFilter[] {}' ParentNode="AppFilter.REQ"/>
<VALUE name="GENDER" description="Gender" IsRoot="Boolean.TRUE" ChildNodes='new AppFilter[] {AppFilter.GENDER_MAN, AppFilter.GENDER_WOMAN, AppFilter.GENDER_OTHER}'/>
<VALUE name="GENDER_MAN" description="Man" IsRoot="Boolean.FALSE" ChildNodes='new AppFilter[] {}' ParentNode="AppFilter.GENDER"/>
<VALUE name="GENDER_WOMAN" description="Woman" IsRoot="Boolean.FALSE" ChildNodes='new AppFilter[] {}' ParentNode="AppFilter.GENDER"/>
<VALUE name="GENDER_OTHER" description="Other" IsRoot="Boolean.FALSE" ChildNodes='new AppFilter[] {}' ParentNode="AppFilter.GENDER"/>
<VALUE name="ATSI" description="ATSI" IsRoot="Boolean.TRUE" ChildNodes='new AppFilter[] {AppFilter.ATSI_ABORIGINAL, AppFilter.ATSI_TSI, AppFilter.ATSI_BOTH}'/>
<VALUE name="ATSI_ABORIGINAL" description="Aboriginal" IsRoot="Boolean.FALSE" ChildNodes='new AppFilter[] {}' ParentNode="AppFilter.ATSI"/>
<VALUE name="ATSI_TSI" description="Torres Strait Islander" IsRoot="Boolean.FALSE" ChildNodes='new AppFilter[] {}' ParentNode="AppFilter.ATSI"/>
<VALUE name="ATSI_BOTH" description="Both" IsRoot="Boolean.FALSE" ChildNodes='new AppFilter[] {}' ParentNode="AppFilter.ATSI"/>
<VALUE name="DISABLED" description="Disability" IsRoot="Boolean.TRUE" ChildNodes='new AppFilter[] {AppFilter.DISABLED_HEARING, AppFilter.DISABLED_LEARNING, AppFilter.DISABLED_MEDICAL, AppFilter.DISABLED_SIGHT, AppFilter.DISABLED_SPEECH , AppFilter.DISABLED_ARMS , AppFilter.DISABLED_LEGS , AppFilter.DISABLED_OTHER }'/>
<VALUE name="DISABLED_HEARING" description="Hearing" IsRoot="Boolean.FALSE" ChildNodes='new AppFilter[] {}' ParentNode="AppFilter.DISABLED"/>
<VALUE name="DISABLED_LEARNING" description="Learning" IsRoot="Boolean.FALSE" ChildNodes='new AppFilter[] {}' ParentNode="AppFilter.DISABLED"/>
<VALUE name="DISABLED_MEDICAL" description="Medical / Physical / Psychiatric" IsRoot="Boolean.FALSE" ChildNodes='new AppFilter[] {}' ParentNode="AppFilter.DISABLED"/>
<VALUE name="DISABLED_SIGHT" description="Sight" IsRoot="Boolean.FALSE" ChildNodes='new AppFilter[] {}' ParentNode="AppFilter.DISABLED"/>
<VALUE name="DISABLED_SPEECH" description="Speech" IsRoot="Boolean.FALSE" ChildNodes='new AppFilter[] {}' ParentNode="AppFilter.DISABLED"/>
<VALUE name="DISABLED_ARMS" description="Use of Arms and Hands" IsRoot="Boolean.FALSE" ChildNodes='new AppFilter[] {}' ParentNode="AppFilter.DISABLED"/>
<VALUE name="DISABLED_LEGS" description="Use of Legs" IsRoot="Boolean.FALSE" ChildNodes='new AppFilter[] {}' ParentNode="AppFilter.DISABLED"/>
<VALUE name="DISABLED_OTHER" description="Other" IsRoot="Boolean.FALSE" ChildNodes='new AppFilter[] {}' ParentNode="AppFilter.DISABLED"/>
</CONSTANT>
</ROOT>
\ No newline at end of file
...@@ -30,6 +30,8 @@ import oneit.servlets.orm.*; ...@@ -30,6 +30,8 @@ import oneit.servlets.orm.*;
import performa.orm.*; import performa.orm.*;
import performa.orm.types.*;
public abstract class BaseSearchApplicant extends SearchExecutor public abstract class BaseSearchApplicant extends SearchExecutor
...@@ -43,6 +45,7 @@ public abstract class BaseSearchApplicant extends SearchExecutor ...@@ -43,6 +45,7 @@ public abstract class BaseSearchApplicant extends SearchExecutor
// Static constants corresponding to field names // Static constants corresponding to field names
public static final String FIELD_Details = "Details"; public static final String FIELD_Details = "Details";
public static final String FIELD_Filter = "Filter";
public static final String SINGLEREFERENCE_Job = "Job"; public static final String SINGLEREFERENCE_Job = "Job";
// Static constants corresponding to searches // Static constants corresponding to searches
...@@ -50,10 +53,12 @@ public abstract class BaseSearchApplicant extends SearchExecutor ...@@ -50,10 +53,12 @@ public abstract class BaseSearchApplicant extends SearchExecutor
// Static constants corresponding to attribute helpers // Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper<SearchApplicant> HELPER_Details = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper<SearchApplicant> HELPER_Details = DefaultAttributeHelper.INSTANCE;
private static final DelimitedEnumsAttributeHelper HELPER_Filter = new DelimitedEnumsAttributeHelper (AppFilter.FACTORY_AppFilter);
// Private attributes corresponding to business object data // Private attributes corresponding to business object data
private String _Details; private String _Details;
private Set<AppFilter> _Filter;
// Private attributes corresponding to single references // Private attributes corresponding to single references
...@@ -68,6 +73,7 @@ public abstract class BaseSearchApplicant extends SearchExecutor ...@@ -68,6 +73,7 @@ public abstract class BaseSearchApplicant extends SearchExecutor
// Arrays of validators for each attribute // Arrays of validators for each attribute
private static final AttributeValidator[] FIELD_Details_Validators; private static final AttributeValidator[] FIELD_Details_Validators;
private static final AttributeValidator[] FIELD_Filter_Validators;
// Arrays of behaviour decorators // Arrays of behaviour decorators
...@@ -83,6 +89,7 @@ public abstract class BaseSearchApplicant extends SearchExecutor ...@@ -83,6 +89,7 @@ public abstract class BaseSearchApplicant extends SearchExecutor
setupAssocMetaData_Job(); setupAssocMetaData_Job();
FIELD_Details_Validators = (AttributeValidator[])setupAttribMetaData_Details(validatorMapping).toArray (new AttributeValidator[0]); FIELD_Details_Validators = (AttributeValidator[])setupAttribMetaData_Details(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_Filter_Validators = (AttributeValidator[])setupAttribMetaData_Filter(validatorMapping).toArray (new AttributeValidator[0]);
REFERENCE_SearchApplicant.initialiseReference (); REFERENCE_SearchApplicant.initialiseReference ();
...@@ -129,6 +136,26 @@ public abstract class BaseSearchApplicant extends SearchExecutor ...@@ -129,6 +136,26 @@ public abstract class BaseSearchApplicant extends SearchExecutor
return validators; return validators;
} }
// Meta Info setup
private static List setupAttribMetaData_Filter(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("attribHelper", "DelimitedEnumsAttributeHelper");
metaInfo.put ("attribHelperInstance", "new DelimitedEnumsAttributeHelper (AppFilter.FACTORY_AppFilter)");
metaInfo.put ("dbcol", "xxxx");
metaInfo.put ("name", "Filter");
metaInfo.put ("type", "Set<AppFilter>");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for SearchApplicant.Filter:", metaInfo);
ATTRIBUTES_METADATA_SearchApplicant.put (FIELD_Filter, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(SearchApplicant.class, "Filter", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for SearchApplicant.Filter:", validators);
return validators;
}
// END OF STATIC METADATA DEFINITION // END OF STATIC METADATA DEFINITION
...@@ -157,6 +184,7 @@ public abstract class BaseSearchApplicant extends SearchExecutor ...@@ -157,6 +184,7 @@ public abstract class BaseSearchApplicant extends SearchExecutor
_Details = (String)(HELPER_Details.initialise (_Details)); _Details = (String)(HELPER_Details.initialise (_Details));
_Filter = (Set<AppFilter>)(HELPER_Filter.initialise (_Filter));
} }
...@@ -281,6 +309,104 @@ public abstract class BaseSearchApplicant extends SearchExecutor ...@@ -281,6 +309,104 @@ public abstract class BaseSearchApplicant extends SearchExecutor
} }
} }
/**
* Get the attribute Filter
*/
public Set<AppFilter> getFilter ()
{
assertValid();
Set<AppFilter> valToReturn = _Filter;
for (SearchApplicantBehaviourDecorator bhd : SearchApplicant_BehaviourDecorators)
{
valToReturn = bhd.getFilter ((SearchApplicant)this, valToReturn);
}
return valToReturn;
}
/**
* Called prior to the attribute changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preFilterChange (Set<AppFilter> newFilter) throws FieldException
{
}
/**
* Called after the attribute changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postFilterChange () throws FieldException
{
}
public FieldWriteability getWriteability_Filter ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute Filter. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setFilter (Set<AppFilter> newFilter) throws FieldException
{
boolean oldAndNewIdentical = HELPER_Filter.compare (_Filter, newFilter);
try
{
for (SearchApplicantBehaviourDecorator bhd : SearchApplicant_BehaviourDecorators)
{
newFilter = bhd.setFilter ((SearchApplicant)this, newFilter);
oldAndNewIdentical = HELPER_Filter.compare (_Filter, newFilter);
}
if (FIELD_Filter_Validators.length > 0)
{
Object newFilterObj = HELPER_Filter.toObject (newFilter);
if (newFilterObj != null)
{
int loopMax = FIELD_Filter_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_SearchApplicant.get (FIELD_Filter);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_Filter_Validators[v].checkAttribute (this, FIELD_Filter, metadata, newFilterObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_Filter () != FieldWriteability.FALSE, "Field Filter is not writeable");
preFilterChange (newFilter);
markFieldChange (FIELD_Filter);
_Filter = newFilter;
postFieldChange (FIELD_Filter);
postFilterChange ();
}
}
/** /**
...@@ -654,6 +780,7 @@ public abstract class BaseSearchApplicant extends SearchExecutor ...@@ -654,6 +780,7 @@ public abstract class BaseSearchApplicant extends SearchExecutor
it_does_not_matterPSet.setAttrib (FIELD_ObjectID, myID); it_does_not_matterPSet.setAttrib (FIELD_ObjectID, myID);
it_does_not_matterPSet.setAttrib (FIELD_Details, HELPER_Details.toObject (_Details)); // it_does_not_matterPSet.setAttrib (FIELD_Details, HELPER_Details.toObject (_Details)); //
it_does_not_matterPSet.setAttrib (FIELD_Filter, HELPER_Filter.toObject (_Filter)); //
_Job.getPersistentSets (allSets); _Job.getPersistentSets (allSets);
} }
...@@ -670,6 +797,7 @@ public abstract class BaseSearchApplicant extends SearchExecutor ...@@ -670,6 +797,7 @@ public abstract class BaseSearchApplicant extends SearchExecutor
PersistentSet it_does_not_matterPSet = allSets.getPersistentSet (objectID, "it_does_not_matter"); PersistentSet it_does_not_matterPSet = allSets.getPersistentSet (objectID, "it_does_not_matter");
_Details = (String)(HELPER_Details.fromObject (_Details, it_does_not_matterPSet.getAttrib (FIELD_Details))); // _Details = (String)(HELPER_Details.fromObject (_Details, it_does_not_matterPSet.getAttrib (FIELD_Details))); //
_Filter = (Set<AppFilter>)(HELPER_Filter.fromObject (_Filter, it_does_not_matterPSet.getAttrib (FIELD_Filter))); //
_Job.setFromPersistentSets (objectID, allSets); _Job.setFromPersistentSets (objectID, allSets);
} }
...@@ -695,6 +823,15 @@ public abstract class BaseSearchApplicant extends SearchExecutor ...@@ -695,6 +823,15 @@ public abstract class BaseSearchApplicant extends SearchExecutor
e.addException (ex); e.addException (ex);
} }
try
{
setFilter (otherSearchApplicant.getFilter ());
}
catch (FieldException ex)
{
e.addException (ex);
}
} }
} }
...@@ -711,6 +848,7 @@ public abstract class BaseSearchApplicant extends SearchExecutor ...@@ -711,6 +848,7 @@ public abstract class BaseSearchApplicant extends SearchExecutor
BaseSearchApplicant sourceSearchApplicant = (BaseSearchApplicant)(source); BaseSearchApplicant sourceSearchApplicant = (BaseSearchApplicant)(source);
_Details = sourceSearchApplicant._Details; _Details = sourceSearchApplicant._Details;
_Filter = sourceSearchApplicant._Filter;
} }
} }
...@@ -765,6 +903,7 @@ public abstract class BaseSearchApplicant extends SearchExecutor ...@@ -765,6 +903,7 @@ public abstract class BaseSearchApplicant extends SearchExecutor
super.readExternalData(vals); super.readExternalData(vals);
_Details = (String)(HELPER_Details.readExternal (_Details, vals.get(FIELD_Details))); // _Details = (String)(HELPER_Details.readExternal (_Details, vals.get(FIELD_Details))); //
_Filter = (Set<AppFilter>)(HELPER_Filter.readExternal (_Filter, vals.get(FIELD_Filter))); //
_Job.readExternalData(vals.get(SINGLEREFERENCE_Job)); _Job.readExternalData(vals.get(SINGLEREFERENCE_Job));
} }
...@@ -778,6 +917,7 @@ public abstract class BaseSearchApplicant extends SearchExecutor ...@@ -778,6 +917,7 @@ public abstract class BaseSearchApplicant extends SearchExecutor
super.writeExternalData(vals); super.writeExternalData(vals);
vals.put (FIELD_Details, HELPER_Details.writeExternal (_Details)); vals.put (FIELD_Details, HELPER_Details.writeExternal (_Details));
vals.put (FIELD_Filter, HELPER_Filter.writeExternal (_Filter));
vals.put (SINGLEREFERENCE_Job, _Job.writeExternalData()); vals.put (SINGLEREFERENCE_Job, _Job.writeExternalData());
} }
...@@ -796,6 +936,10 @@ public abstract class BaseSearchApplicant extends SearchExecutor ...@@ -796,6 +936,10 @@ public abstract class BaseSearchApplicant extends SearchExecutor
{ {
listener.notifyFieldChange(this, other, FIELD_Details, HELPER_Details.toObject(this._Details), HELPER_Details.toObject(otherSearchApplicant._Details)); listener.notifyFieldChange(this, other, FIELD_Details, HELPER_Details.toObject(this._Details), HELPER_Details.toObject(otherSearchApplicant._Details));
} }
if (!HELPER_Filter.compare(this._Filter, otherSearchApplicant._Filter))
{
listener.notifyFieldChange(this, other, FIELD_Filter, HELPER_Filter.toObject(this._Filter), HELPER_Filter.toObject(otherSearchApplicant._Filter));
}
// Compare single assocs // Compare single assocs
_Job.compare (otherSearchApplicant._Job, listener); _Job.compare (otherSearchApplicant._Job, listener);
...@@ -820,6 +964,7 @@ public abstract class BaseSearchApplicant extends SearchExecutor ...@@ -820,6 +964,7 @@ public abstract class BaseSearchApplicant extends SearchExecutor
super.visitAttributes (visitor); super.visitAttributes (visitor);
visitor.visitField(this, FIELD_Details, HELPER_Details.toObject(getDetails())); visitor.visitField(this, FIELD_Details, HELPER_Details.toObject(getDetails()));
visitor.visitField(this, FIELD_Filter, HELPER_Filter.toObject(getFilter()));
visitor.visitAssociation (_Job); visitor.visitAssociation (_Job);
} }
...@@ -862,6 +1007,10 @@ public abstract class BaseSearchApplicant extends SearchExecutor ...@@ -862,6 +1007,10 @@ public abstract class BaseSearchApplicant extends SearchExecutor
{ {
return filter.matches (getDetails ()); return filter.matches (getDetails ());
} }
else if (attribName.equals (FIELD_Filter))
{
return filter.matches (getFilter ());
}
else if (attribName.equals (SINGLEREFERENCE_Job)) else if (attribName.equals (SINGLEREFERENCE_Job))
{ {
return filter.matches (getJob ()); return filter.matches (getJob ());
...@@ -885,6 +1034,10 @@ public abstract class BaseSearchApplicant extends SearchExecutor ...@@ -885,6 +1034,10 @@ public abstract class BaseSearchApplicant extends SearchExecutor
{ {
return HELPER_Details.toObject (getDetails ()); return HELPER_Details.toObject (getDetails ());
} }
else if (attribName.equals (FIELD_Filter))
{
return HELPER_Filter.toObject (getFilter ());
}
else else
{ {
return super.getAttribute (attribName); return super.getAttribute (attribName);
...@@ -902,6 +1055,10 @@ public abstract class BaseSearchApplicant extends SearchExecutor ...@@ -902,6 +1055,10 @@ public abstract class BaseSearchApplicant extends SearchExecutor
{ {
return HELPER_Details; return HELPER_Details;
} }
else if (attribName.equals (FIELD_Filter))
{
return HELPER_Filter;
}
else else
{ {
return super.getAttributeHelper (attribName); return super.getAttributeHelper (attribName);
...@@ -919,6 +1076,10 @@ public abstract class BaseSearchApplicant extends SearchExecutor ...@@ -919,6 +1076,10 @@ public abstract class BaseSearchApplicant extends SearchExecutor
{ {
setDetails ((String)(HELPER_Details.fromObject (_Details, attribValue))); setDetails ((String)(HELPER_Details.fromObject (_Details, attribValue)));
} }
else if (attribName.equals (FIELD_Filter))
{
setFilter ((Set<AppFilter>)(HELPER_Filter.fromObject (_Filter, attribValue)));
}
else else
{ {
super.setAttribute (attribName, attribValue); super.setAttribute (attribName, attribValue);
...@@ -943,6 +1104,10 @@ public abstract class BaseSearchApplicant extends SearchExecutor ...@@ -943,6 +1104,10 @@ public abstract class BaseSearchApplicant extends SearchExecutor
{ {
return getWriteability_Details (); return getWriteability_Details ();
} }
else if (fieldName.equals (FIELD_Filter))
{
return getWriteability_Filter ();
}
else if (fieldName.equals (SINGLEREFERENCE_Job)) else if (fieldName.equals (SINGLEREFERENCE_Job))
{ {
return getWriteability_Job (); return getWriteability_Job ();
...@@ -962,6 +1127,11 @@ public abstract class BaseSearchApplicant extends SearchExecutor ...@@ -962,6 +1127,11 @@ public abstract class BaseSearchApplicant extends SearchExecutor
fields.add (FIELD_Details); fields.add (FIELD_Details);
} }
if (getWriteability_Filter () != FieldWriteability.TRUE)
{
fields.add (FIELD_Filter);
}
super.putUnwriteable (fields); super.putUnwriteable (fields);
} }
...@@ -972,6 +1142,7 @@ public abstract class BaseSearchApplicant extends SearchExecutor ...@@ -972,6 +1142,7 @@ public abstract class BaseSearchApplicant extends SearchExecutor
result.add(HELPER_Details.getAttribObject (getClass (), _Details, false, FIELD_Details)); result.add(HELPER_Details.getAttribObject (getClass (), _Details, false, FIELD_Details));
result.add(HELPER_Filter.getAttribObject (getClass (), _Filter, false, FIELD_Filter));
return result; return result;
} }
...@@ -1040,6 +1211,24 @@ public abstract class BaseSearchApplicant extends SearchExecutor ...@@ -1040,6 +1211,24 @@ public abstract class BaseSearchApplicant extends SearchExecutor
return newDetails; return newDetails;
} }
/**
* Get the attribute Filter
*/
public Set<AppFilter> getFilter (SearchApplicant obj, Set<AppFilter> original)
{
return original;
}
/**
* Change the value set for attribute Filter.
* May modify the field beforehand
* Occurs before validation.
*/
public Set<AppFilter> setFilter (SearchApplicant obj, Set<AppFilter> newFilter) throws FieldException
{
return newFilter;
}
} }
...@@ -1096,6 +1285,10 @@ public abstract class BaseSearchApplicant extends SearchExecutor ...@@ -1096,6 +1285,10 @@ public abstract class BaseSearchApplicant extends SearchExecutor
{ {
return toDetails (); return toDetails ();
} }
if (name.equals ("Filter"))
{
return toFilter ();
}
if (name.equals ("Job")) if (name.equals ("Job"))
{ {
return toJob (); return toJob ();
...@@ -1107,6 +1300,8 @@ public abstract class BaseSearchApplicant extends SearchExecutor ...@@ -1107,6 +1300,8 @@ public abstract class BaseSearchApplicant extends SearchExecutor
public PipeLine<From, String> toDetails () { return pipe(new ORMAttributePipe<Me, String>(FIELD_Details)); } public PipeLine<From, String> toDetails () { return pipe(new ORMAttributePipe<Me, String>(FIELD_Details)); }
public PipeLine<From, Set<AppFilter>> toFilter () { return pipe(new ORMAttributePipe<Me, Set<AppFilter>>(FIELD_Filter)); }
public Job.JobPipeLineFactory<From, Job> toJob () { return toJob (Filter.ALL); } public Job.JobPipeLineFactory<From, Job> toJob () { return toJob (Filter.ALL); }
public Job.JobPipeLineFactory<From, Job> toJob (Filter<Job> filter) public Job.JobPipeLineFactory<From, Job> toJob (Filter<Job> filter)
......
package performa.search; package performa.search;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import oneit.logging.LogLevel; import oneit.logging.LogLevel;
import oneit.logging.LogMgr; import oneit.logging.LogMgr;
import oneit.logging.LoggingArea; import oneit.logging.LoggingArea;
...@@ -36,18 +38,29 @@ public class SearchApplicant extends BaseSearchApplicant ...@@ -36,18 +38,29 @@ public class SearchApplicant extends BaseSearchApplicant
@Override @Override
public void run(ObjectTransaction newObjTran) throws FieldException, StorageException public void run(ObjectTransaction newObjTran) throws FieldException, StorageException
{ {
JobApplication[] results = JobApplication.SearchByDetails() JobApplication[] results = JobApplication.SearchByDetails()
.byName(getDetails()) .byName(getDetails())
.andJob(new EqualsFilter<>(getJob())) .andJob(new EqualsFilter<>(getJob()))
.search(newObjTran); .search(newObjTran);
for(JobApplication app : results) for(JobApplication app : results)
{ {
ApplicationStatus appStatus = app.getApplicationStatus(); ApplicationStatus appStatus = app.getApplicationStatus();
boolean skip = false;
app = app.getInTransaction(getTransaction()); app = app.getInTransaction(getTransaction());
app.setApplicationStatus(appStatus); app.setApplicationStatus(appStatus);
if(getFilter() != null)
{
skip = applyFilters(app);
}
if(skip)
{
continue;
}
Answer[] answers = Answer.SearchByAll().andCandidate(new EqualsFilter<>(app.getCandidate())).search(getTransaction()); Answer[] answers = Answer.SearchByAll().andCandidate(new EqualsFilter<>(app.getCandidate())).search(getTransaction());
for (Answer answer: answers) for (Answer answer: answers)
...@@ -73,6 +86,79 @@ public class SearchApplicant extends BaseSearchApplicant ...@@ -73,6 +86,79 @@ public class SearchApplicant extends BaseSearchApplicant
appResults.add(app); appResults.add(app);
} }
} }
private boolean applyFilters(JobApplication app) throws StorageException
{
Map<AppFilter, List<AppFilter>> map = createFilterMap();
for(AppFilter filter : getFilter())
{
if(filter.getIsRoot())
{
if(filter == AppFilter.ATSI || filter == AppFilter.DISABLED)
{
DiversityQuestion question = app.getJob().getQuestionByFilter(filter);
if(question != null)
{
CandidateDiversityAnswer answer = app.getCandidate().getDiversityAnswerByQuestion(question);
boolean hasAnswer = false;
for(AppFilter child : filter.getChildNodes())
{
if(answer != null && answer.pipelineCandidateDiversityAnswer().toAnswers().toAnswer().toCode().uniqueVals().contains(child.getName()))
{
hasAnswer = true;
break;
}
}
if(answer == null || !hasAnswer)
{
return true;
}
}
}
}
else if(filter.getParentNode() != null && filter.getParentNode() == AppFilter.REQ && getJob().showAssessmentCriteriaSection())
{
if((filter == AppFilter.REQ_MET && !app.hasAllEssentialRequirements()) || (filter == AppFilter.REQ_NOT_MET && !app.hasFailedEssentialRequirements()))
{
return true;
}
}
}
for(Map.Entry<AppFilter, List<AppFilter>> entry :map.entrySet()){
AppFilter parentNode = entry.getKey();
List<AppFilter> childList = entry.getValue();
DiversityQuestion question = app.getJob().getQuestionByFilter(parentNode);
if(question != null)
{
CandidateDiversityAnswer answer = app.getCandidate().getDiversityAnswerByQuestion(question);
boolean hasAnswer = false;
for(AppFilter child : childList)
{
if(answer != null && answer.pipelineCandidateDiversityAnswer().toAnswers().toAnswer().toCode().uniqueVals().contains(child.getName()))
{
hasAnswer = true;
break;
}
}
if(answer == null || !hasAnswer)
{
return true;
}
}
}
return false;
}
}); });
} }
...@@ -84,4 +170,25 @@ public class SearchApplicant extends BaseSearchApplicant ...@@ -84,4 +170,25 @@ public class SearchApplicant extends BaseSearchApplicant
return appResults.toArray(new JobApplication[0]); return appResults.toArray(new JobApplication[0]);
} }
private Map<AppFilter, List<AppFilter>> createFilterMap()
{
Map<AppFilter, List<AppFilter>> map = new HashMap<>();
for(AppFilter filter : getFilter())
{
if(filter.getParentNode() != null && filter.getParentNode() != AppFilter.REQ)
{
if (!map.containsKey(filter.getParentNode()))
{
map.put(filter.getParentNode(), new ArrayList<>());
}
map.get(filter.getParentNode()).add(filter);
}
}
return map;
}
} }
\ No newline at end of file
...@@ -6,11 +6,13 @@ ...@@ -6,11 +6,13 @@
<IMPORT value="oneit.servlets.orm.*" /> <IMPORT value="oneit.servlets.orm.*" />
<IMPORT value="performa.orm.*"/> <IMPORT value="performa.orm.*"/>
<IMPORT value="performa.orm.types.*"/>
<TABLE name="it_does_not_matter" tablePrefix="object" polymorphic="FALSE" > <TABLE name="it_does_not_matter" tablePrefix="object" polymorphic="FALSE" >
<ATTRIB name="Details" type="String" dbcol="xxxx" /> <ATTRIB name="Details" type="String" dbcol="xxxx" />
<ATTRIB name="Filter" type="Set&lt;AppFilter&gt;" dbcol="xxxx" attribHelper="DelimitedEnumsAttributeHelper" attribHelperInstance="new DelimitedEnumsAttributeHelper (AppFilter.FACTORY_AppFilter)"/>
<SINGLEREFERENCE name="Job" type="Job" dbcol="xxxx" /> <SINGLEREFERENCE name="Job" type="Job" dbcol="xxxx" />
</TABLE> </TABLE>
......
...@@ -16,6 +16,7 @@ import oneit.utils.*; ...@@ -16,6 +16,7 @@ import oneit.utils.*;
import oneit.utils.threading.*; import oneit.utils.threading.*;
import oneit.servlets.orm.*; import oneit.servlets.orm.*;
import performa.orm.*; import performa.orm.*;
import performa.orm.types.*;
...@@ -29,10 +30,12 @@ public class SearchApplicantPersistenceMgr extends SearchExecutorPersistenceMgr ...@@ -29,10 +30,12 @@ public class SearchApplicantPersistenceMgr extends SearchExecutorPersistenceMgr
// Private attributes corresponding to business object data // Private attributes corresponding to business object data
private String dummyDetails; private String dummyDetails;
private Set<AppFilter> dummyFilter;
// Static constants corresponding to attribute helpers // Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper HELPER_Details = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper HELPER_Details = DefaultAttributeHelper.INSTANCE;
private static final DelimitedEnumsAttributeHelper HELPER_Filter = new DelimitedEnumsAttributeHelper (AppFilter.FACTORY_AppFilter);
...@@ -40,10 +43,11 @@ public class SearchApplicantPersistenceMgr extends SearchExecutorPersistenceMgr ...@@ -40,10 +43,11 @@ public class SearchApplicantPersistenceMgr extends SearchExecutorPersistenceMgr
public SearchApplicantPersistenceMgr () public SearchApplicantPersistenceMgr ()
{ {
dummyDetails = (String)(HELPER_Details.initialise (dummyDetails)); dummyDetails = (String)(HELPER_Details.initialise (dummyDetails));
dummyFilter = (Set<AppFilter>)(HELPER_Filter.initialise (dummyFilter));
} }
private String SELECT_COLUMNS = "{PREFIX}it_does_not_matter.object_id as id, {PREFIX}it_does_not_matter.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}it_does_not_matter.object_CREATED_DATE as CREATED_DATE, {PREFIX}it_does_not_matter.xxxx, {PREFIX}it_does_not_matter.xxxx, 1 AS commasafe "; private String SELECT_COLUMNS = "{PREFIX}it_does_not_matter.object_id as id, {PREFIX}it_does_not_matter.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}it_does_not_matter.object_CREATED_DATE as CREATED_DATE, {PREFIX}it_does_not_matter.xxxx, {PREFIX}it_does_not_matter.xxxx, {PREFIX}it_does_not_matter.xxxx, 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
...@@ -95,6 +99,7 @@ public class SearchApplicantPersistenceMgr extends SearchExecutorPersistenceMgr ...@@ -95,6 +99,7 @@ public class SearchApplicantPersistenceMgr extends SearchExecutorPersistenceMgr
// Check for persistent sets already prefetched // Check for persistent sets already prefetched
if (false || !it_does_not_matterPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) || if (false || !it_does_not_matterPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!it_does_not_matterPSet.containsAttrib(SearchApplicant.FIELD_Details)|| !it_does_not_matterPSet.containsAttrib(SearchApplicant.FIELD_Details)||
!it_does_not_matterPSet.containsAttrib(SearchApplicant.FIELD_Filter)||
!it_does_not_matterPSet.containsAttrib(SearchApplicant.SINGLEREFERENCE_Job)) !it_does_not_matterPSet.containsAttrib(SearchApplicant.SINGLEREFERENCE_Job))
{ {
// We will need to retrieve it // We will need to retrieve it
...@@ -165,10 +170,10 @@ public class SearchApplicantPersistenceMgr extends SearchExecutorPersistenceMgr ...@@ -165,10 +170,10 @@ public class SearchApplicantPersistenceMgr extends SearchExecutorPersistenceMgr
{ {
int rowsUpdated = executeStatement (sqlMgr, int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}it_does_not_matter " + "UPDATE {PREFIX}it_does_not_matter " +
"SET xxxx = ?, xxxx = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " + "SET xxxx = ?, xxxx = ?, xxxx = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE it_does_not_matter.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ", "WHERE it_does_not_matter.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_Details.getForSQL(dummyDetails, it_does_not_matterPSet.getAttrib (SearchApplicant.FIELD_Details))).listEntry (SQLManager.CheckNull((Long)(it_does_not_matterPSet.getAttrib (SearchApplicant.SINGLEREFERENCE_Job)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray()); CollectionUtils.listEntry (HELPER_Details.getForSQL(dummyDetails, it_does_not_matterPSet.getAttrib (SearchApplicant.FIELD_Details))).listEntry (HELPER_Filter.getForSQL(dummyFilter, it_does_not_matterPSet.getAttrib (SearchApplicant.FIELD_Filter))).listEntry (SQLManager.CheckNull((Long)(it_does_not_matterPSet.getAttrib (SearchApplicant.SINGLEREFERENCE_Job)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
if (rowsUpdated != 1) if (rowsUpdated != 1)
{ {
...@@ -403,6 +408,7 @@ public class SearchApplicantPersistenceMgr extends SearchExecutorPersistenceMgr ...@@ -403,6 +408,7 @@ public class SearchApplicantPersistenceMgr extends SearchExecutorPersistenceMgr
it_does_not_matterPSet.setAttrib(BaseBusinessClass.FIELD_ObjectCreated, r.getTimestamp ("CREATED_DATE")); it_does_not_matterPSet.setAttrib(BaseBusinessClass.FIELD_ObjectCreated, r.getTimestamp ("CREATED_DATE"));
it_does_not_matterPSet.setAttrib(SearchApplicant.FIELD_Details, HELPER_Details.getFromRS(dummyDetails, r, "xxxx")); it_does_not_matterPSet.setAttrib(SearchApplicant.FIELD_Details, HELPER_Details.getFromRS(dummyDetails, r, "xxxx"));
it_does_not_matterPSet.setAttrib(SearchApplicant.FIELD_Filter, HELPER_Filter.getFromRS(dummyFilter, r, "xxxx"));
it_does_not_matterPSet.setAttrib(SearchApplicant.SINGLEREFERENCE_Job, r.getObject ("xxxx")); it_does_not_matterPSet.setAttrib(SearchApplicant.SINGLEREFERENCE_Job, r.getObject ("xxxx"));
...@@ -421,10 +427,10 @@ public class SearchApplicantPersistenceMgr extends SearchExecutorPersistenceMgr ...@@ -421,10 +427,10 @@ public class SearchApplicantPersistenceMgr extends SearchExecutorPersistenceMgr
{ {
executeStatement (sqlMgr, executeStatement (sqlMgr,
"INSERT INTO {PREFIX}it_does_not_matter " + "INSERT INTO {PREFIX}it_does_not_matter " +
" (xxxx, xxxx, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " + " (xxxx, xxxx, xxxx, 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_Details.getForSQL(dummyDetails, it_does_not_matterPSet.getAttrib (SearchApplicant.FIELD_Details))) .listEntry (SQLManager.CheckNull((Long)(it_does_not_matterPSet.getAttrib (SearchApplicant.SINGLEREFERENCE_Job)))) .listEntry (objectID.longID ()).toList().toArray()); CollectionUtils.listEntry (HELPER_Details.getForSQL(dummyDetails, it_does_not_matterPSet.getAttrib (SearchApplicant.FIELD_Details))).listEntry (HELPER_Filter.getForSQL(dummyFilter, it_does_not_matterPSet.getAttrib (SearchApplicant.FIELD_Filter))) .listEntry (SQLManager.CheckNull((Long)(it_does_not_matterPSet.getAttrib (SearchApplicant.SINGLEREFERENCE_Job)))) .listEntry (objectID.longID ()).toList().toArray());
it_does_not_matterPSet.setStatus (PersistentSetStatus.PROCESSED); it_does_not_matterPSet.setStatus (PersistentSetStatus.PROCESSED);
} }
......
...@@ -28,6 +28,7 @@ import performa.chart.RingChart; ...@@ -28,6 +28,7 @@ import performa.chart.RingChart;
import performa.form.LinkedInOAuthLoginFP; import performa.form.LinkedInOAuthLoginFP;
import performa.orm.*; import performa.orm.*;
import performa.orm.types.*; import performa.orm.types.*;
import performa.search.SearchApplicant;
/** /**
* *
...@@ -722,4 +723,58 @@ public class Utils ...@@ -722,4 +723,58 @@ public class Utils
return contentType.contains("msword") || contentType.contains("doc") || contentType.contains("docx") || contentType.contains("opendocument.text") return contentType.contains("msword") || contentType.contains("doc") || contentType.contains("docx") || contentType.contains("opendocument.text")
|| contentType.contains("pdf") || contentType.contains("vnd.openxmlformats-officedocument.wordprocessingml.document") || contentType.contains("text/plain") || contentType.contains("txt"); || contentType.contains("pdf") || contentType.contains("vnd.openxmlformats-officedocument.wordprocessingml.document") || contentType.contains("text/plain") || contentType.contains("txt");
} }
public static String getApplicantSortingData(SearchApplicant searchApplicant)
{
StringBuilder sb = new StringBuilder();
sb.append("{");
sb.append("value: [");
if(searchApplicant.getFilter() != null)
{
for(AppFilter filter : searchApplicant.getFilter())
{
if((filter == AppFilter.REQ || (filter.getParentNode() != null && filter.getParentNode() == AppFilter.REQ)) && searchApplicant.getJob().showAssessmentCriteriaSection())
{
sb.append("'").append(filter.getName()).append("' ,");
continue;
}
DiversityQuestion question = searchApplicant.getJob().getQuestionByFilter(filter.getIsRoot() ? filter : filter.getParentNode());
if(question != null)
{
sb.append("'").append(filter.getName()).append("' ,");
}
}
}
sb.append("],");
sb.append("options: [");
for(AppFilter appFilter : AppFilter.getAppFilterArray())
{
DiversityQuestion question = searchApplicant.getJob().getQuestionByFilter(appFilter);
if((!appFilter.getIsRoot() || question == null) && (appFilter != AppFilter.REQ || (appFilter == AppFilter.REQ && !searchApplicant.getJob().showAssessmentCriteriaSection())))
{
continue;
}
sb.append("{ id: '").append(appFilter.getName()).append("',");
sb.append("label: '").append(appFilter.getDescription()).append("',");
sb.append("children: [");
for(AppFilter child : appFilter.getChildNodes())
{
sb.append("{id:'").append(child.getName()).append("', label:'").append(child.getDescription()).append("'},");
}
sb.append("]").append("},");
}
sb.append("]").append("}");
return sb.toString();
}
} }
\ No newline at end of file
...@@ -7,9 +7,11 @@ import oneit.utils.CollectionUtils; ...@@ -7,9 +7,11 @@ import oneit.utils.CollectionUtils;
import javax.servlet.http.*; import javax.servlet.http.*;
import oneit.business.content.jsp.*; import oneit.business.content.jsp.*;
import oneit.objstore.*; import oneit.objstore.*;
import oneit.servlets.jsp.EnumSetDIH;
import oneit.servlets.jsp.ORMSimpleAssocTag; import oneit.servlets.jsp.ORMSimpleAssocTag;
import oneit.servlets.orm.DataInputHandler; import oneit.servlets.orm.DataInputHandler;
import oneit.servlets.orm.DataMap; import oneit.servlets.orm.DataMap;
import oneit.utils.EnumeratedFactory;
public class WebUtils public class WebUtils
...@@ -96,6 +98,14 @@ public class WebUtils ...@@ -96,6 +98,14 @@ public class WebUtils
} }
public static String getEnumSetKey(HttpServletRequest request, BaseBusinessClass bbc, String attributeName, EnumeratedFactory factory)
{
DataMap dataMap = DataMap.getDataMap (request, true);
EnumSetDIH eih = new EnumSetDIH(bbc, attributeName, factory);
return dataMap.storeORMHandler (eih, bbc, attributeName);
}
public static boolean descendsFrom (Article article, String parentArticleIdFilter) public static boolean descendsFrom (Article article, String parentArticleIdFilter)
{ {
if (article.getIdentifier ().equals (parentArticleIdFilter)) if (article.getIdentifier ().equals (parentArticleIdFilter))
......
...@@ -2992,6 +2992,23 @@ a.forgot-pass { ...@@ -2992,6 +2992,23 @@ a.forgot-pass {
.shorting-dropdown .form-control { .shorting-dropdown .form-control {
height: 45px; height: 45px;
} }
.appli-list-shorting .shorting-dropdown.showing{
width: 400px;
}
.vue-treeselect__control{
height: 45px !important;
}
.vue-treeselect__placeholder, .vue-treeselect__single-value {
top: 5px !important;
}
.filter-icon-btn {
display: block;
position: absolute;
background: url('../images/filter-icon.png') no-repeat center center;
width: 45px;
height: 45px;
cursor: pointer;
}
.search-input { .search-input {
background-color: rgba(255,255,255,0.5); background-color: rgba(255,255,255,0.5);
padding-right: 40px; padding-right: 40px;
...@@ -4450,6 +4467,22 @@ no-applicant.inactive a:hover,no-applicant.inactive a:hover span{ ...@@ -4450,6 +4467,22 @@ no-applicant.inactive a:hover,no-applicant.inactive a:hover span{
.appli-list-name.wider-box { .appli-list-name.wider-box {
width: 37%; width: 37%;
} }
.appli-list-name.wider-box.include-diversity {
width: 34%;
}
.appli-l.eq-second-height.diversity {
color: #4a4a4a;
font-size: 11px;
letter-spacing: 1px;
padding: 26px 10px 5px;
text-transform: uppercase;
}
.diversity .checkbox-list>label{
text-align: center;
}
.diversity .checkbox-list input[type="checkbox"]:disabled + label {
opacity: 1;
}
.appli-jcs { .appli-jcs {
color: #4a4a4a; color: #4a4a4a;
font-size: 11px; font-size: 11px;
...@@ -4554,6 +4587,9 @@ no-applicant.inactive a:hover,no-applicant.inactive a:hover span{ ...@@ -4554,6 +4587,9 @@ no-applicant.inactive a:hover,no-applicant.inactive a:hover span{
padding: 15px 23px 0; padding: 15px 23px 0;
width: 15%; width: 15%;
} }
.appli-status.include-diversity {
width: 10%;
}
.appli-list-drop{ .appli-list-drop{
float: left; float: left;
width: 100%; width: 100%;
...@@ -7692,6 +7728,62 @@ input{ ...@@ -7692,6 +7728,62 @@ input{
} }
/* /*
Start of Diversity Popup
*/
.diversity-popup{
border-radius: 4px;
background-color: #ffffff;
box-shadow: 0 0 30px 5px rgba(0, 0, 0, 0.2);
/*border: 1px solid #e8e8eb;*/
width: 55%;
height:500px;
margin: 0 auto;
text-align: center;
padding: 0;
margin-top: 150px;
}
.diversity-popup .nav-tabs{
background: #4E5258;
}
.modal-dialog.diversity{
width:100%;
}
.diversity-popup .header-bar{
background: #4E5258;
height:40px;
}
.diversity-popup .header-bar .heading{
float:left;
color:#ffffff;
font-size: 20px;
padding: 5px 20px;
}
.diversity-popup button.close{
color: #F5F7F8;
padding: 10px 20px;
opacity: 1;
}
.diversity-popup .questions{
padding-top: 40px;
}
.diversity-popup .question>label{
float:left;
padding-left: 40px;
}
.diversity-popup .question-seperator{
padding-bottom: 40px;
}
.diversity-popup .answer>span{
float:left;
padding-left: 80px;
padding-top: 10px;
}
/*
End of Diversity Popup
*/
/*
Start of CV Cover Letter Popup Start of CV Cover Letter Popup
*/ */
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
</NODE> </NODE>
<NODE name="dynamic_content_form::ADMIN_PORTAL" factory="Participant"> <NODE name="dynamic_content_form::ADMIN_PORTAL" factory="Participant">
<FORM name="*.changeDiversity" factory="Participant" class="performa.form.ChangeDiversityFP"/>
<FORM name="*.changeAssessmentCriteria" factory="Participant" class="performa.form.ChangeAssessmentCriteriaFP"/> <FORM name="*.changeAssessmentCriteria" factory="Participant" class="performa.form.ChangeAssessmentCriteriaFP"/>
<FORM name="*.changeCultureCriteria" factory="Participant" class="performa.form.ChangeCultureCriteriaFP"/> <FORM name="*.changeCultureCriteria" factory="Participant" class="performa.form.ChangeCultureCriteriaFP"/>
<FORM name="*.saveJob" factory="Participant" class="performa.form.SaveJobFP"/> <FORM name="*.saveJob" factory="Participant" class="performa.form.SaveJobFP"/>
......
...@@ -168,6 +168,21 @@ ...@@ -168,6 +168,21 @@
<oneit:toString value="<%= job.getRequireCV() ? "Yes" : "No" %>" mode="EscapeHTML"/> <oneit:toString value="<%= job.getRequireCV() ? "Yes" : "No" %>" mode="EscapeHTML"/>
</div> </div>
</div> </div>
<%
if(job.getHiringTeam().showHasDiversity())
{
%>
<div class="form-group row">
<div class="col-md-4">
<label><oneit:label GUIName="Will the Diversity module be used for this Job?" /></label>
</div>
<div class="col-md-8">
<oneit:toString value="<%= job.getDiversityIncluded() ? "Yes" : "No" %>" mode="EscapeHTML"/>
</div>
</div>
<%
}
%>
<div class="form-brack-line-sub"></div> <div class="form-brack-line-sub"></div>
<div class="form-group row"> <div class="form-group row">
<div class="col-md-4"> <div class="col-md-4">
......
...@@ -440,7 +440,7 @@ ...@@ -440,7 +440,7 @@
<oneit:ormInput obj="<%= template %>" id="require-cv" attributeName="RequireCV" type="checkbox"/> <oneit:ormInput obj="<%= template %>" id="require-cv" attributeName="RequireCV" type="checkbox"/>
<oneit:recalcClass htmlTag="span" classScript="template.getRequireCV() != null && template.getRequireCV() ? 'checked': 'unchecked'" template="<%= template %>"> <oneit:recalcClass htmlTag="span" classScript="template.getRequireCV() != null && template.getRequireCV() ? 'checked': 'unchecked'" template="<%= template %>">
<label for="require-cv"> <label for="require-cv">
<oneit:label GUIName="Require CV and Cover Letter from Candidate" /> <oneit:label GUIName="Require CV and Cover Letter from Applicant?" />
</label> </label>
</oneit:recalcClass> </oneit:recalcClass>
</div> </div>
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
new ObjectTransform[]{WorkFlow.pipesWorkFlow().toSortOrder()}, new ObjectTransform[]{WorkFlow.pipesWorkFlow().toSortOrder()},
new Comparator[]{CollectionUtils.DEFAULT_COMPARATOR_NULLS_FIRST}); new Comparator[]{CollectionUtils.DEFAULT_COMPARATOR_NULLS_FIRST});
HiringTeam hiringTeam = job.getHiringTeam(); HiringTeam hiringTeam = job.getHiringTeam();
String keyName = WebUtils.getEnumSetKey(request, searchApplicant, SearchApplicant.FIELD_Filter, AppFilter.FACTORY_AppFilter);
%> %>
<oneit:dynIncluded> <oneit:dynIncluded>
...@@ -41,6 +42,13 @@ ...@@ -41,6 +42,13 @@
$('.checkbox-list input:checkbox').not(this).prop('checked', this.checked); $('.checkbox-list input:checkbox').not(this).prop('checked', this.checked);
enableBulkEdit(); enableBulkEdit();
}); });
Vue.component('treeselect', VueTreeselect.Treeselect)
new Vue({
el: '#app',
data: <%= Utils.getApplicantSortingData(searchApplicant)%>
});
}); });
function enableBulkEdit() { function enableBulkEdit() {
...@@ -52,6 +60,9 @@ ...@@ -52,6 +60,9 @@
$('.search-icon-btn').click(function () { $('.search-icon-btn').click(function () {
$('.search-real-btn').click(); $('.search-real-btn').click();
}); });
$('.filter-icon-btn').click(function () {
$('.search-real-btn').click();
});
}); });
</script> </script>
<div class="main-applicants-filter"> <div class="main-applicants-filter">
...@@ -105,13 +116,13 @@ ...@@ -105,13 +116,13 @@
<div class="shorting-dropdown application_sorting_bar"> <div class="shorting-dropdown application_sorting_bar">
<div class="appli-order-label">Search Applicants</div> <div class="appli-order-label">Search Applicants</div>
<oneit:ormInput obj="<%= searchApplicant %>" type="text" attributeName="Details" cssClass="form-control search-input" id="searchText" /> <oneit:ormInput obj="<%= searchApplicant %>" type="text" attributeName="Details" cssClass="form-control search-input" id="searchText" />
<span class="search-icon-btn"></span> <span class="search-icon-btn"></span>
</div> </div>
<oneit:button value="Search" name="search" cssClass="btn btn-primary search-real-btn" style="display:none;"/> <oneit:button value="Search" name="search" cssClass="btn btn-primary search-real-btn" style="display:none;"/>
<% <%
if(showOrderBy) if(showOrderBy)
{ {
%> %>
<div class="shorting-dropdown"> <div class="shorting-dropdown">
<span class="appli-order-label">order by</span> <span class="appli-order-label">order by</span>
<select class="form-control" onChange="location=this.value"> <select class="form-control" onChange="location=this.value">
...@@ -128,26 +139,23 @@ ...@@ -128,26 +139,23 @@
%> %>
</select> </select>
</div> </div>
<% <%
} }
%>
<div class="shorting-dropdown"> if(job.hasDiversityQuestions() || job.showAssessmentCriteriaSection())
<span class="appli-order-label">Showing</span> {
<select class="form-control status-img" onChange="location=this.value"> %>
<% <div class="shorting-dropdown showing">
for (ApplicationFilter applicationFilter : ApplicationFilter.getApplicationFilterArray()) <span class="appli-order-label">Showing</span>
{ <div id="app" style="float:left; width:80%;">
String optionLink = applicantsPage + "&ApplicationFilter=" + applicationFilter.getName(); <treeselect name="<%= keyName %>" v-model="value" :multiple="true" :options="options" />
%> </div>
<option data-image="images/<%= applicationFilter.getName().toLowerCase() %>.png" <%= (appFilter != null && appFilter == applicationFilter ? "selected" : "" )%> value="<%= optionLink %>"> <div style="float:right; width:20%;">
<oneit:toString value="<%= applicationFilter.getDescription() %>" mode="EscapeHTML"/> <span class="filter-icon-btn" ></span>
</option> </div>
<% </div>
}
%>
</select>
</div>
<% <%
}
} }
%> %>
</div> </div>
...@@ -156,5 +164,4 @@ ...@@ -156,5 +164,4 @@
<label for="select_all" class="select-all-jobs">&nbsp;&nbsp;Select all applicants</label> <label for="select_all" class="select-all-jobs">&nbsp;&nbsp;Select all applicants</label>
</div> </div>
</div> </div>
</oneit:dynIncluded> </oneit:dynIncluded>
...@@ -33,6 +33,11 @@ ...@@ -33,6 +33,11 @@
<%@include file="/hotjar.jsp" %> <%@include file="/hotjar.jsp" %>
<%@page import="oneit.servlets.portability.BrowserServices"%> <%@page import="oneit.servlets.portability.BrowserServices"%>
<!--filter on applicant list-->
<script src="https://cdn.jsdelivr.net/npm/vue@^2"></script>
<script src="https://cdn.jsdelivr.net/npm/@riophae/vue-treeselect@0.0.38/dist/vue-treeselect.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@riophae/vue-treeselect@0.0.38/dist/vue-treeselect.min.css">
<!-- Google Tag Manager --> <!-- Google Tag Manager -->
<script> <script>
dataLayer = [{ dataLayer = [{
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
new ObjectTransform[]{WorkFlow.pipesWorkFlow().toSortOrder()}, new ObjectTransform[]{WorkFlow.pipesWorkFlow().toSortOrder()},
new Comparator[]{CollectionUtils.DEFAULT_COMPARATOR_NULLS_FIRST}); new Comparator[]{CollectionUtils.DEFAULT_COMPARATOR_NULLS_FIRST});
HiringTeam hiringTeam = job.getHiringTeam(); HiringTeam hiringTeam = job.getHiringTeam();
boolean hasDiversity = job.hasDiversityQuestions();
String hasDiversityCss = hasDiversity ? "include-diversity" : "";
%> %>
<oneit:dynIncluded> <oneit:dynIncluded>
...@@ -75,7 +77,7 @@ ...@@ -75,7 +77,7 @@
<label for="<%= appID %>"></label> <label for="<%= appID %>"></label>
</div> </div>
</div> </div>
<div class="appli-list-name appli-l eq-second-height wider-box"> <div class="appli-list-name appli-l eq-second-height wider-box <%= hasDiversityCss %>">
<% <%
if(!hiringTeam.isTrue(hiringTeam.getOnTrial()) || j < 2) if(!hiringTeam.isTrue(hiringTeam.getOnTrial()) || j < 2)
{ {
...@@ -203,7 +205,21 @@ ...@@ -203,7 +205,21 @@
</span> </span>
role fit role fit
</div> </div>
<div class="appli-status appli-l eq-second-height"> <%
if(hasDiversity)
{
%>
<div class="appli-l eq-second-height diversity">
<div class="checkbox-list">
<input type="checkbox" name="DiversityComplete" <%= jobApplication.diversityCompleted() ? "checked" : "" %> id="<%= appID + "_diversity" %>" class="applicant" disabled>
<label for="<%= appID + "_diversity" %>"></label>
</div>
diversity
</div>
<%
}
%>
<div class="appli-status appli-l eq-second-height <%= hasDiversityCss %>">
<% <%
if(jobApplication.getApplicationStatus() == ApplicationStatus.DRAFT) if(jobApplication.getApplicationStatus() == ApplicationStatus.DRAFT)
{ {
......
...@@ -96,6 +96,10 @@ ...@@ -96,6 +96,10 @@
function previewCV(){ function previewCV(){
$('#pdfPreview').modal('show'); $('#pdfPreview').modal('show');
} }
function previewDiversity(){
$('#diversityPreview').modal('show');
}
</script> </script>
<div class="main-applicant-content dashboard-content-area v-applicant-area "> <div class="main-applicant-content dashboard-content-area v-applicant-area ">
<div class="applicant-header"> <div class="applicant-header">
...@@ -112,6 +116,15 @@ ...@@ -112,6 +116,15 @@
</div> </div>
<div class="main-export"> <div class="main-export">
<% <%
if(jobApplication.isDiversityIncluded())
{
%>
<a href="#" class="btn cv-cover-letter" onclick="previewDiversity()">
Diversity
</a>
<%
}
if((onTrial && isVisible) || !onTrial) if((onTrial && isVisible) || !onTrial)
{ {
if(jobApplication.getCV() != null && jobApplication.getCoverLetter() != null) if(jobApplication.getCV() != null && jobApplication.getCoverLetter() != null)
...@@ -770,4 +783,50 @@ ...@@ -770,4 +783,50 @@
</div> </div>
</div> </div>
</div> </div>
<div class="modal fade" id="diversityPreview" role="dialog">
<div class="modal-dialog diversity">
<div class="modal-body diversity-popup">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<div class="header-bar">
<div class="heading">Diversity Questions</div>
</div>
<div class="container questions">
<%
for(HTDiversityQuestion question : job.getDiversityQuestions())
{
%>
<div class="question-seperator">
<div class="row">
<div class="col-md-12 question">
<label>Q. <oneit:toString value="<%= question.getQuestionText() %>" mode="EscapeHTML"/></label>
</div>
</div>
<%
DiversityQuestion originalQuestion = question.getQuestion();
CandidateDiversityAnswer candidateAnswer = candidate.getDiversityAnswerByQuestion(originalQuestion);
if(candidateAnswer != null)
{
for(AnswerOption answer : candidateAnswer.getAnswersSet())
{
%>
<div class="row">
<div class="col-md-12 answer">
<oneit:toString value="<%= answer.getAnswer().getAnswer() %>" mode="EscapeHTML"/>
</div>
</div>
<%
}
}
%>
</div>
<%
}
%>
</div>
</div>
</div>
</div>
</oneit:dynIncluded> </oneit:dynIncluded>
\ No newline at end of file
...@@ -20,10 +20,10 @@ ...@@ -20,10 +20,10 @@
Debug.assertion (iloJobTitle != null, "ILOJobTitle is null in admin portal create job"); Debug.assertion (iloJobTitle != null, "ILOJobTitle is null in admin portal create job");
SecUser txUser = SecUser.getTXUser(process.getTransaction()); SecUser txUser = SecUser.getTXUser(process.getTransaction());
CompanyUser companyUser = txUser.getExtension(CompanyUser.REFERENCE_CompanyUser); CompanyUser companyUser = txUser.getExtension(CompanyUser.REFERENCE_CompanyUser);
AssessmentCriteriaTemplate[] templates = job.getAssessmentTemplates(); AssessmentCriteriaTemplate[] templates = job.getAssessmentTemplates();
String nextPage = WebUtils.getSamePageInRenderMode(request, WebUtils.ASSESSMENT_CRITERIA); String nextPage = WebUtils.getSamePageInRenderMode(request, WebUtils.ASSESSMENT_CRITERIA);
%> %>
<style> <style>
...@@ -427,13 +427,34 @@ ...@@ -427,13 +427,34 @@
<oneit:ormInput obj="<%= job %>" id="require-cv" attributeName="RequireCV" type="checkbox"/> <oneit:ormInput obj="<%= job %>" id="require-cv" attributeName="RequireCV" type="checkbox"/>
<oneit:recalcClass htmlTag="span" classScript="job.getRequireCV() != null && job.getRequireCV() ? 'checked': 'unchecked'" job="<%= job %>"> <oneit:recalcClass htmlTag="span" classScript="job.getRequireCV() != null && job.getRequireCV() ? 'checked': 'unchecked'" job="<%= job %>">
<label for="require-cv"> <label for="require-cv">
<oneit:label GUIName="Require CV and Cover Letter from Candidate" /> <oneit:label GUIName="Require CV and Cover Letter from Applicant?" />
</label> </label>
</oneit:recalcClass> </oneit:recalcClass>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<%
if(job.getHiringTeam().showHasDiversity())
{
%>
<div class="form-group row">
<div class="col-md-12">
<div class="styled_checkboxes">
<div class="checkbox checkbox-primary">
<oneit:ormInput obj="<%= job %>" id="diversity-included" attributeName="DiversityIncluded" type="checkbox"/>
<oneit:recalcClass htmlTag="span" classScript="job.getDiversityIncluded() != null && job.getDiversityIncluded() ? 'checked': 'unchecked'" job="<%= job %>">
<label for="diversity-included">
<oneit:label GUIName="Will the Diversity module be used for this Job?" />
</label>
</oneit:recalcClass>
</div>
</div>
</div>
</div>
<%
}
%>
</div> </div>
<div class="form-page-section darkbg"> <div class="form-page-section darkbg">
<div class="form-group row"> <div class="form-group row">
......
...@@ -206,6 +206,23 @@ ...@@ -206,6 +206,23 @@
</span> </span>
</div> </div>
</div> </div>
<%
if(job.getHiringTeam().showHasDiversity())
{
%>
<div class="row">
<div class="col-md-4 review-medium-title">
<oneit:label GUIName="Will the Diversity module be used for this Job?" />
</div>
<div class="col-md-8">
<span class="skill-label">
<oneit:toString value="<%= job.getDiversityIncluded() ? "Yes" : "No" %>" mode="EscapeHTML" />
</span>
</div>
</div>
<%
}
%>
</div> </div>
<div class="form-brack-line-sub"></div> <div class="form-brack-line-sub"></div>
<div class="form-group job-detail-subsection"> <div class="form-group job-detail-subsection">
......
...@@ -21,23 +21,23 @@ ...@@ -21,23 +21,23 @@
%> %>
<script type="text/javascript"> <script type="text/javascript">
var PopupAlert = null; var PopupAlert = null;
var PopupMsg = null; var PopupMsg = null;
$(document).ready(function() $(document).ready(function()
{ {
recalcFunction = setupRecalc ($("form#editCompany"), {'recalcOnError':true}); recalcFunction = setupRecalc ($("form#editCompany"), {'recalcOnError':true});
PopupMsg = new jBox('Modal', { PopupMsg = new jBox('Modal', {
id : "msg-pop", id : "msg-pop",
overlay : true, overlay : true,
width :600, height : 450 width :600, height : 450
}); });
PopupAlert = new jBox('Modal', { PopupAlert = new jBox('Modal', {
id : "alert-pop", id : "alert-pop",
overlay : true, overlay : true,
width : 350, height : 320 width : 350, height : 320
}); });
$("#upload").change(function(){ $("#upload").change(function(){
...@@ -81,9 +81,19 @@ ...@@ -81,9 +81,19 @@
}); });
$('input[type="text"][id$="Industry"]').attr('placeholder','Please select an Industry'); $('input[type="text"][id$="Industry"]').attr('placeholder','Please select an Industry');
var hasDiversity = $(".has-diversity input:checked").val();
$(".has-diversity input").change(function(){
if (hasDiversity !== $(this).val()){
if($(this).val()==='true'){
$("button[name$='changeDiversity']").click();
}
hasDiversity = $(this).val();
}
});
}); });
function disableOutSideLinks(){ function disableOutSideLinks(){
$("a ").each(function(){ $("a ").each(function(){
if ( !$(this).parents(".form-content-wrap").length) { if ( !$(this).parents(".form-content-wrap").length) {
...@@ -131,6 +141,13 @@ ...@@ -131,6 +141,13 @@
.main-welcome-popup h2 { .main-welcome-popup h2 {
padding: 0 20px 0; padding: 0 20px 0;
} }
.form-control.no-border {
border: 0 !important;
}
.disabled-question{
color:#908e8e;
padding-left: 10px;
}
</style> </style>
<div class="container-fluid"> <div class="container-fluid">
<div class="row content"> <div class="row content">
...@@ -233,22 +250,89 @@ ...@@ -233,22 +250,89 @@
<oneit:ormEnum obj="<%= hiringTeam %>" attributeName="Industry" cssClass="form-control" displayType="autocomplete"/> <oneit:ormEnum obj="<%= hiringTeam %>" attributeName="Industry" cssClass="form-control" displayType="autocomplete"/>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group row">
<div class="styled_checkboxes"> <div class="col-md-12">
<div class="checkbox checkbox-primary"> <label><oneit:label GUIName="Will this team help Clients with hiring?" /><a href="#" title="Selecting this option activates the Client functionality and <br/>allows Jobs and Templates to be grouped and filtered by Client." class="info-icon"><img src="images/info-icon.png" /></a></label>
<oneit:ormInput obj="<%= hiringTeam %>" id="has-client-support" attributeName="HasClientSupport" type="checkbox"/> </div>
<oneit:recalcClass htmlTag="span" classScript="hiringTeam.showHasClientSupport() ? 'checked': 'unchecked'" hiringTeam="<%= hiringTeam %>"> </div>
<label for="has-client-support"> <div class="form-group row">
<oneit:ormlabel obj="<%= hiringTeam %>" field="HasClientSupport" /> <div class="col-md-6">
</label> <div class="radio radio-primary second-radio-primary oneit-radio">
</oneit:recalcClass> <label>
<oneit:ormInput obj="<%= hiringTeam %>" type="radio" attributeName="HasClientSupport" value="true"/>Yes
</label>
</div>
<div class="radio radio-primary second-radio-primary oneit-radio">
<label>
<oneit:ormInput obj="<%= hiringTeam %>" type="radio" attributeName="HasClientSupport" value="false"/>No
</label>
</div>
</div>
</div>
<div class="form-brack-line-sub"></div>
<div class="form-group row">
<div class="col-md-12">
<label><oneit:label GUIName="Will this Hiring Team use the Diversity questions?" /><a href="#" title="Selecting this option allows the capture of Diversity demographics <br/>from applicants to be used as part of affirmative action hiring." class="info-icon"><img src="images/info-icon.png" /></a></label>
</div>
</div>
<div class="form-group row has-diversity">
<div class="col-md-6">
<div class="radio radio-primary second-radio-primary oneit-radio">
<label>
<oneit:ormInput obj="<%= hiringTeam %>" type="radio" attributeName="HasDiversity" value="true"/>Yes
</label>
</div> </div>
<div class="radio radio-primary second-radio-primary oneit-radio">
<label>
<oneit:ormInput obj="<%= hiringTeam %>" type="radio" attributeName="HasDiversity" value="false"/>No
</label>
</div>
<%
if(hiringTeam.getDiversityQuestionsCount() == 0)
{
%>
<oneit:button value=" " name="changeDiversity" cssClass="hide"
requestAttribs="<%= CollectionUtils.mapEntry ("HiringTeam", hiringTeam)
.mapEntry (UpdateMappedObjFP.FAIL_VALIDATION_ERRORS, Boolean.FALSE)
.toMap() %>" />
<%
}
%>
</div> </div>
</div> </div>
<oneit:recalcClass htmlTag="div" classScript="hiringTeam.showHasDiversity() ? 'show': 'hide'" hiringTeam="<%= hiringTeam %>">
<%
for(HTDiversityQuestion question : hiringTeam.getDiversityQuestionsSet())
{
%>
<div class="form-group row">
<div class="col-md-11">
<oneit:recalcClass htmlTag="div" classScript="question.getIsApplicable() ? 'show': 'hide'" question="<%= question %>">
<oneit:ormInput obj="<%= question %>" type="text" attributeName="QuestionText" cssClass="form-control no-border"/>
</oneit:recalcClass>
<oneit:recalcClass htmlTag="div" classScript="question.getIsApplicable() ? 'hide': 'show'" question="<%= question %>">
<span class="disabled-question">
<oneit:toString value="<%= question.getQuestionText() %>" mode="EscapeHTML"/>
</span>
</oneit:recalcClass>
</div>
<div class="col-md-1">
<label class="switch">
<oneit:recalcClass htmlTag="span" classScript="question.getIsApplicable() ? 'checkbox checked': 'checkbox unchecked'" question="<%= question %>">
<oneit:ormInput obj="<%= question %>" attributeName="IsApplicable" type="checkbox"/>
</oneit:recalcClass>
<div class="slider round"></div>
</label>
</div>
</div>
<%
}
%>
</oneit:recalcClass>
<% <%
if(Utils.isAssumedUser(request)) if(Utils.isAssumedUser(request))
{ {
%> %> <div class="form-brack-line-sub"></div>
<div class="form-group"> <div class="form-group">
<label><oneit:ormlabel obj="<%= hiringTeam %>" field="MessageID" /></label> <label><oneit:ormlabel obj="<%= hiringTeam %>" field="MessageID" /></label>
<oneit:ormInput obj="<%= hiringTeam %>" type="text" attributeName="MessageID" cssClass="form-control"/> <oneit:ormInput obj="<%= hiringTeam %>" type="text" attributeName="MessageID" cssClass="form-control"/>
...@@ -267,7 +351,7 @@ ...@@ -267,7 +351,7 @@
</oneit:recalcClass> </oneit:recalcClass>
<div class="form-group row"> <div class="form-group row">
<div class="col-md-6"> <div class="col-md-6">
<label><oneit:label GUIName="Will this team manage its own billing?" /></label> <label><oneit:label GUIName="Will this team manage its own billing?" /><a href="#" title="Selecting this option allows the entry of <br/>separate billing details for this Hiring Team." class="info-icon"><img src="images/info-icon.png" /></a></label>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<oneit:recalcClass htmlTag="div" classScript="hiringTeam.getManageOwnBilling() ? 'hide': 'show'" hiringTeam="<%= hiringTeam %>"> <oneit:recalcClass htmlTag="div" classScript="hiringTeam.getManageOwnBilling() ? 'hide': 'show'" hiringTeam="<%= hiringTeam %>">
......
<?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_candidate_diversity_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="question_id" type="Long" length="11" nullable="false"/>
<column name="candidate_id" type="Long" length="11" nullable="false"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_candidate_diversity_answer" indexName="idx_tl_candidate_diversity_answer_candidate_id" isUnique="false">
<column name="candidate_id"/>
</NODE>
</NODE>
</OBJECTS>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun -->
<OBJECTS name="" xmlns:oneit="http://www.1iT.com.au">
<NODE name="Script" factory="Vector">
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.DefineTableOperation">
<tableName factory="String">tl_diversity_answer</tableName>
<column name="object_id" type="Long" nullable="false" length="11"/>
<column name="object_last_updated_date" type="Date" nullable="false" length="22"/>
<column name="object_created_date" type="Date" nullable="false" length="22"/>
<column name="answer" type="CLOB" nullable="false"/>
<column name="question_id" type="Long" length="11" nullable="false"/>
<column name="answer_code" type="CLOB" nullable="false"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_diversity_answer" indexName="idx_tl_diversity_answer_question_id" isUnique="false">
<column name="question_id"/>
</NODE>
</NODE>
</OBJECTS>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun -->
<OBJECTS name="" xmlns:oneit="http://www.1iT.com.au">
<NODE name="Script" factory="Vector">
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.DefineTableOperation">
<tableName factory="String">tl_diversity_question</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="question_code" type="CLOB" nullable="false"/>
<column name="question_text" type="CLOB" nullable="false"/>
<column name="australia_only" type="Boolean" nullable="true"/>
<column name="multiple_answers" type="Boolean" nullable="true"/>
</NODE>
</NODE>
</OBJECTS>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun -->
<OBJECTS name="" xmlns:oneit="http://www.1iT.com.au">
<NODE name="Script" factory="Vector">
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.DefineTableOperation">
<tableName factory="String">tl_ht_diversity_question</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="question_text" type="CLOB" nullable="false"/>
<column name="is_applicable" type="Boolean" nullable="true"/>
<column name="question_id" type="Long" length="11" nullable="false"/>
<column name="hiring_team_id" type="Long" length="11" nullable="false"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_ht_diversity_question" indexName="idx_tl_ht_diversity_question_hiring_team_id" isUnique="false">
<column name="hiring_team_id"/>
</NODE>
</NODE>
</OBJECTS>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun -->
<OBJECTS name="" xmlns:oneit="http://www.1iT.com.au">
<NODE name="Script" factory="Vector">
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.RedefineTableOperation">
<tableName factory="String">tl_hiring_team</tableName>
<column name="has_diversity" type="Boolean" nullable="true"/>
</NODE>
</NODE>
</OBJECTS>
\ No newline at end of file
UPDATE tl_hiring_team SET has_diversity = 'N';
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun -->
<OBJECTS name="" xmlns:oneit="http://www.1iT.com.au">
<NODE name="Script" factory="Vector">
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.RedefineTableOperation">
<tableName factory="String">tl_job</tableName>
<column name="diversity_included" type="Boolean" nullable="true"/>
</NODE>
</NODE>
</OBJECTS>
\ No newline at end of file
<?xml version="1.0"?>
<!-- @AutoRun -->
<OBJECTS name="">
<NODE name="Script" factory="Vector">
<!-- Diversity Questions -->
<NODE name="insertOp" factory="Participant" class="oneit.sql.transfer.InsertOperation">
<tableName factory="String">tl_diversity_question</tableName>
<value name='object_id' factory='Participant' class="oneit.sql.transfer.DBTransferer$ObjectID" keyName="firstQuestion"/>
<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='australia_only' factory='Boolean'>true</value>
<value name='multiple_answers' factory='Boolean'>false</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>
</NODE>
<NODE name="insertOp" factory="Participant" class="oneit.sql.transfer.InsertOperation">
<tableName factory="String">tl_diversity_question</tableName>
<value name='object_id' factory='Participant' class="oneit.sql.transfer.DBTransferer$ObjectID" keyName="secondQuestion"/>
<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='australia_only' factory='Boolean'>false</value>
<value name='multiple_answers' factory='Boolean'>true</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>
</NODE>
<NODE name="insertOp" factory="Participant" class="oneit.sql.transfer.InsertOperation">
<tableName factory="String">tl_diversity_question</tableName>
<value name='object_id' factory='Participant' class="oneit.sql.transfer.DBTransferer$ObjectID" keyName="thirdQuestion"/>
<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='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_code' factory='String'>GENDER</value>
</NODE>
<!-- Diversity Answers -->
<!-- first question -->
<NODE name="insertOp" factory="Participant" class="oneit.sql.transfer.InsertOperation">
<tableName factory="String">tl_diversity_answer</tableName>
<value name='object_id' factory='Participant' class="oneit.sql.transfer.DBTransferer$ObjectID"/>
<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='answer' factory='String'>No</value>
<value name='question_id' factory='Participant' class="oneit.sql.transfer.DBTransferer$ObjectID" keyName="firstQuestion"/>
<value name='answer_code' factory='String'>ATSI_NO</value>
</NODE>
<NODE name="insertOp" factory="Participant" class="oneit.sql.transfer.InsertOperation">
<tableName factory="String">tl_diversity_answer</tableName>
<value name='object_id' factory='Participant' class="oneit.sql.transfer.DBTransferer$ObjectID"/>
<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='answer' factory='String'>Yes, Aboriginal origin</value>
<value name='question_id' factory='Participant' class="oneit.sql.transfer.DBTransferer$ObjectID" keyName="firstQuestion"/>
<value name='answer_code' factory='String'>ATSI_ABORIGINAL</value>
</NODE>
<NODE name="insertOp" factory="Participant" class="oneit.sql.transfer.InsertOperation">
<tableName factory="String">tl_diversity_answer</tableName>
<value name='object_id' factory='Participant' class="oneit.sql.transfer.DBTransferer$ObjectID"/>
<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='answer' factory='String'>Yes, Torres Strait Islander origin</value>
<value name='question_id' factory='Participant' class="oneit.sql.transfer.DBTransferer$ObjectID" keyName="firstQuestion"/>
<value name='answer_code' factory='String'>ATSI_TSI</value>
</NODE>
<NODE name="insertOp" factory="Participant" class="oneit.sql.transfer.InsertOperation">
<tableName factory="String">tl_diversity_answer</tableName>
<value name='object_id' factory='Participant' class="oneit.sql.transfer.DBTransferer$ObjectID"/>
<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='answer' factory='String'>Yes, both</value>
<value name='question_id' factory='Participant' class="oneit.sql.transfer.DBTransferer$ObjectID" keyName="firstQuestion"/>
<value name='answer_code' factory='String'>ATSI_BOTH</value>
</NODE>
<!-- second question -->
<NODE name="insertOp" factory="Participant" class="oneit.sql.transfer.InsertOperation">
<tableName factory="String">tl_diversity_answer</tableName>
<value name='object_id' factory='Participant' class="oneit.sql.transfer.DBTransferer$ObjectID"/>
<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='answer' factory='String'>No</value>
<value name='question_id' factory='Participant' class="oneit.sql.transfer.DBTransferer$ObjectID" keyName="secondQuestion"/>
<value name='answer_code' factory='String'>DISABLED_NO</value>
</NODE>
<NODE name="insertOp" factory="Participant" class="oneit.sql.transfer.InsertOperation">
<tableName factory="String">tl_diversity_answer</tableName>
<value name='object_id' factory='Participant' class="oneit.sql.transfer.DBTransferer$ObjectID"/>
<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='answer' factory='String'>Hearing</value>
<value name='question_id' factory='Participant' class="oneit.sql.transfer.DBTransferer$ObjectID" keyName="secondQuestion"/>
<value name='answer_code' factory='String'>DISABLED_HEARING</value>
</NODE>
<NODE name="insertOp" factory="Participant" class="oneit.sql.transfer.InsertOperation">
<tableName factory="String">tl_diversity_answer</tableName>
<value name='object_id' factory='Participant' class="oneit.sql.transfer.DBTransferer$ObjectID"/>
<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='answer' factory='String'>Learning</value>
<value name='question_id' factory='Participant' class="oneit.sql.transfer.DBTransferer$ObjectID" keyName="secondQuestion"/>
<value name='answer_code' factory='String'>DISABLED_LEARNING</value>
</NODE>
<NODE name="insertOp" factory="Participant" class="oneit.sql.transfer.InsertOperation">
<tableName factory="String">tl_diversity_answer</tableName>
<value name='object_id' factory='Participant' class="oneit.sql.transfer.DBTransferer$ObjectID"/>
<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='answer' factory='String'>Medical / Physical / Psychiatric</value>
<value name='question_id' factory='Participant' class="oneit.sql.transfer.DBTransferer$ObjectID" keyName="secondQuestion"/>
<value name='answer_code' factory='String'>DISABLED_MEDICAL</value>
</NODE>
<NODE name="insertOp" factory="Participant" class="oneit.sql.transfer.InsertOperation">
<tableName factory="String">tl_diversity_answer</tableName>
<value name='object_id' factory='Participant' class="oneit.sql.transfer.DBTransferer$ObjectID"/>
<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='answer' factory='String'>Sight</value>
<value name='question_id' factory='Participant' class="oneit.sql.transfer.DBTransferer$ObjectID" keyName="secondQuestion"/>
<value name='answer_code' factory='String'>DISABLED_SIGHT</value>
</NODE>
<NODE name="insertOp" factory="Participant" class="oneit.sql.transfer.InsertOperation">
<tableName factory="String">tl_diversity_answer</tableName>
<value name='object_id' factory='Participant' class="oneit.sql.transfer.DBTransferer$ObjectID"/>
<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='answer' factory='String'>Speech</value>
<value name='question_id' factory='Participant' class="oneit.sql.transfer.DBTransferer$ObjectID" keyName="secondQuestion"/>
<value name='answer_code' factory='String'>DISABLED_SPEECH</value>
</NODE>
<NODE name="insertOp" factory="Participant" class="oneit.sql.transfer.InsertOperation">
<tableName factory="String">tl_diversity_answer</tableName>
<value name='object_id' factory='Participant' class="oneit.sql.transfer.DBTransferer$ObjectID"/>
<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='answer' factory='String'>Use of Arms and Hands</value>
<value name='question_id' factory='Participant' class="oneit.sql.transfer.DBTransferer$ObjectID" keyName="secondQuestion"/>
<value name='answer_code' factory='String'>DISABLED_ARMS</value>
</NODE>
<NODE name="insertOp" factory="Participant" class="oneit.sql.transfer.InsertOperation">
<tableName factory="String">tl_diversity_answer</tableName>
<value name='object_id' factory='Participant' class="oneit.sql.transfer.DBTransferer$ObjectID"/>
<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='answer' factory='String'>Use of Legs</value>
<value name='question_id' factory='Participant' class="oneit.sql.transfer.DBTransferer$ObjectID" keyName="secondQuestion"/>
<value name='answer_code' factory='String'>DISABLED_LEGS</value>
</NODE>
<NODE name="insertOp" factory="Participant" class="oneit.sql.transfer.InsertOperation">
<tableName factory="String">tl_diversity_answer</tableName>
<value name='object_id' factory='Participant' class="oneit.sql.transfer.DBTransferer$ObjectID"/>
<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='answer' factory='String'>Other</value>
<value name='question_id' factory='Participant' class="oneit.sql.transfer.DBTransferer$ObjectID" keyName="secondQuestion"/>
<value name='answer_code' factory='String'>DISABLED_OTHER</value>
</NODE>
<!-- third question -->
<NODE name="insertOp" factory="Participant" class="oneit.sql.transfer.InsertOperation">
<tableName factory="String">tl_diversity_answer</tableName>
<value name='object_id' factory='Participant' class="oneit.sql.transfer.DBTransferer$ObjectID"/>
<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='answer' factory='String'>Man</value>
<value name='question_id' factory='Participant' class="oneit.sql.transfer.DBTransferer$ObjectID" keyName="thirdQuestion"/>
<value name='answer_code' factory='String'>GENDER_MAN</value>
</NODE>
<NODE name="insertOp" factory="Participant" class="oneit.sql.transfer.InsertOperation">
<tableName factory="String">tl_diversity_answer</tableName>
<value name='object_id' factory='Participant' class="oneit.sql.transfer.DBTransferer$ObjectID"/>
<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='answer' factory='String'>Woman</value>
<value name='question_id' factory='Participant' class="oneit.sql.transfer.DBTransferer$ObjectID" keyName="thirdQuestion"/>
<value name='answer_code' factory='String'>GENDER_WOMAN</value>
</NODE>
<NODE name="insertOp" factory="Participant" class="oneit.sql.transfer.InsertOperation">
<tableName factory="String">tl_diversity_answer</tableName>
<value name='object_id' factory='Participant' class="oneit.sql.transfer.DBTransferer$ObjectID"/>
<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='answer' factory='String'>Other, non-binary</value>
<value name='question_id' factory='Participant' class="oneit.sql.transfer.DBTransferer$ObjectID" keyName="thirdQuestion"/>
<value name='answer_code' factory='String'>GENDER_OTHER</value>
</NODE>
</NODE>
</OBJECTS>
UPDATE tl_job SET diversity_included = 'N';
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun -->
<OBJECTS name="" xmlns:oneit="http://www.1iT.com.au">
<NODE name="Script" factory="Vector">
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.DefineTableOperation">
<tableName factory="String">tl_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="is_selected" type="Boolean" nullable="true"/>
<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
...@@ -45,10 +45,10 @@ ...@@ -45,10 +45,10 @@
applications = (JobApplication[]) searchApplicant.doSearch(); applications = (JobApplication[]) searchApplicant.doSearch();
} }
if (getData (request, GenericObjSearchDF.GENERIC_SEARCH_RESULTS) != null) // if (getData (request, GenericObjSearchDF.GENERIC_SEARCH_RESULTS) != null)
{ // {
applications = (JobApplication[])getData (request, GenericObjSearchDF.GENERIC_SEARCH_RESULTS); // applications = (JobApplication[])getData (request, GenericObjSearchDF.GENERIC_SEARCH_RESULTS);
} // }
process.setAttribute("JobApplications", applications); process.setAttribute("JobApplications", applications);
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
<FORM name="*.saveAndExitExperienece" factory="Participant" class="performa.form.SaveAndExitExperienceFP"/> <FORM name="*.saveAndExitExperienece" factory="Participant" class="performa.form.SaveAndExitExperienceFP"/>
<FORM name="*.saveAndExitCulture" factory="Participant" class="performa.form.SaveAndExitCultureFP"/> <FORM name="*.saveAndExitCulture" factory="Participant" class="performa.form.SaveAndExitCultureFP"/>
<FORM name="*.saveAndExitWorkStyle" factory="Participant" class="performa.form.SaveAndExitWorkStypeFP"/> <FORM name="*.saveAndExitWorkStyle" factory="Participant" class="performa.form.SaveAndExitWorkStypeFP"/>
<FORM name="*.saveDiversityAnswers" factory="Participant" class="performa.form.SaveDiversityAnswersFP"/>
<FORM name="*.sendVerificationMail" factory="Participant" class="performa.form.SendVerificationMailFP"> <FORM name="*.sendVerificationMail" factory="Participant" class="performa.form.SendVerificationMailFP">
<AccountVerificationEmailer factory="Participant" class="oneit.email.ConfigurableArticleTemplateEmailer" templateShortcut="AccountVerificationMail"/> <AccountVerificationEmailer factory="Participant" class="oneit.email.ConfigurableArticleTemplateEmailer" templateShortcut="AccountVerificationMail"/>
</FORM> </FORM>
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
<RenderMode name="Page" preIncludeJSP="extensions/applicantportal/job_overview.jsp"/> <RenderMode name="Page" preIncludeJSP="extensions/applicantportal/job_overview.jsp"/>
<RenderMode name="SignIn" preIncludeJSP="extensions/applicantportal/sign_in.jsp"/> <RenderMode name="SignIn" preIncludeJSP="extensions/applicantportal/sign_in.jsp"/>
<RenderMode name="VerifyIdentity" preIncludeJSP="extensions/applicantportal/verify_identity.jsp"/> <RenderMode name="VerifyIdentity" preIncludeJSP="extensions/applicantportal/verify_identity.jsp"/>
<RenderMode name="DiversityQuestions" preIncludeJSP="extensions/applicantportal/diversity_questions.jsp"/>
<RenderMode name="MaskedIdentity" preIncludeJSP="extensions/applicantportal/masked_identity.jsp"/> <RenderMode name="MaskedIdentity" preIncludeJSP="extensions/applicantportal/masked_identity.jsp"/>
<RenderMode name="VerificationSent" preIncludeJSP="extensions/applicantportal/verification_sent.jsp"/> <RenderMode name="VerificationSent" preIncludeJSP="extensions/applicantportal/verification_sent.jsp"/>
<RenderMode name="ForgotPassword" preIncludeJSP="extensions/applicantportal/forgot_password.jsp"/> <RenderMode name="ForgotPassword" preIncludeJSP="extensions/applicantportal/forgot_password.jsp"/>
......
<%@ page extends="oneit.servlets.jsp.JSPInclude" %>
<%@ include file="/inc/stdimports50.jsp" %><%-- This is in cougar --%>
<%@ include file="/inc/stdcms.jsp" %><%-- This is in cougar --%>
<%@ include file="/extensions/performa/inc/stdimports.jsp" %>
<oneit:dynIncluded>
<%
boolean toRedirect = GenericObjDF.getOrCreateObject (request, "Job", Job.REFERENCE_Job);
Job job = (Job) process.getAttribute("Job");
Debug.assertion(job != null && !toRedirect, "Invalid job in applicant portal");
SecUser secUser = SecUser.getTXUser(transaction);
Debug.assertion(secUser != null, "Invalid candidate in applicant portal");
Candidate candidate = secUser.getExtension(Candidate.REFERENCE_Candidate);
Debug.assertion(candidate != null, "Invalid candidate in applicant portal");
String successPage = WebUtils.getSamePageInRenderMode(request, "VerificationSent") + "&JobID=" + job.getID();
JobApplication jobApplication = JobApplication.searchCandidateJob(transaction, candidate, job);
Debug.assertion(jobApplication != null, "Invalid Job Application in applicant portal");
if(jobApplication.diversityCompleted())
{
response.sendRedirect(WebUtils.getSamePageInRenderMode(request, "VerificationSent") + "&JobID=" + job.getID());
}
Boolean isSelectionComplete = jobApplication.selectionCompleted();
Boolean isCultureComplete = jobApplication.cultureCompleted();
Boolean isAssesmentComplete = jobApplication.assessmentCompleted();
Article jobApplicationArticle = WebUtils.getArticleByShortCut(transaction, WebUtils.JOB_APPLICATION);
String nextPage = jobApplicationArticle.getLink(request) + "?JobID="+ job.getID().toString();;
if(!jobApplication.hasStartedApplication())
{
nextPage = WebUtils.getArticleLink(request, transaction, WebUtils.JOB_APPLICATION, "Page") + "&JobID="+ job.getID().toString();
}
else if(!isSelectionComplete)
{
nextPage = LoopbackHTTP.getRemoteAccessURL(request)
+ jobApplicationArticle.getLink(request, CollectionUtils.mapEntry("cms.rm", "SelectionCriteria").toMap(), "/");
}
else if(!isCultureComplete)
{
nextPage = LoopbackHTTP.getRemoteAccessURL(request)
+ jobApplicationArticle.getLink(request, CollectionUtils.mapEntry("cms.rm", "WorkplaceCulture").toMap(), "/");
}
else if(!isAssesmentComplete)
{
nextPage = LoopbackHTTP.getRemoteAccessURL(request)
+ jobApplicationArticle.getLink(request, CollectionUtils.mapEntry("cms.rm", "JobMatchAssessment").toMap(), "/");
}
toRedirect = jobApplication.createDiversityAnswerObjects();
if(toRedirect)
{
%><%@include file="/saferedirect.jsp" %><%
}
jobApplication.setDiversityAnswerOptions();
process.setAttribute("JobApplication", jobApplication);
%>
<oneit:form name="diversity" method="post" enctype="multipart/form-data">
<script type="text/javascript">
$(document.body).addClass('bg-color');
$(document).ready(function() {
recalcFunction = setupRecalc ($("form#diversity"), {'recalcOnError':true});
});
</script>
<oneit:dynInclude page="/extensions/applicantportal/inc/multifieldtext.jsp" data="<%= CollectionUtils.EMPTY_MAP%>"/>
<div class="apply-job-logo-header signinpage">
<div class="box-sizing-border-box">
<div class="logo-img">
<%
BinaryContent logo = job.getLogo();
if(logo != null)
{
int logoHeight = 45;
%>
<tagfile:img src="<%= ThumbnailUtils.filterImage(DiskFileBinaryContent.getRelativeURL(logo), "KEEP", new ScaleWithin (0, logoHeight)) %>" />
<%
}
%>
</div>
<div class="header-title">
<%= job.getTeamName() %>
</div>
</div>
</div>
<div class="main-verify-identity">
<div class="main-box-layout main-verify-step-2">
<%
FormTag applicationForm = FormTag.getActiveFormTag(request);
FormBuilder formBuilder = applicationForm.getFormBuilder();
for(HTDiversityQuestion question : job.getDiversityQuestions())
{
DiversityQuestion originalQuestion = question.getQuestion();
CandidateDiversityAnswer candidateAnswer = candidate.getDiversityAnswerByQuestion(originalQuestion);
// not showing question if already answered
if(candidateAnswer.pipelineCandidateDiversityAnswer().toAnswers(AnswerOption.SearchByAll().andIsSelected(new EqualsFilter<>(Boolean.TRUE))).uniqueVals().size() >= 1)
{
continue;
}
%>
<div class="form-group text-left">
<label><%= question.getQuestionText() %></label>
<%
if(originalQuestion.getMultipleAnswers())
{
for(AnswerOption answer : candidateAnswer.getAnswersSet())
{
%>
<div class="styled_checkboxes">
<div class="checkbox checkbox-primary">
<oneit:ormInput obj="<%= answer %>" id="<%= answer.getObjectID() %>" attributeName="IsSelected" type="checkbox"/>
<oneit:recalcClass htmlTag="span" classScript="answer.getIsSelected() ? 'checked': 'unchecked'" answer="<%= answer %>">
<label for="<%= answer.getObjectID() %>">
<%= answer.getAnswer().getAnswer() %>
</label>
</oneit:recalcClass>
</div>
</div>
<%
}
}
else
{
String optionKey = WebUtils.getRadioSingleAssocKey(request, candidateAnswer, CandidateDiversityAnswer.SINGLEREFERENCE_AnswerOption);
String formValue = formBuilder.fieldValue (optionKey, candidateAnswer.getAnswerOption() == null ? "" : String.valueOf(candidateAnswer.getAnswerOptionID()));
%>
<%--<div class="radio radio-primary second-radio-primary full-width">
<input type="radio" name="<%= candidateAnswer.getObjectID() %>" value="<%= answer.getIsSelected() %>" id="<%= answer.getObjectID() %>"/>
<label for="<%= answer.getObjectID() %>">
<%= answer.getAnswer().getAnswer() %>
</label>
</div>--%>
<%
for(DiversityAnswer diversityAnswer : originalQuestion.getAnswersSet())
{
String answerId = String.valueOf(diversityAnswer.getID().longID());
String selectedStr = (CollectionUtils.equals(answerId, formValue) ? "checked" : "");
%>
<div class="radio radio-primary second-radio-primary full-width">
<input type="radio" name="<%= optionKey %>" id="<%= answerId %>" class="element_rating_radio" value="<%= answerId %>" <%= selectedStr %>>
<label for="<%= answerId %>">
<oneit:toString value="<%= diversityAnswer.getAnswer() %>" mode="EscapeHTML" nullValue="-"/>
</label>
</div>
<%
}
}
%>
</div>
<hr class="seperate-line">
<%
}
%>
<div class="text-center">
<oneit:button value="Submit" name="saveDiversityAnswers" cssClass="box-btn send-link-btn"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", successPage)
.mapEntry("JobApplication",jobApplication)
.toMap() %>"/>
</div>
</div>
</div>
</oneit:form>
</oneit:dynIncluded>
\ No newline at end of file
...@@ -7,3 +7,4 @@ ...@@ -7,3 +7,4 @@
#alreadyApplied = You have already applied for this job. #alreadyApplied = You have already applied for this job.
#uploadCover = Please upload your Cover Letter. #uploadCover = Please upload your Cover Letter.
#uploadCV = Please upload your CV. #uploadCV = Please upload your CV.
#atleastOneAnswer = Please select an answer to each question.
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
<oneit:dynIncluded> <oneit:dynIncluded>
<% <%
ObjectTransaction objTran = process.getTransaction (); ObjectTransaction objTran = process.getTransaction ();
String successPage = WebUtils.getSamePageInRenderMode(request, "VerificationSent");
Article applicationArticle = WebUtils.getArticleByShortCut(objTran, WebUtils.JOB_APPLICATION); Article applicationArticle = WebUtils.getArticleByShortCut(objTran, WebUtils.JOB_APPLICATION);
String nextPage = applicationArticle.getLink(request, CollectionUtils.mapEntry("cms.rm", "ConfirmDetails").toMap()); String nextPage = applicationArticle.getLink(request, CollectionUtils.mapEntry("cms.rm", "ConfirmDetails").toMap());
Job job = (Job) process.getAttribute("Job"); Job job = (Job) process.getAttribute("Job");
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
Debug.assertion(candidate != null, "Invalid candidate in applicant portal"); Debug.assertion(candidate != null, "Invalid candidate in applicant portal");
String successPage = WebUtils.getSamePageInRenderMode(request, "VerificationSent") + "&JobID=" + job.getID();
JobApplication jobApplication = JobApplication.searchCandidateJob(transaction, candidate, job); JobApplication jobApplication = JobApplication.searchCandidateJob(transaction, candidate, job);
boolean redirectUser = jobApplication != null && jobApplication.getApplicationStatus() == ApplicationStatus.DRAFT; boolean redirectUser = jobApplication != null && jobApplication.getApplicationStatus() == ApplicationStatus.DRAFT;
...@@ -27,13 +26,19 @@ ...@@ -27,13 +26,19 @@
jobApplication = JobApplication.createNewApplication(candidate, job); jobApplication = JobApplication.createNewApplication(candidate, job);
} }
Boolean isDiversityComplete = jobApplication.diversityCompleted();
Boolean isSelectionComplete = jobApplication.selectionCompleted(); Boolean isSelectionComplete = jobApplication.selectionCompleted();
Boolean isCultureComplete = jobApplication.cultureCompleted(); Boolean isCultureComplete = jobApplication.cultureCompleted();
Boolean isAssesmentComplete = jobApplication.assessmentCompleted(); Boolean isAssesmentComplete = jobApplication.assessmentCompleted();
Article jobApplicationArticle = WebUtils.getArticleByShortCut(transaction, WebUtils.JOB_APPLICATION); Article jobApplicationArticle = WebUtils.getArticleByShortCut(transaction, WebUtils.JOB_APPLICATION);
String nextPage = jobApplicationArticle.getLink(request) + "?JobID="+ job.getID().toString();; String nextPage = jobApplicationArticle.getLink(request) + "?JobID="+ job.getID().toString();
String successPage = WebUtils.getSamePageInRenderMode(request, jobApplication.isDiversityIncluded() ? "DiversityQuestions" : "VerificationSent") + "&JobID=" + job.getID();
if(!jobApplication.hasStartedApplication()) if(!isDiversityComplete)
{
nextPage = WebUtils.getSamePageInRenderMode(request, "DiversityQuestions") + "&JobID=" + job.getID();
}
else if(!jobApplication.hasStartedApplication())
{ {
nextPage = WebUtils.getArticleLink(request, transaction, WebUtils.JOB_APPLICATION, "Page") + "&JobID="+ job.getID().toString(); nextPage = WebUtils.getArticleLink(request, transaction, WebUtils.JOB_APPLICATION, "Page") + "&JobID="+ job.getID().toString();
} }
...@@ -53,7 +58,6 @@ ...@@ -53,7 +58,6 @@
+ jobApplicationArticle.getLink(request, CollectionUtils.mapEntry("cms.rm", "JobMatchAssessment").toMap(), "/"); + jobApplicationArticle.getLink(request, CollectionUtils.mapEntry("cms.rm", "JobMatchAssessment").toMap(), "/");
} }
if(redirectUser) if(redirectUser)
{ {
response.sendRedirect(candidate.isFalse(candidate.getIsAccountVerified()) ? successPage : nextPage +"&JobApplicationID="+ jobApplication.getID().toString()); response.sendRedirect(candidate.isFalse(candidate.getIsAccountVerified()) ? successPage : nextPage +"&JobApplicationID="+ jobApplication.getID().toString());
...@@ -319,7 +323,8 @@ ...@@ -319,7 +323,8 @@
.mapEntry("Job",job) .mapEntry("Job",job)
.mapEntry("Candidate",candidate) .mapEntry("Candidate",candidate)
.mapEntry("JobApplication",jobApplication) .mapEntry("JobApplication",jobApplication)
.mapEntry(NotificationUtils.NOTIFICATION_MSG_PARAM, "emailSent") .mapEntry(NotificationUtils.DISPLAY_NOTIFICATION_PARAM, false)
// .mapEntry(NotificationUtils.NOTIFICATION_MSG_PARAM, "emailSent")
.toMap() %>"/> .toMap() %>"/>
</div> </div>
</div> </div>
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<oneit:script src="/scripts/countimer.js"/> <oneit:script src="/scripts/countimer.js"/>
<oneit:script src="/scripts/slick.min.js"/> <oneit:script src="/scripts/slick.min.js"/>
<oneit:script src="/scripts/raphael-min.js"/> <oneit:script src="/scripts/raphael-min.js"/>
<oneit:script src="/scripts/jBox.js"/> <oneit:script src="/scripts/jBox.js"/>
</oneit:script> </oneit:script>
<script> <script>
......
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