Commit a2678d6d by nilu

S43010494 # Matchd / Talentology - No Plan [Enhancement] #Hiring Team Changes to…

S43010494 # Matchd / Talentology - No Plan [Enhancement] #Hiring Team Changes to include diversity questions
parent bed8c30c
<?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="answer_id" type="Long" length="11" nullable="false"/>
<column name="question_id" type="Long" length="11" nullable="false"/>
<column name="candidate_id" type="Long" length="11" nullable="false"/>
</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"/>
</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_text" type="CLOB" nullable="false"/>
<column name="australia_only" 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 @@
<column name="post_code" type="String" nullable="true" length="10"/>
<column name="city" type="String" nullable="true" length="100"/>
<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="stripe_reference" type="String" nullable="true" length="100"/>
<column name="stripe_subscription" type="String" nullable="true" length="100"/>
......
-- 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
,
answer_id numeric(12) 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 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_text text NOT NULL,
australia_only 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 (
post_code varchar(10) NULL,
city varchar(100) NULL,
has_client_support char(1) NULL,
has_diversity char(1) NULL,
manage_own_billing char(1) NULL,
stripe_reference varchar(100) NULL,
stripe_subscription varchar(100) NULL,
......
-- 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
,
answer_id number(12) 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 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_text clob NOT NULL,
australia_only 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 (
post_code varchar2(10) NULL,
city varchar2(100) NULL,
has_client_support char(1) NULL,
has_diversity char(1) NULL,
manage_own_billing char(1) NULL,
stripe_reference varchar2(100) NULL,
stripe_subscription varchar2(100) NULL,
......
-- @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
,
answer_id numeric(12) 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 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_text text NOT NULL,
australia_only 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 (
post_code varchar(10) NULL,
city varchar(100) NULL,
has_client_support char(1) NULL,
has_diversity char(1) NULL,
manage_own_billing char(1) NULL,
stripe_reference varchar(100) NULL,
stripe_subscription varchar(100) 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
}
}
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
if(hiringTeam.getHiringTeamLogo() == null && !isHTLogoPresent)
......
......@@ -64,6 +64,8 @@ public abstract class BaseCandidate extends SecUserExtension
public static final String BACKREF_CultureCriteriaAnswers = "";
public static final String MULTIPLEREFERENCE_ProfileAssessmentAnswers = "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
public static final String SEARCH_All = "All";
......@@ -114,6 +116,7 @@ public abstract class BaseCandidate extends SecUserExtension
private MultipleAssociation<Candidate, JobApplication> _JobApplications;
private MultipleAssociation<Candidate, CultureCriteriaAnswer> _CultureCriteriaAnswers;
private MultipleAssociation<Candidate, Answer> _ProfileAssessmentAnswers;
private MultipleAssociation<Candidate, CandidateDiversityAnswer> _DiversityAnswers;
// Map of maps of metadata
......@@ -148,6 +151,7 @@ public abstract class BaseCandidate extends SecUserExtension
String tmp_JobApplications = JobApplication.BACKREF_Candidate;
String tmp_CultureCriteriaAnswers = CultureCriteriaAnswer.BACKREF_Candidate;
String tmp_ProfileAssessmentAnswers = Answer.BACKREF_Candidate;
String tmp_DiversityAnswers = CandidateDiversityAnswer.BACKREF_Candidate;
String tmp_TestInput = TestInput.BACKREF_Candidates;
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
......@@ -156,6 +160,7 @@ public abstract class BaseCandidate extends SecUserExtension
setupAssocMetaData_JobApplications();
setupAssocMetaData_CultureCriteriaAnswers();
setupAssocMetaData_ProfileAssessmentAnswers();
setupAssocMetaData_DiversityAnswers();
setupAssocMetaData_TestInput();
FIELD_PrivacyPolicyAgreed_Validators = (AttributeValidator[])setupAttribMetaData_PrivacyPolicyAgreed(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
// 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()
{
Map metaInfo = new HashMap ();
......@@ -571,6 +590,7 @@ public abstract class BaseCandidate extends SecUserExtension
_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);
_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
_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);
_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;
......@@ -2207,6 +2228,8 @@ public abstract class BaseCandidate extends SecUserExtension
result.add("ProfileAssessmentAnswers");
result.add("DiversityAnswers");
return result;
}
......@@ -2238,6 +2261,11 @@ public abstract class BaseCandidate extends SecUserExtension
return Answer.REFERENCE_Answer ;
}
if (MULTIPLEREFERENCE_DiversityAnswers.equals(attribName))
{
return CandidateDiversityAnswer.REFERENCE_CandidateDiversityAnswer ;
}
return super.getMultiAssocReferenceInstance(attribName);
}
......@@ -2266,6 +2294,11 @@ public abstract class BaseCandidate extends SecUserExtension
return Answer.SINGLEREFERENCE_Candidate ;
}
if (MULTIPLEREFERENCE_DiversityAnswers.equals(attribName))
{
return CandidateDiversityAnswer.SINGLEREFERENCE_Candidate ;
}
return super.getMultiAssocBackReference(attribName);
}
......@@ -2297,6 +2330,11 @@ public abstract class BaseCandidate extends SecUserExtension
return this.getProfileAssessmentAnswersCount();
}
if (MULTIPLEREFERENCE_DiversityAnswers.equals(attribName))
{
return this.getDiversityAnswersCount();
}
return super.getMultiAssocCount(attribName);
}
......@@ -2328,6 +2366,11 @@ public abstract class BaseCandidate extends SecUserExtension
return this.getProfileAssessmentAnswersAt(index);
}
if (MULTIPLEREFERENCE_DiversityAnswers.equals(attribName))
{
return this.getDiversityAnswersAt(index);
}
return super.getMultiAssocAt(attribName, index);
}
......@@ -2367,6 +2410,13 @@ public abstract class BaseCandidate extends SecUserExtension
return;
}
if (MULTIPLEREFERENCE_DiversityAnswers.equals(attribName))
{
addToDiversityAnswers((CandidateDiversityAnswer)newElement);
return;
}
super.addToMultiAssoc(attribName, newElement);
}
......@@ -2405,6 +2455,13 @@ public abstract class BaseCandidate extends SecUserExtension
return;
}
if (MULTIPLEREFERENCE_DiversityAnswers.equals(attribName))
{
removeFromDiversityAnswers((CandidateDiversityAnswer)oldElement);
return;
}
super.removeFromMultiAssoc(attribName, oldElement);
}
......@@ -2437,6 +2494,12 @@ public abstract class BaseCandidate extends SecUserExtension
return;
}
if (MULTIPLEREFERENCE_DiversityAnswers.equals(attribName))
{
_DiversityAnswers.__loadAssociation (elements);
return;
}
super.__loadMultiAssoc(attribName, elements);
}
......@@ -2465,6 +2528,11 @@ public abstract class BaseCandidate extends SecUserExtension
return _ProfileAssessmentAnswers.isLoaded ();
}
if (MULTIPLEREFERENCE_DiversityAnswers.equals(attribName))
{
return _DiversityAnswers.isLoaded ();
}
return super.__isMultiAssocLoaded(attribName);
}
......@@ -2747,6 +2815,75 @@ public abstract class BaseCandidate extends SecUserExtension
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 ()
......@@ -2791,6 +2928,12 @@ public abstract class BaseCandidate extends SecUserExtension
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)
{
......@@ -3069,6 +3212,7 @@ public abstract class BaseCandidate extends SecUserExtension
_JobApplications.copyFrom (sourceCandidate._JobApplications, linkToGhosts);
_CultureCriteriaAnswers.copyFrom (sourceCandidate._CultureCriteriaAnswers, linkToGhosts);
_ProfileAssessmentAnswers.copyFrom (sourceCandidate._ProfileAssessmentAnswers, linkToGhosts);
_DiversityAnswers.copyFrom (sourceCandidate._DiversityAnswers, linkToGhosts);
}
}
......@@ -3108,6 +3252,7 @@ public abstract class BaseCandidate extends SecUserExtension
_JobApplications.readExternalData(vals.get(MULTIPLEREFERENCE_JobApplications));
_CultureCriteriaAnswers.readExternalData(vals.get(MULTIPLEREFERENCE_CultureCriteriaAnswers));
_ProfileAssessmentAnswers.readExternalData(vals.get(MULTIPLEREFERENCE_ProfileAssessmentAnswers));
_DiversityAnswers.readExternalData(vals.get(MULTIPLEREFERENCE_DiversityAnswers));
}
......@@ -3138,6 +3283,7 @@ public abstract class BaseCandidate extends SecUserExtension
vals.put (MULTIPLEREFERENCE_JobApplications, _JobApplications.writeExternalData());
vals.put (MULTIPLEREFERENCE_CultureCriteriaAnswers, _CultureCriteriaAnswers.writeExternalData());
vals.put (MULTIPLEREFERENCE_ProfileAssessmentAnswers, _ProfileAssessmentAnswers.writeExternalData());
vals.put (MULTIPLEREFERENCE_DiversityAnswers, _DiversityAnswers.writeExternalData());
}
......@@ -3205,6 +3351,7 @@ public abstract class BaseCandidate extends SecUserExtension
_JobApplications.compare (otherCandidate._JobApplications, listener);
_CultureCriteriaAnswers.compare (otherCandidate._CultureCriteriaAnswers, listener);
_ProfileAssessmentAnswers.compare (otherCandidate._ProfileAssessmentAnswers, listener);
_DiversityAnswers.compare (otherCandidate._DiversityAnswers, listener);
}
}
......@@ -3241,6 +3388,7 @@ public abstract class BaseCandidate extends SecUserExtension
visitor.visitAssociation (_JobApplications);
visitor.visitAssociation (_CultureCriteriaAnswers);
visitor.visitAssociation (_ProfileAssessmentAnswers);
visitor.visitAssociation (_DiversityAnswers);
}
......@@ -3269,6 +3417,10 @@ public abstract class BaseCandidate extends SecUserExtension
{
visitor.visit (_ProfileAssessmentAnswers);
}
if (scope.includes (_DiversityAnswers))
{
visitor.visit (_DiversityAnswers);
}
}
......@@ -3938,6 +4090,10 @@ public abstract class BaseCandidate extends SecUserExtension
{
return getWriteability_ProfileAssessmentAnswers ();
}
else if (fieldName.equals (MULTIPLEREFERENCE_DiversityAnswers))
{
return getWriteability_DiversityAnswers ();
}
else if (fieldName.equals (SINGLEREFERENCE_TestInput))
{
return getWriteability_TestInput ();
......@@ -4427,6 +4583,10 @@ public abstract class BaseCandidate extends SecUserExtension
{
return toProfileAssessmentAnswers ();
}
if (name.equals ("DiversityAnswers"))
{
return toDiversityAnswers ();
}
if (name.equals ("PrivacyPolicyAgreed"))
{
return toPrivacyPolicyAgreed ();
......@@ -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));
}
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
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_Answer = "Answer";
public static final String SINGLEREFERENCE_Question = "Question";
public static final String SINGLEREFERENCE_Candidate = "Candidate";
public static final String BACKREF_Candidate = "";
// 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> _Answer;
private SingleAssociation<CandidateDiversityAnswer, DiversityQuestion> _Question;
private SingleAssociation<CandidateDiversityAnswer, Candidate> _Candidate;
// Private attributes corresponding to multiple references
// 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_Candidate = Candidate.BACKREF_DiversityAnswers;
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
setupAssocMetaData_Answer();
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_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 CandidateDiversityAnswer.Answer:", metaInfo);
ATTRIBUTES_METADATA_CandidateDiversityAnswer.put (SINGLEREFERENCE_Answer, 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 ();
_Answer = new SingleAssociation<CandidateDiversityAnswer, DiversityAnswer> (this, SINGLEREFERENCE_Answer, null, DiversityAnswer.REFERENCE_DiversityAnswer, "tl_candidate_diversity_answer");
_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");
}
// Initialise the associations
protected BaseBusinessClass initialiseReference ()
{
super.initialiseReference ();
_Answer = new SingleAssociation<CandidateDiversityAnswer, DiversityAnswer> (this, SINGLEREFERENCE_Answer, null, DiversityAnswer.REFERENCE_DiversityAnswer, "tl_candidate_diversity_answer");
_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");
return this;
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getSingleAssocs()
{
List result = super.getSingleAssocs ();
result.add("Answer");
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_Answer))
{
return _Answer.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_Answer))
{
return 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_Answer))
{
return getAnswer ();
}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_Answer))
{
return getAnswer (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_Answer))
{
return getAnswerID ();
}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_Answer))
{
setAnswer ((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 Answer
*/
public DiversityAnswer getAnswer () throws StorageException
{
assertValid();
try
{
return (DiversityAnswer)(_Answer.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in CandidateDiversityAnswer:", 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 ();
}
}
/**
* 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 ();
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 (_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);
}
}
}
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);
_Answer.getPersistentSets (allSets);
_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");
_Answer.setFromPersistentSets (objectID, allSets);
_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);
_Answer.copyFrom (sourceCandidateDiversityAnswer._Answer, 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);
}
}
public void validate (ValidationContext context)
{
super.validate (context);
context.check (getAnswerID() != null, this, SINGLEREFERENCE_Answer, "mandatory");
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);
_Answer.readExternalData(vals.get(SINGLEREFERENCE_Answer));
_Question.readExternalData(vals.get(SINGLEREFERENCE_Question));
_Candidate.readExternalData(vals.get(SINGLEREFERENCE_Candidate));
}
/**
* Subclasses must override this to write out their attributes
*/
protected void writeExternalData(Map<String, Object> vals) throws IOException
{
super.writeExternalData(vals);
vals.put (SINGLEREFERENCE_Answer, _Answer.writeExternalData());
vals.put (SINGLEREFERENCE_Question, _Question.writeExternalData());
vals.put (SINGLEREFERENCE_Candidate, _Candidate.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
_Answer.compare (otherCandidateDiversityAnswer._Answer, listener);
_Question.compare (otherCandidateDiversityAnswer._Question, listener);
_Candidate.compare (otherCandidateDiversityAnswer._Candidate, listener);
// Compare multiple assocs
}
}
public void visitTransients (AttributeVisitor visitor) throws StorageException
{
super.visitAttributes (visitor);
}
public void visitAttributes (AttributeVisitor visitor) throws StorageException
{
super.visitAttributes (visitor);
visitor.visitAssociation (_Answer);
visitor.visitAssociation (_Question);
visitor.visitAssociation (_Candidate);
}
public void visitAssociations (AssociationVisitor visitor, AssociatedScope scope) throws StorageException
{
super.visitAssociations (visitor, scope);
if (scope.includes (_Answer))
{
visitor.visit (_Answer);
}
if (scope.includes (_Question))
{
visitor.visit (_Question);
}
if (scope.includes (_Candidate))
{
visitor.visit (_Candidate);
}
}
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_Answer))
{
return filter.matches (getAnswer ());
}
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 andAnswer (QueryFilter<DiversityAnswer> filter)
{
filter.addFilter (context, "tl_candidate_diversity_answer.answer_id", "Answer");
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 (SINGLEREFERENCE_Answer))
{
return getWriteability_Answer ();
}
else if (fieldName.equals (SINGLEREFERENCE_Question))
{
return getWriteability_Question ();
}
else if (fieldName.equals (SINGLEREFERENCE_Candidate))
{
return getWriteability_Candidate ();
}
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 ("Answer"))
{
return toAnswer ();
}
if (name.equals ("Question"))
{
return toQuestion ();
}
if (name.equals ("Candidate"))
{
return toCandidate ();
}
return super.to(name);
}
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 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 boolean isTransientAttrib(String attribName)
{
return super.isTransientAttrib(attribName);
}
public boolean isTransientSingleReference(String assocName)
{
return super.isTransientSingleReference(assocName);
}
}
class DummyCandidateDiversityAnswer extends CandidateDiversityAnswer
{
// Default constructor primarily to support Externalisable
public DummyCandidateDiversityAnswer()
{
super();
}
public void assertValid ()
{
}
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();
}
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();
}
}
/*
* 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_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_Answer = DefaultAttributeHelper.INSTANCE;
// Private attributes corresponding to business object data
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_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_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_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);
_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 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_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");
_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
{
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);
_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);
_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_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_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_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_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 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_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_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_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_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_Answer () != FieldWriteability.TRUE)
{
fields.add (FIELD_Answer);
}
super.putUnwriteable (fields);
}
public List<AbstractAttribute> getAttributes ()
{
List result = super.getAttributes ();
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 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 ("Answer"))
{
return toAnswer ();
}
if (name.equals ("Question"))
{
return toQuestion ();
}
return super.to(name);
}
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_QuestionText = "QuestionText";
public static final String FIELD_AustraliaOnly = "AustraliaOnly";
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_QuestionText = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<DiversityQuestion> HELPER_AustraliaOnly = DefaultAttributeHelper.INSTANCE;
// Private attributes corresponding to business object data
private String _QuestionText;
private Boolean _AustraliaOnly;
// 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_QuestionText_Validators;
private static final AttributeValidator[] FIELD_AustraliaOnly_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_QuestionText_Validators = (AttributeValidator[])setupAttribMetaData_QuestionText(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_AustraliaOnly_Validators = (AttributeValidator[])setupAttribMetaData_AustraliaOnly(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_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;
}
// 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);
_QuestionText = (String)(HELPER_QuestionText.initialise (_QuestionText));
_AustraliaOnly = (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 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 ();
}
}
/**
* 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_QuestionText, HELPER_QuestionText.toObject (_QuestionText)); //
tl_diversity_questionPSet.setAttrib (FIELD_AustraliaOnly, HELPER_AustraliaOnly.toObject (_AustraliaOnly)); //
}
/**
* 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");
_QuestionText = (String)(HELPER_QuestionText.fromObject (_QuestionText, tl_diversity_questionPSet.getAttrib (FIELD_QuestionText))); //
_AustraliaOnly = (Boolean)(HELPER_AustraliaOnly.fromObject (_AustraliaOnly, tl_diversity_questionPSet.getAttrib (FIELD_AustraliaOnly))); //
}
public void setAttributesFrom (BaseBusinessClass other, MultiException e)
{
super.setAttributesFrom (other, e);
if (other instanceof DiversityQuestion)
{
DiversityQuestion otherDiversityQuestion = (DiversityQuestion)other;
try
{
setQuestionText (otherDiversityQuestion.getQuestionText ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setAustraliaOnly (otherDiversityQuestion.getAustraliaOnly ());
}
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);
_QuestionText = sourceDiversityQuestion._QuestionText;
_AustraliaOnly = sourceDiversityQuestion._AustraliaOnly;
}
}
/**
* 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);
_QuestionText = (String)(HELPER_QuestionText.readExternal (_QuestionText, vals.get(FIELD_QuestionText))); //
_AustraliaOnly = (Boolean)(HELPER_AustraliaOnly.readExternal (_AustraliaOnly, vals.get(FIELD_AustraliaOnly))); //
_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_QuestionText, HELPER_QuestionText.writeExternal (_QuestionText));
vals.put (FIELD_AustraliaOnly, HELPER_AustraliaOnly.writeExternal (_AustraliaOnly));
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_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));
}
// 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_QuestionText, HELPER_QuestionText.toObject(getQuestionText()));
visitor.visitField(this, FIELD_AustraliaOnly, HELPER_AustraliaOnly.toObject(getAustraliaOnly()));
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_QuestionText))
{
return filter.matches (getQuestionText ());
}
else if (attribName.equals (FIELD_AustraliaOnly))
{
return filter.matches (getAustraliaOnly ());
}
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 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 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_QuestionText))
{
return HELPER_QuestionText.toObject (getQuestionText ());
}
else if (attribName.equals (FIELD_AustraliaOnly))
{
return HELPER_AustraliaOnly.toObject (getAustraliaOnly ());
}
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_AustraliaOnly))
{
return HELPER_AustraliaOnly;
}
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_AustraliaOnly))
{
setAustraliaOnly ((Boolean)(HELPER_AustraliaOnly.fromObject (_AustraliaOnly, 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_AustraliaOnly))
{
return getWriteability_AustraliaOnly ();
}
else if (fieldName.equals (MULTIPLEREFERENCE_Answers))
{
return getWriteability_Answers ();
}
else
{
return super.getWriteable (fieldName);
}
}
public void putUnwriteable (Set<String> fields)
{
if (getWriteability_QuestionText () != FieldWriteability.TRUE)
{
fields.add (FIELD_QuestionText);
}
if (getWriteability_AustraliaOnly () != FieldWriteability.TRUE)
{
fields.add (FIELD_AustraliaOnly);
}
super.putUnwriteable (fields);
}
public List<AbstractAttribute> getAttributes ()
{
List result = super.getAttributes ();
result.add(HELPER_QuestionText.getAttribObject (getClass (), _QuestionText, true, FIELD_QuestionText));
result.add(HELPER_AustraliaOnly.getAttribObject (getClass (), _AustraliaOnly, false, FIELD_AustraliaOnly));
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 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;
}
}
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 ("QuestionText"))
{
return toQuestionText ();
}
if (name.equals ("AustraliaOnly"))
{
return toAustraliaOnly ();
}
return super.to(name);
}
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 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
public static final String FIELD_PostCode = "PostCode";
public static final String FIELD_City = "City";
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_StripeReference = "StripeReference";
public static final String FIELD_StripeSubscription = "StripeSubscription";
......@@ -91,6 +92,8 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
public static final String BACKREF_Clients = "";
public static final String MULTIPLEREFERENCE_BillingTeams = "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
public static final String SEARCH_All = "All";
......@@ -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_City = 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_StripeReference = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<HiringTeam> HELPER_StripeSubscription = DefaultAttributeHelper.INSTANCE;
......@@ -147,6 +151,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
private String _PostCode;
private String _City;
private Boolean _HasClientSupport;
private Boolean _HasDiversity;
private Boolean _ManageOwnBilling;
private String _StripeReference;
private String _StripeSubscription;
......@@ -187,6 +192,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
private MultipleAssociation<HiringTeam, CompanyUserHiringTeamLink> _Users;
private MultipleAssociation<HiringTeam, Client> _Clients;
private MultipleAssociation<HiringTeam, HiringTeam> _BillingTeams;
private MultipleAssociation<HiringTeam, HTDiversityQuestion> _DiversityQuestions;
// Map of maps of metadata
......@@ -207,6 +213,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
private static final AttributeValidator[] FIELD_PostCode_Validators;
private static final AttributeValidator[] FIELD_City_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_StripeReference_Validators;
private static final AttributeValidator[] FIELD_StripeSubscription_Validators;
......@@ -242,6 +249,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
String tmp_Users = CompanyUserHiringTeamLink.BACKREF_HiringTeam;
String tmp_Clients = Client.BACKREF_HiringTeam;
String tmp_BillingTeams = HiringTeam.BACKREF_BilledByTeam;
String tmp_DiversityQuestions = HTDiversityQuestion.BACKREF_HiringTeam;
String tmp_Company = Company.BACKREF_HiringTeams;
String tmp_BilledByTeam = HiringTeam.BACKREF_BillingTeams;
......@@ -250,6 +258,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
setupAssocMetaData_Users();
setupAssocMetaData_Clients();
setupAssocMetaData_BillingTeams();
setupAssocMetaData_DiversityQuestions();
setupAssocMetaData_Company();
setupAssocMetaData_BilledByTeam();
setupAssocMetaData_AddedByUser();
......@@ -269,6 +278,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
FIELD_PostCode_Validators = (AttributeValidator[])setupAttribMetaData_PostCode(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_HasDiversity_Validators = (AttributeValidator[])setupAttribMetaData_HasDiversity(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_StripeSubscription_Validators = (AttributeValidator[])setupAttribMetaData_StripeSubscription(validatorMapping).toArray (new AttributeValidator[0]);
......@@ -348,6 +358,20 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
// 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()
{
Map metaInfo = new HashMap ();
......@@ -698,6 +722,26 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
}
// 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)
{
Map metaInfo = new HashMap ();
......@@ -1145,6 +1189,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
_PostCode = (String)(HELPER_PostCode.initialise (_PostCode));
_City = (String)(HELPER_City.initialise (_City));
_HasClientSupport = (Boolean)(Boolean.FALSE);
_HasDiversity = (Boolean)(Boolean.FALSE);
_ManageOwnBilling = (Boolean)(Boolean.TRUE);
_StripeReference = (String)(HELPER_StripeReference.initialise (_StripeReference));
_StripeSubscription = (String)(HELPER_StripeSubscription.initialise (_StripeSubscription));
......@@ -1187,6 +1232,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
_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);
_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
_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);
_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;
......@@ -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
*/
public Boolean getManageOwnBilling ()
......@@ -5452,6 +5597,8 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
result.add("BillingTeams");
result.add("DiversityQuestions");
return result;
}
......@@ -5478,6 +5625,11 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
return HiringTeam.REFERENCE_HiringTeam ;
}
if (MULTIPLEREFERENCE_DiversityQuestions.equals(attribName))
{
return HTDiversityQuestion.REFERENCE_HTDiversityQuestion ;
}
return super.getMultiAssocReferenceInstance(attribName);
}
......@@ -5501,6 +5653,11 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
return HiringTeam.SINGLEREFERENCE_BilledByTeam ;
}
if (MULTIPLEREFERENCE_DiversityQuestions.equals(attribName))
{
return HTDiversityQuestion.SINGLEREFERENCE_HiringTeam ;
}
return super.getMultiAssocBackReference(attribName);
}
......@@ -5527,6 +5684,11 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
return this.getBillingTeamsCount();
}
if (MULTIPLEREFERENCE_DiversityQuestions.equals(attribName))
{
return this.getDiversityQuestionsCount();
}
return super.getMultiAssocCount(attribName);
}
......@@ -5553,6 +5715,11 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
return this.getBillingTeamsAt(index);
}
if (MULTIPLEREFERENCE_DiversityQuestions.equals(attribName))
{
return this.getDiversityQuestionsAt(index);
}
return super.getMultiAssocAt(attribName, index);
}
......@@ -5585,6 +5752,13 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
return;
}
if (MULTIPLEREFERENCE_DiversityQuestions.equals(attribName))
{
addToDiversityQuestions((HTDiversityQuestion)newElement);
return;
}
super.addToMultiAssoc(attribName, newElement);
}
......@@ -5616,6 +5790,13 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
return;
}
if (MULTIPLEREFERENCE_DiversityQuestions.equals(attribName))
{
removeFromDiversityQuestions((HTDiversityQuestion)oldElement);
return;
}
super.removeFromMultiAssoc(attribName, oldElement);
}
......@@ -5642,6 +5823,12 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
return;
}
if (MULTIPLEREFERENCE_DiversityQuestions.equals(attribName))
{
_DiversityQuestions.__loadAssociation (elements);
return;
}
super.__loadMultiAssoc(attribName, elements);
}
......@@ -5665,6 +5852,11 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
return _BillingTeams.isLoaded ();
}
if (MULTIPLEREFERENCE_DiversityQuestions.equals(attribName))
{
return _DiversityQuestions.isLoaded ();
}
return super.__isMultiAssocLoaded(attribName);
}
......@@ -5878,6 +6070,75 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
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 ()
......@@ -5930,6 +6191,12 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
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)
{
......@@ -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_City, HELPER_City.toObject (_City)); //
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_StripeReference, HELPER_StripeReference.toObject (_StripeReference)); //
tl_hiring_teamPSet.setAttrib (FIELD_StripeSubscription, HELPER_StripeSubscription.toObject (_StripeSubscription)); //
......@@ -6051,6 +6319,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
_PostCode = (String)(HELPER_PostCode.fromObject (_PostCode, tl_hiring_teamPSet.getAttrib (FIELD_PostCode))); //
_City = (String)(HELPER_City.fromObject (_City, tl_hiring_teamPSet.getAttrib (FIELD_City))); //
_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))); //
_StripeReference = (String)(HELPER_StripeReference.fromObject (_StripeReference, tl_hiring_teamPSet.getAttrib (FIELD_StripeReference))); //
_StripeSubscription = (String)(HELPER_StripeSubscription.fromObject (_StripeSubscription, tl_hiring_teamPSet.getAttrib (FIELD_StripeSubscription))); //
......@@ -6185,6 +6454,15 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
try
{
setHasDiversity (otherHiringTeam.getHasDiversity ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setManageOwnBilling (otherHiringTeam.getManageOwnBilling ());
}
catch (FieldException ex)
......@@ -6406,6 +6684,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
_PostCode = sourceHiringTeam._PostCode;
_City = sourceHiringTeam._City;
_HasClientSupport = sourceHiringTeam._HasClientSupport;
_HasDiversity = sourceHiringTeam._HasDiversity;
_ManageOwnBilling = sourceHiringTeam._ManageOwnBilling;
_StripeReference = sourceHiringTeam._StripeReference;
_StripeSubscription = sourceHiringTeam._StripeSubscription;
......@@ -6472,6 +6751,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
_Users.copyFrom (sourceHiringTeam._Users, linkToGhosts);
_Clients.copyFrom (sourceHiringTeam._Clients, linkToGhosts);
_BillingTeams.copyFrom (sourceHiringTeam._BillingTeams, linkToGhosts);
_DiversityQuestions.copyFrom (sourceHiringTeam._DiversityQuestions, linkToGhosts);
}
}
......@@ -6506,6 +6786,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
_PostCode = (String)(HELPER_PostCode.readExternal (_PostCode, vals.get(FIELD_PostCode))); //
_City = (String)(HELPER_City.readExternal (_City, vals.get(FIELD_City))); //
_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))); //
_StripeReference = (String)(HELPER_StripeReference.readExternal (_StripeReference, vals.get(FIELD_StripeReference))); //
_StripeSubscription = (String)(HELPER_StripeSubscription.readExternal (_StripeSubscription, vals.get(FIELD_StripeSubscription))); //
......@@ -6540,6 +6821,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
_Users.readExternalData(vals.get(MULTIPLEREFERENCE_Users));
_Clients.readExternalData(vals.get(MULTIPLEREFERENCE_Clients));
_BillingTeams.readExternalData(vals.get(MULTIPLEREFERENCE_BillingTeams));
_DiversityQuestions.readExternalData(vals.get(MULTIPLEREFERENCE_DiversityQuestions));
}
......@@ -6561,6 +6843,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
vals.put (FIELD_PostCode, HELPER_PostCode.writeExternal (_PostCode));
vals.put (FIELD_City, HELPER_City.writeExternal (_City));
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_StripeReference, HELPER_StripeReference.writeExternal (_StripeReference));
vals.put (FIELD_StripeSubscription, HELPER_StripeSubscription.writeExternal (_StripeSubscription));
......@@ -6595,6 +6878,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
vals.put (MULTIPLEREFERENCE_Users, _Users.writeExternalData());
vals.put (MULTIPLEREFERENCE_Clients, _Clients.writeExternalData());
vals.put (MULTIPLEREFERENCE_BillingTeams, _BillingTeams.writeExternalData());
vals.put (MULTIPLEREFERENCE_DiversityQuestions, _DiversityQuestions.writeExternalData());
}
......@@ -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));
}
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))
{
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
_Users.compare (otherHiringTeam._Users, listener);
_Clients.compare (otherHiringTeam._Clients, listener);
_BillingTeams.compare (otherHiringTeam._BillingTeams, listener);
_DiversityQuestions.compare (otherHiringTeam._DiversityQuestions, listener);
}
}
......@@ -6780,6 +7069,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
visitor.visitField(this, FIELD_PostCode, HELPER_PostCode.toObject(getPostCode()));
visitor.visitField(this, FIELD_City, HELPER_City.toObject(getCity()));
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_StripeReference, HELPER_StripeReference.toObject(getStripeReference()));
visitor.visitField(this, FIELD_StripeSubscription, HELPER_StripeSubscription.toObject(getStripeSubscription()));
......@@ -6810,6 +7100,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
visitor.visitAssociation (_Users);
visitor.visitAssociation (_Clients);
visitor.visitAssociation (_BillingTeams);
visitor.visitAssociation (_DiversityQuestions);
}
......@@ -6850,6 +7141,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{
visitor.visit (_BillingTeams);
}
if (scope.includes (_DiversityQuestions))
{
visitor.visit (_DiversityQuestions);
}
}
......@@ -6915,6 +7210,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{
return filter.matches (getHasClientSupport ());
}
else if (attribName.equals (FIELD_HasDiversity))
{
return filter.matches (getHasDiversity ());
}
else if (attribName.equals (FIELD_ManageOwnBilling))
{
return filter.matches (getManageOwnBilling ());
......@@ -7114,6 +7413,12 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
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)
{
filter.addFilter (context, "tl_hiring_team.manage_own_billing", "ManageOwnBilling");
......@@ -7387,6 +7692,12 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
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)
{
filter.addFilter (context, "tl_hiring_team.manage_own_billing", "ManageOwnBilling");
......@@ -7624,6 +7935,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{
return HELPER_HasClientSupport.toObject (getHasClientSupport ());
}
else if (attribName.equals (FIELD_HasDiversity))
{
return HELPER_HasDiversity.toObject (getHasDiversity ());
}
else if (attribName.equals (FIELD_ManageOwnBilling))
{
return HELPER_ManageOwnBilling.toObject (getManageOwnBilling ());
......@@ -7781,6 +8096,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{
return HELPER_HasClientSupport;
}
else if (attribName.equals (FIELD_HasDiversity))
{
return HELPER_HasDiversity;
}
else if (attribName.equals (FIELD_ManageOwnBilling))
{
return HELPER_ManageOwnBilling;
......@@ -7938,6 +8257,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{
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))
{
setManageOwnBilling ((Boolean)(HELPER_ManageOwnBilling.fromObject (_ManageOwnBilling, attribValue)));
......@@ -8102,6 +8425,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{
return getWriteability_HasClientSupport ();
}
else if (fieldName.equals (FIELD_HasDiversity))
{
return getWriteability_HasDiversity ();
}
else if (fieldName.equals (FIELD_ManageOwnBilling))
{
return getWriteability_ManageOwnBilling ();
......@@ -8202,6 +8529,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{
return getWriteability_BillingTeams ();
}
else if (fieldName.equals (MULTIPLEREFERENCE_DiversityQuestions))
{
return getWriteability_DiversityQuestions ();
}
else if (fieldName.equals (SINGLEREFERENCE_Company))
{
return getWriteability_Company ();
......@@ -8298,6 +8629,11 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
fields.add (FIELD_HasClientSupport);
}
if (getWriteability_HasDiversity () != FieldWriteability.TRUE)
{
fields.add (FIELD_HasDiversity);
}
if (getWriteability_ManageOwnBilling () != FieldWriteability.TRUE)
{
fields.add (FIELD_ManageOwnBilling);
......@@ -8447,6 +8783,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
result.add(HELPER_PostCode.getAttribObject (getClass (), _PostCode, false, FIELD_PostCode));
result.add(HELPER_City.getAttribObject (getClass (), _City, false, FIELD_City));
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_StripeReference.getAttribObject (getClass (), _StripeReference, false, FIELD_StripeReference));
result.add(HELPER_StripeSubscription.getAttribObject (getClass (), _StripeSubscription, false, FIELD_StripeSubscription));
......@@ -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
*/
public Boolean getManageOwnBilling (HiringTeam obj, Boolean original)
......@@ -9253,6 +9608,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{
return toBillingTeams ();
}
if (name.equals ("DiversityQuestions"))
{
return toDiversityQuestions ();
}
if (name.equals ("IsLogoDeleted"))
{
return toIsLogoDeleted ();
......@@ -9309,6 +9668,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{
return toHasClientSupport ();
}
if (name.equals ("HasDiversity"))
{
return toHasDiversity ();
}
if (name.equals ("ManageOwnBilling"))
{
return toManageOwnBilling ();
......@@ -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> 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, String> toStripeReference () { return pipe(new ORMAttributePipe<Me, String>(FIELD_StripeReference)); }
......@@ -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));
}
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
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();
}
}
......@@ -8,8 +8,9 @@
<MULTIPLEREFERENCE name="TestAnalysises" type="TestAnalysis" backreferenceName="Candidate" />
<MULTIPLEREFERENCE name="JobApplications" type="JobApplication" backreferenceName="Candidate" />
<MULTIPLEREFERENCE name="CultureCriteriaAnswers" type="CultureCriteriaAnswer" backreferenceName="Candidate" />
<MULTIPLEREFERENCE name="ProfileAssessmentAnswers" type="Answer" backreferenceName="Candidate" />
<MULTIPLEREFERENCE name="CultureCriteriaAnswers" type="CultureCriteriaAnswer" 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="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">
<TABLE name="tl_candidate_diversity_answer" tablePrefix="object" polymorphic="FALSE">
<SINGLEREFERENCE name="Answer" type="DiversityAnswer" dbcol="answer_id" mandatory="true" />
<SINGLEREFERENCE name="Question" type="DiversityQuestion" dbcol="question_id" mandatory="true" />
<SINGLEREFERENCE name="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.answer_id, {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_Answer)||
!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 answer_id = ? , 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_Answer)))).listEntry (SQLManager.CheckNull((Long)(tl_candidate_diversity_answerPSet.getAttrib (CandidateDiversityAnswer.SINGLEREFERENCE_Question)))).listEntry (SQLManager.CheckNull((Long)(tl_candidate_diversity_answerPSet.getAttrib (CandidateDiversityAnswer.SINGLEREFERENCE_Candidate)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
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_Answer, r.getObject ("answer_id"));
tl_candidate_diversity_answerPSet.setAttrib(CandidateDiversityAnswer.SINGLEREFERENCE_Question, r.getObject ("question_id"));
tl_candidate_diversity_answerPSet.setAttrib(CandidateDiversityAnswer.SINGLEREFERENCE_Candidate, r.getObject ("candidate_id"));
}
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 " +
" ( answer_id, 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_Answer)))).listEntry (SQLManager.CheckNull((Long)(tl_candidate_diversity_answerPSet.getAttrib (CandidateDiversityAnswer.SINGLEREFERENCE_Question)))).listEntry (SQLManager.CheckNull((Long)(tl_candidate_diversity_answerPSet.getAttrib (CandidateDiversityAnswer.SINGLEREFERENCE_Candidate)))) .listEntry (objectID.longID ()).toList().toArray());
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="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 dummyAnswer;
// Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper HELPER_Answer = DefaultAttributeHelper.INSTANCE;
public DiversityAnswerPersistenceMgr ()
{
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, {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_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 = ?, 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_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_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, question_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " +
" (?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.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="QuestionText" type="String" dbcol="question_text" mandatory="true"/>
<ATTRIB name="AustraliaOnly" type="Boolean" dbcol="australia_only" 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 dummyQuestionText;
private Boolean dummyAustraliaOnly;
// Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper HELPER_QuestionText = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_AustraliaOnly = DefaultAttributeHelper.INSTANCE;
public DiversityQuestionPersistenceMgr ()
{
dummyQuestionText = (String)(HELPER_QuestionText.initialise (dummyQuestionText));
dummyAustraliaOnly = (Boolean)(HELPER_AustraliaOnly.initialise (dummyAustraliaOnly));
}
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_text, {PREFIX}tl_diversity_question.australia_only, 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_QuestionText)||
!tl_diversity_questionPSet.containsAttrib(DiversityQuestion.FIELD_AustraliaOnly))
{
// 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_text = ?, australia_only = ? , 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_QuestionText.getForSQL(dummyQuestionText, tl_diversity_questionPSet.getAttrib (DiversityQuestion.FIELD_QuestionText))).listEntry (HELPER_AustraliaOnly.getForSQL(dummyAustraliaOnly, tl_diversity_questionPSet.getAttrib (DiversityQuestion.FIELD_AustraliaOnly))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
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_QuestionText, HELPER_QuestionText.getFromRS(dummyQuestionText, r, "question_text"));
tl_diversity_questionPSet.setAttrib(DiversityQuestion.FIELD_AustraliaOnly, HELPER_AustraliaOnly.getFromRS(dummyAustraliaOnly, r, "australia_only"));
}
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_text, australia_only, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " +
" (?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_QuestionText.getForSQL(dummyQuestionText, tl_diversity_questionPSet.getAttrib (DiversityQuestion.FIELD_QuestionText))).listEntry (HELPER_AustraliaOnly.getForSQL(dummyAustraliaOnly, tl_diversity_questionPSet.getAttrib (DiversityQuestion.FIELD_AustraliaOnly))) .listEntry (objectID.longID ()).toList().toArray());
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,6 +6,7 @@ import java.util.Date;
import java.util.Set;
import oneit.logging.LoggingArea;
import oneit.objstore.FieldWriteability;
import oneit.objstore.StorageException;
import oneit.objstore.ValidationContext;
import oneit.objstore.rdbms.filters.EqualsFilter;
import oneit.security.SecUser;
......@@ -38,6 +39,11 @@ public class HiringTeam extends BaseHiringTeam
return isTrue(getHasClientSupport());
}
public boolean showHasDiversity() throws StorageException, FieldException
{
return isTrue(getHasDiversity());
}
@Override
public String getToString()
{
......
......@@ -7,9 +7,10 @@
<IMPORT value="performa.orm.types.*"/>
<IMPORT value="performa.orm.types.TimeZone"/>
<MULTIPLEREFERENCE name="Users" type="CompanyUserHiringTeamLink" backreferenceName="HiringTeam" />
<MULTIPLEREFERENCE name="Clients" type="Client" backreferenceName="HiringTeam" />
<MULTIPLEREFERENCE name="BillingTeams" type="HiringTeam" backreferenceName="BilledByTeam" />
<MULTIPLEREFERENCE name="Users" type="CompanyUserHiringTeamLink" backreferenceName="HiringTeam" />
<MULTIPLEREFERENCE name="Clients" type="Client" backreferenceName="HiringTeam" />
<MULTIPLEREFERENCE name="BillingTeams" type="HiringTeam" backreferenceName="BilledByTeam" />
<MULTIPLEREFERENCE name="DiversityQuestions" type="HTDiversityQuestion" backreferenceName="HiringTeam" />
<TRANSIENT name="IsLogoDeleted" type="Boolean" defaultValue="Boolean.FALSE"/>
<TRANSIENT name="CouponCode" type="String" length="20"/>
......@@ -28,6 +29,7 @@
<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="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="StripeReference" type="String" dbcol="stripe_reference" length="100" />
<ATTRIB name="StripeSubscription" type="String" dbcol="stripe_subscription" length="100" />
......
......@@ -38,6 +38,7 @@ public class HiringTeamPersistenceMgr extends ObjectPersistenceMgr
private String dummyPostCode;
private String dummyCity;
private Boolean dummyHasClientSupport;
private Boolean dummyHasDiversity;
private Boolean dummyManageOwnBilling;
private String dummyStripeReference;
private String dummyStripeSubscription;
......@@ -73,6 +74,7 @@ public class HiringTeamPersistenceMgr extends ObjectPersistenceMgr
private static final DefaultAttributeHelper HELPER_PostCode = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_City = 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_StripeReference = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_StripeSubscription = DefaultAttributeHelper.INSTANCE;
......@@ -111,6 +113,7 @@ public class HiringTeamPersistenceMgr extends ObjectPersistenceMgr
dummyPostCode = (String)(HELPER_PostCode.initialise (dummyPostCode));
dummyCity = (String)(HELPER_City.initialise (dummyCity));
dummyHasClientSupport = (Boolean)(HELPER_HasClientSupport.initialise (dummyHasClientSupport));
dummyHasDiversity = (Boolean)(HELPER_HasDiversity.initialise (dummyHasDiversity));
dummyManageOwnBilling = (Boolean)(HELPER_ManageOwnBilling.initialise (dummyManageOwnBilling));
dummyStripeReference = (String)(HELPER_StripeReference.initialise (dummyStripeReference));
dummyStripeSubscription = (String)(HELPER_StripeSubscription.initialise (dummyStripeSubscription));
......@@ -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 = "";
public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
......@@ -197,6 +200,7 @@ public class HiringTeamPersistenceMgr extends ObjectPersistenceMgr
!tl_hiring_teamPSet.containsAttrib(HiringTeam.FIELD_PostCode)||
!tl_hiring_teamPSet.containsAttrib(HiringTeam.FIELD_City)||
!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_StripeReference)||
!tl_hiring_teamPSet.containsAttrib(HiringTeam.FIELD_StripeSubscription)||
......@@ -313,10 +317,10 @@ public class HiringTeamPersistenceMgr extends ObjectPersistenceMgr
{
int rowsUpdated = executeStatement (sqlMgr,
"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 ()) + " ",
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)
{
......@@ -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_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_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_StripeReference, HELPER_StripeReference.getFromRS(dummyStripeReference, r, "stripe_reference"));
tl_hiring_teamPSet.setAttrib(HiringTeam.FIELD_StripeSubscription, HELPER_StripeSubscription.getFromRS(dummyStripeSubscription, r, "stripe_subscription"));
......@@ -668,10 +673,10 @@ public class HiringTeamPersistenceMgr extends ObjectPersistenceMgr
{
executeStatement (sqlMgr,
"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 " +
" (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, " + 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());
" (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, " + 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_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);
}
......
......@@ -26,6 +26,7 @@
</NODE>
<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="*.changeCultureCriteria" factory="Participant" class="performa.form.ChangeCultureCriteriaFP"/>
<FORM name="*.saveJob" factory="Participant" class="performa.form.SaveJobFP"/>
......
......@@ -21,23 +21,23 @@
%>
<script type="text/javascript">
var PopupAlert = null;
var PopupMsg = null;
var PopupAlert = null;
var PopupMsg = null;
$(document).ready(function()
{
recalcFunction = setupRecalc ($("form#editCompany"), {'recalcOnError':true});
PopupMsg = new jBox('Modal', {
id : "msg-pop",
overlay : true,
width :600, height : 450
});
PopupAlert = new jBox('Modal', {
id : "alert-pop",
overlay : true,
width : 350, height : 320
});
PopupMsg = new jBox('Modal', {
id : "msg-pop",
overlay : true,
width :600, height : 450
});
PopupAlert = new jBox('Modal', {
id : "alert-pop",
overlay : true,
width : 350, height : 320
});
$("#upload").change(function(){
......@@ -81,9 +81,19 @@
});
$('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(){
$("a ").each(function(){
if ( !$(this).parents(".form-content-wrap").length) {
......@@ -131,6 +141,13 @@
.main-welcome-popup h2 {
padding: 0 20px 0;
}
.form-control.no-border {
border: 0 !important;
}
.disabled-question{
color:#908e8e;
padding-left: 10px;
}
</style>
<div class="container-fluid">
<div class="row content">
......@@ -233,22 +250,89 @@
<oneit:ormEnum obj="<%= hiringTeam %>" attributeName="Industry" cssClass="form-control" displayType="autocomplete"/>
</div>
</div>
<div class="form-group">
<div class="styled_checkboxes">
<div class="checkbox checkbox-primary">
<oneit:ormInput obj="<%= hiringTeam %>" id="has-client-support" attributeName="HasClientSupport" type="checkbox"/>
<oneit:recalcClass htmlTag="span" classScript="hiringTeam.showHasClientSupport() ? 'checked': 'unchecked'" hiringTeam="<%= hiringTeam %>">
<label for="has-client-support">
<oneit:ormlabel obj="<%= hiringTeam %>" field="HasClientSupport" />
</label>
</oneit:recalcClass>
<div class="form-group row">
<div class="col-md-12">
<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>
</div>
</div>
<div class="form-group row">
<div class="col-md-6">
<div class="radio radio-primary second-radio-primary oneit-radio">
<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 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>
<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))
{
%>
%> <div class="form-brack-line-sub"></div>
<div class="form-group">
<label><oneit:ormlabel obj="<%= hiringTeam %>" field="MessageID" /></label>
<oneit:ormInput obj="<%= hiringTeam %>" type="text" attributeName="MessageID" cssClass="form-control"/>
......@@ -267,7 +351,7 @@
</oneit:recalcClass>
<div class="form-group row">
<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 class="col-md-6">
<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="answer_id" type="Long" length="11" nullable="false"/>
<column name="question_id" type="Long" length="11" nullable="false"/>
<column name="candidate_id" type="Long" length="11" nullable="false"/>
</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"/>
</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_text" type="CLOB" nullable="false"/>
<column name="australia_only" 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"?>
<!-- @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='question_text' factory='String'>Do you identify as a person of Aboriginal or Torres Strait Islander origin?</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='question_text' factory='String'>Do you identify as a person living with a disability?</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='question_text' factory='String'>I identify by gender as</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"/>
</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"/>
</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"/>
</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"/>
</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"/>
</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"/>
</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"/>
</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"/>
</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"/>
</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"/>
</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"/>
</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"/>
</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"/>
</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"/>
</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"/>
</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"/>
</NODE>
</NODE>
</OBJECTS>
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