Commit 89583bd9 by chenith Committed by Harsh Shah

Added mandatory field validation to AnswerNo.

parent d0138324
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<column name="object_id" type="Long" nullable="false" length="11"/> <column name="object_id" type="Long" nullable="false" length="11"/>
<column name="object_last_updated_date" type="Date" nullable="false" length="22"/> <column name="object_last_updated_date" type="Date" nullable="false" length="22"/>
<column name="object_created_date" type="Date" nullable="false" length="22"/> <column name="object_created_date" type="Date" nullable="false" length="22"/>
<column name="answer_number" type="Long" nullable="true"/> <column name="answer_number" type="Long" nullable="false"/>
<column name="section_number" type="Long" length="11" nullable="true"/> <column name="section_number" type="Long" length="11" nullable="true"/>
<column name="job_application_id" type="Long" length="11" nullable="false"/> <column name="job_application_id" type="Long" length="11" nullable="false"/>
<column name="quest_number" type="Long" length="11" nullable="true"/> <column name="quest_number" type="Long" length="11" nullable="true"/>
......
...@@ -8,7 +8,7 @@ CREATE TABLE tl_answer ( ...@@ -8,7 +8,7 @@ CREATE TABLE tl_answer (
object_last_updated_date datetime DEFAULT getdate() NOT NULL , object_last_updated_date datetime DEFAULT getdate() NOT NULL ,
object_created_date datetime DEFAULT getdate() NOT NULL object_created_date datetime DEFAULT getdate() NOT NULL
, ,
answer_number numeric(12) NULL, answer_number numeric(12) NOT NULL,
section_number numeric(12) NULL, section_number numeric(12) NULL,
job_application_id numeric(12) NOT NULL, job_application_id numeric(12) NOT NULL,
quest_number numeric(12) NULL quest_number numeric(12) NULL
......
...@@ -9,7 +9,7 @@ CREATE TABLE tl_answer ( ...@@ -9,7 +9,7 @@ CREATE TABLE tl_answer (
object_last_updated_date date DEFAULT SYSDATE NOT NULL , object_last_updated_date date DEFAULT SYSDATE NOT NULL ,
object_created_date date DEFAULT SYSDATE NOT NULL object_created_date date DEFAULT SYSDATE NOT NULL
, ,
answer_number number(12) NULL, answer_number number(12) NOT NULL,
section_number number(12) NULL, section_number number(12) NULL,
job_application_id number(12) NOT NULL, job_application_id number(12) NOT NULL,
quest_number number(12) NULL quest_number number(12) NULL
......
...@@ -9,7 +9,7 @@ CREATE TABLE tl_answer ( ...@@ -9,7 +9,7 @@ CREATE TABLE tl_answer (
object_last_updated_date timestamp DEFAULT NOW() NOT NULL , object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
object_created_date timestamp DEFAULT NOW() NOT NULL object_created_date timestamp DEFAULT NOW() NOT NULL
, ,
answer_number numeric(12) NULL, answer_number numeric(12) NOT NULL,
section_number numeric(12) NULL, section_number numeric(12) NULL,
job_application_id numeric(12) NOT NULL, job_application_id numeric(12) NOT NULL,
quest_number numeric(12) NULL quest_number numeric(12) NULL
......
package performa.orm; package performa.orm;
import oneit.objstore.rdbms.filters.EqualsFilter; import oneit.objstore.rdbms.filters.EqualsFilter;
import oneit.utils.MultiException;
import oneit.utils.filter.CollectionFilter; import oneit.utils.filter.CollectionFilter;
import oneit.utils.filter.Filter; import oneit.utils.filter.Filter;
import oneit.utils.parsers.FieldException; import oneit.utils.parsers.FieldException;
...@@ -17,18 +16,6 @@ public class Answer extends BaseAnswer ...@@ -17,18 +16,6 @@ public class Answer extends BaseAnswer
{ {
// Do not add any code to this, always put it in initialiseNewObject // Do not add any code to this, always put it in initialiseNewObject
} }
@Override
public void validate(MultiException e)
{
if(this.getAnswerNo()==null)
{
this.delete();
}
super.validate(e);
}
@Override @Override
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<TABLE name="tl_answer" tablePrefix="object" polymorphic="FALSE"> <TABLE name="tl_answer" tablePrefix="object" polymorphic="FALSE">
<ATTRIB name="AnswerNo" type="Integer" dbcol="answer_number"/> <ATTRIB name="AnswerNo" type="Integer" dbcol="answer_number" mandatory="true"/>
<SINGLEREFERENCE name="Section" type="Section" dbcol="section_number" /> <SINGLEREFERENCE name="Section" type="Section" dbcol="section_number" />
<SINGLEREFERENCE name="JobApplication" type="JobApplication" dbcol="job_application_id" backreferenceName="ProfileAssessmentAnswers" mandatory="true"/> <SINGLEREFERENCE name="JobApplication" type="JobApplication" dbcol="job_application_id" backreferenceName="ProfileAssessmentAnswers" mandatory="true"/>
......
...@@ -152,6 +152,7 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -152,6 +152,7 @@ public abstract class BaseAnswer extends BaseBusinessClass
Map metaInfo = new HashMap (); Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "answer_number"); metaInfo.put ("dbcol", "answer_number");
metaInfo.put ("mandatory", "true");
metaInfo.put ("name", "AnswerNo"); metaInfo.put ("name", "AnswerNo");
metaInfo.put ("type", "Integer"); metaInfo.put ("type", "Integer");
...@@ -280,6 +281,7 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -280,6 +281,7 @@ public abstract class BaseAnswer extends BaseBusinessClass
oldAndNewIdentical = HELPER_AnswerNo.compare (_AnswerNo, newAnswerNo); oldAndNewIdentical = HELPER_AnswerNo.compare (_AnswerNo, newAnswerNo);
} }
BusinessObjectParser.assertFieldCondition (newAnswerNo != null, this, FIELD_AnswerNo, "mandatory");
if (FIELD_AnswerNo_Validators.length > 0) if (FIELD_AnswerNo_Validators.length > 0)
...@@ -1381,7 +1383,7 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -1381,7 +1383,7 @@ public abstract class BaseAnswer extends BaseBusinessClass
List result = super.getAttributes (); List result = super.getAttributes ();
result.add(HELPER_AnswerNo.getAttribObject (getClass (), _AnswerNo, false, FIELD_AnswerNo)); result.add(HELPER_AnswerNo.getAttribObject (getClass (), _AnswerNo, true, FIELD_AnswerNo));
return result; return result;
} }
......
...@@ -4,4 +4,6 @@ Job.Email = Email Address ...@@ -4,4 +4,6 @@ Job.Email = Email Address
SecUser.FirstName = First Name SecUser.FirstName = First Name
SecUser.LastName = Last Name SecUser.LastName = Last Name
CultureCriteriaAnswer.SelectedQuestion = Question CultureCriteriaAnswer.SelectedQuestion = Question
Answer.AnswerNo = Answer
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