Commit 7451bc59 by Nilu

BO changes

parent bcc64b13
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
<column name="object_id" type="Long" nullable="false" length="11"/> <column name="object_id" type="Long" nullable="false" length="11"/>
<column name="object_last_updated_date" type="Date" nullable="false" length="22"/> <column name="object_last_updated_date" type="Date" nullable="false" length="22"/>
<column name="object_created_date" type="Date" nullable="false" length="22"/> <column name="object_created_date" type="Date" nullable="false" length="22"/>
<column name="quest_number" type="Long" nullable="true"/>
<column name="answer_number" type="Long" nullable="true"/> <column name="answer_number" type="Long" nullable="true"/>
<column name="candidate_id" type="Long" length="11" nullable="true"/> <column name="candidate_id" type="Long" length="11" nullable="true"/>
<column name="quest_number" type="Long" length="11" nullable="true"/> <column name="quest_number" type="Long" length="11" nullable="true"/>
......
...@@ -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="reverse_score_flag" type="String" nullable="true" length="15"/> <column name="reverse_score_flag" type="Boolean" nullable="true"/>
<column name="factor_number" type="Long" length="11" nullable="true"/> <column name="factor_number" type="Long" length="11" nullable="true"/>
<column name="quest_number" type="Long" length="11" nullable="true"/> <column name="quest_number" type="Long" length="11" nullable="true"/>
</NODE> </NODE>
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<column name="from_score" type="Long" nullable="true"/> <column name="from_score" type="Long" nullable="true"/>
<column name="to_score" type="Long" nullable="true"/> <column name="to_score" type="Long" nullable="true"/>
<column name="narrative_code" type="String" nullable="true" length="15"/> <column name="narrative_code" type="String" nullable="true" length="15"/>
<column name="color_code" type="String" nullable="true" length="15"/> <column name="color_code" type="String" nullable="true" length="200"/>
<column name="factor_number" type="Long" length="11" nullable="true"/> <column name="factor_number" type="Long" length="11" nullable="true"/>
<column name="level_number" type="Long" length="11" nullable="true"/> <column name="level_number" type="Long" length="11" nullable="true"/>
</NODE> </NODE>
......
...@@ -8,9 +8,9 @@ ...@@ -8,9 +8,9 @@
<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="level_number" type="Long" nullable="true"/>
<column name="level_desc" type="String" nullable="true" length="30"/> <column name="level_desc" type="String" nullable="true" length="30"/>
<column name="level_notes" type="CLOB" nullable="true"/> <column name="level_notes" type="CLOB" nullable="true"/>
<column name="rpt_hdr" type="CLOB" nullable="true"/>
</NODE> </NODE>
</NODE></OBJECTS> </NODE></OBJECTS>
\ No newline at end of file
...@@ -8,10 +8,10 @@ ...@@ -8,10 +8,10 @@
<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="left_quest_number" type="Long" nullable="true"/>
<column name="left_quest" type="String" nullable="true" length="80"/> <column name="left_quest" type="String" nullable="true" length="80"/>
<column name="right_quest_number" type="Long" nullable="true"/> <column name="section_number" type="Long" length="11" nullable="true"/>
<column name="right_quest" type="String" nullable="true" length="80"/>
</NODE> </NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="quest_lin" indexName="idx_quest_lin_section_number" isUnique="false"><column name="section_number"/></NODE>
</NODE></OBJECTS> </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">quest_hdr</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="quest_hdr_desc" type="String" nullable="true" length="30"/>
<column name="quest_type_flag" type="String" nullable="true" length="200"/>
</NODE>
</NODE></OBJECTS>
\ No newline at end of file
...@@ -8,7 +8,6 @@ CREATE TABLE answer ( ...@@ -8,7 +8,6 @@ CREATE TABLE 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
, ,
quest_number numeric(12) NULL,
answer_number numeric(12) NULL, answer_number numeric(12) NULL,
candidate_id numeric(12) NULL, candidate_id numeric(12) NULL,
quest_number numeric(12) NULL quest_number numeric(12) NULL
......
...@@ -8,7 +8,7 @@ CREATE TABLE factor_lin ( ...@@ -8,7 +8,7 @@ CREATE TABLE factor_lin (
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
, ,
reverse_score_flag varchar(15) NULL, reverse_score_flag char(1) NULL,
factor_number numeric(12) NULL, factor_number numeric(12) NULL,
quest_number numeric(12) NULL quest_number numeric(12) NULL
); );
......
...@@ -11,7 +11,7 @@ CREATE TABLE level_factor ( ...@@ -11,7 +11,7 @@ CREATE TABLE level_factor (
from_score numeric(12) NULL, from_score numeric(12) NULL,
to_score numeric(12) NULL, to_score numeric(12) NULL,
narrative_code varchar(15) NULL, narrative_code varchar(15) NULL,
color_code varchar(15) NULL, color_code varchar(200) NULL,
factor_number numeric(12) NULL, factor_number numeric(12) NULL,
level_number numeric(12) NULL level_number numeric(12) NULL
); );
......
...@@ -8,9 +8,9 @@ CREATE TABLE level ( ...@@ -8,9 +8,9 @@ CREATE TABLE level (
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
, ,
level_number numeric(12) NULL,
level_desc varchar(30) NULL, level_desc varchar(30) NULL,
level_notes text NULL level_notes text NULL,
rpt_hdr text NULL
); );
......
...@@ -8,10 +8,8 @@ CREATE TABLE quest_lin ( ...@@ -8,10 +8,8 @@ CREATE TABLE quest_lin (
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
, ,
left_quest_number numeric(12) NULL,
left_quest varchar(80) NULL, left_quest varchar(80) NULL,
right_quest_number numeric(12) NULL, section_number numeric(12) NULL
right_quest varchar(80) NULL
); );
...@@ -23,4 +21,6 @@ ALTER TABLE quest_lin ADD ...@@ -23,4 +21,6 @@ ALTER TABLE quest_lin ADD
) ; ) ;
\ No newline at end of file CREATE INDEX idx_quest_lin_section_number
ON quest_lin (section_number);
-- DROP TABLE quest_hdr;
CREATE TABLE quest_hdr (
object_id int NOT NULL ,
object_last_updated_date datetime DEFAULT getdate() NOT NULL ,
object_created_date datetime DEFAULT getdate() NOT NULL
,
quest_hdr_desc varchar(30) NULL,
quest_type_flag varchar(200) NULL
);
ALTER TABLE quest_hdr ADD
CONSTRAINT PK_quest_hdr PRIMARY KEY
(
object_id
) ;
\ No newline at end of file
...@@ -9,7 +9,6 @@ CREATE TABLE answer ( ...@@ -9,7 +9,6 @@ CREATE TABLE 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
, ,
quest_number number(12) NULL,
answer_number number(12) NULL, answer_number number(12) NULL,
candidate_id number(12) NULL, candidate_id number(12) NULL,
quest_number number(12) NULL quest_number number(12) NULL
......
...@@ -9,7 +9,7 @@ CREATE TABLE factor_lin ( ...@@ -9,7 +9,7 @@ CREATE TABLE factor_lin (
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
, ,
reverse_score_flag varchar2(15) NULL, reverse_score_flag char(1) NULL,
factor_number number(12) NULL, factor_number number(12) NULL,
quest_number number(12) NULL quest_number number(12) NULL
); );
......
...@@ -12,7 +12,7 @@ CREATE TABLE level_factor ( ...@@ -12,7 +12,7 @@ CREATE TABLE level_factor (
from_score number(12) NULL, from_score number(12) NULL,
to_score number(12) NULL, to_score number(12) NULL,
narrative_code varchar2(15) NULL, narrative_code varchar2(15) NULL,
color_code varchar2(15) NULL, color_code varchar2(200) NULL,
factor_number number(12) NULL, factor_number number(12) NULL,
level_number number(12) NULL level_number number(12) NULL
); );
......
...@@ -9,9 +9,9 @@ CREATE TABLE level ( ...@@ -9,9 +9,9 @@ CREATE TABLE level (
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
, ,
level_number number(12) NULL,
level_desc varchar2(30) NULL, level_desc varchar2(30) NULL,
level_notes clob NULL level_notes clob NULL,
rpt_hdr clob NULL
); );
......
...@@ -9,10 +9,8 @@ CREATE TABLE quest_lin ( ...@@ -9,10 +9,8 @@ CREATE TABLE quest_lin (
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
, ,
left_quest_number number(12) NULL,
left_quest varchar2(80) NULL, left_quest varchar2(80) NULL,
right_quest_number number(12) NULL, section_number number(12) NULL
right_quest varchar2(80) NULL
); );
...@@ -24,4 +22,6 @@ ALTER TABLE quest_lin ADD ...@@ -24,4 +22,6 @@ ALTER TABLE quest_lin ADD
) ; ) ;
\ No newline at end of file CREATE INDEX idx_quest_lin_section_number
ON quest_lin (section_number);
-- DROP TABLE quest_hdr;
CREATE TABLE quest_hdr (
object_id number(12) NOT NULL ,
object_last_updated_date date DEFAULT SYSDATE NOT NULL ,
object_created_date date DEFAULT SYSDATE NOT NULL
,
quest_hdr_desc varchar2(30) NULL,
quest_type_flag varchar2(200) NULL
);
ALTER TABLE quest_hdr ADD
CONSTRAINT PK_quest_hdr PRIMARY KEY
(
object_id
) ;
\ No newline at end of file
...@@ -9,7 +9,6 @@ CREATE TABLE answer ( ...@@ -9,7 +9,6 @@ CREATE TABLE 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
, ,
quest_number numeric(12) NULL,
answer_number numeric(12) NULL, answer_number numeric(12) NULL,
candidate_id numeric(12) NULL, candidate_id numeric(12) NULL,
quest_number numeric(12) NULL quest_number numeric(12) NULL
......
...@@ -9,7 +9,7 @@ CREATE TABLE factor_lin ( ...@@ -9,7 +9,7 @@ CREATE TABLE factor_lin (
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
, ,
reverse_score_flag varchar(15) NULL, reverse_score_flag char(1) NULL,
factor_number numeric(12) NULL, factor_number numeric(12) NULL,
quest_number numeric(12) NULL quest_number numeric(12) NULL
); );
......
...@@ -12,7 +12,7 @@ CREATE TABLE level_factor ( ...@@ -12,7 +12,7 @@ CREATE TABLE level_factor (
from_score numeric(12) NULL, from_score numeric(12) NULL,
to_score numeric(12) NULL, to_score numeric(12) NULL,
narrative_code varchar(15) NULL, narrative_code varchar(15) NULL,
color_code varchar(15) NULL, color_code varchar(200) NULL,
factor_number numeric(12) NULL, factor_number numeric(12) NULL,
level_number numeric(12) NULL level_number numeric(12) NULL
); );
......
...@@ -9,9 +9,9 @@ CREATE TABLE level ( ...@@ -9,9 +9,9 @@ CREATE TABLE level (
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
, ,
level_number numeric(12) NULL,
level_desc varchar(30) NULL, level_desc varchar(30) NULL,
level_notes text NULL level_notes text NULL,
rpt_hdr text NULL
); );
......
...@@ -9,10 +9,8 @@ CREATE TABLE quest_lin ( ...@@ -9,10 +9,8 @@ CREATE TABLE quest_lin (
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
, ,
left_quest_number numeric(12) NULL,
left_quest varchar(80) NULL, left_quest varchar(80) NULL,
right_quest_number numeric(12) NULL, section_number numeric(12) NULL
right_quest varchar(80) NULL
); );
...@@ -24,4 +22,6 @@ ALTER TABLE quest_lin ADD ...@@ -24,4 +22,6 @@ ALTER TABLE quest_lin ADD
) ; ) ;
\ No newline at end of file CREATE INDEX idx_quest_lin_section_number
ON quest_lin (section_number);
-- @AutoRun
-- drop table quest_hdr;
CREATE TABLE quest_hdr (
object_id numeric(12) NOT NULL ,
object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
object_created_date timestamp DEFAULT NOW() NOT NULL
,
quest_hdr_desc varchar(30) NULL,
quest_type_flag varchar(200) NULL
);
ALTER TABLE quest_hdr ADD
CONSTRAINT pk_quest_hdr PRIMARY KEY
(
object_id
) ;
\ No newline at end of file
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
<TABLE name="answer" tablePrefix="object" polymorphic="FALSE"> <TABLE name="answer" tablePrefix="object" polymorphic="FALSE">
<ATTRIB name="QuestionNo" type="Integer" dbcol="quest_number"/>
<ATTRIB name="AnswerNo" type="Integer" dbcol="answer_number"/> <ATTRIB name="AnswerNo" type="Integer" dbcol="answer_number"/>
<!--<SINGLEREFERENCE name="Section" type="Section" dbcol="section_number" />--> <!--<SINGLEREFERENCE name="Section" type="Section" dbcol="section_number" />-->
......
...@@ -26,12 +26,10 @@ public class AnswerPersistenceMgr extends ObjectPersistenceMgr ...@@ -26,12 +26,10 @@ public class AnswerPersistenceMgr extends ObjectPersistenceMgr
private static final LoggingArea AnswerPersistence = LoggingArea.createLoggingArea(ObjectPersistenceMgr.OBJECT_PERSISTENCE, "Answer"); private static final LoggingArea AnswerPersistence = LoggingArea.createLoggingArea(ObjectPersistenceMgr.OBJECT_PERSISTENCE, "Answer");
// Private attributes corresponding to business object data // Private attributes corresponding to business object data
private Integer dummyQuestionNo;
private Integer dummyAnswerNo; private Integer dummyAnswerNo;
// Static constants corresponding to attribute helpers // Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper HELPER_QuestionNo = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_AnswerNo = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper HELPER_AnswerNo = DefaultAttributeHelper.INSTANCE;
...@@ -39,12 +37,11 @@ public class AnswerPersistenceMgr extends ObjectPersistenceMgr ...@@ -39,12 +37,11 @@ public class AnswerPersistenceMgr extends ObjectPersistenceMgr
public AnswerPersistenceMgr () public AnswerPersistenceMgr ()
{ {
dummyQuestionNo = (Integer)(HELPER_QuestionNo.initialise (dummyQuestionNo));
dummyAnswerNo = (Integer)(HELPER_AnswerNo.initialise (dummyAnswerNo)); dummyAnswerNo = (Integer)(HELPER_AnswerNo.initialise (dummyAnswerNo));
} }
private String SELECT_COLUMNS = "{PREFIX}answer.object_id as id, {PREFIX}answer.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}answer.object_CREATED_DATE as CREATED_DATE, {PREFIX}answer.quest_number, {PREFIX}answer.answer_number, {PREFIX}answer.candidate_id, {PREFIX}answer.quest_number, 1 AS commasafe "; private String SELECT_COLUMNS = "{PREFIX}answer.object_id as id, {PREFIX}answer.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}answer.object_CREATED_DATE as CREATED_DATE, {PREFIX}answer.answer_number, {PREFIX}answer.candidate_id, {PREFIX}answer.quest_number, 1 AS commasafe ";
private String SELECT_JOINS = ""; private String SELECT_JOINS = "";
public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
...@@ -95,7 +92,6 @@ public class AnswerPersistenceMgr extends ObjectPersistenceMgr ...@@ -95,7 +92,6 @@ public class AnswerPersistenceMgr extends ObjectPersistenceMgr
// Check for persistent sets already prefetched // Check for persistent sets already prefetched
if (false || !answerPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) || if (false || !answerPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!answerPSet.containsAttrib(Answer.FIELD_QuestionNo)||
!answerPSet.containsAttrib(Answer.FIELD_AnswerNo)|| !answerPSet.containsAttrib(Answer.FIELD_AnswerNo)||
!answerPSet.containsAttrib(Answer.SINGLEREFERENCE_Candidate)|| !answerPSet.containsAttrib(Answer.SINGLEREFERENCE_Candidate)||
!answerPSet.containsAttrib(Answer.SINGLEREFERENCE_Question)) !answerPSet.containsAttrib(Answer.SINGLEREFERENCE_Question))
...@@ -168,10 +164,10 @@ public class AnswerPersistenceMgr extends ObjectPersistenceMgr ...@@ -168,10 +164,10 @@ public class AnswerPersistenceMgr extends ObjectPersistenceMgr
{ {
int rowsUpdated = executeStatement (sqlMgr, int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}answer " + "UPDATE {PREFIX}answer " +
"SET quest_number = ?, answer_number = ?, candidate_id = ? , quest_number = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " + "SET answer_number = ?, candidate_id = ? , quest_number = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE answer.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ", "WHERE answer.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_QuestionNo.getForSQL(dummyQuestionNo, answerPSet.getAttrib (Answer.FIELD_QuestionNo))).listEntry (HELPER_AnswerNo.getForSQL(dummyAnswerNo, answerPSet.getAttrib (Answer.FIELD_AnswerNo))).listEntry (SQLManager.CheckNull((Long)(answerPSet.getAttrib (Answer.SINGLEREFERENCE_Candidate)))).listEntry (SQLManager.CheckNull((Long)(answerPSet.getAttrib (Answer.SINGLEREFERENCE_Question)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray()); CollectionUtils.listEntry (HELPER_AnswerNo.getForSQL(dummyAnswerNo, answerPSet.getAttrib (Answer.FIELD_AnswerNo))).listEntry (SQLManager.CheckNull((Long)(answerPSet.getAttrib (Answer.SINGLEREFERENCE_Candidate)))).listEntry (SQLManager.CheckNull((Long)(answerPSet.getAttrib (Answer.SINGLEREFERENCE_Question)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
if (rowsUpdated != 1) if (rowsUpdated != 1)
{ {
...@@ -385,7 +381,6 @@ public class AnswerPersistenceMgr extends ObjectPersistenceMgr ...@@ -385,7 +381,6 @@ public class AnswerPersistenceMgr extends ObjectPersistenceMgr
// Object Created // Object Created
answerPSet.setAttrib(BaseBusinessClass.FIELD_ObjectCreated, r.getTimestamp ("CREATED_DATE")); answerPSet.setAttrib(BaseBusinessClass.FIELD_ObjectCreated, r.getTimestamp ("CREATED_DATE"));
answerPSet.setAttrib(Answer.FIELD_QuestionNo, HELPER_QuestionNo.getFromRS(dummyQuestionNo, r, "quest_number"));
answerPSet.setAttrib(Answer.FIELD_AnswerNo, HELPER_AnswerNo.getFromRS(dummyAnswerNo, r, "answer_number")); answerPSet.setAttrib(Answer.FIELD_AnswerNo, HELPER_AnswerNo.getFromRS(dummyAnswerNo, r, "answer_number"));
answerPSet.setAttrib(Answer.SINGLEREFERENCE_Candidate, r.getObject ("candidate_id")); answerPSet.setAttrib(Answer.SINGLEREFERENCE_Candidate, r.getObject ("candidate_id"));
...@@ -406,10 +401,10 @@ public class AnswerPersistenceMgr extends ObjectPersistenceMgr ...@@ -406,10 +401,10 @@ public class AnswerPersistenceMgr extends ObjectPersistenceMgr
{ {
executeStatement (sqlMgr, executeStatement (sqlMgr,
"INSERT INTO {PREFIX}answer " + "INSERT INTO {PREFIX}answer " +
" (quest_number, answer_number, candidate_id, quest_number, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " + " (answer_number, candidate_id, quest_number, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " + "VALUES " +
" (?, ?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")", " (?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_QuestionNo.getForSQL(dummyQuestionNo, answerPSet.getAttrib (Answer.FIELD_QuestionNo))).listEntry (HELPER_AnswerNo.getForSQL(dummyAnswerNo, answerPSet.getAttrib (Answer.FIELD_AnswerNo))) .listEntry (SQLManager.CheckNull((Long)(answerPSet.getAttrib (Answer.SINGLEREFERENCE_Candidate)))).listEntry (SQLManager.CheckNull((Long)(answerPSet.getAttrib (Answer.SINGLEREFERENCE_Question)))) .listEntry (objectID.longID ()).toList().toArray()); CollectionUtils.listEntry (HELPER_AnswerNo.getForSQL(dummyAnswerNo, answerPSet.getAttrib (Answer.FIELD_AnswerNo))) .listEntry (SQLManager.CheckNull((Long)(answerPSet.getAttrib (Answer.SINGLEREFERENCE_Candidate)))).listEntry (SQLManager.CheckNull((Long)(answerPSet.getAttrib (Answer.SINGLEREFERENCE_Question)))) .listEntry (objectID.longID ()).toList().toArray());
answerPSet.setStatus (PersistentSetStatus.PROCESSED); answerPSet.setStatus (PersistentSetStatus.PROCESSED);
} }
......
...@@ -38,7 +38,6 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -38,7 +38,6 @@ public abstract class BaseAnswer extends BaseBusinessClass
// Static constants corresponding to field names // Static constants corresponding to field names
public static final String FIELD_QuestionNo = "QuestionNo";
public static final String FIELD_AnswerNo = "AnswerNo"; public static final String FIELD_AnswerNo = "AnswerNo";
public static final String SINGLEREFERENCE_Candidate = "Candidate"; public static final String SINGLEREFERENCE_Candidate = "Candidate";
public static final String SINGLEREFERENCE_Question = "Question"; public static final String SINGLEREFERENCE_Question = "Question";
...@@ -47,12 +46,10 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -47,12 +46,10 @@ public abstract class BaseAnswer extends BaseBusinessClass
// Static constants corresponding to attribute helpers // Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper<Answer> HELPER_QuestionNo = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Answer> HELPER_AnswerNo = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper<Answer> HELPER_AnswerNo = DefaultAttributeHelper.INSTANCE;
// Private attributes corresponding to business object data // Private attributes corresponding to business object data
private Integer _QuestionNo;
private Integer _AnswerNo; private Integer _AnswerNo;
...@@ -68,7 +65,6 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -68,7 +65,6 @@ public abstract class BaseAnswer extends BaseBusinessClass
private static final Map ATTRIBUTES_METADATA_Answer = new HashMap (); private static final Map ATTRIBUTES_METADATA_Answer = new HashMap ();
// Arrays of validators for each attribute // Arrays of validators for each attribute
private static final AttributeValidator[] FIELD_QuestionNo_Validators;
private static final AttributeValidator[] FIELD_AnswerNo_Validators; private static final AttributeValidator[] FIELD_AnswerNo_Validators;
...@@ -85,7 +81,6 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -85,7 +81,6 @@ public abstract class BaseAnswer extends BaseBusinessClass
setupAssocMetaData_Candidate(); setupAssocMetaData_Candidate();
setupAssocMetaData_Question(); setupAssocMetaData_Question();
FIELD_QuestionNo_Validators = (AttributeValidator[])setupAttribMetaData_QuestionNo(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_AnswerNo_Validators = (AttributeValidator[])setupAttribMetaData_AnswerNo(validatorMapping).toArray (new AttributeValidator[0]); FIELD_AnswerNo_Validators = (AttributeValidator[])setupAttribMetaData_AnswerNo(validatorMapping).toArray (new AttributeValidator[0]);
...@@ -130,24 +125,6 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -130,24 +125,6 @@ public abstract class BaseAnswer extends BaseBusinessClass
// Meta Info setup // Meta Info setup
private static List setupAttribMetaData_QuestionNo(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "quest_number");
metaInfo.put ("name", "QuestionNo");
metaInfo.put ("type", "Integer");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Answer.QuestionNo:", metaInfo);
ATTRIBUTES_METADATA_Answer.put (FIELD_QuestionNo, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(Answer.class, "QuestionNo", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for Answer.QuestionNo:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_AnswerNo(Map validatorMapping) private static List setupAttribMetaData_AnswerNo(Map validatorMapping)
{ {
Map metaInfo = new HashMap (); Map metaInfo = new HashMap ();
...@@ -192,7 +169,6 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -192,7 +169,6 @@ public abstract class BaseAnswer extends BaseBusinessClass
super._initialiseNewObjAttributes (transaction); super._initialiseNewObjAttributes (transaction);
_QuestionNo = (Integer)(HELPER_QuestionNo.initialise (_QuestionNo));
_AnswerNo = (Integer)(HELPER_AnswerNo.initialise (_AnswerNo)); _AnswerNo = (Integer)(HELPER_AnswerNo.initialise (_AnswerNo));
} }
...@@ -223,104 +199,6 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -223,104 +199,6 @@ public abstract class BaseAnswer extends BaseBusinessClass
/** /**
* Get the attribute QuestionNo
*/
public Integer getQuestionNo ()
{
assertValid();
Integer valToReturn = _QuestionNo;
for (AnswerBehaviourDecorator bhd : Answer_BehaviourDecorators)
{
valToReturn = bhd.getQuestionNo ((Answer)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 preQuestionNoChange (Integer newQuestionNo) 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 postQuestionNoChange () throws FieldException
{
}
public FieldWriteability getWriteability_QuestionNo ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute QuestionNo. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setQuestionNo (Integer newQuestionNo) throws FieldException
{
boolean oldAndNewIdentical = HELPER_QuestionNo.compare (_QuestionNo, newQuestionNo);
try
{
for (AnswerBehaviourDecorator bhd : Answer_BehaviourDecorators)
{
newQuestionNo = bhd.setQuestionNo ((Answer)this, newQuestionNo);
oldAndNewIdentical = HELPER_QuestionNo.compare (_QuestionNo, newQuestionNo);
}
if (FIELD_QuestionNo_Validators.length > 0)
{
Object newQuestionNoObj = HELPER_QuestionNo.toObject (newQuestionNo);
if (newQuestionNoObj != null)
{
int loopMax = FIELD_QuestionNo_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_Answer.get (FIELD_QuestionNo);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_QuestionNo_Validators[v].checkAttribute (this, FIELD_QuestionNo, metadata, newQuestionNoObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_QuestionNo () != FieldWriteability.FALSE, "Field QuestionNo is not writeable");
preQuestionNoChange (newQuestionNo);
markFieldChange (FIELD_QuestionNo);
_QuestionNo = newQuestionNo;
postFieldChange (FIELD_QuestionNo);
postQuestionNoChange ();
}
}
/**
* Get the attribute AnswerNo * Get the attribute AnswerNo
*/ */
public Integer getAnswerNo () public Integer getAnswerNo ()
...@@ -904,7 +782,6 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -904,7 +782,6 @@ public abstract class BaseAnswer extends BaseBusinessClass
PersistentSet answerPSet = allSets.getPersistentSet (myID, "answer", myPSetStatus); PersistentSet answerPSet = allSets.getPersistentSet (myID, "answer", myPSetStatus);
answerPSet.setAttrib (FIELD_ObjectID, myID); answerPSet.setAttrib (FIELD_ObjectID, myID);
answerPSet.setAttrib (FIELD_QuestionNo, HELPER_QuestionNo.toObject (_QuestionNo)); //
answerPSet.setAttrib (FIELD_AnswerNo, HELPER_AnswerNo.toObject (_AnswerNo)); // answerPSet.setAttrib (FIELD_AnswerNo, HELPER_AnswerNo.toObject (_AnswerNo)); //
_Candidate.getPersistentSets (allSets); _Candidate.getPersistentSets (allSets);
_Question.getPersistentSets (allSets); _Question.getPersistentSets (allSets);
...@@ -922,7 +799,6 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -922,7 +799,6 @@ public abstract class BaseAnswer extends BaseBusinessClass
PersistentSet answerPSet = allSets.getPersistentSet (objectID, "answer"); PersistentSet answerPSet = allSets.getPersistentSet (objectID, "answer");
_QuestionNo = (Integer)(HELPER_QuestionNo.fromObject (_QuestionNo, answerPSet.getAttrib (FIELD_QuestionNo))); //
_AnswerNo = (Integer)(HELPER_AnswerNo.fromObject (_AnswerNo, answerPSet.getAttrib (FIELD_AnswerNo))); // _AnswerNo = (Integer)(HELPER_AnswerNo.fromObject (_AnswerNo, answerPSet.getAttrib (FIELD_AnswerNo))); //
_Candidate.setFromPersistentSets (objectID, allSets); _Candidate.setFromPersistentSets (objectID, allSets);
_Question.setFromPersistentSets (objectID, allSets); _Question.setFromPersistentSets (objectID, allSets);
...@@ -943,15 +819,6 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -943,15 +819,6 @@ public abstract class BaseAnswer extends BaseBusinessClass
try try
{ {
setQuestionNo (otherAnswer.getQuestionNo ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setAnswerNo (otherAnswer.getAnswerNo ()); setAnswerNo (otherAnswer.getAnswerNo ());
} }
catch (FieldException ex) catch (FieldException ex)
...@@ -974,7 +841,6 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -974,7 +841,6 @@ public abstract class BaseAnswer extends BaseBusinessClass
{ {
BaseAnswer sourceAnswer = (BaseAnswer)(source); BaseAnswer sourceAnswer = (BaseAnswer)(source);
_QuestionNo = sourceAnswer._QuestionNo;
_AnswerNo = sourceAnswer._AnswerNo; _AnswerNo = sourceAnswer._AnswerNo;
} }
...@@ -1030,7 +896,6 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -1030,7 +896,6 @@ public abstract class BaseAnswer extends BaseBusinessClass
{ {
super.readExternalData(vals); super.readExternalData(vals);
_QuestionNo = (Integer)(HELPER_QuestionNo.readExternal (_QuestionNo, vals.get(FIELD_QuestionNo))); //
_AnswerNo = (Integer)(HELPER_AnswerNo.readExternal (_AnswerNo, vals.get(FIELD_AnswerNo))); // _AnswerNo = (Integer)(HELPER_AnswerNo.readExternal (_AnswerNo, vals.get(FIELD_AnswerNo))); //
_Candidate.readExternalData(vals.get(SINGLEREFERENCE_Candidate)); _Candidate.readExternalData(vals.get(SINGLEREFERENCE_Candidate));
_Question.readExternalData(vals.get(SINGLEREFERENCE_Question)); _Question.readExternalData(vals.get(SINGLEREFERENCE_Question));
...@@ -1045,7 +910,6 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -1045,7 +910,6 @@ public abstract class BaseAnswer extends BaseBusinessClass
{ {
super.writeExternalData(vals); super.writeExternalData(vals);
vals.put (FIELD_QuestionNo, HELPER_QuestionNo.writeExternal (_QuestionNo));
vals.put (FIELD_AnswerNo, HELPER_AnswerNo.writeExternal (_AnswerNo)); vals.put (FIELD_AnswerNo, HELPER_AnswerNo.writeExternal (_AnswerNo));
vals.put (SINGLEREFERENCE_Candidate, _Candidate.writeExternalData()); vals.put (SINGLEREFERENCE_Candidate, _Candidate.writeExternalData());
vals.put (SINGLEREFERENCE_Question, _Question.writeExternalData()); vals.put (SINGLEREFERENCE_Question, _Question.writeExternalData());
...@@ -1062,10 +926,6 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -1062,10 +926,6 @@ public abstract class BaseAnswer extends BaseBusinessClass
BaseAnswer otherAnswer = (BaseAnswer)(other); BaseAnswer otherAnswer = (BaseAnswer)(other);
if (!HELPER_QuestionNo.compare(this._QuestionNo, otherAnswer._QuestionNo))
{
listener.notifyFieldChange(this, other, FIELD_QuestionNo, HELPER_QuestionNo.toObject(this._QuestionNo), HELPER_QuestionNo.toObject(otherAnswer._QuestionNo));
}
if (!HELPER_AnswerNo.compare(this._AnswerNo, otherAnswer._AnswerNo)) if (!HELPER_AnswerNo.compare(this._AnswerNo, otherAnswer._AnswerNo))
{ {
listener.notifyFieldChange(this, other, FIELD_AnswerNo, HELPER_AnswerNo.toObject(this._AnswerNo), HELPER_AnswerNo.toObject(otherAnswer._AnswerNo)); listener.notifyFieldChange(this, other, FIELD_AnswerNo, HELPER_AnswerNo.toObject(this._AnswerNo), HELPER_AnswerNo.toObject(otherAnswer._AnswerNo));
...@@ -1094,7 +954,6 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -1094,7 +954,6 @@ public abstract class BaseAnswer extends BaseBusinessClass
{ {
super.visitAttributes (visitor); super.visitAttributes (visitor);
visitor.visitField(this, FIELD_QuestionNo, HELPER_QuestionNo.toObject(getQuestionNo()));
visitor.visitField(this, FIELD_AnswerNo, HELPER_AnswerNo.toObject(getAnswerNo())); visitor.visitField(this, FIELD_AnswerNo, HELPER_AnswerNo.toObject(getAnswerNo()));
visitor.visitAssociation (_Candidate); visitor.visitAssociation (_Candidate);
visitor.visitAssociation (_Question); visitor.visitAssociation (_Question);
...@@ -1139,10 +998,6 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -1139,10 +998,6 @@ public abstract class BaseAnswer extends BaseBusinessClass
{ {
throw new RuntimeException ("Game over man!!"); throw new RuntimeException ("Game over man!!");
} }
else if (attribName.equals (FIELD_QuestionNo))
{
return filter.matches (getQuestionNo ());
}
else if (attribName.equals (FIELD_AnswerNo)) else if (attribName.equals (FIELD_AnswerNo))
{ {
return filter.matches (getAnswerNo ()); return filter.matches (getAnswerNo ());
...@@ -1170,10 +1025,6 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -1170,10 +1025,6 @@ public abstract class BaseAnswer extends BaseBusinessClass
{ {
throw new RuntimeException ("Game over man!!"); throw new RuntimeException ("Game over man!!");
} }
else if (attribName.equals (FIELD_QuestionNo))
{
return HELPER_QuestionNo.toObject (getQuestionNo ());
}
else if (attribName.equals (FIELD_AnswerNo)) else if (attribName.equals (FIELD_AnswerNo))
{ {
return HELPER_AnswerNo.toObject (getAnswerNo ()); return HELPER_AnswerNo.toObject (getAnswerNo ());
...@@ -1191,10 +1042,6 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -1191,10 +1042,6 @@ public abstract class BaseAnswer extends BaseBusinessClass
{ {
throw new RuntimeException ("Game over man!!"); throw new RuntimeException ("Game over man!!");
} }
else if (attribName.equals (FIELD_QuestionNo))
{
return HELPER_QuestionNo;
}
else if (attribName.equals (FIELD_AnswerNo)) else if (attribName.equals (FIELD_AnswerNo))
{ {
return HELPER_AnswerNo; return HELPER_AnswerNo;
...@@ -1212,10 +1059,6 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -1212,10 +1059,6 @@ public abstract class BaseAnswer extends BaseBusinessClass
{ {
throw new RuntimeException ("Game over man!!"); throw new RuntimeException ("Game over man!!");
} }
else if (attribName.equals (FIELD_QuestionNo))
{
setQuestionNo ((Integer)(HELPER_QuestionNo.fromObject (_QuestionNo, attribValue)));
}
else if (attribName.equals (FIELD_AnswerNo)) else if (attribName.equals (FIELD_AnswerNo))
{ {
setAnswerNo ((Integer)(HELPER_AnswerNo.fromObject (_AnswerNo, attribValue))); setAnswerNo ((Integer)(HELPER_AnswerNo.fromObject (_AnswerNo, attribValue)));
...@@ -1240,10 +1083,6 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -1240,10 +1083,6 @@ public abstract class BaseAnswer extends BaseBusinessClass
{ {
throw new RuntimeException ("Game over man!!"); throw new RuntimeException ("Game over man!!");
} }
else if (fieldName.equals (FIELD_QuestionNo))
{
return getWriteability_QuestionNo ();
}
else if (fieldName.equals (FIELD_AnswerNo)) else if (fieldName.equals (FIELD_AnswerNo))
{ {
return getWriteability_AnswerNo (); return getWriteability_AnswerNo ();
...@@ -1266,11 +1105,6 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -1266,11 +1105,6 @@ public abstract class BaseAnswer extends BaseBusinessClass
public void putUnwriteable (Set<String> fields) public void putUnwriteable (Set<String> fields)
{ {
if (getWriteability_QuestionNo () != FieldWriteability.TRUE)
{
fields.add (FIELD_QuestionNo);
}
if (getWriteability_AnswerNo () != FieldWriteability.TRUE) if (getWriteability_AnswerNo () != FieldWriteability.TRUE)
{ {
fields.add (FIELD_AnswerNo); fields.add (FIELD_AnswerNo);
...@@ -1285,7 +1119,6 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -1285,7 +1119,6 @@ public abstract class BaseAnswer extends BaseBusinessClass
List result = super.getAttributes (); List result = super.getAttributes ();
result.add(HELPER_QuestionNo.getAttribObject (getClass (), _QuestionNo, false, FIELD_QuestionNo));
result.add(HELPER_AnswerNo.getAttribObject (getClass (), _AnswerNo, false, FIELD_AnswerNo)); result.add(HELPER_AnswerNo.getAttribObject (getClass (), _AnswerNo, false, FIELD_AnswerNo));
return result; return result;
...@@ -1338,24 +1171,6 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -1338,24 +1171,6 @@ public abstract class BaseAnswer extends BaseBusinessClass
{ {
/** /**
* Get the attribute QuestionNo
*/
public Integer getQuestionNo (Answer obj, Integer original)
{
return original;
}
/**
* Change the value set for attribute QuestionNo.
* May modify the field beforehand
* Occurs before validation.
*/
public Integer setQuestionNo (Answer obj, Integer newQuestionNo) throws FieldException
{
return newQuestionNo;
}
/**
* Get the attribute AnswerNo * Get the attribute AnswerNo
*/ */
public Integer getAnswerNo (Answer obj, Integer original) public Integer getAnswerNo (Answer obj, Integer original)
...@@ -1425,10 +1240,6 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -1425,10 +1240,6 @@ public abstract class BaseAnswer extends BaseBusinessClass
public PipeLine<From, ? extends Object> to(String name) public PipeLine<From, ? extends Object> to(String name)
{ {
if (name.equals ("QuestionNo"))
{
return toQuestionNo ();
}
if (name.equals ("AnswerNo")) if (name.equals ("AnswerNo"))
{ {
return toAnswerNo (); return toAnswerNo ();
...@@ -1447,8 +1258,6 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -1447,8 +1258,6 @@ public abstract class BaseAnswer extends BaseBusinessClass
} }
public PipeLine<From, Integer> toQuestionNo () { return pipe(new ORMAttributePipe<Me, Integer>(FIELD_QuestionNo)); }
public PipeLine<From, Integer> toAnswerNo () { return pipe(new ORMAttributePipe<Me, Integer>(FIELD_AnswerNo)); } public PipeLine<From, Integer> toAnswerNo () { return pipe(new ORMAttributePipe<Me, Integer>(FIELD_AnswerNo)); }
public Candidate.CandidatePipeLineFactory<From, Candidate> toCandidate () { return toCandidate (Filter.ALL); } public Candidate.CandidatePipeLineFactory<From, Candidate> toCandidate () { return toCandidate (Filter.ALL); }
......
...@@ -51,7 +51,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass ...@@ -51,7 +51,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
// Private attributes corresponding to business object data // Private attributes corresponding to business object data
private String _ReverseScore; private Boolean _ReverseScore;
// Private attributes corresponding to single references // Private attributes corresponding to single references
...@@ -131,9 +131,8 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass ...@@ -131,9 +131,8 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
Map metaInfo = new HashMap (); Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "reverse_score_flag"); metaInfo.put ("dbcol", "reverse_score_flag");
metaInfo.put ("length", "15");
metaInfo.put ("name", "ReverseScore"); metaInfo.put ("name", "ReverseScore");
metaInfo.put ("type", "String"); metaInfo.put ("type", "Boolean");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for FactorQuestionLink.ReverseScore:", metaInfo); LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for FactorQuestionLink.ReverseScore:", metaInfo);
ATTRIBUTES_METADATA_FactorQuestionLink.put (FIELD_ReverseScore, Collections.unmodifiableMap (metaInfo)); ATTRIBUTES_METADATA_FactorQuestionLink.put (FIELD_ReverseScore, Collections.unmodifiableMap (metaInfo));
...@@ -171,7 +170,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass ...@@ -171,7 +170,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
super._initialiseNewObjAttributes (transaction); super._initialiseNewObjAttributes (transaction);
_ReverseScore = (String)(HELPER_ReverseScore.initialise (_ReverseScore)); _ReverseScore = (Boolean)(HELPER_ReverseScore.initialise (_ReverseScore));
} }
...@@ -203,10 +202,10 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass ...@@ -203,10 +202,10 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
/** /**
* Get the attribute ReverseScore * Get the attribute ReverseScore
*/ */
public String getReverseScore () public Boolean getReverseScore ()
{ {
assertValid(); assertValid();
String valToReturn = _ReverseScore; Boolean valToReturn = _ReverseScore;
for (FactorQuestionLinkBehaviourDecorator bhd : FactorQuestionLink_BehaviourDecorators) for (FactorQuestionLinkBehaviourDecorator bhd : FactorQuestionLink_BehaviourDecorators)
{ {
...@@ -222,7 +221,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass ...@@ -222,7 +221,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
* Called prior to the attribute changing. Subclasses need not call super. If a field exception * 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. * is thrown, the attribute change will fail. The new value is different to the old value.
*/ */
protected void preReverseScoreChange (String newReverseScore) throws FieldException protected void preReverseScoreChange (Boolean newReverseScore) throws FieldException
{ {
} }
...@@ -246,7 +245,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass ...@@ -246,7 +245,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
* Set the attribute ReverseScore. Checks to ensure a new value * Set the attribute ReverseScore. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute. * has been supplied. If so, marks the field as altered and sets the attribute.
*/ */
public void setReverseScore (String newReverseScore) throws FieldException public void setReverseScore (Boolean newReverseScore) throws FieldException
{ {
boolean oldAndNewIdentical = HELPER_ReverseScore.compare (_ReverseScore, newReverseScore); boolean oldAndNewIdentical = HELPER_ReverseScore.compare (_ReverseScore, newReverseScore);
...@@ -801,7 +800,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass ...@@ -801,7 +800,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
PersistentSet factor_linPSet = allSets.getPersistentSet (objectID, "factor_lin"); PersistentSet factor_linPSet = allSets.getPersistentSet (objectID, "factor_lin");
_ReverseScore = (String)(HELPER_ReverseScore.fromObject (_ReverseScore, factor_linPSet.getAttrib (FIELD_ReverseScore))); // _ReverseScore = (Boolean)(HELPER_ReverseScore.fromObject (_ReverseScore, factor_linPSet.getAttrib (FIELD_ReverseScore))); //
_Factor.setFromPersistentSets (objectID, allSets); _Factor.setFromPersistentSets (objectID, allSets);
_Question.setFromPersistentSets (objectID, allSets); _Question.setFromPersistentSets (objectID, allSets);
...@@ -898,7 +897,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass ...@@ -898,7 +897,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
{ {
super.readExternalData(vals); super.readExternalData(vals);
_ReverseScore = (String)(HELPER_ReverseScore.readExternal (_ReverseScore, vals.get(FIELD_ReverseScore))); // _ReverseScore = (Boolean)(HELPER_ReverseScore.readExternal (_ReverseScore, vals.get(FIELD_ReverseScore))); //
_Factor.readExternalData(vals.get(SINGLEREFERENCE_Factor)); _Factor.readExternalData(vals.get(SINGLEREFERENCE_Factor));
_Question.readExternalData(vals.get(SINGLEREFERENCE_Question)); _Question.readExternalData(vals.get(SINGLEREFERENCE_Question));
...@@ -1043,7 +1042,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass ...@@ -1043,7 +1042,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
} }
public SearchAll andReverseScore (QueryFilter<String> filter) public SearchAll andReverseScore (QueryFilter<Boolean> filter)
{ {
filter.addFilter (context, "factor_lin.reverse_score_flag", "ReverseScore"); filter.addFilter (context, "factor_lin.reverse_score_flag", "ReverseScore");
return this; return this;
...@@ -1132,7 +1131,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass ...@@ -1132,7 +1131,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
} }
else if (attribName.equals (FIELD_ReverseScore)) else if (attribName.equals (FIELD_ReverseScore))
{ {
setReverseScore ((String)(HELPER_ReverseScore.fromObject (_ReverseScore, attribValue))); setReverseScore ((Boolean)(HELPER_ReverseScore.fromObject (_ReverseScore, attribValue)));
} }
else else
{ {
...@@ -1244,7 +1243,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass ...@@ -1244,7 +1243,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
/** /**
* Get the attribute ReverseScore * Get the attribute ReverseScore
*/ */
public String getReverseScore (FactorQuestionLink obj, String original) public Boolean getReverseScore (FactorQuestionLink obj, Boolean original)
{ {
return original; return original;
} }
...@@ -1254,7 +1253,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass ...@@ -1254,7 +1253,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
* May modify the field beforehand * May modify the field beforehand
* Occurs before validation. * Occurs before validation.
*/ */
public String setReverseScore (FactorQuestionLink obj, String newReverseScore) throws FieldException public Boolean setReverseScore (FactorQuestionLink obj, Boolean newReverseScore) throws FieldException
{ {
return newReverseScore; return newReverseScore;
} }
...@@ -1329,7 +1328,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass ...@@ -1329,7 +1328,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
} }
public PipeLine<From, String> toReverseScore () { return pipe(new ORMAttributePipe<Me, String>(FIELD_ReverseScore)); } public PipeLine<From, Boolean> toReverseScore () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_ReverseScore)); }
public Factor.FactorPipeLineFactory<From, Factor> toFactor () { return toFactor (Filter.ALL); } public Factor.FactorPipeLineFactory<From, Factor> toFactor () { return toFactor (Filter.ALL); }
public Factor.FactorPipeLineFactory<From, Factor> toFactor (Filter<Factor> filter) public Factor.FactorPipeLineFactory<From, Factor> toFactor (Filter<Factor> filter)
......
...@@ -26,6 +26,8 @@ import oneit.utils.filter.Filter; ...@@ -26,6 +26,8 @@ import oneit.utils.filter.Filter;
import oneit.utils.transform.*; import oneit.utils.transform.*;
import oneit.utils.parsers.FieldException; import oneit.utils.parsers.FieldException;
import performa.orm.types.*;
public abstract class BaseFactorScoreResult extends BaseBusinessClass public abstract class BaseFactorScoreResult extends BaseBusinessClass
...@@ -54,14 +56,14 @@ public abstract class BaseFactorScoreResult extends BaseBusinessClass ...@@ -54,14 +56,14 @@ public abstract class BaseFactorScoreResult extends BaseBusinessClass
private static final DefaultAttributeHelper<FactorScoreResult> HELPER_FromScore = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper<FactorScoreResult> HELPER_FromScore = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<FactorScoreResult> HELPER_ToScore = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper<FactorScoreResult> HELPER_ToScore = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<FactorScoreResult> HELPER_NarrativeCode = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper<FactorScoreResult> HELPER_NarrativeCode = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<FactorScoreResult> HELPER_ColorCode = DefaultAttributeHelper.INSTANCE; private static final EnumeratedAttributeHelper<FactorScoreResult, ColorCode> HELPER_ColorCode = new EnumeratedAttributeHelper<FactorScoreResult, ColorCode> (ColorCode.FACTORY_ColorCode);
// Private attributes corresponding to business object data // Private attributes corresponding to business object data
private Integer _FromScore; private Integer _FromScore;
private Integer _ToScore; private Integer _ToScore;
private String _NarrativeCode; private String _NarrativeCode;
private String _ColorCode; private ColorCode _ColorCode;
// Private attributes corresponding to single references // Private attributes corresponding to single references
...@@ -201,10 +203,10 @@ public abstract class BaseFactorScoreResult extends BaseBusinessClass ...@@ -201,10 +203,10 @@ public abstract class BaseFactorScoreResult extends BaseBusinessClass
{ {
Map metaInfo = new HashMap (); Map metaInfo = new HashMap ();
metaInfo.put ("attribHelper", "EnumeratedAttributeHelper");
metaInfo.put ("dbcol", "color_code"); metaInfo.put ("dbcol", "color_code");
metaInfo.put ("length", "15");
metaInfo.put ("name", "ColorCode"); metaInfo.put ("name", "ColorCode");
metaInfo.put ("type", "String"); metaInfo.put ("type", "ColorCode");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for FactorScoreResult.ColorCode:", metaInfo); LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for FactorScoreResult.ColorCode:", metaInfo);
ATTRIBUTES_METADATA_FactorScoreResult.put (FIELD_ColorCode, Collections.unmodifiableMap (metaInfo)); ATTRIBUTES_METADATA_FactorScoreResult.put (FIELD_ColorCode, Collections.unmodifiableMap (metaInfo));
...@@ -245,7 +247,7 @@ public abstract class BaseFactorScoreResult extends BaseBusinessClass ...@@ -245,7 +247,7 @@ public abstract class BaseFactorScoreResult extends BaseBusinessClass
_FromScore = (Integer)(HELPER_FromScore.initialise (_FromScore)); _FromScore = (Integer)(HELPER_FromScore.initialise (_FromScore));
_ToScore = (Integer)(HELPER_ToScore.initialise (_ToScore)); _ToScore = (Integer)(HELPER_ToScore.initialise (_ToScore));
_NarrativeCode = (String)(HELPER_NarrativeCode.initialise (_NarrativeCode)); _NarrativeCode = (String)(HELPER_NarrativeCode.initialise (_NarrativeCode));
_ColorCode = (String)(HELPER_ColorCode.initialise (_ColorCode)); _ColorCode = (ColorCode)(HELPER_ColorCode.initialise (_ColorCode));
} }
...@@ -571,10 +573,10 @@ public abstract class BaseFactorScoreResult extends BaseBusinessClass ...@@ -571,10 +573,10 @@ public abstract class BaseFactorScoreResult extends BaseBusinessClass
/** /**
* Get the attribute ColorCode * Get the attribute ColorCode
*/ */
public String getColorCode () public ColorCode getColorCode ()
{ {
assertValid(); assertValid();
String valToReturn = _ColorCode; ColorCode valToReturn = _ColorCode;
for (FactorScoreResultBehaviourDecorator bhd : FactorScoreResult_BehaviourDecorators) for (FactorScoreResultBehaviourDecorator bhd : FactorScoreResult_BehaviourDecorators)
{ {
...@@ -590,7 +592,7 @@ public abstract class BaseFactorScoreResult extends BaseBusinessClass ...@@ -590,7 +592,7 @@ public abstract class BaseFactorScoreResult extends BaseBusinessClass
* Called prior to the attribute changing. Subclasses need not call super. If a field exception * 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. * is thrown, the attribute change will fail. The new value is different to the old value.
*/ */
protected void preColorCodeChange (String newColorCode) throws FieldException protected void preColorCodeChange (ColorCode newColorCode) throws FieldException
{ {
} }
...@@ -614,7 +616,7 @@ public abstract class BaseFactorScoreResult extends BaseBusinessClass ...@@ -614,7 +616,7 @@ public abstract class BaseFactorScoreResult extends BaseBusinessClass
* Set the attribute ColorCode. Checks to ensure a new value * Set the attribute ColorCode. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute. * has been supplied. If so, marks the field as altered and sets the attribute.
*/ */
public void setColorCode (String newColorCode) throws FieldException public void setColorCode (ColorCode newColorCode) throws FieldException
{ {
boolean oldAndNewIdentical = HELPER_ColorCode.compare (_ColorCode, newColorCode); boolean oldAndNewIdentical = HELPER_ColorCode.compare (_ColorCode, newColorCode);
...@@ -1175,7 +1177,7 @@ public abstract class BaseFactorScoreResult extends BaseBusinessClass ...@@ -1175,7 +1177,7 @@ public abstract class BaseFactorScoreResult extends BaseBusinessClass
_FromScore = (Integer)(HELPER_FromScore.fromObject (_FromScore, level_factorPSet.getAttrib (FIELD_FromScore))); // _FromScore = (Integer)(HELPER_FromScore.fromObject (_FromScore, level_factorPSet.getAttrib (FIELD_FromScore))); //
_ToScore = (Integer)(HELPER_ToScore.fromObject (_ToScore, level_factorPSet.getAttrib (FIELD_ToScore))); // _ToScore = (Integer)(HELPER_ToScore.fromObject (_ToScore, level_factorPSet.getAttrib (FIELD_ToScore))); //
_NarrativeCode = (String)(HELPER_NarrativeCode.fromObject (_NarrativeCode, level_factorPSet.getAttrib (FIELD_NarrativeCode))); // _NarrativeCode = (String)(HELPER_NarrativeCode.fromObject (_NarrativeCode, level_factorPSet.getAttrib (FIELD_NarrativeCode))); //
_ColorCode = (String)(HELPER_ColorCode.fromObject (_ColorCode, level_factorPSet.getAttrib (FIELD_ColorCode))); // _ColorCode = (ColorCode)(HELPER_ColorCode.fromObject (_ColorCode, level_factorPSet.getAttrib (FIELD_ColorCode))); //
_Factor.setFromPersistentSets (objectID, allSets); _Factor.setFromPersistentSets (objectID, allSets);
_Level.setFromPersistentSets (objectID, allSets); _Level.setFromPersistentSets (objectID, allSets);
...@@ -1305,7 +1307,7 @@ public abstract class BaseFactorScoreResult extends BaseBusinessClass ...@@ -1305,7 +1307,7 @@ public abstract class BaseFactorScoreResult extends BaseBusinessClass
_FromScore = (Integer)(HELPER_FromScore.readExternal (_FromScore, vals.get(FIELD_FromScore))); // _FromScore = (Integer)(HELPER_FromScore.readExternal (_FromScore, vals.get(FIELD_FromScore))); //
_ToScore = (Integer)(HELPER_ToScore.readExternal (_ToScore, vals.get(FIELD_ToScore))); // _ToScore = (Integer)(HELPER_ToScore.readExternal (_ToScore, vals.get(FIELD_ToScore))); //
_NarrativeCode = (String)(HELPER_NarrativeCode.readExternal (_NarrativeCode, vals.get(FIELD_NarrativeCode))); // _NarrativeCode = (String)(HELPER_NarrativeCode.readExternal (_NarrativeCode, vals.get(FIELD_NarrativeCode))); //
_ColorCode = (String)(HELPER_ColorCode.readExternal (_ColorCode, vals.get(FIELD_ColorCode))); // _ColorCode = (ColorCode)(HELPER_ColorCode.readExternal (_ColorCode, vals.get(FIELD_ColorCode))); //
_Factor.readExternalData(vals.get(SINGLEREFERENCE_Factor)); _Factor.readExternalData(vals.get(SINGLEREFERENCE_Factor));
_Level.readExternalData(vals.get(SINGLEREFERENCE_Level)); _Level.readExternalData(vals.get(SINGLEREFERENCE_Level));
...@@ -1498,7 +1500,7 @@ public abstract class BaseFactorScoreResult extends BaseBusinessClass ...@@ -1498,7 +1500,7 @@ public abstract class BaseFactorScoreResult extends BaseBusinessClass
return this; return this;
} }
public SearchAll andColorCode (QueryFilter<String> filter) public SearchAll andColorCode (QueryFilter<ColorCode> filter)
{ {
filter.addFilter (context, "level_factor.color_code", "ColorCode"); filter.addFilter (context, "level_factor.color_code", "ColorCode");
return this; return this;
...@@ -1585,7 +1587,7 @@ public abstract class BaseFactorScoreResult extends BaseBusinessClass ...@@ -1585,7 +1587,7 @@ public abstract class BaseFactorScoreResult extends BaseBusinessClass
return this; return this;
} }
public SearchFactorScore andColorCode (QueryFilter<String> filter) public SearchFactorScore andColorCode (QueryFilter<ColorCode> filter)
{ {
filter.addFilter (context, "level_factor.color_code", "ColorCode"); filter.addFilter (context, "level_factor.color_code", "ColorCode");
return this; return this;
...@@ -1708,7 +1710,7 @@ public abstract class BaseFactorScoreResult extends BaseBusinessClass ...@@ -1708,7 +1710,7 @@ public abstract class BaseFactorScoreResult extends BaseBusinessClass
} }
else if (attribName.equals (FIELD_ColorCode)) else if (attribName.equals (FIELD_ColorCode))
{ {
setColorCode ((String)(HELPER_ColorCode.fromObject (_ColorCode, attribValue))); setColorCode ((ColorCode)(HELPER_ColorCode.fromObject (_ColorCode, attribValue)));
} }
else else
{ {
...@@ -1904,7 +1906,7 @@ public abstract class BaseFactorScoreResult extends BaseBusinessClass ...@@ -1904,7 +1906,7 @@ public abstract class BaseFactorScoreResult extends BaseBusinessClass
/** /**
* Get the attribute ColorCode * Get the attribute ColorCode
*/ */
public String getColorCode (FactorScoreResult obj, String original) public ColorCode getColorCode (FactorScoreResult obj, ColorCode original)
{ {
return original; return original;
} }
...@@ -1914,7 +1916,7 @@ public abstract class BaseFactorScoreResult extends BaseBusinessClass ...@@ -1914,7 +1916,7 @@ public abstract class BaseFactorScoreResult extends BaseBusinessClass
* May modify the field beforehand * May modify the field beforehand
* Occurs before validation. * Occurs before validation.
*/ */
public String setColorCode (FactorScoreResult obj, String newColorCode) throws FieldException public ColorCode setColorCode (FactorScoreResult obj, ColorCode newColorCode) throws FieldException
{ {
return newColorCode; return newColorCode;
} }
...@@ -2007,7 +2009,7 @@ public abstract class BaseFactorScoreResult extends BaseBusinessClass ...@@ -2007,7 +2009,7 @@ public abstract class BaseFactorScoreResult extends BaseBusinessClass
public PipeLine<From, String> toNarrativeCode () { return pipe(new ORMAttributePipe<Me, String>(FIELD_NarrativeCode)); } public PipeLine<From, String> toNarrativeCode () { return pipe(new ORMAttributePipe<Me, String>(FIELD_NarrativeCode)); }
public PipeLine<From, String> toColorCode () { return pipe(new ORMAttributePipe<Me, String>(FIELD_ColorCode)); } public PipeLine<From, ColorCode> toColorCode () { return pipe(new ORMAttributePipe<Me, ColorCode>(FIELD_ColorCode)); }
public Factor.FactorPipeLineFactory<From, Factor> toFactor () { return toFactor (Filter.ALL); } public Factor.FactorPipeLineFactory<From, Factor> toFactor () { return toFactor (Filter.ALL); }
public Factor.FactorPipeLineFactory<From, Factor> toFactor (Filter<Factor> filter) public Factor.FactorPipeLineFactory<From, Factor> toFactor (Filter<Factor> filter)
......
...@@ -38,9 +38,9 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -38,9 +38,9 @@ public abstract class BaseLevel extends BaseBusinessClass
// Static constants corresponding to field names // Static constants corresponding to field names
public static final String FIELD_LevelNo = "LevelNo";
public static final String FIELD_LevelDescription = "LevelDescription"; public static final String FIELD_LevelDescription = "LevelDescription";
public static final String FIELD_LevelNotes = "LevelNotes"; public static final String FIELD_LevelNotes = "LevelNotes";
public static final String FIELD_ReportHeader = "ReportHeader";
public static final String MULTIPLEREFERENCE_Factors = "Factors"; public static final String MULTIPLEREFERENCE_Factors = "Factors";
public static final String BACKREF_Factors = ""; public static final String BACKREF_Factors = "";
...@@ -48,15 +48,15 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -48,15 +48,15 @@ public abstract class BaseLevel extends BaseBusinessClass
// Static constants corresponding to attribute helpers // Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper<Level> HELPER_LevelNo = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Level> HELPER_LevelDescription = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper<Level> HELPER_LevelDescription = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Level> HELPER_LevelNotes = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper<Level> HELPER_LevelNotes = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Level> HELPER_ReportHeader = DefaultAttributeHelper.INSTANCE;
// Private attributes corresponding to business object data // Private attributes corresponding to business object data
private Integer _LevelNo;
private String _LevelDescription; private String _LevelDescription;
private String _LevelNotes; private String _LevelNotes;
private String _ReportHeader;
// Private attributes corresponding to single references // Private attributes corresponding to single references
...@@ -70,9 +70,9 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -70,9 +70,9 @@ public abstract class BaseLevel extends BaseBusinessClass
private static final Map ATTRIBUTES_METADATA_Level = new HashMap (); private static final Map ATTRIBUTES_METADATA_Level = new HashMap ();
// Arrays of validators for each attribute // Arrays of validators for each attribute
private static final AttributeValidator[] FIELD_LevelNo_Validators;
private static final AttributeValidator[] FIELD_LevelDescription_Validators; private static final AttributeValidator[] FIELD_LevelDescription_Validators;
private static final AttributeValidator[] FIELD_LevelNotes_Validators; private static final AttributeValidator[] FIELD_LevelNotes_Validators;
private static final AttributeValidator[] FIELD_ReportHeader_Validators;
// Arrays of behaviour decorators // Arrays of behaviour decorators
...@@ -88,9 +88,9 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -88,9 +88,9 @@ public abstract class BaseLevel extends BaseBusinessClass
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping")); Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
setupAssocMetaData_Factors(); setupAssocMetaData_Factors();
FIELD_LevelNo_Validators = (AttributeValidator[])setupAttribMetaData_LevelNo(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_LevelDescription_Validators = (AttributeValidator[])setupAttribMetaData_LevelDescription(validatorMapping).toArray (new AttributeValidator[0]); FIELD_LevelDescription_Validators = (AttributeValidator[])setupAttribMetaData_LevelDescription(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_LevelNotes_Validators = (AttributeValidator[])setupAttribMetaData_LevelNotes(validatorMapping).toArray (new AttributeValidator[0]); FIELD_LevelNotes_Validators = (AttributeValidator[])setupAttribMetaData_LevelNotes(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_ReportHeader_Validators = (AttributeValidator[])setupAttribMetaData_ReportHeader(validatorMapping).toArray (new AttributeValidator[0]);
REFERENCE_Level.initialiseReference (); REFERENCE_Level.initialiseReference ();
...@@ -120,24 +120,6 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -120,24 +120,6 @@ public abstract class BaseLevel extends BaseBusinessClass
// Meta Info setup // Meta Info setup
private static List setupAttribMetaData_LevelNo(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "level_number");
metaInfo.put ("name", "LevelNo");
metaInfo.put ("type", "Integer");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Level.LevelNo:", metaInfo);
ATTRIBUTES_METADATA_Level.put (FIELD_LevelNo, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(Level.class, "LevelNo", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for Level.LevelNo:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_LevelDescription(Map validatorMapping) private static List setupAttribMetaData_LevelDescription(Map validatorMapping)
{ {
Map metaInfo = new HashMap (); Map metaInfo = new HashMap ();
...@@ -174,6 +156,24 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -174,6 +156,24 @@ public abstract class BaseLevel extends BaseBusinessClass
return validators; return validators;
} }
// Meta Info setup
private static List setupAttribMetaData_ReportHeader(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "rpt_hdr");
metaInfo.put ("name", "ReportHeader");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Level.ReportHeader:", metaInfo);
ATTRIBUTES_METADATA_Level.put (FIELD_ReportHeader, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(Level.class, "ReportHeader", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for Level.ReportHeader:", validators);
return validators;
}
// END OF STATIC METADATA DEFINITION // END OF STATIC METADATA DEFINITION
...@@ -201,9 +201,9 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -201,9 +201,9 @@ public abstract class BaseLevel extends BaseBusinessClass
super._initialiseNewObjAttributes (transaction); super._initialiseNewObjAttributes (transaction);
_LevelNo = (Integer)(HELPER_LevelNo.initialise (_LevelNo));
_LevelDescription = (String)(HELPER_LevelDescription.initialise (_LevelDescription)); _LevelDescription = (String)(HELPER_LevelDescription.initialise (_LevelDescription));
_LevelNotes = (String)(HELPER_LevelNotes.initialise (_LevelNotes)); _LevelNotes = (String)(HELPER_LevelNotes.initialise (_LevelNotes));
_ReportHeader = (String)(HELPER_ReportHeader.initialise (_ReportHeader));
} }
...@@ -231,16 +231,16 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -231,16 +231,16 @@ public abstract class BaseLevel extends BaseBusinessClass
/** /**
* Get the attribute LevelNo * Get the attribute LevelDescription
*/ */
public Integer getLevelNo () public String getLevelDescription ()
{ {
assertValid(); assertValid();
Integer valToReturn = _LevelNo; String valToReturn = _LevelDescription;
for (LevelBehaviourDecorator bhd : Level_BehaviourDecorators) for (LevelBehaviourDecorator bhd : Level_BehaviourDecorators)
{ {
valToReturn = bhd.getLevelNo ((Level)this, valToReturn); valToReturn = bhd.getLevelDescription ((Level)this, valToReturn);
} }
return valToReturn; return valToReturn;
...@@ -252,7 +252,7 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -252,7 +252,7 @@ public abstract class BaseLevel extends BaseBusinessClass
* Called prior to the attribute changing. Subclasses need not call super. If a field exception * 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. * is thrown, the attribute change will fail. The new value is different to the old value.
*/ */
protected void preLevelNoChange (Integer newLevelNo) throws FieldException protected void preLevelDescriptionChange (String newLevelDescription) throws FieldException
{ {
} }
...@@ -262,46 +262,46 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -262,46 +262,46 @@ public abstract class BaseLevel extends BaseBusinessClass
* If a field exception is thrown, the value is still changed, however it * If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back * may lead to the TX being rolled back
*/ */
protected void postLevelNoChange () throws FieldException protected void postLevelDescriptionChange () throws FieldException
{ {
} }
public FieldWriteability getWriteability_LevelNo () public FieldWriteability getWriteability_LevelDescription ()
{ {
return getFieldWritabilityUtil (FieldWriteability.TRUE); return getFieldWritabilityUtil (FieldWriteability.TRUE);
} }
/** /**
* Set the attribute LevelNo. Checks to ensure a new value * Set the attribute LevelDescription. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute. * has been supplied. If so, marks the field as altered and sets the attribute.
*/ */
public void setLevelNo (Integer newLevelNo) throws FieldException public void setLevelDescription (String newLevelDescription) throws FieldException
{ {
boolean oldAndNewIdentical = HELPER_LevelNo.compare (_LevelNo, newLevelNo); boolean oldAndNewIdentical = HELPER_LevelDescription.compare (_LevelDescription, newLevelDescription);
try try
{ {
for (LevelBehaviourDecorator bhd : Level_BehaviourDecorators) for (LevelBehaviourDecorator bhd : Level_BehaviourDecorators)
{ {
newLevelNo = bhd.setLevelNo ((Level)this, newLevelNo); newLevelDescription = bhd.setLevelDescription ((Level)this, newLevelDescription);
oldAndNewIdentical = HELPER_LevelNo.compare (_LevelNo, newLevelNo); oldAndNewIdentical = HELPER_LevelDescription.compare (_LevelDescription, newLevelDescription);
} }
if (FIELD_LevelNo_Validators.length > 0) if (FIELD_LevelDescription_Validators.length > 0)
{ {
Object newLevelNoObj = HELPER_LevelNo.toObject (newLevelNo); Object newLevelDescriptionObj = HELPER_LevelDescription.toObject (newLevelDescription);
if (newLevelNoObj != null) if (newLevelDescriptionObj != null)
{ {
int loopMax = FIELD_LevelNo_Validators.length; int loopMax = FIELD_LevelDescription_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_Level.get (FIELD_LevelNo); Map metadata = (Map)ATTRIBUTES_METADATA_Level.get (FIELD_LevelDescription);
for (int v = 0 ; v < loopMax ; ++v) for (int v = 0 ; v < loopMax ; ++v)
{ {
FIELD_LevelNo_Validators[v].checkAttribute (this, FIELD_LevelNo, metadata, newLevelNoObj); FIELD_LevelDescription_Validators[v].checkAttribute (this, FIELD_LevelDescription, metadata, newLevelDescriptionObj);
} }
} }
} }
...@@ -319,26 +319,26 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -319,26 +319,26 @@ public abstract class BaseLevel extends BaseBusinessClass
if (!oldAndNewIdentical) if (!oldAndNewIdentical)
{ {
assertValid(); assertValid();
Debug.assertion (getWriteability_LevelNo () != FieldWriteability.FALSE, "Field LevelNo is not writeable"); Debug.assertion (getWriteability_LevelDescription () != FieldWriteability.FALSE, "Field LevelDescription is not writeable");
preLevelNoChange (newLevelNo); preLevelDescriptionChange (newLevelDescription);
markFieldChange (FIELD_LevelNo); markFieldChange (FIELD_LevelDescription);
_LevelNo = newLevelNo; _LevelDescription = newLevelDescription;
postFieldChange (FIELD_LevelNo); postFieldChange (FIELD_LevelDescription);
postLevelNoChange (); postLevelDescriptionChange ();
} }
} }
/** /**
* Get the attribute LevelDescription * Get the attribute LevelNotes
*/ */
public String getLevelDescription () public String getLevelNotes ()
{ {
assertValid(); assertValid();
String valToReturn = _LevelDescription; String valToReturn = _LevelNotes;
for (LevelBehaviourDecorator bhd : Level_BehaviourDecorators) for (LevelBehaviourDecorator bhd : Level_BehaviourDecorators)
{ {
valToReturn = bhd.getLevelDescription ((Level)this, valToReturn); valToReturn = bhd.getLevelNotes ((Level)this, valToReturn);
} }
return valToReturn; return valToReturn;
...@@ -350,7 +350,7 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -350,7 +350,7 @@ public abstract class BaseLevel extends BaseBusinessClass
* Called prior to the attribute changing. Subclasses need not call super. If a field exception * 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. * is thrown, the attribute change will fail. The new value is different to the old value.
*/ */
protected void preLevelDescriptionChange (String newLevelDescription) throws FieldException protected void preLevelNotesChange (String newLevelNotes) throws FieldException
{ {
} }
...@@ -360,46 +360,46 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -360,46 +360,46 @@ public abstract class BaseLevel extends BaseBusinessClass
* If a field exception is thrown, the value is still changed, however it * If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back * may lead to the TX being rolled back
*/ */
protected void postLevelDescriptionChange () throws FieldException protected void postLevelNotesChange () throws FieldException
{ {
} }
public FieldWriteability getWriteability_LevelDescription () public FieldWriteability getWriteability_LevelNotes ()
{ {
return getFieldWritabilityUtil (FieldWriteability.TRUE); return getFieldWritabilityUtil (FieldWriteability.TRUE);
} }
/** /**
* Set the attribute LevelDescription. Checks to ensure a new value * Set the attribute LevelNotes. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute. * has been supplied. If so, marks the field as altered and sets the attribute.
*/ */
public void setLevelDescription (String newLevelDescription) throws FieldException public void setLevelNotes (String newLevelNotes) throws FieldException
{ {
boolean oldAndNewIdentical = HELPER_LevelDescription.compare (_LevelDescription, newLevelDescription); boolean oldAndNewIdentical = HELPER_LevelNotes.compare (_LevelNotes, newLevelNotes);
try try
{ {
for (LevelBehaviourDecorator bhd : Level_BehaviourDecorators) for (LevelBehaviourDecorator bhd : Level_BehaviourDecorators)
{ {
newLevelDescription = bhd.setLevelDescription ((Level)this, newLevelDescription); newLevelNotes = bhd.setLevelNotes ((Level)this, newLevelNotes);
oldAndNewIdentical = HELPER_LevelDescription.compare (_LevelDescription, newLevelDescription); oldAndNewIdentical = HELPER_LevelNotes.compare (_LevelNotes, newLevelNotes);
} }
if (FIELD_LevelDescription_Validators.length > 0) if (FIELD_LevelNotes_Validators.length > 0)
{ {
Object newLevelDescriptionObj = HELPER_LevelDescription.toObject (newLevelDescription); Object newLevelNotesObj = HELPER_LevelNotes.toObject (newLevelNotes);
if (newLevelDescriptionObj != null) if (newLevelNotesObj != null)
{ {
int loopMax = FIELD_LevelDescription_Validators.length; int loopMax = FIELD_LevelNotes_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_Level.get (FIELD_LevelDescription); Map metadata = (Map)ATTRIBUTES_METADATA_Level.get (FIELD_LevelNotes);
for (int v = 0 ; v < loopMax ; ++v) for (int v = 0 ; v < loopMax ; ++v)
{ {
FIELD_LevelDescription_Validators[v].checkAttribute (this, FIELD_LevelDescription, metadata, newLevelDescriptionObj); FIELD_LevelNotes_Validators[v].checkAttribute (this, FIELD_LevelNotes, metadata, newLevelNotesObj);
} }
} }
} }
...@@ -417,26 +417,26 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -417,26 +417,26 @@ public abstract class BaseLevel extends BaseBusinessClass
if (!oldAndNewIdentical) if (!oldAndNewIdentical)
{ {
assertValid(); assertValid();
Debug.assertion (getWriteability_LevelDescription () != FieldWriteability.FALSE, "Field LevelDescription is not writeable"); Debug.assertion (getWriteability_LevelNotes () != FieldWriteability.FALSE, "Field LevelNotes is not writeable");
preLevelDescriptionChange (newLevelDescription); preLevelNotesChange (newLevelNotes);
markFieldChange (FIELD_LevelDescription); markFieldChange (FIELD_LevelNotes);
_LevelDescription = newLevelDescription; _LevelNotes = newLevelNotes;
postFieldChange (FIELD_LevelDescription); postFieldChange (FIELD_LevelNotes);
postLevelDescriptionChange (); postLevelNotesChange ();
} }
} }
/** /**
* Get the attribute LevelNotes * Get the attribute ReportHeader
*/ */
public String getLevelNotes () public String getReportHeader ()
{ {
assertValid(); assertValid();
String valToReturn = _LevelNotes; String valToReturn = _ReportHeader;
for (LevelBehaviourDecorator bhd : Level_BehaviourDecorators) for (LevelBehaviourDecorator bhd : Level_BehaviourDecorators)
{ {
valToReturn = bhd.getLevelNotes ((Level)this, valToReturn); valToReturn = bhd.getReportHeader ((Level)this, valToReturn);
} }
return valToReturn; return valToReturn;
...@@ -448,7 +448,7 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -448,7 +448,7 @@ public abstract class BaseLevel extends BaseBusinessClass
* Called prior to the attribute changing. Subclasses need not call super. If a field exception * 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. * is thrown, the attribute change will fail. The new value is different to the old value.
*/ */
protected void preLevelNotesChange (String newLevelNotes) throws FieldException protected void preReportHeaderChange (String newReportHeader) throws FieldException
{ {
} }
...@@ -458,46 +458,46 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -458,46 +458,46 @@ public abstract class BaseLevel extends BaseBusinessClass
* If a field exception is thrown, the value is still changed, however it * If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back * may lead to the TX being rolled back
*/ */
protected void postLevelNotesChange () throws FieldException protected void postReportHeaderChange () throws FieldException
{ {
} }
public FieldWriteability getWriteability_LevelNotes () public FieldWriteability getWriteability_ReportHeader ()
{ {
return getFieldWritabilityUtil (FieldWriteability.TRUE); return getFieldWritabilityUtil (FieldWriteability.TRUE);
} }
/** /**
* Set the attribute LevelNotes. Checks to ensure a new value * Set the attribute ReportHeader. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute. * has been supplied. If so, marks the field as altered and sets the attribute.
*/ */
public void setLevelNotes (String newLevelNotes) throws FieldException public void setReportHeader (String newReportHeader) throws FieldException
{ {
boolean oldAndNewIdentical = HELPER_LevelNotes.compare (_LevelNotes, newLevelNotes); boolean oldAndNewIdentical = HELPER_ReportHeader.compare (_ReportHeader, newReportHeader);
try try
{ {
for (LevelBehaviourDecorator bhd : Level_BehaviourDecorators) for (LevelBehaviourDecorator bhd : Level_BehaviourDecorators)
{ {
newLevelNotes = bhd.setLevelNotes ((Level)this, newLevelNotes); newReportHeader = bhd.setReportHeader ((Level)this, newReportHeader);
oldAndNewIdentical = HELPER_LevelNotes.compare (_LevelNotes, newLevelNotes); oldAndNewIdentical = HELPER_ReportHeader.compare (_ReportHeader, newReportHeader);
} }
if (FIELD_LevelNotes_Validators.length > 0) if (FIELD_ReportHeader_Validators.length > 0)
{ {
Object newLevelNotesObj = HELPER_LevelNotes.toObject (newLevelNotes); Object newReportHeaderObj = HELPER_ReportHeader.toObject (newReportHeader);
if (newLevelNotesObj != null) if (newReportHeaderObj != null)
{ {
int loopMax = FIELD_LevelNotes_Validators.length; int loopMax = FIELD_ReportHeader_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_Level.get (FIELD_LevelNotes); Map metadata = (Map)ATTRIBUTES_METADATA_Level.get (FIELD_ReportHeader);
for (int v = 0 ; v < loopMax ; ++v) for (int v = 0 ; v < loopMax ; ++v)
{ {
FIELD_LevelNotes_Validators[v].checkAttribute (this, FIELD_LevelNotes, metadata, newLevelNotesObj); FIELD_ReportHeader_Validators[v].checkAttribute (this, FIELD_ReportHeader, metadata, newReportHeaderObj);
} }
} }
} }
...@@ -515,12 +515,12 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -515,12 +515,12 @@ public abstract class BaseLevel extends BaseBusinessClass
if (!oldAndNewIdentical) if (!oldAndNewIdentical)
{ {
assertValid(); assertValid();
Debug.assertion (getWriteability_LevelNotes () != FieldWriteability.FALSE, "Field LevelNotes is not writeable"); Debug.assertion (getWriteability_ReportHeader () != FieldWriteability.FALSE, "Field ReportHeader is not writeable");
preLevelNotesChange (newLevelNotes); preReportHeaderChange (newReportHeader);
markFieldChange (FIELD_LevelNotes); markFieldChange (FIELD_ReportHeader);
_LevelNotes = newLevelNotes; _ReportHeader = newReportHeader;
postFieldChange (FIELD_LevelNotes); postFieldChange (FIELD_ReportHeader);
postLevelNotesChange (); postReportHeaderChange ();
} }
} }
...@@ -904,9 +904,9 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -904,9 +904,9 @@ public abstract class BaseLevel extends BaseBusinessClass
PersistentSet levelPSet = allSets.getPersistentSet (myID, "level", myPSetStatus); PersistentSet levelPSet = allSets.getPersistentSet (myID, "level", myPSetStatus);
levelPSet.setAttrib (FIELD_ObjectID, myID); levelPSet.setAttrib (FIELD_ObjectID, myID);
levelPSet.setAttrib (FIELD_LevelNo, HELPER_LevelNo.toObject (_LevelNo)); //
levelPSet.setAttrib (FIELD_LevelDescription, HELPER_LevelDescription.toObject (_LevelDescription)); // levelPSet.setAttrib (FIELD_LevelDescription, HELPER_LevelDescription.toObject (_LevelDescription)); //
levelPSet.setAttrib (FIELD_LevelNotes, HELPER_LevelNotes.toObject (_LevelNotes)); // levelPSet.setAttrib (FIELD_LevelNotes, HELPER_LevelNotes.toObject (_LevelNotes)); //
levelPSet.setAttrib (FIELD_ReportHeader, HELPER_ReportHeader.toObject (_ReportHeader)); //
} }
...@@ -921,9 +921,9 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -921,9 +921,9 @@ public abstract class BaseLevel extends BaseBusinessClass
PersistentSet levelPSet = allSets.getPersistentSet (objectID, "level"); PersistentSet levelPSet = allSets.getPersistentSet (objectID, "level");
_LevelNo = (Integer)(HELPER_LevelNo.fromObject (_LevelNo, levelPSet.getAttrib (FIELD_LevelNo))); //
_LevelDescription = (String)(HELPER_LevelDescription.fromObject (_LevelDescription, levelPSet.getAttrib (FIELD_LevelDescription))); // _LevelDescription = (String)(HELPER_LevelDescription.fromObject (_LevelDescription, levelPSet.getAttrib (FIELD_LevelDescription))); //
_LevelNotes = (String)(HELPER_LevelNotes.fromObject (_LevelNotes, levelPSet.getAttrib (FIELD_LevelNotes))); // _LevelNotes = (String)(HELPER_LevelNotes.fromObject (_LevelNotes, levelPSet.getAttrib (FIELD_LevelNotes))); //
_ReportHeader = (String)(HELPER_ReportHeader.fromObject (_ReportHeader, levelPSet.getAttrib (FIELD_ReportHeader))); //
} }
...@@ -941,7 +941,7 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -941,7 +941,7 @@ public abstract class BaseLevel extends BaseBusinessClass
try try
{ {
setLevelNo (otherLevel.getLevelNo ()); setLevelDescription (otherLevel.getLevelDescription ());
} }
catch (FieldException ex) catch (FieldException ex)
{ {
...@@ -950,7 +950,7 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -950,7 +950,7 @@ public abstract class BaseLevel extends BaseBusinessClass
try try
{ {
setLevelDescription (otherLevel.getLevelDescription ()); setLevelNotes (otherLevel.getLevelNotes ());
} }
catch (FieldException ex) catch (FieldException ex)
{ {
...@@ -959,7 +959,7 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -959,7 +959,7 @@ public abstract class BaseLevel extends BaseBusinessClass
try try
{ {
setLevelNotes (otherLevel.getLevelNotes ()); setReportHeader (otherLevel.getReportHeader ());
} }
catch (FieldException ex) catch (FieldException ex)
{ {
...@@ -981,9 +981,9 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -981,9 +981,9 @@ public abstract class BaseLevel extends BaseBusinessClass
{ {
BaseLevel sourceLevel = (BaseLevel)(source); BaseLevel sourceLevel = (BaseLevel)(source);
_LevelNo = sourceLevel._LevelNo;
_LevelDescription = sourceLevel._LevelDescription; _LevelDescription = sourceLevel._LevelDescription;
_LevelNotes = sourceLevel._LevelNotes; _LevelNotes = sourceLevel._LevelNotes;
_ReportHeader = sourceLevel._ReportHeader;
} }
} }
...@@ -1037,9 +1037,9 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -1037,9 +1037,9 @@ public abstract class BaseLevel extends BaseBusinessClass
{ {
super.readExternalData(vals); super.readExternalData(vals);
_LevelNo = (Integer)(HELPER_LevelNo.readExternal (_LevelNo, vals.get(FIELD_LevelNo))); //
_LevelDescription = (String)(HELPER_LevelDescription.readExternal (_LevelDescription, vals.get(FIELD_LevelDescription))); // _LevelDescription = (String)(HELPER_LevelDescription.readExternal (_LevelDescription, vals.get(FIELD_LevelDescription))); //
_LevelNotes = (String)(HELPER_LevelNotes.readExternal (_LevelNotes, vals.get(FIELD_LevelNotes))); // _LevelNotes = (String)(HELPER_LevelNotes.readExternal (_LevelNotes, vals.get(FIELD_LevelNotes))); //
_ReportHeader = (String)(HELPER_ReportHeader.readExternal (_ReportHeader, vals.get(FIELD_ReportHeader))); //
_Factors.readExternalData(vals.get(MULTIPLEREFERENCE_Factors)); _Factors.readExternalData(vals.get(MULTIPLEREFERENCE_Factors));
} }
...@@ -1052,9 +1052,9 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -1052,9 +1052,9 @@ public abstract class BaseLevel extends BaseBusinessClass
{ {
super.writeExternalData(vals); super.writeExternalData(vals);
vals.put (FIELD_LevelNo, HELPER_LevelNo.writeExternal (_LevelNo));
vals.put (FIELD_LevelDescription, HELPER_LevelDescription.writeExternal (_LevelDescription)); vals.put (FIELD_LevelDescription, HELPER_LevelDescription.writeExternal (_LevelDescription));
vals.put (FIELD_LevelNotes, HELPER_LevelNotes.writeExternal (_LevelNotes)); vals.put (FIELD_LevelNotes, HELPER_LevelNotes.writeExternal (_LevelNotes));
vals.put (FIELD_ReportHeader, HELPER_ReportHeader.writeExternal (_ReportHeader));
vals.put (MULTIPLEREFERENCE_Factors, _Factors.writeExternalData()); vals.put (MULTIPLEREFERENCE_Factors, _Factors.writeExternalData());
} }
...@@ -1069,10 +1069,6 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -1069,10 +1069,6 @@ public abstract class BaseLevel extends BaseBusinessClass
BaseLevel otherLevel = (BaseLevel)(other); BaseLevel otherLevel = (BaseLevel)(other);
if (!HELPER_LevelNo.compare(this._LevelNo, otherLevel._LevelNo))
{
listener.notifyFieldChange(this, other, FIELD_LevelNo, HELPER_LevelNo.toObject(this._LevelNo), HELPER_LevelNo.toObject(otherLevel._LevelNo));
}
if (!HELPER_LevelDescription.compare(this._LevelDescription, otherLevel._LevelDescription)) if (!HELPER_LevelDescription.compare(this._LevelDescription, otherLevel._LevelDescription))
{ {
listener.notifyFieldChange(this, other, FIELD_LevelDescription, HELPER_LevelDescription.toObject(this._LevelDescription), HELPER_LevelDescription.toObject(otherLevel._LevelDescription)); listener.notifyFieldChange(this, other, FIELD_LevelDescription, HELPER_LevelDescription.toObject(this._LevelDescription), HELPER_LevelDescription.toObject(otherLevel._LevelDescription));
...@@ -1081,6 +1077,10 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -1081,6 +1077,10 @@ public abstract class BaseLevel extends BaseBusinessClass
{ {
listener.notifyFieldChange(this, other, FIELD_LevelNotes, HELPER_LevelNotes.toObject(this._LevelNotes), HELPER_LevelNotes.toObject(otherLevel._LevelNotes)); listener.notifyFieldChange(this, other, FIELD_LevelNotes, HELPER_LevelNotes.toObject(this._LevelNotes), HELPER_LevelNotes.toObject(otherLevel._LevelNotes));
} }
if (!HELPER_ReportHeader.compare(this._ReportHeader, otherLevel._ReportHeader))
{
listener.notifyFieldChange(this, other, FIELD_ReportHeader, HELPER_ReportHeader.toObject(this._ReportHeader), HELPER_ReportHeader.toObject(otherLevel._ReportHeader));
}
// Compare single assocs // Compare single assocs
...@@ -1104,9 +1104,9 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -1104,9 +1104,9 @@ public abstract class BaseLevel extends BaseBusinessClass
{ {
super.visitAttributes (visitor); super.visitAttributes (visitor);
visitor.visitField(this, FIELD_LevelNo, HELPER_LevelNo.toObject(getLevelNo()));
visitor.visitField(this, FIELD_LevelDescription, HELPER_LevelDescription.toObject(getLevelDescription())); visitor.visitField(this, FIELD_LevelDescription, HELPER_LevelDescription.toObject(getLevelDescription()));
visitor.visitField(this, FIELD_LevelNotes, HELPER_LevelNotes.toObject(getLevelNotes())); visitor.visitField(this, FIELD_LevelNotes, HELPER_LevelNotes.toObject(getLevelNotes()));
visitor.visitField(this, FIELD_ReportHeader, HELPER_ReportHeader.toObject(getReportHeader()));
visitor.visitAssociation (_Factors); visitor.visitAssociation (_Factors);
} }
...@@ -1145,10 +1145,6 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -1145,10 +1145,6 @@ public abstract class BaseLevel extends BaseBusinessClass
{ {
throw new RuntimeException ("Game over man!!"); throw new RuntimeException ("Game over man!!");
} }
else if (attribName.equals (FIELD_LevelNo))
{
return filter.matches (getLevelNo ());
}
else if (attribName.equals (FIELD_LevelDescription)) else if (attribName.equals (FIELD_LevelDescription))
{ {
return filter.matches (getLevelDescription ()); return filter.matches (getLevelDescription ());
...@@ -1157,6 +1153,10 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -1157,6 +1153,10 @@ public abstract class BaseLevel extends BaseBusinessClass
{ {
return filter.matches (getLevelNotes ()); return filter.matches (getLevelNotes ());
} }
else if (attribName.equals (FIELD_ReportHeader))
{
return filter.matches (getReportHeader ());
}
else else
{ {
return super.testFilter (attribName, filter); return super.testFilter (attribName, filter);
...@@ -1172,10 +1172,6 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -1172,10 +1172,6 @@ public abstract class BaseLevel extends BaseBusinessClass
{ {
throw new RuntimeException ("Game over man!!"); throw new RuntimeException ("Game over man!!");
} }
else if (attribName.equals (FIELD_LevelNo))
{
return HELPER_LevelNo.toObject (getLevelNo ());
}
else if (attribName.equals (FIELD_LevelDescription)) else if (attribName.equals (FIELD_LevelDescription))
{ {
return HELPER_LevelDescription.toObject (getLevelDescription ()); return HELPER_LevelDescription.toObject (getLevelDescription ());
...@@ -1184,6 +1180,10 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -1184,6 +1180,10 @@ public abstract class BaseLevel extends BaseBusinessClass
{ {
return HELPER_LevelNotes.toObject (getLevelNotes ()); return HELPER_LevelNotes.toObject (getLevelNotes ());
} }
else if (attribName.equals (FIELD_ReportHeader))
{
return HELPER_ReportHeader.toObject (getReportHeader ());
}
else else
{ {
return super.getAttribute (attribName); return super.getAttribute (attribName);
...@@ -1197,10 +1197,6 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -1197,10 +1197,6 @@ public abstract class BaseLevel extends BaseBusinessClass
{ {
throw new RuntimeException ("Game over man!!"); throw new RuntimeException ("Game over man!!");
} }
else if (attribName.equals (FIELD_LevelNo))
{
return HELPER_LevelNo;
}
else if (attribName.equals (FIELD_LevelDescription)) else if (attribName.equals (FIELD_LevelDescription))
{ {
return HELPER_LevelDescription; return HELPER_LevelDescription;
...@@ -1209,6 +1205,10 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -1209,6 +1205,10 @@ public abstract class BaseLevel extends BaseBusinessClass
{ {
return HELPER_LevelNotes; return HELPER_LevelNotes;
} }
else if (attribName.equals (FIELD_ReportHeader))
{
return HELPER_ReportHeader;
}
else else
{ {
return super.getAttributeHelper (attribName); return super.getAttributeHelper (attribName);
...@@ -1222,10 +1222,6 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -1222,10 +1222,6 @@ public abstract class BaseLevel extends BaseBusinessClass
{ {
throw new RuntimeException ("Game over man!!"); throw new RuntimeException ("Game over man!!");
} }
else if (attribName.equals (FIELD_LevelNo))
{
setLevelNo ((Integer)(HELPER_LevelNo.fromObject (_LevelNo, attribValue)));
}
else if (attribName.equals (FIELD_LevelDescription)) else if (attribName.equals (FIELD_LevelDescription))
{ {
setLevelDescription ((String)(HELPER_LevelDescription.fromObject (_LevelDescription, attribValue))); setLevelDescription ((String)(HELPER_LevelDescription.fromObject (_LevelDescription, attribValue)));
...@@ -1234,6 +1230,10 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -1234,6 +1230,10 @@ public abstract class BaseLevel extends BaseBusinessClass
{ {
setLevelNotes ((String)(HELPER_LevelNotes.fromObject (_LevelNotes, attribValue))); setLevelNotes ((String)(HELPER_LevelNotes.fromObject (_LevelNotes, attribValue)));
} }
else if (attribName.equals (FIELD_ReportHeader))
{
setReportHeader ((String)(HELPER_ReportHeader.fromObject (_ReportHeader, attribValue)));
}
else else
{ {
super.setAttribute (attribName, attribValue); super.setAttribute (attribName, attribValue);
...@@ -1254,10 +1254,6 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -1254,10 +1254,6 @@ public abstract class BaseLevel extends BaseBusinessClass
{ {
throw new RuntimeException ("Game over man!!"); throw new RuntimeException ("Game over man!!");
} }
else if (fieldName.equals (FIELD_LevelNo))
{
return getWriteability_LevelNo ();
}
else if (fieldName.equals (FIELD_LevelDescription)) else if (fieldName.equals (FIELD_LevelDescription))
{ {
return getWriteability_LevelDescription (); return getWriteability_LevelDescription ();
...@@ -1266,6 +1262,10 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -1266,6 +1262,10 @@ public abstract class BaseLevel extends BaseBusinessClass
{ {
return getWriteability_LevelNotes (); return getWriteability_LevelNotes ();
} }
else if (fieldName.equals (FIELD_ReportHeader))
{
return getWriteability_ReportHeader ();
}
else if (fieldName.equals (MULTIPLEREFERENCE_Factors)) else if (fieldName.equals (MULTIPLEREFERENCE_Factors))
{ {
return getWriteability_Factors (); return getWriteability_Factors ();
...@@ -1280,11 +1280,6 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -1280,11 +1280,6 @@ public abstract class BaseLevel extends BaseBusinessClass
public void putUnwriteable (Set<String> fields) public void putUnwriteable (Set<String> fields)
{ {
if (getWriteability_LevelNo () != FieldWriteability.TRUE)
{
fields.add (FIELD_LevelNo);
}
if (getWriteability_LevelDescription () != FieldWriteability.TRUE) if (getWriteability_LevelDescription () != FieldWriteability.TRUE)
{ {
fields.add (FIELD_LevelDescription); fields.add (FIELD_LevelDescription);
...@@ -1295,6 +1290,11 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -1295,6 +1290,11 @@ public abstract class BaseLevel extends BaseBusinessClass
fields.add (FIELD_LevelNotes); fields.add (FIELD_LevelNotes);
} }
if (getWriteability_ReportHeader () != FieldWriteability.TRUE)
{
fields.add (FIELD_ReportHeader);
}
super.putUnwriteable (fields); super.putUnwriteable (fields);
} }
...@@ -1304,9 +1304,9 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -1304,9 +1304,9 @@ public abstract class BaseLevel extends BaseBusinessClass
List result = super.getAttributes (); List result = super.getAttributes ();
result.add(HELPER_LevelNo.getAttribObject (getClass (), _LevelNo, false, FIELD_LevelNo));
result.add(HELPER_LevelDescription.getAttribObject (getClass (), _LevelDescription, false, FIELD_LevelDescription)); result.add(HELPER_LevelDescription.getAttribObject (getClass (), _LevelDescription, false, FIELD_LevelDescription));
result.add(HELPER_LevelNotes.getAttribObject (getClass (), _LevelNotes, false, FIELD_LevelNotes)); result.add(HELPER_LevelNotes.getAttribObject (getClass (), _LevelNotes, false, FIELD_LevelNotes));
result.add(HELPER_ReportHeader.getAttribObject (getClass (), _ReportHeader, false, FIELD_ReportHeader));
return result; return result;
} }
...@@ -1358,57 +1358,57 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -1358,57 +1358,57 @@ public abstract class BaseLevel extends BaseBusinessClass
{ {
/** /**
* Get the attribute LevelNo * Get the attribute LevelDescription
*/ */
public Integer getLevelNo (Level obj, Integer original) public String getLevelDescription (Level obj, String original)
{ {
return original; return original;
} }
/** /**
* Change the value set for attribute LevelNo. * Change the value set for attribute LevelDescription.
* May modify the field beforehand * May modify the field beforehand
* Occurs before validation. * Occurs before validation.
*/ */
public Integer setLevelNo (Level obj, Integer newLevelNo) throws FieldException public String setLevelDescription (Level obj, String newLevelDescription) throws FieldException
{ {
return newLevelNo; return newLevelDescription;
} }
/** /**
* Get the attribute LevelDescription * Get the attribute LevelNotes
*/ */
public String getLevelDescription (Level obj, String original) public String getLevelNotes (Level obj, String original)
{ {
return original; return original;
} }
/** /**
* Change the value set for attribute LevelDescription. * Change the value set for attribute LevelNotes.
* May modify the field beforehand * May modify the field beforehand
* Occurs before validation. * Occurs before validation.
*/ */
public String setLevelDescription (Level obj, String newLevelDescription) throws FieldException public String setLevelNotes (Level obj, String newLevelNotes) throws FieldException
{ {
return newLevelDescription; return newLevelNotes;
} }
/** /**
* Get the attribute LevelNotes * Get the attribute ReportHeader
*/ */
public String getLevelNotes (Level obj, String original) public String getReportHeader (Level obj, String original)
{ {
return original; return original;
} }
/** /**
* Change the value set for attribute LevelNotes. * Change the value set for attribute ReportHeader.
* May modify the field beforehand * May modify the field beforehand
* Occurs before validation. * Occurs before validation.
*/ */
public String setLevelNotes (Level obj, String newLevelNotes) throws FieldException public String setReportHeader (Level obj, String newReportHeader) throws FieldException
{ {
return newLevelNotes; return newReportHeader;
} }
} }
...@@ -1467,10 +1467,6 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -1467,10 +1467,6 @@ public abstract class BaseLevel extends BaseBusinessClass
{ {
return toFactors (); return toFactors ();
} }
if (name.equals ("LevelNo"))
{
return toLevelNo ();
}
if (name.equals ("LevelDescription")) if (name.equals ("LevelDescription"))
{ {
return toLevelDescription (); return toLevelDescription ();
...@@ -1479,17 +1475,21 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -1479,17 +1475,21 @@ public abstract class BaseLevel extends BaseBusinessClass
{ {
return toLevelNotes (); return toLevelNotes ();
} }
if (name.equals ("ReportHeader"))
{
return toReportHeader ();
}
return super.to(name); return super.to(name);
} }
public PipeLine<From, Integer> toLevelNo () { return pipe(new ORMAttributePipe<Me, Integer>(FIELD_LevelNo)); }
public PipeLine<From, String> toLevelDescription () { return pipe(new ORMAttributePipe<Me, String>(FIELD_LevelDescription)); } public PipeLine<From, String> toLevelDescription () { return pipe(new ORMAttributePipe<Me, String>(FIELD_LevelDescription)); }
public PipeLine<From, String> toLevelNotes () { return pipe(new ORMAttributePipe<Me, String>(FIELD_LevelNotes)); } public PipeLine<From, String> toLevelNotes () { return pipe(new ORMAttributePipe<Me, String>(FIELD_LevelNotes)); }
public PipeLine<From, String> toReportHeader () { return pipe(new ORMAttributePipe<Me, String>(FIELD_ReportHeader)); }
public Factor.FactorPipeLineFactory<From, Factor> toFactors () { return toFactors(Filter.ALL); } public Factor.FactorPipeLineFactory<From, Factor> toFactors () { return toFactors(Filter.ALL); }
public Factor.FactorPipeLineFactory<From, Factor> toFactors (Filter<Factor> filter) public Factor.FactorPipeLineFactory<From, Factor> toFactors (Filter<Factor> filter)
......
...@@ -38,29 +38,23 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -38,29 +38,23 @@ public abstract class BaseQuestion extends BaseBusinessClass
// Static constants corresponding to field names // Static constants corresponding to field names
public static final String FIELD_LeftQuestionNo = "LeftQuestionNo"; public static final String FIELD_Description = "Description";
public static final String FIELD_LeftQuestion = "LeftQuestion"; public static final String SINGLEREFERENCE_Section = "Section";
public static final String FIELD_RightQuestionNo = "RightQuestionNo"; public static final String BACKREF_Section = "";
public static final String FIELD_RightQuestion = "RightQuestion";
// Static constants corresponding to searches // Static constants corresponding to searches
// Static constants corresponding to attribute helpers // Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper<Question> HELPER_LeftQuestionNo = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper<Question> HELPER_Description = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Question> HELPER_LeftQuestion = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Question> HELPER_RightQuestionNo = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Question> HELPER_RightQuestion = DefaultAttributeHelper.INSTANCE;
// Private attributes corresponding to business object data // Private attributes corresponding to business object data
private Integer _LeftQuestionNo; private String _Description;
private String _LeftQuestion;
private Integer _RightQuestionNo;
private String _RightQuestion;
// Private attributes corresponding to single references // Private attributes corresponding to single references
private SingleAssociation<Question, Section> _Section;
// Private attributes corresponding to multiple references // Private attributes corresponding to multiple references
...@@ -70,10 +64,7 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -70,10 +64,7 @@ public abstract class BaseQuestion extends BaseBusinessClass
private static final Map ATTRIBUTES_METADATA_Question = new HashMap (); private static final Map ATTRIBUTES_METADATA_Question = new HashMap ();
// Arrays of validators for each attribute // Arrays of validators for each attribute
private static final AttributeValidator[] FIELD_LeftQuestionNo_Validators; private static final AttributeValidator[] FIELD_Description_Validators;
private static final AttributeValidator[] FIELD_LeftQuestion_Validators;
private static final AttributeValidator[] FIELD_RightQuestionNo_Validators;
private static final AttributeValidator[] FIELD_RightQuestion_Validators;
// Arrays of behaviour decorators // Arrays of behaviour decorators
...@@ -84,13 +75,12 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -84,13 +75,12 @@ public abstract class BaseQuestion extends BaseBusinessClass
try try
{ {
String tmp_Section = Section.BACKREF_Questions;
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping")); Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
FIELD_LeftQuestionNo_Validators = (AttributeValidator[])setupAttribMetaData_LeftQuestionNo(validatorMapping).toArray (new AttributeValidator[0]); setupAssocMetaData_Section();
FIELD_LeftQuestion_Validators = (AttributeValidator[])setupAttribMetaData_LeftQuestion(validatorMapping).toArray (new AttributeValidator[0]); FIELD_Description_Validators = (AttributeValidator[])setupAttribMetaData_Description(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_RightQuestionNo_Validators = (AttributeValidator[])setupAttribMetaData_RightQuestionNo(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_RightQuestion_Validators = (AttributeValidator[])setupAttribMetaData_RightQuestion(validatorMapping).toArray (new AttributeValidator[0]);
REFERENCE_Question.initialiseReference (); REFERENCE_Question.initialiseReference ();
...@@ -106,75 +96,35 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -106,75 +96,35 @@ public abstract class BaseQuestion extends BaseBusinessClass
// Meta Info setup // Meta Info setup
private static List setupAttribMetaData_LeftQuestionNo(Map validatorMapping) private static void setupAssocMetaData_Section()
{ {
Map metaInfo = new HashMap (); Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "left_quest_number"); metaInfo.put ("backreferenceName", "Questions");
metaInfo.put ("name", "LeftQuestionNo"); metaInfo.put ("dbcol", "section_number");
metaInfo.put ("type", "Integer"); metaInfo.put ("name", "Section");
metaInfo.put ("type", "Section");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Question.LeftQuestionNo:", metaInfo); LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Question.Section:", metaInfo);
ATTRIBUTES_METADATA_Question.put (FIELD_LeftQuestionNo, Collections.unmodifiableMap (metaInfo)); ATTRIBUTES_METADATA_Question.put (SINGLEREFERENCE_Section, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(Question.class, "LeftQuestionNo", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for Question.LeftQuestionNo:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_LeftQuestion(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "left_quest");
metaInfo.put ("length", "80");
metaInfo.put ("name", "LeftQuestion");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Question.LeftQuestion:", metaInfo);
ATTRIBUTES_METADATA_Question.put (FIELD_LeftQuestion, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(Question.class, "LeftQuestion", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for Question.LeftQuestion:", validators);
return validators;
} }
// Meta Info setup
private static List setupAttribMetaData_RightQuestionNo(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "right_quest_number");
metaInfo.put ("name", "RightQuestionNo");
metaInfo.put ("type", "Integer");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Question.RightQuestionNo:", metaInfo);
ATTRIBUTES_METADATA_Question.put (FIELD_RightQuestionNo, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(Question.class, "RightQuestionNo", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for Question.RightQuestionNo:", validators);
return validators;
}
// Meta Info setup // Meta Info setup
private static List setupAttribMetaData_RightQuestion(Map validatorMapping) private static List setupAttribMetaData_Description(Map validatorMapping)
{ {
Map metaInfo = new HashMap (); Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "right_quest"); metaInfo.put ("dbcol", "left_quest");
metaInfo.put ("length", "80"); metaInfo.put ("length", "80");
metaInfo.put ("name", "RightQuestion"); metaInfo.put ("name", "Description");
metaInfo.put ("type", "String"); metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Question.RightQuestion:", metaInfo); LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Question.Description:", metaInfo);
ATTRIBUTES_METADATA_Question.put (FIELD_RightQuestion, Collections.unmodifiableMap (metaInfo)); ATTRIBUTES_METADATA_Question.put (FIELD_Description, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(Question.class, "RightQuestion", metaInfo, validatorMapping); List validators = BaseBusinessClass.getAttribValidators(Question.class, "Description", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for Question.RightQuestion:", validators); LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for Question.Description:", validators);
return validators; return validators;
} }
...@@ -206,10 +156,7 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -206,10 +156,7 @@ public abstract class BaseQuestion extends BaseBusinessClass
super._initialiseNewObjAttributes (transaction); super._initialiseNewObjAttributes (transaction);
_LeftQuestionNo = (Integer)(HELPER_LeftQuestionNo.initialise (_LeftQuestionNo)); _Description = (String)(HELPER_Description.initialise (_Description));
_LeftQuestion = (String)(HELPER_LeftQuestion.initialise (_LeftQuestion));
_RightQuestionNo = (Integer)(HELPER_RightQuestionNo.initialise (_RightQuestionNo));
_RightQuestion = (String)(HELPER_RightQuestion.initialise (_RightQuestion));
} }
...@@ -218,6 +165,7 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -218,6 +165,7 @@ public abstract class BaseQuestion extends BaseBusinessClass
{ {
super._initialiseAssociations (); super._initialiseAssociations ();
_Section = new SingleAssociation<Question, Section> (this, SINGLEREFERENCE_Section, Section.MULTIPLEREFERENCE_Questions, Section.REFERENCE_Section, "quest_lin");
} }
...@@ -227,6 +175,7 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -227,6 +175,7 @@ public abstract class BaseQuestion extends BaseBusinessClass
{ {
super.initialiseReference (); super.initialiseReference ();
_Section = new SingleAssociation<Question, Section> (this, SINGLEREFERENCE_Section, Section.MULTIPLEREFERENCE_Questions, Section.REFERENCE_Section, "quest_lin");
return this; return this;
...@@ -235,310 +184,16 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -235,310 +184,16 @@ public abstract class BaseQuestion extends BaseBusinessClass
/** /**
* Get the attribute LeftQuestionNo * Get the attribute Description
*/
public Integer getLeftQuestionNo ()
{
assertValid();
Integer valToReturn = _LeftQuestionNo;
for (QuestionBehaviourDecorator bhd : Question_BehaviourDecorators)
{
valToReturn = bhd.getLeftQuestionNo ((Question)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 preLeftQuestionNoChange (Integer newLeftQuestionNo) 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 postLeftQuestionNoChange () throws FieldException
{
}
public FieldWriteability getWriteability_LeftQuestionNo ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute LeftQuestionNo. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setLeftQuestionNo (Integer newLeftQuestionNo) throws FieldException
{
boolean oldAndNewIdentical = HELPER_LeftQuestionNo.compare (_LeftQuestionNo, newLeftQuestionNo);
try
{
for (QuestionBehaviourDecorator bhd : Question_BehaviourDecorators)
{
newLeftQuestionNo = bhd.setLeftQuestionNo ((Question)this, newLeftQuestionNo);
oldAndNewIdentical = HELPER_LeftQuestionNo.compare (_LeftQuestionNo, newLeftQuestionNo);
}
if (FIELD_LeftQuestionNo_Validators.length > 0)
{
Object newLeftQuestionNoObj = HELPER_LeftQuestionNo.toObject (newLeftQuestionNo);
if (newLeftQuestionNoObj != null)
{
int loopMax = FIELD_LeftQuestionNo_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_Question.get (FIELD_LeftQuestionNo);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_LeftQuestionNo_Validators[v].checkAttribute (this, FIELD_LeftQuestionNo, metadata, newLeftQuestionNoObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_LeftQuestionNo () != FieldWriteability.FALSE, "Field LeftQuestionNo is not writeable");
preLeftQuestionNoChange (newLeftQuestionNo);
markFieldChange (FIELD_LeftQuestionNo);
_LeftQuestionNo = newLeftQuestionNo;
postFieldChange (FIELD_LeftQuestionNo);
postLeftQuestionNoChange ();
}
}
/**
* Get the attribute LeftQuestion
*/
public String getLeftQuestion ()
{
assertValid();
String valToReturn = _LeftQuestion;
for (QuestionBehaviourDecorator bhd : Question_BehaviourDecorators)
{
valToReturn = bhd.getLeftQuestion ((Question)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 preLeftQuestionChange (String newLeftQuestion) 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 postLeftQuestionChange () throws FieldException
{
}
public FieldWriteability getWriteability_LeftQuestion ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute LeftQuestion. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setLeftQuestion (String newLeftQuestion) throws FieldException
{
boolean oldAndNewIdentical = HELPER_LeftQuestion.compare (_LeftQuestion, newLeftQuestion);
try
{
for (QuestionBehaviourDecorator bhd : Question_BehaviourDecorators)
{
newLeftQuestion = bhd.setLeftQuestion ((Question)this, newLeftQuestion);
oldAndNewIdentical = HELPER_LeftQuestion.compare (_LeftQuestion, newLeftQuestion);
}
if (FIELD_LeftQuestion_Validators.length > 0)
{
Object newLeftQuestionObj = HELPER_LeftQuestion.toObject (newLeftQuestion);
if (newLeftQuestionObj != null)
{
int loopMax = FIELD_LeftQuestion_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_Question.get (FIELD_LeftQuestion);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_LeftQuestion_Validators[v].checkAttribute (this, FIELD_LeftQuestion, metadata, newLeftQuestionObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_LeftQuestion () != FieldWriteability.FALSE, "Field LeftQuestion is not writeable");
preLeftQuestionChange (newLeftQuestion);
markFieldChange (FIELD_LeftQuestion);
_LeftQuestion = newLeftQuestion;
postFieldChange (FIELD_LeftQuestion);
postLeftQuestionChange ();
}
}
/**
* Get the attribute RightQuestionNo
*/
public Integer getRightQuestionNo ()
{
assertValid();
Integer valToReturn = _RightQuestionNo;
for (QuestionBehaviourDecorator bhd : Question_BehaviourDecorators)
{
valToReturn = bhd.getRightQuestionNo ((Question)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 preRightQuestionNoChange (Integer newRightQuestionNo) 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 postRightQuestionNoChange () throws FieldException
{
}
public FieldWriteability getWriteability_RightQuestionNo ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute RightQuestionNo. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setRightQuestionNo (Integer newRightQuestionNo) throws FieldException
{
boolean oldAndNewIdentical = HELPER_RightQuestionNo.compare (_RightQuestionNo, newRightQuestionNo);
try
{
for (QuestionBehaviourDecorator bhd : Question_BehaviourDecorators)
{
newRightQuestionNo = bhd.setRightQuestionNo ((Question)this, newRightQuestionNo);
oldAndNewIdentical = HELPER_RightQuestionNo.compare (_RightQuestionNo, newRightQuestionNo);
}
if (FIELD_RightQuestionNo_Validators.length > 0)
{
Object newRightQuestionNoObj = HELPER_RightQuestionNo.toObject (newRightQuestionNo);
if (newRightQuestionNoObj != null)
{
int loopMax = FIELD_RightQuestionNo_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_Question.get (FIELD_RightQuestionNo);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_RightQuestionNo_Validators[v].checkAttribute (this, FIELD_RightQuestionNo, metadata, newRightQuestionNoObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_RightQuestionNo () != FieldWriteability.FALSE, "Field RightQuestionNo is not writeable");
preRightQuestionNoChange (newRightQuestionNo);
markFieldChange (FIELD_RightQuestionNo);
_RightQuestionNo = newRightQuestionNo;
postFieldChange (FIELD_RightQuestionNo);
postRightQuestionNoChange ();
}
}
/**
* Get the attribute RightQuestion
*/ */
public String getRightQuestion () public String getDescription ()
{ {
assertValid(); assertValid();
String valToReturn = _RightQuestion; String valToReturn = _Description;
for (QuestionBehaviourDecorator bhd : Question_BehaviourDecorators) for (QuestionBehaviourDecorator bhd : Question_BehaviourDecorators)
{ {
valToReturn = bhd.getRightQuestion ((Question)this, valToReturn); valToReturn = bhd.getDescription ((Question)this, valToReturn);
} }
return valToReturn; return valToReturn;
...@@ -550,7 +205,7 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -550,7 +205,7 @@ public abstract class BaseQuestion extends BaseBusinessClass
* Called prior to the attribute changing. Subclasses need not call super. If a field exception * 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. * is thrown, the attribute change will fail. The new value is different to the old value.
*/ */
protected void preRightQuestionChange (String newRightQuestion) throws FieldException protected void preDescriptionChange (String newDescription) throws FieldException
{ {
} }
...@@ -560,46 +215,46 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -560,46 +215,46 @@ public abstract class BaseQuestion extends BaseBusinessClass
* If a field exception is thrown, the value is still changed, however it * If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back * may lead to the TX being rolled back
*/ */
protected void postRightQuestionChange () throws FieldException protected void postDescriptionChange () throws FieldException
{ {
} }
public FieldWriteability getWriteability_RightQuestion () public FieldWriteability getWriteability_Description ()
{ {
return getFieldWritabilityUtil (FieldWriteability.TRUE); return getFieldWritabilityUtil (FieldWriteability.TRUE);
} }
/** /**
* Set the attribute RightQuestion. Checks to ensure a new value * Set the attribute Description. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute. * has been supplied. If so, marks the field as altered and sets the attribute.
*/ */
public void setRightQuestion (String newRightQuestion) throws FieldException public void setDescription (String newDescription) throws FieldException
{ {
boolean oldAndNewIdentical = HELPER_RightQuestion.compare (_RightQuestion, newRightQuestion); boolean oldAndNewIdentical = HELPER_Description.compare (_Description, newDescription);
try try
{ {
for (QuestionBehaviourDecorator bhd : Question_BehaviourDecorators) for (QuestionBehaviourDecorator bhd : Question_BehaviourDecorators)
{ {
newRightQuestion = bhd.setRightQuestion ((Question)this, newRightQuestion); newDescription = bhd.setDescription ((Question)this, newDescription);
oldAndNewIdentical = HELPER_RightQuestion.compare (_RightQuestion, newRightQuestion); oldAndNewIdentical = HELPER_Description.compare (_Description, newDescription);
} }
if (FIELD_RightQuestion_Validators.length > 0) if (FIELD_Description_Validators.length > 0)
{ {
Object newRightQuestionObj = HELPER_RightQuestion.toObject (newRightQuestion); Object newDescriptionObj = HELPER_Description.toObject (newDescription);
if (newRightQuestionObj != null) if (newDescriptionObj != null)
{ {
int loopMax = FIELD_RightQuestion_Validators.length; int loopMax = FIELD_Description_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_Question.get (FIELD_RightQuestion); Map metadata = (Map)ATTRIBUTES_METADATA_Question.get (FIELD_Description);
for (int v = 0 ; v < loopMax ; ++v) for (int v = 0 ; v < loopMax ; ++v)
{ {
FIELD_RightQuestion_Validators[v].checkAttribute (this, FIELD_RightQuestion, metadata, newRightQuestionObj); FIELD_Description_Validators[v].checkAttribute (this, FIELD_Description, metadata, newDescriptionObj);
} }
} }
} }
...@@ -617,12 +272,12 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -617,12 +272,12 @@ public abstract class BaseQuestion extends BaseBusinessClass
if (!oldAndNewIdentical) if (!oldAndNewIdentical)
{ {
assertValid(); assertValid();
Debug.assertion (getWriteability_RightQuestion () != FieldWriteability.FALSE, "Field RightQuestion is not writeable"); Debug.assertion (getWriteability_Description () != FieldWriteability.FALSE, "Field Description is not writeable");
preRightQuestionChange (newRightQuestion); preDescriptionChange (newDescription);
markFieldChange (FIELD_RightQuestion); markFieldChange (FIELD_Description);
_RightQuestion = newRightQuestion; _Description = newDescription;
postFieldChange (FIELD_RightQuestion); postFieldChange (FIELD_Description);
postRightQuestionChange (); postDescriptionChange ();
} }
} }
...@@ -636,6 +291,8 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -636,6 +291,8 @@ public abstract class BaseQuestion extends BaseBusinessClass
List result = super.getSingleAssocs (); List result = super.getSingleAssocs ();
result.add("Section");
return result; return result;
} }
...@@ -647,7 +304,10 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -647,7 +304,10 @@ public abstract class BaseQuestion extends BaseBusinessClass
{ {
throw new RuntimeException ("Game over == null!"); throw new RuntimeException ("Game over == null!");
} }
else if (assocName.equals (SINGLEREFERENCE_Section))
{
return _Section.getReferencedType ();
}
else else
{ {
return super.getSingleAssocReferenceInstance (assocName); return super.getSingleAssocReferenceInstance (assocName);
...@@ -661,7 +321,10 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -661,7 +321,10 @@ public abstract class BaseQuestion extends BaseBusinessClass
{ {
throw new RuntimeException ("Game over == null!"); throw new RuntimeException ("Game over == null!");
} }
else if (assocName.equals (SINGLEREFERENCE_Section))
{
return Section.MULTIPLEREFERENCE_Questions ;
}
else else
{ {
return super.getSingleAssocBackReference (assocName); return super.getSingleAssocBackReference (assocName);
...@@ -675,7 +338,10 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -675,7 +338,10 @@ public abstract class BaseQuestion extends BaseBusinessClass
{ {
throw new RuntimeException ("Game over == null!"); throw new RuntimeException ("Game over == null!");
} }
else if (assocName.equals (SINGLEREFERENCE_Section))
{
return getSection ();
}
else else
{ {
return super.getSingleAssoc (assocName); return super.getSingleAssoc (assocName);
...@@ -689,7 +355,10 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -689,7 +355,10 @@ public abstract class BaseQuestion extends BaseBusinessClass
{ {
throw new RuntimeException ("Game over == null!"); throw new RuntimeException ("Game over == null!");
} }
else if (assocName.equals (SINGLEREFERENCE_Section))
{
return getSection (getType);
}
else else
{ {
return super.getSingleAssoc (assocName, getType); return super.getSingleAssoc (assocName, getType);
...@@ -703,7 +372,10 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -703,7 +372,10 @@ public abstract class BaseQuestion extends BaseBusinessClass
{ {
throw new RuntimeException ("Game over == null!"); throw new RuntimeException ("Game over == null!");
} }
else if (assocName.equals (SINGLEREFERENCE_Section))
{
return getSectionID ();
}
else else
{ {
return super.getSingleAssocID (assocName); return super.getSingleAssocID (assocName);
...@@ -717,7 +389,10 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -717,7 +389,10 @@ public abstract class BaseQuestion extends BaseBusinessClass
{ {
throw new RuntimeException ("Game over == null!"); throw new RuntimeException ("Game over == null!");
} }
else if (assocName.equals (SINGLEREFERENCE_Section))
{
setSection ((Section)(newValue));
}
else else
{ {
super.setSingleAssoc (assocName, newValue); super.setSingleAssoc (assocName, newValue);
...@@ -727,6 +402,113 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -727,6 +402,113 @@ public abstract class BaseQuestion extends BaseBusinessClass
/** /**
* Get the reference Section
*/
public Section getSection () throws StorageException
{
assertValid();
try
{
return (Section)(_Section.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in Question:", this.getObjectID (), ", was trying to get Section:", getSectionID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _Section.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Section getSection (Get getType) throws StorageException
{
assertValid();
return _Section.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getSectionID ()
{
assertValid();
if (_Section == null)
{
return null;
}
else
{
return _Section.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 preSectionChange (Section newSection) 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 postSectionChange () throws FieldException
{
}
public FieldWriteability getWriteability_Section ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference Section. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setSection (Section newSection) throws StorageException, FieldException
{
if (_Section.wouldReferencedChange (newSection))
{
assertValid();
Debug.assertion (getWriteability_Section () != FieldWriteability.FALSE, "Assoc Section is not writeable");
preSectionChange (newSection);
Section oldSection = getSection ();
if (oldSection != null)
{
// This is to stop validation from triggering when we are removed
_Section.set (null);
oldSection.removeFromQuestions ((Question)(this));
}
_Section.set (newSection);
if (newSection != null)
{
newSection.addToQuestions ((Question)(this));
}
postSectionChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings. * A list of multi assoc names e.g. list of strings.
*/ */
public List<String> getMultiAssocs() public List<String> getMultiAssocs()
...@@ -824,6 +606,20 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -824,6 +606,20 @@ public abstract class BaseQuestion extends BaseBusinessClass
{ {
try try
{ {
// Ensure we are removed from any loaded multi-associations that aren't mandatory
if (_Section.isLoaded () || getTransaction ().isObjectLoaded (_Section.getReferencedType (), getSectionID ()))
{
Section referenced = getSection ();
if (referenced != null)
{
// Stop the callback
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null Questions from ", getObjectID (), " to ", referenced.getObjectID ());
_Section.set (null);
referenced.removeFromQuestions ((Question)this);
}
}
} }
catch (Exception e) catch (Exception e)
{ {
...@@ -884,10 +680,8 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -884,10 +680,8 @@ public abstract class BaseQuestion extends BaseBusinessClass
PersistentSet quest_linPSet = allSets.getPersistentSet (myID, "quest_lin", myPSetStatus); PersistentSet quest_linPSet = allSets.getPersistentSet (myID, "quest_lin", myPSetStatus);
quest_linPSet.setAttrib (FIELD_ObjectID, myID); quest_linPSet.setAttrib (FIELD_ObjectID, myID);
quest_linPSet.setAttrib (FIELD_LeftQuestionNo, HELPER_LeftQuestionNo.toObject (_LeftQuestionNo)); // quest_linPSet.setAttrib (FIELD_Description, HELPER_Description.toObject (_Description)); //
quest_linPSet.setAttrib (FIELD_LeftQuestion, HELPER_LeftQuestion.toObject (_LeftQuestion)); // _Section.getPersistentSets (allSets);
quest_linPSet.setAttrib (FIELD_RightQuestionNo, HELPER_RightQuestionNo.toObject (_RightQuestionNo)); //
quest_linPSet.setAttrib (FIELD_RightQuestion, HELPER_RightQuestion.toObject (_RightQuestion)); //
} }
...@@ -902,10 +696,8 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -902,10 +696,8 @@ public abstract class BaseQuestion extends BaseBusinessClass
PersistentSet quest_linPSet = allSets.getPersistentSet (objectID, "quest_lin"); PersistentSet quest_linPSet = allSets.getPersistentSet (objectID, "quest_lin");
_LeftQuestionNo = (Integer)(HELPER_LeftQuestionNo.fromObject (_LeftQuestionNo, quest_linPSet.getAttrib (FIELD_LeftQuestionNo))); // _Description = (String)(HELPER_Description.fromObject (_Description, quest_linPSet.getAttrib (FIELD_Description))); //
_LeftQuestion = (String)(HELPER_LeftQuestion.fromObject (_LeftQuestion, quest_linPSet.getAttrib (FIELD_LeftQuestion))); // _Section.setFromPersistentSets (objectID, allSets);
_RightQuestionNo = (Integer)(HELPER_RightQuestionNo.fromObject (_RightQuestionNo, quest_linPSet.getAttrib (FIELD_RightQuestionNo))); //
_RightQuestion = (String)(HELPER_RightQuestion.fromObject (_RightQuestion, quest_linPSet.getAttrib (FIELD_RightQuestion))); //
} }
...@@ -923,34 +715,7 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -923,34 +715,7 @@ public abstract class BaseQuestion extends BaseBusinessClass
try try
{ {
setLeftQuestionNo (otherQuestion.getLeftQuestionNo ()); setDescription (otherQuestion.getDescription ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setLeftQuestion (otherQuestion.getLeftQuestion ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setRightQuestionNo (otherQuestion.getRightQuestionNo ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setRightQuestion (otherQuestion.getRightQuestion ());
} }
catch (FieldException ex) catch (FieldException ex)
{ {
...@@ -972,10 +737,7 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -972,10 +737,7 @@ public abstract class BaseQuestion extends BaseBusinessClass
{ {
BaseQuestion sourceQuestion = (BaseQuestion)(source); BaseQuestion sourceQuestion = (BaseQuestion)(source);
_LeftQuestionNo = sourceQuestion._LeftQuestionNo; _Description = sourceQuestion._Description;
_LeftQuestion = sourceQuestion._LeftQuestion;
_RightQuestionNo = sourceQuestion._RightQuestionNo;
_RightQuestion = sourceQuestion._RightQuestion;
} }
} }
...@@ -992,6 +754,7 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -992,6 +754,7 @@ public abstract class BaseQuestion extends BaseBusinessClass
{ {
BaseQuestion sourceQuestion = (BaseQuestion)(source); BaseQuestion sourceQuestion = (BaseQuestion)(source);
_Section.copyFrom (sourceQuestion._Section, linkToGhosts);
} }
} }
...@@ -1028,10 +791,8 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -1028,10 +791,8 @@ public abstract class BaseQuestion extends BaseBusinessClass
{ {
super.readExternalData(vals); super.readExternalData(vals);
_LeftQuestionNo = (Integer)(HELPER_LeftQuestionNo.readExternal (_LeftQuestionNo, vals.get(FIELD_LeftQuestionNo))); // _Description = (String)(HELPER_Description.readExternal (_Description, vals.get(FIELD_Description))); //
_LeftQuestion = (String)(HELPER_LeftQuestion.readExternal (_LeftQuestion, vals.get(FIELD_LeftQuestion))); // _Section.readExternalData(vals.get(SINGLEREFERENCE_Section));
_RightQuestionNo = (Integer)(HELPER_RightQuestionNo.readExternal (_RightQuestionNo, vals.get(FIELD_RightQuestionNo))); //
_RightQuestion = (String)(HELPER_RightQuestion.readExternal (_RightQuestion, vals.get(FIELD_RightQuestion))); //
} }
...@@ -1043,10 +804,8 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -1043,10 +804,8 @@ public abstract class BaseQuestion extends BaseBusinessClass
{ {
super.writeExternalData(vals); super.writeExternalData(vals);
vals.put (FIELD_LeftQuestionNo, HELPER_LeftQuestionNo.writeExternal (_LeftQuestionNo)); vals.put (FIELD_Description, HELPER_Description.writeExternal (_Description));
vals.put (FIELD_LeftQuestion, HELPER_LeftQuestion.writeExternal (_LeftQuestion)); vals.put (SINGLEREFERENCE_Section, _Section.writeExternalData());
vals.put (FIELD_RightQuestionNo, HELPER_RightQuestionNo.writeExternal (_RightQuestionNo));
vals.put (FIELD_RightQuestion, HELPER_RightQuestion.writeExternal (_RightQuestion));
} }
...@@ -1060,24 +819,13 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -1060,24 +819,13 @@ public abstract class BaseQuestion extends BaseBusinessClass
BaseQuestion otherQuestion = (BaseQuestion)(other); BaseQuestion otherQuestion = (BaseQuestion)(other);
if (!HELPER_LeftQuestionNo.compare(this._LeftQuestionNo, otherQuestion._LeftQuestionNo)) if (!HELPER_Description.compare(this._Description, otherQuestion._Description))
{
listener.notifyFieldChange(this, other, FIELD_LeftQuestionNo, HELPER_LeftQuestionNo.toObject(this._LeftQuestionNo), HELPER_LeftQuestionNo.toObject(otherQuestion._LeftQuestionNo));
}
if (!HELPER_LeftQuestion.compare(this._LeftQuestion, otherQuestion._LeftQuestion))
{
listener.notifyFieldChange(this, other, FIELD_LeftQuestion, HELPER_LeftQuestion.toObject(this._LeftQuestion), HELPER_LeftQuestion.toObject(otherQuestion._LeftQuestion));
}
if (!HELPER_RightQuestionNo.compare(this._RightQuestionNo, otherQuestion._RightQuestionNo))
{
listener.notifyFieldChange(this, other, FIELD_RightQuestionNo, HELPER_RightQuestionNo.toObject(this._RightQuestionNo), HELPER_RightQuestionNo.toObject(otherQuestion._RightQuestionNo));
}
if (!HELPER_RightQuestion.compare(this._RightQuestion, otherQuestion._RightQuestion))
{ {
listener.notifyFieldChange(this, other, FIELD_RightQuestion, HELPER_RightQuestion.toObject(this._RightQuestion), HELPER_RightQuestion.toObject(otherQuestion._RightQuestion)); listener.notifyFieldChange(this, other, FIELD_Description, HELPER_Description.toObject(this._Description), HELPER_Description.toObject(otherQuestion._Description));
} }
// Compare single assocs // Compare single assocs
_Section.compare (otherQuestion._Section, listener);
// Compare multiple assocs // Compare multiple assocs
...@@ -1098,10 +846,8 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -1098,10 +846,8 @@ public abstract class BaseQuestion extends BaseBusinessClass
{ {
super.visitAttributes (visitor); super.visitAttributes (visitor);
visitor.visitField(this, FIELD_LeftQuestionNo, HELPER_LeftQuestionNo.toObject(getLeftQuestionNo())); visitor.visitField(this, FIELD_Description, HELPER_Description.toObject(getDescription()));
visitor.visitField(this, FIELD_LeftQuestion, HELPER_LeftQuestion.toObject(getLeftQuestion())); visitor.visitAssociation (_Section);
visitor.visitField(this, FIELD_RightQuestionNo, HELPER_RightQuestionNo.toObject(getRightQuestionNo()));
visitor.visitField(this, FIELD_RightQuestion, HELPER_RightQuestion.toObject(getRightQuestion()));
} }
...@@ -1110,6 +856,10 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -1110,6 +856,10 @@ public abstract class BaseQuestion extends BaseBusinessClass
{ {
super.visitAssociations (visitor, scope); super.visitAssociations (visitor, scope);
if (scope.includes (_Section))
{
visitor.visit (_Section);
}
} }
...@@ -1135,21 +885,13 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -1135,21 +885,13 @@ public abstract class BaseQuestion extends BaseBusinessClass
{ {
throw new RuntimeException ("Game over man!!"); throw new RuntimeException ("Game over man!!");
} }
else if (attribName.equals (FIELD_LeftQuestionNo)) else if (attribName.equals (FIELD_Description))
{
return filter.matches (getLeftQuestionNo ());
}
else if (attribName.equals (FIELD_LeftQuestion))
{ {
return filter.matches (getLeftQuestion ()); return filter.matches (getDescription ());
} }
else if (attribName.equals (FIELD_RightQuestionNo)) else if (attribName.equals (SINGLEREFERENCE_Section))
{ {
return filter.matches (getRightQuestionNo ()); return filter.matches (getSection ());
}
else if (attribName.equals (FIELD_RightQuestion))
{
return filter.matches (getRightQuestion ());
} }
else else
{ {
...@@ -1166,21 +908,9 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -1166,21 +908,9 @@ public abstract class BaseQuestion extends BaseBusinessClass
{ {
throw new RuntimeException ("Game over man!!"); throw new RuntimeException ("Game over man!!");
} }
else if (attribName.equals (FIELD_LeftQuestionNo)) else if (attribName.equals (FIELD_Description))
{ {
return HELPER_LeftQuestionNo.toObject (getLeftQuestionNo ()); return HELPER_Description.toObject (getDescription ());
}
else if (attribName.equals (FIELD_LeftQuestion))
{
return HELPER_LeftQuestion.toObject (getLeftQuestion ());
}
else if (attribName.equals (FIELD_RightQuestionNo))
{
return HELPER_RightQuestionNo.toObject (getRightQuestionNo ());
}
else if (attribName.equals (FIELD_RightQuestion))
{
return HELPER_RightQuestion.toObject (getRightQuestion ());
} }
else else
{ {
...@@ -1195,21 +925,9 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -1195,21 +925,9 @@ public abstract class BaseQuestion extends BaseBusinessClass
{ {
throw new RuntimeException ("Game over man!!"); throw new RuntimeException ("Game over man!!");
} }
else if (attribName.equals (FIELD_LeftQuestionNo)) else if (attribName.equals (FIELD_Description))
{
return HELPER_LeftQuestionNo;
}
else if (attribName.equals (FIELD_LeftQuestion))
{ {
return HELPER_LeftQuestion; return HELPER_Description;
}
else if (attribName.equals (FIELD_RightQuestionNo))
{
return HELPER_RightQuestionNo;
}
else if (attribName.equals (FIELD_RightQuestion))
{
return HELPER_RightQuestion;
} }
else else
{ {
...@@ -1224,21 +942,9 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -1224,21 +942,9 @@ public abstract class BaseQuestion extends BaseBusinessClass
{ {
throw new RuntimeException ("Game over man!!"); throw new RuntimeException ("Game over man!!");
} }
else if (attribName.equals (FIELD_LeftQuestionNo)) else if (attribName.equals (FIELD_Description))
{
setLeftQuestionNo ((Integer)(HELPER_LeftQuestionNo.fromObject (_LeftQuestionNo, attribValue)));
}
else if (attribName.equals (FIELD_LeftQuestion))
{
setLeftQuestion ((String)(HELPER_LeftQuestion.fromObject (_LeftQuestion, attribValue)));
}
else if (attribName.equals (FIELD_RightQuestionNo))
{ {
setRightQuestionNo ((Integer)(HELPER_RightQuestionNo.fromObject (_RightQuestionNo, attribValue))); setDescription ((String)(HELPER_Description.fromObject (_Description, attribValue)));
}
else if (attribName.equals (FIELD_RightQuestion))
{
setRightQuestion ((String)(HELPER_RightQuestion.fromObject (_RightQuestion, attribValue)));
} }
else else
{ {
...@@ -1260,21 +966,13 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -1260,21 +966,13 @@ public abstract class BaseQuestion extends BaseBusinessClass
{ {
throw new RuntimeException ("Game over man!!"); throw new RuntimeException ("Game over man!!");
} }
else if (fieldName.equals (FIELD_LeftQuestionNo)) else if (fieldName.equals (FIELD_Description))
{
return getWriteability_LeftQuestionNo ();
}
else if (fieldName.equals (FIELD_LeftQuestion))
{ {
return getWriteability_LeftQuestion (); return getWriteability_Description ();
} }
else if (fieldName.equals (FIELD_RightQuestionNo)) else if (fieldName.equals (SINGLEREFERENCE_Section))
{ {
return getWriteability_RightQuestionNo (); return getWriteability_Section ();
}
else if (fieldName.equals (FIELD_RightQuestion))
{
return getWriteability_RightQuestion ();
} }
else else
{ {
...@@ -1286,24 +984,9 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -1286,24 +984,9 @@ public abstract class BaseQuestion extends BaseBusinessClass
public void putUnwriteable (Set<String> fields) public void putUnwriteable (Set<String> fields)
{ {
if (getWriteability_LeftQuestionNo () != FieldWriteability.TRUE) if (getWriteability_Description () != FieldWriteability.TRUE)
{
fields.add (FIELD_LeftQuestionNo);
}
if (getWriteability_LeftQuestion () != FieldWriteability.TRUE)
{ {
fields.add (FIELD_LeftQuestion); fields.add (FIELD_Description);
}
if (getWriteability_RightQuestionNo () != FieldWriteability.TRUE)
{
fields.add (FIELD_RightQuestionNo);
}
if (getWriteability_RightQuestion () != FieldWriteability.TRUE)
{
fields.add (FIELD_RightQuestion);
} }
...@@ -1315,10 +998,7 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -1315,10 +998,7 @@ public abstract class BaseQuestion extends BaseBusinessClass
List result = super.getAttributes (); List result = super.getAttributes ();
result.add(HELPER_LeftQuestionNo.getAttribObject (getClass (), _LeftQuestionNo, false, FIELD_LeftQuestionNo)); result.add(HELPER_Description.getAttribObject (getClass (), _Description, false, FIELD_Description));
result.add(HELPER_LeftQuestion.getAttribObject (getClass (), _LeftQuestion, false, FIELD_LeftQuestion));
result.add(HELPER_RightQuestionNo.getAttribObject (getClass (), _RightQuestionNo, false, FIELD_RightQuestionNo));
result.add(HELPER_RightQuestion.getAttribObject (getClass (), _RightQuestion, false, FIELD_RightQuestion));
return result; return result;
} }
...@@ -1370,75 +1050,21 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -1370,75 +1050,21 @@ public abstract class BaseQuestion extends BaseBusinessClass
{ {
/** /**
* Get the attribute LeftQuestionNo * Get the attribute Description
*/
public Integer getLeftQuestionNo (Question obj, Integer original)
{
return original;
}
/**
* Change the value set for attribute LeftQuestionNo.
* May modify the field beforehand
* Occurs before validation.
*/
public Integer setLeftQuestionNo (Question obj, Integer newLeftQuestionNo) throws FieldException
{
return newLeftQuestionNo;
}
/**
* Get the attribute LeftQuestion
*/
public String getLeftQuestion (Question obj, String original)
{
return original;
}
/**
* Change the value set for attribute LeftQuestion.
* May modify the field beforehand
* Occurs before validation.
*/
public String setLeftQuestion (Question obj, String newLeftQuestion) throws FieldException
{
return newLeftQuestion;
}
/**
* Get the attribute RightQuestionNo
*/
public Integer getRightQuestionNo (Question obj, Integer original)
{
return original;
}
/**
* Change the value set for attribute RightQuestionNo.
* May modify the field beforehand
* Occurs before validation.
*/ */
public Integer setRightQuestionNo (Question obj, Integer newRightQuestionNo) throws FieldException public String getDescription (Question obj, String original)
{
return newRightQuestionNo;
}
/**
* Get the attribute RightQuestion
*/
public String getRightQuestion (Question obj, String original)
{ {
return original; return original;
} }
/** /**
* Change the value set for attribute RightQuestion. * Change the value set for attribute Description.
* May modify the field beforehand * May modify the field beforehand
* Occurs before validation. * Occurs before validation.
*/ */
public String setRightQuestion (Question obj, String newRightQuestion) throws FieldException public String setDescription (Question obj, String newDescription) throws FieldException
{ {
return newRightQuestion; return newDescription;
} }
} }
...@@ -1493,21 +1119,13 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -1493,21 +1119,13 @@ public abstract class BaseQuestion extends BaseBusinessClass
public PipeLine<From, ? extends Object> to(String name) public PipeLine<From, ? extends Object> to(String name)
{ {
if (name.equals ("LeftQuestionNo")) if (name.equals ("Description"))
{
return toLeftQuestionNo ();
}
if (name.equals ("LeftQuestion"))
{
return toLeftQuestion ();
}
if (name.equals ("RightQuestionNo"))
{ {
return toRightQuestionNo (); return toDescription ();
} }
if (name.equals ("RightQuestion")) if (name.equals ("Section"))
{ {
return toRightQuestion (); return toSection ();
} }
...@@ -1515,13 +1133,13 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -1515,13 +1133,13 @@ public abstract class BaseQuestion extends BaseBusinessClass
} }
public PipeLine<From, Integer> toLeftQuestionNo () { return pipe(new ORMAttributePipe<Me, Integer>(FIELD_LeftQuestionNo)); } public PipeLine<From, String> toDescription () { return pipe(new ORMAttributePipe<Me, String>(FIELD_Description)); }
public Section.SectionPipeLineFactory<From, Section> toSection () { return toSection (Filter.ALL); }
public PipeLine<From, String> toLeftQuestion () { return pipe(new ORMAttributePipe<Me, String>(FIELD_LeftQuestion)); }
public Section.SectionPipeLineFactory<From, Section> toSection (Filter<Section> filter)
public PipeLine<From, Integer> toRightQuestionNo () { return pipe(new ORMAttributePipe<Me, Integer>(FIELD_RightQuestionNo)); } {
return Section.REFERENCE_Section.new SectionPipeLineFactory<From, Section> (this, new ORMSingleAssocPipe<Me, Section>(SINGLEREFERENCE_Section, filter));
public PipeLine<From, String> toRightQuestion () { return pipe(new ORMAttributePipe<Me, String>(FIELD_RightQuestion)); } }
} }
...@@ -1553,6 +1171,20 @@ class DummyQuestion extends Question ...@@ -1553,6 +1171,20 @@ class DummyQuestion extends Question
} }
public Section getSection () throws StorageException
{
return (Section)(Section.DUMMY_Section);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getSectionID ()
{
return Section.DUMMY_Section.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;
import performa.orm.types.*;
public abstract class BaseSection extends BaseBusinessClass
{
// Reference instance for the object
public static final Section REFERENCE_Section = new Section ();
// Reference instance for the object
public static final Section DUMMY_Section = new DummySection ();
// Static constants corresponding to field names
public static final String FIELD_Description = "Description";
public static final String FIELD_QuestionType = "QuestionType";
public static final String MULTIPLEREFERENCE_Questions = "Questions";
public static final String BACKREF_Questions = "";
// Static constants corresponding to searches
// Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper<Section> HELPER_Description = DefaultAttributeHelper.INSTANCE;
private static final EnumeratedAttributeHelper<Section, QuestionType> HELPER_QuestionType = new EnumeratedAttributeHelper<Section, QuestionType> (QuestionType.FACTORY_QuestionType);
// Private attributes corresponding to business object data
private String _Description;
private QuestionType _QuestionType;
// Private attributes corresponding to single references
// Private attributes corresponding to multiple references
private MultipleAssociation<Section, Question> _Questions;
// Map of maps of metadata
private static final Map ATTRIBUTES_METADATA_Section = new HashMap ();
// Arrays of validators for each attribute
private static final AttributeValidator[] FIELD_Description_Validators;
private static final AttributeValidator[] FIELD_QuestionType_Validators;
// Arrays of behaviour decorators
private static final SectionBehaviourDecorator[] Section_BehaviourDecorators;
static
{
try
{
String tmp_Questions = Question.BACKREF_Section;
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
setupAssocMetaData_Questions();
FIELD_Description_Validators = (AttributeValidator[])setupAttribMetaData_Description(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_QuestionType_Validators = (AttributeValidator[])setupAttribMetaData_QuestionType(validatorMapping).toArray (new AttributeValidator[0]);
REFERENCE_Section.initialiseReference ();
DUMMY_Section.initialiseReference ();
Section_BehaviourDecorators = BaseBusinessClass.getBBCBehaviours(Section.class).toArray(new SectionBehaviourDecorator[0]);
}
catch (RuntimeException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR1, e, "Error initialising");
throw e;
}
}
// Meta Info setup
private static void setupAssocMetaData_Questions()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "Section");
metaInfo.put ("name", "Questions");
metaInfo.put ("type", "Question");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Section.Questions:", metaInfo);
ATTRIBUTES_METADATA_Section.put (MULTIPLEREFERENCE_Questions, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static List setupAttribMetaData_Description(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "quest_hdr_desc");
metaInfo.put ("length", "30");
metaInfo.put ("name", "Description");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Section.Description:", metaInfo);
ATTRIBUTES_METADATA_Section.put (FIELD_Description, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(Section.class, "Description", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for Section.Description:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_QuestionType(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("attribHelper", "EnumeratedAttributeHelper");
metaInfo.put ("dbcol", "quest_type_flag");
metaInfo.put ("name", "QuestionType");
metaInfo.put ("type", "QuestionType");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Section.QuestionType:", metaInfo);
ATTRIBUTES_METADATA_Section.put (FIELD_QuestionType, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(Section.class, "QuestionType", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for Section.QuestionType:", validators);
return validators;
}
// END OF STATIC METADATA DEFINITION
// This constructor should not be called
protected BaseSection ()
{
}
protected BBCBehaviourDecorator[] getBehaviours()
{
return Section_BehaviourDecorators;
}
// Initialise the attributes
protected void _initialiseNewObjAttributes (ObjectTransaction transaction) throws StorageException
{
super._initialiseNewObjAttributes (transaction);
_Description = (String)(HELPER_Description.initialise (_Description));
_QuestionType = (QuestionType)(HELPER_QuestionType.initialise (_QuestionType));
}
// Initialise the associations
protected void _initialiseAssociations ()
{
super._initialiseAssociations ();
_Questions = new MultipleAssociation<Section, Question> (this, MULTIPLEREFERENCE_Questions, Question.SINGLEREFERENCE_Section, Question.REFERENCE_Question);
}
// Initialise the associations
protected BaseBusinessClass initialiseReference ()
{
super.initialiseReference ();
_Questions = new MultipleAssociation<Section, Question> (this, MULTIPLEREFERENCE_Questions, Question.SINGLEREFERENCE_Section, Question.REFERENCE_Question);
return this;
}
/**
* Get the attribute Description
*/
public String getDescription ()
{
assertValid();
String valToReturn = _Description;
for (SectionBehaviourDecorator bhd : Section_BehaviourDecorators)
{
valToReturn = bhd.getDescription ((Section)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 preDescriptionChange (String newDescription) 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 postDescriptionChange () throws FieldException
{
}
public FieldWriteability getWriteability_Description ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute Description. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setDescription (String newDescription) throws FieldException
{
boolean oldAndNewIdentical = HELPER_Description.compare (_Description, newDescription);
try
{
for (SectionBehaviourDecorator bhd : Section_BehaviourDecorators)
{
newDescription = bhd.setDescription ((Section)this, newDescription);
oldAndNewIdentical = HELPER_Description.compare (_Description, newDescription);
}
if (FIELD_Description_Validators.length > 0)
{
Object newDescriptionObj = HELPER_Description.toObject (newDescription);
if (newDescriptionObj != null)
{
int loopMax = FIELD_Description_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_Section.get (FIELD_Description);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_Description_Validators[v].checkAttribute (this, FIELD_Description, metadata, newDescriptionObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_Description () != FieldWriteability.FALSE, "Field Description is not writeable");
preDescriptionChange (newDescription);
markFieldChange (FIELD_Description);
_Description = newDescription;
postFieldChange (FIELD_Description);
postDescriptionChange ();
}
}
/**
* Get the attribute QuestionType
*/
public QuestionType getQuestionType ()
{
assertValid();
QuestionType valToReturn = _QuestionType;
for (SectionBehaviourDecorator bhd : Section_BehaviourDecorators)
{
valToReturn = bhd.getQuestionType ((Section)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 preQuestionTypeChange (QuestionType newQuestionType) 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 postQuestionTypeChange () throws FieldException
{
}
public FieldWriteability getWriteability_QuestionType ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute QuestionType. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setQuestionType (QuestionType newQuestionType) throws FieldException
{
boolean oldAndNewIdentical = HELPER_QuestionType.compare (_QuestionType, newQuestionType);
try
{
for (SectionBehaviourDecorator bhd : Section_BehaviourDecorators)
{
newQuestionType = bhd.setQuestionType ((Section)this, newQuestionType);
oldAndNewIdentical = HELPER_QuestionType.compare (_QuestionType, newQuestionType);
}
if (FIELD_QuestionType_Validators.length > 0)
{
Object newQuestionTypeObj = HELPER_QuestionType.toObject (newQuestionType);
if (newQuestionTypeObj != null)
{
int loopMax = FIELD_QuestionType_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_Section.get (FIELD_QuestionType);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_QuestionType_Validators[v].checkAttribute (this, FIELD_QuestionType, metadata, newQuestionTypeObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_QuestionType () != FieldWriteability.FALSE, "Field QuestionType is not writeable");
preQuestionTypeChange (newQuestionType);
markFieldChange (FIELD_QuestionType);
_QuestionType = newQuestionType;
postFieldChange (FIELD_QuestionType);
postQuestionTypeChange ();
}
}
/**
* 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("Questions");
return result;
}
/**
* Get the reference instance for the multi assoc name.
*/
public BaseBusinessClass getMultiAssocReferenceInstance(String attribName)
{
if (MULTIPLEREFERENCE_Questions.equals(attribName))
{
return Question.REFERENCE_Question ;
}
return super.getMultiAssocReferenceInstance(attribName);
}
public String getMultiAssocBackReference(String attribName)
{
if (MULTIPLEREFERENCE_Questions.equals(attribName))
{
return Question.SINGLEREFERENCE_Section ;
}
return super.getMultiAssocBackReference(attribName);
}
/**
* Get the assoc count for the multi assoc name.
*/
public int getMultiAssocCount(String attribName) throws StorageException
{
if (MULTIPLEREFERENCE_Questions.equals(attribName))
{
return this.getQuestionsCount();
}
return super.getMultiAssocCount(attribName);
}
/**
* Get the assoc at a particular index
*/
public BaseBusinessClass getMultiAssocAt(String attribName, int index) throws StorageException
{
if (MULTIPLEREFERENCE_Questions.equals(attribName))
{
return this.getQuestionsAt(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_Questions.equals(attribName))
{
addToQuestions((Question)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_Questions.equals(attribName))
{
removeFromQuestions((Question)oldElement);
return;
}
super.removeFromMultiAssoc(attribName, oldElement);
}
protected void __loadMultiAssoc (String attribName, BaseBusinessClass[] elements)
{
if (MULTIPLEREFERENCE_Questions.equals(attribName))
{
_Questions.__loadAssociation (elements);
return;
}
super.__loadMultiAssoc(attribName, elements);
}
protected boolean __isMultiAssocLoaded (String attribName)
{
if (MULTIPLEREFERENCE_Questions.equals(attribName))
{
return _Questions.isLoaded ();
}
return super.__isMultiAssocLoaded(attribName);
}
public FieldWriteability getWriteability_Questions ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
public int getQuestionsCount () throws StorageException
{
assertValid();
return _Questions.getReferencedObjectsCount ();
}
public void addToQuestions (Question newElement) throws StorageException
{
if (_Questions.wouldAddChange (newElement))
{
assertValid();
Debug.assertion (getWriteability_Questions () != FieldWriteability.FALSE, "MultiAssoc Questions is not writeable (add)");
_Questions.appendElement (newElement);
try
{
if (newElement.getSection () != this)
{
newElement.setSection ((Section)(this));
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
}
}
public void removeFromQuestions (Question elementToRemove) throws StorageException
{
if (_Questions.wouldRemoveChange (elementToRemove))
{
assertValid();
Debug.assertion (getWriteability_Questions () != FieldWriteability.FALSE, "MultiAssoc Questions is not writeable (remove)");
_Questions.removeElement (elementToRemove);
try
{
if (elementToRemove.getSection () != null)
{
elementToRemove.setSection (null);
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
}
}
public Question getQuestionsAt (int index) throws StorageException
{
return (Question)(_Questions.getElementAt (index));
}
public SortedSet<Question> getQuestionsSet () throws StorageException
{
return _Questions.getSet ();
}
public void onDelete ()
{
try
{
for(Question referenced : CollectionUtils.reverse(getQuestionsSet()))
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null Section from ", getObjectID (), " to ", referenced.getObjectID ());
referenced.setSection(null);
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
super.onDelete ();
}
public Section newInstance ()
{
return new Section ();
}
public Section referenceInstance ()
{
return REFERENCE_Section;
}
public Section getInTransaction (ObjectTransaction t) throws StorageException
{
return getSectionByID (t, getObjectID());
}
public BaseBusinessClass dummyInstance ()
{
return DUMMY_Section;
}
public String getBaseSetName ()
{
return "quest_hdr";
}
/**
* 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 quest_hdrPSet = allSets.getPersistentSet (myID, "quest_hdr", myPSetStatus);
quest_hdrPSet.setAttrib (FIELD_ObjectID, myID);
quest_hdrPSet.setAttrib (FIELD_Description, HELPER_Description.toObject (_Description)); //
quest_hdrPSet.setAttrib (FIELD_QuestionType, HELPER_QuestionType.toObject (_QuestionType)); //
}
/**
* Sets the objects state based on Persistent sets.
*/
public void setFromPersistentSets (ObjectID objectID, PersistentSetCollection allSets)
{
super.setFromPersistentSets (objectID, allSets);
PersistentSet quest_hdrPSet = allSets.getPersistentSet (objectID, "quest_hdr");
_Description = (String)(HELPER_Description.fromObject (_Description, quest_hdrPSet.getAttrib (FIELD_Description))); //
_QuestionType = (QuestionType)(HELPER_QuestionType.fromObject (_QuestionType, quest_hdrPSet.getAttrib (FIELD_QuestionType))); //
}
public void setAttributesFrom (BaseBusinessClass other, MultiException e)
{
super.setAttributesFrom (other, e);
if (other instanceof Section)
{
Section otherSection = (Section)other;
try
{
setDescription (otherSection.getDescription ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setQuestionType (otherSection.getQuestionType ());
}
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 BaseSection)
{
BaseSection sourceSection = (BaseSection)(source);
_Description = sourceSection._Description;
_QuestionType = sourceSection._QuestionType;
}
}
/**
* 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 BaseSection)
{
BaseSection sourceSection = (BaseSection)(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 BaseSection)
{
BaseSection sourceSection = (BaseSection)(source);
_Questions.copyFrom (sourceSection._Questions, 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);
_Description = (String)(HELPER_Description.readExternal (_Description, vals.get(FIELD_Description))); //
_QuestionType = (QuestionType)(HELPER_QuestionType.readExternal (_QuestionType, vals.get(FIELD_QuestionType))); //
_Questions.readExternalData(vals.get(MULTIPLEREFERENCE_Questions));
}
/**
* Subclasses must override this to write out their attributes
*/
protected void writeExternalData(Map<String, Object> vals) throws IOException
{
super.writeExternalData(vals);
vals.put (FIELD_Description, HELPER_Description.writeExternal (_Description));
vals.put (FIELD_QuestionType, HELPER_QuestionType.writeExternal (_QuestionType));
vals.put (MULTIPLEREFERENCE_Questions, _Questions.writeExternalData());
}
public void compare (BaseBusinessClass other, AttributeChangeListener listener) throws StorageException
{
super.compare (other, listener);
if (other instanceof BaseSection)
{
BaseSection otherSection = (BaseSection)(other);
if (!HELPER_Description.compare(this._Description, otherSection._Description))
{
listener.notifyFieldChange(this, other, FIELD_Description, HELPER_Description.toObject(this._Description), HELPER_Description.toObject(otherSection._Description));
}
if (!HELPER_QuestionType.compare(this._QuestionType, otherSection._QuestionType))
{
listener.notifyFieldChange(this, other, FIELD_QuestionType, HELPER_QuestionType.toObject(this._QuestionType), HELPER_QuestionType.toObject(otherSection._QuestionType));
}
// Compare single assocs
// Compare multiple assocs
_Questions.compare (otherSection._Questions, 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_Description, HELPER_Description.toObject(getDescription()));
visitor.visitField(this, FIELD_QuestionType, HELPER_QuestionType.toObject(getQuestionType()));
visitor.visitAssociation (_Questions);
}
public void visitAssociations (AssociationVisitor visitor, AssociatedScope scope) throws StorageException
{
super.visitAssociations (visitor, scope);
if (scope.includes (_Questions))
{
visitor.visit (_Questions);
}
}
public static Section createSection (ObjectTransaction transaction) throws StorageException
{
Section result = new Section ();
result.initialiseNewObject (transaction);
return result;
}
public static Section getSectionByID (ObjectTransaction transaction, Long objectID) throws StorageException
{
return (Section)(transaction.getObjectByID (REFERENCE_Section, objectID));
}
public boolean testFilter (String attribName, QueryFilter filter) throws StorageException
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_Description))
{
return filter.matches (getDescription ());
}
else if (attribName.equals (FIELD_QuestionType))
{
return filter.matches (getQuestionType ());
}
else
{
return super.testFilter (attribName, filter);
}
}
public Object getAttribute (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_Description))
{
return HELPER_Description.toObject (getDescription ());
}
else if (attribName.equals (FIELD_QuestionType))
{
return HELPER_QuestionType.toObject (getQuestionType ());
}
else
{
return super.getAttribute (attribName);
}
}
public AttributeHelper getAttributeHelper (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_Description))
{
return HELPER_Description;
}
else if (attribName.equals (FIELD_QuestionType))
{
return HELPER_QuestionType;
}
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_Description))
{
setDescription ((String)(HELPER_Description.fromObject (_Description, attribValue)));
}
else if (attribName.equals (FIELD_QuestionType))
{
setQuestionType ((QuestionType)(HELPER_QuestionType.fromObject (_QuestionType, 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_Description))
{
return getWriteability_Description ();
}
else if (fieldName.equals (FIELD_QuestionType))
{
return getWriteability_QuestionType ();
}
else if (fieldName.equals (MULTIPLEREFERENCE_Questions))
{
return getWriteability_Questions ();
}
else
{
return super.getWriteable (fieldName);
}
}
public void putUnwriteable (Set<String> fields)
{
if (getWriteability_Description () != FieldWriteability.TRUE)
{
fields.add (FIELD_Description);
}
if (getWriteability_QuestionType () != FieldWriteability.TRUE)
{
fields.add (FIELD_QuestionType);
}
super.putUnwriteable (fields);
}
public List<AbstractAttribute> getAttributes ()
{
List result = super.getAttributes ();
result.add(HELPER_Description.getAttribObject (getClass (), _Description, false, FIELD_Description));
result.add(HELPER_QuestionType.getAttribObject (getClass (), _QuestionType, false, FIELD_QuestionType));
return result;
}
public Map getAttributeMetadata (String attribute)
{
if (ATTRIBUTES_METADATA_Section.containsKey (attribute))
{
return (Map)ATTRIBUTES_METADATA_Section.get (attribute);
}
else
{
return super.getAttributeMetadata (attribute);
}
}
public Object getAttributeMetadata (String attribute, String metadata)
{
if (ATTRIBUTES_METADATA_Section.containsKey (attribute))
{
return ((Map)ATTRIBUTES_METADATA_Section.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 SectionBehaviourDecorator extends BaseBusinessClass.BBCBehaviourDecorator<Section>
{
/**
* Get the attribute Description
*/
public String getDescription (Section obj, String original)
{
return original;
}
/**
* Change the value set for attribute Description.
* May modify the field beforehand
* Occurs before validation.
*/
public String setDescription (Section obj, String newDescription) throws FieldException
{
return newDescription;
}
/**
* Get the attribute QuestionType
*/
public QuestionType getQuestionType (Section obj, QuestionType original)
{
return original;
}
/**
* Change the value set for attribute QuestionType.
* May modify the field beforehand
* Occurs before validation.
*/
public QuestionType setQuestionType (Section obj, QuestionType newQuestionType) throws FieldException
{
return newQuestionType;
}
}
public ORMPipeLine pipes()
{
return new SectionPipeLineFactory<Section, Section> ((Section)this);
}
/**
* Use this instead of pipes() to get rid of type casting.
*/
public SectionPipeLineFactory<Section, Section> pipelineSection()
{
return (SectionPipeLineFactory<Section, Section>) pipes();
}
public static SectionPipeLineFactory<Section, Section> pipesSection(Collection<Section> items)
{
return REFERENCE_Section.new SectionPipeLineFactory<Section, Section> (items);
}
public static SectionPipeLineFactory<Section, Section> pipesSection(Section[] _items)
{
return pipesSection(Arrays.asList (_items));
}
public static SectionPipeLineFactory<Section, Section> pipesSection()
{
return pipesSection((Collection)null);
}
public class SectionPipeLineFactory<From extends BaseBusinessClass, Me extends Section> extends BaseBusinessClass.ORMPipeLine<From, Me>
{
public <Prev> SectionPipeLineFactory (PipeLine<From, Prev> pipeLine, Pipe<Prev, Me> nextPipe)
{
super (pipeLine, nextPipe);
}
public SectionPipeLineFactory (From seed)
{
super(seed);
}
public SectionPipeLineFactory (Collection<From> seed)
{
super(seed);
}
public PipeLine<From, ? extends Object> to(String name)
{
if (name.equals ("Questions"))
{
return toQuestions ();
}
if (name.equals ("Description"))
{
return toDescription ();
}
if (name.equals ("QuestionType"))
{
return toQuestionType ();
}
return super.to(name);
}
public PipeLine<From, String> toDescription () { return pipe(new ORMAttributePipe<Me, String>(FIELD_Description)); }
public PipeLine<From, QuestionType> toQuestionType () { return pipe(new ORMAttributePipe<Me, QuestionType>(FIELD_QuestionType)); }
public Question.QuestionPipeLineFactory<From, Question> toQuestions () { return toQuestions(Filter.ALL); }
public Question.QuestionPipeLineFactory<From, Question> toQuestions (Filter<Question> filter)
{
return Question.REFERENCE_Question.new QuestionPipeLineFactory<From, Question> (this, new ORMMultiAssocPipe<Me, Question>(MULTIPLEREFERENCE_Questions, filter));
}
}
public boolean isTransientAttrib(String attribName)
{
return super.isTransientAttrib(attribName);
}
public boolean isTransientSingleReference(String assocName)
{
return super.isTransientSingleReference(assocName);
}
}
class DummySection extends Section
{
// Default constructor primarily to support Externalisable
public DummySection()
{
super();
}
public void assertValid ()
{
}
public int getQuestionsCount () throws StorageException
{
return 0;
}
public Question getQuestionsAt (int index) throws StorageException
{
throw new RuntimeException ("No elements in a dummy object in association Questions");
}
public SortedSet getQuestionsSet () throws StorageException
{
return new TreeSet();
}
}
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<TABLE name="factor_lin" tablePrefix="object" polymorphic="FALSE"> <TABLE name="factor_lin" tablePrefix="object" polymorphic="FALSE">
<ATTRIB name="ReverseScore" type="String" dbcol="reverse_score_flag" length="15"/> <ATTRIB name="ReverseScore" type="Boolean" dbcol="reverse_score_flag"/>
<SINGLEREFERENCE name="Factor" type="Factor" dbcol="factor_number" /> <SINGLEREFERENCE name="Factor" type="Factor" dbcol="factor_number" />
<SINGLEREFERENCE name="Question" type="Question" dbcol="quest_number" /> <SINGLEREFERENCE name="Question" type="Question" dbcol="quest_number" />
......
...@@ -26,7 +26,7 @@ public class FactorQuestionLinkPersistenceMgr extends ObjectPersistenceMgr ...@@ -26,7 +26,7 @@ public class FactorQuestionLinkPersistenceMgr extends ObjectPersistenceMgr
private static final LoggingArea FactorQuestionLinkPersistence = LoggingArea.createLoggingArea(ObjectPersistenceMgr.OBJECT_PERSISTENCE, "FactorQuestionLink"); private static final LoggingArea FactorQuestionLinkPersistence = LoggingArea.createLoggingArea(ObjectPersistenceMgr.OBJECT_PERSISTENCE, "FactorQuestionLink");
// Private attributes corresponding to business object data // Private attributes corresponding to business object data
private String dummyReverseScore; private Boolean dummyReverseScore;
// Static constants corresponding to attribute helpers // Static constants corresponding to attribute helpers
...@@ -37,7 +37,7 @@ public class FactorQuestionLinkPersistenceMgr extends ObjectPersistenceMgr ...@@ -37,7 +37,7 @@ public class FactorQuestionLinkPersistenceMgr extends ObjectPersistenceMgr
public FactorQuestionLinkPersistenceMgr () public FactorQuestionLinkPersistenceMgr ()
{ {
dummyReverseScore = (String)(HELPER_ReverseScore.initialise (dummyReverseScore)); dummyReverseScore = (Boolean)(HELPER_ReverseScore.initialise (dummyReverseScore));
} }
......
...@@ -3,14 +3,15 @@ ...@@ -3,14 +3,15 @@
<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='http://www.oneit.com.au/schemas/5.2/BusinessObject.xsd'> <ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='http://www.oneit.com.au/schemas/5.2/BusinessObject.xsd'>
<BUSINESSCLASS name="FactorScoreResult" package="performa.orm"> <BUSINESSCLASS name="FactorScoreResult" package="performa.orm">
<IMPORT value="performa.orm.types.*"/>
<TABLE name="level_factor" tablePrefix="object" polymorphic="FALSE"> <TABLE name="level_factor" tablePrefix="object" polymorphic="FALSE">
<ATTRIB name="FromScore" type="Integer" dbcol="from_score"/> <ATTRIB name="FromScore" type="Integer" dbcol="from_score"/>
<ATTRIB name="ToScore" type="Integer" dbcol="to_score"/> <ATTRIB name="ToScore" type="Integer" dbcol="to_score"/>
<ATTRIB name="NarrativeCode" type="String" dbcol="narrative_code" length="15"/> <ATTRIB name="NarrativeCode" type="String" dbcol="narrative_code" length="15"/>
<ATTRIB name="ColorCode" type="String" dbcol="color_code" length="15"/> <ATTRIB name="ColorCode" type="ColorCode" dbcol="color_code" attribHelper="EnumeratedAttributeHelper" />
<SINGLEREFERENCE name="Factor" type="Factor" dbcol="factor_number" /> <SINGLEREFERENCE name="Factor" type="Factor" dbcol="factor_number" />
<SINGLEREFERENCE name="Level" type="Level" dbcol="level_number" /> <SINGLEREFERENCE name="Level" type="Level" dbcol="level_number" />
......
...@@ -14,6 +14,7 @@ import oneit.sql.*; ...@@ -14,6 +14,7 @@ import oneit.sql.*;
import oneit.utils.resource.*; import oneit.utils.resource.*;
import oneit.utils.*; import oneit.utils.*;
import oneit.utils.threading.*; import oneit.utils.threading.*;
import performa.orm.types.*;
...@@ -29,14 +30,14 @@ public class FactorScoreResultPersistenceMgr extends ObjectPersistenceMgr ...@@ -29,14 +30,14 @@ public class FactorScoreResultPersistenceMgr extends ObjectPersistenceMgr
private Integer dummyFromScore; private Integer dummyFromScore;
private Integer dummyToScore; private Integer dummyToScore;
private String dummyNarrativeCode; private String dummyNarrativeCode;
private String dummyColorCode; private ColorCode dummyColorCode;
// Static constants corresponding to attribute helpers // Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper HELPER_FromScore = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper HELPER_FromScore = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_ToScore = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper HELPER_ToScore = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_NarrativeCode = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper HELPER_NarrativeCode = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_ColorCode = DefaultAttributeHelper.INSTANCE; private static final EnumeratedAttributeHelper HELPER_ColorCode = new EnumeratedAttributeHelper (ColorCode.FACTORY_ColorCode);
...@@ -46,7 +47,7 @@ public class FactorScoreResultPersistenceMgr extends ObjectPersistenceMgr ...@@ -46,7 +47,7 @@ public class FactorScoreResultPersistenceMgr extends ObjectPersistenceMgr
dummyFromScore = (Integer)(HELPER_FromScore.initialise (dummyFromScore)); dummyFromScore = (Integer)(HELPER_FromScore.initialise (dummyFromScore));
dummyToScore = (Integer)(HELPER_ToScore.initialise (dummyToScore)); dummyToScore = (Integer)(HELPER_ToScore.initialise (dummyToScore));
dummyNarrativeCode = (String)(HELPER_NarrativeCode.initialise (dummyNarrativeCode)); dummyNarrativeCode = (String)(HELPER_NarrativeCode.initialise (dummyNarrativeCode));
dummyColorCode = (String)(HELPER_ColorCode.initialise (dummyColorCode)); dummyColorCode = (ColorCode)(HELPER_ColorCode.initialise (dummyColorCode));
} }
......
...@@ -8,9 +8,9 @@ ...@@ -8,9 +8,9 @@
<TABLE name="level" tablePrefix="object" polymorphic="FALSE"> <TABLE name="level" tablePrefix="object" polymorphic="FALSE">
<ATTRIB name="LevelNo" type="Integer" dbcol="level_number"/>
<ATTRIB name="LevelDescription" type="String" dbcol="level_desc" length="30"/> <ATTRIB name="LevelDescription" type="String" dbcol="level_desc" length="30"/>
<ATTRIB name="LevelNotes" type="String" dbcol="level_notes"/> <ATTRIB name="LevelNotes" type="String" dbcol="level_notes"/>
<ATTRIB name="ReportHeader" type="String" dbcol="rpt_hdr"/>
</TABLE> </TABLE>
......
...@@ -26,28 +26,28 @@ public class LevelPersistenceMgr extends ObjectPersistenceMgr ...@@ -26,28 +26,28 @@ public class LevelPersistenceMgr extends ObjectPersistenceMgr
private static final LoggingArea LevelPersistence = LoggingArea.createLoggingArea(ObjectPersistenceMgr.OBJECT_PERSISTENCE, "Level"); private static final LoggingArea LevelPersistence = LoggingArea.createLoggingArea(ObjectPersistenceMgr.OBJECT_PERSISTENCE, "Level");
// Private attributes corresponding to business object data // Private attributes corresponding to business object data
private Integer dummyLevelNo;
private String dummyLevelDescription; private String dummyLevelDescription;
private String dummyLevelNotes; private String dummyLevelNotes;
private String dummyReportHeader;
// Static constants corresponding to attribute helpers // Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper HELPER_LevelNo = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_LevelDescription = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper HELPER_LevelDescription = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_LevelNotes = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper HELPER_LevelNotes = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_ReportHeader = DefaultAttributeHelper.INSTANCE;
public LevelPersistenceMgr () public LevelPersistenceMgr ()
{ {
dummyLevelNo = (Integer)(HELPER_LevelNo.initialise (dummyLevelNo));
dummyLevelDescription = (String)(HELPER_LevelDescription.initialise (dummyLevelDescription)); dummyLevelDescription = (String)(HELPER_LevelDescription.initialise (dummyLevelDescription));
dummyLevelNotes = (String)(HELPER_LevelNotes.initialise (dummyLevelNotes)); dummyLevelNotes = (String)(HELPER_LevelNotes.initialise (dummyLevelNotes));
dummyReportHeader = (String)(HELPER_ReportHeader.initialise (dummyReportHeader));
} }
private String SELECT_COLUMNS = "{PREFIX}level.object_id as id, {PREFIX}level.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}level.object_CREATED_DATE as CREATED_DATE, {PREFIX}level.level_number, {PREFIX}level.level_desc, {PREFIX}level.level_notes, 1 AS commasafe "; private String SELECT_COLUMNS = "{PREFIX}level.object_id as id, {PREFIX}level.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}level.object_CREATED_DATE as CREATED_DATE, {PREFIX}level.level_desc, {PREFIX}level.level_notes, {PREFIX}level.rpt_hdr, 1 AS commasafe ";
private String SELECT_JOINS = ""; private String SELECT_JOINS = "";
public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
...@@ -98,9 +98,9 @@ public class LevelPersistenceMgr extends ObjectPersistenceMgr ...@@ -98,9 +98,9 @@ public class LevelPersistenceMgr extends ObjectPersistenceMgr
// Check for persistent sets already prefetched // Check for persistent sets already prefetched
if (false || !levelPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) || if (false || !levelPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!levelPSet.containsAttrib(Level.FIELD_LevelNo)||
!levelPSet.containsAttrib(Level.FIELD_LevelDescription)|| !levelPSet.containsAttrib(Level.FIELD_LevelDescription)||
!levelPSet.containsAttrib(Level.FIELD_LevelNotes)) !levelPSet.containsAttrib(Level.FIELD_LevelNotes)||
!levelPSet.containsAttrib(Level.FIELD_ReportHeader))
{ {
// We will need to retrieve it // We will need to retrieve it
idsToFetch.add (id.longValue()); idsToFetch.add (id.longValue());
...@@ -170,10 +170,10 @@ public class LevelPersistenceMgr extends ObjectPersistenceMgr ...@@ -170,10 +170,10 @@ public class LevelPersistenceMgr extends ObjectPersistenceMgr
{ {
int rowsUpdated = executeStatement (sqlMgr, int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}level " + "UPDATE {PREFIX}level " +
"SET level_number = ?, level_desc = ?, level_notes = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " + "SET level_desc = ?, level_notes = ?, rpt_hdr = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE level.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ", "WHERE level.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_LevelNo.getForSQL(dummyLevelNo, levelPSet.getAttrib (Level.FIELD_LevelNo))).listEntry (HELPER_LevelDescription.getForSQL(dummyLevelDescription, levelPSet.getAttrib (Level.FIELD_LevelDescription))).listEntry (HELPER_LevelNotes.getForSQL(dummyLevelNotes, levelPSet.getAttrib (Level.FIELD_LevelNotes))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray()); CollectionUtils.listEntry (HELPER_LevelDescription.getForSQL(dummyLevelDescription, levelPSet.getAttrib (Level.FIELD_LevelDescription))).listEntry (HELPER_LevelNotes.getForSQL(dummyLevelNotes, levelPSet.getAttrib (Level.FIELD_LevelNotes))).listEntry (HELPER_ReportHeader.getForSQL(dummyReportHeader, levelPSet.getAttrib (Level.FIELD_ReportHeader))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
if (rowsUpdated != 1) if (rowsUpdated != 1)
{ {
...@@ -387,9 +387,9 @@ public class LevelPersistenceMgr extends ObjectPersistenceMgr ...@@ -387,9 +387,9 @@ public class LevelPersistenceMgr extends ObjectPersistenceMgr
// Object Created // Object Created
levelPSet.setAttrib(BaseBusinessClass.FIELD_ObjectCreated, r.getTimestamp ("CREATED_DATE")); levelPSet.setAttrib(BaseBusinessClass.FIELD_ObjectCreated, r.getTimestamp ("CREATED_DATE"));
levelPSet.setAttrib(Level.FIELD_LevelNo, HELPER_LevelNo.getFromRS(dummyLevelNo, r, "level_number"));
levelPSet.setAttrib(Level.FIELD_LevelDescription, HELPER_LevelDescription.getFromRS(dummyLevelDescription, r, "level_desc")); levelPSet.setAttrib(Level.FIELD_LevelDescription, HELPER_LevelDescription.getFromRS(dummyLevelDescription, r, "level_desc"));
levelPSet.setAttrib(Level.FIELD_LevelNotes, HELPER_LevelNotes.getFromRS(dummyLevelNotes, r, "level_notes")); levelPSet.setAttrib(Level.FIELD_LevelNotes, HELPER_LevelNotes.getFromRS(dummyLevelNotes, r, "level_notes"));
levelPSet.setAttrib(Level.FIELD_ReportHeader, HELPER_ReportHeader.getFromRS(dummyReportHeader, r, "rpt_hdr"));
} }
...@@ -407,10 +407,10 @@ public class LevelPersistenceMgr extends ObjectPersistenceMgr ...@@ -407,10 +407,10 @@ public class LevelPersistenceMgr extends ObjectPersistenceMgr
{ {
executeStatement (sqlMgr, executeStatement (sqlMgr,
"INSERT INTO {PREFIX}level " + "INSERT INTO {PREFIX}level " +
" (level_number, level_desc, level_notes, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " + " (level_desc, level_notes, rpt_hdr, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " + "VALUES " +
" (?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")", " (?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_LevelNo.getForSQL(dummyLevelNo, levelPSet.getAttrib (Level.FIELD_LevelNo))).listEntry (HELPER_LevelDescription.getForSQL(dummyLevelDescription, levelPSet.getAttrib (Level.FIELD_LevelDescription))).listEntry (HELPER_LevelNotes.getForSQL(dummyLevelNotes, levelPSet.getAttrib (Level.FIELD_LevelNotes))) .listEntry (objectID.longID ()).toList().toArray()); CollectionUtils.listEntry (HELPER_LevelDescription.getForSQL(dummyLevelDescription, levelPSet.getAttrib (Level.FIELD_LevelDescription))).listEntry (HELPER_LevelNotes.getForSQL(dummyLevelNotes, levelPSet.getAttrib (Level.FIELD_LevelNotes))).listEntry (HELPER_ReportHeader.getForSQL(dummyReportHeader, levelPSet.getAttrib (Level.FIELD_ReportHeader))) .listEntry (objectID.longID ()).toList().toArray());
levelPSet.setStatus (PersistentSetStatus.PROCESSED); levelPSet.setStatus (PersistentSetStatus.PROCESSED);
} }
......
...@@ -6,12 +6,9 @@ ...@@ -6,12 +6,9 @@
<TABLE name="quest_lin" tablePrefix="object" polymorphic="FALSE"> <TABLE name="quest_lin" tablePrefix="object" polymorphic="FALSE">
<ATTRIB name="LeftQuestionNo" type="Integer" dbcol="left_quest_number"/> <ATTRIB name="Description" type="String" dbcol="left_quest" length="80"/>
<ATTRIB name="LeftQuestion" type="String" dbcol="left_quest" length="80"/>
<ATTRIB name="RightQuestionNo" type="Integer" dbcol="right_quest_number"/>
<ATTRIB name="RightQuestion" type="String" dbcol="right_quest" length="80"/>
<!--<SINGLEREFERENCE name="Section" type="Section" dbcol="section_number" />--> <SINGLEREFERENCE name="Section" type="Section" dbcol="section_number" backreferenceName="Questions"/>
</TABLE> </TABLE>
......
...@@ -26,31 +26,22 @@ public class QuestionPersistenceMgr extends ObjectPersistenceMgr ...@@ -26,31 +26,22 @@ public class QuestionPersistenceMgr extends ObjectPersistenceMgr
private static final LoggingArea QuestionPersistence = LoggingArea.createLoggingArea(ObjectPersistenceMgr.OBJECT_PERSISTENCE, "Question"); private static final LoggingArea QuestionPersistence = LoggingArea.createLoggingArea(ObjectPersistenceMgr.OBJECT_PERSISTENCE, "Question");
// Private attributes corresponding to business object data // Private attributes corresponding to business object data
private Integer dummyLeftQuestionNo; private String dummyDescription;
private String dummyLeftQuestion;
private Integer dummyRightQuestionNo;
private String dummyRightQuestion;
// Static constants corresponding to attribute helpers // Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper HELPER_LeftQuestionNo = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper HELPER_Description = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_LeftQuestion = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_RightQuestionNo = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_RightQuestion = DefaultAttributeHelper.INSTANCE;
public QuestionPersistenceMgr () public QuestionPersistenceMgr ()
{ {
dummyLeftQuestionNo = (Integer)(HELPER_LeftQuestionNo.initialise (dummyLeftQuestionNo)); dummyDescription = (String)(HELPER_Description.initialise (dummyDescription));
dummyLeftQuestion = (String)(HELPER_LeftQuestion.initialise (dummyLeftQuestion));
dummyRightQuestionNo = (Integer)(HELPER_RightQuestionNo.initialise (dummyRightQuestionNo));
dummyRightQuestion = (String)(HELPER_RightQuestion.initialise (dummyRightQuestion));
} }
private String SELECT_COLUMNS = "{PREFIX}quest_lin.object_id as id, {PREFIX}quest_lin.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}quest_lin.object_CREATED_DATE as CREATED_DATE, {PREFIX}quest_lin.left_quest_number, {PREFIX}quest_lin.left_quest, {PREFIX}quest_lin.right_quest_number, {PREFIX}quest_lin.right_quest, 1 AS commasafe "; private String SELECT_COLUMNS = "{PREFIX}quest_lin.object_id as id, {PREFIX}quest_lin.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}quest_lin.object_CREATED_DATE as CREATED_DATE, {PREFIX}quest_lin.left_quest, {PREFIX}quest_lin.section_number, 1 AS commasafe ";
private String SELECT_JOINS = ""; private String SELECT_JOINS = "";
public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
...@@ -101,10 +92,8 @@ public class QuestionPersistenceMgr extends ObjectPersistenceMgr ...@@ -101,10 +92,8 @@ public class QuestionPersistenceMgr extends ObjectPersistenceMgr
// Check for persistent sets already prefetched // Check for persistent sets already prefetched
if (false || !quest_linPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) || if (false || !quest_linPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!quest_linPSet.containsAttrib(Question.FIELD_LeftQuestionNo)|| !quest_linPSet.containsAttrib(Question.FIELD_Description)||
!quest_linPSet.containsAttrib(Question.FIELD_LeftQuestion)|| !quest_linPSet.containsAttrib(Question.SINGLEREFERENCE_Section))
!quest_linPSet.containsAttrib(Question.FIELD_RightQuestionNo)||
!quest_linPSet.containsAttrib(Question.FIELD_RightQuestion))
{ {
// We will need to retrieve it // We will need to retrieve it
idsToFetch.add (id.longValue()); idsToFetch.add (id.longValue());
...@@ -150,6 +139,16 @@ public class QuestionPersistenceMgr extends ObjectPersistenceMgr ...@@ -150,6 +139,16 @@ public class QuestionPersistenceMgr extends ObjectPersistenceMgr
{ {
throw new RuntimeException (); throw new RuntimeException ();
} }
else if (refName.equals (Question.SINGLEREFERENCE_Section))
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}quest_lin " +
"WHERE " + SELECT_JOINS + "section_number = ?";
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, new Object[] { _objectID.longID () }, null, false);
return results;
}
else else
{ {
throw new IllegalArgumentException ("Illegal reference type:" + refName); throw new IllegalArgumentException ("Illegal reference type:" + refName);
...@@ -174,10 +173,10 @@ public class QuestionPersistenceMgr extends ObjectPersistenceMgr ...@@ -174,10 +173,10 @@ public class QuestionPersistenceMgr extends ObjectPersistenceMgr
{ {
int rowsUpdated = executeStatement (sqlMgr, int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}quest_lin " + "UPDATE {PREFIX}quest_lin " +
"SET left_quest_number = ?, left_quest = ?, right_quest_number = ?, right_quest = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " + "SET left_quest = ?, section_number = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE quest_lin.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ", "WHERE quest_lin.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_LeftQuestionNo.getForSQL(dummyLeftQuestionNo, quest_linPSet.getAttrib (Question.FIELD_LeftQuestionNo))).listEntry (HELPER_LeftQuestion.getForSQL(dummyLeftQuestion, quest_linPSet.getAttrib (Question.FIELD_LeftQuestion))).listEntry (HELPER_RightQuestionNo.getForSQL(dummyRightQuestionNo, quest_linPSet.getAttrib (Question.FIELD_RightQuestionNo))).listEntry (HELPER_RightQuestion.getForSQL(dummyRightQuestion, quest_linPSet.getAttrib (Question.FIELD_RightQuestion))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray()); CollectionUtils.listEntry (HELPER_Description.getForSQL(dummyDescription, quest_linPSet.getAttrib (Question.FIELD_Description))).listEntry (SQLManager.CheckNull((Long)(quest_linPSet.getAttrib (Question.SINGLEREFERENCE_Section)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
if (rowsUpdated != 1) if (rowsUpdated != 1)
{ {
...@@ -391,11 +390,9 @@ public class QuestionPersistenceMgr extends ObjectPersistenceMgr ...@@ -391,11 +390,9 @@ public class QuestionPersistenceMgr extends ObjectPersistenceMgr
// Object Created // Object Created
quest_linPSet.setAttrib(BaseBusinessClass.FIELD_ObjectCreated, r.getTimestamp ("CREATED_DATE")); quest_linPSet.setAttrib(BaseBusinessClass.FIELD_ObjectCreated, r.getTimestamp ("CREATED_DATE"));
quest_linPSet.setAttrib(Question.FIELD_LeftQuestionNo, HELPER_LeftQuestionNo.getFromRS(dummyLeftQuestionNo, r, "left_quest_number")); quest_linPSet.setAttrib(Question.FIELD_Description, HELPER_Description.getFromRS(dummyDescription, r, "left_quest"));
quest_linPSet.setAttrib(Question.FIELD_LeftQuestion, HELPER_LeftQuestion.getFromRS(dummyLeftQuestion, r, "left_quest"));
quest_linPSet.setAttrib(Question.FIELD_RightQuestionNo, HELPER_RightQuestionNo.getFromRS(dummyRightQuestionNo, r, "right_quest_number"));
quest_linPSet.setAttrib(Question.FIELD_RightQuestion, HELPER_RightQuestion.getFromRS(dummyRightQuestion, r, "right_quest"));
quest_linPSet.setAttrib(Question.SINGLEREFERENCE_Section, r.getObject ("section_number"));
} }
...@@ -412,10 +409,10 @@ public class QuestionPersistenceMgr extends ObjectPersistenceMgr ...@@ -412,10 +409,10 @@ public class QuestionPersistenceMgr extends ObjectPersistenceMgr
{ {
executeStatement (sqlMgr, executeStatement (sqlMgr,
"INSERT INTO {PREFIX}quest_lin " + "INSERT INTO {PREFIX}quest_lin " +
" (left_quest_number, left_quest, right_quest_number, right_quest, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " + " (left_quest, section_number, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " + "VALUES " +
" (?, ?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")", " (?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_LeftQuestionNo.getForSQL(dummyLeftQuestionNo, quest_linPSet.getAttrib (Question.FIELD_LeftQuestionNo))).listEntry (HELPER_LeftQuestion.getForSQL(dummyLeftQuestion, quest_linPSet.getAttrib (Question.FIELD_LeftQuestion))).listEntry (HELPER_RightQuestionNo.getForSQL(dummyRightQuestionNo, quest_linPSet.getAttrib (Question.FIELD_RightQuestionNo))).listEntry (HELPER_RightQuestion.getForSQL(dummyRightQuestion, quest_linPSet.getAttrib (Question.FIELD_RightQuestion))) .listEntry (objectID.longID ()).toList().toArray()); CollectionUtils.listEntry (HELPER_Description.getForSQL(dummyDescription, quest_linPSet.getAttrib (Question.FIELD_Description))) .listEntry (SQLManager.CheckNull((Long)(quest_linPSet.getAttrib (Question.SINGLEREFERENCE_Section)))) .listEntry (objectID.longID ()).toList().toArray());
quest_linPSet.setStatus (PersistentSetStatus.PROCESSED); quest_linPSet.setStatus (PersistentSetStatus.PROCESSED);
} }
......
package performa.orm;
public class Section extends BaseSection
{
private static final long serialVersionUID = 0L;
// This constructor should not be called
public Section ()
{
// 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="Section" package="performa.orm">
<IMPORT value="performa.orm.types.*"/>
<MULTIPLEREFERENCE name="Questions" type="Question" backreferenceName="Section" />
<TABLE name="quest_hdr" tablePrefix="object" polymorphic="FALSE">
<ATTRIB name="Description" type="String" dbcol="quest_hdr_desc" length="30"/>
<ATTRIB name="QuestionType" type="QuestionType" dbcol="quest_type_flag" attribHelper="EnumeratedAttributeHelper" />
</TABLE>
</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.*;
import performa.orm.types.*;
/**
* IMPORTANT!!!! Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2[oneit.objstore.PersistenceMgrTemplate.xsl]
*/
public class SectionPersistenceMgr extends ObjectPersistenceMgr
{
private static final LoggingArea SectionPersistence = LoggingArea.createLoggingArea(ObjectPersistenceMgr.OBJECT_PERSISTENCE, "Section");
// Private attributes corresponding to business object data
private String dummyDescription;
private QuestionType dummyQuestionType;
// Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper HELPER_Description = DefaultAttributeHelper.INSTANCE;
private static final EnumeratedAttributeHelper HELPER_QuestionType = new EnumeratedAttributeHelper (QuestionType.FACTORY_QuestionType);
public SectionPersistenceMgr ()
{
dummyDescription = (String)(HELPER_Description.initialise (dummyDescription));
dummyQuestionType = (QuestionType)(HELPER_QuestionType.initialise (dummyQuestionType));
}
private String SELECT_COLUMNS = "{PREFIX}quest_hdr.object_id as id, {PREFIX}quest_hdr.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}quest_hdr.object_CREATED_DATE as CREATED_DATE, {PREFIX}quest_hdr.quest_hdr_desc, {PREFIX}quest_hdr.quest_type_flag, 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, Section.REFERENCE_Section);
if (objectToReturn instanceof Section)
{
LogMgr.log (SectionPersistence, 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 Section");
}
}
PersistentSet quest_hdrPSet = allPSets.getPersistentSet(id, "quest_hdr", PersistentSetStatus.FETCHED);
// Check for persistent sets already prefetched
if (false || !quest_hdrPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!quest_hdrPSet.containsAttrib(Section.FIELD_Description)||
!quest_hdrPSet.containsAttrib(Section.FIELD_QuestionType))
{
// We will need to retrieve it
idsToFetch.add (id.longValue());
}
else
{
LogMgr.log (SectionPersistence, LogLevel.DEBUG2, "Persistent set preloaded id:", id);
/* Non Polymorphic */
Section result = new Section ();
result.setFromPersistentSets(id, allPSets);
context.addRetrievedObject(result);
results.add (result);
}
}
if (idsToFetch.size () > 0)
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}quest_hdr " +
"WHERE " + SELECT_JOINS + "{PREFIX}quest_hdr.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 quest_hdrPSet = allPSets.getPersistentSet(objectID, "quest_hdr");
if (quest_hdrPSet.getStatus () != PersistentSetStatus.PROCESSED &&
quest_hdrPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}quest_hdr " +
"SET quest_hdr_desc = ?, quest_type_flag = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE quest_hdr.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_Description.getForSQL(dummyDescription, quest_hdrPSet.getAttrib (Section.FIELD_Description))).listEntry (HELPER_QuestionType.getForSQL(dummyQuestionType, quest_hdrPSet.getAttrib (Section.FIELD_QuestionType))).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}quest_hdr 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[] { "quest_hdr", objectID.longID (), obj.getObjectLastModified (), d },
sqlMgr.getPortabilityServices ());
LogMgr.log (SectionPersistence, LogLevel.BUSINESS1, errorMsg);
throw new ConcurrentUpdateConflictException (obj, "quest_hdr");
}
else
{
String errorMsg = "Attempt to update nonexistent row in table:quest_hdr for row:" + objectID + " objDate:" + obj.getObjectLastModified ();
LogMgr.log (SectionPersistence, LogLevel.BUSINESS1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
quest_hdrPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
else
{
LogMgr.log (SectionPersistence, 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 quest_hdrPSet = allPSets.getPersistentSet(objectID, "quest_hdr");
LogMgr.log (SectionPersistence, LogLevel.DEBUG2, "Deleting:", objectID);
if (quest_hdrPSet.getStatus () != PersistentSetStatus.PROCESSED &&
quest_hdrPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsDeleted = executeStatement (sqlMgr,
"DELETE " +
"FROM {PREFIX}quest_hdr " +
"WHERE quest_hdr.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}quest_hdr WHERE object_id = ?",
new Object[] { objectID.longID() });
if (r.next ())
{
throw new ConcurrentUpdateConflictException (obj, "quest_hdr");
}
else
{
String errorMsg = "Attempt to delete nonexistent row in table:quest_hdr for row:" + objectID;
LogMgr.log (SectionPersistence, LogLevel.SYSTEMERROR1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
quest_hdrPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
public BaseBusinessClass[] loadQuery (PersistentSetCollection allPSets, SQLManager sqlMgr, RDBMSPersistenceContext context, String query, Object[] params, Integer maxRows, boolean truncateExtra) throws SQLException, StorageException
{
LinkedHashMap<ObjectID, Section> results = new LinkedHashMap ();
ResultSet r = executeQuery (sqlMgr, query, params);
while (r.next())
{
ThreadUtils.checkInterrupted ();
ObjectID objectID = new ObjectID (Section.REFERENCE_Section.getObjectIDSpace (), r.getLong ("id"));
Section 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, Section.REFERENCE_Section);
if (cachedElement instanceof Section)
{
LogMgr.log (SectionPersistence, LogLevel.TRACE, "Cache hit for id:", objectID);
resultElement = (Section)cachedElement;
}
else
{
throw new StorageException ("Cache collision for id:" + objectID + " with object " + cachedElement + "while fetching a Section");
}
}
else
{
PersistentSet quest_hdrPSet = allPSets.getPersistentSet(objectID, "quest_hdr", PersistentSetStatus.FETCHED);
createPersistentSetFromRS(allPSets, r, objectID);
resultElement = new Section ();
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 (SectionPersistence, 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}quest_hdr " + tables +
"WHERE " + SELECT_JOINS + " " + customParamFilter + customOrderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, null, false);
return results;
}
else
{
throw new IllegalArgumentException ("Illegal search type:" + searchType);
}
}
private void createPersistentSetFromRS(PersistentSetCollection allPSets, ResultSet r, ObjectID objectID) throws SQLException
{
PersistentSet quest_hdrPSet = allPSets.getPersistentSet(objectID, "quest_hdr", PersistentSetStatus.FETCHED);
// Object Modified
quest_hdrPSet.setAttrib(BaseBusinessClass.FIELD_ObjectLastModified, r.getTimestamp ("LAST_UPDATED_DATE"));
// Object Created
quest_hdrPSet.setAttrib(BaseBusinessClass.FIELD_ObjectCreated, r.getTimestamp ("CREATED_DATE"));
quest_hdrPSet.setAttrib(Section.FIELD_Description, HELPER_Description.getFromRS(dummyDescription, r, "quest_hdr_desc"));
quest_hdrPSet.setAttrib(Section.FIELD_QuestionType, HELPER_QuestionType.getFromRS(dummyQuestionType, r, "quest_type_flag"));
}
public void create(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet quest_hdrPSet = allPSets.getPersistentSet(objectID, "quest_hdr");
if (quest_hdrPSet.getStatus () != PersistentSetStatus.PROCESSED &&
quest_hdrPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
executeStatement (sqlMgr,
"INSERT INTO {PREFIX}quest_hdr " +
" (quest_hdr_desc, quest_type_flag, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " +
" (?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_Description.getForSQL(dummyDescription, quest_hdrPSet.getAttrib (Section.FIELD_Description))).listEntry (HELPER_QuestionType.getForSQL(dummyQuestionType, quest_hdrPSet.getAttrib (Section.FIELD_QuestionType))) .listEntry (objectID.longID ()).toList().toArray());
quest_hdrPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
}
package performa.orm.types;
import java.util.*;
import oneit.utils.*;
/**
* This class was generated using constGen.bat.
* DO NOT MODIFY THIS CODE.
* Edit the associated .xml file, and regenerate this file
* constGen (directory) (file minus extension)
* e.g. constGen C:\...\sql FieldType
*/
public class ColorCode extends AbstractEnumerated
{
public static final EnumeratedFactory FACTORY_ColorCode = new ColorCodeFactory();
public static final ColorCode RED = new ColorCode ("RED", "RED", "Red", false);
public static final ColorCode AMBER = new ColorCode ("AMBER", "AMBER", "Amber", false);
public static final ColorCode GREEN = new ColorCode ("GREEN", "GREEN", "Green", false);
private static final ColorCode[] allColorCodes =
new ColorCode[] { RED,AMBER,GREEN};
private static ColorCode[] getAllColorCodes ()
{
return allColorCodes;
}
private transient Integer Weightage;
private ColorCode (String name, String value, String description, boolean disabled)
{
super (name, value, description, disabled);
}
public Integer getWeightage()
{
return Weightage;
}
public static final Comparator COMPARE_BY_POSITION = new CompareEnumByPosition (allColorCodes);
static
{
defineAdditionalData ();
}
public boolean isEqual (ColorCode other)
{
return this.name.equals (other.name);
}
public Enumeration getAllInstances ()
{
return ColorCode.getAll ();
}
private Object readResolve() throws java.io.ObjectStreamException
{
return ColorCode.forName (this.name);
}
public EnumeratedFactory getFactory ()
{
return FACTORY_ColorCode;
}
public static ColorCode forName (String name)
{
if (name == null) { return null; }
ColorCode[] all = getAllColorCodes();
int enumIndex = AbstractEnumerated.getIndexForName (all, name);
return all[enumIndex];
}
public static ColorCode forValue (String value)
{
if (value == null) { return null; }
ColorCode[] all = getAllColorCodes();
int enumIndex = AbstractEnumerated.getIndexForValue (getAllColorCodes (), value);
return all[enumIndex];
}
public static java.util.Enumeration getAll ()
{
return AbstractEnumerated.getAll (getAllColorCodes());
}
public static ColorCode[] getColorCodeArray ()
{
return (ColorCode[])getAllColorCodes().clone ();
}
public static void defineAdditionalData ()
{
RED.Weightage = 1;
AMBER.Weightage = 5;
GREEN.Weightage = 10;
}
static class ColorCodeFactory implements EnumeratedFactory
{
public AbstractEnumerated getForName (String name)
{
return ColorCode.forName (name);
}
public AbstractEnumerated getForValue (String name)
{
return ColorCode.forValue (name);
}
public Enumeration getAll ()
{
return ColorCode.getAll ();
}
}
public Map getAdditionalAttributes ()
{
Map attribs = new HashMap ();
attribs.put ("Weightage", ArrayFormatter.toObject(getWeightage()));
return attribs;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<ROOT>
<CONSTANT package="performa.orm.types" name="ColorCode">
<DATA name="Weightage" type="Integer"/>
<VALUE name="RED" value="RED" description="Red" Weightage="1"/>
<VALUE name="AMBER" value="AMBER" description="Amber" Weightage="5"/>
<VALUE name="GREEN" value="GREEN" description="Green" Weightage="10"/>
</CONSTANT>
</ROOT>
\ No newline at end of file
package performa.orm.types;
import java.util.*;
import oneit.utils.*;
/**
* This class was generated using constGen.bat.
* DO NOT MODIFY THIS CODE.
* Edit the associated .xml file, and regenerate this file
* constGen (directory) (file minus extension)
* e.g. constGen C:\...\sql FieldType
*/
public class QuestionType extends AbstractEnumerated
{
public static final EnumeratedFactory FACTORY_QuestionType = new QuestionTypeFactory();
public static final QuestionType SCALAR = new QuestionType ("SCALAR", "SCALAR", "Scalar", false);
public static final QuestionType IPSATIVE = new QuestionType ("IPSATIVE", "IPSATIVE", "Ipsative", false);
private static final QuestionType[] allQuestionTypes =
new QuestionType[] { SCALAR,IPSATIVE};
private static QuestionType[] getAllQuestionTypes ()
{
return allQuestionTypes;
}
private QuestionType (String name, String value, String description, boolean disabled)
{
super (name, value, description, disabled);
}
public static final Comparator COMPARE_BY_POSITION = new CompareEnumByPosition (allQuestionTypes);
static
{
defineAdditionalData ();
}
public boolean isEqual (QuestionType other)
{
return this.name.equals (other.name);
}
public Enumeration getAllInstances ()
{
return QuestionType.getAll ();
}
private Object readResolve() throws java.io.ObjectStreamException
{
return QuestionType.forName (this.name);
}
public EnumeratedFactory getFactory ()
{
return FACTORY_QuestionType;
}
public static QuestionType forName (String name)
{
if (name == null) { return null; }
QuestionType[] all = getAllQuestionTypes();
int enumIndex = AbstractEnumerated.getIndexForName (all, name);
return all[enumIndex];
}
public static QuestionType forValue (String value)
{
if (value == null) { return null; }
QuestionType[] all = getAllQuestionTypes();
int enumIndex = AbstractEnumerated.getIndexForValue (getAllQuestionTypes (), value);
return all[enumIndex];
}
public static java.util.Enumeration getAll ()
{
return AbstractEnumerated.getAll (getAllQuestionTypes());
}
public static QuestionType[] getQuestionTypeArray ()
{
return (QuestionType[])getAllQuestionTypes().clone ();
}
public static void defineAdditionalData ()
{
}
static class QuestionTypeFactory implements EnumeratedFactory
{
public AbstractEnumerated getForName (String name)
{
return QuestionType.forName (name);
}
public AbstractEnumerated getForValue (String name)
{
return QuestionType.forValue (name);
}
public Enumeration getAll ()
{
return QuestionType.getAll ();
}
}
public Map getAdditionalAttributes ()
{
Map attribs = new HashMap ();
return attribs;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<ROOT>
<CONSTANT package="performa.orm.types" name="QuestionType">
<VALUE name="SCALAR" value="SCALAR" description="Scalar"/>
<VALUE name="IPSATIVE" value="IPSATIVE" description="Ipsative"/>
</CONSTANT>
</ROOT>
\ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* To change this template file, choose Tools | Templates * To change this template file, choose Tools | Templates
* and open the template in the editor. * and open the template in the editor.
*/ */
package performa.form; package performa.utils;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
...@@ -74,20 +74,8 @@ public class AnalysisEngine ...@@ -74,20 +74,8 @@ public class AnalysisEngine
.andToScore(new LessThanEqualFilter<>(factorScore)) .andToScore(new LessThanEqualFilter<>(factorScore))
.search(objTran); .search(objTran);
int score = 0; int score = result.getColorCode().getWeightage();
switch (result.getColorCode())
{
case "Green":
score = 10;
break;
case "Amber":
score = 5;
break;
case "Red":
score = 1;
break;
}
// TODO: calculate normalised score based on importance // TODO: calculate normalised score based on importance
} }
......
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