Commit bad2fe18 by nilu

S43014153 # Matchd / Talentology - No Plan [Enhancement] #Including diversity…

S43014153 # Matchd / Talentology - No Plan [Enhancement] #Including diversity questions in applicant process
parent 4f4c0d47
......@@ -8,6 +8,7 @@
<column name="object_id" type="Long" nullable="false" length="11"/>
<column name="object_last_updated_date" type="Date" nullable="false" length="22"/>
<column name="object_created_date" type="Date" nullable="false" length="22"/>
<column name="is_selected" type="Boolean" nullable="true"/>
<column name="candidate_answer_id" type="Long" length="11" nullable="false"/>
<column name="answer_id" type="Long" length="11" nullable="false"/>
</NODE>
......
......@@ -8,6 +8,7 @@ CREATE TABLE tl_answer_option (
object_last_updated_date datetime DEFAULT getdate() NOT NULL ,
object_created_date datetime DEFAULT getdate() NOT NULL
,
is_selected char(1) NULL,
candidate_answer_id numeric(12) NOT NULL,
answer_id numeric(12) NOT NULL
);
......
......@@ -9,6 +9,7 @@ CREATE TABLE tl_answer_option (
object_last_updated_date date DEFAULT SYSDATE NOT NULL ,
object_created_date date DEFAULT SYSDATE NOT NULL
,
is_selected char(1) NULL,
candidate_answer_id number(12) NOT NULL,
answer_id number(12) NOT NULL
);
......
......@@ -9,6 +9,7 @@ CREATE TABLE tl_answer_option (
object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
object_created_date timestamp DEFAULT NOW() NOT NULL
,
is_selected char(1) NULL,
candidate_answer_id numeric(12) NOT NULL,
answer_id numeric(12) NOT NULL
);
......
package performa.form;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import oneit.logging.LogLevel;
import oneit.logging.LogMgr;
import oneit.objstore.StorageException;
import oneit.objstore.parser.BusinessObjectParser;
import oneit.objstore.rdbms.filters.EqualsFilter;
import oneit.servlets.forms.SubmissionDetails;
import oneit.servlets.forms.SuccessfulResult;
import oneit.servlets.process.ORMProcessState;
import oneit.servlets.process.SaveFP;
import oneit.utils.BusinessException;
import oneit.utils.MultiException;
import oneit.utils.filter.Filter;
import performa.orm.AnswerOption;
import performa.orm.Candidate;
import performa.orm.CandidateDiversityAnswer;
import performa.orm.HTDiversityQuestion;
import performa.orm.Job;
import performa.orm.JobApplication;
public class SaveDiversityAnswersFP extends SaveFP
{
@Override
public SuccessfulResult processForm(ORMProcessState process, SubmissionDetails submission, Map params) throws BusinessException, StorageException
{
HttpServletRequest request = submission.getRequest();
JobApplication jobApplication = (JobApplication) request.getAttribute("JobApplication");
LogMgr.log(JobApplication.LOG, LogLevel.PROCESSING1,"In SaveDiversityAnswersFP saving job application: ", jobApplication );
Candidate candidate = jobApplication.getCandidate();
Job job = jobApplication.getJob();
for(HTDiversityQuestion htQuestion : job.getDiversityQuestions())
{
CandidateDiversityAnswer diversityAnswer = candidate.getDiversityAnswerByQuestion(htQuestion.getQuestion());
for(AnswerOption answer : diversityAnswer.getAnswersSet())
{
if(!answer.isTrue(answer.getIsSelected()))
{
LogMgr.log(JobApplication.LOG, LogLevel.PROCESSING1,"In SaveDiversityAnswersFP deleting AnswerOption : ", answer );
answer.delete();
}
}
}
return super.processForm(process, submission, params);
}
@Override
public void validate(ORMProcessState process, SubmissionDetails submission, MultiException exceptions, Map params) throws StorageException
{
HttpServletRequest request = submission.getRequest();
JobApplication jobApplication = (JobApplication) request.getAttribute("JobApplication");
Candidate candidate = jobApplication.getCandidate();
Job job = jobApplication.getJob();
for(HTDiversityQuestion htQuestion : job.getDiversityQuestions())
{
CandidateDiversityAnswer diversityAnswer = candidate.getDiversityAnswerByQuestion(htQuestion.getQuestion());
Filter<AnswerOption> filter = AnswerOption.SearchByAll().andIsSelected(new EqualsFilter<>(Boolean.TRUE));
BusinessObjectParser.assertFieldCondition(diversityAnswer.pipelineCandidateDiversityAnswer().toAnswers(filter).uniqueVals().size() >= 1 , diversityAnswer, CandidateDiversityAnswer.MULTIPLEREFERENCE_Answers, "atleastOneAnswer", exceptions, true, request);
}
super.validate(process, submission, exceptions, params);
}
}
\ No newline at end of file
......@@ -66,13 +66,6 @@ public class SendVerificationMailFP extends SaveFP
BusinessObjectParser.assertFieldCondition(candidate.getGoogleAddressText() != null, candidate, Candidate.FIELD_GoogleAddressText, "mandatory", exceptions, true, request);
BusinessObjectParser.assertFieldCondition(candidate.isTrue(candidate.getHasValidAddress()), candidate, Candidate.FIELD_GoogleAddressText, "invalid", exceptions, true, request);
if(candidate.getAnsweredDiversity())
{
for(HTDiversityQuestion htQuestion : job.getDiversityQuestions())
{
BusinessObjectParser.assertFieldCondition(candidate.hasAnswer(htQuestion), candidate, Candidate.MULTIPLEREFERENCE_DiversityAnswers, "mandatory", exceptions, true, request);
}
}
}
super.validate(process, submission, exceptions, params);
......@@ -138,11 +131,6 @@ public class SendVerificationMailFP extends SaveFP
}
else
{
if(job.hasDiversityQuestions() && candidate.isFalse(candidate.getAnsweredDiversity()))
{
return super.processForm(process, submission, params);
}
if(candidate.isTrue(candidate.getIsEmailIngest()) || jobApplication.getApplicationStatus() == ApplicationStatus.POST_INGEST)
{
if(candidate.isFalse(candidate.getIsMaskedEmail()))
......
......@@ -5,7 +5,9 @@
<BUSINESSCLASS name="AnswerOption" package="performa.orm">
<TABLE name="tl_answer_option" tablePrefix="object" polymorphic="FALSE">
<ATTRIB name="IsSelected" type="Boolean" dbcol="is_selected" defaultValue="Boolean.FALSE" />
<SINGLEREFERENCE name="CandidateAnswer" type="CandidateDiversityAnswer" dbcol="candidate_answer_id" mandatory="true" backreferenceName="Answers"/>
<SINGLEREFERENCE name="Answer" type="DiversityAnswer" dbcol="answer_id" mandatory="true" />
......
......@@ -26,19 +26,22 @@ public class AnswerOptionPersistenceMgr extends ObjectPersistenceMgr
private static final LoggingArea AnswerOptionPersistence = LoggingArea.createLoggingArea(ObjectPersistenceMgr.OBJECT_PERSISTENCE, "AnswerOption");
// Private attributes corresponding to business object data
private Boolean dummyIsSelected;
// Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper HELPER_IsSelected = DefaultAttributeHelper.INSTANCE;
public AnswerOptionPersistenceMgr ()
{
dummyIsSelected = (Boolean)(HELPER_IsSelected.initialise (dummyIsSelected));
}
private String SELECT_COLUMNS = "{PREFIX}tl_answer_option.object_id as id, {PREFIX}tl_answer_option.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_answer_option.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_answer_option.candidate_answer_id, {PREFIX}tl_answer_option.answer_id, 1 AS commasafe ";
private String SELECT_COLUMNS = "{PREFIX}tl_answer_option.object_id as id, {PREFIX}tl_answer_option.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_answer_option.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_answer_option.is_selected, {PREFIX}tl_answer_option.candidate_answer_id, {PREFIX}tl_answer_option.answer_id, 1 AS commasafe ";
private String SELECT_JOINS = "";
public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
......@@ -89,6 +92,7 @@ public class AnswerOptionPersistenceMgr extends ObjectPersistenceMgr
// Check for persistent sets already prefetched
if (false || !tl_answer_optionPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!tl_answer_optionPSet.containsAttrib(AnswerOption.FIELD_IsSelected)||
!tl_answer_optionPSet.containsAttrib(AnswerOption.SINGLEREFERENCE_CandidateAnswer)||
!tl_answer_optionPSet.containsAttrib(AnswerOption.SINGLEREFERENCE_Answer))
{
......@@ -170,10 +174,10 @@ public class AnswerOptionPersistenceMgr extends ObjectPersistenceMgr
{
int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}tl_answer_option " +
"SET candidate_answer_id = ? , answer_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"SET is_selected = ?, candidate_answer_id = ? , answer_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE tl_answer_option.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (SQLManager.CheckNull((Long)(tl_answer_optionPSet.getAttrib (AnswerOption.SINGLEREFERENCE_CandidateAnswer)))).listEntry (SQLManager.CheckNull((Long)(tl_answer_optionPSet.getAttrib (AnswerOption.SINGLEREFERENCE_Answer)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
CollectionUtils.listEntry (HELPER_IsSelected.getForSQL(dummyIsSelected, tl_answer_optionPSet.getAttrib (AnswerOption.FIELD_IsSelected))).listEntry (SQLManager.CheckNull((Long)(tl_answer_optionPSet.getAttrib (AnswerOption.SINGLEREFERENCE_CandidateAnswer)))).listEntry (SQLManager.CheckNull((Long)(tl_answer_optionPSet.getAttrib (AnswerOption.SINGLEREFERENCE_Answer)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
if (rowsUpdated != 1)
{
......@@ -429,6 +433,7 @@ public class AnswerOptionPersistenceMgr extends ObjectPersistenceMgr
// Object Created
tl_answer_optionPSet.setAttrib(BaseBusinessClass.FIELD_ObjectCreated, r.getTimestamp ("CREATED_DATE"));
tl_answer_optionPSet.setAttrib(AnswerOption.FIELD_IsSelected, HELPER_IsSelected.getFromRS(dummyIsSelected, r, "is_selected"));
tl_answer_optionPSet.setAttrib(AnswerOption.SINGLEREFERENCE_CandidateAnswer, r.getObject ("candidate_answer_id"));
tl_answer_optionPSet.setAttrib(AnswerOption.SINGLEREFERENCE_Answer, r.getObject ("answer_id"));
......@@ -448,10 +453,10 @@ public class AnswerOptionPersistenceMgr extends ObjectPersistenceMgr
{
executeStatement (sqlMgr,
"INSERT INTO {PREFIX}tl_answer_option " +
" ( candidate_answer_id, answer_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
" (is_selected, candidate_answer_id, answer_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " +
" ( ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils .listEntry (SQLManager.CheckNull((Long)(tl_answer_optionPSet.getAttrib (AnswerOption.SINGLEREFERENCE_CandidateAnswer)))).listEntry (SQLManager.CheckNull((Long)(tl_answer_optionPSet.getAttrib (AnswerOption.SINGLEREFERENCE_Answer)))) .listEntry (objectID.longID ()).toList().toArray());
" (?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_IsSelected.getForSQL(dummyIsSelected, tl_answer_optionPSet.getAttrib (AnswerOption.FIELD_IsSelected))) .listEntry (SQLManager.CheckNull((Long)(tl_answer_optionPSet.getAttrib (AnswerOption.SINGLEREFERENCE_CandidateAnswer)))).listEntry (SQLManager.CheckNull((Long)(tl_answer_optionPSet.getAttrib (AnswerOption.SINGLEREFERENCE_Answer)))) .listEntry (objectID.longID ()).toList().toArray());
tl_answer_optionPSet.setStatus (PersistentSetStatus.PROCESSED);
}
......
......@@ -38,6 +38,7 @@ public abstract class BaseAnswerOption extends BaseBusinessClass
// Static constants corresponding to field names
public static final String FIELD_IsSelected = "IsSelected";
public static final String SINGLEREFERENCE_CandidateAnswer = "CandidateAnswer";
public static final String BACKREF_CandidateAnswer = "";
public static final String SINGLEREFERENCE_Answer = "Answer";
......@@ -47,9 +48,11 @@ public abstract class BaseAnswerOption extends BaseBusinessClass
// Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper<AnswerOption> HELPER_IsSelected = DefaultAttributeHelper.INSTANCE;
// Private attributes corresponding to business object data
private Boolean _IsSelected;
// Private attributes corresponding to single references
......@@ -64,6 +67,7 @@ public abstract class BaseAnswerOption extends BaseBusinessClass
private static final Map ATTRIBUTES_METADATA_AnswerOption = new HashMap ();
// Arrays of validators for each attribute
private static final AttributeValidator[] FIELD_IsSelected_Validators;
// Arrays of behaviour decorators
......@@ -80,6 +84,7 @@ public abstract class BaseAnswerOption extends BaseBusinessClass
setupAssocMetaData_CandidateAnswer();
setupAssocMetaData_Answer();
FIELD_IsSelected_Validators = (AttributeValidator[])setupAttribMetaData_IsSelected(validatorMapping).toArray (new AttributeValidator[0]);
REFERENCE_AnswerOption.initialiseReference ();
......@@ -125,6 +130,25 @@ public abstract class BaseAnswerOption extends BaseBusinessClass
}
// Meta Info setup
private static List setupAttribMetaData_IsSelected(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "is_selected");
metaInfo.put ("defaultValue", "Boolean.FALSE");
metaInfo.put ("name", "IsSelected");
metaInfo.put ("type", "Boolean");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for AnswerOption.IsSelected:", metaInfo);
ATTRIBUTES_METADATA_AnswerOption.put (FIELD_IsSelected, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(AnswerOption.class, "IsSelected", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for AnswerOption.IsSelected:", validators);
return validators;
}
// END OF STATIC METADATA DEFINITION
......@@ -152,6 +176,7 @@ public abstract class BaseAnswerOption extends BaseBusinessClass
super._initialiseNewObjAttributes (transaction);
_IsSelected = (Boolean)(Boolean.FALSE);
}
......@@ -180,6 +205,104 @@ public abstract class BaseAnswerOption extends BaseBusinessClass
/**
* Get the attribute IsSelected
*/
public Boolean getIsSelected ()
{
assertValid();
Boolean valToReturn = _IsSelected;
for (AnswerOptionBehaviourDecorator bhd : AnswerOption_BehaviourDecorators)
{
valToReturn = bhd.getIsSelected ((AnswerOption)this, valToReturn);
}
return valToReturn;
}
/**
* Called prior to the attribute changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preIsSelectedChange (Boolean newIsSelected) throws FieldException
{
}
/**
* Called after the attribute changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postIsSelectedChange () throws FieldException
{
}
public FieldWriteability getWriteability_IsSelected ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute IsSelected. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setIsSelected (Boolean newIsSelected) throws FieldException
{
boolean oldAndNewIdentical = HELPER_IsSelected.compare (_IsSelected, newIsSelected);
try
{
for (AnswerOptionBehaviourDecorator bhd : AnswerOption_BehaviourDecorators)
{
newIsSelected = bhd.setIsSelected ((AnswerOption)this, newIsSelected);
oldAndNewIdentical = HELPER_IsSelected.compare (_IsSelected, newIsSelected);
}
if (FIELD_IsSelected_Validators.length > 0)
{
Object newIsSelectedObj = HELPER_IsSelected.toObject (newIsSelected);
if (newIsSelectedObj != null)
{
int loopMax = FIELD_IsSelected_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_AnswerOption.get (FIELD_IsSelected);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_IsSelected_Validators[v].checkAttribute (this, FIELD_IsSelected, metadata, newIsSelectedObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_IsSelected () != FieldWriteability.FALSE, "Field IsSelected is not writeable");
preIsSelectedChange (newIsSelected);
markFieldChange (FIELD_IsSelected);
_IsSelected = newIsSelected;
postFieldChange (FIELD_IsSelected);
postIsSelectedChange ();
}
}
/**
......@@ -695,6 +818,7 @@ public abstract class BaseAnswerOption extends BaseBusinessClass
PersistentSet tl_answer_optionPSet = allSets.getPersistentSet (myID, "tl_answer_option", myPSetStatus);
tl_answer_optionPSet.setAttrib (FIELD_ObjectID, myID);
tl_answer_optionPSet.setAttrib (FIELD_IsSelected, HELPER_IsSelected.toObject (_IsSelected)); //
_CandidateAnswer.getPersistentSets (allSets);
_Answer.getPersistentSets (allSets);
......@@ -711,6 +835,7 @@ public abstract class BaseAnswerOption extends BaseBusinessClass
PersistentSet tl_answer_optionPSet = allSets.getPersistentSet (objectID, "tl_answer_option");
_IsSelected = (Boolean)(HELPER_IsSelected.fromObject (_IsSelected, tl_answer_optionPSet.getAttrib (FIELD_IsSelected))); //
_CandidateAnswer.setFromPersistentSets (objectID, allSets);
_Answer.setFromPersistentSets (objectID, allSets);
......@@ -728,6 +853,15 @@ public abstract class BaseAnswerOption extends BaseBusinessClass
{
AnswerOption otherAnswerOption = (AnswerOption)other;
try
{
setIsSelected (otherAnswerOption.getIsSelected ());
}
catch (FieldException ex)
{
e.addException (ex);
}
}
}
......@@ -743,6 +877,7 @@ public abstract class BaseAnswerOption extends BaseBusinessClass
{
BaseAnswerOption sourceAnswerOption = (BaseAnswerOption)(source);
_IsSelected = sourceAnswerOption._IsSelected;
}
}
......@@ -801,6 +936,7 @@ public abstract class BaseAnswerOption extends BaseBusinessClass
{
super.readExternalData(vals);
_IsSelected = (Boolean)(HELPER_IsSelected.readExternal (_IsSelected, vals.get(FIELD_IsSelected))); //
_CandidateAnswer.readExternalData(vals.get(SINGLEREFERENCE_CandidateAnswer));
_Answer.readExternalData(vals.get(SINGLEREFERENCE_Answer));
......@@ -814,6 +950,7 @@ public abstract class BaseAnswerOption extends BaseBusinessClass
{
super.writeExternalData(vals);
vals.put (FIELD_IsSelected, HELPER_IsSelected.writeExternal (_IsSelected));
vals.put (SINGLEREFERENCE_CandidateAnswer, _CandidateAnswer.writeExternalData());
vals.put (SINGLEREFERENCE_Answer, _Answer.writeExternalData());
......@@ -829,6 +966,10 @@ public abstract class BaseAnswerOption extends BaseBusinessClass
BaseAnswerOption otherAnswerOption = (BaseAnswerOption)(other);
if (!HELPER_IsSelected.compare(this._IsSelected, otherAnswerOption._IsSelected))
{
listener.notifyFieldChange(this, other, FIELD_IsSelected, HELPER_IsSelected.toObject(this._IsSelected), HELPER_IsSelected.toObject(otherAnswerOption._IsSelected));
}
// Compare single assocs
_CandidateAnswer.compare (otherAnswerOption._CandidateAnswer, listener);
......@@ -853,6 +994,7 @@ public abstract class BaseAnswerOption extends BaseBusinessClass
{
super.visitAttributes (visitor);
visitor.visitField(this, FIELD_IsSelected, HELPER_IsSelected.toObject(getIsSelected()));
visitor.visitAssociation (_CandidateAnswer);
visitor.visitAssociation (_Answer);
......@@ -896,6 +1038,10 @@ public abstract class BaseAnswerOption extends BaseBusinessClass
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_IsSelected))
{
return filter.matches (getIsSelected ());
}
else if (attribName.equals (SINGLEREFERENCE_CandidateAnswer))
{
return filter.matches (getCandidateAnswer ());
......@@ -935,6 +1081,12 @@ public abstract class BaseAnswerOption extends BaseBusinessClass
}
public SearchAll andIsSelected (QueryFilter<Boolean> filter)
{
filter.addFilter (context, "tl_answer_option.is_selected", "IsSelected");
return this;
}
public SearchAll andCandidateAnswer (QueryFilter<CandidateDiversityAnswer> filter)
{
filter.addFilter (context, "tl_answer_option.candidate_answer_id", "CandidateAnswer");
......@@ -982,6 +1134,10 @@ public abstract class BaseAnswerOption extends BaseBusinessClass
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_IsSelected))
{
return HELPER_IsSelected.toObject (getIsSelected ());
}
else
{
return super.getAttribute (attribName);
......@@ -995,6 +1151,10 @@ public abstract class BaseAnswerOption extends BaseBusinessClass
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_IsSelected))
{
return HELPER_IsSelected;
}
else
{
return super.getAttributeHelper (attribName);
......@@ -1008,6 +1168,10 @@ public abstract class BaseAnswerOption extends BaseBusinessClass
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_IsSelected))
{
setIsSelected ((Boolean)(HELPER_IsSelected.fromObject (_IsSelected, attribValue)));
}
else
{
super.setAttribute (attribName, attribValue);
......@@ -1028,6 +1192,10 @@ public abstract class BaseAnswerOption extends BaseBusinessClass
{
throw new RuntimeException ("Game over man!!");
}
else if (fieldName.equals (FIELD_IsSelected))
{
return getWriteability_IsSelected ();
}
else if (fieldName.equals (SINGLEREFERENCE_CandidateAnswer))
{
return getWriteability_CandidateAnswer ();
......@@ -1046,6 +1214,11 @@ public abstract class BaseAnswerOption extends BaseBusinessClass
public void putUnwriteable (Set<String> fields)
{
if (getWriteability_IsSelected () != FieldWriteability.TRUE)
{
fields.add (FIELD_IsSelected);
}
super.putUnwriteable (fields);
}
......@@ -1055,6 +1228,7 @@ public abstract class BaseAnswerOption extends BaseBusinessClass
List result = super.getAttributes ();
result.add(HELPER_IsSelected.getAttribObject (getClass (), _IsSelected, false, FIELD_IsSelected));
return result;
}
......@@ -1105,6 +1279,24 @@ public abstract class BaseAnswerOption extends BaseBusinessClass
public static class AnswerOptionBehaviourDecorator extends BaseBusinessClass.BBCBehaviourDecorator<AnswerOption>
{
/**
* Get the attribute IsSelected
*/
public Boolean getIsSelected (AnswerOption obj, Boolean original)
{
return original;
}
/**
* Change the value set for attribute IsSelected.
* May modify the field beforehand
* Occurs before validation.
*/
public Boolean setIsSelected (AnswerOption obj, Boolean newIsSelected) throws FieldException
{
return newIsSelected;
}
}
......@@ -1157,6 +1349,10 @@ public abstract class BaseAnswerOption extends BaseBusinessClass
public PipeLine<From, ? extends Object> to(String name)
{
if (name.equals ("IsSelected"))
{
return toIsSelected ();
}
if (name.equals ("CandidateAnswer"))
{
return toCandidateAnswer ();
......@@ -1170,6 +1366,8 @@ public abstract class BaseAnswerOption extends BaseBusinessClass
return super.to(name);
}
public PipeLine<From, Boolean> toIsSelected () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_IsSelected)); }
public CandidateDiversityAnswer.CandidateDiversityAnswerPipeLineFactory<From, CandidateDiversityAnswer> toCandidateAnswer () { return toCandidateAnswer (Filter.ALL); }
public CandidateDiversityAnswer.CandidateDiversityAnswerPipeLineFactory<From, CandidateDiversityAnswer> toCandidateAnswer (Filter<CandidateDiversityAnswer> filter)
......
......@@ -54,7 +54,6 @@ public abstract class BaseCandidate extends SecUserExtension
public static final String FIELD_PrivacyPolicyAgreed = "PrivacyPolicyAgreed";
public static final String FIELD_ConditionsAgreed = "ConditionsAgreed";
public static final String FIELD_HasValidAddress = "HasValidAddress";
public static final String FIELD_AnsweredDiversity = "AnsweredDiversity";
public static final String SINGLEREFERENCE_TestInput = "TestInput";
public static final String BACKREF_TestInput = "";
public static final String MULTIPLEREFERENCE_TestAnalysises = "TestAnalysises";
......@@ -89,7 +88,6 @@ public abstract class BaseCandidate extends SecUserExtension
private static final DefaultAttributeHelper<Candidate> HELPER_PrivacyPolicyAgreed = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Candidate> HELPER_ConditionsAgreed = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Candidate> HELPER_HasValidAddress = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Candidate> HELPER_AnsweredDiversity = DefaultAttributeHelper.INSTANCE;
// Private attributes corresponding to business object data
......@@ -107,7 +105,6 @@ public abstract class BaseCandidate extends SecUserExtension
private Boolean _PrivacyPolicyAgreed;
private Boolean _ConditionsAgreed;
private Boolean _HasValidAddress;
private Boolean _AnsweredDiversity;
// Private attributes corresponding to single references
......@@ -129,7 +126,6 @@ public abstract class BaseCandidate extends SecUserExtension
private static final AttributeValidator[] FIELD_PrivacyPolicyAgreed_Validators;
private static final AttributeValidator[] FIELD_ConditionsAgreed_Validators;
private static final AttributeValidator[] FIELD_HasValidAddress_Validators;
private static final AttributeValidator[] FIELD_AnsweredDiversity_Validators;
private static final AttributeValidator[] FIELD_Phone_Validators;
private static final AttributeValidator[] FIELD_ForgotPasswordMailSendDate_Validators;
private static final AttributeValidator[] FIELD_ForgotPasswordKey_Validators;
......@@ -169,7 +165,6 @@ public abstract class BaseCandidate extends SecUserExtension
FIELD_PrivacyPolicyAgreed_Validators = (AttributeValidator[])setupAttribMetaData_PrivacyPolicyAgreed(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_ConditionsAgreed_Validators = (AttributeValidator[])setupAttribMetaData_ConditionsAgreed(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_HasValidAddress_Validators = (AttributeValidator[])setupAttribMetaData_HasValidAddress(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_AnsweredDiversity_Validators = (AttributeValidator[])setupAttribMetaData_AnsweredDiversity(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_Phone_Validators = (AttributeValidator[])setupAttribMetaData_Phone(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_ForgotPasswordMailSendDate_Validators = (AttributeValidator[])setupAttribMetaData_ForgotPasswordMailSendDate(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_ForgotPasswordKey_Validators = (AttributeValidator[])setupAttribMetaData_ForgotPasswordKey(validatorMapping).toArray (new AttributeValidator[0]);
......@@ -335,24 +330,6 @@ public abstract class BaseCandidate extends SecUserExtension
}
// Meta Info setup
private static List setupAttribMetaData_AnsweredDiversity(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("defaultValue", "Boolean.FALSE");
metaInfo.put ("name", "AnsweredDiversity");
metaInfo.put ("type", "Boolean");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Candidate.AnsweredDiversity:", metaInfo);
ATTRIBUTES_METADATA_Candidate.put (FIELD_AnsweredDiversity, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(Candidate.class, "AnsweredDiversity", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for Candidate.AnsweredDiversity:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_Phone(Map validatorMapping)
{
Map metaInfo = new HashMap ();
......@@ -600,7 +577,6 @@ public abstract class BaseCandidate extends SecUserExtension
_PrivacyPolicyAgreed = (Boolean)(Boolean.FALSE);
_ConditionsAgreed = (Boolean)(Boolean.FALSE);
_HasValidAddress = (Boolean)(Boolean.FALSE);
_AnsweredDiversity = (Boolean)(Boolean.FALSE);
}
......@@ -2009,104 +1985,6 @@ public abstract class BaseCandidate extends SecUserExtension
}
}
/**
* Get the attribute AnsweredDiversity
*/
public Boolean getAnsweredDiversity ()
{
assertValid();
Boolean valToReturn = _AnsweredDiversity;
for (CandidateBehaviourDecorator bhd : Candidate_BehaviourDecorators)
{
valToReturn = bhd.getAnsweredDiversity ((Candidate)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 preAnsweredDiversityChange (Boolean newAnsweredDiversity) 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 postAnsweredDiversityChange () throws FieldException
{
}
public FieldWriteability getWriteability_AnsweredDiversity ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute AnsweredDiversity. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setAnsweredDiversity (Boolean newAnsweredDiversity) throws FieldException
{
boolean oldAndNewIdentical = HELPER_AnsweredDiversity.compare (_AnsweredDiversity, newAnsweredDiversity);
try
{
for (CandidateBehaviourDecorator bhd : Candidate_BehaviourDecorators)
{
newAnsweredDiversity = bhd.setAnsweredDiversity ((Candidate)this, newAnsweredDiversity);
oldAndNewIdentical = HELPER_AnsweredDiversity.compare (_AnsweredDiversity, newAnsweredDiversity);
}
if (FIELD_AnsweredDiversity_Validators.length > 0)
{
Object newAnsweredDiversityObj = HELPER_AnsweredDiversity.toObject (newAnsweredDiversity);
if (newAnsweredDiversityObj != null)
{
int loopMax = FIELD_AnsweredDiversity_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_Candidate.get (FIELD_AnsweredDiversity);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_AnsweredDiversity_Validators[v].checkAttribute (this, FIELD_AnsweredDiversity, metadata, newAnsweredDiversityObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_AnsweredDiversity () != FieldWriteability.FALSE, "Field AnsweredDiversity is not writeable");
preAnsweredDiversityChange (newAnsweredDiversity);
markFieldChange (FIELD_AnsweredDiversity);
_AnsweredDiversity = newAnsweredDiversity;
postFieldChange (FIELD_AnsweredDiversity);
postAnsweredDiversityChange ();
}
}
/**
......@@ -3297,7 +3175,6 @@ public abstract class BaseCandidate extends SecUserExtension
_PrivacyPolicyAgreed = sourceCandidate._PrivacyPolicyAgreed;
_ConditionsAgreed = sourceCandidate._ConditionsAgreed;
_HasValidAddress = sourceCandidate._HasValidAddress;
_AnsweredDiversity = sourceCandidate._AnsweredDiversity;
}
}
......@@ -3370,7 +3247,6 @@ public abstract class BaseCandidate extends SecUserExtension
_PrivacyPolicyAgreed = (Boolean)(HELPER_PrivacyPolicyAgreed.readExternal (_PrivacyPolicyAgreed, vals.get(FIELD_PrivacyPolicyAgreed))); //
_ConditionsAgreed = (Boolean)(HELPER_ConditionsAgreed.readExternal (_ConditionsAgreed, vals.get(FIELD_ConditionsAgreed))); //
_HasValidAddress = (Boolean)(HELPER_HasValidAddress.readExternal (_HasValidAddress, vals.get(FIELD_HasValidAddress))); //
_AnsweredDiversity = (Boolean)(HELPER_AnsweredDiversity.readExternal (_AnsweredDiversity, vals.get(FIELD_AnsweredDiversity))); //
_TestInput.readExternalData(vals.get(SINGLEREFERENCE_TestInput));
_TestAnalysises.readExternalData(vals.get(MULTIPLEREFERENCE_TestAnalysises));
_JobApplications.readExternalData(vals.get(MULTIPLEREFERENCE_JobApplications));
......@@ -3402,7 +3278,6 @@ public abstract class BaseCandidate extends SecUserExtension
vals.put (FIELD_PrivacyPolicyAgreed, HELPER_PrivacyPolicyAgreed.writeExternal (_PrivacyPolicyAgreed));
vals.put (FIELD_ConditionsAgreed, HELPER_ConditionsAgreed.writeExternal (_ConditionsAgreed));
vals.put (FIELD_HasValidAddress, HELPER_HasValidAddress.writeExternal (_HasValidAddress));
vals.put (FIELD_AnsweredDiversity, HELPER_AnsweredDiversity.writeExternal (_AnsweredDiversity));
vals.put (SINGLEREFERENCE_TestInput, _TestInput.writeExternalData());
vals.put (MULTIPLEREFERENCE_TestAnalysises, _TestAnalysises.writeExternalData());
vals.put (MULTIPLEREFERENCE_JobApplications, _JobApplications.writeExternalData());
......@@ -3489,7 +3364,6 @@ public abstract class BaseCandidate extends SecUserExtension
visitor.visitField(this, FIELD_PrivacyPolicyAgreed, HELPER_PrivacyPolicyAgreed.toObject(getPrivacyPolicyAgreed()));
visitor.visitField(this, FIELD_ConditionsAgreed, HELPER_ConditionsAgreed.toObject(getConditionsAgreed()));
visitor.visitField(this, FIELD_HasValidAddress, HELPER_HasValidAddress.toObject(getHasValidAddress()));
visitor.visitField(this, FIELD_AnsweredDiversity, HELPER_AnsweredDiversity.toObject(getAnsweredDiversity()));
}
......@@ -3998,10 +3872,6 @@ public abstract class BaseCandidate extends SecUserExtension
{
return HELPER_HasValidAddress.toObject (getHasValidAddress ());
}
else if (attribName.equals (FIELD_AnsweredDiversity))
{
return HELPER_AnsweredDiversity.toObject (getAnsweredDiversity ());
}
else
{
return super.getAttribute (attribName);
......@@ -4071,10 +3941,6 @@ public abstract class BaseCandidate extends SecUserExtension
{
return HELPER_HasValidAddress;
}
else if (attribName.equals (FIELD_AnsweredDiversity))
{
return HELPER_AnsweredDiversity;
}
else
{
return super.getAttributeHelper (attribName);
......@@ -4144,10 +4010,6 @@ public abstract class BaseCandidate extends SecUserExtension
{
setHasValidAddress ((Boolean)(HELPER_HasValidAddress.fromObject (_HasValidAddress, attribValue)));
}
else if (attribName.equals (FIELD_AnsweredDiversity))
{
setAnsweredDiversity ((Boolean)(HELPER_AnsweredDiversity.fromObject (_AnsweredDiversity, attribValue)));
}
else
{
super.setAttribute (attribName, attribValue);
......@@ -4248,10 +4110,6 @@ public abstract class BaseCandidate extends SecUserExtension
{
return getWriteability_HasValidAddress ();
}
else if (fieldName.equals (FIELD_AnsweredDiversity))
{
return getWriteability_AnsweredDiversity ();
}
else
{
return super.getWriteable (fieldName);
......@@ -4332,11 +4190,6 @@ public abstract class BaseCandidate extends SecUserExtension
fields.add (FIELD_HasValidAddress);
}
if (getWriteability_AnsweredDiversity () != FieldWriteability.TRUE)
{
fields.add (FIELD_AnsweredDiversity);
}
super.putUnwriteable (fields);
}
......@@ -4360,7 +4213,6 @@ public abstract class BaseCandidate extends SecUserExtension
result.add(HELPER_PrivacyPolicyAgreed.getAttribObject (getClass (), _PrivacyPolicyAgreed, false, FIELD_PrivacyPolicyAgreed));
result.add(HELPER_ConditionsAgreed.getAttribObject (getClass (), _ConditionsAgreed, false, FIELD_ConditionsAgreed));
result.add(HELPER_HasValidAddress.getAttribObject (getClass (), _HasValidAddress, false, FIELD_HasValidAddress));
result.add(HELPER_AnsweredDiversity.getAttribObject (getClass (), _AnsweredDiversity, false, FIELD_AnsweredDiversity));
return result;
}
......@@ -4663,24 +4515,6 @@ public abstract class BaseCandidate extends SecUserExtension
return newHasValidAddress;
}
/**
* Get the attribute AnsweredDiversity
*/
public Boolean getAnsweredDiversity (Candidate obj, Boolean original)
{
return original;
}
/**
* Change the value set for attribute AnsweredDiversity.
* May modify the field beforehand
* Occurs before validation.
*/
public Boolean setAnsweredDiversity (Candidate obj, Boolean newAnsweredDiversity) throws FieldException
{
return newAnsweredDiversity;
}
}
......@@ -4765,10 +4599,6 @@ public abstract class BaseCandidate extends SecUserExtension
{
return toHasValidAddress ();
}
if (name.equals ("AnsweredDiversity"))
{
return toAnsweredDiversity ();
}
if (name.equals ("Phone"))
{
return toPhone ();
......@@ -4829,8 +4659,6 @@ public abstract class BaseCandidate extends SecUserExtension
public PipeLine<From, Boolean> toHasValidAddress () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_HasValidAddress)); }
public PipeLine<From, Boolean> toAnsweredDiversity () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_AnsweredDiversity)); }
public PipeLine<From, String> toPhone () { return pipe(new ORMAttributePipe<Me, String>(FIELD_Phone)); }
public PipeLine<From, Date> toForgotPasswordMailSendDate () { return pipe(new ORMAttributePipe<Me, Date>(FIELD_ForgotPasswordMailSendDate)); }
......@@ -4909,11 +4737,6 @@ public abstract class BaseCandidate extends SecUserExtension
return true;
}
if(CollectionUtils.equals(attribName, "AnsweredDiversity"))
{
return true;
}
return super.isTransientAttrib(attribName);
}
......
......@@ -112,6 +112,20 @@ public class Candidate extends BaseCandidate
}
public boolean diversityCompleted(Job job)
{
Set<AnswerOption> selectedAnswers = pipelineCandidate().toDiversityAnswers().toAnswers(AnswerOption.SearchByAll().andAnswer(new IsNotNullFilter<>())).uniqueVals();
Set<DiversityQuestion> answeredQuestions = AnswerOption.pipesAnswerOption(selectedAnswers).toCandidateAnswer().toQuestion().uniqueVals();
Set<DiversityQuestion> applicableQuestions = HTDiversityQuestion.pipesHTDiversityQuestion(job.getDiversityQuestions()).toQuestion().uniqueVals();
return answeredQuestions.containsAll(applicableQuestions);
}
public CandidateDiversityAnswer getDiversityAnswerByQuestion(DiversityQuestion question)
{
return pipelineCandidate().toDiversityAnswers(CandidateDiversityAnswer.SearchByAll().andQuestion(new EqualsFilter<>(question))).val();
}
public boolean cultureCompleted(Job job)
{
if(!job.showCultureCriteriaSection())
......@@ -238,8 +252,6 @@ public class Candidate extends BaseCandidate
public Boolean hasAnswer(HTDiversityQuestion htQuestion)
{
return Boolean.FALSE;
}
}
\ No newline at end of file
......@@ -15,7 +15,6 @@
<TRANSIENT name="PrivacyPolicyAgreed" type="Boolean" defaultValue="Boolean.FALSE"/>
<TRANSIENT name="ConditionsAgreed" type="Boolean" defaultValue="Boolean.FALSE"/>
<TRANSIENT name="HasValidAddress" type="Boolean" defaultValue="Boolean.FALSE"/>
<TRANSIENT name="AnsweredDiversity" type="Boolean" defaultValue="Boolean.FALSE"/>
<TABLE name="oneit_sec_user_extension" tablePrefix="object" polymorphic="TRUE">
......
......@@ -19,15 +19,15 @@ public class CandidateDiversityAnswer extends BaseCandidateDiversityAnswer
if(htQuestion != null)
{
for(CultureCriteria cc: htQuestion.getQ)
{
if(CollectionUtils.equals(cc.getCultureElement(), getCultureElement()))
{
criteria = cc;
break;
}
}
// for(CultureCriteria cc: htQuestion.getQ)
// {
// if(CollectionUtils.equals(cc.getCultureElement(), getCultureElement()))
// {
// criteria = cc;
//
// break;
// }
// }
}
return answer;
......
......@@ -199,6 +199,53 @@ public class JobApplication extends BaseJobApplication
return safeRedirect;
}
public boolean createDiversityAnswerObjects() throws FieldException
{
boolean safeRedirect = false;
Candidate candidate = getCandidate();
//to skip diversity test
if(!isDiversityIncluded() || diversityCompleted())
{
return safeRedirect;
}
for(HTDiversityQuestion htQuestion : getJob().getDiversityQuestions())
{
DiversityQuestion question = htQuestion.getQuestion();
boolean available = false;
for(CandidateDiversityAnswer answer : getCandidate().getDiversityAnswersSet())
{
if(answer.getQuestion().equals(question))
{
available = true;
break;
}
}
if(!available)
{
CandidateDiversityAnswer answer = CandidateDiversityAnswer.createCandidateDiversityAnswer(getTransaction());
for(DiversityAnswer diversityAnswer : question.getAnswersSet())
{
AnswerOption answerOption = AnswerOption.createAnswerOption(getTransaction());
answer.addToAnswers(answerOption);
answerOption.setAnswer(diversityAnswer);
}
candidate.addToDiversityAnswers(answer);
answer.setQuestion(question);
safeRedirect = true;
}
}
return safeRedirect;
}
public Answer getAnswerForQuestion(Question question) throws FieldException
{
......@@ -254,6 +301,11 @@ public class JobApplication extends BaseJobApplication
return isIncludeCultureCriteria() ? getCandidate().cultureCompleted(getJob()) : true;
}
public boolean diversityCompleted()
{
return getCandidate().diversityCompleted(getJob());
}
public boolean assessmentCompleted() //role
{
......@@ -287,6 +339,11 @@ public class JobApplication extends BaseJobApplication
{
return getJob() != null && isTrue(getJob().getIncludeCulture());
}
public boolean isDiversityIncluded()
{
return getJob() != null && getJob().hasDiversityQuestions();
}
@Override
public Map getRoleFit()
......
......@@ -168,6 +168,21 @@
<oneit:toString value="<%= job.getRequireCV() ? "Yes" : "No" %>" mode="EscapeHTML"/>
</div>
</div>
<%
if(job.getHiringTeam().showHasDiversity())
{
%>
<div class="form-group row">
<div class="col-md-4">
<label><oneit:label GUIName="Will the Diversity module be used for this Job?" /></label>
</div>
<div class="col-md-8">
<oneit:toString value="<%= job.getDiversityIncluded() ? "Yes" : "No" %>" mode="EscapeHTML"/>
</div>
</div>
<%
}
%>
<div class="form-brack-line-sub"></div>
<div class="form-group row">
<div class="col-md-4">
......
......@@ -206,6 +206,23 @@
</span>
</div>
</div>
<%
if(job.getHiringTeam().showHasDiversity())
{
%>
<div class="row">
<div class="col-md-4 review-medium-title">
<oneit:label GUIName="Will the Diversity module be used for this Job?" />
</div>
<div class="col-md-8">
<span class="skill-label">
<oneit:toString value="<%= job.getDiversityIncluded() ? "Yes" : "No" %>" mode="EscapeHTML" />
</span>
</div>
</div>
<%
}
%>
</div>
<div class="form-brack-line-sub"></div>
<div class="form-group job-detail-subsection">
......
......@@ -9,7 +9,7 @@
<value name='object_last_updated_date' class="oneit.sql.transfer.DBTransferer$Timestamp"/>
<value name='object_created_date' class="oneit.sql.transfer.DBTransferer$Timestamp"/>
<value name='australia_only' factory='Boolean'>true</value>
<value name='multiple_answers' factory='Boolean'>true</value>
<value name='multiple_answers' factory='Boolean'>false</value>
<value name='question_text' factory='String'>Do you identify as a person of Aboriginal or Torres Strait Islander origin?</value>
<value name='question_code' factory='String'>ATSI</value>
</NODE>
......@@ -19,7 +19,7 @@
<value name='object_last_updated_date' class="oneit.sql.transfer.DBTransferer$Timestamp"/>
<value name='object_created_date' class="oneit.sql.transfer.DBTransferer$Timestamp"/>
<value name='australia_only' factory='Boolean'>false</value>
<value name='multiple_answers' factory='Boolean'>false</value>
<value name='multiple_answers' factory='Boolean'>true</value>
<value name='question_text' factory='String'>Do you identify as a person living with a disability?</value>
<value name='question_code' factory='String'>DISABLED</value>
</NODE>
......
......@@ -9,6 +9,7 @@
<column name="object_id" type="Long" nullable="false" length="11"/>
<column name="object_last_updated_date" type="Date" nullable="false" length="22"/>
<column name="object_created_date" type="Date" nullable="false" length="22"/>
<column name="is_selected" type="Boolean" nullable="true"/>
<column name="candidate_answer_id" type="Long" length="11" nullable="false"/>
<column name="answer_id" type="Long" length="11" nullable="false"/>
</NODE>
......
......@@ -10,6 +10,7 @@
<FORM name="*.saveAndExitExperienece" factory="Participant" class="performa.form.SaveAndExitExperienceFP"/>
<FORM name="*.saveAndExitCulture" factory="Participant" class="performa.form.SaveAndExitCultureFP"/>
<FORM name="*.saveAndExitWorkStyle" factory="Participant" class="performa.form.SaveAndExitWorkStypeFP"/>
<FORM name="*.saveDiversityAnswers" factory="Participant" class="performa.form.SaveDiversityAnswersFP"/>
<FORM name="*.sendVerificationMail" factory="Participant" class="performa.form.SendVerificationMailFP">
<AccountVerificationEmailer factory="Participant" class="oneit.email.ConfigurableArticleTemplateEmailer" templateShortcut="AccountVerificationMail"/>
</FORM>
......
......@@ -20,12 +20,8 @@
String successPage = WebUtils.getSamePageInRenderMode(request, "VerificationSent") + "&JobID=" + job.getID();
JobApplication jobApplication = JobApplication.searchCandidateJob(transaction, candidate, job);
boolean redirectUser = jobApplication != null && jobApplication.getApplicationStatus() == ApplicationStatus.DRAFT;
if(jobApplication == null)
{
jobApplication = JobApplication.createNewApplication(candidate, job);
}
Debug.assertion(jobApplication != null, "Invalid Job Application in applicant portal");
Boolean isSelectionComplete = jobApplication.selectionCompleted();
Boolean isCultureComplete = jobApplication.cultureCompleted();
......@@ -53,15 +49,13 @@
+ jobApplicationArticle.getLink(request, CollectionUtils.mapEntry("cms.rm", "JobMatchAssessment").toMap(), "/");
}
toRedirect = jobApplication.createDiversityAnswerObjects();
if(redirectUser)
if(toRedirect)
{
response.sendRedirect(candidate.isFalse(candidate.getIsAccountVerified()) ? successPage : nextPage +"&JobApplicationID="+ jobApplication.getID().toString());
%><%@include file="/saferedirect.jsp" %><%
}
candidate.setHasValidAddress(candidate.getGoogleAddressText() != null);
candidate.setAnsweredDiversity(true);
process.setAttribute("JobApplication", jobApplication);
%>
<oneit:form name="diversity" method="post" enctype="multipart/form-data">
......@@ -93,24 +87,57 @@
</div>
</div>
<div class="main-verify-identity">
<div class="main-box-layout main-verify-step-2">
<%
for(HTDiversityQuestion question : job.getDiversityQuestions())
{
DiversityQuestion originalQuestion = question.getQuestion();
CandidateDiversityAnswer candidateAnswer = candidate.getDiversityAnswerByQuestion(originalQuestion);
%>
<div class="form-group text-left">
<label><%= question.getQuestionText() %></label>
<%
for(AnswerOption answer : candidateAnswer.getAnswersSet())
{
if(originalQuestion.getMultipleAnswers())
{
%>
<div class="styled_checkboxes">
<div class="checkbox checkbox-primary">
<oneit:ormInput obj="<%= answer %>" id="<%= answer.getObjectID() %>" attributeName="IsSelected" type="checkbox"/>
<oneit:recalcClass htmlTag="span" classScript="answer.getIsSelected() ? 'checked': 'unchecked'" answer="<%= answer %>">
<label for="<%= answer.getObjectID() %>">
<%= answer.getAnswer().getAnswer() %>
</label>
</oneit:recalcClass>
</div>
</div>
<%
}
else
{
%>
<div class="radio radio-primary second-radio-primary full-width">
<input type="radio" name="<%= candidateAnswer.getObjectID() %>" value="<%= answer.getIsSelected() %>" id="<%= answer.getObjectID() %>"/>
<label for="<%= answer.getObjectID() %>">
<%= answer.getAnswer().getAnswer() %>
</label>
</div>
<%
}
}
%>
</div>
<hr class="seperate-line">
<%
}
%>
<div class="text-center">
<oneit:button value="Submit" name="sendVerificationMail" cssClass="box-btn send-link-btn"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", successPage)
.mapEntry("Job",job)
.mapEntry("Candidate",candidate)
.mapEntry("JobApplication",jobApplication)
.mapEntry(NotificationUtils.NOTIFICATION_MSG_PARAM, "emailSent")
.toMap() %>"/>
<div class="text-center">
<oneit:button value="Submit" name="saveDiversityAnswers" cssClass="box-btn send-link-btn"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", successPage)
.mapEntry("JobApplication",jobApplication)
.toMap() %>"/>
</div>
</div>
</div>
</oneit:form>
......
......@@ -7,3 +7,4 @@
#alreadyApplied = You have already applied for this job.
#uploadCover = Please upload your Cover Letter.
#uploadCV = Please upload your CV.
#atleastOneAnswer = Please select an answer to each question.
......@@ -6,7 +6,6 @@
<oneit:dynIncluded>
<%
ObjectTransaction objTran = process.getTransaction ();
String successPage = WebUtils.getSamePageInRenderMode(request, "VerificationSent");
Article applicationArticle = WebUtils.getArticleByShortCut(objTran, WebUtils.JOB_APPLICATION);
String nextPage = applicationArticle.getLink(request, CollectionUtils.mapEntry("cms.rm", "ConfirmDetails").toMap());
Job job = (Job) process.getAttribute("Job");
......
......@@ -18,7 +18,6 @@
Debug.assertion(candidate != null, "Invalid candidate in applicant portal");
String successPage = WebUtils.getSamePageInRenderMode(request, "VerificationSent") + "&JobID=" + job.getID();
JobApplication jobApplication = JobApplication.searchCandidateJob(transaction, candidate, job);
boolean redirectUser = jobApplication != null && jobApplication.getApplicationStatus() == ApplicationStatus.DRAFT;
......@@ -27,13 +26,19 @@
jobApplication = JobApplication.createNewApplication(candidate, job);
}
Boolean isDiversityComplete = jobApplication.diversityCompleted();
Boolean isSelectionComplete = jobApplication.selectionCompleted();
Boolean isCultureComplete = jobApplication.cultureCompleted();
Boolean isAssesmentComplete = jobApplication.assessmentCompleted();
Article jobApplicationArticle = WebUtils.getArticleByShortCut(transaction, WebUtils.JOB_APPLICATION);
String nextPage = jobApplicationArticle.getLink(request) + "?JobID="+ job.getID().toString();;
String nextPage = jobApplicationArticle.getLink(request) + "?JobID="+ job.getID().toString();
String successPage = WebUtils.getSamePageInRenderMode(request, jobApplication.isDiversityIncluded() ? "DiversityQuestions" : "VerificationSent") + "&JobID=" + job.getID();
if(!jobApplication.hasStartedApplication())
if(!isDiversityComplete)
{
nextPage = WebUtils.getSamePageInRenderMode(request, "DiversityQuestions") + "&JobID=" + job.getID();
}
else if(!jobApplication.hasStartedApplication())
{
nextPage = WebUtils.getArticleLink(request, transaction, WebUtils.JOB_APPLICATION, "Page") + "&JobID="+ job.getID().toString();
}
......@@ -53,7 +58,6 @@
+ jobApplicationArticle.getLink(request, CollectionUtils.mapEntry("cms.rm", "JobMatchAssessment").toMap(), "/");
}
if(redirectUser)
{
response.sendRedirect(candidate.isFalse(candidate.getIsAccountVerified()) ? successPage : nextPage +"&JobApplicationID="+ jobApplication.getID().toString());
......@@ -319,7 +323,7 @@
.mapEntry("Job",job)
.mapEntry("Candidate",candidate)
.mapEntry("JobApplication",jobApplication)
.mapEntry(NotificationUtils.NOTIFICATION_MSG_PARAM, "emailSent")
// .mapEntry(NotificationUtils.NOTIFICATION_MSG_PARAM, "emailSent")
.toMap() %>"/>
</div>
</div>
......
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