Commit 72f8b4ef by Nilu

BO changes

parent cc4ef9f0
<?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">answer</tableName>
<column name="object_id" type="Long" nullable="false" length="11"/>
<column name="object_last_updated_date" type="Date" nullable="false" length="22"/>
<column name="object_created_date" type="Date" nullable="false" length="22"/>
<column name="quest_number" type="Long" nullable="true"/>
<column name="answer_number" type="Long" nullable="true"/>
<column name="candidate_id" type="Long" length="11" nullable="true"/>
</NODE>
</NODE></OBJECTS>
\ No newline at end of file
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
<column name="gender" type="String" nullable="true" length="10"/> <column name="gender" type="String" nullable="true" length="10"/>
<column name="password" type="String" nullable="true" length="15"/> <column name="password" type="String" nullable="true" length="15"/>
<column name="date_taken" type="Date" nullable="true"/> <column name="date_taken" type="Date" nullable="true"/>
<column name="section_number" type="Long" nullable="true"/>
<column name="left_quest_number" type="Long" nullable="true"/>
<column name="location" type="String" nullable="true" length="80"/> <column name="location" type="String" nullable="true" length="80"/>
<column name="contact_phone" type="String" nullable="true" length="80"/> <column name="contact_phone" type="String" nullable="true" length="80"/>
<column name="email" type="String" nullable="true" length="60"/> <column name="email" type="String" nullable="true" length="60"/>
......
...@@ -8,11 +8,9 @@ ...@@ -8,11 +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="factor_number" type="Long" nullable="true"/>
<column name="factor_hdr_desc" type="String" nullable="true" length="30"/> <column name="factor_hdr_desc" type="String" nullable="true" length="30"/>
<column name="class_code" type="String" nullable="true" length="15"/> <column name="class_code" type="String" nullable="true" length="15"/>
<column name="factor_hdr_notes" type="CLOB" nullable="true"/> <column name="factor_hdr_notes" type="CLOB" nullable="true"/>
<column name="level_number" type="Long" nullable="true"/>
<column name="left_annot" type="String" nullable="true" length="60"/> <column name="left_annot" type="String" nullable="true" length="60"/>
<column name="right_annot" type="String" nullable="true" length="60"/> <column name="right_annot" type="String" nullable="true" length="60"/>
<column name="factor_hdr_desc_schinese" type="String" nullable="true" length="120"/> <column name="factor_hdr_desc_schinese" type="String" nullable="true" length="120"/>
...@@ -21,6 +19,9 @@ ...@@ -21,6 +19,9 @@
<column name="factor_hdr_desc_thai" type="String" nullable="true" length="120"/> <column name="factor_hdr_desc_thai" type="String" nullable="true" length="120"/>
<column name="z_score_wght" type="Double" nullable="true"/> <column name="z_score_wght" type="Double" nullable="true"/>
<column name="z_score_wght_2" type="Double" nullable="true"/> <column name="z_score_wght_2" type="Double" nullable="true"/>
<column name="level_number" type="Long" length="11" nullable="true"/>
</NODE> </NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="factor_hdr" indexName="idx_factor_hdr_level_number" isUnique="false"><column name="level_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">factor_lin</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="reverse_score_flag" type="String" nullable="true" length="15"/>
<column name="factor_number" type="Long" length="11" nullable="true"/>
</NODE>
</NODE></OBJECTS>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun -->
<OBJECTS name="" xmlns:oneit="http://www.1iT.com.au"><NODE name="Script" factory="Vector">
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.DefineTableOperation">
<tableName factory="String">level_factor</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="from_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="color_code" type="String" nullable="true" length="15"/>
<column name="factor_number" type="Long" length="11" nullable="true"/>
<column name="level_number" type="Long" length="11" nullable="true"/>
</NODE>
</NODE></OBJECTS>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun -->
<OBJECTS name="" xmlns:oneit="http://www.1iT.com.au"><NODE name="Script" factory="Vector">
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.DefineTableOperation">
<tableName factory="String">level</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="level_number" type="Long" nullable="true"/>
<column name="level_desc" type="String" nullable="true" length="30"/>
<column name="level_notes" type="CLOB" nullable="true"/>
</NODE>
</NODE></OBJECTS>
\ No newline at end of file
...@@ -12,16 +12,6 @@ ...@@ -12,16 +12,6 @@
<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="right_quest_number" type="Long" nullable="true"/>
<column name="right_quest" type="String" nullable="true" length="80"/> <column name="right_quest" type="String" nullable="true" length="80"/>
<column name="left_quest_schinese" type="CLOB" nullable="true"/>
<column name="right_quest_schinese" type="CLOB" nullable="true"/>
<column name="left_quest_chinese" type="CLOB" nullable="true"/>
<column name="right_quest_chinese" type="CLOB" nullable="true"/>
<column name="left_quest_korean" type="CLOB" nullable="true"/>
<column name="right_quest_korean" type="CLOB" nullable="true"/>
<column name="left_quest_thai" type="CLOB" nullable="true"/>
<column name="right_quest_thai" type="CLOB" nullable="true"/>
<column name="left_quest_viet" type="CLOB" nullable="true"/>
<column name="right_quest_viet" type="CLOB" nullable="true"/>
</NODE> </NODE>
</NODE></OBJECTS> </NODE></OBJECTS>
\ No newline at end of file
-- DROP TABLE answer;
CREATE TABLE answer (
object_id int NOT NULL ,
object_last_updated_date datetime DEFAULT getdate() NOT NULL ,
object_created_date datetime DEFAULT getdate() NOT NULL
,
quest_number numeric(12) NULL,
answer_number numeric(12) NULL,
candidate_id numeric(12) NULL
);
ALTER TABLE answer ADD
CONSTRAINT PK_answer PRIMARY KEY
(
object_id
) ;
\ No newline at end of file
...@@ -19,8 +19,6 @@ CREATE TABLE candidate ( ...@@ -19,8 +19,6 @@ CREATE TABLE candidate (
gender varchar(10) NULL, gender varchar(10) NULL,
password varchar(15) NULL, password varchar(15) NULL,
date_taken datetime NULL, date_taken datetime NULL,
section_number numeric(12) NULL,
left_quest_number numeric(12) NULL,
location varchar(80) NULL, location varchar(80) NULL,
contact_phone varchar(80) NULL, contact_phone varchar(80) NULL,
email varchar(60) NULL email varchar(60) NULL
......
...@@ -8,11 +8,9 @@ CREATE TABLE factor_hdr ( ...@@ -8,11 +8,9 @@ CREATE TABLE factor_hdr (
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
, ,
factor_number numeric(12) NULL,
factor_hdr_desc varchar(30) NULL, factor_hdr_desc varchar(30) NULL,
class_code varchar(15) NULL, class_code varchar(15) NULL,
factor_hdr_notes text NULL, factor_hdr_notes text NULL,
level_number numeric(12) NULL,
left_annot varchar(60) NULL, left_annot varchar(60) NULL,
right_annot varchar(60) NULL, right_annot varchar(60) NULL,
factor_hdr_desc_schinese varchar(120) NULL, factor_hdr_desc_schinese varchar(120) NULL,
...@@ -20,7 +18,8 @@ CREATE TABLE factor_hdr ( ...@@ -20,7 +18,8 @@ CREATE TABLE factor_hdr (
factor_hdr_desc_korean varchar(120) NULL, factor_hdr_desc_korean varchar(120) NULL,
factor_hdr_desc_thai varchar(120) NULL, factor_hdr_desc_thai varchar(120) NULL,
z_score_wght numeric(20,5) NULL, z_score_wght numeric(20,5) NULL,
z_score_wght_2 numeric(20,5) NULL z_score_wght_2 numeric(20,5) NULL,
level_number numeric(12) NULL
); );
...@@ -32,4 +31,6 @@ ALTER TABLE factor_hdr ADD ...@@ -32,4 +31,6 @@ ALTER TABLE factor_hdr ADD
) ; ) ;
\ No newline at end of file CREATE INDEX idx_factor_hdr_level_number
ON factor_hdr (level_number);
-- DROP TABLE factor_lin;
CREATE TABLE factor_lin (
object_id int NOT NULL ,
object_last_updated_date datetime DEFAULT getdate() NOT NULL ,
object_created_date datetime DEFAULT getdate() NOT NULL
,
reverse_score_flag varchar(15) NULL,
factor_number numeric(12) NULL
);
ALTER TABLE factor_lin ADD
CONSTRAINT PK_factor_lin PRIMARY KEY
(
object_id
) ;
\ No newline at end of file
-- DROP TABLE level_factor;
CREATE TABLE level_factor (
object_id int NOT NULL ,
object_last_updated_date datetime DEFAULT getdate() NOT NULL ,
object_created_date datetime DEFAULT getdate() NOT NULL
,
from_score numeric(12) NULL,
to_score numeric(12) NULL,
narrative_code varchar(15) NULL,
color_code varchar(15) NULL,
factor_number numeric(12) NULL,
level_number numeric(12) NULL
);
ALTER TABLE level_factor ADD
CONSTRAINT PK_level_factor PRIMARY KEY
(
object_id
) ;
\ No newline at end of file
-- DROP TABLE level;
CREATE TABLE level (
object_id int NOT NULL ,
object_last_updated_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_notes text NULL
);
ALTER TABLE level ADD
CONSTRAINT PK_level PRIMARY KEY
(
object_id
) ;
\ No newline at end of file
...@@ -11,17 +11,7 @@ CREATE TABLE quest_lin ( ...@@ -11,17 +11,7 @@ CREATE TABLE quest_lin (
left_quest_number numeric(12) NULL, left_quest_number numeric(12) NULL,
left_quest varchar(80) NULL, left_quest varchar(80) NULL,
right_quest_number numeric(12) NULL, right_quest_number numeric(12) NULL,
right_quest varchar(80) NULL, right_quest varchar(80) NULL
left_quest_schinese text NULL,
right_quest_schinese text NULL,
left_quest_chinese text NULL,
right_quest_chinese text NULL,
left_quest_korean text NULL,
right_quest_korean text NULL,
left_quest_thai text NULL,
right_quest_thai text NULL,
left_quest_viet text NULL,
right_quest_viet text NULL
); );
......
-- DROP TABLE answer;
CREATE TABLE answer (
object_id number(12) NOT NULL ,
object_last_updated_date date DEFAULT SYSDATE NOT NULL ,
object_created_date date DEFAULT SYSDATE NOT NULL
,
quest_number number(12) NULL,
answer_number number(12) NULL,
candidate_id number(12) NULL
);
ALTER TABLE answer ADD
CONSTRAINT PK_answer PRIMARY KEY
(
object_id
) ;
\ No newline at end of file
...@@ -20,8 +20,6 @@ CREATE TABLE candidate ( ...@@ -20,8 +20,6 @@ CREATE TABLE candidate (
gender varchar2(10) NULL, gender varchar2(10) NULL,
password varchar2(15) NULL, password varchar2(15) NULL,
date_taken date NULL, date_taken date NULL,
section_number number(12) NULL,
left_quest_number number(12) NULL,
location varchar2(80) NULL, location varchar2(80) NULL,
contact_phone varchar2(80) NULL, contact_phone varchar2(80) NULL,
email varchar2(60) NULL email varchar2(60) NULL
......
...@@ -9,11 +9,9 @@ CREATE TABLE factor_hdr ( ...@@ -9,11 +9,9 @@ CREATE TABLE factor_hdr (
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
, ,
factor_number number(12) NULL,
factor_hdr_desc varchar2(30) NULL, factor_hdr_desc varchar2(30) NULL,
class_code varchar2(15) NULL, class_code varchar2(15) NULL,
factor_hdr_notes clob NULL, factor_hdr_notes clob NULL,
level_number number(12) NULL,
left_annot varchar2(60) NULL, left_annot varchar2(60) NULL,
right_annot varchar2(60) NULL, right_annot varchar2(60) NULL,
factor_hdr_desc_schinese varchar2(120) NULL, factor_hdr_desc_schinese varchar2(120) NULL,
...@@ -21,7 +19,8 @@ CREATE TABLE factor_hdr ( ...@@ -21,7 +19,8 @@ CREATE TABLE factor_hdr (
factor_hdr_desc_korean varchar2(120) NULL, factor_hdr_desc_korean varchar2(120) NULL,
factor_hdr_desc_thai varchar2(120) NULL, factor_hdr_desc_thai varchar2(120) NULL,
z_score_wght number(20,5) NULL, z_score_wght number(20,5) NULL,
z_score_wght_2 number(20,5) NULL z_score_wght_2 number(20,5) NULL,
level_number number(12) NULL
); );
...@@ -33,4 +32,6 @@ ALTER TABLE factor_hdr ADD ...@@ -33,4 +32,6 @@ ALTER TABLE factor_hdr ADD
) ; ) ;
\ No newline at end of file CREATE INDEX idx_factor_hdr_level_number
ON factor_hdr (level_number);
-- DROP TABLE factor_lin;
CREATE TABLE factor_lin (
object_id number(12) NOT NULL ,
object_last_updated_date date DEFAULT SYSDATE NOT NULL ,
object_created_date date DEFAULT SYSDATE NOT NULL
,
reverse_score_flag varchar2(15) NULL,
factor_number number(12) NULL
);
ALTER TABLE factor_lin ADD
CONSTRAINT PK_factor_lin PRIMARY KEY
(
object_id
) ;
\ No newline at end of file
-- DROP TABLE level_factor;
CREATE TABLE level_factor (
object_id number(12) NOT NULL ,
object_last_updated_date date DEFAULT SYSDATE NOT NULL ,
object_created_date date DEFAULT SYSDATE NOT NULL
,
from_score number(12) NULL,
to_score number(12) NULL,
narrative_code varchar2(15) NULL,
color_code varchar2(15) NULL,
factor_number number(12) NULL,
level_number number(12) NULL
);
ALTER TABLE level_factor ADD
CONSTRAINT PK_level_factor PRIMARY KEY
(
object_id
) ;
\ No newline at end of file
-- DROP TABLE level;
CREATE TABLE level (
object_id number(12) NOT NULL ,
object_last_updated_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_notes clob NULL
);
ALTER TABLE level ADD
CONSTRAINT PK_level PRIMARY KEY
(
object_id
) ;
\ No newline at end of file
...@@ -12,17 +12,7 @@ CREATE TABLE quest_lin ( ...@@ -12,17 +12,7 @@ CREATE TABLE quest_lin (
left_quest_number number(12) NULL, left_quest_number number(12) NULL,
left_quest varchar2(80) NULL, left_quest varchar2(80) NULL,
right_quest_number number(12) NULL, right_quest_number number(12) NULL,
right_quest varchar2(80) NULL, right_quest varchar2(80) NULL
left_quest_schinese clob NULL,
right_quest_schinese clob NULL,
left_quest_chinese clob NULL,
right_quest_chinese clob NULL,
left_quest_korean clob NULL,
right_quest_korean clob NULL,
left_quest_thai clob NULL,
right_quest_thai clob NULL,
left_quest_viet clob NULL,
right_quest_viet clob NULL
); );
......
-- @AutoRun
-- drop table answer;
CREATE TABLE answer (
object_id numeric(12) NOT NULL ,
object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
object_created_date timestamp DEFAULT NOW() NOT NULL
,
quest_number numeric(12) NULL,
answer_number numeric(12) NULL,
candidate_id numeric(12) NULL
);
ALTER TABLE answer ADD
CONSTRAINT pk_answer PRIMARY KEY
(
object_id
) ;
\ No newline at end of file
...@@ -20,8 +20,6 @@ CREATE TABLE candidate ( ...@@ -20,8 +20,6 @@ CREATE TABLE candidate (
gender varchar(10) NULL, gender varchar(10) NULL,
password varchar(15) NULL, password varchar(15) NULL,
date_taken timestamp NULL, date_taken timestamp NULL,
section_number numeric(12) NULL,
left_quest_number numeric(12) NULL,
location varchar(80) NULL, location varchar(80) NULL,
contact_phone varchar(80) NULL, contact_phone varchar(80) NULL,
email varchar(60) NULL email varchar(60) NULL
......
...@@ -9,11 +9,9 @@ CREATE TABLE factor_hdr ( ...@@ -9,11 +9,9 @@ CREATE TABLE factor_hdr (
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
, ,
factor_number numeric(12) NULL,
factor_hdr_desc varchar(30) NULL, factor_hdr_desc varchar(30) NULL,
class_code varchar(15) NULL, class_code varchar(15) NULL,
factor_hdr_notes text NULL, factor_hdr_notes text NULL,
level_number numeric(12) NULL,
left_annot varchar(60) NULL, left_annot varchar(60) NULL,
right_annot varchar(60) NULL, right_annot varchar(60) NULL,
factor_hdr_desc_schinese varchar(120) NULL, factor_hdr_desc_schinese varchar(120) NULL,
...@@ -21,7 +19,8 @@ CREATE TABLE factor_hdr ( ...@@ -21,7 +19,8 @@ CREATE TABLE factor_hdr (
factor_hdr_desc_korean varchar(120) NULL, factor_hdr_desc_korean varchar(120) NULL,
factor_hdr_desc_thai varchar(120) NULL, factor_hdr_desc_thai varchar(120) NULL,
z_score_wght numeric(20,5) NULL, z_score_wght numeric(20,5) NULL,
z_score_wght_2 numeric(20,5) NULL z_score_wght_2 numeric(20,5) NULL,
level_number numeric(12) NULL
); );
...@@ -33,4 +32,6 @@ ALTER TABLE factor_hdr ADD ...@@ -33,4 +32,6 @@ ALTER TABLE factor_hdr ADD
) ; ) ;
\ No newline at end of file CREATE INDEX idx_factor_hdr_level_number
ON factor_hdr (level_number);
-- @AutoRun
-- drop table factor_lin;
CREATE TABLE factor_lin (
object_id numeric(12) NOT NULL ,
object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
object_created_date timestamp DEFAULT NOW() NOT NULL
,
reverse_score_flag varchar(15) NULL,
factor_number numeric(12) NULL
);
ALTER TABLE factor_lin ADD
CONSTRAINT pk_factor_lin PRIMARY KEY
(
object_id
) ;
\ No newline at end of file
-- @AutoRun
-- drop table level_factor;
CREATE TABLE level_factor (
object_id numeric(12) NOT NULL ,
object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
object_created_date timestamp DEFAULT NOW() NOT NULL
,
from_score numeric(12) NULL,
to_score numeric(12) NULL,
narrative_code varchar(15) NULL,
color_code varchar(15) NULL,
factor_number numeric(12) NULL,
level_number numeric(12) NULL
);
ALTER TABLE level_factor ADD
CONSTRAINT pk_level_factor PRIMARY KEY
(
object_id
) ;
\ No newline at end of file
-- @AutoRun
-- drop table level;
CREATE TABLE level (
object_id numeric(12) NOT NULL ,
object_last_updated_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_notes text NULL
);
ALTER TABLE level ADD
CONSTRAINT pk_level PRIMARY KEY
(
object_id
) ;
\ No newline at end of file
...@@ -12,17 +12,7 @@ CREATE TABLE quest_lin ( ...@@ -12,17 +12,7 @@ CREATE TABLE quest_lin (
left_quest_number numeric(12) NULL, left_quest_number numeric(12) NULL,
left_quest varchar(80) NULL, left_quest varchar(80) NULL,
right_quest_number numeric(12) NULL, right_quest_number numeric(12) NULL,
right_quest varchar(80) NULL, right_quest varchar(80) NULL
left_quest_schinese text NULL,
right_quest_schinese text NULL,
left_quest_chinese text NULL,
right_quest_chinese text NULL,
left_quest_korean text NULL,
right_quest_korean text NULL,
left_quest_thai text NULL,
right_quest_thai text NULL,
left_quest_viet text NULL,
right_quest_viet text NULL
); );
......
package performa.orm;
public class Answer extends BaseAnswer
{
private static final long serialVersionUID = 0L;
// This constructor should not be called
public Answer ()
{
// 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="Answer" package="performa.orm">
<TABLE name="answer" tablePrefix="object" polymorphic="FALSE">
<ATTRIB name="QuestionNo" type="Integer" dbcol="quest_number"/>
<ATTRIB name="AnswerNo" type="Integer" dbcol="answer_number"/>
<!--<SINGLEREFERENCE name="Section" type="Section" dbcol="section_number" />-->
<SINGLEREFERENCE name="Candidate" type="Candidate" dbcol="candidate_id" />
</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.*;
/**
* IMPORTANT!!!! Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2[oneit.objstore.PersistenceMgrTemplate.xsl]
*/
public class AnswerPersistenceMgr extends ObjectPersistenceMgr
{
private static final LoggingArea AnswerPersistence = LoggingArea.createLoggingArea(ObjectPersistenceMgr.OBJECT_PERSISTENCE, "Answer");
// Private attributes corresponding to business object data
private Integer dummyQuestionNo;
private Integer dummyAnswerNo;
// Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper HELPER_QuestionNo = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_AnswerNo = DefaultAttributeHelper.INSTANCE;
public AnswerPersistenceMgr ()
{
dummyQuestionNo = (Integer)(HELPER_QuestionNo.initialise (dummyQuestionNo));
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, 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, Answer.REFERENCE_Answer);
if (objectToReturn instanceof Answer)
{
LogMgr.log (AnswerPersistence, 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 Answer");
}
}
PersistentSet answerPSet = allPSets.getPersistentSet(id, "answer", PersistentSetStatus.FETCHED);
// Check for persistent sets already prefetched
if (false || !answerPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!answerPSet.containsAttrib(Answer.FIELD_QuestionNo)||
!answerPSet.containsAttrib(Answer.FIELD_AnswerNo)||
!answerPSet.containsAttrib(Answer.SINGLEREFERENCE_Candidate))
{
// We will need to retrieve it
idsToFetch.add (id.longValue());
}
else
{
LogMgr.log (AnswerPersistence, LogLevel.DEBUG2, "Persistent set preloaded id:", id);
/* Non Polymorphic */
Answer result = new Answer ();
result.setFromPersistentSets(id, allPSets);
context.addRetrievedObject(result);
results.add (result);
}
}
if (idsToFetch.size () > 0)
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}answer " +
"WHERE " + SELECT_JOINS + "{PREFIX}answer.object_id IN ?";
BaseBusinessClass[] resultsFetched = loadQuery (allPSets, sqlMgr, context, query, new Object[] { idsToFetch }, null, false);
for (BaseBusinessClass objFetched : resultsFetched)
{
results.add (objFetched);
}
}
return results;
}
public BaseBusinessClass[] getReferencedObjects(ObjectID _objectID, String refName, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
if (false)
{
throw new RuntimeException ();
}
else
{
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 answerPSet = allPSets.getPersistentSet(objectID, "answer");
if (answerPSet.getStatus () != PersistentSetStatus.PROCESSED &&
answerPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}answer " +
"SET quest_number = ?, answer_number = ?, candidate_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"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 (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}answer WHERE object_id = ?",
new Object[] { objectID.longID () });
if (r.next ())
{
Date d = new java.util.Date (r.getTimestamp (2).getTime());
String errorMsg = QueryBuilder.buildQueryString ("Concurrent update error:[?] for row:[?] objDate:[?] dbDate:[?]",
new Object[] { "answer", objectID.longID (), obj.getObjectLastModified (), d },
sqlMgr.getPortabilityServices ());
LogMgr.log (AnswerPersistence, LogLevel.BUSINESS1, errorMsg);
throw new ConcurrentUpdateConflictException (obj, "answer");
}
else
{
String errorMsg = "Attempt to update nonexistent row in table:answer for row:" + objectID + " objDate:" + obj.getObjectLastModified ();
LogMgr.log (AnswerPersistence, LogLevel.BUSINESS1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
answerPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
else
{
LogMgr.log (AnswerPersistence, 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 answerPSet = allPSets.getPersistentSet(objectID, "answer");
LogMgr.log (AnswerPersistence, LogLevel.DEBUG2, "Deleting:", objectID);
if (answerPSet.getStatus () != PersistentSetStatus.PROCESSED &&
answerPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsDeleted = executeStatement (sqlMgr,
"DELETE " +
"FROM {PREFIX}answer " +
"WHERE answer.object_id = ? AND " + sqlMgr.getPortabilityServices ().getTruncatedTimestampColumn ("object_LAST_UPDATED_DATE") + " = " + sqlMgr.getPortabilityServices ().getTruncatedTimestampParam("?") + " ",
new Object[] { objectID.longID(), obj.getObjectLastModified () });
if (rowsDeleted != 1)
{
// Error, either a concurrency error or a not-exists error
ResultSet r = executeQuery (sqlMgr,
"SELECT object_id FROM {PREFIX}answer WHERE object_id = ?",
new Object[] { objectID.longID() });
if (r.next ())
{
throw new ConcurrentUpdateConflictException (obj, "answer");
}
else
{
String errorMsg = "Attempt to delete nonexistent row in table:answer for row:" + objectID;
LogMgr.log (AnswerPersistence, LogLevel.SYSTEMERROR1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
answerPSet.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, Answer> results = new LinkedHashMap ();
ResultSet r = executeQuery (sqlMgr, query, params);
while (r.next())
{
ThreadUtils.checkInterrupted ();
ObjectID objectID = new ObjectID (Answer.REFERENCE_Answer.getObjectIDSpace (), r.getLong ("id"));
Answer 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, Answer.REFERENCE_Answer);
if (cachedElement instanceof Answer)
{
LogMgr.log (AnswerPersistence, LogLevel.TRACE, "Cache hit for id:", objectID);
resultElement = (Answer)cachedElement;
}
else
{
throw new StorageException ("Cache collision for id:" + objectID + " with object " + cachedElement + "while fetching a Answer");
}
}
else
{
PersistentSet answerPSet = allPSets.getPersistentSet(objectID, "answer", PersistentSetStatus.FETCHED);
createPersistentSetFromRS(allPSets, r, objectID);
resultElement = new Answer ();
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 (AnswerPersistence, 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}answer " + 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 answerPSet = allPSets.getPersistentSet(objectID, "answer", PersistentSetStatus.FETCHED);
// Object Modified
answerPSet.setAttrib(BaseBusinessClass.FIELD_ObjectLastModified, r.getTimestamp ("LAST_UPDATED_DATE"));
// Object Created
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.SINGLEREFERENCE_Candidate, r.getObject ("candidate_id"));
}
public void create(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet answerPSet = allPSets.getPersistentSet(objectID, "answer");
if (answerPSet.getStatus () != PersistentSetStatus.PROCESSED &&
answerPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
executeStatement (sqlMgr,
"INSERT INTO {PREFIX}answer " +
" (quest_number, answer_number, candidate_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " +
" (?, ?, ?, ?, " + 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 (objectID.longID ()).toList().toArray());
answerPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
}
/*
* IMPORTANT!!!! XSL Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2 rev3 [oneit.objstore.BusinessObjectTemplate.xsl]
*
* Version: 1.0
* Vendor: Apache Software Foundation (Xalan XSLTC)
* Vendor URL: http://xml.apache.org/xalan-j
*/
package performa.orm;
import java.io.*;
import java.util.*;
import oneit.appservices.config.*;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.objstore.assocs.*;
import oneit.objstore.attributes.*;
import oneit.objstore.rdbms.filters.*;
import oneit.objstore.parser.*;
import oneit.objstore.validator.*;
import oneit.objstore.utils.*;
import oneit.utils.*;
import oneit.utils.filter.Filter;
import oneit.utils.transform.*;
import oneit.utils.parsers.FieldException;
public abstract class BaseAnswer extends BaseBusinessClass
{
// Reference instance for the object
public static final Answer REFERENCE_Answer = new Answer ();
// Reference instance for the object
public static final Answer DUMMY_Answer = new DummyAnswer ();
// Static constants corresponding to field names
public static final String FIELD_QuestionNo = "QuestionNo";
public static final String FIELD_AnswerNo = "AnswerNo";
public static final String SINGLEREFERENCE_Candidate = "Candidate";
// Static constants corresponding to searches
// 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 attributes corresponding to business object data
private Integer _QuestionNo;
private Integer _AnswerNo;
// Private attributes corresponding to single references
private SingleAssociation<Answer, Candidate> _Candidate;
// Private attributes corresponding to multiple references
// Map of maps of metadata
private static final Map ATTRIBUTES_METADATA_Answer = new HashMap ();
// Arrays of validators for each attribute
private static final AttributeValidator[] FIELD_QuestionNo_Validators;
private static final AttributeValidator[] FIELD_AnswerNo_Validators;
// Arrays of behaviour decorators
private static final AnswerBehaviourDecorator[] Answer_BehaviourDecorators;
static
{
try
{
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
setupAssocMetaData_Candidate();
FIELD_QuestionNo_Validators = (AttributeValidator[])setupAttribMetaData_QuestionNo(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_AnswerNo_Validators = (AttributeValidator[])setupAttribMetaData_AnswerNo(validatorMapping).toArray (new AttributeValidator[0]);
REFERENCE_Answer.initialiseReference ();
DUMMY_Answer.initialiseReference ();
Answer_BehaviourDecorators = BaseBusinessClass.getBBCBehaviours(Answer.class).toArray(new AnswerBehaviourDecorator[0]);
}
catch (RuntimeException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR1, e, "Error initialising");
throw e;
}
}
// Meta Info setup
private static void setupAssocMetaData_Candidate()
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "candidate_id");
metaInfo.put ("name", "Candidate");
metaInfo.put ("type", "Candidate");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Answer.Candidate:", metaInfo);
ATTRIBUTES_METADATA_Answer.put (SINGLEREFERENCE_Candidate, Collections.unmodifiableMap (metaInfo));
}
// 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)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "answer_number");
metaInfo.put ("name", "AnswerNo");
metaInfo.put ("type", "Integer");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Answer.AnswerNo:", metaInfo);
ATTRIBUTES_METADATA_Answer.put (FIELD_AnswerNo, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(Answer.class, "AnswerNo", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for Answer.AnswerNo:", validators);
return validators;
}
// END OF STATIC METADATA DEFINITION
// This constructor should not be called
protected BaseAnswer ()
{
}
protected BBCBehaviourDecorator[] getBehaviours()
{
return Answer_BehaviourDecorators;
}
// Initialise the attributes
protected void _initialiseNewObjAttributes (ObjectTransaction transaction) throws StorageException
{
super._initialiseNewObjAttributes (transaction);
_QuestionNo = (Integer)(HELPER_QuestionNo.initialise (_QuestionNo));
_AnswerNo = (Integer)(HELPER_AnswerNo.initialise (_AnswerNo));
}
// Initialise the associations
protected void _initialiseAssociations ()
{
super._initialiseAssociations ();
_Candidate = new SingleAssociation<Answer, Candidate> (this, SINGLEREFERENCE_Candidate, null, Candidate.REFERENCE_Candidate, "answer");
}
// Initialise the associations
protected BaseBusinessClass initialiseReference ()
{
super.initialiseReference ();
_Candidate = new SingleAssociation<Answer, Candidate> (this, SINGLEREFERENCE_Candidate, null, Candidate.REFERENCE_Candidate, "answer");
return this;
}
/**
* 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
*/
public Integer getAnswerNo ()
{
assertValid();
Integer valToReturn = _AnswerNo;
for (AnswerBehaviourDecorator bhd : Answer_BehaviourDecorators)
{
valToReturn = bhd.getAnswerNo ((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 preAnswerNoChange (Integer newAnswerNo) 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 postAnswerNoChange () throws FieldException
{
}
public FieldWriteability getWriteability_AnswerNo ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute AnswerNo. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setAnswerNo (Integer newAnswerNo) throws FieldException
{
boolean oldAndNewIdentical = HELPER_AnswerNo.compare (_AnswerNo, newAnswerNo);
try
{
for (AnswerBehaviourDecorator bhd : Answer_BehaviourDecorators)
{
newAnswerNo = bhd.setAnswerNo ((Answer)this, newAnswerNo);
oldAndNewIdentical = HELPER_AnswerNo.compare (_AnswerNo, newAnswerNo);
}
if (FIELD_AnswerNo_Validators.length > 0)
{
Object newAnswerNoObj = HELPER_AnswerNo.toObject (newAnswerNo);
if (newAnswerNoObj != null)
{
int loopMax = FIELD_AnswerNo_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_Answer.get (FIELD_AnswerNo);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_AnswerNo_Validators[v].checkAttribute (this, FIELD_AnswerNo, metadata, newAnswerNoObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_AnswerNo () != FieldWriteability.FALSE, "Field AnswerNo is not writeable");
preAnswerNoChange (newAnswerNo);
markFieldChange (FIELD_AnswerNo);
_AnswerNo = newAnswerNo;
postFieldChange (FIELD_AnswerNo);
postAnswerNoChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getSingleAssocs()
{
List result = super.getSingleAssocs ();
result.add("Candidate");
return result;
}
public BaseBusinessClass getSingleAssocReferenceInstance (String assocName)
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Candidate))
{
return _Candidate.getReferencedType ();
}
else
{
return super.getSingleAssocReferenceInstance (assocName);
}
}
public String getSingleAssocBackReference(String assocName)
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Candidate))
{
return null ;
}
else
{
return super.getSingleAssocBackReference (assocName);
}
}
public BaseBusinessClass getSingleAssoc (String assocName) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Candidate))
{
return getCandidate ();
}
else
{
return super.getSingleAssoc (assocName);
}
}
public BaseBusinessClass getSingleAssoc (String assocName, Get getType) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Candidate))
{
return getCandidate (getType);
}
else
{
return super.getSingleAssoc (assocName, getType);
}
}
public Long getSingleAssocID (String assocName) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Candidate))
{
return getCandidateID ();
}
else
{
return super.getSingleAssocID (assocName);
}
}
public void setSingleAssoc (String assocName, BaseBusinessClass newValue) throws StorageException, FieldException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Candidate))
{
setCandidate ((Candidate)(newValue));
}
else
{
super.setSingleAssoc (assocName, newValue);
}
}
/**
* Get the reference Candidate
*/
public Candidate getCandidate () throws StorageException
{
assertValid();
try
{
return (Candidate)(_Candidate.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in Answer:", this.getObjectID (), ", was trying to get Candidate:", getCandidateID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _Candidate.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Candidate getCandidate (Get getType) throws StorageException
{
assertValid();
return _Candidate.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getCandidateID ()
{
assertValid();
if (_Candidate == null)
{
return null;
}
else
{
return _Candidate.getID ();
}
}
/**
* Called prior to the assoc changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preCandidateChange (Candidate newCandidate) throws FieldException
{
}
/**
* Called after the assoc changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postCandidateChange () throws FieldException
{
}
public FieldWriteability getWriteability_Candidate ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference Candidate. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setCandidate (Candidate newCandidate) throws StorageException, FieldException
{
if (_Candidate.wouldReferencedChange (newCandidate))
{
assertValid();
Debug.assertion (getWriteability_Candidate () != FieldWriteability.FALSE, "Assoc Candidate is not writeable");
preCandidateChange (newCandidate);
_Candidate.set (newCandidate);
postCandidateChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getMultiAssocs()
{
List result = super.getMultiAssocs ();
return result;
}
/**
* Get the reference instance for the multi assoc name.
*/
public BaseBusinessClass getMultiAssocReferenceInstance(String attribName)
{
return super.getMultiAssocReferenceInstance(attribName);
}
public String getMultiAssocBackReference(String attribName)
{
return super.getMultiAssocBackReference(attribName);
}
/**
* Get the assoc count for the multi assoc name.
*/
public int getMultiAssocCount(String attribName) throws StorageException
{
return super.getMultiAssocCount(attribName);
}
/**
* Get the assoc at a particular index
*/
public BaseBusinessClass getMultiAssocAt(String attribName, int index) throws StorageException
{
return super.getMultiAssocAt(attribName, index);
}
/**
* Add to a multi assoc by attribute name
*/
public void addToMultiAssoc(String attribName, BaseBusinessClass newElement) throws StorageException
{
super.addToMultiAssoc(attribName, newElement);
}
/**
* Remove from a multi assoc by attribute name
*/
public void removeFromMultiAssoc(String attribName, BaseBusinessClass oldElement) throws StorageException
{
super.removeFromMultiAssoc(attribName, oldElement);
}
protected void __loadMultiAssoc (String attribName, BaseBusinessClass[] elements)
{
super.__loadMultiAssoc(attribName, elements);
}
protected boolean __isMultiAssocLoaded (String attribName)
{
return super.__isMultiAssocLoaded(attribName);
}
public void onDelete ()
{
try
{
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
super.onDelete ();
}
public Answer newInstance ()
{
return new Answer ();
}
public Answer referenceInstance ()
{
return REFERENCE_Answer;
}
public Answer getInTransaction (ObjectTransaction t) throws StorageException
{
return getAnswerByID (t, getObjectID());
}
public BaseBusinessClass dummyInstance ()
{
return DUMMY_Answer;
}
public String getBaseSetName ()
{
return "answer";
}
/**
* This is where an object returns the Persistent sets that will
* store it into the database.
* The should be entered into allSets
*/
public void getPersistentSets (PersistentSetCollection allSets)
{
ObjectStatus myStatus = getStatus ();
PersistentSetStatus myPSetStatus = myStatus.getPSetStatus();
ObjectID myID = getID();
super.getPersistentSets (allSets);
PersistentSet answerPSet = allSets.getPersistentSet (myID, "answer", myPSetStatus);
answerPSet.setAttrib (FIELD_ObjectID, myID);
answerPSet.setAttrib (FIELD_QuestionNo, HELPER_QuestionNo.toObject (_QuestionNo)); //
answerPSet.setAttrib (FIELD_AnswerNo, HELPER_AnswerNo.toObject (_AnswerNo)); //
_Candidate.getPersistentSets (allSets);
}
/**
* Sets the objects state based on Persistent sets.
*/
public void setFromPersistentSets (ObjectID objectID, PersistentSetCollection allSets)
{
super.setFromPersistentSets (objectID, allSets);
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))); //
_Candidate.setFromPersistentSets (objectID, allSets);
}
public void setAttributesFrom (BaseBusinessClass other, MultiException e)
{
super.setAttributesFrom (other, e);
if (other instanceof Answer)
{
Answer otherAnswer = (Answer)other;
try
{
setQuestionNo (otherAnswer.getQuestionNo ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setAnswerNo (otherAnswer.getAnswerNo ());
}
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 BaseAnswer)
{
BaseAnswer sourceAnswer = (BaseAnswer)(source);
_QuestionNo = sourceAnswer._QuestionNo;
_AnswerNo = sourceAnswer._AnswerNo;
}
}
/**
* 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 BaseAnswer)
{
BaseAnswer sourceAnswer = (BaseAnswer)(source);
_Candidate.copyFrom (sourceAnswer._Candidate, linkToGhosts);
}
}
/**
* Set the associations in this to copies of the attributes in source.
*/
public void copyAssociationsFrom (BaseBusinessClass source, boolean linkToGhosts)
{
super.copyAssociationsFrom (source, linkToGhosts);
if (source instanceof BaseAnswer)
{
BaseAnswer sourceAnswer = (BaseAnswer)(source);
}
}
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);
_QuestionNo = (Integer)(HELPER_QuestionNo.readExternal (_QuestionNo, vals.get(FIELD_QuestionNo))); //
_AnswerNo = (Integer)(HELPER_AnswerNo.readExternal (_AnswerNo, vals.get(FIELD_AnswerNo))); //
_Candidate.readExternalData(vals.get(SINGLEREFERENCE_Candidate));
}
/**
* Subclasses must override this to write out their attributes
*/
protected void writeExternalData(Map<String, Object> vals) throws IOException
{
super.writeExternalData(vals);
vals.put (FIELD_QuestionNo, HELPER_QuestionNo.writeExternal (_QuestionNo));
vals.put (FIELD_AnswerNo, HELPER_AnswerNo.writeExternal (_AnswerNo));
vals.put (SINGLEREFERENCE_Candidate, _Candidate.writeExternalData());
}
public void compare (BaseBusinessClass other, AttributeChangeListener listener) throws StorageException
{
super.compare (other, listener);
if (other instanceof BaseAnswer)
{
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))
{
listener.notifyFieldChange(this, other, FIELD_AnswerNo, HELPER_AnswerNo.toObject(this._AnswerNo), HELPER_AnswerNo.toObject(otherAnswer._AnswerNo));
}
// Compare single assocs
_Candidate.compare (otherAnswer._Candidate, listener);
// Compare multiple assocs
}
}
public void visitTransients (AttributeVisitor visitor) throws StorageException
{
super.visitAttributes (visitor);
}
public void visitAttributes (AttributeVisitor visitor) throws StorageException
{
super.visitAttributes (visitor);
visitor.visitField(this, FIELD_QuestionNo, HELPER_QuestionNo.toObject(getQuestionNo()));
visitor.visitField(this, FIELD_AnswerNo, HELPER_AnswerNo.toObject(getAnswerNo()));
visitor.visitAssociation (_Candidate);
}
public void visitAssociations (AssociationVisitor visitor, AssociatedScope scope) throws StorageException
{
super.visitAssociations (visitor, scope);
if (scope.includes (_Candidate))
{
visitor.visit (_Candidate);
}
}
public static Answer createAnswer (ObjectTransaction transaction) throws StorageException
{
Answer result = new Answer ();
result.initialiseNewObject (transaction);
return result;
}
public static Answer getAnswerByID (ObjectTransaction transaction, Long objectID) throws StorageException
{
return (Answer)(transaction.getObjectByID (REFERENCE_Answer, objectID));
}
public boolean testFilter (String attribName, QueryFilter filter) throws StorageException
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_QuestionNo))
{
return filter.matches (getQuestionNo ());
}
else if (attribName.equals (FIELD_AnswerNo))
{
return filter.matches (getAnswerNo ());
}
else if (attribName.equals (SINGLEREFERENCE_Candidate))
{
return filter.matches (getCandidate ());
}
else
{
return super.testFilter (attribName, filter);
}
}
public Object getAttribute (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_QuestionNo))
{
return HELPER_QuestionNo.toObject (getQuestionNo ());
}
else if (attribName.equals (FIELD_AnswerNo))
{
return HELPER_AnswerNo.toObject (getAnswerNo ());
}
else
{
return super.getAttribute (attribName);
}
}
public AttributeHelper getAttributeHelper (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_QuestionNo))
{
return HELPER_QuestionNo;
}
else if (attribName.equals (FIELD_AnswerNo))
{
return HELPER_AnswerNo;
}
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_QuestionNo))
{
setQuestionNo ((Integer)(HELPER_QuestionNo.fromObject (_QuestionNo, attribValue)));
}
else if (attribName.equals (FIELD_AnswerNo))
{
setAnswerNo ((Integer)(HELPER_AnswerNo.fromObject (_AnswerNo, 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_QuestionNo))
{
return getWriteability_QuestionNo ();
}
else if (fieldName.equals (FIELD_AnswerNo))
{
return getWriteability_AnswerNo ();
}
else if (fieldName.equals (SINGLEREFERENCE_Candidate))
{
return getWriteability_Candidate ();
}
else
{
return super.getWriteable (fieldName);
}
}
public void putUnwriteable (Set<String> fields)
{
if (getWriteability_QuestionNo () != FieldWriteability.TRUE)
{
fields.add (FIELD_QuestionNo);
}
if (getWriteability_AnswerNo () != FieldWriteability.TRUE)
{
fields.add (FIELD_AnswerNo);
}
super.putUnwriteable (fields);
}
public List<AbstractAttribute> 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));
return result;
}
public Map getAttributeMetadata (String attribute)
{
if (ATTRIBUTES_METADATA_Answer.containsKey (attribute))
{
return (Map)ATTRIBUTES_METADATA_Answer.get (attribute);
}
else
{
return super.getAttributeMetadata (attribute);
}
}
public Object getAttributeMetadata (String attribute, String metadata)
{
if (ATTRIBUTES_METADATA_Answer.containsKey (attribute))
{
return ((Map)ATTRIBUTES_METADATA_Answer.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 AnswerBehaviourDecorator extends BaseBusinessClass.BBCBehaviourDecorator<Answer>
{
/**
* 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
*/
public Integer getAnswerNo (Answer obj, Integer original)
{
return original;
}
/**
* Change the value set for attribute AnswerNo.
* May modify the field beforehand
* Occurs before validation.
*/
public Integer setAnswerNo (Answer obj, Integer newAnswerNo) throws FieldException
{
return newAnswerNo;
}
}
public ORMPipeLine pipes()
{
return new AnswerPipeLineFactory<Answer, Answer> ((Answer)this);
}
/**
* Use this instead of pipes() to get rid of type casting.
*/
public AnswerPipeLineFactory<Answer, Answer> pipelineAnswer()
{
return (AnswerPipeLineFactory<Answer, Answer>) pipes();
}
public static AnswerPipeLineFactory<Answer, Answer> pipesAnswer(Collection<Answer> items)
{
return REFERENCE_Answer.new AnswerPipeLineFactory<Answer, Answer> (items);
}
public static AnswerPipeLineFactory<Answer, Answer> pipesAnswer(Answer[] _items)
{
return pipesAnswer(Arrays.asList (_items));
}
public static AnswerPipeLineFactory<Answer, Answer> pipesAnswer()
{
return pipesAnswer((Collection)null);
}
public class AnswerPipeLineFactory<From extends BaseBusinessClass, Me extends Answer> extends BaseBusinessClass.ORMPipeLine<From, Me>
{
public <Prev> AnswerPipeLineFactory (PipeLine<From, Prev> pipeLine, Pipe<Prev, Me> nextPipe)
{
super (pipeLine, nextPipe);
}
public AnswerPipeLineFactory (From seed)
{
super(seed);
}
public AnswerPipeLineFactory (Collection<From> seed)
{
super(seed);
}
public PipeLine<From, ? extends Object> to(String name)
{
if (name.equals ("QuestionNo"))
{
return toQuestionNo ();
}
if (name.equals ("AnswerNo"))
{
return toAnswerNo ();
}
if (name.equals ("Candidate"))
{
return toCandidate ();
}
return super.to(name);
}
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 Candidate.CandidatePipeLineFactory<From, Candidate> toCandidate () { return toCandidate (Filter.ALL); }
public Candidate.CandidatePipeLineFactory<From, Candidate> toCandidate (Filter<Candidate> filter)
{
return Candidate.REFERENCE_Candidate.new CandidatePipeLineFactory<From, Candidate> (this, new ORMSingleAssocPipe<Me, Candidate>(SINGLEREFERENCE_Candidate, filter));
}
}
public boolean isTransientAttrib(String attribName)
{
return super.isTransientAttrib(attribName);
}
public boolean isTransientSingleReference(String assocName)
{
return super.isTransientSingleReference(assocName);
}
}
class DummyAnswer extends Answer
{
// Default constructor primarily to support Externalisable
public DummyAnswer()
{
super();
}
public void assertValid ()
{
}
public Candidate getCandidate () throws StorageException
{
return (Candidate)(Candidate.DUMMY_Candidate);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getCandidateID ()
{
return Candidate.DUMMY_Candidate.getObjectID();
}
}
...@@ -49,8 +49,6 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -49,8 +49,6 @@ public abstract class BaseCandidate extends BaseBusinessClass
public static final String FIELD_Gender = "Gender"; public static final String FIELD_Gender = "Gender";
public static final String FIELD_Password = "Password"; public static final String FIELD_Password = "Password";
public static final String FIELD_DateTaken = "DateTaken"; public static final String FIELD_DateTaken = "DateTaken";
public static final String FIELD_SectionNo = "SectionNo";
public static final String FIELD_LeftQuestionNo = "LeftQuestionNo";
public static final String FIELD_Location = "Location"; public static final String FIELD_Location = "Location";
public static final String FIELD_Phone = "Phone"; public static final String FIELD_Phone = "Phone";
public static final String FIELD_Email = "Email"; public static final String FIELD_Email = "Email";
...@@ -70,8 +68,6 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -70,8 +68,6 @@ public abstract class BaseCandidate extends BaseBusinessClass
private static final DefaultAttributeHelper<Candidate> HELPER_Gender = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper<Candidate> HELPER_Gender = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Candidate> HELPER_Password = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper<Candidate> HELPER_Password = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Candidate> HELPER_DateTaken = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper<Candidate> HELPER_DateTaken = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Candidate> HELPER_SectionNo = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Candidate> HELPER_LeftQuestionNo = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Candidate> HELPER_Location = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper<Candidate> HELPER_Location = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Candidate> HELPER_Phone = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper<Candidate> HELPER_Phone = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Candidate> HELPER_Email = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper<Candidate> HELPER_Email = DefaultAttributeHelper.INSTANCE;
...@@ -89,8 +85,6 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -89,8 +85,6 @@ public abstract class BaseCandidate extends BaseBusinessClass
private String _Gender; private String _Gender;
private String _Password; private String _Password;
private Date _DateTaken; private Date _DateTaken;
private Integer _SectionNo;
private Integer _LeftQuestionNo;
private String _Location; private String _Location;
private String _Phone; private String _Phone;
private String _Email; private String _Email;
...@@ -117,8 +111,6 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -117,8 +111,6 @@ public abstract class BaseCandidate extends BaseBusinessClass
private static final AttributeValidator[] FIELD_Gender_Validators; private static final AttributeValidator[] FIELD_Gender_Validators;
private static final AttributeValidator[] FIELD_Password_Validators; private static final AttributeValidator[] FIELD_Password_Validators;
private static final AttributeValidator[] FIELD_DateTaken_Validators; private static final AttributeValidator[] FIELD_DateTaken_Validators;
private static final AttributeValidator[] FIELD_SectionNo_Validators;
private static final AttributeValidator[] FIELD_LeftQuestionNo_Validators;
private static final AttributeValidator[] FIELD_Location_Validators; private static final AttributeValidator[] FIELD_Location_Validators;
private static final AttributeValidator[] FIELD_Phone_Validators; private static final AttributeValidator[] FIELD_Phone_Validators;
private static final AttributeValidator[] FIELD_Email_Validators; private static final AttributeValidator[] FIELD_Email_Validators;
...@@ -146,8 +138,6 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -146,8 +138,6 @@ public abstract class BaseCandidate extends BaseBusinessClass
FIELD_Gender_Validators = (AttributeValidator[])setupAttribMetaData_Gender(validatorMapping).toArray (new AttributeValidator[0]); FIELD_Gender_Validators = (AttributeValidator[])setupAttribMetaData_Gender(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_Password_Validators = (AttributeValidator[])setupAttribMetaData_Password(validatorMapping).toArray (new AttributeValidator[0]); FIELD_Password_Validators = (AttributeValidator[])setupAttribMetaData_Password(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_DateTaken_Validators = (AttributeValidator[])setupAttribMetaData_DateTaken(validatorMapping).toArray (new AttributeValidator[0]); FIELD_DateTaken_Validators = (AttributeValidator[])setupAttribMetaData_DateTaken(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_SectionNo_Validators = (AttributeValidator[])setupAttribMetaData_SectionNo(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_LeftQuestionNo_Validators = (AttributeValidator[])setupAttribMetaData_LeftQuestionNo(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_Location_Validators = (AttributeValidator[])setupAttribMetaData_Location(validatorMapping).toArray (new AttributeValidator[0]); FIELD_Location_Validators = (AttributeValidator[])setupAttribMetaData_Location(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_Phone_Validators = (AttributeValidator[])setupAttribMetaData_Phone(validatorMapping).toArray (new AttributeValidator[0]); FIELD_Phone_Validators = (AttributeValidator[])setupAttribMetaData_Phone(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_Email_Validators = (AttributeValidator[])setupAttribMetaData_Email(validatorMapping).toArray (new AttributeValidator[0]); FIELD_Email_Validators = (AttributeValidator[])setupAttribMetaData_Email(validatorMapping).toArray (new AttributeValidator[0]);
...@@ -372,42 +362,6 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -372,42 +362,6 @@ public abstract class BaseCandidate extends BaseBusinessClass
} }
// Meta Info setup // Meta Info setup
private static List setupAttribMetaData_SectionNo(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "section_number");
metaInfo.put ("name", "SectionNo");
metaInfo.put ("type", "Integer");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Candidate.SectionNo:", metaInfo);
ATTRIBUTES_METADATA_Candidate.put (FIELD_SectionNo, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(Candidate.class, "SectionNo", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for Candidate.SectionNo:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_LeftQuestionNo(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "left_quest_number");
metaInfo.put ("name", "LeftQuestionNo");
metaInfo.put ("type", "Integer");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Candidate.LeftQuestionNo:", metaInfo);
ATTRIBUTES_METADATA_Candidate.put (FIELD_LeftQuestionNo, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(Candidate.class, "LeftQuestionNo", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for Candidate.LeftQuestionNo:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_Location(Map validatorMapping) private static List setupAttribMetaData_Location(Map validatorMapping)
{ {
Map metaInfo = new HashMap (); Map metaInfo = new HashMap ();
...@@ -502,8 +456,6 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -502,8 +456,6 @@ public abstract class BaseCandidate extends BaseBusinessClass
_Gender = (String)(HELPER_Gender.initialise (_Gender)); _Gender = (String)(HELPER_Gender.initialise (_Gender));
_Password = (String)(HELPER_Password.initialise (_Password)); _Password = (String)(HELPER_Password.initialise (_Password));
_DateTaken = (Date)(HELPER_DateTaken.initialise (_DateTaken)); _DateTaken = (Date)(HELPER_DateTaken.initialise (_DateTaken));
_SectionNo = (Integer)(HELPER_SectionNo.initialise (_SectionNo));
_LeftQuestionNo = (Integer)(HELPER_LeftQuestionNo.initialise (_LeftQuestionNo));
_Location = (String)(HELPER_Location.initialise (_Location)); _Location = (String)(HELPER_Location.initialise (_Location));
_Phone = (String)(HELPER_Phone.initialise (_Phone)); _Phone = (String)(HELPER_Phone.initialise (_Phone));
_Email = (String)(HELPER_Email.initialise (_Email)); _Email = (String)(HELPER_Email.initialise (_Email));
...@@ -1610,202 +1562,6 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -1610,202 +1562,6 @@ public abstract class BaseCandidate extends BaseBusinessClass
} }
/** /**
* Get the attribute SectionNo
*/
public Integer getSectionNo ()
{
assertValid();
Integer valToReturn = _SectionNo;
for (CandidateBehaviourDecorator bhd : Candidate_BehaviourDecorators)
{
valToReturn = bhd.getSectionNo ((Candidate)this, valToReturn);
}
return valToReturn;
}
/**
* Called prior to the attribute changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preSectionNoChange (Integer newSectionNo) 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 postSectionNoChange () throws FieldException
{
}
public FieldWriteability getWriteability_SectionNo ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute SectionNo. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setSectionNo (Integer newSectionNo) throws FieldException
{
boolean oldAndNewIdentical = HELPER_SectionNo.compare (_SectionNo, newSectionNo);
try
{
for (CandidateBehaviourDecorator bhd : Candidate_BehaviourDecorators)
{
newSectionNo = bhd.setSectionNo ((Candidate)this, newSectionNo);
oldAndNewIdentical = HELPER_SectionNo.compare (_SectionNo, newSectionNo);
}
if (FIELD_SectionNo_Validators.length > 0)
{
Object newSectionNoObj = HELPER_SectionNo.toObject (newSectionNo);
if (newSectionNoObj != null)
{
int loopMax = FIELD_SectionNo_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_Candidate.get (FIELD_SectionNo);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_SectionNo_Validators[v].checkAttribute (this, FIELD_SectionNo, metadata, newSectionNoObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_SectionNo () != FieldWriteability.FALSE, "Field SectionNo is not writeable");
preSectionNoChange (newSectionNo);
markFieldChange (FIELD_SectionNo);
_SectionNo = newSectionNo;
postFieldChange (FIELD_SectionNo);
postSectionNoChange ();
}
}
/**
* Get the attribute LeftQuestionNo
*/
public Integer getLeftQuestionNo ()
{
assertValid();
Integer valToReturn = _LeftQuestionNo;
for (CandidateBehaviourDecorator bhd : Candidate_BehaviourDecorators)
{
valToReturn = bhd.getLeftQuestionNo ((Candidate)this, valToReturn);
}
return valToReturn;
}
/**
* Called prior to the attribute changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void 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 (CandidateBehaviourDecorator bhd : Candidate_BehaviourDecorators)
{
newLeftQuestionNo = bhd.setLeftQuestionNo ((Candidate)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_Candidate.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 Location * Get the attribute Location
*/ */
public String getLocation () public String getLocation ()
...@@ -2368,8 +2124,6 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -2368,8 +2124,6 @@ public abstract class BaseCandidate extends BaseBusinessClass
candidatePSet.setAttrib (FIELD_Gender, HELPER_Gender.toObject (_Gender)); // candidatePSet.setAttrib (FIELD_Gender, HELPER_Gender.toObject (_Gender)); //
candidatePSet.setAttrib (FIELD_Password, HELPER_Password.toObject (_Password)); // candidatePSet.setAttrib (FIELD_Password, HELPER_Password.toObject (_Password)); //
candidatePSet.setAttrib (FIELD_DateTaken, HELPER_DateTaken.toObject (_DateTaken)); // candidatePSet.setAttrib (FIELD_DateTaken, HELPER_DateTaken.toObject (_DateTaken)); //
candidatePSet.setAttrib (FIELD_SectionNo, HELPER_SectionNo.toObject (_SectionNo)); //
candidatePSet.setAttrib (FIELD_LeftQuestionNo, HELPER_LeftQuestionNo.toObject (_LeftQuestionNo)); //
candidatePSet.setAttrib (FIELD_Location, HELPER_Location.toObject (_Location)); // candidatePSet.setAttrib (FIELD_Location, HELPER_Location.toObject (_Location)); //
candidatePSet.setAttrib (FIELD_Phone, HELPER_Phone.toObject (_Phone)); // candidatePSet.setAttrib (FIELD_Phone, HELPER_Phone.toObject (_Phone)); //
candidatePSet.setAttrib (FIELD_Email, HELPER_Email.toObject (_Email)); // candidatePSet.setAttrib (FIELD_Email, HELPER_Email.toObject (_Email)); //
...@@ -2398,8 +2152,6 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -2398,8 +2152,6 @@ public abstract class BaseCandidate extends BaseBusinessClass
_Gender = (String)(HELPER_Gender.fromObject (_Gender, candidatePSet.getAttrib (FIELD_Gender))); // _Gender = (String)(HELPER_Gender.fromObject (_Gender, candidatePSet.getAttrib (FIELD_Gender))); //
_Password = (String)(HELPER_Password.fromObject (_Password, candidatePSet.getAttrib (FIELD_Password))); // _Password = (String)(HELPER_Password.fromObject (_Password, candidatePSet.getAttrib (FIELD_Password))); //
_DateTaken = (Date)(HELPER_DateTaken.fromObject (_DateTaken, candidatePSet.getAttrib (FIELD_DateTaken))); // _DateTaken = (Date)(HELPER_DateTaken.fromObject (_DateTaken, candidatePSet.getAttrib (FIELD_DateTaken))); //
_SectionNo = (Integer)(HELPER_SectionNo.fromObject (_SectionNo, candidatePSet.getAttrib (FIELD_SectionNo))); //
_LeftQuestionNo = (Integer)(HELPER_LeftQuestionNo.fromObject (_LeftQuestionNo, candidatePSet.getAttrib (FIELD_LeftQuestionNo))); //
_Location = (String)(HELPER_Location.fromObject (_Location, candidatePSet.getAttrib (FIELD_Location))); // _Location = (String)(HELPER_Location.fromObject (_Location, candidatePSet.getAttrib (FIELD_Location))); //
_Phone = (String)(HELPER_Phone.fromObject (_Phone, candidatePSet.getAttrib (FIELD_Phone))); // _Phone = (String)(HELPER_Phone.fromObject (_Phone, candidatePSet.getAttrib (FIELD_Phone))); //
_Email = (String)(HELPER_Email.fromObject (_Email, candidatePSet.getAttrib (FIELD_Email))); // _Email = (String)(HELPER_Email.fromObject (_Email, candidatePSet.getAttrib (FIELD_Email))); //
...@@ -2519,24 +2271,6 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -2519,24 +2271,6 @@ public abstract class BaseCandidate extends BaseBusinessClass
try try
{ {
setSectionNo (otherCandidate.getSectionNo ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setLeftQuestionNo (otherCandidate.getLeftQuestionNo ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setLocation (otherCandidate.getLocation ()); setLocation (otherCandidate.getLocation ());
} }
catch (FieldException ex) catch (FieldException ex)
...@@ -2588,8 +2322,6 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -2588,8 +2322,6 @@ public abstract class BaseCandidate extends BaseBusinessClass
_Gender = sourceCandidate._Gender; _Gender = sourceCandidate._Gender;
_Password = sourceCandidate._Password; _Password = sourceCandidate._Password;
_DateTaken = sourceCandidate._DateTaken; _DateTaken = sourceCandidate._DateTaken;
_SectionNo = sourceCandidate._SectionNo;
_LeftQuestionNo = sourceCandidate._LeftQuestionNo;
_Location = sourceCandidate._Location; _Location = sourceCandidate._Location;
_Phone = sourceCandidate._Phone; _Phone = sourceCandidate._Phone;
_Email = sourceCandidate._Email; _Email = sourceCandidate._Email;
...@@ -2656,8 +2388,6 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -2656,8 +2388,6 @@ public abstract class BaseCandidate extends BaseBusinessClass
_Gender = (String)(HELPER_Gender.readExternal (_Gender, vals.get(FIELD_Gender))); // _Gender = (String)(HELPER_Gender.readExternal (_Gender, vals.get(FIELD_Gender))); //
_Password = (String)(HELPER_Password.readExternal (_Password, vals.get(FIELD_Password))); // _Password = (String)(HELPER_Password.readExternal (_Password, vals.get(FIELD_Password))); //
_DateTaken = (Date)(HELPER_DateTaken.readExternal (_DateTaken, vals.get(FIELD_DateTaken))); // _DateTaken = (Date)(HELPER_DateTaken.readExternal (_DateTaken, vals.get(FIELD_DateTaken))); //
_SectionNo = (Integer)(HELPER_SectionNo.readExternal (_SectionNo, vals.get(FIELD_SectionNo))); //
_LeftQuestionNo = (Integer)(HELPER_LeftQuestionNo.readExternal (_LeftQuestionNo, vals.get(FIELD_LeftQuestionNo))); //
_Location = (String)(HELPER_Location.readExternal (_Location, vals.get(FIELD_Location))); // _Location = (String)(HELPER_Location.readExternal (_Location, vals.get(FIELD_Location))); //
_Phone = (String)(HELPER_Phone.readExternal (_Phone, vals.get(FIELD_Phone))); // _Phone = (String)(HELPER_Phone.readExternal (_Phone, vals.get(FIELD_Phone))); //
_Email = (String)(HELPER_Email.readExternal (_Email, vals.get(FIELD_Email))); // _Email = (String)(HELPER_Email.readExternal (_Email, vals.get(FIELD_Email))); //
...@@ -2683,8 +2413,6 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -2683,8 +2413,6 @@ public abstract class BaseCandidate extends BaseBusinessClass
vals.put (FIELD_Gender, HELPER_Gender.writeExternal (_Gender)); vals.put (FIELD_Gender, HELPER_Gender.writeExternal (_Gender));
vals.put (FIELD_Password, HELPER_Password.writeExternal (_Password)); vals.put (FIELD_Password, HELPER_Password.writeExternal (_Password));
vals.put (FIELD_DateTaken, HELPER_DateTaken.writeExternal (_DateTaken)); vals.put (FIELD_DateTaken, HELPER_DateTaken.writeExternal (_DateTaken));
vals.put (FIELD_SectionNo, HELPER_SectionNo.writeExternal (_SectionNo));
vals.put (FIELD_LeftQuestionNo, HELPER_LeftQuestionNo.writeExternal (_LeftQuestionNo));
vals.put (FIELD_Location, HELPER_Location.writeExternal (_Location)); vals.put (FIELD_Location, HELPER_Location.writeExternal (_Location));
vals.put (FIELD_Phone, HELPER_Phone.writeExternal (_Phone)); vals.put (FIELD_Phone, HELPER_Phone.writeExternal (_Phone));
vals.put (FIELD_Email, HELPER_Email.writeExternal (_Email)); vals.put (FIELD_Email, HELPER_Email.writeExternal (_Email));
...@@ -2745,14 +2473,6 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -2745,14 +2473,6 @@ public abstract class BaseCandidate extends BaseBusinessClass
{ {
listener.notifyFieldChange(this, other, FIELD_DateTaken, HELPER_DateTaken.toObject(this._DateTaken), HELPER_DateTaken.toObject(otherCandidate._DateTaken)); listener.notifyFieldChange(this, other, FIELD_DateTaken, HELPER_DateTaken.toObject(this._DateTaken), HELPER_DateTaken.toObject(otherCandidate._DateTaken));
} }
if (!HELPER_SectionNo.compare(this._SectionNo, otherCandidate._SectionNo))
{
listener.notifyFieldChange(this, other, FIELD_SectionNo, HELPER_SectionNo.toObject(this._SectionNo), HELPER_SectionNo.toObject(otherCandidate._SectionNo));
}
if (!HELPER_LeftQuestionNo.compare(this._LeftQuestionNo, otherCandidate._LeftQuestionNo))
{
listener.notifyFieldChange(this, other, FIELD_LeftQuestionNo, HELPER_LeftQuestionNo.toObject(this._LeftQuestionNo), HELPER_LeftQuestionNo.toObject(otherCandidate._LeftQuestionNo));
}
if (!HELPER_Location.compare(this._Location, otherCandidate._Location)) if (!HELPER_Location.compare(this._Location, otherCandidate._Location))
{ {
listener.notifyFieldChange(this, other, FIELD_Location, HELPER_Location.toObject(this._Location), HELPER_Location.toObject(otherCandidate._Location)); listener.notifyFieldChange(this, other, FIELD_Location, HELPER_Location.toObject(this._Location), HELPER_Location.toObject(otherCandidate._Location));
...@@ -2798,8 +2518,6 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -2798,8 +2518,6 @@ public abstract class BaseCandidate extends BaseBusinessClass
visitor.visitField(this, FIELD_Gender, HELPER_Gender.toObject(getGender())); visitor.visitField(this, FIELD_Gender, HELPER_Gender.toObject(getGender()));
visitor.visitField(this, FIELD_Password, HELPER_Password.toObject(getPassword())); visitor.visitField(this, FIELD_Password, HELPER_Password.toObject(getPassword()));
visitor.visitField(this, FIELD_DateTaken, HELPER_DateTaken.toObject(getDateTaken())); visitor.visitField(this, FIELD_DateTaken, HELPER_DateTaken.toObject(getDateTaken()));
visitor.visitField(this, FIELD_SectionNo, HELPER_SectionNo.toObject(getSectionNo()));
visitor.visitField(this, FIELD_LeftQuestionNo, HELPER_LeftQuestionNo.toObject(getLeftQuestionNo()));
visitor.visitField(this, FIELD_Location, HELPER_Location.toObject(getLocation())); visitor.visitField(this, FIELD_Location, HELPER_Location.toObject(getLocation()));
visitor.visitField(this, FIELD_Phone, HELPER_Phone.toObject(getPhone())); visitor.visitField(this, FIELD_Phone, HELPER_Phone.toObject(getPhone()));
visitor.visitField(this, FIELD_Email, HELPER_Email.toObject(getEmail())); visitor.visitField(this, FIELD_Email, HELPER_Email.toObject(getEmail()));
...@@ -2880,14 +2598,6 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -2880,14 +2598,6 @@ public abstract class BaseCandidate extends BaseBusinessClass
{ {
return filter.matches (getDateTaken ()); return filter.matches (getDateTaken ());
} }
else if (attribName.equals (FIELD_SectionNo))
{
return filter.matches (getSectionNo ());
}
else if (attribName.equals (FIELD_LeftQuestionNo))
{
return filter.matches (getLeftQuestionNo ());
}
else if (attribName.equals (FIELD_Location)) else if (attribName.equals (FIELD_Location))
{ {
return filter.matches (getLocation ()); return filter.matches (getLocation ());
...@@ -2959,14 +2669,6 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -2959,14 +2669,6 @@ public abstract class BaseCandidate extends BaseBusinessClass
{ {
return HELPER_DateTaken.toObject (getDateTaken ()); return HELPER_DateTaken.toObject (getDateTaken ());
} }
else if (attribName.equals (FIELD_SectionNo))
{
return HELPER_SectionNo.toObject (getSectionNo ());
}
else if (attribName.equals (FIELD_LeftQuestionNo))
{
return HELPER_LeftQuestionNo.toObject (getLeftQuestionNo ());
}
else if (attribName.equals (FIELD_Location)) else if (attribName.equals (FIELD_Location))
{ {
return HELPER_Location.toObject (getLocation ()); return HELPER_Location.toObject (getLocation ());
...@@ -3036,14 +2738,6 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -3036,14 +2738,6 @@ public abstract class BaseCandidate extends BaseBusinessClass
{ {
return HELPER_DateTaken; return HELPER_DateTaken;
} }
else if (attribName.equals (FIELD_SectionNo))
{
return HELPER_SectionNo;
}
else if (attribName.equals (FIELD_LeftQuestionNo))
{
return HELPER_LeftQuestionNo;
}
else if (attribName.equals (FIELD_Location)) else if (attribName.equals (FIELD_Location))
{ {
return HELPER_Location; return HELPER_Location;
...@@ -3113,14 +2807,6 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -3113,14 +2807,6 @@ public abstract class BaseCandidate extends BaseBusinessClass
{ {
setDateTaken ((Date)(HELPER_DateTaken.fromObject (_DateTaken, attribValue))); setDateTaken ((Date)(HELPER_DateTaken.fromObject (_DateTaken, attribValue)));
} }
else if (attribName.equals (FIELD_SectionNo))
{
setSectionNo ((Integer)(HELPER_SectionNo.fromObject (_SectionNo, attribValue)));
}
else if (attribName.equals (FIELD_LeftQuestionNo))
{
setLeftQuestionNo ((Integer)(HELPER_LeftQuestionNo.fromObject (_LeftQuestionNo, attribValue)));
}
else if (attribName.equals (FIELD_Location)) else if (attribName.equals (FIELD_Location))
{ {
setLocation ((String)(HELPER_Location.fromObject (_Location, attribValue))); setLocation ((String)(HELPER_Location.fromObject (_Location, attribValue)));
...@@ -3197,14 +2883,6 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -3197,14 +2883,6 @@ public abstract class BaseCandidate extends BaseBusinessClass
{ {
return getWriteability_DateTaken (); return getWriteability_DateTaken ();
} }
else if (fieldName.equals (FIELD_SectionNo))
{
return getWriteability_SectionNo ();
}
else if (fieldName.equals (FIELD_LeftQuestionNo))
{
return getWriteability_LeftQuestionNo ();
}
else if (fieldName.equals (FIELD_Location)) else if (fieldName.equals (FIELD_Location))
{ {
return getWriteability_Location (); return getWriteability_Location ();
...@@ -3282,16 +2960,6 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -3282,16 +2960,6 @@ public abstract class BaseCandidate extends BaseBusinessClass
fields.add (FIELD_DateTaken); fields.add (FIELD_DateTaken);
} }
if (getWriteability_SectionNo () != FieldWriteability.TRUE)
{
fields.add (FIELD_SectionNo);
}
if (getWriteability_LeftQuestionNo () != FieldWriteability.TRUE)
{
fields.add (FIELD_LeftQuestionNo);
}
if (getWriteability_Location () != FieldWriteability.TRUE) if (getWriteability_Location () != FieldWriteability.TRUE)
{ {
fields.add (FIELD_Location); fields.add (FIELD_Location);
...@@ -3327,8 +2995,6 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -3327,8 +2995,6 @@ public abstract class BaseCandidate extends BaseBusinessClass
result.add(HELPER_Gender.getAttribObject (getClass (), _Gender, false, FIELD_Gender)); result.add(HELPER_Gender.getAttribObject (getClass (), _Gender, false, FIELD_Gender));
result.add(HELPER_Password.getAttribObject (getClass (), _Password, false, FIELD_Password)); result.add(HELPER_Password.getAttribObject (getClass (), _Password, false, FIELD_Password));
result.add(HELPER_DateTaken.getAttribObject (getClass (), _DateTaken, false, FIELD_DateTaken)); result.add(HELPER_DateTaken.getAttribObject (getClass (), _DateTaken, false, FIELD_DateTaken));
result.add(HELPER_SectionNo.getAttribObject (getClass (), _SectionNo, false, FIELD_SectionNo));
result.add(HELPER_LeftQuestionNo.getAttribObject (getClass (), _LeftQuestionNo, false, FIELD_LeftQuestionNo));
result.add(HELPER_Location.getAttribObject (getClass (), _Location, false, FIELD_Location)); result.add(HELPER_Location.getAttribObject (getClass (), _Location, false, FIELD_Location));
result.add(HELPER_Phone.getAttribObject (getClass (), _Phone, false, FIELD_Phone)); result.add(HELPER_Phone.getAttribObject (getClass (), _Phone, false, FIELD_Phone));
result.add(HELPER_Email.getAttribObject (getClass (), _Email, false, FIELD_Email)); result.add(HELPER_Email.getAttribObject (getClass (), _Email, false, FIELD_Email));
...@@ -3581,42 +3247,6 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -3581,42 +3247,6 @@ public abstract class BaseCandidate extends BaseBusinessClass
} }
/** /**
* Get the attribute SectionNo
*/
public Integer getSectionNo (Candidate obj, Integer original)
{
return original;
}
/**
* Change the value set for attribute SectionNo.
* May modify the field beforehand
* Occurs before validation.
*/
public Integer setSectionNo (Candidate obj, Integer newSectionNo) throws FieldException
{
return newSectionNo;
}
/**
* Get the attribute LeftQuestionNo
*/
public Integer getLeftQuestionNo (Candidate obj, Integer original)
{
return original;
}
/**
* Change the value set for attribute LeftQuestionNo.
* May modify the field beforehand
* Occurs before validation.
*/
public Integer setLeftQuestionNo (Candidate obj, Integer newLeftQuestionNo) throws FieldException
{
return newLeftQuestionNo;
}
/**
* Get the attribute Location * Get the attribute Location
*/ */
public String getLocation (Candidate obj, String original) public String getLocation (Candidate obj, String original)
...@@ -3766,14 +3396,6 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -3766,14 +3396,6 @@ public abstract class BaseCandidate extends BaseBusinessClass
{ {
return toDateTaken (); return toDateTaken ();
} }
if (name.equals ("SectionNo"))
{
return toSectionNo ();
}
if (name.equals ("LeftQuestionNo"))
{
return toLeftQuestionNo ();
}
if (name.equals ("Location")) if (name.equals ("Location"))
{ {
return toLocation (); return toLocation ();
...@@ -3814,10 +3436,6 @@ public abstract class BaseCandidate extends BaseBusinessClass ...@@ -3814,10 +3436,6 @@ public abstract class BaseCandidate extends BaseBusinessClass
public PipeLine<From, Date> toDateTaken () { return pipe(new ORMAttributePipe<Me, Date>(FIELD_DateTaken)); } public PipeLine<From, Date> toDateTaken () { return pipe(new ORMAttributePipe<Me, Date>(FIELD_DateTaken)); }
public PipeLine<From, Integer> toSectionNo () { return pipe(new ORMAttributePipe<Me, Integer>(FIELD_SectionNo)); }
public PipeLine<From, Integer> toLeftQuestionNo () { return pipe(new ORMAttributePipe<Me, Integer>(FIELD_LeftQuestionNo)); }
public PipeLine<From, String> toLocation () { return pipe(new ORMAttributePipe<Me, String>(FIELD_Location)); } public PipeLine<From, String> toLocation () { return pipe(new ORMAttributePipe<Me, String>(FIELD_Location)); }
public PipeLine<From, String> toPhone () { return pipe(new ORMAttributePipe<Me, String>(FIELD_Phone)); } public PipeLine<From, String> toPhone () { return pipe(new ORMAttributePipe<Me, String>(FIELD_Phone)); }
......
...@@ -38,11 +38,9 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -38,11 +38,9 @@ public abstract class BaseFactor extends BaseBusinessClass
// Static constants corresponding to field names // Static constants corresponding to field names
public static final String FIELD_FactorNo = "FactorNo";
public static final String FIELD_Description = "Description"; public static final String FIELD_Description = "Description";
public static final String FIELD_ClassCode = "ClassCode"; public static final String FIELD_ClassCode = "ClassCode";
public static final String FIELD_Notes = "Notes"; public static final String FIELD_Notes = "Notes";
public static final String FIELD_LevelNo = "LevelNo";
public static final String FIELD_LeftAnnot = "LeftAnnot"; public static final String FIELD_LeftAnnot = "LeftAnnot";
public static final String FIELD_RightAnnot = "RightAnnot"; public static final String FIELD_RightAnnot = "RightAnnot";
public static final String FIELD_DescriptionSchinese = "DescriptionSchinese"; public static final String FIELD_DescriptionSchinese = "DescriptionSchinese";
...@@ -51,16 +49,16 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -51,16 +49,16 @@ public abstract class BaseFactor extends BaseBusinessClass
public static final String FIELD_DescriptionThai = "DescriptionThai"; public static final String FIELD_DescriptionThai = "DescriptionThai";
public static final String FIELD_ZScoreWeight = "ZScoreWeight"; public static final String FIELD_ZScoreWeight = "ZScoreWeight";
public static final String FIELD_ZScoreWeight2 = "ZScoreWeight2"; public static final String FIELD_ZScoreWeight2 = "ZScoreWeight2";
public static final String SINGLEREFERENCE_Level = "Level";
public static final String BACKREF_Level = "";
// 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<Factor> HELPER_FactorNo = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Factor> HELPER_Description = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper<Factor> HELPER_Description = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Factor> HELPER_ClassCode = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper<Factor> HELPER_ClassCode = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Factor> HELPER_Notes = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper<Factor> HELPER_Notes = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Factor> HELPER_LevelNo = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Factor> HELPER_LeftAnnot = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper<Factor> HELPER_LeftAnnot = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Factor> HELPER_RightAnnot = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper<Factor> HELPER_RightAnnot = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Factor> HELPER_DescriptionSchinese = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper<Factor> HELPER_DescriptionSchinese = DefaultAttributeHelper.INSTANCE;
...@@ -72,11 +70,9 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -72,11 +70,9 @@ public abstract class BaseFactor extends BaseBusinessClass
// Private attributes corresponding to business object data // Private attributes corresponding to business object data
private Integer _FactorNo;
private String _Description; private String _Description;
private String _ClassCode; private String _ClassCode;
private String _Notes; private String _Notes;
private Integer _LevelNo;
private String _LeftAnnot; private String _LeftAnnot;
private String _RightAnnot; private String _RightAnnot;
private String _DescriptionSchinese; private String _DescriptionSchinese;
...@@ -88,6 +84,7 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -88,6 +84,7 @@ public abstract class BaseFactor extends BaseBusinessClass
// Private attributes corresponding to single references // Private attributes corresponding to single references
private SingleAssociation<Factor, Level> _Level;
// Private attributes corresponding to multiple references // Private attributes corresponding to multiple references
...@@ -97,11 +94,9 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -97,11 +94,9 @@ public abstract class BaseFactor extends BaseBusinessClass
private static final Map ATTRIBUTES_METADATA_Factor = new HashMap (); private static final Map ATTRIBUTES_METADATA_Factor = new HashMap ();
// Arrays of validators for each attribute // Arrays of validators for each attribute
private static final AttributeValidator[] FIELD_FactorNo_Validators;
private static final AttributeValidator[] FIELD_Description_Validators; private static final AttributeValidator[] FIELD_Description_Validators;
private static final AttributeValidator[] FIELD_ClassCode_Validators; private static final AttributeValidator[] FIELD_ClassCode_Validators;
private static final AttributeValidator[] FIELD_Notes_Validators; private static final AttributeValidator[] FIELD_Notes_Validators;
private static final AttributeValidator[] FIELD_LevelNo_Validators;
private static final AttributeValidator[] FIELD_LeftAnnot_Validators; private static final AttributeValidator[] FIELD_LeftAnnot_Validators;
private static final AttributeValidator[] FIELD_RightAnnot_Validators; private static final AttributeValidator[] FIELD_RightAnnot_Validators;
private static final AttributeValidator[] FIELD_DescriptionSchinese_Validators; private static final AttributeValidator[] FIELD_DescriptionSchinese_Validators;
...@@ -120,14 +115,14 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -120,14 +115,14 @@ public abstract class BaseFactor extends BaseBusinessClass
try try
{ {
String tmp_Level = Level.BACKREF_Factors;
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping")); Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
FIELD_FactorNo_Validators = (AttributeValidator[])setupAttribMetaData_FactorNo(validatorMapping).toArray (new AttributeValidator[0]); setupAssocMetaData_Level();
FIELD_Description_Validators = (AttributeValidator[])setupAttribMetaData_Description(validatorMapping).toArray (new AttributeValidator[0]); FIELD_Description_Validators = (AttributeValidator[])setupAttribMetaData_Description(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_ClassCode_Validators = (AttributeValidator[])setupAttribMetaData_ClassCode(validatorMapping).toArray (new AttributeValidator[0]); FIELD_ClassCode_Validators = (AttributeValidator[])setupAttribMetaData_ClassCode(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_Notes_Validators = (AttributeValidator[])setupAttribMetaData_Notes(validatorMapping).toArray (new AttributeValidator[0]); FIELD_Notes_Validators = (AttributeValidator[])setupAttribMetaData_Notes(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_LevelNo_Validators = (AttributeValidator[])setupAttribMetaData_LevelNo(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_LeftAnnot_Validators = (AttributeValidator[])setupAttribMetaData_LeftAnnot(validatorMapping).toArray (new AttributeValidator[0]); FIELD_LeftAnnot_Validators = (AttributeValidator[])setupAttribMetaData_LeftAnnot(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_RightAnnot_Validators = (AttributeValidator[])setupAttribMetaData_RightAnnot(validatorMapping).toArray (new AttributeValidator[0]); FIELD_RightAnnot_Validators = (AttributeValidator[])setupAttribMetaData_RightAnnot(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_DescriptionSchinese_Validators = (AttributeValidator[])setupAttribMetaData_DescriptionSchinese(validatorMapping).toArray (new AttributeValidator[0]); FIELD_DescriptionSchinese_Validators = (AttributeValidator[])setupAttribMetaData_DescriptionSchinese(validatorMapping).toArray (new AttributeValidator[0]);
...@@ -151,23 +146,20 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -151,23 +146,20 @@ public abstract class BaseFactor extends BaseBusinessClass
// Meta Info setup // Meta Info setup
private static List setupAttribMetaData_FactorNo(Map validatorMapping) private static void setupAssocMetaData_Level()
{ {
Map metaInfo = new HashMap (); Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "factor_number"); metaInfo.put ("backreferenceName", "Factors");
metaInfo.put ("name", "FactorNo"); metaInfo.put ("dbcol", "level_number");
metaInfo.put ("type", "Integer"); metaInfo.put ("name", "Level");
metaInfo.put ("type", "Level");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Factor.FactorNo:", metaInfo); LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Factor.Level:", metaInfo);
ATTRIBUTES_METADATA_Factor.put (FIELD_FactorNo, Collections.unmodifiableMap (metaInfo)); ATTRIBUTES_METADATA_Factor.put (SINGLEREFERENCE_Level, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(Factor.class, "FactorNo", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for Factor.FactorNo:", validators);
return validators;
} }
// Meta Info setup // Meta Info setup
private static List setupAttribMetaData_Description(Map validatorMapping) private static List setupAttribMetaData_Description(Map validatorMapping)
{ {
...@@ -225,24 +217,6 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -225,24 +217,6 @@ public abstract class BaseFactor 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 Factor.LevelNo:", metaInfo);
ATTRIBUTES_METADATA_Factor.put (FIELD_LevelNo, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(Factor.class, "LevelNo", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for Factor.LevelNo:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_LeftAnnot(Map validatorMapping) private static List setupAttribMetaData_LeftAnnot(Map validatorMapping)
{ {
Map metaInfo = new HashMap (); Map metaInfo = new HashMap ();
...@@ -419,11 +393,9 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -419,11 +393,9 @@ public abstract class BaseFactor extends BaseBusinessClass
super._initialiseNewObjAttributes (transaction); super._initialiseNewObjAttributes (transaction);
_FactorNo = (Integer)(HELPER_FactorNo.initialise (_FactorNo));
_Description = (String)(HELPER_Description.initialise (_Description)); _Description = (String)(HELPER_Description.initialise (_Description));
_ClassCode = (String)(HELPER_ClassCode.initialise (_ClassCode)); _ClassCode = (String)(HELPER_ClassCode.initialise (_ClassCode));
_Notes = (String)(HELPER_Notes.initialise (_Notes)); _Notes = (String)(HELPER_Notes.initialise (_Notes));
_LevelNo = (Integer)(HELPER_LevelNo.initialise (_LevelNo));
_LeftAnnot = (String)(HELPER_LeftAnnot.initialise (_LeftAnnot)); _LeftAnnot = (String)(HELPER_LeftAnnot.initialise (_LeftAnnot));
_RightAnnot = (String)(HELPER_RightAnnot.initialise (_RightAnnot)); _RightAnnot = (String)(HELPER_RightAnnot.initialise (_RightAnnot));
_DescriptionSchinese = (String)(HELPER_DescriptionSchinese.initialise (_DescriptionSchinese)); _DescriptionSchinese = (String)(HELPER_DescriptionSchinese.initialise (_DescriptionSchinese));
...@@ -440,6 +412,7 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -440,6 +412,7 @@ public abstract class BaseFactor extends BaseBusinessClass
{ {
super._initialiseAssociations (); super._initialiseAssociations ();
_Level = new SingleAssociation<Factor, Level> (this, SINGLEREFERENCE_Level, Level.MULTIPLEREFERENCE_Factors, Level.REFERENCE_Level, "factor_hdr");
} }
...@@ -449,6 +422,7 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -449,6 +422,7 @@ public abstract class BaseFactor extends BaseBusinessClass
{ {
super.initialiseReference (); super.initialiseReference ();
_Level = new SingleAssociation<Factor, Level> (this, SINGLEREFERENCE_Level, Level.MULTIPLEREFERENCE_Factors, Level.REFERENCE_Level, "factor_hdr");
return this; return this;
...@@ -457,104 +431,6 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -457,104 +431,6 @@ public abstract class BaseFactor extends BaseBusinessClass
/** /**
* Get the attribute FactorNo
*/
public Integer getFactorNo ()
{
assertValid();
Integer valToReturn = _FactorNo;
for (FactorBehaviourDecorator bhd : Factor_BehaviourDecorators)
{
valToReturn = bhd.getFactorNo ((Factor)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 preFactorNoChange (Integer newFactorNo) 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 postFactorNoChange () throws FieldException
{
}
public FieldWriteability getWriteability_FactorNo ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute FactorNo. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setFactorNo (Integer newFactorNo) throws FieldException
{
boolean oldAndNewIdentical = HELPER_FactorNo.compare (_FactorNo, newFactorNo);
try
{
for (FactorBehaviourDecorator bhd : Factor_BehaviourDecorators)
{
newFactorNo = bhd.setFactorNo ((Factor)this, newFactorNo);
oldAndNewIdentical = HELPER_FactorNo.compare (_FactorNo, newFactorNo);
}
if (FIELD_FactorNo_Validators.length > 0)
{
Object newFactorNoObj = HELPER_FactorNo.toObject (newFactorNo);
if (newFactorNoObj != null)
{
int loopMax = FIELD_FactorNo_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_Factor.get (FIELD_FactorNo);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_FactorNo_Validators[v].checkAttribute (this, FIELD_FactorNo, metadata, newFactorNoObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_FactorNo () != FieldWriteability.FALSE, "Field FactorNo is not writeable");
preFactorNoChange (newFactorNo);
markFieldChange (FIELD_FactorNo);
_FactorNo = newFactorNo;
postFieldChange (FIELD_FactorNo);
postFactorNoChange ();
}
}
/**
* Get the attribute Description * Get the attribute Description
*/ */
public String getDescription () public String getDescription ()
...@@ -849,104 +725,6 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -849,104 +725,6 @@ public abstract class BaseFactor extends BaseBusinessClass
} }
/** /**
* Get the attribute LevelNo
*/
public Integer getLevelNo ()
{
assertValid();
Integer valToReturn = _LevelNo;
for (FactorBehaviourDecorator bhd : Factor_BehaviourDecorators)
{
valToReturn = bhd.getLevelNo ((Factor)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 preLevelNoChange (Integer newLevelNo) 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 postLevelNoChange () throws FieldException
{
}
public FieldWriteability getWriteability_LevelNo ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute LevelNo. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setLevelNo (Integer newLevelNo) throws FieldException
{
boolean oldAndNewIdentical = HELPER_LevelNo.compare (_LevelNo, newLevelNo);
try
{
for (FactorBehaviourDecorator bhd : Factor_BehaviourDecorators)
{
newLevelNo = bhd.setLevelNo ((Factor)this, newLevelNo);
oldAndNewIdentical = HELPER_LevelNo.compare (_LevelNo, newLevelNo);
}
if (FIELD_LevelNo_Validators.length > 0)
{
Object newLevelNoObj = HELPER_LevelNo.toObject (newLevelNo);
if (newLevelNoObj != null)
{
int loopMax = FIELD_LevelNo_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_Factor.get (FIELD_LevelNo);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_LevelNo_Validators[v].checkAttribute (this, FIELD_LevelNo, metadata, newLevelNoObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_LevelNo () != FieldWriteability.FALSE, "Field LevelNo is not writeable");
preLevelNoChange (newLevelNo);
markFieldChange (FIELD_LevelNo);
_LevelNo = newLevelNo;
postFieldChange (FIELD_LevelNo);
postLevelNoChange ();
}
}
/**
* Get the attribute LeftAnnot * Get the attribute LeftAnnot
*/ */
public String getLeftAnnot () public String getLeftAnnot ()
...@@ -1740,6 +1518,8 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -1740,6 +1518,8 @@ public abstract class BaseFactor extends BaseBusinessClass
List result = super.getSingleAssocs (); List result = super.getSingleAssocs ();
result.add("Level");
return result; return result;
} }
...@@ -1751,7 +1531,10 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -1751,7 +1531,10 @@ public abstract class BaseFactor extends BaseBusinessClass
{ {
throw new RuntimeException ("Game over == null!"); throw new RuntimeException ("Game over == null!");
} }
else if (assocName.equals (SINGLEREFERENCE_Level))
{
return _Level.getReferencedType ();
}
else else
{ {
return super.getSingleAssocReferenceInstance (assocName); return super.getSingleAssocReferenceInstance (assocName);
...@@ -1765,7 +1548,10 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -1765,7 +1548,10 @@ public abstract class BaseFactor extends BaseBusinessClass
{ {
throw new RuntimeException ("Game over == null!"); throw new RuntimeException ("Game over == null!");
} }
else if (assocName.equals (SINGLEREFERENCE_Level))
{
return Level.MULTIPLEREFERENCE_Factors ;
}
else else
{ {
return super.getSingleAssocBackReference (assocName); return super.getSingleAssocBackReference (assocName);
...@@ -1779,7 +1565,10 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -1779,7 +1565,10 @@ public abstract class BaseFactor extends BaseBusinessClass
{ {
throw new RuntimeException ("Game over == null!"); throw new RuntimeException ("Game over == null!");
} }
else if (assocName.equals (SINGLEREFERENCE_Level))
{
return getLevel ();
}
else else
{ {
return super.getSingleAssoc (assocName); return super.getSingleAssoc (assocName);
...@@ -1793,7 +1582,10 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -1793,7 +1582,10 @@ public abstract class BaseFactor extends BaseBusinessClass
{ {
throw new RuntimeException ("Game over == null!"); throw new RuntimeException ("Game over == null!");
} }
else if (assocName.equals (SINGLEREFERENCE_Level))
{
return getLevel (getType);
}
else else
{ {
return super.getSingleAssoc (assocName, getType); return super.getSingleAssoc (assocName, getType);
...@@ -1807,7 +1599,10 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -1807,7 +1599,10 @@ public abstract class BaseFactor extends BaseBusinessClass
{ {
throw new RuntimeException ("Game over == null!"); throw new RuntimeException ("Game over == null!");
} }
else if (assocName.equals (SINGLEREFERENCE_Level))
{
return getLevelID ();
}
else else
{ {
return super.getSingleAssocID (assocName); return super.getSingleAssocID (assocName);
...@@ -1821,7 +1616,10 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -1821,7 +1616,10 @@ public abstract class BaseFactor extends BaseBusinessClass
{ {
throw new RuntimeException ("Game over == null!"); throw new RuntimeException ("Game over == null!");
} }
else if (assocName.equals (SINGLEREFERENCE_Level))
{
setLevel ((Level)(newValue));
}
else else
{ {
super.setSingleAssoc (assocName, newValue); super.setSingleAssoc (assocName, newValue);
...@@ -1831,6 +1629,113 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -1831,6 +1629,113 @@ public abstract class BaseFactor extends BaseBusinessClass
/** /**
* Get the reference Level
*/
public Level getLevel () throws StorageException
{
assertValid();
try
{
return (Level)(_Level.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in Factor:", this.getObjectID (), ", was trying to get Level:", getLevelID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _Level.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Level getLevel (Get getType) throws StorageException
{
assertValid();
return _Level.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getLevelID ()
{
assertValid();
if (_Level == null)
{
return null;
}
else
{
return _Level.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 preLevelChange (Level newLevel) 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 postLevelChange () throws FieldException
{
}
public FieldWriteability getWriteability_Level ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference Level. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setLevel (Level newLevel) throws StorageException, FieldException
{
if (_Level.wouldReferencedChange (newLevel))
{
assertValid();
Debug.assertion (getWriteability_Level () != FieldWriteability.FALSE, "Assoc Level is not writeable");
preLevelChange (newLevel);
Level oldLevel = getLevel ();
if (oldLevel != null)
{
// This is to stop validation from triggering when we are removed
_Level.set (null);
oldLevel.removeFromFactors ((Factor)(this));
}
_Level.set (newLevel);
if (newLevel != null)
{
newLevel.addToFactors ((Factor)(this));
}
postLevelChange ();
}
}
/**
* 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()
...@@ -1928,6 +1833,20 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -1928,6 +1833,20 @@ public abstract class BaseFactor extends BaseBusinessClass
{ {
try try
{ {
// Ensure we are removed from any loaded multi-associations that aren't mandatory
if (_Level.isLoaded () || getTransaction ().isObjectLoaded (_Level.getReferencedType (), getLevelID ()))
{
Level referenced = getLevel ();
if (referenced != null)
{
// Stop the callback
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null Factors from ", getObjectID (), " to ", referenced.getObjectID ());
_Level.set (null);
referenced.removeFromFactors ((Factor)this);
}
}
} }
catch (Exception e) catch (Exception e)
{ {
...@@ -1988,11 +1907,9 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -1988,11 +1907,9 @@ public abstract class BaseFactor extends BaseBusinessClass
PersistentSet factor_hdrPSet = allSets.getPersistentSet (myID, "factor_hdr", myPSetStatus); PersistentSet factor_hdrPSet = allSets.getPersistentSet (myID, "factor_hdr", myPSetStatus);
factor_hdrPSet.setAttrib (FIELD_ObjectID, myID); factor_hdrPSet.setAttrib (FIELD_ObjectID, myID);
factor_hdrPSet.setAttrib (FIELD_FactorNo, HELPER_FactorNo.toObject (_FactorNo)); //
factor_hdrPSet.setAttrib (FIELD_Description, HELPER_Description.toObject (_Description)); // factor_hdrPSet.setAttrib (FIELD_Description, HELPER_Description.toObject (_Description)); //
factor_hdrPSet.setAttrib (FIELD_ClassCode, HELPER_ClassCode.toObject (_ClassCode)); // factor_hdrPSet.setAttrib (FIELD_ClassCode, HELPER_ClassCode.toObject (_ClassCode)); //
factor_hdrPSet.setAttrib (FIELD_Notes, HELPER_Notes.toObject (_Notes)); // factor_hdrPSet.setAttrib (FIELD_Notes, HELPER_Notes.toObject (_Notes)); //
factor_hdrPSet.setAttrib (FIELD_LevelNo, HELPER_LevelNo.toObject (_LevelNo)); //
factor_hdrPSet.setAttrib (FIELD_LeftAnnot, HELPER_LeftAnnot.toObject (_LeftAnnot)); // factor_hdrPSet.setAttrib (FIELD_LeftAnnot, HELPER_LeftAnnot.toObject (_LeftAnnot)); //
factor_hdrPSet.setAttrib (FIELD_RightAnnot, HELPER_RightAnnot.toObject (_RightAnnot)); // factor_hdrPSet.setAttrib (FIELD_RightAnnot, HELPER_RightAnnot.toObject (_RightAnnot)); //
factor_hdrPSet.setAttrib (FIELD_DescriptionSchinese, HELPER_DescriptionSchinese.toObject (_DescriptionSchinese)); // factor_hdrPSet.setAttrib (FIELD_DescriptionSchinese, HELPER_DescriptionSchinese.toObject (_DescriptionSchinese)); //
...@@ -2001,6 +1918,7 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -2001,6 +1918,7 @@ public abstract class BaseFactor extends BaseBusinessClass
factor_hdrPSet.setAttrib (FIELD_DescriptionThai, HELPER_DescriptionThai.toObject (_DescriptionThai)); // factor_hdrPSet.setAttrib (FIELD_DescriptionThai, HELPER_DescriptionThai.toObject (_DescriptionThai)); //
factor_hdrPSet.setAttrib (FIELD_ZScoreWeight, HELPER_ZScoreWeight.toObject (_ZScoreWeight)); // factor_hdrPSet.setAttrib (FIELD_ZScoreWeight, HELPER_ZScoreWeight.toObject (_ZScoreWeight)); //
factor_hdrPSet.setAttrib (FIELD_ZScoreWeight2, HELPER_ZScoreWeight2.toObject (_ZScoreWeight2)); // factor_hdrPSet.setAttrib (FIELD_ZScoreWeight2, HELPER_ZScoreWeight2.toObject (_ZScoreWeight2)); //
_Level.getPersistentSets (allSets);
} }
...@@ -2015,11 +1933,9 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -2015,11 +1933,9 @@ public abstract class BaseFactor extends BaseBusinessClass
PersistentSet factor_hdrPSet = allSets.getPersistentSet (objectID, "factor_hdr"); PersistentSet factor_hdrPSet = allSets.getPersistentSet (objectID, "factor_hdr");
_FactorNo = (Integer)(HELPER_FactorNo.fromObject (_FactorNo, factor_hdrPSet.getAttrib (FIELD_FactorNo))); //
_Description = (String)(HELPER_Description.fromObject (_Description, factor_hdrPSet.getAttrib (FIELD_Description))); // _Description = (String)(HELPER_Description.fromObject (_Description, factor_hdrPSet.getAttrib (FIELD_Description))); //
_ClassCode = (String)(HELPER_ClassCode.fromObject (_ClassCode, factor_hdrPSet.getAttrib (FIELD_ClassCode))); // _ClassCode = (String)(HELPER_ClassCode.fromObject (_ClassCode, factor_hdrPSet.getAttrib (FIELD_ClassCode))); //
_Notes = (String)(HELPER_Notes.fromObject (_Notes, factor_hdrPSet.getAttrib (FIELD_Notes))); // _Notes = (String)(HELPER_Notes.fromObject (_Notes, factor_hdrPSet.getAttrib (FIELD_Notes))); //
_LevelNo = (Integer)(HELPER_LevelNo.fromObject (_LevelNo, factor_hdrPSet.getAttrib (FIELD_LevelNo))); //
_LeftAnnot = (String)(HELPER_LeftAnnot.fromObject (_LeftAnnot, factor_hdrPSet.getAttrib (FIELD_LeftAnnot))); // _LeftAnnot = (String)(HELPER_LeftAnnot.fromObject (_LeftAnnot, factor_hdrPSet.getAttrib (FIELD_LeftAnnot))); //
_RightAnnot = (String)(HELPER_RightAnnot.fromObject (_RightAnnot, factor_hdrPSet.getAttrib (FIELD_RightAnnot))); // _RightAnnot = (String)(HELPER_RightAnnot.fromObject (_RightAnnot, factor_hdrPSet.getAttrib (FIELD_RightAnnot))); //
_DescriptionSchinese = (String)(HELPER_DescriptionSchinese.fromObject (_DescriptionSchinese, factor_hdrPSet.getAttrib (FIELD_DescriptionSchinese))); // _DescriptionSchinese = (String)(HELPER_DescriptionSchinese.fromObject (_DescriptionSchinese, factor_hdrPSet.getAttrib (FIELD_DescriptionSchinese))); //
...@@ -2028,6 +1944,7 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -2028,6 +1944,7 @@ public abstract class BaseFactor extends BaseBusinessClass
_DescriptionThai = (String)(HELPER_DescriptionThai.fromObject (_DescriptionThai, factor_hdrPSet.getAttrib (FIELD_DescriptionThai))); // _DescriptionThai = (String)(HELPER_DescriptionThai.fromObject (_DescriptionThai, factor_hdrPSet.getAttrib (FIELD_DescriptionThai))); //
_ZScoreWeight = (Double)(HELPER_ZScoreWeight.fromObject (_ZScoreWeight, factor_hdrPSet.getAttrib (FIELD_ZScoreWeight))); // _ZScoreWeight = (Double)(HELPER_ZScoreWeight.fromObject (_ZScoreWeight, factor_hdrPSet.getAttrib (FIELD_ZScoreWeight))); //
_ZScoreWeight2 = (Double)(HELPER_ZScoreWeight2.fromObject (_ZScoreWeight2, factor_hdrPSet.getAttrib (FIELD_ZScoreWeight2))); // _ZScoreWeight2 = (Double)(HELPER_ZScoreWeight2.fromObject (_ZScoreWeight2, factor_hdrPSet.getAttrib (FIELD_ZScoreWeight2))); //
_Level.setFromPersistentSets (objectID, allSets);
} }
...@@ -2045,15 +1962,6 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -2045,15 +1962,6 @@ public abstract class BaseFactor extends BaseBusinessClass
try try
{ {
setFactorNo (otherFactor.getFactorNo ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setDescription (otherFactor.getDescription ()); setDescription (otherFactor.getDescription ());
} }
catch (FieldException ex) catch (FieldException ex)
...@@ -2081,15 +1989,6 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -2081,15 +1989,6 @@ public abstract class BaseFactor extends BaseBusinessClass
try try
{ {
setLevelNo (otherFactor.getLevelNo ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setLeftAnnot (otherFactor.getLeftAnnot ()); setLeftAnnot (otherFactor.getLeftAnnot ());
} }
catch (FieldException ex) catch (FieldException ex)
...@@ -2175,11 +2074,9 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -2175,11 +2074,9 @@ public abstract class BaseFactor extends BaseBusinessClass
{ {
BaseFactor sourceFactor = (BaseFactor)(source); BaseFactor sourceFactor = (BaseFactor)(source);
_FactorNo = sourceFactor._FactorNo;
_Description = sourceFactor._Description; _Description = sourceFactor._Description;
_ClassCode = sourceFactor._ClassCode; _ClassCode = sourceFactor._ClassCode;
_Notes = sourceFactor._Notes; _Notes = sourceFactor._Notes;
_LevelNo = sourceFactor._LevelNo;
_LeftAnnot = sourceFactor._LeftAnnot; _LeftAnnot = sourceFactor._LeftAnnot;
_RightAnnot = sourceFactor._RightAnnot; _RightAnnot = sourceFactor._RightAnnot;
_DescriptionSchinese = sourceFactor._DescriptionSchinese; _DescriptionSchinese = sourceFactor._DescriptionSchinese;
...@@ -2204,6 +2101,7 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -2204,6 +2101,7 @@ public abstract class BaseFactor extends BaseBusinessClass
{ {
BaseFactor sourceFactor = (BaseFactor)(source); BaseFactor sourceFactor = (BaseFactor)(source);
_Level.copyFrom (sourceFactor._Level, linkToGhosts);
} }
} }
...@@ -2240,11 +2138,9 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -2240,11 +2138,9 @@ public abstract class BaseFactor extends BaseBusinessClass
{ {
super.readExternalData(vals); super.readExternalData(vals);
_FactorNo = (Integer)(HELPER_FactorNo.readExternal (_FactorNo, vals.get(FIELD_FactorNo))); //
_Description = (String)(HELPER_Description.readExternal (_Description, vals.get(FIELD_Description))); // _Description = (String)(HELPER_Description.readExternal (_Description, vals.get(FIELD_Description))); //
_ClassCode = (String)(HELPER_ClassCode.readExternal (_ClassCode, vals.get(FIELD_ClassCode))); // _ClassCode = (String)(HELPER_ClassCode.readExternal (_ClassCode, vals.get(FIELD_ClassCode))); //
_Notes = (String)(HELPER_Notes.readExternal (_Notes, vals.get(FIELD_Notes))); // _Notes = (String)(HELPER_Notes.readExternal (_Notes, vals.get(FIELD_Notes))); //
_LevelNo = (Integer)(HELPER_LevelNo.readExternal (_LevelNo, vals.get(FIELD_LevelNo))); //
_LeftAnnot = (String)(HELPER_LeftAnnot.readExternal (_LeftAnnot, vals.get(FIELD_LeftAnnot))); // _LeftAnnot = (String)(HELPER_LeftAnnot.readExternal (_LeftAnnot, vals.get(FIELD_LeftAnnot))); //
_RightAnnot = (String)(HELPER_RightAnnot.readExternal (_RightAnnot, vals.get(FIELD_RightAnnot))); // _RightAnnot = (String)(HELPER_RightAnnot.readExternal (_RightAnnot, vals.get(FIELD_RightAnnot))); //
_DescriptionSchinese = (String)(HELPER_DescriptionSchinese.readExternal (_DescriptionSchinese, vals.get(FIELD_DescriptionSchinese))); // _DescriptionSchinese = (String)(HELPER_DescriptionSchinese.readExternal (_DescriptionSchinese, vals.get(FIELD_DescriptionSchinese))); //
...@@ -2253,6 +2149,7 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -2253,6 +2149,7 @@ public abstract class BaseFactor extends BaseBusinessClass
_DescriptionThai = (String)(HELPER_DescriptionThai.readExternal (_DescriptionThai, vals.get(FIELD_DescriptionThai))); // _DescriptionThai = (String)(HELPER_DescriptionThai.readExternal (_DescriptionThai, vals.get(FIELD_DescriptionThai))); //
_ZScoreWeight = (Double)(HELPER_ZScoreWeight.readExternal (_ZScoreWeight, vals.get(FIELD_ZScoreWeight))); // _ZScoreWeight = (Double)(HELPER_ZScoreWeight.readExternal (_ZScoreWeight, vals.get(FIELD_ZScoreWeight))); //
_ZScoreWeight2 = (Double)(HELPER_ZScoreWeight2.readExternal (_ZScoreWeight2, vals.get(FIELD_ZScoreWeight2))); // _ZScoreWeight2 = (Double)(HELPER_ZScoreWeight2.readExternal (_ZScoreWeight2, vals.get(FIELD_ZScoreWeight2))); //
_Level.readExternalData(vals.get(SINGLEREFERENCE_Level));
} }
...@@ -2264,11 +2161,9 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -2264,11 +2161,9 @@ public abstract class BaseFactor extends BaseBusinessClass
{ {
super.writeExternalData(vals); super.writeExternalData(vals);
vals.put (FIELD_FactorNo, HELPER_FactorNo.writeExternal (_FactorNo));
vals.put (FIELD_Description, HELPER_Description.writeExternal (_Description)); vals.put (FIELD_Description, HELPER_Description.writeExternal (_Description));
vals.put (FIELD_ClassCode, HELPER_ClassCode.writeExternal (_ClassCode)); vals.put (FIELD_ClassCode, HELPER_ClassCode.writeExternal (_ClassCode));
vals.put (FIELD_Notes, HELPER_Notes.writeExternal (_Notes)); vals.put (FIELD_Notes, HELPER_Notes.writeExternal (_Notes));
vals.put (FIELD_LevelNo, HELPER_LevelNo.writeExternal (_LevelNo));
vals.put (FIELD_LeftAnnot, HELPER_LeftAnnot.writeExternal (_LeftAnnot)); vals.put (FIELD_LeftAnnot, HELPER_LeftAnnot.writeExternal (_LeftAnnot));
vals.put (FIELD_RightAnnot, HELPER_RightAnnot.writeExternal (_RightAnnot)); vals.put (FIELD_RightAnnot, HELPER_RightAnnot.writeExternal (_RightAnnot));
vals.put (FIELD_DescriptionSchinese, HELPER_DescriptionSchinese.writeExternal (_DescriptionSchinese)); vals.put (FIELD_DescriptionSchinese, HELPER_DescriptionSchinese.writeExternal (_DescriptionSchinese));
...@@ -2277,6 +2172,7 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -2277,6 +2172,7 @@ public abstract class BaseFactor extends BaseBusinessClass
vals.put (FIELD_DescriptionThai, HELPER_DescriptionThai.writeExternal (_DescriptionThai)); vals.put (FIELD_DescriptionThai, HELPER_DescriptionThai.writeExternal (_DescriptionThai));
vals.put (FIELD_ZScoreWeight, HELPER_ZScoreWeight.writeExternal (_ZScoreWeight)); vals.put (FIELD_ZScoreWeight, HELPER_ZScoreWeight.writeExternal (_ZScoreWeight));
vals.put (FIELD_ZScoreWeight2, HELPER_ZScoreWeight2.writeExternal (_ZScoreWeight2)); vals.put (FIELD_ZScoreWeight2, HELPER_ZScoreWeight2.writeExternal (_ZScoreWeight2));
vals.put (SINGLEREFERENCE_Level, _Level.writeExternalData());
} }
...@@ -2290,10 +2186,6 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -2290,10 +2186,6 @@ public abstract class BaseFactor extends BaseBusinessClass
BaseFactor otherFactor = (BaseFactor)(other); BaseFactor otherFactor = (BaseFactor)(other);
if (!HELPER_FactorNo.compare(this._FactorNo, otherFactor._FactorNo))
{
listener.notifyFieldChange(this, other, FIELD_FactorNo, HELPER_FactorNo.toObject(this._FactorNo), HELPER_FactorNo.toObject(otherFactor._FactorNo));
}
if (!HELPER_Description.compare(this._Description, otherFactor._Description)) if (!HELPER_Description.compare(this._Description, otherFactor._Description))
{ {
listener.notifyFieldChange(this, other, FIELD_Description, HELPER_Description.toObject(this._Description), HELPER_Description.toObject(otherFactor._Description)); listener.notifyFieldChange(this, other, FIELD_Description, HELPER_Description.toObject(this._Description), HELPER_Description.toObject(otherFactor._Description));
...@@ -2306,10 +2198,6 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -2306,10 +2198,6 @@ public abstract class BaseFactor extends BaseBusinessClass
{ {
listener.notifyFieldChange(this, other, FIELD_Notes, HELPER_Notes.toObject(this._Notes), HELPER_Notes.toObject(otherFactor._Notes)); listener.notifyFieldChange(this, other, FIELD_Notes, HELPER_Notes.toObject(this._Notes), HELPER_Notes.toObject(otherFactor._Notes));
} }
if (!HELPER_LevelNo.compare(this._LevelNo, otherFactor._LevelNo))
{
listener.notifyFieldChange(this, other, FIELD_LevelNo, HELPER_LevelNo.toObject(this._LevelNo), HELPER_LevelNo.toObject(otherFactor._LevelNo));
}
if (!HELPER_LeftAnnot.compare(this._LeftAnnot, otherFactor._LeftAnnot)) if (!HELPER_LeftAnnot.compare(this._LeftAnnot, otherFactor._LeftAnnot))
{ {
listener.notifyFieldChange(this, other, FIELD_LeftAnnot, HELPER_LeftAnnot.toObject(this._LeftAnnot), HELPER_LeftAnnot.toObject(otherFactor._LeftAnnot)); listener.notifyFieldChange(this, other, FIELD_LeftAnnot, HELPER_LeftAnnot.toObject(this._LeftAnnot), HELPER_LeftAnnot.toObject(otherFactor._LeftAnnot));
...@@ -2344,6 +2232,7 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -2344,6 +2232,7 @@ public abstract class BaseFactor extends BaseBusinessClass
} }
// Compare single assocs // Compare single assocs
_Level.compare (otherFactor._Level, listener);
// Compare multiple assocs // Compare multiple assocs
...@@ -2364,11 +2253,9 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -2364,11 +2253,9 @@ public abstract class BaseFactor extends BaseBusinessClass
{ {
super.visitAttributes (visitor); super.visitAttributes (visitor);
visitor.visitField(this, FIELD_FactorNo, HELPER_FactorNo.toObject(getFactorNo()));
visitor.visitField(this, FIELD_Description, HELPER_Description.toObject(getDescription())); visitor.visitField(this, FIELD_Description, HELPER_Description.toObject(getDescription()));
visitor.visitField(this, FIELD_ClassCode, HELPER_ClassCode.toObject(getClassCode())); visitor.visitField(this, FIELD_ClassCode, HELPER_ClassCode.toObject(getClassCode()));
visitor.visitField(this, FIELD_Notes, HELPER_Notes.toObject(getNotes())); visitor.visitField(this, FIELD_Notes, HELPER_Notes.toObject(getNotes()));
visitor.visitField(this, FIELD_LevelNo, HELPER_LevelNo.toObject(getLevelNo()));
visitor.visitField(this, FIELD_LeftAnnot, HELPER_LeftAnnot.toObject(getLeftAnnot())); visitor.visitField(this, FIELD_LeftAnnot, HELPER_LeftAnnot.toObject(getLeftAnnot()));
visitor.visitField(this, FIELD_RightAnnot, HELPER_RightAnnot.toObject(getRightAnnot())); visitor.visitField(this, FIELD_RightAnnot, HELPER_RightAnnot.toObject(getRightAnnot()));
visitor.visitField(this, FIELD_DescriptionSchinese, HELPER_DescriptionSchinese.toObject(getDescriptionSchinese())); visitor.visitField(this, FIELD_DescriptionSchinese, HELPER_DescriptionSchinese.toObject(getDescriptionSchinese()));
...@@ -2377,6 +2264,7 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -2377,6 +2264,7 @@ public abstract class BaseFactor extends BaseBusinessClass
visitor.visitField(this, FIELD_DescriptionThai, HELPER_DescriptionThai.toObject(getDescriptionThai())); visitor.visitField(this, FIELD_DescriptionThai, HELPER_DescriptionThai.toObject(getDescriptionThai()));
visitor.visitField(this, FIELD_ZScoreWeight, HELPER_ZScoreWeight.toObject(getZScoreWeight())); visitor.visitField(this, FIELD_ZScoreWeight, HELPER_ZScoreWeight.toObject(getZScoreWeight()));
visitor.visitField(this, FIELD_ZScoreWeight2, HELPER_ZScoreWeight2.toObject(getZScoreWeight2())); visitor.visitField(this, FIELD_ZScoreWeight2, HELPER_ZScoreWeight2.toObject(getZScoreWeight2()));
visitor.visitAssociation (_Level);
} }
...@@ -2385,6 +2273,10 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -2385,6 +2273,10 @@ public abstract class BaseFactor extends BaseBusinessClass
{ {
super.visitAssociations (visitor, scope); super.visitAssociations (visitor, scope);
if (scope.includes (_Level))
{
visitor.visit (_Level);
}
} }
...@@ -2410,10 +2302,6 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -2410,10 +2302,6 @@ public abstract class BaseFactor extends BaseBusinessClass
{ {
throw new RuntimeException ("Game over man!!"); throw new RuntimeException ("Game over man!!");
} }
else if (attribName.equals (FIELD_FactorNo))
{
return filter.matches (getFactorNo ());
}
else if (attribName.equals (FIELD_Description)) else if (attribName.equals (FIELD_Description))
{ {
return filter.matches (getDescription ()); return filter.matches (getDescription ());
...@@ -2426,10 +2314,6 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -2426,10 +2314,6 @@ public abstract class BaseFactor extends BaseBusinessClass
{ {
return filter.matches (getNotes ()); return filter.matches (getNotes ());
} }
else if (attribName.equals (FIELD_LevelNo))
{
return filter.matches (getLevelNo ());
}
else if (attribName.equals (FIELD_LeftAnnot)) else if (attribName.equals (FIELD_LeftAnnot))
{ {
return filter.matches (getLeftAnnot ()); return filter.matches (getLeftAnnot ());
...@@ -2462,6 +2346,10 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -2462,6 +2346,10 @@ public abstract class BaseFactor extends BaseBusinessClass
{ {
return filter.matches (getZScoreWeight2 ()); return filter.matches (getZScoreWeight2 ());
} }
else if (attribName.equals (SINGLEREFERENCE_Level))
{
return filter.matches (getLevel ());
}
else else
{ {
return super.testFilter (attribName, filter); return super.testFilter (attribName, filter);
...@@ -2477,10 +2365,6 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -2477,10 +2365,6 @@ public abstract class BaseFactor extends BaseBusinessClass
{ {
throw new RuntimeException ("Game over man!!"); throw new RuntimeException ("Game over man!!");
} }
else if (attribName.equals (FIELD_FactorNo))
{
return HELPER_FactorNo.toObject (getFactorNo ());
}
else if (attribName.equals (FIELD_Description)) else if (attribName.equals (FIELD_Description))
{ {
return HELPER_Description.toObject (getDescription ()); return HELPER_Description.toObject (getDescription ());
...@@ -2493,10 +2377,6 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -2493,10 +2377,6 @@ public abstract class BaseFactor extends BaseBusinessClass
{ {
return HELPER_Notes.toObject (getNotes ()); return HELPER_Notes.toObject (getNotes ());
} }
else if (attribName.equals (FIELD_LevelNo))
{
return HELPER_LevelNo.toObject (getLevelNo ());
}
else if (attribName.equals (FIELD_LeftAnnot)) else if (attribName.equals (FIELD_LeftAnnot))
{ {
return HELPER_LeftAnnot.toObject (getLeftAnnot ()); return HELPER_LeftAnnot.toObject (getLeftAnnot ());
...@@ -2542,10 +2422,6 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -2542,10 +2422,6 @@ public abstract class BaseFactor extends BaseBusinessClass
{ {
throw new RuntimeException ("Game over man!!"); throw new RuntimeException ("Game over man!!");
} }
else if (attribName.equals (FIELD_FactorNo))
{
return HELPER_FactorNo;
}
else if (attribName.equals (FIELD_Description)) else if (attribName.equals (FIELD_Description))
{ {
return HELPER_Description; return HELPER_Description;
...@@ -2558,10 +2434,6 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -2558,10 +2434,6 @@ public abstract class BaseFactor extends BaseBusinessClass
{ {
return HELPER_Notes; return HELPER_Notes;
} }
else if (attribName.equals (FIELD_LevelNo))
{
return HELPER_LevelNo;
}
else if (attribName.equals (FIELD_LeftAnnot)) else if (attribName.equals (FIELD_LeftAnnot))
{ {
return HELPER_LeftAnnot; return HELPER_LeftAnnot;
...@@ -2607,10 +2479,6 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -2607,10 +2479,6 @@ public abstract class BaseFactor extends BaseBusinessClass
{ {
throw new RuntimeException ("Game over man!!"); throw new RuntimeException ("Game over man!!");
} }
else if (attribName.equals (FIELD_FactorNo))
{
setFactorNo ((Integer)(HELPER_FactorNo.fromObject (_FactorNo, attribValue)));
}
else if (attribName.equals (FIELD_Description)) else if (attribName.equals (FIELD_Description))
{ {
setDescription ((String)(HELPER_Description.fromObject (_Description, attribValue))); setDescription ((String)(HELPER_Description.fromObject (_Description, attribValue)));
...@@ -2623,10 +2491,6 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -2623,10 +2491,6 @@ public abstract class BaseFactor extends BaseBusinessClass
{ {
setNotes ((String)(HELPER_Notes.fromObject (_Notes, attribValue))); setNotes ((String)(HELPER_Notes.fromObject (_Notes, attribValue)));
} }
else if (attribName.equals (FIELD_LevelNo))
{
setLevelNo ((Integer)(HELPER_LevelNo.fromObject (_LevelNo, attribValue)));
}
else if (attribName.equals (FIELD_LeftAnnot)) else if (attribName.equals (FIELD_LeftAnnot))
{ {
setLeftAnnot ((String)(HELPER_LeftAnnot.fromObject (_LeftAnnot, attribValue))); setLeftAnnot ((String)(HELPER_LeftAnnot.fromObject (_LeftAnnot, attribValue)));
...@@ -2679,10 +2543,6 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -2679,10 +2543,6 @@ public abstract class BaseFactor extends BaseBusinessClass
{ {
throw new RuntimeException ("Game over man!!"); throw new RuntimeException ("Game over man!!");
} }
else if (fieldName.equals (FIELD_FactorNo))
{
return getWriteability_FactorNo ();
}
else if (fieldName.equals (FIELD_Description)) else if (fieldName.equals (FIELD_Description))
{ {
return getWriteability_Description (); return getWriteability_Description ();
...@@ -2695,10 +2555,6 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -2695,10 +2555,6 @@ public abstract class BaseFactor extends BaseBusinessClass
{ {
return getWriteability_Notes (); return getWriteability_Notes ();
} }
else if (fieldName.equals (FIELD_LevelNo))
{
return getWriteability_LevelNo ();
}
else if (fieldName.equals (FIELD_LeftAnnot)) else if (fieldName.equals (FIELD_LeftAnnot))
{ {
return getWriteability_LeftAnnot (); return getWriteability_LeftAnnot ();
...@@ -2731,6 +2587,10 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -2731,6 +2587,10 @@ public abstract class BaseFactor extends BaseBusinessClass
{ {
return getWriteability_ZScoreWeight2 (); return getWriteability_ZScoreWeight2 ();
} }
else if (fieldName.equals (SINGLEREFERENCE_Level))
{
return getWriteability_Level ();
}
else else
{ {
return super.getWriteable (fieldName); return super.getWriteable (fieldName);
...@@ -2741,11 +2601,6 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -2741,11 +2601,6 @@ public abstract class BaseFactor extends BaseBusinessClass
public void putUnwriteable (Set<String> fields) public void putUnwriteable (Set<String> fields)
{ {
if (getWriteability_FactorNo () != FieldWriteability.TRUE)
{
fields.add (FIELD_FactorNo);
}
if (getWriteability_Description () != FieldWriteability.TRUE) if (getWriteability_Description () != FieldWriteability.TRUE)
{ {
fields.add (FIELD_Description); fields.add (FIELD_Description);
...@@ -2761,11 +2616,6 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -2761,11 +2616,6 @@ public abstract class BaseFactor extends BaseBusinessClass
fields.add (FIELD_Notes); fields.add (FIELD_Notes);
} }
if (getWriteability_LevelNo () != FieldWriteability.TRUE)
{
fields.add (FIELD_LevelNo);
}
if (getWriteability_LeftAnnot () != FieldWriteability.TRUE) if (getWriteability_LeftAnnot () != FieldWriteability.TRUE)
{ {
fields.add (FIELD_LeftAnnot); fields.add (FIELD_LeftAnnot);
...@@ -2815,11 +2665,9 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -2815,11 +2665,9 @@ public abstract class BaseFactor extends BaseBusinessClass
List result = super.getAttributes (); List result = super.getAttributes ();
result.add(HELPER_FactorNo.getAttribObject (getClass (), _FactorNo, false, FIELD_FactorNo));
result.add(HELPER_Description.getAttribObject (getClass (), _Description, false, FIELD_Description)); result.add(HELPER_Description.getAttribObject (getClass (), _Description, false, FIELD_Description));
result.add(HELPER_ClassCode.getAttribObject (getClass (), _ClassCode, false, FIELD_ClassCode)); result.add(HELPER_ClassCode.getAttribObject (getClass (), _ClassCode, false, FIELD_ClassCode));
result.add(HELPER_Notes.getAttribObject (getClass (), _Notes, false, FIELD_Notes)); result.add(HELPER_Notes.getAttribObject (getClass (), _Notes, false, FIELD_Notes));
result.add(HELPER_LevelNo.getAttribObject (getClass (), _LevelNo, false, FIELD_LevelNo));
result.add(HELPER_LeftAnnot.getAttribObject (getClass (), _LeftAnnot, false, FIELD_LeftAnnot)); result.add(HELPER_LeftAnnot.getAttribObject (getClass (), _LeftAnnot, false, FIELD_LeftAnnot));
result.add(HELPER_RightAnnot.getAttribObject (getClass (), _RightAnnot, false, FIELD_RightAnnot)); result.add(HELPER_RightAnnot.getAttribObject (getClass (), _RightAnnot, false, FIELD_RightAnnot));
result.add(HELPER_DescriptionSchinese.getAttribObject (getClass (), _DescriptionSchinese, false, FIELD_DescriptionSchinese)); result.add(HELPER_DescriptionSchinese.getAttribObject (getClass (), _DescriptionSchinese, false, FIELD_DescriptionSchinese));
...@@ -2879,24 +2727,6 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -2879,24 +2727,6 @@ public abstract class BaseFactor extends BaseBusinessClass
{ {
/** /**
* Get the attribute FactorNo
*/
public Integer getFactorNo (Factor obj, Integer original)
{
return original;
}
/**
* Change the value set for attribute FactorNo.
* May modify the field beforehand
* Occurs before validation.
*/
public Integer setFactorNo (Factor obj, Integer newFactorNo) throws FieldException
{
return newFactorNo;
}
/**
* Get the attribute Description * Get the attribute Description
*/ */
public String getDescription (Factor obj, String original) public String getDescription (Factor obj, String original)
...@@ -2951,24 +2781,6 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -2951,24 +2781,6 @@ public abstract class BaseFactor extends BaseBusinessClass
} }
/** /**
* Get the attribute LevelNo
*/
public Integer getLevelNo (Factor obj, Integer original)
{
return original;
}
/**
* Change the value set for attribute LevelNo.
* May modify the field beforehand
* Occurs before validation.
*/
public Integer setLevelNo (Factor obj, Integer newLevelNo) throws FieldException
{
return newLevelNo;
}
/**
* Get the attribute LeftAnnot * Get the attribute LeftAnnot
*/ */
public String getLeftAnnot (Factor obj, String original) public String getLeftAnnot (Factor obj, String original)
...@@ -3164,10 +2976,6 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -3164,10 +2976,6 @@ public abstract class BaseFactor extends BaseBusinessClass
public PipeLine<From, ? extends Object> to(String name) public PipeLine<From, ? extends Object> to(String name)
{ {
if (name.equals ("FactorNo"))
{
return toFactorNo ();
}
if (name.equals ("Description")) if (name.equals ("Description"))
{ {
return toDescription (); return toDescription ();
...@@ -3180,10 +2988,6 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -3180,10 +2988,6 @@ public abstract class BaseFactor extends BaseBusinessClass
{ {
return toNotes (); return toNotes ();
} }
if (name.equals ("LevelNo"))
{
return toLevelNo ();
}
if (name.equals ("LeftAnnot")) if (name.equals ("LeftAnnot"))
{ {
return toLeftAnnot (); return toLeftAnnot ();
...@@ -3216,22 +3020,22 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -3216,22 +3020,22 @@ public abstract class BaseFactor extends BaseBusinessClass
{ {
return toZScoreWeight2 (); return toZScoreWeight2 ();
} }
if (name.equals ("Level"))
{
return toLevel ();
}
return super.to(name); return super.to(name);
} }
public PipeLine<From, Integer> toFactorNo () { return pipe(new ORMAttributePipe<Me, Integer>(FIELD_FactorNo)); }
public PipeLine<From, String> toDescription () { return pipe(new ORMAttributePipe<Me, String>(FIELD_Description)); } public PipeLine<From, String> toDescription () { return pipe(new ORMAttributePipe<Me, String>(FIELD_Description)); }
public PipeLine<From, String> toClassCode () { return pipe(new ORMAttributePipe<Me, String>(FIELD_ClassCode)); } public PipeLine<From, String> toClassCode () { return pipe(new ORMAttributePipe<Me, String>(FIELD_ClassCode)); }
public PipeLine<From, String> toNotes () { return pipe(new ORMAttributePipe<Me, String>(FIELD_Notes)); } public PipeLine<From, String> toNotes () { return pipe(new ORMAttributePipe<Me, String>(FIELD_Notes)); }
public PipeLine<From, Integer> toLevelNo () { return pipe(new ORMAttributePipe<Me, Integer>(FIELD_LevelNo)); }
public PipeLine<From, String> toLeftAnnot () { return pipe(new ORMAttributePipe<Me, String>(FIELD_LeftAnnot)); } public PipeLine<From, String> toLeftAnnot () { return pipe(new ORMAttributePipe<Me, String>(FIELD_LeftAnnot)); }
public PipeLine<From, String> toRightAnnot () { return pipe(new ORMAttributePipe<Me, String>(FIELD_RightAnnot)); } public PipeLine<From, String> toRightAnnot () { return pipe(new ORMAttributePipe<Me, String>(FIELD_RightAnnot)); }
...@@ -3247,6 +3051,12 @@ public abstract class BaseFactor extends BaseBusinessClass ...@@ -3247,6 +3051,12 @@ public abstract class BaseFactor extends BaseBusinessClass
public PipeLine<From, Double> toZScoreWeight () { return pipe(new ORMAttributePipe<Me, Double>(FIELD_ZScoreWeight)); } public PipeLine<From, Double> toZScoreWeight () { return pipe(new ORMAttributePipe<Me, Double>(FIELD_ZScoreWeight)); }
public PipeLine<From, Double> toZScoreWeight2 () { return pipe(new ORMAttributePipe<Me, Double>(FIELD_ZScoreWeight2)); } public PipeLine<From, Double> toZScoreWeight2 () { return pipe(new ORMAttributePipe<Me, Double>(FIELD_ZScoreWeight2)); }
public Level.LevelPipeLineFactory<From, Level> toLevel () { return toLevel (Filter.ALL); }
public Level.LevelPipeLineFactory<From, Level> toLevel (Filter<Level> filter)
{
return Level.REFERENCE_Level.new LevelPipeLineFactory<From, Level> (this, new ORMSingleAssocPipe<Me, Level>(SINGLEREFERENCE_Level, filter));
}
} }
...@@ -3278,6 +3088,20 @@ class DummyFactor extends Factor ...@@ -3278,6 +3088,20 @@ class DummyFactor extends Factor
} }
public Level getLevel () throws StorageException
{
return (Level)(Level.DUMMY_Level);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getLevelID ()
{
return Level.DUMMY_Level.getObjectID();
}
} }
/*
* IMPORTANT!!!! XSL Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2 rev3 [oneit.objstore.BusinessObjectTemplate.xsl]
*
* Version: 1.0
* Vendor: Apache Software Foundation (Xalan XSLTC)
* Vendor URL: http://xml.apache.org/xalan-j
*/
package performa.orm;
import java.io.*;
import java.util.*;
import oneit.appservices.config.*;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.objstore.assocs.*;
import oneit.objstore.attributes.*;
import oneit.objstore.rdbms.filters.*;
import oneit.objstore.parser.*;
import oneit.objstore.validator.*;
import oneit.objstore.utils.*;
import oneit.utils.*;
import oneit.utils.filter.Filter;
import oneit.utils.transform.*;
import oneit.utils.parsers.FieldException;
public abstract class BaseFactorQuestionLink extends BaseBusinessClass
{
// Reference instance for the object
public static final FactorQuestionLink REFERENCE_FactorQuestionLink = new FactorQuestionLink ();
// Reference instance for the object
public static final FactorQuestionLink DUMMY_FactorQuestionLink = new DummyFactorQuestionLink ();
// Static constants corresponding to field names
public static final String FIELD_ReverseScore = "ReverseScore";
public static final String SINGLEREFERENCE_Factor = "Factor";
// Static constants corresponding to searches
// Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper<FactorQuestionLink> HELPER_ReverseScore = DefaultAttributeHelper.INSTANCE;
// Private attributes corresponding to business object data
private String _ReverseScore;
// Private attributes corresponding to single references
private SingleAssociation<FactorQuestionLink, Factor> _Factor;
// Private attributes corresponding to multiple references
// Map of maps of metadata
private static final Map ATTRIBUTES_METADATA_FactorQuestionLink = new HashMap ();
// Arrays of validators for each attribute
private static final AttributeValidator[] FIELD_ReverseScore_Validators;
// Arrays of behaviour decorators
private static final FactorQuestionLinkBehaviourDecorator[] FactorQuestionLink_BehaviourDecorators;
static
{
try
{
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
setupAssocMetaData_Factor();
FIELD_ReverseScore_Validators = (AttributeValidator[])setupAttribMetaData_ReverseScore(validatorMapping).toArray (new AttributeValidator[0]);
REFERENCE_FactorQuestionLink.initialiseReference ();
DUMMY_FactorQuestionLink.initialiseReference ();
FactorQuestionLink_BehaviourDecorators = BaseBusinessClass.getBBCBehaviours(FactorQuestionLink.class).toArray(new FactorQuestionLinkBehaviourDecorator[0]);
}
catch (RuntimeException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR1, e, "Error initialising");
throw e;
}
}
// Meta Info setup
private static void setupAssocMetaData_Factor()
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "factor_number");
metaInfo.put ("name", "Factor");
metaInfo.put ("type", "Factor");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for FactorQuestionLink.Factor:", metaInfo);
ATTRIBUTES_METADATA_FactorQuestionLink.put (SINGLEREFERENCE_Factor, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static List setupAttribMetaData_ReverseScore(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "reverse_score_flag");
metaInfo.put ("length", "15");
metaInfo.put ("name", "ReverseScore");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for FactorQuestionLink.ReverseScore:", metaInfo);
ATTRIBUTES_METADATA_FactorQuestionLink.put (FIELD_ReverseScore, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(FactorQuestionLink.class, "ReverseScore", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for FactorQuestionLink.ReverseScore:", validators);
return validators;
}
// END OF STATIC METADATA DEFINITION
// This constructor should not be called
protected BaseFactorQuestionLink ()
{
}
protected BBCBehaviourDecorator[] getBehaviours()
{
return FactorQuestionLink_BehaviourDecorators;
}
// Initialise the attributes
protected void _initialiseNewObjAttributes (ObjectTransaction transaction) throws StorageException
{
super._initialiseNewObjAttributes (transaction);
_ReverseScore = (String)(HELPER_ReverseScore.initialise (_ReverseScore));
}
// Initialise the associations
protected void _initialiseAssociations ()
{
super._initialiseAssociations ();
_Factor = new SingleAssociation<FactorQuestionLink, Factor> (this, SINGLEREFERENCE_Factor, null, Factor.REFERENCE_Factor, "factor_lin");
}
// Initialise the associations
protected BaseBusinessClass initialiseReference ()
{
super.initialiseReference ();
_Factor = new SingleAssociation<FactorQuestionLink, Factor> (this, SINGLEREFERENCE_Factor, null, Factor.REFERENCE_Factor, "factor_lin");
return this;
}
/**
* Get the attribute ReverseScore
*/
public String getReverseScore ()
{
assertValid();
String valToReturn = _ReverseScore;
for (FactorQuestionLinkBehaviourDecorator bhd : FactorQuestionLink_BehaviourDecorators)
{
valToReturn = bhd.getReverseScore ((FactorQuestionLink)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 preReverseScoreChange (String newReverseScore) 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 postReverseScoreChange () throws FieldException
{
}
public FieldWriteability getWriteability_ReverseScore ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute ReverseScore. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setReverseScore (String newReverseScore) throws FieldException
{
boolean oldAndNewIdentical = HELPER_ReverseScore.compare (_ReverseScore, newReverseScore);
try
{
for (FactorQuestionLinkBehaviourDecorator bhd : FactorQuestionLink_BehaviourDecorators)
{
newReverseScore = bhd.setReverseScore ((FactorQuestionLink)this, newReverseScore);
oldAndNewIdentical = HELPER_ReverseScore.compare (_ReverseScore, newReverseScore);
}
if (FIELD_ReverseScore_Validators.length > 0)
{
Object newReverseScoreObj = HELPER_ReverseScore.toObject (newReverseScore);
if (newReverseScoreObj != null)
{
int loopMax = FIELD_ReverseScore_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_FactorQuestionLink.get (FIELD_ReverseScore);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_ReverseScore_Validators[v].checkAttribute (this, FIELD_ReverseScore, metadata, newReverseScoreObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_ReverseScore () != FieldWriteability.FALSE, "Field ReverseScore is not writeable");
preReverseScoreChange (newReverseScore);
markFieldChange (FIELD_ReverseScore);
_ReverseScore = newReverseScore;
postFieldChange (FIELD_ReverseScore);
postReverseScoreChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getSingleAssocs()
{
List result = super.getSingleAssocs ();
result.add("Factor");
return result;
}
public BaseBusinessClass getSingleAssocReferenceInstance (String assocName)
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Factor))
{
return _Factor.getReferencedType ();
}
else
{
return super.getSingleAssocReferenceInstance (assocName);
}
}
public String getSingleAssocBackReference(String assocName)
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Factor))
{
return null ;
}
else
{
return super.getSingleAssocBackReference (assocName);
}
}
public BaseBusinessClass getSingleAssoc (String assocName) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Factor))
{
return getFactor ();
}
else
{
return super.getSingleAssoc (assocName);
}
}
public BaseBusinessClass getSingleAssoc (String assocName, Get getType) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Factor))
{
return getFactor (getType);
}
else
{
return super.getSingleAssoc (assocName, getType);
}
}
public Long getSingleAssocID (String assocName) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Factor))
{
return getFactorID ();
}
else
{
return super.getSingleAssocID (assocName);
}
}
public void setSingleAssoc (String assocName, BaseBusinessClass newValue) throws StorageException, FieldException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Factor))
{
setFactor ((Factor)(newValue));
}
else
{
super.setSingleAssoc (assocName, newValue);
}
}
/**
* Get the reference Factor
*/
public Factor getFactor () throws StorageException
{
assertValid();
try
{
return (Factor)(_Factor.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in FactorQuestionLink:", this.getObjectID (), ", was trying to get Factor:", getFactorID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _Factor.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Factor getFactor (Get getType) throws StorageException
{
assertValid();
return _Factor.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getFactorID ()
{
assertValid();
if (_Factor == null)
{
return null;
}
else
{
return _Factor.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 preFactorChange (Factor newFactor) 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 postFactorChange () throws FieldException
{
}
public FieldWriteability getWriteability_Factor ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference Factor. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setFactor (Factor newFactor) throws StorageException, FieldException
{
if (_Factor.wouldReferencedChange (newFactor))
{
assertValid();
Debug.assertion (getWriteability_Factor () != FieldWriteability.FALSE, "Assoc Factor is not writeable");
preFactorChange (newFactor);
_Factor.set (newFactor);
postFactorChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getMultiAssocs()
{
List result = super.getMultiAssocs ();
return result;
}
/**
* Get the reference instance for the multi assoc name.
*/
public BaseBusinessClass getMultiAssocReferenceInstance(String attribName)
{
return super.getMultiAssocReferenceInstance(attribName);
}
public String getMultiAssocBackReference(String attribName)
{
return super.getMultiAssocBackReference(attribName);
}
/**
* Get the assoc count for the multi assoc name.
*/
public int getMultiAssocCount(String attribName) throws StorageException
{
return super.getMultiAssocCount(attribName);
}
/**
* Get the assoc at a particular index
*/
public BaseBusinessClass getMultiAssocAt(String attribName, int index) throws StorageException
{
return super.getMultiAssocAt(attribName, index);
}
/**
* Add to a multi assoc by attribute name
*/
public void addToMultiAssoc(String attribName, BaseBusinessClass newElement) throws StorageException
{
super.addToMultiAssoc(attribName, newElement);
}
/**
* Remove from a multi assoc by attribute name
*/
public void removeFromMultiAssoc(String attribName, BaseBusinessClass oldElement) throws StorageException
{
super.removeFromMultiAssoc(attribName, oldElement);
}
protected void __loadMultiAssoc (String attribName, BaseBusinessClass[] elements)
{
super.__loadMultiAssoc(attribName, elements);
}
protected boolean __isMultiAssocLoaded (String attribName)
{
return super.__isMultiAssocLoaded(attribName);
}
public void onDelete ()
{
try
{
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
super.onDelete ();
}
public FactorQuestionLink newInstance ()
{
return new FactorQuestionLink ();
}
public FactorQuestionLink referenceInstance ()
{
return REFERENCE_FactorQuestionLink;
}
public FactorQuestionLink getInTransaction (ObjectTransaction t) throws StorageException
{
return getFactorQuestionLinkByID (t, getObjectID());
}
public BaseBusinessClass dummyInstance ()
{
return DUMMY_FactorQuestionLink;
}
public String getBaseSetName ()
{
return "factor_lin";
}
/**
* 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 factor_linPSet = allSets.getPersistentSet (myID, "factor_lin", myPSetStatus);
factor_linPSet.setAttrib (FIELD_ObjectID, myID);
factor_linPSet.setAttrib (FIELD_ReverseScore, HELPER_ReverseScore.toObject (_ReverseScore)); //
_Factor.getPersistentSets (allSets);
}
/**
* Sets the objects state based on Persistent sets.
*/
public void setFromPersistentSets (ObjectID objectID, PersistentSetCollection allSets)
{
super.setFromPersistentSets (objectID, allSets);
PersistentSet factor_linPSet = allSets.getPersistentSet (objectID, "factor_lin");
_ReverseScore = (String)(HELPER_ReverseScore.fromObject (_ReverseScore, factor_linPSet.getAttrib (FIELD_ReverseScore))); //
_Factor.setFromPersistentSets (objectID, allSets);
}
public void setAttributesFrom (BaseBusinessClass other, MultiException e)
{
super.setAttributesFrom (other, e);
if (other instanceof FactorQuestionLink)
{
FactorQuestionLink otherFactorQuestionLink = (FactorQuestionLink)other;
try
{
setReverseScore (otherFactorQuestionLink.getReverseScore ());
}
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 BaseFactorQuestionLink)
{
BaseFactorQuestionLink sourceFactorQuestionLink = (BaseFactorQuestionLink)(source);
_ReverseScore = sourceFactorQuestionLink._ReverseScore;
}
}
/**
* 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 BaseFactorQuestionLink)
{
BaseFactorQuestionLink sourceFactorQuestionLink = (BaseFactorQuestionLink)(source);
_Factor.copyFrom (sourceFactorQuestionLink._Factor, linkToGhosts);
}
}
/**
* Set the associations in this to copies of the attributes in source.
*/
public void copyAssociationsFrom (BaseBusinessClass source, boolean linkToGhosts)
{
super.copyAssociationsFrom (source, linkToGhosts);
if (source instanceof BaseFactorQuestionLink)
{
BaseFactorQuestionLink sourceFactorQuestionLink = (BaseFactorQuestionLink)(source);
}
}
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);
_ReverseScore = (String)(HELPER_ReverseScore.readExternal (_ReverseScore, vals.get(FIELD_ReverseScore))); //
_Factor.readExternalData(vals.get(SINGLEREFERENCE_Factor));
}
/**
* Subclasses must override this to write out their attributes
*/
protected void writeExternalData(Map<String, Object> vals) throws IOException
{
super.writeExternalData(vals);
vals.put (FIELD_ReverseScore, HELPER_ReverseScore.writeExternal (_ReverseScore));
vals.put (SINGLEREFERENCE_Factor, _Factor.writeExternalData());
}
public void compare (BaseBusinessClass other, AttributeChangeListener listener) throws StorageException
{
super.compare (other, listener);
if (other instanceof BaseFactorQuestionLink)
{
BaseFactorQuestionLink otherFactorQuestionLink = (BaseFactorQuestionLink)(other);
if (!HELPER_ReverseScore.compare(this._ReverseScore, otherFactorQuestionLink._ReverseScore))
{
listener.notifyFieldChange(this, other, FIELD_ReverseScore, HELPER_ReverseScore.toObject(this._ReverseScore), HELPER_ReverseScore.toObject(otherFactorQuestionLink._ReverseScore));
}
// Compare single assocs
_Factor.compare (otherFactorQuestionLink._Factor, listener);
// Compare multiple assocs
}
}
public void visitTransients (AttributeVisitor visitor) throws StorageException
{
super.visitAttributes (visitor);
}
public void visitAttributes (AttributeVisitor visitor) throws StorageException
{
super.visitAttributes (visitor);
visitor.visitField(this, FIELD_ReverseScore, HELPER_ReverseScore.toObject(getReverseScore()));
visitor.visitAssociation (_Factor);
}
public void visitAssociations (AssociationVisitor visitor, AssociatedScope scope) throws StorageException
{
super.visitAssociations (visitor, scope);
if (scope.includes (_Factor))
{
visitor.visit (_Factor);
}
}
public static FactorQuestionLink createFactorQuestionLink (ObjectTransaction transaction) throws StorageException
{
FactorQuestionLink result = new FactorQuestionLink ();
result.initialiseNewObject (transaction);
return result;
}
public static FactorQuestionLink getFactorQuestionLinkByID (ObjectTransaction transaction, Long objectID) throws StorageException
{
return (FactorQuestionLink)(transaction.getObjectByID (REFERENCE_FactorQuestionLink, objectID));
}
public boolean testFilter (String attribName, QueryFilter filter) throws StorageException
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_ReverseScore))
{
return filter.matches (getReverseScore ());
}
else if (attribName.equals (SINGLEREFERENCE_Factor))
{
return filter.matches (getFactor ());
}
else
{
return super.testFilter (attribName, filter);
}
}
public Object getAttribute (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_ReverseScore))
{
return HELPER_ReverseScore.toObject (getReverseScore ());
}
else
{
return super.getAttribute (attribName);
}
}
public AttributeHelper getAttributeHelper (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_ReverseScore))
{
return HELPER_ReverseScore;
}
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_ReverseScore))
{
setReverseScore ((String)(HELPER_ReverseScore.fromObject (_ReverseScore, 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_ReverseScore))
{
return getWriteability_ReverseScore ();
}
else if (fieldName.equals (SINGLEREFERENCE_Factor))
{
return getWriteability_Factor ();
}
else
{
return super.getWriteable (fieldName);
}
}
public void putUnwriteable (Set<String> fields)
{
if (getWriteability_ReverseScore () != FieldWriteability.TRUE)
{
fields.add (FIELD_ReverseScore);
}
super.putUnwriteable (fields);
}
public List<AbstractAttribute> getAttributes ()
{
List result = super.getAttributes ();
result.add(HELPER_ReverseScore.getAttribObject (getClass (), _ReverseScore, false, FIELD_ReverseScore));
return result;
}
public Map getAttributeMetadata (String attribute)
{
if (ATTRIBUTES_METADATA_FactorQuestionLink.containsKey (attribute))
{
return (Map)ATTRIBUTES_METADATA_FactorQuestionLink.get (attribute);
}
else
{
return super.getAttributeMetadata (attribute);
}
}
public Object getAttributeMetadata (String attribute, String metadata)
{
if (ATTRIBUTES_METADATA_FactorQuestionLink.containsKey (attribute))
{
return ((Map)ATTRIBUTES_METADATA_FactorQuestionLink.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 FactorQuestionLinkBehaviourDecorator extends BaseBusinessClass.BBCBehaviourDecorator<FactorQuestionLink>
{
/**
* Get the attribute ReverseScore
*/
public String getReverseScore (FactorQuestionLink obj, String original)
{
return original;
}
/**
* Change the value set for attribute ReverseScore.
* May modify the field beforehand
* Occurs before validation.
*/
public String setReverseScore (FactorQuestionLink obj, String newReverseScore) throws FieldException
{
return newReverseScore;
}
}
public ORMPipeLine pipes()
{
return new FactorQuestionLinkPipeLineFactory<FactorQuestionLink, FactorQuestionLink> ((FactorQuestionLink)this);
}
/**
* Use this instead of pipes() to get rid of type casting.
*/
public FactorQuestionLinkPipeLineFactory<FactorQuestionLink, FactorQuestionLink> pipelineFactorQuestionLink()
{
return (FactorQuestionLinkPipeLineFactory<FactorQuestionLink, FactorQuestionLink>) pipes();
}
public static FactorQuestionLinkPipeLineFactory<FactorQuestionLink, FactorQuestionLink> pipesFactorQuestionLink(Collection<FactorQuestionLink> items)
{
return REFERENCE_FactorQuestionLink.new FactorQuestionLinkPipeLineFactory<FactorQuestionLink, FactorQuestionLink> (items);
}
public static FactorQuestionLinkPipeLineFactory<FactorQuestionLink, FactorQuestionLink> pipesFactorQuestionLink(FactorQuestionLink[] _items)
{
return pipesFactorQuestionLink(Arrays.asList (_items));
}
public static FactorQuestionLinkPipeLineFactory<FactorQuestionLink, FactorQuestionLink> pipesFactorQuestionLink()
{
return pipesFactorQuestionLink((Collection)null);
}
public class FactorQuestionLinkPipeLineFactory<From extends BaseBusinessClass, Me extends FactorQuestionLink> extends BaseBusinessClass.ORMPipeLine<From, Me>
{
public <Prev> FactorQuestionLinkPipeLineFactory (PipeLine<From, Prev> pipeLine, Pipe<Prev, Me> nextPipe)
{
super (pipeLine, nextPipe);
}
public FactorQuestionLinkPipeLineFactory (From seed)
{
super(seed);
}
public FactorQuestionLinkPipeLineFactory (Collection<From> seed)
{
super(seed);
}
public PipeLine<From, ? extends Object> to(String name)
{
if (name.equals ("ReverseScore"))
{
return toReverseScore ();
}
if (name.equals ("Factor"))
{
return toFactor ();
}
return super.to(name);
}
public PipeLine<From, String> toReverseScore () { return pipe(new ORMAttributePipe<Me, String>(FIELD_ReverseScore)); }
public Factor.FactorPipeLineFactory<From, Factor> toFactor () { return toFactor (Filter.ALL); }
public Factor.FactorPipeLineFactory<From, Factor> toFactor (Filter<Factor> filter)
{
return Factor.REFERENCE_Factor.new FactorPipeLineFactory<From, Factor> (this, new ORMSingleAssocPipe<Me, Factor>(SINGLEREFERENCE_Factor, filter));
}
}
public boolean isTransientAttrib(String attribName)
{
return super.isTransientAttrib(attribName);
}
public boolean isTransientSingleReference(String assocName)
{
return super.isTransientSingleReference(assocName);
}
}
class DummyFactorQuestionLink extends FactorQuestionLink
{
// Default constructor primarily to support Externalisable
public DummyFactorQuestionLink()
{
super();
}
public void assertValid ()
{
}
public Factor getFactor () throws StorageException
{
return (Factor)(Factor.DUMMY_Factor);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getFactorID ()
{
return Factor.DUMMY_Factor.getObjectID();
}
}
/*
* IMPORTANT!!!! XSL Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2 rev3 [oneit.objstore.BusinessObjectTemplate.xsl]
*
* Version: 1.0
* Vendor: Apache Software Foundation (Xalan XSLTC)
* Vendor URL: http://xml.apache.org/xalan-j
*/
package performa.orm;
import java.io.*;
import java.util.*;
import oneit.appservices.config.*;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.objstore.assocs.*;
import oneit.objstore.attributes.*;
import oneit.objstore.rdbms.filters.*;
import oneit.objstore.parser.*;
import oneit.objstore.validator.*;
import oneit.objstore.utils.*;
import oneit.utils.*;
import oneit.utils.filter.Filter;
import oneit.utils.transform.*;
import oneit.utils.parsers.FieldException;
public abstract class BaseFactorScoreResult extends BaseBusinessClass
{
// Reference instance for the object
public static final FactorScoreResult REFERENCE_FactorScoreResult = new FactorScoreResult ();
// Reference instance for the object
public static final FactorScoreResult DUMMY_FactorScoreResult = new DummyFactorScoreResult ();
// Static constants corresponding to field names
public static final String FIELD_FromScore = "FromScore";
public static final String FIELD_ToScore = "ToScore";
public static final String FIELD_NarrativeCode = "NarrativeCode";
public static final String FIELD_ColorCode = "ColorCode";
public static final String SINGLEREFERENCE_Factor = "Factor";
public static final String SINGLEREFERENCE_Level = "Level";
// Static constants corresponding to searches
// Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper<FactorScoreResult> HELPER_FromScore = 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_ColorCode = DefaultAttributeHelper.INSTANCE;
// Private attributes corresponding to business object data
private Integer _FromScore;
private Integer _ToScore;
private String _NarrativeCode;
private String _ColorCode;
// Private attributes corresponding to single references
private SingleAssociation<FactorScoreResult, Factor> _Factor;
private SingleAssociation<FactorScoreResult, Level> _Level;
// Private attributes corresponding to multiple references
// Map of maps of metadata
private static final Map ATTRIBUTES_METADATA_FactorScoreResult = new HashMap ();
// Arrays of validators for each attribute
private static final AttributeValidator[] FIELD_FromScore_Validators;
private static final AttributeValidator[] FIELD_ToScore_Validators;
private static final AttributeValidator[] FIELD_NarrativeCode_Validators;
private static final AttributeValidator[] FIELD_ColorCode_Validators;
// Arrays of behaviour decorators
private static final FactorScoreResultBehaviourDecorator[] FactorScoreResult_BehaviourDecorators;
static
{
try
{
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
setupAssocMetaData_Factor();
setupAssocMetaData_Level();
FIELD_FromScore_Validators = (AttributeValidator[])setupAttribMetaData_FromScore(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_ToScore_Validators = (AttributeValidator[])setupAttribMetaData_ToScore(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_NarrativeCode_Validators = (AttributeValidator[])setupAttribMetaData_NarrativeCode(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_ColorCode_Validators = (AttributeValidator[])setupAttribMetaData_ColorCode(validatorMapping).toArray (new AttributeValidator[0]);
REFERENCE_FactorScoreResult.initialiseReference ();
DUMMY_FactorScoreResult.initialiseReference ();
FactorScoreResult_BehaviourDecorators = BaseBusinessClass.getBBCBehaviours(FactorScoreResult.class).toArray(new FactorScoreResultBehaviourDecorator[0]);
}
catch (RuntimeException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR1, e, "Error initialising");
throw e;
}
}
// Meta Info setup
private static void setupAssocMetaData_Factor()
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "factor_number");
metaInfo.put ("name", "Factor");
metaInfo.put ("type", "Factor");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for FactorScoreResult.Factor:", metaInfo);
ATTRIBUTES_METADATA_FactorScoreResult.put (SINGLEREFERENCE_Factor, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static void setupAssocMetaData_Level()
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "level_number");
metaInfo.put ("name", "Level");
metaInfo.put ("type", "Level");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for FactorScoreResult.Level:", metaInfo);
ATTRIBUTES_METADATA_FactorScoreResult.put (SINGLEREFERENCE_Level, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static List setupAttribMetaData_FromScore(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "from_score");
metaInfo.put ("name", "FromScore");
metaInfo.put ("type", "Integer");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for FactorScoreResult.FromScore:", metaInfo);
ATTRIBUTES_METADATA_FactorScoreResult.put (FIELD_FromScore, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(FactorScoreResult.class, "FromScore", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for FactorScoreResult.FromScore:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_ToScore(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "to_score");
metaInfo.put ("name", "ToScore");
metaInfo.put ("type", "Integer");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for FactorScoreResult.ToScore:", metaInfo);
ATTRIBUTES_METADATA_FactorScoreResult.put (FIELD_ToScore, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(FactorScoreResult.class, "ToScore", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for FactorScoreResult.ToScore:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_NarrativeCode(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "narrative_code");
metaInfo.put ("length", "15");
metaInfo.put ("name", "NarrativeCode");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for FactorScoreResult.NarrativeCode:", metaInfo);
ATTRIBUTES_METADATA_FactorScoreResult.put (FIELD_NarrativeCode, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(FactorScoreResult.class, "NarrativeCode", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for FactorScoreResult.NarrativeCode:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_ColorCode(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "color_code");
metaInfo.put ("length", "15");
metaInfo.put ("name", "ColorCode");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for FactorScoreResult.ColorCode:", metaInfo);
ATTRIBUTES_METADATA_FactorScoreResult.put (FIELD_ColorCode, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(FactorScoreResult.class, "ColorCode", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for FactorScoreResult.ColorCode:", validators);
return validators;
}
// END OF STATIC METADATA DEFINITION
// This constructor should not be called
protected BaseFactorScoreResult ()
{
}
protected BBCBehaviourDecorator[] getBehaviours()
{
return FactorScoreResult_BehaviourDecorators;
}
// Initialise the attributes
protected void _initialiseNewObjAttributes (ObjectTransaction transaction) throws StorageException
{
super._initialiseNewObjAttributes (transaction);
_FromScore = (Integer)(HELPER_FromScore.initialise (_FromScore));
_ToScore = (Integer)(HELPER_ToScore.initialise (_ToScore));
_NarrativeCode = (String)(HELPER_NarrativeCode.initialise (_NarrativeCode));
_ColorCode = (String)(HELPER_ColorCode.initialise (_ColorCode));
}
// Initialise the associations
protected void _initialiseAssociations ()
{
super._initialiseAssociations ();
_Factor = new SingleAssociation<FactorScoreResult, Factor> (this, SINGLEREFERENCE_Factor, null, Factor.REFERENCE_Factor, "level_factor");
_Level = new SingleAssociation<FactorScoreResult, Level> (this, SINGLEREFERENCE_Level, null, Level.REFERENCE_Level, "level_factor");
}
// Initialise the associations
protected BaseBusinessClass initialiseReference ()
{
super.initialiseReference ();
_Factor = new SingleAssociation<FactorScoreResult, Factor> (this, SINGLEREFERENCE_Factor, null, Factor.REFERENCE_Factor, "level_factor");
_Level = new SingleAssociation<FactorScoreResult, Level> (this, SINGLEREFERENCE_Level, null, Level.REFERENCE_Level, "level_factor");
return this;
}
/**
* Get the attribute FromScore
*/
public Integer getFromScore ()
{
assertValid();
Integer valToReturn = _FromScore;
for (FactorScoreResultBehaviourDecorator bhd : FactorScoreResult_BehaviourDecorators)
{
valToReturn = bhd.getFromScore ((FactorScoreResult)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 preFromScoreChange (Integer newFromScore) 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 postFromScoreChange () throws FieldException
{
}
public FieldWriteability getWriteability_FromScore ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute FromScore. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setFromScore (Integer newFromScore) throws FieldException
{
boolean oldAndNewIdentical = HELPER_FromScore.compare (_FromScore, newFromScore);
try
{
for (FactorScoreResultBehaviourDecorator bhd : FactorScoreResult_BehaviourDecorators)
{
newFromScore = bhd.setFromScore ((FactorScoreResult)this, newFromScore);
oldAndNewIdentical = HELPER_FromScore.compare (_FromScore, newFromScore);
}
if (FIELD_FromScore_Validators.length > 0)
{
Object newFromScoreObj = HELPER_FromScore.toObject (newFromScore);
if (newFromScoreObj != null)
{
int loopMax = FIELD_FromScore_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_FactorScoreResult.get (FIELD_FromScore);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_FromScore_Validators[v].checkAttribute (this, FIELD_FromScore, metadata, newFromScoreObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_FromScore () != FieldWriteability.FALSE, "Field FromScore is not writeable");
preFromScoreChange (newFromScore);
markFieldChange (FIELD_FromScore);
_FromScore = newFromScore;
postFieldChange (FIELD_FromScore);
postFromScoreChange ();
}
}
/**
* Get the attribute ToScore
*/
public Integer getToScore ()
{
assertValid();
Integer valToReturn = _ToScore;
for (FactorScoreResultBehaviourDecorator bhd : FactorScoreResult_BehaviourDecorators)
{
valToReturn = bhd.getToScore ((FactorScoreResult)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 preToScoreChange (Integer newToScore) 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 postToScoreChange () throws FieldException
{
}
public FieldWriteability getWriteability_ToScore ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute ToScore. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setToScore (Integer newToScore) throws FieldException
{
boolean oldAndNewIdentical = HELPER_ToScore.compare (_ToScore, newToScore);
try
{
for (FactorScoreResultBehaviourDecorator bhd : FactorScoreResult_BehaviourDecorators)
{
newToScore = bhd.setToScore ((FactorScoreResult)this, newToScore);
oldAndNewIdentical = HELPER_ToScore.compare (_ToScore, newToScore);
}
if (FIELD_ToScore_Validators.length > 0)
{
Object newToScoreObj = HELPER_ToScore.toObject (newToScore);
if (newToScoreObj != null)
{
int loopMax = FIELD_ToScore_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_FactorScoreResult.get (FIELD_ToScore);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_ToScore_Validators[v].checkAttribute (this, FIELD_ToScore, metadata, newToScoreObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_ToScore () != FieldWriteability.FALSE, "Field ToScore is not writeable");
preToScoreChange (newToScore);
markFieldChange (FIELD_ToScore);
_ToScore = newToScore;
postFieldChange (FIELD_ToScore);
postToScoreChange ();
}
}
/**
* Get the attribute NarrativeCode
*/
public String getNarrativeCode ()
{
assertValid();
String valToReturn = _NarrativeCode;
for (FactorScoreResultBehaviourDecorator bhd : FactorScoreResult_BehaviourDecorators)
{
valToReturn = bhd.getNarrativeCode ((FactorScoreResult)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 preNarrativeCodeChange (String newNarrativeCode) 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 postNarrativeCodeChange () throws FieldException
{
}
public FieldWriteability getWriteability_NarrativeCode ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute NarrativeCode. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setNarrativeCode (String newNarrativeCode) throws FieldException
{
boolean oldAndNewIdentical = HELPER_NarrativeCode.compare (_NarrativeCode, newNarrativeCode);
try
{
for (FactorScoreResultBehaviourDecorator bhd : FactorScoreResult_BehaviourDecorators)
{
newNarrativeCode = bhd.setNarrativeCode ((FactorScoreResult)this, newNarrativeCode);
oldAndNewIdentical = HELPER_NarrativeCode.compare (_NarrativeCode, newNarrativeCode);
}
if (FIELD_NarrativeCode_Validators.length > 0)
{
Object newNarrativeCodeObj = HELPER_NarrativeCode.toObject (newNarrativeCode);
if (newNarrativeCodeObj != null)
{
int loopMax = FIELD_NarrativeCode_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_FactorScoreResult.get (FIELD_NarrativeCode);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_NarrativeCode_Validators[v].checkAttribute (this, FIELD_NarrativeCode, metadata, newNarrativeCodeObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_NarrativeCode () != FieldWriteability.FALSE, "Field NarrativeCode is not writeable");
preNarrativeCodeChange (newNarrativeCode);
markFieldChange (FIELD_NarrativeCode);
_NarrativeCode = newNarrativeCode;
postFieldChange (FIELD_NarrativeCode);
postNarrativeCodeChange ();
}
}
/**
* Get the attribute ColorCode
*/
public String getColorCode ()
{
assertValid();
String valToReturn = _ColorCode;
for (FactorScoreResultBehaviourDecorator bhd : FactorScoreResult_BehaviourDecorators)
{
valToReturn = bhd.getColorCode ((FactorScoreResult)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 preColorCodeChange (String newColorCode) 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 postColorCodeChange () throws FieldException
{
}
public FieldWriteability getWriteability_ColorCode ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute ColorCode. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setColorCode (String newColorCode) throws FieldException
{
boolean oldAndNewIdentical = HELPER_ColorCode.compare (_ColorCode, newColorCode);
try
{
for (FactorScoreResultBehaviourDecorator bhd : FactorScoreResult_BehaviourDecorators)
{
newColorCode = bhd.setColorCode ((FactorScoreResult)this, newColorCode);
oldAndNewIdentical = HELPER_ColorCode.compare (_ColorCode, newColorCode);
}
if (FIELD_ColorCode_Validators.length > 0)
{
Object newColorCodeObj = HELPER_ColorCode.toObject (newColorCode);
if (newColorCodeObj != null)
{
int loopMax = FIELD_ColorCode_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_FactorScoreResult.get (FIELD_ColorCode);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_ColorCode_Validators[v].checkAttribute (this, FIELD_ColorCode, metadata, newColorCodeObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_ColorCode () != FieldWriteability.FALSE, "Field ColorCode is not writeable");
preColorCodeChange (newColorCode);
markFieldChange (FIELD_ColorCode);
_ColorCode = newColorCode;
postFieldChange (FIELD_ColorCode);
postColorCodeChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getSingleAssocs()
{
List result = super.getSingleAssocs ();
result.add("Factor");
result.add("Level");
return result;
}
public BaseBusinessClass getSingleAssocReferenceInstance (String assocName)
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Factor))
{
return _Factor.getReferencedType ();
}else if (assocName.equals (SINGLEREFERENCE_Level))
{
return _Level.getReferencedType ();
}
else
{
return super.getSingleAssocReferenceInstance (assocName);
}
}
public String getSingleAssocBackReference(String assocName)
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Factor))
{
return null ;
}else if (assocName.equals (SINGLEREFERENCE_Level))
{
return null ;
}
else
{
return super.getSingleAssocBackReference (assocName);
}
}
public BaseBusinessClass getSingleAssoc (String assocName) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Factor))
{
return getFactor ();
}else if (assocName.equals (SINGLEREFERENCE_Level))
{
return getLevel ();
}
else
{
return super.getSingleAssoc (assocName);
}
}
public BaseBusinessClass getSingleAssoc (String assocName, Get getType) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Factor))
{
return getFactor (getType);
}else if (assocName.equals (SINGLEREFERENCE_Level))
{
return getLevel (getType);
}
else
{
return super.getSingleAssoc (assocName, getType);
}
}
public Long getSingleAssocID (String assocName) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Factor))
{
return getFactorID ();
}else if (assocName.equals (SINGLEREFERENCE_Level))
{
return getLevelID ();
}
else
{
return super.getSingleAssocID (assocName);
}
}
public void setSingleAssoc (String assocName, BaseBusinessClass newValue) throws StorageException, FieldException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Factor))
{
setFactor ((Factor)(newValue));
}else if (assocName.equals (SINGLEREFERENCE_Level))
{
setLevel ((Level)(newValue));
}
else
{
super.setSingleAssoc (assocName, newValue);
}
}
/**
* Get the reference Factor
*/
public Factor getFactor () throws StorageException
{
assertValid();
try
{
return (Factor)(_Factor.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in FactorScoreResult:", this.getObjectID (), ", was trying to get Factor:", getFactorID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _Factor.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Factor getFactor (Get getType) throws StorageException
{
assertValid();
return _Factor.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getFactorID ()
{
assertValid();
if (_Factor == null)
{
return null;
}
else
{
return _Factor.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 preFactorChange (Factor newFactor) 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 postFactorChange () throws FieldException
{
}
public FieldWriteability getWriteability_Factor ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference Factor. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setFactor (Factor newFactor) throws StorageException, FieldException
{
if (_Factor.wouldReferencedChange (newFactor))
{
assertValid();
Debug.assertion (getWriteability_Factor () != FieldWriteability.FALSE, "Assoc Factor is not writeable");
preFactorChange (newFactor);
_Factor.set (newFactor);
postFactorChange ();
}
}
/**
* Get the reference Level
*/
public Level getLevel () throws StorageException
{
assertValid();
try
{
return (Level)(_Level.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in FactorScoreResult:", this.getObjectID (), ", was trying to get Level:", getLevelID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _Level.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Level getLevel (Get getType) throws StorageException
{
assertValid();
return _Level.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getLevelID ()
{
assertValid();
if (_Level == null)
{
return null;
}
else
{
return _Level.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 preLevelChange (Level newLevel) 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 postLevelChange () throws FieldException
{
}
public FieldWriteability getWriteability_Level ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference Level. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setLevel (Level newLevel) throws StorageException, FieldException
{
if (_Level.wouldReferencedChange (newLevel))
{
assertValid();
Debug.assertion (getWriteability_Level () != FieldWriteability.FALSE, "Assoc Level is not writeable");
preLevelChange (newLevel);
_Level.set (newLevel);
postLevelChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getMultiAssocs()
{
List result = super.getMultiAssocs ();
return result;
}
/**
* Get the reference instance for the multi assoc name.
*/
public BaseBusinessClass getMultiAssocReferenceInstance(String attribName)
{
return super.getMultiAssocReferenceInstance(attribName);
}
public String getMultiAssocBackReference(String attribName)
{
return super.getMultiAssocBackReference(attribName);
}
/**
* Get the assoc count for the multi assoc name.
*/
public int getMultiAssocCount(String attribName) throws StorageException
{
return super.getMultiAssocCount(attribName);
}
/**
* Get the assoc at a particular index
*/
public BaseBusinessClass getMultiAssocAt(String attribName, int index) throws StorageException
{
return super.getMultiAssocAt(attribName, index);
}
/**
* Add to a multi assoc by attribute name
*/
public void addToMultiAssoc(String attribName, BaseBusinessClass newElement) throws StorageException
{
super.addToMultiAssoc(attribName, newElement);
}
/**
* Remove from a multi assoc by attribute name
*/
public void removeFromMultiAssoc(String attribName, BaseBusinessClass oldElement) throws StorageException
{
super.removeFromMultiAssoc(attribName, oldElement);
}
protected void __loadMultiAssoc (String attribName, BaseBusinessClass[] elements)
{
super.__loadMultiAssoc(attribName, elements);
}
protected boolean __isMultiAssocLoaded (String attribName)
{
return super.__isMultiAssocLoaded(attribName);
}
public void onDelete ()
{
try
{
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
super.onDelete ();
}
public FactorScoreResult newInstance ()
{
return new FactorScoreResult ();
}
public FactorScoreResult referenceInstance ()
{
return REFERENCE_FactorScoreResult;
}
public FactorScoreResult getInTransaction (ObjectTransaction t) throws StorageException
{
return getFactorScoreResultByID (t, getObjectID());
}
public BaseBusinessClass dummyInstance ()
{
return DUMMY_FactorScoreResult;
}
public String getBaseSetName ()
{
return "level_factor";
}
/**
* 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 level_factorPSet = allSets.getPersistentSet (myID, "level_factor", myPSetStatus);
level_factorPSet.setAttrib (FIELD_ObjectID, myID);
level_factorPSet.setAttrib (FIELD_FromScore, HELPER_FromScore.toObject (_FromScore)); //
level_factorPSet.setAttrib (FIELD_ToScore, HELPER_ToScore.toObject (_ToScore)); //
level_factorPSet.setAttrib (FIELD_NarrativeCode, HELPER_NarrativeCode.toObject (_NarrativeCode)); //
level_factorPSet.setAttrib (FIELD_ColorCode, HELPER_ColorCode.toObject (_ColorCode)); //
_Factor.getPersistentSets (allSets);
_Level.getPersistentSets (allSets);
}
/**
* Sets the objects state based on Persistent sets.
*/
public void setFromPersistentSets (ObjectID objectID, PersistentSetCollection allSets)
{
super.setFromPersistentSets (objectID, allSets);
PersistentSet level_factorPSet = allSets.getPersistentSet (objectID, "level_factor");
_FromScore = (Integer)(HELPER_FromScore.fromObject (_FromScore, level_factorPSet.getAttrib (FIELD_FromScore))); //
_ToScore = (Integer)(HELPER_ToScore.fromObject (_ToScore, level_factorPSet.getAttrib (FIELD_ToScore))); //
_NarrativeCode = (String)(HELPER_NarrativeCode.fromObject (_NarrativeCode, level_factorPSet.getAttrib (FIELD_NarrativeCode))); //
_ColorCode = (String)(HELPER_ColorCode.fromObject (_ColorCode, level_factorPSet.getAttrib (FIELD_ColorCode))); //
_Factor.setFromPersistentSets (objectID, allSets);
_Level.setFromPersistentSets (objectID, allSets);
}
public void setAttributesFrom (BaseBusinessClass other, MultiException e)
{
super.setAttributesFrom (other, e);
if (other instanceof FactorScoreResult)
{
FactorScoreResult otherFactorScoreResult = (FactorScoreResult)other;
try
{
setFromScore (otherFactorScoreResult.getFromScore ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setToScore (otherFactorScoreResult.getToScore ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setNarrativeCode (otherFactorScoreResult.getNarrativeCode ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setColorCode (otherFactorScoreResult.getColorCode ());
}
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 BaseFactorScoreResult)
{
BaseFactorScoreResult sourceFactorScoreResult = (BaseFactorScoreResult)(source);
_FromScore = sourceFactorScoreResult._FromScore;
_ToScore = sourceFactorScoreResult._ToScore;
_NarrativeCode = sourceFactorScoreResult._NarrativeCode;
_ColorCode = sourceFactorScoreResult._ColorCode;
}
}
/**
* 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 BaseFactorScoreResult)
{
BaseFactorScoreResult sourceFactorScoreResult = (BaseFactorScoreResult)(source);
_Factor.copyFrom (sourceFactorScoreResult._Factor, linkToGhosts);
_Level.copyFrom (sourceFactorScoreResult._Level, linkToGhosts);
}
}
/**
* Set the associations in this to copies of the attributes in source.
*/
public void copyAssociationsFrom (BaseBusinessClass source, boolean linkToGhosts)
{
super.copyAssociationsFrom (source, linkToGhosts);
if (source instanceof BaseFactorScoreResult)
{
BaseFactorScoreResult sourceFactorScoreResult = (BaseFactorScoreResult)(source);
}
}
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);
_FromScore = (Integer)(HELPER_FromScore.readExternal (_FromScore, vals.get(FIELD_FromScore))); //
_ToScore = (Integer)(HELPER_ToScore.readExternal (_ToScore, vals.get(FIELD_ToScore))); //
_NarrativeCode = (String)(HELPER_NarrativeCode.readExternal (_NarrativeCode, vals.get(FIELD_NarrativeCode))); //
_ColorCode = (String)(HELPER_ColorCode.readExternal (_ColorCode, vals.get(FIELD_ColorCode))); //
_Factor.readExternalData(vals.get(SINGLEREFERENCE_Factor));
_Level.readExternalData(vals.get(SINGLEREFERENCE_Level));
}
/**
* Subclasses must override this to write out their attributes
*/
protected void writeExternalData(Map<String, Object> vals) throws IOException
{
super.writeExternalData(vals);
vals.put (FIELD_FromScore, HELPER_FromScore.writeExternal (_FromScore));
vals.put (FIELD_ToScore, HELPER_ToScore.writeExternal (_ToScore));
vals.put (FIELD_NarrativeCode, HELPER_NarrativeCode.writeExternal (_NarrativeCode));
vals.put (FIELD_ColorCode, HELPER_ColorCode.writeExternal (_ColorCode));
vals.put (SINGLEREFERENCE_Factor, _Factor.writeExternalData());
vals.put (SINGLEREFERENCE_Level, _Level.writeExternalData());
}
public void compare (BaseBusinessClass other, AttributeChangeListener listener) throws StorageException
{
super.compare (other, listener);
if (other instanceof BaseFactorScoreResult)
{
BaseFactorScoreResult otherFactorScoreResult = (BaseFactorScoreResult)(other);
if (!HELPER_FromScore.compare(this._FromScore, otherFactorScoreResult._FromScore))
{
listener.notifyFieldChange(this, other, FIELD_FromScore, HELPER_FromScore.toObject(this._FromScore), HELPER_FromScore.toObject(otherFactorScoreResult._FromScore));
}
if (!HELPER_ToScore.compare(this._ToScore, otherFactorScoreResult._ToScore))
{
listener.notifyFieldChange(this, other, FIELD_ToScore, HELPER_ToScore.toObject(this._ToScore), HELPER_ToScore.toObject(otherFactorScoreResult._ToScore));
}
if (!HELPER_NarrativeCode.compare(this._NarrativeCode, otherFactorScoreResult._NarrativeCode))
{
listener.notifyFieldChange(this, other, FIELD_NarrativeCode, HELPER_NarrativeCode.toObject(this._NarrativeCode), HELPER_NarrativeCode.toObject(otherFactorScoreResult._NarrativeCode));
}
if (!HELPER_ColorCode.compare(this._ColorCode, otherFactorScoreResult._ColorCode))
{
listener.notifyFieldChange(this, other, FIELD_ColorCode, HELPER_ColorCode.toObject(this._ColorCode), HELPER_ColorCode.toObject(otherFactorScoreResult._ColorCode));
}
// Compare single assocs
_Factor.compare (otherFactorScoreResult._Factor, listener);
_Level.compare (otherFactorScoreResult._Level, listener);
// Compare multiple assocs
}
}
public void visitTransients (AttributeVisitor visitor) throws StorageException
{
super.visitAttributes (visitor);
}
public void visitAttributes (AttributeVisitor visitor) throws StorageException
{
super.visitAttributes (visitor);
visitor.visitField(this, FIELD_FromScore, HELPER_FromScore.toObject(getFromScore()));
visitor.visitField(this, FIELD_ToScore, HELPER_ToScore.toObject(getToScore()));
visitor.visitField(this, FIELD_NarrativeCode, HELPER_NarrativeCode.toObject(getNarrativeCode()));
visitor.visitField(this, FIELD_ColorCode, HELPER_ColorCode.toObject(getColorCode()));
visitor.visitAssociation (_Factor);
visitor.visitAssociation (_Level);
}
public void visitAssociations (AssociationVisitor visitor, AssociatedScope scope) throws StorageException
{
super.visitAssociations (visitor, scope);
if (scope.includes (_Factor))
{
visitor.visit (_Factor);
}
if (scope.includes (_Level))
{
visitor.visit (_Level);
}
}
public static FactorScoreResult createFactorScoreResult (ObjectTransaction transaction) throws StorageException
{
FactorScoreResult result = new FactorScoreResult ();
result.initialiseNewObject (transaction);
return result;
}
public static FactorScoreResult getFactorScoreResultByID (ObjectTransaction transaction, Long objectID) throws StorageException
{
return (FactorScoreResult)(transaction.getObjectByID (REFERENCE_FactorScoreResult, objectID));
}
public boolean testFilter (String attribName, QueryFilter filter) throws StorageException
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_FromScore))
{
return filter.matches (getFromScore ());
}
else if (attribName.equals (FIELD_ToScore))
{
return filter.matches (getToScore ());
}
else if (attribName.equals (FIELD_NarrativeCode))
{
return filter.matches (getNarrativeCode ());
}
else if (attribName.equals (FIELD_ColorCode))
{
return filter.matches (getColorCode ());
}
else if (attribName.equals (SINGLEREFERENCE_Factor))
{
return filter.matches (getFactor ());
}
else if (attribName.equals (SINGLEREFERENCE_Level))
{
return filter.matches (getLevel ());
}
else
{
return super.testFilter (attribName, filter);
}
}
public Object getAttribute (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_FromScore))
{
return HELPER_FromScore.toObject (getFromScore ());
}
else if (attribName.equals (FIELD_ToScore))
{
return HELPER_ToScore.toObject (getToScore ());
}
else if (attribName.equals (FIELD_NarrativeCode))
{
return HELPER_NarrativeCode.toObject (getNarrativeCode ());
}
else if (attribName.equals (FIELD_ColorCode))
{
return HELPER_ColorCode.toObject (getColorCode ());
}
else
{
return super.getAttribute (attribName);
}
}
public AttributeHelper getAttributeHelper (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_FromScore))
{
return HELPER_FromScore;
}
else if (attribName.equals (FIELD_ToScore))
{
return HELPER_ToScore;
}
else if (attribName.equals (FIELD_NarrativeCode))
{
return HELPER_NarrativeCode;
}
else if (attribName.equals (FIELD_ColorCode))
{
return HELPER_ColorCode;
}
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_FromScore))
{
setFromScore ((Integer)(HELPER_FromScore.fromObject (_FromScore, attribValue)));
}
else if (attribName.equals (FIELD_ToScore))
{
setToScore ((Integer)(HELPER_ToScore.fromObject (_ToScore, attribValue)));
}
else if (attribName.equals (FIELD_NarrativeCode))
{
setNarrativeCode ((String)(HELPER_NarrativeCode.fromObject (_NarrativeCode, attribValue)));
}
else if (attribName.equals (FIELD_ColorCode))
{
setColorCode ((String)(HELPER_ColorCode.fromObject (_ColorCode, 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_FromScore))
{
return getWriteability_FromScore ();
}
else if (fieldName.equals (FIELD_ToScore))
{
return getWriteability_ToScore ();
}
else if (fieldName.equals (FIELD_NarrativeCode))
{
return getWriteability_NarrativeCode ();
}
else if (fieldName.equals (FIELD_ColorCode))
{
return getWriteability_ColorCode ();
}
else if (fieldName.equals (SINGLEREFERENCE_Factor))
{
return getWriteability_Factor ();
}
else if (fieldName.equals (SINGLEREFERENCE_Level))
{
return getWriteability_Level ();
}
else
{
return super.getWriteable (fieldName);
}
}
public void putUnwriteable (Set<String> fields)
{
if (getWriteability_FromScore () != FieldWriteability.TRUE)
{
fields.add (FIELD_FromScore);
}
if (getWriteability_ToScore () != FieldWriteability.TRUE)
{
fields.add (FIELD_ToScore);
}
if (getWriteability_NarrativeCode () != FieldWriteability.TRUE)
{
fields.add (FIELD_NarrativeCode);
}
if (getWriteability_ColorCode () != FieldWriteability.TRUE)
{
fields.add (FIELD_ColorCode);
}
super.putUnwriteable (fields);
}
public List<AbstractAttribute> getAttributes ()
{
List result = super.getAttributes ();
result.add(HELPER_FromScore.getAttribObject (getClass (), _FromScore, false, FIELD_FromScore));
result.add(HELPER_ToScore.getAttribObject (getClass (), _ToScore, false, FIELD_ToScore));
result.add(HELPER_NarrativeCode.getAttribObject (getClass (), _NarrativeCode, false, FIELD_NarrativeCode));
result.add(HELPER_ColorCode.getAttribObject (getClass (), _ColorCode, false, FIELD_ColorCode));
return result;
}
public Map getAttributeMetadata (String attribute)
{
if (ATTRIBUTES_METADATA_FactorScoreResult.containsKey (attribute))
{
return (Map)ATTRIBUTES_METADATA_FactorScoreResult.get (attribute);
}
else
{
return super.getAttributeMetadata (attribute);
}
}
public Object getAttributeMetadata (String attribute, String metadata)
{
if (ATTRIBUTES_METADATA_FactorScoreResult.containsKey (attribute))
{
return ((Map)ATTRIBUTES_METADATA_FactorScoreResult.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 FactorScoreResultBehaviourDecorator extends BaseBusinessClass.BBCBehaviourDecorator<FactorScoreResult>
{
/**
* Get the attribute FromScore
*/
public Integer getFromScore (FactorScoreResult obj, Integer original)
{
return original;
}
/**
* Change the value set for attribute FromScore.
* May modify the field beforehand
* Occurs before validation.
*/
public Integer setFromScore (FactorScoreResult obj, Integer newFromScore) throws FieldException
{
return newFromScore;
}
/**
* Get the attribute ToScore
*/
public Integer getToScore (FactorScoreResult obj, Integer original)
{
return original;
}
/**
* Change the value set for attribute ToScore.
* May modify the field beforehand
* Occurs before validation.
*/
public Integer setToScore (FactorScoreResult obj, Integer newToScore) throws FieldException
{
return newToScore;
}
/**
* Get the attribute NarrativeCode
*/
public String getNarrativeCode (FactorScoreResult obj, String original)
{
return original;
}
/**
* Change the value set for attribute NarrativeCode.
* May modify the field beforehand
* Occurs before validation.
*/
public String setNarrativeCode (FactorScoreResult obj, String newNarrativeCode) throws FieldException
{
return newNarrativeCode;
}
/**
* Get the attribute ColorCode
*/
public String getColorCode (FactorScoreResult obj, String original)
{
return original;
}
/**
* Change the value set for attribute ColorCode.
* May modify the field beforehand
* Occurs before validation.
*/
public String setColorCode (FactorScoreResult obj, String newColorCode) throws FieldException
{
return newColorCode;
}
}
public ORMPipeLine pipes()
{
return new FactorScoreResultPipeLineFactory<FactorScoreResult, FactorScoreResult> ((FactorScoreResult)this);
}
/**
* Use this instead of pipes() to get rid of type casting.
*/
public FactorScoreResultPipeLineFactory<FactorScoreResult, FactorScoreResult> pipelineFactorScoreResult()
{
return (FactorScoreResultPipeLineFactory<FactorScoreResult, FactorScoreResult>) pipes();
}
public static FactorScoreResultPipeLineFactory<FactorScoreResult, FactorScoreResult> pipesFactorScoreResult(Collection<FactorScoreResult> items)
{
return REFERENCE_FactorScoreResult.new FactorScoreResultPipeLineFactory<FactorScoreResult, FactorScoreResult> (items);
}
public static FactorScoreResultPipeLineFactory<FactorScoreResult, FactorScoreResult> pipesFactorScoreResult(FactorScoreResult[] _items)
{
return pipesFactorScoreResult(Arrays.asList (_items));
}
public static FactorScoreResultPipeLineFactory<FactorScoreResult, FactorScoreResult> pipesFactorScoreResult()
{
return pipesFactorScoreResult((Collection)null);
}
public class FactorScoreResultPipeLineFactory<From extends BaseBusinessClass, Me extends FactorScoreResult> extends BaseBusinessClass.ORMPipeLine<From, Me>
{
public <Prev> FactorScoreResultPipeLineFactory (PipeLine<From, Prev> pipeLine, Pipe<Prev, Me> nextPipe)
{
super (pipeLine, nextPipe);
}
public FactorScoreResultPipeLineFactory (From seed)
{
super(seed);
}
public FactorScoreResultPipeLineFactory (Collection<From> seed)
{
super(seed);
}
public PipeLine<From, ? extends Object> to(String name)
{
if (name.equals ("FromScore"))
{
return toFromScore ();
}
if (name.equals ("ToScore"))
{
return toToScore ();
}
if (name.equals ("NarrativeCode"))
{
return toNarrativeCode ();
}
if (name.equals ("ColorCode"))
{
return toColorCode ();
}
if (name.equals ("Factor"))
{
return toFactor ();
}
if (name.equals ("Level"))
{
return toLevel ();
}
return super.to(name);
}
public PipeLine<From, Integer> toFromScore () { return pipe(new ORMAttributePipe<Me, Integer>(FIELD_FromScore)); }
public PipeLine<From, Integer> toToScore () { return pipe(new ORMAttributePipe<Me, Integer>(FIELD_ToScore)); }
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 Factor.FactorPipeLineFactory<From, Factor> toFactor () { return toFactor (Filter.ALL); }
public Factor.FactorPipeLineFactory<From, Factor> toFactor (Filter<Factor> filter)
{
return Factor.REFERENCE_Factor.new FactorPipeLineFactory<From, Factor> (this, new ORMSingleAssocPipe<Me, Factor>(SINGLEREFERENCE_Factor, filter));
}
public Level.LevelPipeLineFactory<From, Level> toLevel () { return toLevel (Filter.ALL); }
public Level.LevelPipeLineFactory<From, Level> toLevel (Filter<Level> filter)
{
return Level.REFERENCE_Level.new LevelPipeLineFactory<From, Level> (this, new ORMSingleAssocPipe<Me, Level>(SINGLEREFERENCE_Level, filter));
}
}
public boolean isTransientAttrib(String attribName)
{
return super.isTransientAttrib(attribName);
}
public boolean isTransientSingleReference(String assocName)
{
return super.isTransientSingleReference(assocName);
}
}
class DummyFactorScoreResult extends FactorScoreResult
{
// Default constructor primarily to support Externalisable
public DummyFactorScoreResult()
{
super();
}
public void assertValid ()
{
}
public Factor getFactor () throws StorageException
{
return (Factor)(Factor.DUMMY_Factor);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getFactorID ()
{
return Factor.DUMMY_Factor.getObjectID();
}
public Level getLevel () throws StorageException
{
return (Level)(Level.DUMMY_Level);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getLevelID ()
{
return Level.DUMMY_Level.getObjectID();
}
}
/*
* IMPORTANT!!!! XSL Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2 rev3 [oneit.objstore.BusinessObjectTemplate.xsl]
*
* Version: 1.0
* Vendor: Apache Software Foundation (Xalan XSLTC)
* Vendor URL: http://xml.apache.org/xalan-j
*/
package performa.orm;
import java.io.*;
import java.util.*;
import oneit.appservices.config.*;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.objstore.assocs.*;
import oneit.objstore.attributes.*;
import oneit.objstore.rdbms.filters.*;
import oneit.objstore.parser.*;
import oneit.objstore.validator.*;
import oneit.objstore.utils.*;
import oneit.utils.*;
import oneit.utils.filter.Filter;
import oneit.utils.transform.*;
import oneit.utils.parsers.FieldException;
public abstract class BaseLevel extends BaseBusinessClass
{
// Reference instance for the object
public static final Level REFERENCE_Level = new Level ();
// Reference instance for the object
public static final Level DUMMY_Level = new DummyLevel ();
// 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_LevelNotes = "LevelNotes";
public static final String MULTIPLEREFERENCE_Factors = "Factors";
public static final String BACKREF_Factors = "";
// Static constants corresponding to searches
// 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_LevelNotes = DefaultAttributeHelper.INSTANCE;
// Private attributes corresponding to business object data
private Integer _LevelNo;
private String _LevelDescription;
private String _LevelNotes;
// Private attributes corresponding to single references
// Private attributes corresponding to multiple references
private MultipleAssociation<Level, Factor> _Factors;
// Map of maps of metadata
private static final Map ATTRIBUTES_METADATA_Level = new HashMap ();
// 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_LevelNotes_Validators;
// Arrays of behaviour decorators
private static final LevelBehaviourDecorator[] Level_BehaviourDecorators;
static
{
try
{
String tmp_Factors = Factor.BACKREF_Level;
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
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_LevelNotes_Validators = (AttributeValidator[])setupAttribMetaData_LevelNotes(validatorMapping).toArray (new AttributeValidator[0]);
REFERENCE_Level.initialiseReference ();
DUMMY_Level.initialiseReference ();
Level_BehaviourDecorators = BaseBusinessClass.getBBCBehaviours(Level.class).toArray(new LevelBehaviourDecorator[0]);
}
catch (RuntimeException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR1, e, "Error initialising");
throw e;
}
}
// Meta Info setup
private static void setupAssocMetaData_Factors()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "Level");
metaInfo.put ("name", "Factors");
metaInfo.put ("type", "Factor");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Level.Factors:", metaInfo);
ATTRIBUTES_METADATA_Level.put (MULTIPLEREFERENCE_Factors, Collections.unmodifiableMap (metaInfo));
}
// 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)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "level_desc");
metaInfo.put ("length", "30");
metaInfo.put ("name", "LevelDescription");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Level.LevelDescription:", metaInfo);
ATTRIBUTES_METADATA_Level.put (FIELD_LevelDescription, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(Level.class, "LevelDescription", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for Level.LevelDescription:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_LevelNotes(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "level_notes");
metaInfo.put ("name", "LevelNotes");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Level.LevelNotes:", metaInfo);
ATTRIBUTES_METADATA_Level.put (FIELD_LevelNotes, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(Level.class, "LevelNotes", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for Level.LevelNotes:", validators);
return validators;
}
// END OF STATIC METADATA DEFINITION
// This constructor should not be called
protected BaseLevel ()
{
}
protected BBCBehaviourDecorator[] getBehaviours()
{
return Level_BehaviourDecorators;
}
// Initialise the attributes
protected void _initialiseNewObjAttributes (ObjectTransaction transaction) throws StorageException
{
super._initialiseNewObjAttributes (transaction);
_LevelNo = (Integer)(HELPER_LevelNo.initialise (_LevelNo));
_LevelDescription = (String)(HELPER_LevelDescription.initialise (_LevelDescription));
_LevelNotes = (String)(HELPER_LevelNotes.initialise (_LevelNotes));
}
// Initialise the associations
protected void _initialiseAssociations ()
{
super._initialiseAssociations ();
_Factors = new MultipleAssociation<Level, Factor> (this, MULTIPLEREFERENCE_Factors, Factor.SINGLEREFERENCE_Level, Factor.REFERENCE_Factor);
}
// Initialise the associations
protected BaseBusinessClass initialiseReference ()
{
super.initialiseReference ();
_Factors = new MultipleAssociation<Level, Factor> (this, MULTIPLEREFERENCE_Factors, Factor.SINGLEREFERENCE_Level, Factor.REFERENCE_Factor);
return this;
}
/**
* Get the attribute LevelNo
*/
public Integer getLevelNo ()
{
assertValid();
Integer valToReturn = _LevelNo;
for (LevelBehaviourDecorator bhd : Level_BehaviourDecorators)
{
valToReturn = bhd.getLevelNo ((Level)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 preLevelNoChange (Integer newLevelNo) 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 postLevelNoChange () throws FieldException
{
}
public FieldWriteability getWriteability_LevelNo ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute LevelNo. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setLevelNo (Integer newLevelNo) throws FieldException
{
boolean oldAndNewIdentical = HELPER_LevelNo.compare (_LevelNo, newLevelNo);
try
{
for (LevelBehaviourDecorator bhd : Level_BehaviourDecorators)
{
newLevelNo = bhd.setLevelNo ((Level)this, newLevelNo);
oldAndNewIdentical = HELPER_LevelNo.compare (_LevelNo, newLevelNo);
}
if (FIELD_LevelNo_Validators.length > 0)
{
Object newLevelNoObj = HELPER_LevelNo.toObject (newLevelNo);
if (newLevelNoObj != null)
{
int loopMax = FIELD_LevelNo_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_Level.get (FIELD_LevelNo);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_LevelNo_Validators[v].checkAttribute (this, FIELD_LevelNo, metadata, newLevelNoObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_LevelNo () != FieldWriteability.FALSE, "Field LevelNo is not writeable");
preLevelNoChange (newLevelNo);
markFieldChange (FIELD_LevelNo);
_LevelNo = newLevelNo;
postFieldChange (FIELD_LevelNo);
postLevelNoChange ();
}
}
/**
* Get the attribute LevelDescription
*/
public String getLevelDescription ()
{
assertValid();
String valToReturn = _LevelDescription;
for (LevelBehaviourDecorator bhd : Level_BehaviourDecorators)
{
valToReturn = bhd.getLevelDescription ((Level)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 preLevelDescriptionChange (String newLevelDescription) 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 postLevelDescriptionChange () throws FieldException
{
}
public FieldWriteability getWriteability_LevelDescription ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute LevelDescription. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setLevelDescription (String newLevelDescription) throws FieldException
{
boolean oldAndNewIdentical = HELPER_LevelDescription.compare (_LevelDescription, newLevelDescription);
try
{
for (LevelBehaviourDecorator bhd : Level_BehaviourDecorators)
{
newLevelDescription = bhd.setLevelDescription ((Level)this, newLevelDescription);
oldAndNewIdentical = HELPER_LevelDescription.compare (_LevelDescription, newLevelDescription);
}
if (FIELD_LevelDescription_Validators.length > 0)
{
Object newLevelDescriptionObj = HELPER_LevelDescription.toObject (newLevelDescription);
if (newLevelDescriptionObj != null)
{
int loopMax = FIELD_LevelDescription_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_Level.get (FIELD_LevelDescription);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_LevelDescription_Validators[v].checkAttribute (this, FIELD_LevelDescription, metadata, newLevelDescriptionObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_LevelDescription () != FieldWriteability.FALSE, "Field LevelDescription is not writeable");
preLevelDescriptionChange (newLevelDescription);
markFieldChange (FIELD_LevelDescription);
_LevelDescription = newLevelDescription;
postFieldChange (FIELD_LevelDescription);
postLevelDescriptionChange ();
}
}
/**
* Get the attribute LevelNotes
*/
public String getLevelNotes ()
{
assertValid();
String valToReturn = _LevelNotes;
for (LevelBehaviourDecorator bhd : Level_BehaviourDecorators)
{
valToReturn = bhd.getLevelNotes ((Level)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 preLevelNotesChange (String newLevelNotes) 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 postLevelNotesChange () throws FieldException
{
}
public FieldWriteability getWriteability_LevelNotes ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute LevelNotes. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setLevelNotes (String newLevelNotes) throws FieldException
{
boolean oldAndNewIdentical = HELPER_LevelNotes.compare (_LevelNotes, newLevelNotes);
try
{
for (LevelBehaviourDecorator bhd : Level_BehaviourDecorators)
{
newLevelNotes = bhd.setLevelNotes ((Level)this, newLevelNotes);
oldAndNewIdentical = HELPER_LevelNotes.compare (_LevelNotes, newLevelNotes);
}
if (FIELD_LevelNotes_Validators.length > 0)
{
Object newLevelNotesObj = HELPER_LevelNotes.toObject (newLevelNotes);
if (newLevelNotesObj != null)
{
int loopMax = FIELD_LevelNotes_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_Level.get (FIELD_LevelNotes);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_LevelNotes_Validators[v].checkAttribute (this, FIELD_LevelNotes, metadata, newLevelNotesObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_LevelNotes () != FieldWriteability.FALSE, "Field LevelNotes is not writeable");
preLevelNotesChange (newLevelNotes);
markFieldChange (FIELD_LevelNotes);
_LevelNotes = newLevelNotes;
postFieldChange (FIELD_LevelNotes);
postLevelNotesChange ();
}
}
/**
* 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("Factors");
return result;
}
/**
* Get the reference instance for the multi assoc name.
*/
public BaseBusinessClass getMultiAssocReferenceInstance(String attribName)
{
if (MULTIPLEREFERENCE_Factors.equals(attribName))
{
return Factor.REFERENCE_Factor ;
}
return super.getMultiAssocReferenceInstance(attribName);
}
public String getMultiAssocBackReference(String attribName)
{
if (MULTIPLEREFERENCE_Factors.equals(attribName))
{
return Factor.SINGLEREFERENCE_Level ;
}
return super.getMultiAssocBackReference(attribName);
}
/**
* Get the assoc count for the multi assoc name.
*/
public int getMultiAssocCount(String attribName) throws StorageException
{
if (MULTIPLEREFERENCE_Factors.equals(attribName))
{
return this.getFactorsCount();
}
return super.getMultiAssocCount(attribName);
}
/**
* Get the assoc at a particular index
*/
public BaseBusinessClass getMultiAssocAt(String attribName, int index) throws StorageException
{
if (MULTIPLEREFERENCE_Factors.equals(attribName))
{
return this.getFactorsAt(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_Factors.equals(attribName))
{
addToFactors((Factor)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_Factors.equals(attribName))
{
removeFromFactors((Factor)oldElement);
return;
}
super.removeFromMultiAssoc(attribName, oldElement);
}
protected void __loadMultiAssoc (String attribName, BaseBusinessClass[] elements)
{
if (MULTIPLEREFERENCE_Factors.equals(attribName))
{
_Factors.__loadAssociation (elements);
return;
}
super.__loadMultiAssoc(attribName, elements);
}
protected boolean __isMultiAssocLoaded (String attribName)
{
if (MULTIPLEREFERENCE_Factors.equals(attribName))
{
return _Factors.isLoaded ();
}
return super.__isMultiAssocLoaded(attribName);
}
public FieldWriteability getWriteability_Factors ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
public int getFactorsCount () throws StorageException
{
assertValid();
return _Factors.getReferencedObjectsCount ();
}
public void addToFactors (Factor newElement) throws StorageException
{
if (_Factors.wouldAddChange (newElement))
{
assertValid();
Debug.assertion (getWriteability_Factors () != FieldWriteability.FALSE, "MultiAssoc Factors is not writeable (add)");
_Factors.appendElement (newElement);
try
{
if (newElement.getLevel () != this)
{
newElement.setLevel ((Level)(this));
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
}
}
public void removeFromFactors (Factor elementToRemove) throws StorageException
{
if (_Factors.wouldRemoveChange (elementToRemove))
{
assertValid();
Debug.assertion (getWriteability_Factors () != FieldWriteability.FALSE, "MultiAssoc Factors is not writeable (remove)");
_Factors.removeElement (elementToRemove);
try
{
if (elementToRemove.getLevel () != null)
{
elementToRemove.setLevel (null);
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
}
}
public Factor getFactorsAt (int index) throws StorageException
{
return (Factor)(_Factors.getElementAt (index));
}
public SortedSet<Factor> getFactorsSet () throws StorageException
{
return _Factors.getSet ();
}
public void onDelete ()
{
try
{
for(Factor referenced : CollectionUtils.reverse(getFactorsSet()))
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null Level from ", getObjectID (), " to ", referenced.getObjectID ());
referenced.setLevel(null);
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
super.onDelete ();
}
public Level newInstance ()
{
return new Level ();
}
public Level referenceInstance ()
{
return REFERENCE_Level;
}
public Level getInTransaction (ObjectTransaction t) throws StorageException
{
return getLevelByID (t, getObjectID());
}
public BaseBusinessClass dummyInstance ()
{
return DUMMY_Level;
}
public String getBaseSetName ()
{
return "level";
}
/**
* 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 levelPSet = allSets.getPersistentSet (myID, "level", myPSetStatus);
levelPSet.setAttrib (FIELD_ObjectID, myID);
levelPSet.setAttrib (FIELD_LevelNo, HELPER_LevelNo.toObject (_LevelNo)); //
levelPSet.setAttrib (FIELD_LevelDescription, HELPER_LevelDescription.toObject (_LevelDescription)); //
levelPSet.setAttrib (FIELD_LevelNotes, HELPER_LevelNotes.toObject (_LevelNotes)); //
}
/**
* Sets the objects state based on Persistent sets.
*/
public void setFromPersistentSets (ObjectID objectID, PersistentSetCollection allSets)
{
super.setFromPersistentSets (objectID, allSets);
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))); //
_LevelNotes = (String)(HELPER_LevelNotes.fromObject (_LevelNotes, levelPSet.getAttrib (FIELD_LevelNotes))); //
}
public void setAttributesFrom (BaseBusinessClass other, MultiException e)
{
super.setAttributesFrom (other, e);
if (other instanceof Level)
{
Level otherLevel = (Level)other;
try
{
setLevelNo (otherLevel.getLevelNo ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setLevelDescription (otherLevel.getLevelDescription ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setLevelNotes (otherLevel.getLevelNotes ());
}
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 BaseLevel)
{
BaseLevel sourceLevel = (BaseLevel)(source);
_LevelNo = sourceLevel._LevelNo;
_LevelDescription = sourceLevel._LevelDescription;
_LevelNotes = sourceLevel._LevelNotes;
}
}
/**
* 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 BaseLevel)
{
BaseLevel sourceLevel = (BaseLevel)(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 BaseLevel)
{
BaseLevel sourceLevel = (BaseLevel)(source);
_Factors.copyFrom (sourceLevel._Factors, 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);
_LevelNo = (Integer)(HELPER_LevelNo.readExternal (_LevelNo, vals.get(FIELD_LevelNo))); //
_LevelDescription = (String)(HELPER_LevelDescription.readExternal (_LevelDescription, vals.get(FIELD_LevelDescription))); //
_LevelNotes = (String)(HELPER_LevelNotes.readExternal (_LevelNotes, vals.get(FIELD_LevelNotes))); //
_Factors.readExternalData(vals.get(MULTIPLEREFERENCE_Factors));
}
/**
* Subclasses must override this to write out their attributes
*/
protected void writeExternalData(Map<String, Object> vals) throws IOException
{
super.writeExternalData(vals);
vals.put (FIELD_LevelNo, HELPER_LevelNo.writeExternal (_LevelNo));
vals.put (FIELD_LevelDescription, HELPER_LevelDescription.writeExternal (_LevelDescription));
vals.put (FIELD_LevelNotes, HELPER_LevelNotes.writeExternal (_LevelNotes));
vals.put (MULTIPLEREFERENCE_Factors, _Factors.writeExternalData());
}
public void compare (BaseBusinessClass other, AttributeChangeListener listener) throws StorageException
{
super.compare (other, listener);
if (other instanceof BaseLevel)
{
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))
{
listener.notifyFieldChange(this, other, FIELD_LevelDescription, HELPER_LevelDescription.toObject(this._LevelDescription), HELPER_LevelDescription.toObject(otherLevel._LevelDescription));
}
if (!HELPER_LevelNotes.compare(this._LevelNotes, otherLevel._LevelNotes))
{
listener.notifyFieldChange(this, other, FIELD_LevelNotes, HELPER_LevelNotes.toObject(this._LevelNotes), HELPER_LevelNotes.toObject(otherLevel._LevelNotes));
}
// Compare single assocs
// Compare multiple assocs
_Factors.compare (otherLevel._Factors, 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_LevelNo, HELPER_LevelNo.toObject(getLevelNo()));
visitor.visitField(this, FIELD_LevelDescription, HELPER_LevelDescription.toObject(getLevelDescription()));
visitor.visitField(this, FIELD_LevelNotes, HELPER_LevelNotes.toObject(getLevelNotes()));
visitor.visitAssociation (_Factors);
}
public void visitAssociations (AssociationVisitor visitor, AssociatedScope scope) throws StorageException
{
super.visitAssociations (visitor, scope);
if (scope.includes (_Factors))
{
visitor.visit (_Factors);
}
}
public static Level createLevel (ObjectTransaction transaction) throws StorageException
{
Level result = new Level ();
result.initialiseNewObject (transaction);
return result;
}
public static Level getLevelByID (ObjectTransaction transaction, Long objectID) throws StorageException
{
return (Level)(transaction.getObjectByID (REFERENCE_Level, objectID));
}
public boolean testFilter (String attribName, QueryFilter filter) throws StorageException
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_LevelNo))
{
return filter.matches (getLevelNo ());
}
else if (attribName.equals (FIELD_LevelDescription))
{
return filter.matches (getLevelDescription ());
}
else if (attribName.equals (FIELD_LevelNotes))
{
return filter.matches (getLevelNotes ());
}
else
{
return super.testFilter (attribName, filter);
}
}
public Object getAttribute (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_LevelNo))
{
return HELPER_LevelNo.toObject (getLevelNo ());
}
else if (attribName.equals (FIELD_LevelDescription))
{
return HELPER_LevelDescription.toObject (getLevelDescription ());
}
else if (attribName.equals (FIELD_LevelNotes))
{
return HELPER_LevelNotes.toObject (getLevelNotes ());
}
else
{
return super.getAttribute (attribName);
}
}
public AttributeHelper getAttributeHelper (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_LevelNo))
{
return HELPER_LevelNo;
}
else if (attribName.equals (FIELD_LevelDescription))
{
return HELPER_LevelDescription;
}
else if (attribName.equals (FIELD_LevelNotes))
{
return HELPER_LevelNotes;
}
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_LevelNo))
{
setLevelNo ((Integer)(HELPER_LevelNo.fromObject (_LevelNo, attribValue)));
}
else if (attribName.equals (FIELD_LevelDescription))
{
setLevelDescription ((String)(HELPER_LevelDescription.fromObject (_LevelDescription, attribValue)));
}
else if (attribName.equals (FIELD_LevelNotes))
{
setLevelNotes ((String)(HELPER_LevelNotes.fromObject (_LevelNotes, 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_LevelNo))
{
return getWriteability_LevelNo ();
}
else if (fieldName.equals (FIELD_LevelDescription))
{
return getWriteability_LevelDescription ();
}
else if (fieldName.equals (FIELD_LevelNotes))
{
return getWriteability_LevelNotes ();
}
else if (fieldName.equals (MULTIPLEREFERENCE_Factors))
{
return getWriteability_Factors ();
}
else
{
return super.getWriteable (fieldName);
}
}
public void putUnwriteable (Set<String> fields)
{
if (getWriteability_LevelNo () != FieldWriteability.TRUE)
{
fields.add (FIELD_LevelNo);
}
if (getWriteability_LevelDescription () != FieldWriteability.TRUE)
{
fields.add (FIELD_LevelDescription);
}
if (getWriteability_LevelNotes () != FieldWriteability.TRUE)
{
fields.add (FIELD_LevelNotes);
}
super.putUnwriteable (fields);
}
public List<AbstractAttribute> 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_LevelNotes.getAttribObject (getClass (), _LevelNotes, false, FIELD_LevelNotes));
return result;
}
public Map getAttributeMetadata (String attribute)
{
if (ATTRIBUTES_METADATA_Level.containsKey (attribute))
{
return (Map)ATTRIBUTES_METADATA_Level.get (attribute);
}
else
{
return super.getAttributeMetadata (attribute);
}
}
public Object getAttributeMetadata (String attribute, String metadata)
{
if (ATTRIBUTES_METADATA_Level.containsKey (attribute))
{
return ((Map)ATTRIBUTES_METADATA_Level.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 LevelBehaviourDecorator extends BaseBusinessClass.BBCBehaviourDecorator<Level>
{
/**
* Get the attribute LevelNo
*/
public Integer getLevelNo (Level obj, Integer original)
{
return original;
}
/**
* Change the value set for attribute LevelNo.
* May modify the field beforehand
* Occurs before validation.
*/
public Integer setLevelNo (Level obj, Integer newLevelNo) throws FieldException
{
return newLevelNo;
}
/**
* Get the attribute LevelDescription
*/
public String getLevelDescription (Level obj, String original)
{
return original;
}
/**
* Change the value set for attribute LevelDescription.
* May modify the field beforehand
* Occurs before validation.
*/
public String setLevelDescription (Level obj, String newLevelDescription) throws FieldException
{
return newLevelDescription;
}
/**
* Get the attribute LevelNotes
*/
public String getLevelNotes (Level obj, String original)
{
return original;
}
/**
* Change the value set for attribute LevelNotes.
* May modify the field beforehand
* Occurs before validation.
*/
public String setLevelNotes (Level obj, String newLevelNotes) throws FieldException
{
return newLevelNotes;
}
}
public ORMPipeLine pipes()
{
return new LevelPipeLineFactory<Level, Level> ((Level)this);
}
/**
* Use this instead of pipes() to get rid of type casting.
*/
public LevelPipeLineFactory<Level, Level> pipelineLevel()
{
return (LevelPipeLineFactory<Level, Level>) pipes();
}
public static LevelPipeLineFactory<Level, Level> pipesLevel(Collection<Level> items)
{
return REFERENCE_Level.new LevelPipeLineFactory<Level, Level> (items);
}
public static LevelPipeLineFactory<Level, Level> pipesLevel(Level[] _items)
{
return pipesLevel(Arrays.asList (_items));
}
public static LevelPipeLineFactory<Level, Level> pipesLevel()
{
return pipesLevel((Collection)null);
}
public class LevelPipeLineFactory<From extends BaseBusinessClass, Me extends Level> extends BaseBusinessClass.ORMPipeLine<From, Me>
{
public <Prev> LevelPipeLineFactory (PipeLine<From, Prev> pipeLine, Pipe<Prev, Me> nextPipe)
{
super (pipeLine, nextPipe);
}
public LevelPipeLineFactory (From seed)
{
super(seed);
}
public LevelPipeLineFactory (Collection<From> seed)
{
super(seed);
}
public PipeLine<From, ? extends Object> to(String name)
{
if (name.equals ("Factors"))
{
return toFactors ();
}
if (name.equals ("LevelNo"))
{
return toLevelNo ();
}
if (name.equals ("LevelDescription"))
{
return toLevelDescription ();
}
if (name.equals ("LevelNotes"))
{
return toLevelNotes ();
}
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> toLevelNotes () { return pipe(new ORMAttributePipe<Me, String>(FIELD_LevelNotes)); }
public Factor.FactorPipeLineFactory<From, Factor> toFactors () { return toFactors(Filter.ALL); }
public Factor.FactorPipeLineFactory<From, Factor> toFactors (Filter<Factor> filter)
{
return Factor.REFERENCE_Factor.new FactorPipeLineFactory<From, Factor> (this, new ORMMultiAssocPipe<Me, Factor>(MULTIPLEREFERENCE_Factors, filter));
}
}
public boolean isTransientAttrib(String attribName)
{
return super.isTransientAttrib(attribName);
}
public boolean isTransientSingleReference(String assocName)
{
return super.isTransientSingleReference(assocName);
}
}
class DummyLevel extends Level
{
// Default constructor primarily to support Externalisable
public DummyLevel()
{
super();
}
public void assertValid ()
{
}
public int getFactorsCount () throws StorageException
{
return 0;
}
public Factor getFactorsAt (int index) throws StorageException
{
throw new RuntimeException ("No elements in a dummy object in association Factors");
}
public SortedSet getFactorsSet () throws StorageException
{
return new TreeSet();
}
}
...@@ -42,16 +42,6 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -42,16 +42,6 @@ public abstract class BaseQuestion extends BaseBusinessClass
public static final String FIELD_LeftQuestion = "LeftQuestion"; public static final String FIELD_LeftQuestion = "LeftQuestion";
public static final String FIELD_RightQuestionNo = "RightQuestionNo"; public static final String FIELD_RightQuestionNo = "RightQuestionNo";
public static final String FIELD_RightQuestion = "RightQuestion"; public static final String FIELD_RightQuestion = "RightQuestion";
public static final String FIELD_LeftQuestionSchinese = "LeftQuestionSchinese";
public static final String FIELD_RightQuestionSchinese = "RightQuestionSchinese";
public static final String FIELD_LeftQuestionChinese = "LeftQuestionChinese";
public static final String FIELD_RightQuestionChinese = "RightQuestionChinese";
public static final String FIELD_LeftQuestionKorean = "LeftQuestionKorean";
public static final String FIELD_RightQuestionKorean = "RightQuestionKorean";
public static final String FIELD_LeftQuestionThai = "LeftQuestionThai";
public static final String FIELD_RightQuestionThai = "RightQuestionThai";
public static final String FIELD_LeftQuestionViet = "LeftQuestionViet";
public static final String FIELD_RightQuestionViet = "RightQuestionViet";
// Static constants corresponding to searches // Static constants corresponding to searches
...@@ -61,16 +51,6 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -61,16 +51,6 @@ public abstract class BaseQuestion extends BaseBusinessClass
private static final DefaultAttributeHelper<Question> HELPER_LeftQuestion = 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_RightQuestionNo = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Question> HELPER_RightQuestion = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper<Question> HELPER_RightQuestion = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Question> HELPER_LeftQuestionSchinese = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Question> HELPER_RightQuestionSchinese = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Question> HELPER_LeftQuestionChinese = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Question> HELPER_RightQuestionChinese = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Question> HELPER_LeftQuestionKorean = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Question> HELPER_RightQuestionKorean = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Question> HELPER_LeftQuestionThai = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Question> HELPER_RightQuestionThai = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Question> HELPER_LeftQuestionViet = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Question> HELPER_RightQuestionViet = DefaultAttributeHelper.INSTANCE;
// Private attributes corresponding to business object data // Private attributes corresponding to business object data
...@@ -78,16 +58,6 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -78,16 +58,6 @@ public abstract class BaseQuestion extends BaseBusinessClass
private String _LeftQuestion; private String _LeftQuestion;
private Integer _RightQuestionNo; private Integer _RightQuestionNo;
private String _RightQuestion; private String _RightQuestion;
private String _LeftQuestionSchinese;
private String _RightQuestionSchinese;
private String _LeftQuestionChinese;
private String _RightQuestionChinese;
private String _LeftQuestionKorean;
private String _RightQuestionKorean;
private String _LeftQuestionThai;
private String _RightQuestionThai;
private String _LeftQuestionViet;
private String _RightQuestionViet;
// Private attributes corresponding to single references // Private attributes corresponding to single references
...@@ -104,16 +74,6 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -104,16 +74,6 @@ public abstract class BaseQuestion extends BaseBusinessClass
private static final AttributeValidator[] FIELD_LeftQuestion_Validators; private static final AttributeValidator[] FIELD_LeftQuestion_Validators;
private static final AttributeValidator[] FIELD_RightQuestionNo_Validators; private static final AttributeValidator[] FIELD_RightQuestionNo_Validators;
private static final AttributeValidator[] FIELD_RightQuestion_Validators; private static final AttributeValidator[] FIELD_RightQuestion_Validators;
private static final AttributeValidator[] FIELD_LeftQuestionSchinese_Validators;
private static final AttributeValidator[] FIELD_RightQuestionSchinese_Validators;
private static final AttributeValidator[] FIELD_LeftQuestionChinese_Validators;
private static final AttributeValidator[] FIELD_RightQuestionChinese_Validators;
private static final AttributeValidator[] FIELD_LeftQuestionKorean_Validators;
private static final AttributeValidator[] FIELD_RightQuestionKorean_Validators;
private static final AttributeValidator[] FIELD_LeftQuestionThai_Validators;
private static final AttributeValidator[] FIELD_RightQuestionThai_Validators;
private static final AttributeValidator[] FIELD_LeftQuestionViet_Validators;
private static final AttributeValidator[] FIELD_RightQuestionViet_Validators;
// Arrays of behaviour decorators // Arrays of behaviour decorators
...@@ -131,16 +91,6 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -131,16 +91,6 @@ public abstract class BaseQuestion extends BaseBusinessClass
FIELD_LeftQuestion_Validators = (AttributeValidator[])setupAttribMetaData_LeftQuestion(validatorMapping).toArray (new AttributeValidator[0]); FIELD_LeftQuestion_Validators = (AttributeValidator[])setupAttribMetaData_LeftQuestion(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_RightQuestionNo_Validators = (AttributeValidator[])setupAttribMetaData_RightQuestionNo(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]); FIELD_RightQuestion_Validators = (AttributeValidator[])setupAttribMetaData_RightQuestion(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_LeftQuestionSchinese_Validators = (AttributeValidator[])setupAttribMetaData_LeftQuestionSchinese(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_RightQuestionSchinese_Validators = (AttributeValidator[])setupAttribMetaData_RightQuestionSchinese(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_LeftQuestionChinese_Validators = (AttributeValidator[])setupAttribMetaData_LeftQuestionChinese(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_RightQuestionChinese_Validators = (AttributeValidator[])setupAttribMetaData_RightQuestionChinese(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_LeftQuestionKorean_Validators = (AttributeValidator[])setupAttribMetaData_LeftQuestionKorean(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_RightQuestionKorean_Validators = (AttributeValidator[])setupAttribMetaData_RightQuestionKorean(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_LeftQuestionThai_Validators = (AttributeValidator[])setupAttribMetaData_LeftQuestionThai(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_RightQuestionThai_Validators = (AttributeValidator[])setupAttribMetaData_RightQuestionThai(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_LeftQuestionViet_Validators = (AttributeValidator[])setupAttribMetaData_LeftQuestionViet(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_RightQuestionViet_Validators = (AttributeValidator[])setupAttribMetaData_RightQuestionViet(validatorMapping).toArray (new AttributeValidator[0]);
REFERENCE_Question.initialiseReference (); REFERENCE_Question.initialiseReference ();
...@@ -229,186 +179,6 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -229,186 +179,6 @@ public abstract class BaseQuestion extends BaseBusinessClass
return validators; return validators;
} }
// Meta Info setup
private static List setupAttribMetaData_LeftQuestionSchinese(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "left_quest_schinese");
metaInfo.put ("name", "LeftQuestionSchinese");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Question.LeftQuestionSchinese:", metaInfo);
ATTRIBUTES_METADATA_Question.put (FIELD_LeftQuestionSchinese, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(Question.class, "LeftQuestionSchinese", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for Question.LeftQuestionSchinese:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_RightQuestionSchinese(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "right_quest_schinese");
metaInfo.put ("name", "RightQuestionSchinese");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Question.RightQuestionSchinese:", metaInfo);
ATTRIBUTES_METADATA_Question.put (FIELD_RightQuestionSchinese, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(Question.class, "RightQuestionSchinese", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for Question.RightQuestionSchinese:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_LeftQuestionChinese(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "left_quest_chinese");
metaInfo.put ("name", "LeftQuestionChinese");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Question.LeftQuestionChinese:", metaInfo);
ATTRIBUTES_METADATA_Question.put (FIELD_LeftQuestionChinese, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(Question.class, "LeftQuestionChinese", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for Question.LeftQuestionChinese:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_RightQuestionChinese(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "right_quest_chinese");
metaInfo.put ("name", "RightQuestionChinese");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Question.RightQuestionChinese:", metaInfo);
ATTRIBUTES_METADATA_Question.put (FIELD_RightQuestionChinese, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(Question.class, "RightQuestionChinese", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for Question.RightQuestionChinese:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_LeftQuestionKorean(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "left_quest_korean");
metaInfo.put ("name", "LeftQuestionKorean");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Question.LeftQuestionKorean:", metaInfo);
ATTRIBUTES_METADATA_Question.put (FIELD_LeftQuestionKorean, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(Question.class, "LeftQuestionKorean", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for Question.LeftQuestionKorean:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_RightQuestionKorean(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "right_quest_korean");
metaInfo.put ("name", "RightQuestionKorean");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Question.RightQuestionKorean:", metaInfo);
ATTRIBUTES_METADATA_Question.put (FIELD_RightQuestionKorean, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(Question.class, "RightQuestionKorean", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for Question.RightQuestionKorean:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_LeftQuestionThai(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "left_quest_thai");
metaInfo.put ("name", "LeftQuestionThai");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Question.LeftQuestionThai:", metaInfo);
ATTRIBUTES_METADATA_Question.put (FIELD_LeftQuestionThai, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(Question.class, "LeftQuestionThai", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for Question.LeftQuestionThai:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_RightQuestionThai(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "right_quest_thai");
metaInfo.put ("name", "RightQuestionThai");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Question.RightQuestionThai:", metaInfo);
ATTRIBUTES_METADATA_Question.put (FIELD_RightQuestionThai, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(Question.class, "RightQuestionThai", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for Question.RightQuestionThai:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_LeftQuestionViet(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "left_quest_viet");
metaInfo.put ("name", "LeftQuestionViet");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Question.LeftQuestionViet:", metaInfo);
ATTRIBUTES_METADATA_Question.put (FIELD_LeftQuestionViet, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(Question.class, "LeftQuestionViet", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for Question.LeftQuestionViet:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_RightQuestionViet(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "right_quest_viet");
metaInfo.put ("name", "RightQuestionViet");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Question.RightQuestionViet:", metaInfo);
ATTRIBUTES_METADATA_Question.put (FIELD_RightQuestionViet, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(Question.class, "RightQuestionViet", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for Question.RightQuestionViet:", validators);
return validators;
}
// END OF STATIC METADATA DEFINITION // END OF STATIC METADATA DEFINITION
...@@ -440,16 +210,6 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -440,16 +210,6 @@ public abstract class BaseQuestion extends BaseBusinessClass
_LeftQuestion = (String)(HELPER_LeftQuestion.initialise (_LeftQuestion)); _LeftQuestion = (String)(HELPER_LeftQuestion.initialise (_LeftQuestion));
_RightQuestionNo = (Integer)(HELPER_RightQuestionNo.initialise (_RightQuestionNo)); _RightQuestionNo = (Integer)(HELPER_RightQuestionNo.initialise (_RightQuestionNo));
_RightQuestion = (String)(HELPER_RightQuestion.initialise (_RightQuestion)); _RightQuestion = (String)(HELPER_RightQuestion.initialise (_RightQuestion));
_LeftQuestionSchinese = (String)(HELPER_LeftQuestionSchinese.initialise (_LeftQuestionSchinese));
_RightQuestionSchinese = (String)(HELPER_RightQuestionSchinese.initialise (_RightQuestionSchinese));
_LeftQuestionChinese = (String)(HELPER_LeftQuestionChinese.initialise (_LeftQuestionChinese));
_RightQuestionChinese = (String)(HELPER_RightQuestionChinese.initialise (_RightQuestionChinese));
_LeftQuestionKorean = (String)(HELPER_LeftQuestionKorean.initialise (_LeftQuestionKorean));
_RightQuestionKorean = (String)(HELPER_RightQuestionKorean.initialise (_RightQuestionKorean));
_LeftQuestionThai = (String)(HELPER_LeftQuestionThai.initialise (_LeftQuestionThai));
_RightQuestionThai = (String)(HELPER_RightQuestionThai.initialise (_RightQuestionThai));
_LeftQuestionViet = (String)(HELPER_LeftQuestionViet.initialise (_LeftQuestionViet));
_RightQuestionViet = (String)(HELPER_RightQuestionViet.initialise (_RightQuestionViet));
} }
...@@ -866,1115 +626,135 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -866,1115 +626,135 @@ public abstract class BaseQuestion extends BaseBusinessClass
} }
} }
/** /**
* Get the attribute LeftQuestionSchinese * A list of multi assoc names e.g. list of strings.
*/ */
public String getLeftQuestionSchinese () public List<String> getSingleAssocs()
{ {
assertValid(); List result = super.getSingleAssocs ();
String valToReturn = _LeftQuestionSchinese;
for (QuestionBehaviourDecorator bhd : Question_BehaviourDecorators)
{
valToReturn = bhd.getLeftQuestionSchinese ((Question)this, valToReturn);
}
return valToReturn;
}
return result;
/** }
* 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.
*/ public BaseBusinessClass getSingleAssocReferenceInstance (String assocName)
protected void preLeftQuestionSchineseChange (String newLeftQuestionSchinese) throws FieldException
{ {
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else
{
return super.getSingleAssocReferenceInstance (assocName);
}
} }
/** public String getSingleAssocBackReference(String assocName)
* 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 postLeftQuestionSchineseChange () throws FieldException
{ {
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else
{
return super.getSingleAssocBackReference (assocName);
}
} }
public FieldWriteability getWriteability_LeftQuestionSchinese ()
public BaseBusinessClass getSingleAssoc (String assocName) throws StorageException
{ {
return getFieldWritabilityUtil (FieldWriteability.TRUE); if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else
{
return super.getSingleAssoc (assocName);
}
} }
/**
* Set the attribute LeftQuestionSchinese. Checks to ensure a new value public BaseBusinessClass getSingleAssoc (String assocName, Get getType) throws StorageException
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setLeftQuestionSchinese (String newLeftQuestionSchinese) throws FieldException
{ {
boolean oldAndNewIdentical = HELPER_LeftQuestionSchinese.compare (_LeftQuestionSchinese, newLeftQuestionSchinese); if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
try else
{ {
for (QuestionBehaviourDecorator bhd : Question_BehaviourDecorators) return super.getSingleAssoc (assocName, getType);
{ }
newLeftQuestionSchinese = bhd.setLeftQuestionSchinese ((Question)this, newLeftQuestionSchinese); }
oldAndNewIdentical = HELPER_LeftQuestionSchinese.compare (_LeftQuestionSchinese, newLeftQuestionSchinese);
}
if (FIELD_LeftQuestionSchinese_Validators.length > 0)
{
Object newLeftQuestionSchineseObj = HELPER_LeftQuestionSchinese.toObject (newLeftQuestionSchinese);
if (newLeftQuestionSchineseObj != null)
{
int loopMax = FIELD_LeftQuestionSchinese_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_Question.get (FIELD_LeftQuestionSchinese);
for (int v = 0 ; v < loopMax ; ++v) public Long getSingleAssocID (String assocName) throws StorageException
{ {
FIELD_LeftQuestionSchinese_Validators[v].checkAttribute (this, FIELD_LeftQuestionSchinese, metadata, newLeftQuestionSchineseObj); if (assocName == null)
} {
} throw new RuntimeException ("Game over == null!");
}
} }
catch (FieldException e)
else
{ {
if (!oldAndNewIdentical) return super.getSingleAssocID (assocName);
{
e.setWouldModify ();
}
throw e;
} }
}
if (!oldAndNewIdentical)
public void setSingleAssoc (String assocName, BaseBusinessClass newValue) throws StorageException, FieldException
{
if (assocName == null)
{ {
assertValid(); throw new RuntimeException ("Game over == null!");
Debug.assertion (getWriteability_LeftQuestionSchinese () != FieldWriteability.FALSE, "Field LeftQuestionSchinese is not writeable"); }
preLeftQuestionSchineseChange (newLeftQuestionSchinese);
markFieldChange (FIELD_LeftQuestionSchinese); else
_LeftQuestionSchinese = newLeftQuestionSchinese; {
postFieldChange (FIELD_LeftQuestionSchinese); super.setSingleAssoc (assocName, newValue);
postLeftQuestionSchineseChange ();
} }
} }
/** /**
* Get the attribute RightQuestionSchinese * A list of multi assoc names e.g. list of strings.
*/ */
public String getRightQuestionSchinese () public List<String> getMultiAssocs()
{ {
assertValid(); List result = super.getMultiAssocs ();
String valToReturn = _RightQuestionSchinese;
for (QuestionBehaviourDecorator bhd : Question_BehaviourDecorators)
{
valToReturn = bhd.getRightQuestionSchinese ((Question)this, valToReturn);
}
return valToReturn;
return result;
} }
/** /**
* Called prior to the attribute changing. Subclasses need not call super. If a field exception * Get the reference instance for the multi assoc name.
* is thrown, the attribute change will fail. The new value is different to the old value.
*/ */
protected void preRightQuestionSchineseChange (String newRightQuestionSchinese) throws FieldException public BaseBusinessClass getMultiAssocReferenceInstance(String attribName)
{ {
return super.getMultiAssocReferenceInstance(attribName);
} }
/** public String getMultiAssocBackReference(String attribName)
* 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 postRightQuestionSchineseChange () throws FieldException
{ {
}
return super.getMultiAssocBackReference(attribName);
public FieldWriteability getWriteability_RightQuestionSchinese ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute RightQuestionSchinese. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setRightQuestionSchinese (String newRightQuestionSchinese) throws FieldException
{
boolean oldAndNewIdentical = HELPER_RightQuestionSchinese.compare (_RightQuestionSchinese, newRightQuestionSchinese);
try
{
for (QuestionBehaviourDecorator bhd : Question_BehaviourDecorators)
{
newRightQuestionSchinese = bhd.setRightQuestionSchinese ((Question)this, newRightQuestionSchinese);
oldAndNewIdentical = HELPER_RightQuestionSchinese.compare (_RightQuestionSchinese, newRightQuestionSchinese);
}
if (FIELD_RightQuestionSchinese_Validators.length > 0)
{
Object newRightQuestionSchineseObj = HELPER_RightQuestionSchinese.toObject (newRightQuestionSchinese);
if (newRightQuestionSchineseObj != null)
{
int loopMax = FIELD_RightQuestionSchinese_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_Question.get (FIELD_RightQuestionSchinese);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_RightQuestionSchinese_Validators[v].checkAttribute (this, FIELD_RightQuestionSchinese, metadata, newRightQuestionSchineseObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_RightQuestionSchinese () != FieldWriteability.FALSE, "Field RightQuestionSchinese is not writeable");
preRightQuestionSchineseChange (newRightQuestionSchinese);
markFieldChange (FIELD_RightQuestionSchinese);
_RightQuestionSchinese = newRightQuestionSchinese;
postFieldChange (FIELD_RightQuestionSchinese);
postRightQuestionSchineseChange ();
}
}
/**
* Get the attribute LeftQuestionChinese
*/
public String getLeftQuestionChinese ()
{
assertValid();
String valToReturn = _LeftQuestionChinese;
for (QuestionBehaviourDecorator bhd : Question_BehaviourDecorators)
{
valToReturn = bhd.getLeftQuestionChinese ((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 preLeftQuestionChineseChange (String newLeftQuestionChinese) 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 postLeftQuestionChineseChange () throws FieldException
{
}
public FieldWriteability getWriteability_LeftQuestionChinese ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute LeftQuestionChinese. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setLeftQuestionChinese (String newLeftQuestionChinese) throws FieldException
{
boolean oldAndNewIdentical = HELPER_LeftQuestionChinese.compare (_LeftQuestionChinese, newLeftQuestionChinese);
try
{
for (QuestionBehaviourDecorator bhd : Question_BehaviourDecorators)
{
newLeftQuestionChinese = bhd.setLeftQuestionChinese ((Question)this, newLeftQuestionChinese);
oldAndNewIdentical = HELPER_LeftQuestionChinese.compare (_LeftQuestionChinese, newLeftQuestionChinese);
}
if (FIELD_LeftQuestionChinese_Validators.length > 0)
{
Object newLeftQuestionChineseObj = HELPER_LeftQuestionChinese.toObject (newLeftQuestionChinese);
if (newLeftQuestionChineseObj != null)
{
int loopMax = FIELD_LeftQuestionChinese_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_Question.get (FIELD_LeftQuestionChinese);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_LeftQuestionChinese_Validators[v].checkAttribute (this, FIELD_LeftQuestionChinese, metadata, newLeftQuestionChineseObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_LeftQuestionChinese () != FieldWriteability.FALSE, "Field LeftQuestionChinese is not writeable");
preLeftQuestionChineseChange (newLeftQuestionChinese);
markFieldChange (FIELD_LeftQuestionChinese);
_LeftQuestionChinese = newLeftQuestionChinese;
postFieldChange (FIELD_LeftQuestionChinese);
postLeftQuestionChineseChange ();
}
}
/**
* Get the attribute RightQuestionChinese
*/
public String getRightQuestionChinese ()
{
assertValid();
String valToReturn = _RightQuestionChinese;
for (QuestionBehaviourDecorator bhd : Question_BehaviourDecorators)
{
valToReturn = bhd.getRightQuestionChinese ((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 preRightQuestionChineseChange (String newRightQuestionChinese) 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 postRightQuestionChineseChange () throws FieldException
{
}
public FieldWriteability getWriteability_RightQuestionChinese ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute RightQuestionChinese. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setRightQuestionChinese (String newRightQuestionChinese) throws FieldException
{
boolean oldAndNewIdentical = HELPER_RightQuestionChinese.compare (_RightQuestionChinese, newRightQuestionChinese);
try
{
for (QuestionBehaviourDecorator bhd : Question_BehaviourDecorators)
{
newRightQuestionChinese = bhd.setRightQuestionChinese ((Question)this, newRightQuestionChinese);
oldAndNewIdentical = HELPER_RightQuestionChinese.compare (_RightQuestionChinese, newRightQuestionChinese);
}
if (FIELD_RightQuestionChinese_Validators.length > 0)
{
Object newRightQuestionChineseObj = HELPER_RightQuestionChinese.toObject (newRightQuestionChinese);
if (newRightQuestionChineseObj != null)
{
int loopMax = FIELD_RightQuestionChinese_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_Question.get (FIELD_RightQuestionChinese);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_RightQuestionChinese_Validators[v].checkAttribute (this, FIELD_RightQuestionChinese, metadata, newRightQuestionChineseObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_RightQuestionChinese () != FieldWriteability.FALSE, "Field RightQuestionChinese is not writeable");
preRightQuestionChineseChange (newRightQuestionChinese);
markFieldChange (FIELD_RightQuestionChinese);
_RightQuestionChinese = newRightQuestionChinese;
postFieldChange (FIELD_RightQuestionChinese);
postRightQuestionChineseChange ();
}
}
/**
* Get the attribute LeftQuestionKorean
*/
public String getLeftQuestionKorean ()
{
assertValid();
String valToReturn = _LeftQuestionKorean;
for (QuestionBehaviourDecorator bhd : Question_BehaviourDecorators)
{
valToReturn = bhd.getLeftQuestionKorean ((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 preLeftQuestionKoreanChange (String newLeftQuestionKorean) 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 postLeftQuestionKoreanChange () throws FieldException
{
}
public FieldWriteability getWriteability_LeftQuestionKorean ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute LeftQuestionKorean. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setLeftQuestionKorean (String newLeftQuestionKorean) throws FieldException
{
boolean oldAndNewIdentical = HELPER_LeftQuestionKorean.compare (_LeftQuestionKorean, newLeftQuestionKorean);
try
{
for (QuestionBehaviourDecorator bhd : Question_BehaviourDecorators)
{
newLeftQuestionKorean = bhd.setLeftQuestionKorean ((Question)this, newLeftQuestionKorean);
oldAndNewIdentical = HELPER_LeftQuestionKorean.compare (_LeftQuestionKorean, newLeftQuestionKorean);
}
if (FIELD_LeftQuestionKorean_Validators.length > 0)
{
Object newLeftQuestionKoreanObj = HELPER_LeftQuestionKorean.toObject (newLeftQuestionKorean);
if (newLeftQuestionKoreanObj != null)
{
int loopMax = FIELD_LeftQuestionKorean_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_Question.get (FIELD_LeftQuestionKorean);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_LeftQuestionKorean_Validators[v].checkAttribute (this, FIELD_LeftQuestionKorean, metadata, newLeftQuestionKoreanObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_LeftQuestionKorean () != FieldWriteability.FALSE, "Field LeftQuestionKorean is not writeable");
preLeftQuestionKoreanChange (newLeftQuestionKorean);
markFieldChange (FIELD_LeftQuestionKorean);
_LeftQuestionKorean = newLeftQuestionKorean;
postFieldChange (FIELD_LeftQuestionKorean);
postLeftQuestionKoreanChange ();
}
}
/**
* Get the attribute RightQuestionKorean
*/
public String getRightQuestionKorean ()
{
assertValid();
String valToReturn = _RightQuestionKorean;
for (QuestionBehaviourDecorator bhd : Question_BehaviourDecorators)
{
valToReturn = bhd.getRightQuestionKorean ((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 preRightQuestionKoreanChange (String newRightQuestionKorean) 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 postRightQuestionKoreanChange () throws FieldException
{
}
public FieldWriteability getWriteability_RightQuestionKorean ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute RightQuestionKorean. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setRightQuestionKorean (String newRightQuestionKorean) throws FieldException
{
boolean oldAndNewIdentical = HELPER_RightQuestionKorean.compare (_RightQuestionKorean, newRightQuestionKorean);
try
{
for (QuestionBehaviourDecorator bhd : Question_BehaviourDecorators)
{
newRightQuestionKorean = bhd.setRightQuestionKorean ((Question)this, newRightQuestionKorean);
oldAndNewIdentical = HELPER_RightQuestionKorean.compare (_RightQuestionKorean, newRightQuestionKorean);
}
if (FIELD_RightQuestionKorean_Validators.length > 0)
{
Object newRightQuestionKoreanObj = HELPER_RightQuestionKorean.toObject (newRightQuestionKorean);
if (newRightQuestionKoreanObj != null)
{
int loopMax = FIELD_RightQuestionKorean_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_Question.get (FIELD_RightQuestionKorean);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_RightQuestionKorean_Validators[v].checkAttribute (this, FIELD_RightQuestionKorean, metadata, newRightQuestionKoreanObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_RightQuestionKorean () != FieldWriteability.FALSE, "Field RightQuestionKorean is not writeable");
preRightQuestionKoreanChange (newRightQuestionKorean);
markFieldChange (FIELD_RightQuestionKorean);
_RightQuestionKorean = newRightQuestionKorean;
postFieldChange (FIELD_RightQuestionKorean);
postRightQuestionKoreanChange ();
}
}
/**
* Get the attribute LeftQuestionThai
*/
public String getLeftQuestionThai ()
{
assertValid();
String valToReturn = _LeftQuestionThai;
for (QuestionBehaviourDecorator bhd : Question_BehaviourDecorators)
{
valToReturn = bhd.getLeftQuestionThai ((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 preLeftQuestionThaiChange (String newLeftQuestionThai) 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 postLeftQuestionThaiChange () throws FieldException
{
}
public FieldWriteability getWriteability_LeftQuestionThai ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute LeftQuestionThai. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setLeftQuestionThai (String newLeftQuestionThai) throws FieldException
{
boolean oldAndNewIdentical = HELPER_LeftQuestionThai.compare (_LeftQuestionThai, newLeftQuestionThai);
try
{
for (QuestionBehaviourDecorator bhd : Question_BehaviourDecorators)
{
newLeftQuestionThai = bhd.setLeftQuestionThai ((Question)this, newLeftQuestionThai);
oldAndNewIdentical = HELPER_LeftQuestionThai.compare (_LeftQuestionThai, newLeftQuestionThai);
}
if (FIELD_LeftQuestionThai_Validators.length > 0)
{
Object newLeftQuestionThaiObj = HELPER_LeftQuestionThai.toObject (newLeftQuestionThai);
if (newLeftQuestionThaiObj != null)
{
int loopMax = FIELD_LeftQuestionThai_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_Question.get (FIELD_LeftQuestionThai);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_LeftQuestionThai_Validators[v].checkAttribute (this, FIELD_LeftQuestionThai, metadata, newLeftQuestionThaiObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_LeftQuestionThai () != FieldWriteability.FALSE, "Field LeftQuestionThai is not writeable");
preLeftQuestionThaiChange (newLeftQuestionThai);
markFieldChange (FIELD_LeftQuestionThai);
_LeftQuestionThai = newLeftQuestionThai;
postFieldChange (FIELD_LeftQuestionThai);
postLeftQuestionThaiChange ();
}
}
/**
* Get the attribute RightQuestionThai
*/
public String getRightQuestionThai ()
{
assertValid();
String valToReturn = _RightQuestionThai;
for (QuestionBehaviourDecorator bhd : Question_BehaviourDecorators)
{
valToReturn = bhd.getRightQuestionThai ((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 preRightQuestionThaiChange (String newRightQuestionThai) 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 postRightQuestionThaiChange () throws FieldException
{
}
public FieldWriteability getWriteability_RightQuestionThai ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute RightQuestionThai. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setRightQuestionThai (String newRightQuestionThai) throws FieldException
{
boolean oldAndNewIdentical = HELPER_RightQuestionThai.compare (_RightQuestionThai, newRightQuestionThai);
try
{
for (QuestionBehaviourDecorator bhd : Question_BehaviourDecorators)
{
newRightQuestionThai = bhd.setRightQuestionThai ((Question)this, newRightQuestionThai);
oldAndNewIdentical = HELPER_RightQuestionThai.compare (_RightQuestionThai, newRightQuestionThai);
}
if (FIELD_RightQuestionThai_Validators.length > 0)
{
Object newRightQuestionThaiObj = HELPER_RightQuestionThai.toObject (newRightQuestionThai);
if (newRightQuestionThaiObj != null)
{
int loopMax = FIELD_RightQuestionThai_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_Question.get (FIELD_RightQuestionThai);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_RightQuestionThai_Validators[v].checkAttribute (this, FIELD_RightQuestionThai, metadata, newRightQuestionThaiObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_RightQuestionThai () != FieldWriteability.FALSE, "Field RightQuestionThai is not writeable");
preRightQuestionThaiChange (newRightQuestionThai);
markFieldChange (FIELD_RightQuestionThai);
_RightQuestionThai = newRightQuestionThai;
postFieldChange (FIELD_RightQuestionThai);
postRightQuestionThaiChange ();
}
}
/**
* Get the attribute LeftQuestionViet
*/
public String getLeftQuestionViet ()
{
assertValid();
String valToReturn = _LeftQuestionViet;
for (QuestionBehaviourDecorator bhd : Question_BehaviourDecorators)
{
valToReturn = bhd.getLeftQuestionViet ((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 preLeftQuestionVietChange (String newLeftQuestionViet) 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 postLeftQuestionVietChange () throws FieldException
{
}
public FieldWriteability getWriteability_LeftQuestionViet ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute LeftQuestionViet. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setLeftQuestionViet (String newLeftQuestionViet) throws FieldException
{
boolean oldAndNewIdentical = HELPER_LeftQuestionViet.compare (_LeftQuestionViet, newLeftQuestionViet);
try
{
for (QuestionBehaviourDecorator bhd : Question_BehaviourDecorators)
{
newLeftQuestionViet = bhd.setLeftQuestionViet ((Question)this, newLeftQuestionViet);
oldAndNewIdentical = HELPER_LeftQuestionViet.compare (_LeftQuestionViet, newLeftQuestionViet);
}
if (FIELD_LeftQuestionViet_Validators.length > 0)
{
Object newLeftQuestionVietObj = HELPER_LeftQuestionViet.toObject (newLeftQuestionViet);
if (newLeftQuestionVietObj != null)
{
int loopMax = FIELD_LeftQuestionViet_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_Question.get (FIELD_LeftQuestionViet);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_LeftQuestionViet_Validators[v].checkAttribute (this, FIELD_LeftQuestionViet, metadata, newLeftQuestionVietObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_LeftQuestionViet () != FieldWriteability.FALSE, "Field LeftQuestionViet is not writeable");
preLeftQuestionVietChange (newLeftQuestionViet);
markFieldChange (FIELD_LeftQuestionViet);
_LeftQuestionViet = newLeftQuestionViet;
postFieldChange (FIELD_LeftQuestionViet);
postLeftQuestionVietChange ();
}
}
/**
* Get the attribute RightQuestionViet
*/
public String getRightQuestionViet ()
{
assertValid();
String valToReturn = _RightQuestionViet;
for (QuestionBehaviourDecorator bhd : Question_BehaviourDecorators)
{
valToReturn = bhd.getRightQuestionViet ((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 preRightQuestionVietChange (String newRightQuestionViet) 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 postRightQuestionVietChange () throws FieldException
{
}
public FieldWriteability getWriteability_RightQuestionViet ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute RightQuestionViet. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setRightQuestionViet (String newRightQuestionViet) throws FieldException
{
boolean oldAndNewIdentical = HELPER_RightQuestionViet.compare (_RightQuestionViet, newRightQuestionViet);
try
{
for (QuestionBehaviourDecorator bhd : Question_BehaviourDecorators)
{
newRightQuestionViet = bhd.setRightQuestionViet ((Question)this, newRightQuestionViet);
oldAndNewIdentical = HELPER_RightQuestionViet.compare (_RightQuestionViet, newRightQuestionViet);
}
if (FIELD_RightQuestionViet_Validators.length > 0)
{
Object newRightQuestionVietObj = HELPER_RightQuestionViet.toObject (newRightQuestionViet);
if (newRightQuestionVietObj != null)
{
int loopMax = FIELD_RightQuestionViet_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_Question.get (FIELD_RightQuestionViet);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_RightQuestionViet_Validators[v].checkAttribute (this, FIELD_RightQuestionViet, metadata, newRightQuestionVietObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_RightQuestionViet () != FieldWriteability.FALSE, "Field RightQuestionViet is not writeable");
preRightQuestionVietChange (newRightQuestionViet);
markFieldChange (FIELD_RightQuestionViet);
_RightQuestionViet = newRightQuestionViet;
postFieldChange (FIELD_RightQuestionViet);
postRightQuestionVietChange ();
}
}
/**
* 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 ();
return result;
}
/**
* Get the reference instance for the multi assoc name.
*/
public BaseBusinessClass getMultiAssocReferenceInstance(String attribName)
{
return super.getMultiAssocReferenceInstance(attribName);
}
public String getMultiAssocBackReference(String attribName)
{
return super.getMultiAssocBackReference(attribName);
} }
...@@ -2108,16 +888,6 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -2108,16 +888,6 @@ public abstract class BaseQuestion extends BaseBusinessClass
quest_linPSet.setAttrib (FIELD_LeftQuestion, HELPER_LeftQuestion.toObject (_LeftQuestion)); // quest_linPSet.setAttrib (FIELD_LeftQuestion, HELPER_LeftQuestion.toObject (_LeftQuestion)); //
quest_linPSet.setAttrib (FIELD_RightQuestionNo, HELPER_RightQuestionNo.toObject (_RightQuestionNo)); // quest_linPSet.setAttrib (FIELD_RightQuestionNo, HELPER_RightQuestionNo.toObject (_RightQuestionNo)); //
quest_linPSet.setAttrib (FIELD_RightQuestion, HELPER_RightQuestion.toObject (_RightQuestion)); // quest_linPSet.setAttrib (FIELD_RightQuestion, HELPER_RightQuestion.toObject (_RightQuestion)); //
quest_linPSet.setAttrib (FIELD_LeftQuestionSchinese, HELPER_LeftQuestionSchinese.toObject (_LeftQuestionSchinese)); //
quest_linPSet.setAttrib (FIELD_RightQuestionSchinese, HELPER_RightQuestionSchinese.toObject (_RightQuestionSchinese)); //
quest_linPSet.setAttrib (FIELD_LeftQuestionChinese, HELPER_LeftQuestionChinese.toObject (_LeftQuestionChinese)); //
quest_linPSet.setAttrib (FIELD_RightQuestionChinese, HELPER_RightQuestionChinese.toObject (_RightQuestionChinese)); //
quest_linPSet.setAttrib (FIELD_LeftQuestionKorean, HELPER_LeftQuestionKorean.toObject (_LeftQuestionKorean)); //
quest_linPSet.setAttrib (FIELD_RightQuestionKorean, HELPER_RightQuestionKorean.toObject (_RightQuestionKorean)); //
quest_linPSet.setAttrib (FIELD_LeftQuestionThai, HELPER_LeftQuestionThai.toObject (_LeftQuestionThai)); //
quest_linPSet.setAttrib (FIELD_RightQuestionThai, HELPER_RightQuestionThai.toObject (_RightQuestionThai)); //
quest_linPSet.setAttrib (FIELD_LeftQuestionViet, HELPER_LeftQuestionViet.toObject (_LeftQuestionViet)); //
quest_linPSet.setAttrib (FIELD_RightQuestionViet, HELPER_RightQuestionViet.toObject (_RightQuestionViet)); //
} }
...@@ -2136,16 +906,6 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -2136,16 +906,6 @@ public abstract class BaseQuestion extends BaseBusinessClass
_LeftQuestion = (String)(HELPER_LeftQuestion.fromObject (_LeftQuestion, quest_linPSet.getAttrib (FIELD_LeftQuestion))); // _LeftQuestion = (String)(HELPER_LeftQuestion.fromObject (_LeftQuestion, quest_linPSet.getAttrib (FIELD_LeftQuestion))); //
_RightQuestionNo = (Integer)(HELPER_RightQuestionNo.fromObject (_RightQuestionNo, quest_linPSet.getAttrib (FIELD_RightQuestionNo))); // _RightQuestionNo = (Integer)(HELPER_RightQuestionNo.fromObject (_RightQuestionNo, quest_linPSet.getAttrib (FIELD_RightQuestionNo))); //
_RightQuestion = (String)(HELPER_RightQuestion.fromObject (_RightQuestion, quest_linPSet.getAttrib (FIELD_RightQuestion))); // _RightQuestion = (String)(HELPER_RightQuestion.fromObject (_RightQuestion, quest_linPSet.getAttrib (FIELD_RightQuestion))); //
_LeftQuestionSchinese = (String)(HELPER_LeftQuestionSchinese.fromObject (_LeftQuestionSchinese, quest_linPSet.getAttrib (FIELD_LeftQuestionSchinese))); //
_RightQuestionSchinese = (String)(HELPER_RightQuestionSchinese.fromObject (_RightQuestionSchinese, quest_linPSet.getAttrib (FIELD_RightQuestionSchinese))); //
_LeftQuestionChinese = (String)(HELPER_LeftQuestionChinese.fromObject (_LeftQuestionChinese, quest_linPSet.getAttrib (FIELD_LeftQuestionChinese))); //
_RightQuestionChinese = (String)(HELPER_RightQuestionChinese.fromObject (_RightQuestionChinese, quest_linPSet.getAttrib (FIELD_RightQuestionChinese))); //
_LeftQuestionKorean = (String)(HELPER_LeftQuestionKorean.fromObject (_LeftQuestionKorean, quest_linPSet.getAttrib (FIELD_LeftQuestionKorean))); //
_RightQuestionKorean = (String)(HELPER_RightQuestionKorean.fromObject (_RightQuestionKorean, quest_linPSet.getAttrib (FIELD_RightQuestionKorean))); //
_LeftQuestionThai = (String)(HELPER_LeftQuestionThai.fromObject (_LeftQuestionThai, quest_linPSet.getAttrib (FIELD_LeftQuestionThai))); //
_RightQuestionThai = (String)(HELPER_RightQuestionThai.fromObject (_RightQuestionThai, quest_linPSet.getAttrib (FIELD_RightQuestionThai))); //
_LeftQuestionViet = (String)(HELPER_LeftQuestionViet.fromObject (_LeftQuestionViet, quest_linPSet.getAttrib (FIELD_LeftQuestionViet))); //
_RightQuestionViet = (String)(HELPER_RightQuestionViet.fromObject (_RightQuestionViet, quest_linPSet.getAttrib (FIELD_RightQuestionViet))); //
} }
...@@ -2197,96 +957,6 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -2197,96 +957,6 @@ public abstract class BaseQuestion extends BaseBusinessClass
e.addException (ex); e.addException (ex);
} }
try
{
setLeftQuestionSchinese (otherQuestion.getLeftQuestionSchinese ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setRightQuestionSchinese (otherQuestion.getRightQuestionSchinese ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setLeftQuestionChinese (otherQuestion.getLeftQuestionChinese ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setRightQuestionChinese (otherQuestion.getRightQuestionChinese ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setLeftQuestionKorean (otherQuestion.getLeftQuestionKorean ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setRightQuestionKorean (otherQuestion.getRightQuestionKorean ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setLeftQuestionThai (otherQuestion.getLeftQuestionThai ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setRightQuestionThai (otherQuestion.getRightQuestionThai ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setLeftQuestionViet (otherQuestion.getLeftQuestionViet ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setRightQuestionViet (otherQuestion.getRightQuestionViet ());
}
catch (FieldException ex)
{
e.addException (ex);
}
} }
} }
...@@ -2306,16 +976,6 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -2306,16 +976,6 @@ public abstract class BaseQuestion extends BaseBusinessClass
_LeftQuestion = sourceQuestion._LeftQuestion; _LeftQuestion = sourceQuestion._LeftQuestion;
_RightQuestionNo = sourceQuestion._RightQuestionNo; _RightQuestionNo = sourceQuestion._RightQuestionNo;
_RightQuestion = sourceQuestion._RightQuestion; _RightQuestion = sourceQuestion._RightQuestion;
_LeftQuestionSchinese = sourceQuestion._LeftQuestionSchinese;
_RightQuestionSchinese = sourceQuestion._RightQuestionSchinese;
_LeftQuestionChinese = sourceQuestion._LeftQuestionChinese;
_RightQuestionChinese = sourceQuestion._RightQuestionChinese;
_LeftQuestionKorean = sourceQuestion._LeftQuestionKorean;
_RightQuestionKorean = sourceQuestion._RightQuestionKorean;
_LeftQuestionThai = sourceQuestion._LeftQuestionThai;
_RightQuestionThai = sourceQuestion._RightQuestionThai;
_LeftQuestionViet = sourceQuestion._LeftQuestionViet;
_RightQuestionViet = sourceQuestion._RightQuestionViet;
} }
} }
...@@ -2372,16 +1032,6 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -2372,16 +1032,6 @@ public abstract class BaseQuestion extends BaseBusinessClass
_LeftQuestion = (String)(HELPER_LeftQuestion.readExternal (_LeftQuestion, vals.get(FIELD_LeftQuestion))); // _LeftQuestion = (String)(HELPER_LeftQuestion.readExternal (_LeftQuestion, vals.get(FIELD_LeftQuestion))); //
_RightQuestionNo = (Integer)(HELPER_RightQuestionNo.readExternal (_RightQuestionNo, vals.get(FIELD_RightQuestionNo))); // _RightQuestionNo = (Integer)(HELPER_RightQuestionNo.readExternal (_RightQuestionNo, vals.get(FIELD_RightQuestionNo))); //
_RightQuestion = (String)(HELPER_RightQuestion.readExternal (_RightQuestion, vals.get(FIELD_RightQuestion))); // _RightQuestion = (String)(HELPER_RightQuestion.readExternal (_RightQuestion, vals.get(FIELD_RightQuestion))); //
_LeftQuestionSchinese = (String)(HELPER_LeftQuestionSchinese.readExternal (_LeftQuestionSchinese, vals.get(FIELD_LeftQuestionSchinese))); //
_RightQuestionSchinese = (String)(HELPER_RightQuestionSchinese.readExternal (_RightQuestionSchinese, vals.get(FIELD_RightQuestionSchinese))); //
_LeftQuestionChinese = (String)(HELPER_LeftQuestionChinese.readExternal (_LeftQuestionChinese, vals.get(FIELD_LeftQuestionChinese))); //
_RightQuestionChinese = (String)(HELPER_RightQuestionChinese.readExternal (_RightQuestionChinese, vals.get(FIELD_RightQuestionChinese))); //
_LeftQuestionKorean = (String)(HELPER_LeftQuestionKorean.readExternal (_LeftQuestionKorean, vals.get(FIELD_LeftQuestionKorean))); //
_RightQuestionKorean = (String)(HELPER_RightQuestionKorean.readExternal (_RightQuestionKorean, vals.get(FIELD_RightQuestionKorean))); //
_LeftQuestionThai = (String)(HELPER_LeftQuestionThai.readExternal (_LeftQuestionThai, vals.get(FIELD_LeftQuestionThai))); //
_RightQuestionThai = (String)(HELPER_RightQuestionThai.readExternal (_RightQuestionThai, vals.get(FIELD_RightQuestionThai))); //
_LeftQuestionViet = (String)(HELPER_LeftQuestionViet.readExternal (_LeftQuestionViet, vals.get(FIELD_LeftQuestionViet))); //
_RightQuestionViet = (String)(HELPER_RightQuestionViet.readExternal (_RightQuestionViet, vals.get(FIELD_RightQuestionViet))); //
} }
...@@ -2397,16 +1047,6 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -2397,16 +1047,6 @@ public abstract class BaseQuestion extends BaseBusinessClass
vals.put (FIELD_LeftQuestion, HELPER_LeftQuestion.writeExternal (_LeftQuestion)); vals.put (FIELD_LeftQuestion, HELPER_LeftQuestion.writeExternal (_LeftQuestion));
vals.put (FIELD_RightQuestionNo, HELPER_RightQuestionNo.writeExternal (_RightQuestionNo)); vals.put (FIELD_RightQuestionNo, HELPER_RightQuestionNo.writeExternal (_RightQuestionNo));
vals.put (FIELD_RightQuestion, HELPER_RightQuestion.writeExternal (_RightQuestion)); vals.put (FIELD_RightQuestion, HELPER_RightQuestion.writeExternal (_RightQuestion));
vals.put (FIELD_LeftQuestionSchinese, HELPER_LeftQuestionSchinese.writeExternal (_LeftQuestionSchinese));
vals.put (FIELD_RightQuestionSchinese, HELPER_RightQuestionSchinese.writeExternal (_RightQuestionSchinese));
vals.put (FIELD_LeftQuestionChinese, HELPER_LeftQuestionChinese.writeExternal (_LeftQuestionChinese));
vals.put (FIELD_RightQuestionChinese, HELPER_RightQuestionChinese.writeExternal (_RightQuestionChinese));
vals.put (FIELD_LeftQuestionKorean, HELPER_LeftQuestionKorean.writeExternal (_LeftQuestionKorean));
vals.put (FIELD_RightQuestionKorean, HELPER_RightQuestionKorean.writeExternal (_RightQuestionKorean));
vals.put (FIELD_LeftQuestionThai, HELPER_LeftQuestionThai.writeExternal (_LeftQuestionThai));
vals.put (FIELD_RightQuestionThai, HELPER_RightQuestionThai.writeExternal (_RightQuestionThai));
vals.put (FIELD_LeftQuestionViet, HELPER_LeftQuestionViet.writeExternal (_LeftQuestionViet));
vals.put (FIELD_RightQuestionViet, HELPER_RightQuestionViet.writeExternal (_RightQuestionViet));
} }
...@@ -2436,46 +1076,6 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -2436,46 +1076,6 @@ public abstract class BaseQuestion extends BaseBusinessClass
{ {
listener.notifyFieldChange(this, other, FIELD_RightQuestion, HELPER_RightQuestion.toObject(this._RightQuestion), HELPER_RightQuestion.toObject(otherQuestion._RightQuestion)); listener.notifyFieldChange(this, other, FIELD_RightQuestion, HELPER_RightQuestion.toObject(this._RightQuestion), HELPER_RightQuestion.toObject(otherQuestion._RightQuestion));
} }
if (!HELPER_LeftQuestionSchinese.compare(this._LeftQuestionSchinese, otherQuestion._LeftQuestionSchinese))
{
listener.notifyFieldChange(this, other, FIELD_LeftQuestionSchinese, HELPER_LeftQuestionSchinese.toObject(this._LeftQuestionSchinese), HELPER_LeftQuestionSchinese.toObject(otherQuestion._LeftQuestionSchinese));
}
if (!HELPER_RightQuestionSchinese.compare(this._RightQuestionSchinese, otherQuestion._RightQuestionSchinese))
{
listener.notifyFieldChange(this, other, FIELD_RightQuestionSchinese, HELPER_RightQuestionSchinese.toObject(this._RightQuestionSchinese), HELPER_RightQuestionSchinese.toObject(otherQuestion._RightQuestionSchinese));
}
if (!HELPER_LeftQuestionChinese.compare(this._LeftQuestionChinese, otherQuestion._LeftQuestionChinese))
{
listener.notifyFieldChange(this, other, FIELD_LeftQuestionChinese, HELPER_LeftQuestionChinese.toObject(this._LeftQuestionChinese), HELPER_LeftQuestionChinese.toObject(otherQuestion._LeftQuestionChinese));
}
if (!HELPER_RightQuestionChinese.compare(this._RightQuestionChinese, otherQuestion._RightQuestionChinese))
{
listener.notifyFieldChange(this, other, FIELD_RightQuestionChinese, HELPER_RightQuestionChinese.toObject(this._RightQuestionChinese), HELPER_RightQuestionChinese.toObject(otherQuestion._RightQuestionChinese));
}
if (!HELPER_LeftQuestionKorean.compare(this._LeftQuestionKorean, otherQuestion._LeftQuestionKorean))
{
listener.notifyFieldChange(this, other, FIELD_LeftQuestionKorean, HELPER_LeftQuestionKorean.toObject(this._LeftQuestionKorean), HELPER_LeftQuestionKorean.toObject(otherQuestion._LeftQuestionKorean));
}
if (!HELPER_RightQuestionKorean.compare(this._RightQuestionKorean, otherQuestion._RightQuestionKorean))
{
listener.notifyFieldChange(this, other, FIELD_RightQuestionKorean, HELPER_RightQuestionKorean.toObject(this._RightQuestionKorean), HELPER_RightQuestionKorean.toObject(otherQuestion._RightQuestionKorean));
}
if (!HELPER_LeftQuestionThai.compare(this._LeftQuestionThai, otherQuestion._LeftQuestionThai))
{
listener.notifyFieldChange(this, other, FIELD_LeftQuestionThai, HELPER_LeftQuestionThai.toObject(this._LeftQuestionThai), HELPER_LeftQuestionThai.toObject(otherQuestion._LeftQuestionThai));
}
if (!HELPER_RightQuestionThai.compare(this._RightQuestionThai, otherQuestion._RightQuestionThai))
{
listener.notifyFieldChange(this, other, FIELD_RightQuestionThai, HELPER_RightQuestionThai.toObject(this._RightQuestionThai), HELPER_RightQuestionThai.toObject(otherQuestion._RightQuestionThai));
}
if (!HELPER_LeftQuestionViet.compare(this._LeftQuestionViet, otherQuestion._LeftQuestionViet))
{
listener.notifyFieldChange(this, other, FIELD_LeftQuestionViet, HELPER_LeftQuestionViet.toObject(this._LeftQuestionViet), HELPER_LeftQuestionViet.toObject(otherQuestion._LeftQuestionViet));
}
if (!HELPER_RightQuestionViet.compare(this._RightQuestionViet, otherQuestion._RightQuestionViet))
{
listener.notifyFieldChange(this, other, FIELD_RightQuestionViet, HELPER_RightQuestionViet.toObject(this._RightQuestionViet), HELPER_RightQuestionViet.toObject(otherQuestion._RightQuestionViet));
}
// Compare single assocs // Compare single assocs
...@@ -2502,16 +1102,6 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -2502,16 +1102,6 @@ public abstract class BaseQuestion extends BaseBusinessClass
visitor.visitField(this, FIELD_LeftQuestion, HELPER_LeftQuestion.toObject(getLeftQuestion())); visitor.visitField(this, FIELD_LeftQuestion, HELPER_LeftQuestion.toObject(getLeftQuestion()));
visitor.visitField(this, FIELD_RightQuestionNo, HELPER_RightQuestionNo.toObject(getRightQuestionNo())); visitor.visitField(this, FIELD_RightQuestionNo, HELPER_RightQuestionNo.toObject(getRightQuestionNo()));
visitor.visitField(this, FIELD_RightQuestion, HELPER_RightQuestion.toObject(getRightQuestion())); visitor.visitField(this, FIELD_RightQuestion, HELPER_RightQuestion.toObject(getRightQuestion()));
visitor.visitField(this, FIELD_LeftQuestionSchinese, HELPER_LeftQuestionSchinese.toObject(getLeftQuestionSchinese()));
visitor.visitField(this, FIELD_RightQuestionSchinese, HELPER_RightQuestionSchinese.toObject(getRightQuestionSchinese()));
visitor.visitField(this, FIELD_LeftQuestionChinese, HELPER_LeftQuestionChinese.toObject(getLeftQuestionChinese()));
visitor.visitField(this, FIELD_RightQuestionChinese, HELPER_RightQuestionChinese.toObject(getRightQuestionChinese()));
visitor.visitField(this, FIELD_LeftQuestionKorean, HELPER_LeftQuestionKorean.toObject(getLeftQuestionKorean()));
visitor.visitField(this, FIELD_RightQuestionKorean, HELPER_RightQuestionKorean.toObject(getRightQuestionKorean()));
visitor.visitField(this, FIELD_LeftQuestionThai, HELPER_LeftQuestionThai.toObject(getLeftQuestionThai()));
visitor.visitField(this, FIELD_RightQuestionThai, HELPER_RightQuestionThai.toObject(getRightQuestionThai()));
visitor.visitField(this, FIELD_LeftQuestionViet, HELPER_LeftQuestionViet.toObject(getLeftQuestionViet()));
visitor.visitField(this, FIELD_RightQuestionViet, HELPER_RightQuestionViet.toObject(getRightQuestionViet()));
} }
...@@ -2561,46 +1151,6 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -2561,46 +1151,6 @@ public abstract class BaseQuestion extends BaseBusinessClass
{ {
return filter.matches (getRightQuestion ()); return filter.matches (getRightQuestion ());
} }
else if (attribName.equals (FIELD_LeftQuestionSchinese))
{
return filter.matches (getLeftQuestionSchinese ());
}
else if (attribName.equals (FIELD_RightQuestionSchinese))
{
return filter.matches (getRightQuestionSchinese ());
}
else if (attribName.equals (FIELD_LeftQuestionChinese))
{
return filter.matches (getLeftQuestionChinese ());
}
else if (attribName.equals (FIELD_RightQuestionChinese))
{
return filter.matches (getRightQuestionChinese ());
}
else if (attribName.equals (FIELD_LeftQuestionKorean))
{
return filter.matches (getLeftQuestionKorean ());
}
else if (attribName.equals (FIELD_RightQuestionKorean))
{
return filter.matches (getRightQuestionKorean ());
}
else if (attribName.equals (FIELD_LeftQuestionThai))
{
return filter.matches (getLeftQuestionThai ());
}
else if (attribName.equals (FIELD_RightQuestionThai))
{
return filter.matches (getRightQuestionThai ());
}
else if (attribName.equals (FIELD_LeftQuestionViet))
{
return filter.matches (getLeftQuestionViet ());
}
else if (attribName.equals (FIELD_RightQuestionViet))
{
return filter.matches (getRightQuestionViet ());
}
else else
{ {
return super.testFilter (attribName, filter); return super.testFilter (attribName, filter);
...@@ -2620,57 +1170,17 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -2620,57 +1170,17 @@ public abstract class BaseQuestion extends BaseBusinessClass
{ {
return HELPER_LeftQuestionNo.toObject (getLeftQuestionNo ()); return HELPER_LeftQuestionNo.toObject (getLeftQuestionNo ());
} }
else if (attribName.equals (FIELD_LeftQuestion)) 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 if (attribName.equals (FIELD_LeftQuestionSchinese))
{
return HELPER_LeftQuestionSchinese.toObject (getLeftQuestionSchinese ());
}
else if (attribName.equals (FIELD_RightQuestionSchinese))
{
return HELPER_RightQuestionSchinese.toObject (getRightQuestionSchinese ());
}
else if (attribName.equals (FIELD_LeftQuestionChinese))
{
return HELPER_LeftQuestionChinese.toObject (getLeftQuestionChinese ());
}
else if (attribName.equals (FIELD_RightQuestionChinese))
{
return HELPER_RightQuestionChinese.toObject (getRightQuestionChinese ());
}
else if (attribName.equals (FIELD_LeftQuestionKorean))
{
return HELPER_LeftQuestionKorean.toObject (getLeftQuestionKorean ());
}
else if (attribName.equals (FIELD_RightQuestionKorean))
{
return HELPER_RightQuestionKorean.toObject (getRightQuestionKorean ());
}
else if (attribName.equals (FIELD_LeftQuestionThai))
{
return HELPER_LeftQuestionThai.toObject (getLeftQuestionThai ());
}
else if (attribName.equals (FIELD_RightQuestionThai))
{ {
return HELPER_RightQuestionThai.toObject (getRightQuestionThai ()); return HELPER_LeftQuestion.toObject (getLeftQuestion ());
} }
else if (attribName.equals (FIELD_LeftQuestionViet)) else if (attribName.equals (FIELD_RightQuestionNo))
{ {
return HELPER_LeftQuestionViet.toObject (getLeftQuestionViet ()); return HELPER_RightQuestionNo.toObject (getRightQuestionNo ());
} }
else if (attribName.equals (FIELD_RightQuestionViet)) else if (attribName.equals (FIELD_RightQuestion))
{ {
return HELPER_RightQuestionViet.toObject (getRightQuestionViet ()); return HELPER_RightQuestion.toObject (getRightQuestion ());
} }
else else
{ {
...@@ -2701,46 +1211,6 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -2701,46 +1211,6 @@ public abstract class BaseQuestion extends BaseBusinessClass
{ {
return HELPER_RightQuestion; return HELPER_RightQuestion;
} }
else if (attribName.equals (FIELD_LeftQuestionSchinese))
{
return HELPER_LeftQuestionSchinese;
}
else if (attribName.equals (FIELD_RightQuestionSchinese))
{
return HELPER_RightQuestionSchinese;
}
else if (attribName.equals (FIELD_LeftQuestionChinese))
{
return HELPER_LeftQuestionChinese;
}
else if (attribName.equals (FIELD_RightQuestionChinese))
{
return HELPER_RightQuestionChinese;
}
else if (attribName.equals (FIELD_LeftQuestionKorean))
{
return HELPER_LeftQuestionKorean;
}
else if (attribName.equals (FIELD_RightQuestionKorean))
{
return HELPER_RightQuestionKorean;
}
else if (attribName.equals (FIELD_LeftQuestionThai))
{
return HELPER_LeftQuestionThai;
}
else if (attribName.equals (FIELD_RightQuestionThai))
{
return HELPER_RightQuestionThai;
}
else if (attribName.equals (FIELD_LeftQuestionViet))
{
return HELPER_LeftQuestionViet;
}
else if (attribName.equals (FIELD_RightQuestionViet))
{
return HELPER_RightQuestionViet;
}
else else
{ {
return super.getAttributeHelper (attribName); return super.getAttributeHelper (attribName);
...@@ -2770,46 +1240,6 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -2770,46 +1240,6 @@ public abstract class BaseQuestion extends BaseBusinessClass
{ {
setRightQuestion ((String)(HELPER_RightQuestion.fromObject (_RightQuestion, attribValue))); setRightQuestion ((String)(HELPER_RightQuestion.fromObject (_RightQuestion, attribValue)));
} }
else if (attribName.equals (FIELD_LeftQuestionSchinese))
{
setLeftQuestionSchinese ((String)(HELPER_LeftQuestionSchinese.fromObject (_LeftQuestionSchinese, attribValue)));
}
else if (attribName.equals (FIELD_RightQuestionSchinese))
{
setRightQuestionSchinese ((String)(HELPER_RightQuestionSchinese.fromObject (_RightQuestionSchinese, attribValue)));
}
else if (attribName.equals (FIELD_LeftQuestionChinese))
{
setLeftQuestionChinese ((String)(HELPER_LeftQuestionChinese.fromObject (_LeftQuestionChinese, attribValue)));
}
else if (attribName.equals (FIELD_RightQuestionChinese))
{
setRightQuestionChinese ((String)(HELPER_RightQuestionChinese.fromObject (_RightQuestionChinese, attribValue)));
}
else if (attribName.equals (FIELD_LeftQuestionKorean))
{
setLeftQuestionKorean ((String)(HELPER_LeftQuestionKorean.fromObject (_LeftQuestionKorean, attribValue)));
}
else if (attribName.equals (FIELD_RightQuestionKorean))
{
setRightQuestionKorean ((String)(HELPER_RightQuestionKorean.fromObject (_RightQuestionKorean, attribValue)));
}
else if (attribName.equals (FIELD_LeftQuestionThai))
{
setLeftQuestionThai ((String)(HELPER_LeftQuestionThai.fromObject (_LeftQuestionThai, attribValue)));
}
else if (attribName.equals (FIELD_RightQuestionThai))
{
setRightQuestionThai ((String)(HELPER_RightQuestionThai.fromObject (_RightQuestionThai, attribValue)));
}
else if (attribName.equals (FIELD_LeftQuestionViet))
{
setLeftQuestionViet ((String)(HELPER_LeftQuestionViet.fromObject (_LeftQuestionViet, attribValue)));
}
else if (attribName.equals (FIELD_RightQuestionViet))
{
setRightQuestionViet ((String)(HELPER_RightQuestionViet.fromObject (_RightQuestionViet, attribValue)));
}
else else
{ {
super.setAttribute (attribName, attribValue); super.setAttribute (attribName, attribValue);
...@@ -2846,46 +1276,6 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -2846,46 +1276,6 @@ public abstract class BaseQuestion extends BaseBusinessClass
{ {
return getWriteability_RightQuestion (); return getWriteability_RightQuestion ();
} }
else if (fieldName.equals (FIELD_LeftQuestionSchinese))
{
return getWriteability_LeftQuestionSchinese ();
}
else if (fieldName.equals (FIELD_RightQuestionSchinese))
{
return getWriteability_RightQuestionSchinese ();
}
else if (fieldName.equals (FIELD_LeftQuestionChinese))
{
return getWriteability_LeftQuestionChinese ();
}
else if (fieldName.equals (FIELD_RightQuestionChinese))
{
return getWriteability_RightQuestionChinese ();
}
else if (fieldName.equals (FIELD_LeftQuestionKorean))
{
return getWriteability_LeftQuestionKorean ();
}
else if (fieldName.equals (FIELD_RightQuestionKorean))
{
return getWriteability_RightQuestionKorean ();
}
else if (fieldName.equals (FIELD_LeftQuestionThai))
{
return getWriteability_LeftQuestionThai ();
}
else if (fieldName.equals (FIELD_RightQuestionThai))
{
return getWriteability_RightQuestionThai ();
}
else if (fieldName.equals (FIELD_LeftQuestionViet))
{
return getWriteability_LeftQuestionViet ();
}
else if (fieldName.equals (FIELD_RightQuestionViet))
{
return getWriteability_RightQuestionViet ();
}
else else
{ {
return super.getWriteable (fieldName); return super.getWriteable (fieldName);
...@@ -2916,56 +1306,6 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -2916,56 +1306,6 @@ public abstract class BaseQuestion extends BaseBusinessClass
fields.add (FIELD_RightQuestion); fields.add (FIELD_RightQuestion);
} }
if (getWriteability_LeftQuestionSchinese () != FieldWriteability.TRUE)
{
fields.add (FIELD_LeftQuestionSchinese);
}
if (getWriteability_RightQuestionSchinese () != FieldWriteability.TRUE)
{
fields.add (FIELD_RightQuestionSchinese);
}
if (getWriteability_LeftQuestionChinese () != FieldWriteability.TRUE)
{
fields.add (FIELD_LeftQuestionChinese);
}
if (getWriteability_RightQuestionChinese () != FieldWriteability.TRUE)
{
fields.add (FIELD_RightQuestionChinese);
}
if (getWriteability_LeftQuestionKorean () != FieldWriteability.TRUE)
{
fields.add (FIELD_LeftQuestionKorean);
}
if (getWriteability_RightQuestionKorean () != FieldWriteability.TRUE)
{
fields.add (FIELD_RightQuestionKorean);
}
if (getWriteability_LeftQuestionThai () != FieldWriteability.TRUE)
{
fields.add (FIELD_LeftQuestionThai);
}
if (getWriteability_RightQuestionThai () != FieldWriteability.TRUE)
{
fields.add (FIELD_RightQuestionThai);
}
if (getWriteability_LeftQuestionViet () != FieldWriteability.TRUE)
{
fields.add (FIELD_LeftQuestionViet);
}
if (getWriteability_RightQuestionViet () != FieldWriteability.TRUE)
{
fields.add (FIELD_RightQuestionViet);
}
super.putUnwriteable (fields); super.putUnwriteable (fields);
} }
...@@ -2979,16 +1319,6 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -2979,16 +1319,6 @@ public abstract class BaseQuestion extends BaseBusinessClass
result.add(HELPER_LeftQuestion.getAttribObject (getClass (), _LeftQuestion, false, FIELD_LeftQuestion)); result.add(HELPER_LeftQuestion.getAttribObject (getClass (), _LeftQuestion, false, FIELD_LeftQuestion));
result.add(HELPER_RightQuestionNo.getAttribObject (getClass (), _RightQuestionNo, false, FIELD_RightQuestionNo)); result.add(HELPER_RightQuestionNo.getAttribObject (getClass (), _RightQuestionNo, false, FIELD_RightQuestionNo));
result.add(HELPER_RightQuestion.getAttribObject (getClass (), _RightQuestion, false, FIELD_RightQuestion)); result.add(HELPER_RightQuestion.getAttribObject (getClass (), _RightQuestion, false, FIELD_RightQuestion));
result.add(HELPER_LeftQuestionSchinese.getAttribObject (getClass (), _LeftQuestionSchinese, false, FIELD_LeftQuestionSchinese));
result.add(HELPER_RightQuestionSchinese.getAttribObject (getClass (), _RightQuestionSchinese, false, FIELD_RightQuestionSchinese));
result.add(HELPER_LeftQuestionChinese.getAttribObject (getClass (), _LeftQuestionChinese, false, FIELD_LeftQuestionChinese));
result.add(HELPER_RightQuestionChinese.getAttribObject (getClass (), _RightQuestionChinese, false, FIELD_RightQuestionChinese));
result.add(HELPER_LeftQuestionKorean.getAttribObject (getClass (), _LeftQuestionKorean, false, FIELD_LeftQuestionKorean));
result.add(HELPER_RightQuestionKorean.getAttribObject (getClass (), _RightQuestionKorean, false, FIELD_RightQuestionKorean));
result.add(HELPER_LeftQuestionThai.getAttribObject (getClass (), _LeftQuestionThai, false, FIELD_LeftQuestionThai));
result.add(HELPER_RightQuestionThai.getAttribObject (getClass (), _RightQuestionThai, false, FIELD_RightQuestionThai));
result.add(HELPER_LeftQuestionViet.getAttribObject (getClass (), _LeftQuestionViet, false, FIELD_LeftQuestionViet));
result.add(HELPER_RightQuestionViet.getAttribObject (getClass (), _RightQuestionViet, false, FIELD_RightQuestionViet));
return result; return result;
} }
...@@ -3111,186 +1441,6 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -3111,186 +1441,6 @@ public abstract class BaseQuestion extends BaseBusinessClass
return newRightQuestion; return newRightQuestion;
} }
/**
* Get the attribute LeftQuestionSchinese
*/
public String getLeftQuestionSchinese (Question obj, String original)
{
return original;
}
/**
* Change the value set for attribute LeftQuestionSchinese.
* May modify the field beforehand
* Occurs before validation.
*/
public String setLeftQuestionSchinese (Question obj, String newLeftQuestionSchinese) throws FieldException
{
return newLeftQuestionSchinese;
}
/**
* Get the attribute RightQuestionSchinese
*/
public String getRightQuestionSchinese (Question obj, String original)
{
return original;
}
/**
* Change the value set for attribute RightQuestionSchinese.
* May modify the field beforehand
* Occurs before validation.
*/
public String setRightQuestionSchinese (Question obj, String newRightQuestionSchinese) throws FieldException
{
return newRightQuestionSchinese;
}
/**
* Get the attribute LeftQuestionChinese
*/
public String getLeftQuestionChinese (Question obj, String original)
{
return original;
}
/**
* Change the value set for attribute LeftQuestionChinese.
* May modify the field beforehand
* Occurs before validation.
*/
public String setLeftQuestionChinese (Question obj, String newLeftQuestionChinese) throws FieldException
{
return newLeftQuestionChinese;
}
/**
* Get the attribute RightQuestionChinese
*/
public String getRightQuestionChinese (Question obj, String original)
{
return original;
}
/**
* Change the value set for attribute RightQuestionChinese.
* May modify the field beforehand
* Occurs before validation.
*/
public String setRightQuestionChinese (Question obj, String newRightQuestionChinese) throws FieldException
{
return newRightQuestionChinese;
}
/**
* Get the attribute LeftQuestionKorean
*/
public String getLeftQuestionKorean (Question obj, String original)
{
return original;
}
/**
* Change the value set for attribute LeftQuestionKorean.
* May modify the field beforehand
* Occurs before validation.
*/
public String setLeftQuestionKorean (Question obj, String newLeftQuestionKorean) throws FieldException
{
return newLeftQuestionKorean;
}
/**
* Get the attribute RightQuestionKorean
*/
public String getRightQuestionKorean (Question obj, String original)
{
return original;
}
/**
* Change the value set for attribute RightQuestionKorean.
* May modify the field beforehand
* Occurs before validation.
*/
public String setRightQuestionKorean (Question obj, String newRightQuestionKorean) throws FieldException
{
return newRightQuestionKorean;
}
/**
* Get the attribute LeftQuestionThai
*/
public String getLeftQuestionThai (Question obj, String original)
{
return original;
}
/**
* Change the value set for attribute LeftQuestionThai.
* May modify the field beforehand
* Occurs before validation.
*/
public String setLeftQuestionThai (Question obj, String newLeftQuestionThai) throws FieldException
{
return newLeftQuestionThai;
}
/**
* Get the attribute RightQuestionThai
*/
public String getRightQuestionThai (Question obj, String original)
{
return original;
}
/**
* Change the value set for attribute RightQuestionThai.
* May modify the field beforehand
* Occurs before validation.
*/
public String setRightQuestionThai (Question obj, String newRightQuestionThai) throws FieldException
{
return newRightQuestionThai;
}
/**
* Get the attribute LeftQuestionViet
*/
public String getLeftQuestionViet (Question obj, String original)
{
return original;
}
/**
* Change the value set for attribute LeftQuestionViet.
* May modify the field beforehand
* Occurs before validation.
*/
public String setLeftQuestionViet (Question obj, String newLeftQuestionViet) throws FieldException
{
return newLeftQuestionViet;
}
/**
* Get the attribute RightQuestionViet
*/
public String getRightQuestionViet (Question obj, String original)
{
return original;
}
/**
* Change the value set for attribute RightQuestionViet.
* May modify the field beforehand
* Occurs before validation.
*/
public String setRightQuestionViet (Question obj, String newRightQuestionViet) throws FieldException
{
return newRightQuestionViet;
}
} }
...@@ -3359,46 +1509,6 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -3359,46 +1509,6 @@ public abstract class BaseQuestion extends BaseBusinessClass
{ {
return toRightQuestion (); return toRightQuestion ();
} }
if (name.equals ("LeftQuestionSchinese"))
{
return toLeftQuestionSchinese ();
}
if (name.equals ("RightQuestionSchinese"))
{
return toRightQuestionSchinese ();
}
if (name.equals ("LeftQuestionChinese"))
{
return toLeftQuestionChinese ();
}
if (name.equals ("RightQuestionChinese"))
{
return toRightQuestionChinese ();
}
if (name.equals ("LeftQuestionKorean"))
{
return toLeftQuestionKorean ();
}
if (name.equals ("RightQuestionKorean"))
{
return toRightQuestionKorean ();
}
if (name.equals ("LeftQuestionThai"))
{
return toLeftQuestionThai ();
}
if (name.equals ("RightQuestionThai"))
{
return toRightQuestionThai ();
}
if (name.equals ("LeftQuestionViet"))
{
return toLeftQuestionViet ();
}
if (name.equals ("RightQuestionViet"))
{
return toRightQuestionViet ();
}
return super.to(name); return super.to(name);
...@@ -3413,26 +1523,6 @@ public abstract class BaseQuestion extends BaseBusinessClass ...@@ -3413,26 +1523,6 @@ public abstract class BaseQuestion extends BaseBusinessClass
public PipeLine<From, String> toRightQuestion () { return pipe(new ORMAttributePipe<Me, String>(FIELD_RightQuestion)); } public PipeLine<From, String> toRightQuestion () { return pipe(new ORMAttributePipe<Me, String>(FIELD_RightQuestion)); }
public PipeLine<From, String> toLeftQuestionSchinese () { return pipe(new ORMAttributePipe<Me, String>(FIELD_LeftQuestionSchinese)); }
public PipeLine<From, String> toRightQuestionSchinese () { return pipe(new ORMAttributePipe<Me, String>(FIELD_RightQuestionSchinese)); }
public PipeLine<From, String> toLeftQuestionChinese () { return pipe(new ORMAttributePipe<Me, String>(FIELD_LeftQuestionChinese)); }
public PipeLine<From, String> toRightQuestionChinese () { return pipe(new ORMAttributePipe<Me, String>(FIELD_RightQuestionChinese)); }
public PipeLine<From, String> toLeftQuestionKorean () { return pipe(new ORMAttributePipe<Me, String>(FIELD_LeftQuestionKorean)); }
public PipeLine<From, String> toRightQuestionKorean () { return pipe(new ORMAttributePipe<Me, String>(FIELD_RightQuestionKorean)); }
public PipeLine<From, String> toLeftQuestionThai () { return pipe(new ORMAttributePipe<Me, String>(FIELD_LeftQuestionThai)); }
public PipeLine<From, String> toRightQuestionThai () { return pipe(new ORMAttributePipe<Me, String>(FIELD_RightQuestionThai)); }
public PipeLine<From, String> toLeftQuestionViet () { return pipe(new ORMAttributePipe<Me, String>(FIELD_LeftQuestionViet)); }
public PipeLine<From, String> toRightQuestionViet () { return pipe(new ORMAttributePipe<Me, String>(FIELD_RightQuestionViet)); }
} }
public boolean isTransientAttrib(String attribName) public boolean isTransientAttrib(String attribName)
......
package performa.orm; package performa.orm;
import java.io.*;
import java.util.*;
import oneit.appservices.config.*;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.utils.*;
public class Candidate extends BaseCandidate public class Candidate extends BaseCandidate
{ {
...@@ -22,6 +10,4 @@ public class Candidate extends BaseCandidate ...@@ -22,6 +10,4 @@ public class Candidate extends BaseCandidate
{ {
// Do not add any code to this, always put it in initialiseNewObject // Do not add any code to this, always put it in initialiseNewObject
} }
} }
\ No newline at end of file
...@@ -17,8 +17,6 @@ ...@@ -17,8 +17,6 @@
<ATTRIB name="Gender" type="String" dbcol="gender" length="10"/> <ATTRIB name="Gender" type="String" dbcol="gender" length="10"/>
<ATTRIB name="Password" type="String" dbcol="password" length="15"/> <ATTRIB name="Password" type="String" dbcol="password" length="15"/>
<ATTRIB name="DateTaken" type="Date" dbcol="date_taken"/> <ATTRIB name="DateTaken" type="Date" dbcol="date_taken"/>
<ATTRIB name="SectionNo" type="Integer" dbcol="section_number"/>
<ATTRIB name="LeftQuestionNo" type="Integer" dbcol="left_quest_number"/>
<ATTRIB name="Location" type="String" dbcol="location" length="80"/> <ATTRIB name="Location" type="String" dbcol="location" length="80"/>
<ATTRIB name="Phone" type="String" dbcol="contact_phone" length="80"/> <ATTRIB name="Phone" type="String" dbcol="contact_phone" length="80"/>
<ATTRIB name="Email" type="String" dbcol="email" length="60"/> <ATTRIB name="Email" type="String" dbcol="email" length="60"/>
......
...@@ -37,8 +37,6 @@ public class CandidatePersistenceMgr extends ObjectPersistenceMgr ...@@ -37,8 +37,6 @@ public class CandidatePersistenceMgr extends ObjectPersistenceMgr
private String dummyGender; private String dummyGender;
private String dummyPassword; private String dummyPassword;
private Date dummyDateTaken; private Date dummyDateTaken;
private Integer dummySectionNo;
private Integer dummyLeftQuestionNo;
private String dummyLocation; private String dummyLocation;
private String dummyPhone; private String dummyPhone;
private String dummyEmail; private String dummyEmail;
...@@ -56,8 +54,6 @@ public class CandidatePersistenceMgr extends ObjectPersistenceMgr ...@@ -56,8 +54,6 @@ public class CandidatePersistenceMgr extends ObjectPersistenceMgr
private static final DefaultAttributeHelper HELPER_Gender = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper HELPER_Gender = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_Password = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper HELPER_Password = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_DateTaken = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper HELPER_DateTaken = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_SectionNo = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_LeftQuestionNo = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_Location = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper HELPER_Location = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_Phone = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper HELPER_Phone = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_Email = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper HELPER_Email = DefaultAttributeHelper.INSTANCE;
...@@ -78,15 +74,13 @@ public class CandidatePersistenceMgr extends ObjectPersistenceMgr ...@@ -78,15 +74,13 @@ public class CandidatePersistenceMgr extends ObjectPersistenceMgr
dummyGender = (String)(HELPER_Gender.initialise (dummyGender)); dummyGender = (String)(HELPER_Gender.initialise (dummyGender));
dummyPassword = (String)(HELPER_Password.initialise (dummyPassword)); dummyPassword = (String)(HELPER_Password.initialise (dummyPassword));
dummyDateTaken = (Date)(HELPER_DateTaken.initialise (dummyDateTaken)); dummyDateTaken = (Date)(HELPER_DateTaken.initialise (dummyDateTaken));
dummySectionNo = (Integer)(HELPER_SectionNo.initialise (dummySectionNo));
dummyLeftQuestionNo = (Integer)(HELPER_LeftQuestionNo.initialise (dummyLeftQuestionNo));
dummyLocation = (String)(HELPER_Location.initialise (dummyLocation)); dummyLocation = (String)(HELPER_Location.initialise (dummyLocation));
dummyPhone = (String)(HELPER_Phone.initialise (dummyPhone)); dummyPhone = (String)(HELPER_Phone.initialise (dummyPhone));
dummyEmail = (String)(HELPER_Email.initialise (dummyEmail)); dummyEmail = (String)(HELPER_Email.initialise (dummyEmail));
} }
private String SELECT_COLUMNS = "{PREFIX}candidate.object_id as id, {PREFIX}candidate.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}candidate.object_CREATED_DATE as CREATED_DATE, {PREFIX}candidate.first_name, {PREFIX}candidate.middle_name, {PREFIX}candidate.last_name, {PREFIX}candidate.preferred_name, {PREFIX}candidate.salutation, {PREFIX}candidate.position, {PREFIX}candidate.date_of_birth, {PREFIX}candidate.date_registered, {PREFIX}candidate.gender, {PREFIX}candidate.password, {PREFIX}candidate.date_taken, {PREFIX}candidate.section_number, {PREFIX}candidate.left_quest_number, {PREFIX}candidate.location, {PREFIX}candidate.contact_phone, {PREFIX}candidate.email, 1 AS commasafe "; private String SELECT_COLUMNS = "{PREFIX}candidate.object_id as id, {PREFIX}candidate.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}candidate.object_CREATED_DATE as CREATED_DATE, {PREFIX}candidate.first_name, {PREFIX}candidate.middle_name, {PREFIX}candidate.last_name, {PREFIX}candidate.preferred_name, {PREFIX}candidate.salutation, {PREFIX}candidate.position, {PREFIX}candidate.date_of_birth, {PREFIX}candidate.date_registered, {PREFIX}candidate.gender, {PREFIX}candidate.password, {PREFIX}candidate.date_taken, {PREFIX}candidate.location, {PREFIX}candidate.contact_phone, {PREFIX}candidate.email, 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
...@@ -148,8 +142,6 @@ public class CandidatePersistenceMgr extends ObjectPersistenceMgr ...@@ -148,8 +142,6 @@ public class CandidatePersistenceMgr extends ObjectPersistenceMgr
!candidatePSet.containsAttrib(Candidate.FIELD_Gender)|| !candidatePSet.containsAttrib(Candidate.FIELD_Gender)||
!candidatePSet.containsAttrib(Candidate.FIELD_Password)|| !candidatePSet.containsAttrib(Candidate.FIELD_Password)||
!candidatePSet.containsAttrib(Candidate.FIELD_DateTaken)|| !candidatePSet.containsAttrib(Candidate.FIELD_DateTaken)||
!candidatePSet.containsAttrib(Candidate.FIELD_SectionNo)||
!candidatePSet.containsAttrib(Candidate.FIELD_LeftQuestionNo)||
!candidatePSet.containsAttrib(Candidate.FIELD_Location)|| !candidatePSet.containsAttrib(Candidate.FIELD_Location)||
!candidatePSet.containsAttrib(Candidate.FIELD_Phone)|| !candidatePSet.containsAttrib(Candidate.FIELD_Phone)||
!candidatePSet.containsAttrib(Candidate.FIELD_Email)) !candidatePSet.containsAttrib(Candidate.FIELD_Email))
...@@ -222,10 +214,10 @@ public class CandidatePersistenceMgr extends ObjectPersistenceMgr ...@@ -222,10 +214,10 @@ public class CandidatePersistenceMgr extends ObjectPersistenceMgr
{ {
int rowsUpdated = executeStatement (sqlMgr, int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}candidate " + "UPDATE {PREFIX}candidate " +
"SET first_name = ?, middle_name = ?, last_name = ?, preferred_name = ?, salutation = ?, position = ?, date_of_birth = ?, date_registered = ?, gender = ?, password = ?, date_taken = ?, section_number = ?, left_quest_number = ?, location = ?, contact_phone = ?, email = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " + "SET first_name = ?, middle_name = ?, last_name = ?, preferred_name = ?, salutation = ?, position = ?, date_of_birth = ?, date_registered = ?, gender = ?, password = ?, date_taken = ?, location = ?, contact_phone = ?, email = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE candidate.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ", "WHERE candidate.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_FirstName.getForSQL(dummyFirstName, candidatePSet.getAttrib (Candidate.FIELD_FirstName))).listEntry (HELPER_MiddleName.getForSQL(dummyMiddleName, candidatePSet.getAttrib (Candidate.FIELD_MiddleName))).listEntry (HELPER_LastName.getForSQL(dummyLastName, candidatePSet.getAttrib (Candidate.FIELD_LastName))).listEntry (HELPER_PreferredName.getForSQL(dummyPreferredName, candidatePSet.getAttrib (Candidate.FIELD_PreferredName))).listEntry (HELPER_Salutation.getForSQL(dummySalutation, candidatePSet.getAttrib (Candidate.FIELD_Salutation))).listEntry (HELPER_Position.getForSQL(dummyPosition, candidatePSet.getAttrib (Candidate.FIELD_Position))).listEntry (HELPER_DateOfBirth.getForSQL(dummyDateOfBirth, candidatePSet.getAttrib (Candidate.FIELD_DateOfBirth))).listEntry (HELPER_DateRegistered.getForSQL(dummyDateRegistered, candidatePSet.getAttrib (Candidate.FIELD_DateRegistered))).listEntry (HELPER_Gender.getForSQL(dummyGender, candidatePSet.getAttrib (Candidate.FIELD_Gender))).listEntry (HELPER_Password.getForSQL(dummyPassword, candidatePSet.getAttrib (Candidate.FIELD_Password))).listEntry (HELPER_DateTaken.getForSQL(dummyDateTaken, candidatePSet.getAttrib (Candidate.FIELD_DateTaken))).listEntry (HELPER_SectionNo.getForSQL(dummySectionNo, candidatePSet.getAttrib (Candidate.FIELD_SectionNo))).listEntry (HELPER_LeftQuestionNo.getForSQL(dummyLeftQuestionNo, candidatePSet.getAttrib (Candidate.FIELD_LeftQuestionNo))).listEntry (HELPER_Location.getForSQL(dummyLocation, candidatePSet.getAttrib (Candidate.FIELD_Location))).listEntry (HELPER_Phone.getForSQL(dummyPhone, candidatePSet.getAttrib (Candidate.FIELD_Phone))).listEntry (HELPER_Email.getForSQL(dummyEmail, candidatePSet.getAttrib (Candidate.FIELD_Email))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray()); CollectionUtils.listEntry (HELPER_FirstName.getForSQL(dummyFirstName, candidatePSet.getAttrib (Candidate.FIELD_FirstName))).listEntry (HELPER_MiddleName.getForSQL(dummyMiddleName, candidatePSet.getAttrib (Candidate.FIELD_MiddleName))).listEntry (HELPER_LastName.getForSQL(dummyLastName, candidatePSet.getAttrib (Candidate.FIELD_LastName))).listEntry (HELPER_PreferredName.getForSQL(dummyPreferredName, candidatePSet.getAttrib (Candidate.FIELD_PreferredName))).listEntry (HELPER_Salutation.getForSQL(dummySalutation, candidatePSet.getAttrib (Candidate.FIELD_Salutation))).listEntry (HELPER_Position.getForSQL(dummyPosition, candidatePSet.getAttrib (Candidate.FIELD_Position))).listEntry (HELPER_DateOfBirth.getForSQL(dummyDateOfBirth, candidatePSet.getAttrib (Candidate.FIELD_DateOfBirth))).listEntry (HELPER_DateRegistered.getForSQL(dummyDateRegistered, candidatePSet.getAttrib (Candidate.FIELD_DateRegistered))).listEntry (HELPER_Gender.getForSQL(dummyGender, candidatePSet.getAttrib (Candidate.FIELD_Gender))).listEntry (HELPER_Password.getForSQL(dummyPassword, candidatePSet.getAttrib (Candidate.FIELD_Password))).listEntry (HELPER_DateTaken.getForSQL(dummyDateTaken, candidatePSet.getAttrib (Candidate.FIELD_DateTaken))).listEntry (HELPER_Location.getForSQL(dummyLocation, candidatePSet.getAttrib (Candidate.FIELD_Location))).listEntry (HELPER_Phone.getForSQL(dummyPhone, candidatePSet.getAttrib (Candidate.FIELD_Phone))).listEntry (HELPER_Email.getForSQL(dummyEmail, candidatePSet.getAttrib (Candidate.FIELD_Email))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
if (rowsUpdated != 1) if (rowsUpdated != 1)
{ {
...@@ -450,8 +442,6 @@ public class CandidatePersistenceMgr extends ObjectPersistenceMgr ...@@ -450,8 +442,6 @@ public class CandidatePersistenceMgr extends ObjectPersistenceMgr
candidatePSet.setAttrib(Candidate.FIELD_Gender, HELPER_Gender.getFromRS(dummyGender, r, "gender")); candidatePSet.setAttrib(Candidate.FIELD_Gender, HELPER_Gender.getFromRS(dummyGender, r, "gender"));
candidatePSet.setAttrib(Candidate.FIELD_Password, HELPER_Password.getFromRS(dummyPassword, r, "password")); candidatePSet.setAttrib(Candidate.FIELD_Password, HELPER_Password.getFromRS(dummyPassword, r, "password"));
candidatePSet.setAttrib(Candidate.FIELD_DateTaken, HELPER_DateTaken.getFromRS(dummyDateTaken, r, "date_taken")); candidatePSet.setAttrib(Candidate.FIELD_DateTaken, HELPER_DateTaken.getFromRS(dummyDateTaken, r, "date_taken"));
candidatePSet.setAttrib(Candidate.FIELD_SectionNo, HELPER_SectionNo.getFromRS(dummySectionNo, r, "section_number"));
candidatePSet.setAttrib(Candidate.FIELD_LeftQuestionNo, HELPER_LeftQuestionNo.getFromRS(dummyLeftQuestionNo, r, "left_quest_number"));
candidatePSet.setAttrib(Candidate.FIELD_Location, HELPER_Location.getFromRS(dummyLocation, r, "location")); candidatePSet.setAttrib(Candidate.FIELD_Location, HELPER_Location.getFromRS(dummyLocation, r, "location"));
candidatePSet.setAttrib(Candidate.FIELD_Phone, HELPER_Phone.getFromRS(dummyPhone, r, "contact_phone")); candidatePSet.setAttrib(Candidate.FIELD_Phone, HELPER_Phone.getFromRS(dummyPhone, r, "contact_phone"));
candidatePSet.setAttrib(Candidate.FIELD_Email, HELPER_Email.getFromRS(dummyEmail, r, "email")); candidatePSet.setAttrib(Candidate.FIELD_Email, HELPER_Email.getFromRS(dummyEmail, r, "email"));
...@@ -472,10 +462,10 @@ public class CandidatePersistenceMgr extends ObjectPersistenceMgr ...@@ -472,10 +462,10 @@ public class CandidatePersistenceMgr extends ObjectPersistenceMgr
{ {
executeStatement (sqlMgr, executeStatement (sqlMgr,
"INSERT INTO {PREFIX}candidate " + "INSERT INTO {PREFIX}candidate " +
" (first_name, middle_name, last_name, preferred_name, salutation, position, date_of_birth, date_registered, gender, password, date_taken, section_number, left_quest_number, location, contact_phone, email, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " + " (first_name, middle_name, last_name, preferred_name, salutation, position, date_of_birth, date_registered, gender, password, date_taken, location, contact_phone, email, 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_FirstName.getForSQL(dummyFirstName, candidatePSet.getAttrib (Candidate.FIELD_FirstName))).listEntry (HELPER_MiddleName.getForSQL(dummyMiddleName, candidatePSet.getAttrib (Candidate.FIELD_MiddleName))).listEntry (HELPER_LastName.getForSQL(dummyLastName, candidatePSet.getAttrib (Candidate.FIELD_LastName))).listEntry (HELPER_PreferredName.getForSQL(dummyPreferredName, candidatePSet.getAttrib (Candidate.FIELD_PreferredName))).listEntry (HELPER_Salutation.getForSQL(dummySalutation, candidatePSet.getAttrib (Candidate.FIELD_Salutation))).listEntry (HELPER_Position.getForSQL(dummyPosition, candidatePSet.getAttrib (Candidate.FIELD_Position))).listEntry (HELPER_DateOfBirth.getForSQL(dummyDateOfBirth, candidatePSet.getAttrib (Candidate.FIELD_DateOfBirth))).listEntry (HELPER_DateRegistered.getForSQL(dummyDateRegistered, candidatePSet.getAttrib (Candidate.FIELD_DateRegistered))).listEntry (HELPER_Gender.getForSQL(dummyGender, candidatePSet.getAttrib (Candidate.FIELD_Gender))).listEntry (HELPER_Password.getForSQL(dummyPassword, candidatePSet.getAttrib (Candidate.FIELD_Password))).listEntry (HELPER_DateTaken.getForSQL(dummyDateTaken, candidatePSet.getAttrib (Candidate.FIELD_DateTaken))).listEntry (HELPER_SectionNo.getForSQL(dummySectionNo, candidatePSet.getAttrib (Candidate.FIELD_SectionNo))).listEntry (HELPER_LeftQuestionNo.getForSQL(dummyLeftQuestionNo, candidatePSet.getAttrib (Candidate.FIELD_LeftQuestionNo))).listEntry (HELPER_Location.getForSQL(dummyLocation, candidatePSet.getAttrib (Candidate.FIELD_Location))).listEntry (HELPER_Phone.getForSQL(dummyPhone, candidatePSet.getAttrib (Candidate.FIELD_Phone))).listEntry (HELPER_Email.getForSQL(dummyEmail, candidatePSet.getAttrib (Candidate.FIELD_Email))) .listEntry (objectID.longID ()).toList().toArray()); CollectionUtils.listEntry (HELPER_FirstName.getForSQL(dummyFirstName, candidatePSet.getAttrib (Candidate.FIELD_FirstName))).listEntry (HELPER_MiddleName.getForSQL(dummyMiddleName, candidatePSet.getAttrib (Candidate.FIELD_MiddleName))).listEntry (HELPER_LastName.getForSQL(dummyLastName, candidatePSet.getAttrib (Candidate.FIELD_LastName))).listEntry (HELPER_PreferredName.getForSQL(dummyPreferredName, candidatePSet.getAttrib (Candidate.FIELD_PreferredName))).listEntry (HELPER_Salutation.getForSQL(dummySalutation, candidatePSet.getAttrib (Candidate.FIELD_Salutation))).listEntry (HELPER_Position.getForSQL(dummyPosition, candidatePSet.getAttrib (Candidate.FIELD_Position))).listEntry (HELPER_DateOfBirth.getForSQL(dummyDateOfBirth, candidatePSet.getAttrib (Candidate.FIELD_DateOfBirth))).listEntry (HELPER_DateRegistered.getForSQL(dummyDateRegistered, candidatePSet.getAttrib (Candidate.FIELD_DateRegistered))).listEntry (HELPER_Gender.getForSQL(dummyGender, candidatePSet.getAttrib (Candidate.FIELD_Gender))).listEntry (HELPER_Password.getForSQL(dummyPassword, candidatePSet.getAttrib (Candidate.FIELD_Password))).listEntry (HELPER_DateTaken.getForSQL(dummyDateTaken, candidatePSet.getAttrib (Candidate.FIELD_DateTaken))).listEntry (HELPER_Location.getForSQL(dummyLocation, candidatePSet.getAttrib (Candidate.FIELD_Location))).listEntry (HELPER_Phone.getForSQL(dummyPhone, candidatePSet.getAttrib (Candidate.FIELD_Phone))).listEntry (HELPER_Email.getForSQL(dummyEmail, candidatePSet.getAttrib (Candidate.FIELD_Email))) .listEntry (objectID.longID ()).toList().toArray());
candidatePSet.setStatus (PersistentSetStatus.PROCESSED); candidatePSet.setStatus (PersistentSetStatus.PROCESSED);
} }
......
package performa.orm; package performa.orm;
import java.io.*;
import java.util.*;
import oneit.appservices.config.*;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.utils.*;
public class Factor extends BaseFactor public class Factor extends BaseFactor
{ {
...@@ -22,6 +10,4 @@ public class Factor extends BaseFactor ...@@ -22,6 +10,4 @@ public class Factor extends BaseFactor
{ {
// Do not add any code to this, always put it in initialiseNewObject // Do not add any code to this, always put it in initialiseNewObject
} }
} }
\ No newline at end of file
...@@ -6,11 +6,9 @@ ...@@ -6,11 +6,9 @@
<TABLE name="factor_hdr" tablePrefix="object" polymorphic="FALSE"> <TABLE name="factor_hdr" tablePrefix="object" polymorphic="FALSE">
<ATTRIB name="FactorNo" type="Integer" dbcol="factor_number"/>
<ATTRIB name="Description" type="String" dbcol="factor_hdr_desc" length="30"/> <ATTRIB name="Description" type="String" dbcol="factor_hdr_desc" length="30"/>
<ATTRIB name="ClassCode" type="String" dbcol="class_code" length="15"/> <ATTRIB name="ClassCode" type="String" dbcol="class_code" length="15"/>
<ATTRIB name="Notes" type="String" dbcol="factor_hdr_notes"/> <ATTRIB name="Notes" type="String" dbcol="factor_hdr_notes"/>
<ATTRIB name="LevelNo" type="Integer" dbcol="level_number"/>
<ATTRIB name="LeftAnnot" type="String" dbcol="left_annot" length="60"/> <ATTRIB name="LeftAnnot" type="String" dbcol="left_annot" length="60"/>
<ATTRIB name="RightAnnot" type="String" dbcol="right_annot" length="60"/> <ATTRIB name="RightAnnot" type="String" dbcol="right_annot" length="60"/>
<ATTRIB name="DescriptionSchinese" type="String" dbcol="factor_hdr_desc_schinese" length="120"/> <ATTRIB name="DescriptionSchinese" type="String" dbcol="factor_hdr_desc_schinese" length="120"/>
...@@ -20,6 +18,8 @@ ...@@ -20,6 +18,8 @@
<ATTRIB name="ZScoreWeight" type="Double" dbcol="z_score_wght"/> <ATTRIB name="ZScoreWeight" type="Double" dbcol="z_score_wght"/>
<ATTRIB name="ZScoreWeight2" type="Double" dbcol="z_score_wght_2"/> <ATTRIB name="ZScoreWeight2" type="Double" dbcol="z_score_wght_2"/>
<SINGLEREFERENCE name="Level" type="Level" dbcol="level_number" backreferenceName="Factors" />
</TABLE> </TABLE>
</BUSINESSCLASS> </BUSINESSCLASS>
......
...@@ -26,11 +26,9 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr ...@@ -26,11 +26,9 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr
private static final LoggingArea FactorPersistence = LoggingArea.createLoggingArea(ObjectPersistenceMgr.OBJECT_PERSISTENCE, "Factor"); private static final LoggingArea FactorPersistence = LoggingArea.createLoggingArea(ObjectPersistenceMgr.OBJECT_PERSISTENCE, "Factor");
// Private attributes corresponding to business object data // Private attributes corresponding to business object data
private Integer dummyFactorNo;
private String dummyDescription; private String dummyDescription;
private String dummyClassCode; private String dummyClassCode;
private String dummyNotes; private String dummyNotes;
private Integer dummyLevelNo;
private String dummyLeftAnnot; private String dummyLeftAnnot;
private String dummyRightAnnot; private String dummyRightAnnot;
private String dummyDescriptionSchinese; private String dummyDescriptionSchinese;
...@@ -42,11 +40,9 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr ...@@ -42,11 +40,9 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr
// Static constants corresponding to attribute helpers // Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper HELPER_FactorNo = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_Description = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper HELPER_Description = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_ClassCode = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper HELPER_ClassCode = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_Notes = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper HELPER_Notes = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_LevelNo = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_LeftAnnot = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper HELPER_LeftAnnot = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_RightAnnot = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper HELPER_RightAnnot = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_DescriptionSchinese = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper HELPER_DescriptionSchinese = DefaultAttributeHelper.INSTANCE;
...@@ -61,11 +57,9 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr ...@@ -61,11 +57,9 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr
public FactorPersistenceMgr () public FactorPersistenceMgr ()
{ {
dummyFactorNo = (Integer)(HELPER_FactorNo.initialise (dummyFactorNo));
dummyDescription = (String)(HELPER_Description.initialise (dummyDescription)); dummyDescription = (String)(HELPER_Description.initialise (dummyDescription));
dummyClassCode = (String)(HELPER_ClassCode.initialise (dummyClassCode)); dummyClassCode = (String)(HELPER_ClassCode.initialise (dummyClassCode));
dummyNotes = (String)(HELPER_Notes.initialise (dummyNotes)); dummyNotes = (String)(HELPER_Notes.initialise (dummyNotes));
dummyLevelNo = (Integer)(HELPER_LevelNo.initialise (dummyLevelNo));
dummyLeftAnnot = (String)(HELPER_LeftAnnot.initialise (dummyLeftAnnot)); dummyLeftAnnot = (String)(HELPER_LeftAnnot.initialise (dummyLeftAnnot));
dummyRightAnnot = (String)(HELPER_RightAnnot.initialise (dummyRightAnnot)); dummyRightAnnot = (String)(HELPER_RightAnnot.initialise (dummyRightAnnot));
dummyDescriptionSchinese = (String)(HELPER_DescriptionSchinese.initialise (dummyDescriptionSchinese)); dummyDescriptionSchinese = (String)(HELPER_DescriptionSchinese.initialise (dummyDescriptionSchinese));
...@@ -77,7 +71,7 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr ...@@ -77,7 +71,7 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr
} }
private String SELECT_COLUMNS = "{PREFIX}factor_hdr.object_id as id, {PREFIX}factor_hdr.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}factor_hdr.object_CREATED_DATE as CREATED_DATE, {PREFIX}factor_hdr.factor_number, {PREFIX}factor_hdr.factor_hdr_desc, {PREFIX}factor_hdr.class_code, {PREFIX}factor_hdr.factor_hdr_notes, {PREFIX}factor_hdr.level_number, {PREFIX}factor_hdr.left_annot, {PREFIX}factor_hdr.right_annot, {PREFIX}factor_hdr.factor_hdr_desc_schinese, {PREFIX}factor_hdr.factor_hdr_desc_chinese, {PREFIX}factor_hdr.factor_hdr_desc_korean, {PREFIX}factor_hdr.factor_hdr_desc_thai, {PREFIX}factor_hdr.z_score_wght, {PREFIX}factor_hdr.z_score_wght_2, 1 AS commasafe "; private String SELECT_COLUMNS = "{PREFIX}factor_hdr.object_id as id, {PREFIX}factor_hdr.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}factor_hdr.object_CREATED_DATE as CREATED_DATE, {PREFIX}factor_hdr.factor_hdr_desc, {PREFIX}factor_hdr.class_code, {PREFIX}factor_hdr.factor_hdr_notes, {PREFIX}factor_hdr.left_annot, {PREFIX}factor_hdr.right_annot, {PREFIX}factor_hdr.factor_hdr_desc_schinese, {PREFIX}factor_hdr.factor_hdr_desc_chinese, {PREFIX}factor_hdr.factor_hdr_desc_korean, {PREFIX}factor_hdr.factor_hdr_desc_thai, {PREFIX}factor_hdr.z_score_wght, {PREFIX}factor_hdr.z_score_wght_2, {PREFIX}factor_hdr.level_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
...@@ -128,11 +122,9 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr ...@@ -128,11 +122,9 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr
// Check for persistent sets already prefetched // Check for persistent sets already prefetched
if (false || !factor_hdrPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) || if (false || !factor_hdrPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!factor_hdrPSet.containsAttrib(Factor.FIELD_FactorNo)||
!factor_hdrPSet.containsAttrib(Factor.FIELD_Description)|| !factor_hdrPSet.containsAttrib(Factor.FIELD_Description)||
!factor_hdrPSet.containsAttrib(Factor.FIELD_ClassCode)|| !factor_hdrPSet.containsAttrib(Factor.FIELD_ClassCode)||
!factor_hdrPSet.containsAttrib(Factor.FIELD_Notes)|| !factor_hdrPSet.containsAttrib(Factor.FIELD_Notes)||
!factor_hdrPSet.containsAttrib(Factor.FIELD_LevelNo)||
!factor_hdrPSet.containsAttrib(Factor.FIELD_LeftAnnot)|| !factor_hdrPSet.containsAttrib(Factor.FIELD_LeftAnnot)||
!factor_hdrPSet.containsAttrib(Factor.FIELD_RightAnnot)|| !factor_hdrPSet.containsAttrib(Factor.FIELD_RightAnnot)||
!factor_hdrPSet.containsAttrib(Factor.FIELD_DescriptionSchinese)|| !factor_hdrPSet.containsAttrib(Factor.FIELD_DescriptionSchinese)||
...@@ -140,7 +132,8 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr ...@@ -140,7 +132,8 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr
!factor_hdrPSet.containsAttrib(Factor.FIELD_DescriptionKorean)|| !factor_hdrPSet.containsAttrib(Factor.FIELD_DescriptionKorean)||
!factor_hdrPSet.containsAttrib(Factor.FIELD_DescriptionThai)|| !factor_hdrPSet.containsAttrib(Factor.FIELD_DescriptionThai)||
!factor_hdrPSet.containsAttrib(Factor.FIELD_ZScoreWeight)|| !factor_hdrPSet.containsAttrib(Factor.FIELD_ZScoreWeight)||
!factor_hdrPSet.containsAttrib(Factor.FIELD_ZScoreWeight2)) !factor_hdrPSet.containsAttrib(Factor.FIELD_ZScoreWeight2)||
!factor_hdrPSet.containsAttrib(Factor.SINGLEREFERENCE_Level))
{ {
// We will need to retrieve it // We will need to retrieve it
idsToFetch.add (id.longValue()); idsToFetch.add (id.longValue());
...@@ -186,6 +179,16 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr ...@@ -186,6 +179,16 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr
{ {
throw new RuntimeException (); throw new RuntimeException ();
} }
else if (refName.equals (Factor.SINGLEREFERENCE_Level))
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}factor_hdr " +
"WHERE " + SELECT_JOINS + "level_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);
...@@ -210,10 +213,10 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr ...@@ -210,10 +213,10 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr
{ {
int rowsUpdated = executeStatement (sqlMgr, int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}factor_hdr " + "UPDATE {PREFIX}factor_hdr " +
"SET factor_number = ?, factor_hdr_desc = ?, class_code = ?, factor_hdr_notes = ?, level_number = ?, left_annot = ?, right_annot = ?, factor_hdr_desc_schinese = ?, factor_hdr_desc_chinese = ?, factor_hdr_desc_korean = ?, factor_hdr_desc_thai = ?, z_score_wght = ?, z_score_wght_2 = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " + "SET factor_hdr_desc = ?, class_code = ?, factor_hdr_notes = ?, left_annot = ?, right_annot = ?, factor_hdr_desc_schinese = ?, factor_hdr_desc_chinese = ?, factor_hdr_desc_korean = ?, factor_hdr_desc_thai = ?, z_score_wght = ?, z_score_wght_2 = ?, level_number = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE factor_hdr.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ", "WHERE factor_hdr.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_FactorNo.getForSQL(dummyFactorNo, factor_hdrPSet.getAttrib (Factor.FIELD_FactorNo))).listEntry (HELPER_Description.getForSQL(dummyDescription, factor_hdrPSet.getAttrib (Factor.FIELD_Description))).listEntry (HELPER_ClassCode.getForSQL(dummyClassCode, factor_hdrPSet.getAttrib (Factor.FIELD_ClassCode))).listEntry (HELPER_Notes.getForSQL(dummyNotes, factor_hdrPSet.getAttrib (Factor.FIELD_Notes))).listEntry (HELPER_LevelNo.getForSQL(dummyLevelNo, factor_hdrPSet.getAttrib (Factor.FIELD_LevelNo))).listEntry (HELPER_LeftAnnot.getForSQL(dummyLeftAnnot, factor_hdrPSet.getAttrib (Factor.FIELD_LeftAnnot))).listEntry (HELPER_RightAnnot.getForSQL(dummyRightAnnot, factor_hdrPSet.getAttrib (Factor.FIELD_RightAnnot))).listEntry (HELPER_DescriptionSchinese.getForSQL(dummyDescriptionSchinese, factor_hdrPSet.getAttrib (Factor.FIELD_DescriptionSchinese))).listEntry (HELPER_DescriptionChinese.getForSQL(dummyDescriptionChinese, factor_hdrPSet.getAttrib (Factor.FIELD_DescriptionChinese))).listEntry (HELPER_DescriptionKorean.getForSQL(dummyDescriptionKorean, factor_hdrPSet.getAttrib (Factor.FIELD_DescriptionKorean))).listEntry (HELPER_DescriptionThai.getForSQL(dummyDescriptionThai, factor_hdrPSet.getAttrib (Factor.FIELD_DescriptionThai))).listEntry (HELPER_ZScoreWeight.getForSQL(dummyZScoreWeight, factor_hdrPSet.getAttrib (Factor.FIELD_ZScoreWeight))).listEntry (HELPER_ZScoreWeight2.getForSQL(dummyZScoreWeight2, factor_hdrPSet.getAttrib (Factor.FIELD_ZScoreWeight2))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray()); CollectionUtils.listEntry (HELPER_Description.getForSQL(dummyDescription, factor_hdrPSet.getAttrib (Factor.FIELD_Description))).listEntry (HELPER_ClassCode.getForSQL(dummyClassCode, factor_hdrPSet.getAttrib (Factor.FIELD_ClassCode))).listEntry (HELPER_Notes.getForSQL(dummyNotes, factor_hdrPSet.getAttrib (Factor.FIELD_Notes))).listEntry (HELPER_LeftAnnot.getForSQL(dummyLeftAnnot, factor_hdrPSet.getAttrib (Factor.FIELD_LeftAnnot))).listEntry (HELPER_RightAnnot.getForSQL(dummyRightAnnot, factor_hdrPSet.getAttrib (Factor.FIELD_RightAnnot))).listEntry (HELPER_DescriptionSchinese.getForSQL(dummyDescriptionSchinese, factor_hdrPSet.getAttrib (Factor.FIELD_DescriptionSchinese))).listEntry (HELPER_DescriptionChinese.getForSQL(dummyDescriptionChinese, factor_hdrPSet.getAttrib (Factor.FIELD_DescriptionChinese))).listEntry (HELPER_DescriptionKorean.getForSQL(dummyDescriptionKorean, factor_hdrPSet.getAttrib (Factor.FIELD_DescriptionKorean))).listEntry (HELPER_DescriptionThai.getForSQL(dummyDescriptionThai, factor_hdrPSet.getAttrib (Factor.FIELD_DescriptionThai))).listEntry (HELPER_ZScoreWeight.getForSQL(dummyZScoreWeight, factor_hdrPSet.getAttrib (Factor.FIELD_ZScoreWeight))).listEntry (HELPER_ZScoreWeight2.getForSQL(dummyZScoreWeight2, factor_hdrPSet.getAttrib (Factor.FIELD_ZScoreWeight2))).listEntry (SQLManager.CheckNull((Long)(factor_hdrPSet.getAttrib (Factor.SINGLEREFERENCE_Level)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
if (rowsUpdated != 1) if (rowsUpdated != 1)
{ {
...@@ -427,11 +430,9 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr ...@@ -427,11 +430,9 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr
// Object Created // Object Created
factor_hdrPSet.setAttrib(BaseBusinessClass.FIELD_ObjectCreated, r.getTimestamp ("CREATED_DATE")); factor_hdrPSet.setAttrib(BaseBusinessClass.FIELD_ObjectCreated, r.getTimestamp ("CREATED_DATE"));
factor_hdrPSet.setAttrib(Factor.FIELD_FactorNo, HELPER_FactorNo.getFromRS(dummyFactorNo, r, "factor_number"));
factor_hdrPSet.setAttrib(Factor.FIELD_Description, HELPER_Description.getFromRS(dummyDescription, r, "factor_hdr_desc")); factor_hdrPSet.setAttrib(Factor.FIELD_Description, HELPER_Description.getFromRS(dummyDescription, r, "factor_hdr_desc"));
factor_hdrPSet.setAttrib(Factor.FIELD_ClassCode, HELPER_ClassCode.getFromRS(dummyClassCode, r, "class_code")); factor_hdrPSet.setAttrib(Factor.FIELD_ClassCode, HELPER_ClassCode.getFromRS(dummyClassCode, r, "class_code"));
factor_hdrPSet.setAttrib(Factor.FIELD_Notes, HELPER_Notes.getFromRS(dummyNotes, r, "factor_hdr_notes")); factor_hdrPSet.setAttrib(Factor.FIELD_Notes, HELPER_Notes.getFromRS(dummyNotes, r, "factor_hdr_notes"));
factor_hdrPSet.setAttrib(Factor.FIELD_LevelNo, HELPER_LevelNo.getFromRS(dummyLevelNo, r, "level_number"));
factor_hdrPSet.setAttrib(Factor.FIELD_LeftAnnot, HELPER_LeftAnnot.getFromRS(dummyLeftAnnot, r, "left_annot")); factor_hdrPSet.setAttrib(Factor.FIELD_LeftAnnot, HELPER_LeftAnnot.getFromRS(dummyLeftAnnot, r, "left_annot"));
factor_hdrPSet.setAttrib(Factor.FIELD_RightAnnot, HELPER_RightAnnot.getFromRS(dummyRightAnnot, r, "right_annot")); factor_hdrPSet.setAttrib(Factor.FIELD_RightAnnot, HELPER_RightAnnot.getFromRS(dummyRightAnnot, r, "right_annot"));
factor_hdrPSet.setAttrib(Factor.FIELD_DescriptionSchinese, HELPER_DescriptionSchinese.getFromRS(dummyDescriptionSchinese, r, "factor_hdr_desc_schinese")); factor_hdrPSet.setAttrib(Factor.FIELD_DescriptionSchinese, HELPER_DescriptionSchinese.getFromRS(dummyDescriptionSchinese, r, "factor_hdr_desc_schinese"));
...@@ -441,6 +442,7 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr ...@@ -441,6 +442,7 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr
factor_hdrPSet.setAttrib(Factor.FIELD_ZScoreWeight, HELPER_ZScoreWeight.getFromRS(dummyZScoreWeight, r, "z_score_wght")); factor_hdrPSet.setAttrib(Factor.FIELD_ZScoreWeight, HELPER_ZScoreWeight.getFromRS(dummyZScoreWeight, r, "z_score_wght"));
factor_hdrPSet.setAttrib(Factor.FIELD_ZScoreWeight2, HELPER_ZScoreWeight2.getFromRS(dummyZScoreWeight2, r, "z_score_wght_2")); factor_hdrPSet.setAttrib(Factor.FIELD_ZScoreWeight2, HELPER_ZScoreWeight2.getFromRS(dummyZScoreWeight2, r, "z_score_wght_2"));
factor_hdrPSet.setAttrib(Factor.SINGLEREFERENCE_Level, r.getObject ("level_number"));
} }
...@@ -457,10 +459,10 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr ...@@ -457,10 +459,10 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr
{ {
executeStatement (sqlMgr, executeStatement (sqlMgr,
"INSERT INTO {PREFIX}factor_hdr " + "INSERT INTO {PREFIX}factor_hdr " +
" (factor_number, factor_hdr_desc, class_code, factor_hdr_notes, level_number, left_annot, right_annot, factor_hdr_desc_schinese, factor_hdr_desc_chinese, factor_hdr_desc_korean, factor_hdr_desc_thai, z_score_wght, z_score_wght_2, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " + " (factor_hdr_desc, class_code, factor_hdr_notes, left_annot, right_annot, factor_hdr_desc_schinese, factor_hdr_desc_chinese, factor_hdr_desc_korean, factor_hdr_desc_thai, z_score_wght, z_score_wght_2, level_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_FactorNo.getForSQL(dummyFactorNo, factor_hdrPSet.getAttrib (Factor.FIELD_FactorNo))).listEntry (HELPER_Description.getForSQL(dummyDescription, factor_hdrPSet.getAttrib (Factor.FIELD_Description))).listEntry (HELPER_ClassCode.getForSQL(dummyClassCode, factor_hdrPSet.getAttrib (Factor.FIELD_ClassCode))).listEntry (HELPER_Notes.getForSQL(dummyNotes, factor_hdrPSet.getAttrib (Factor.FIELD_Notes))).listEntry (HELPER_LevelNo.getForSQL(dummyLevelNo, factor_hdrPSet.getAttrib (Factor.FIELD_LevelNo))).listEntry (HELPER_LeftAnnot.getForSQL(dummyLeftAnnot, factor_hdrPSet.getAttrib (Factor.FIELD_LeftAnnot))).listEntry (HELPER_RightAnnot.getForSQL(dummyRightAnnot, factor_hdrPSet.getAttrib (Factor.FIELD_RightAnnot))).listEntry (HELPER_DescriptionSchinese.getForSQL(dummyDescriptionSchinese, factor_hdrPSet.getAttrib (Factor.FIELD_DescriptionSchinese))).listEntry (HELPER_DescriptionChinese.getForSQL(dummyDescriptionChinese, factor_hdrPSet.getAttrib (Factor.FIELD_DescriptionChinese))).listEntry (HELPER_DescriptionKorean.getForSQL(dummyDescriptionKorean, factor_hdrPSet.getAttrib (Factor.FIELD_DescriptionKorean))).listEntry (HELPER_DescriptionThai.getForSQL(dummyDescriptionThai, factor_hdrPSet.getAttrib (Factor.FIELD_DescriptionThai))).listEntry (HELPER_ZScoreWeight.getForSQL(dummyZScoreWeight, factor_hdrPSet.getAttrib (Factor.FIELD_ZScoreWeight))).listEntry (HELPER_ZScoreWeight2.getForSQL(dummyZScoreWeight2, factor_hdrPSet.getAttrib (Factor.FIELD_ZScoreWeight2))) .listEntry (objectID.longID ()).toList().toArray()); CollectionUtils.listEntry (HELPER_Description.getForSQL(dummyDescription, factor_hdrPSet.getAttrib (Factor.FIELD_Description))).listEntry (HELPER_ClassCode.getForSQL(dummyClassCode, factor_hdrPSet.getAttrib (Factor.FIELD_ClassCode))).listEntry (HELPER_Notes.getForSQL(dummyNotes, factor_hdrPSet.getAttrib (Factor.FIELD_Notes))).listEntry (HELPER_LeftAnnot.getForSQL(dummyLeftAnnot, factor_hdrPSet.getAttrib (Factor.FIELD_LeftAnnot))).listEntry (HELPER_RightAnnot.getForSQL(dummyRightAnnot, factor_hdrPSet.getAttrib (Factor.FIELD_RightAnnot))).listEntry (HELPER_DescriptionSchinese.getForSQL(dummyDescriptionSchinese, factor_hdrPSet.getAttrib (Factor.FIELD_DescriptionSchinese))).listEntry (HELPER_DescriptionChinese.getForSQL(dummyDescriptionChinese, factor_hdrPSet.getAttrib (Factor.FIELD_DescriptionChinese))).listEntry (HELPER_DescriptionKorean.getForSQL(dummyDescriptionKorean, factor_hdrPSet.getAttrib (Factor.FIELD_DescriptionKorean))).listEntry (HELPER_DescriptionThai.getForSQL(dummyDescriptionThai, factor_hdrPSet.getAttrib (Factor.FIELD_DescriptionThai))).listEntry (HELPER_ZScoreWeight.getForSQL(dummyZScoreWeight, factor_hdrPSet.getAttrib (Factor.FIELD_ZScoreWeight))).listEntry (HELPER_ZScoreWeight2.getForSQL(dummyZScoreWeight2, factor_hdrPSet.getAttrib (Factor.FIELD_ZScoreWeight2))) .listEntry (SQLManager.CheckNull((Long)(factor_hdrPSet.getAttrib (Factor.SINGLEREFERENCE_Level)))) .listEntry (objectID.longID ()).toList().toArray());
factor_hdrPSet.setStatus (PersistentSetStatus.PROCESSED); factor_hdrPSet.setStatus (PersistentSetStatus.PROCESSED);
} }
......
package performa.orm;
public class FactorQuestionLink extends BaseFactorQuestionLink
{
private static final long serialVersionUID = 0L;
// This constructor should not be called
public FactorQuestionLink ()
{
// 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="FactorQuestionLink" package="performa.orm">
<TABLE name="factor_lin" tablePrefix="object" polymorphic="FALSE">
<ATTRIB name="ReverseScore" type="String" dbcol="reverse_score_flag" length="15"/>
<SINGLEREFERENCE name="Factor" type="Factor" dbcol="factor_number" />
</TABLE>
</BUSINESSCLASS>
</ROOT>
package performa.orm;
import java.io.*;
import java.util.*;
import java.sql.ResultSet;
import java.sql.SQLException;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.objstore.assocs.*;
import oneit.objstore.rdbms.*;
import oneit.objstore.utils.*;
import oneit.sql.*;
import oneit.utils.resource.*;
import oneit.utils.*;
import oneit.utils.threading.*;
/**
* IMPORTANT!!!! Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2[oneit.objstore.PersistenceMgrTemplate.xsl]
*/
public class FactorQuestionLinkPersistenceMgr extends ObjectPersistenceMgr
{
private static final LoggingArea FactorQuestionLinkPersistence = LoggingArea.createLoggingArea(ObjectPersistenceMgr.OBJECT_PERSISTENCE, "FactorQuestionLink");
// Private attributes corresponding to business object data
private String dummyReverseScore;
// Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper HELPER_ReverseScore = DefaultAttributeHelper.INSTANCE;
public FactorQuestionLinkPersistenceMgr ()
{
dummyReverseScore = (String)(HELPER_ReverseScore.initialise (dummyReverseScore));
}
private String SELECT_COLUMNS = "{PREFIX}factor_lin.object_id as id, {PREFIX}factor_lin.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}factor_lin.object_CREATED_DATE as CREATED_DATE, {PREFIX}factor_lin.reverse_score_flag, {PREFIX}factor_lin.factor_number, 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, FactorQuestionLink.REFERENCE_FactorQuestionLink);
if (objectToReturn instanceof FactorQuestionLink)
{
LogMgr.log (FactorQuestionLinkPersistence, 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 FactorQuestionLink");
}
}
PersistentSet factor_linPSet = allPSets.getPersistentSet(id, "factor_lin", PersistentSetStatus.FETCHED);
// Check for persistent sets already prefetched
if (false || !factor_linPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!factor_linPSet.containsAttrib(FactorQuestionLink.FIELD_ReverseScore)||
!factor_linPSet.containsAttrib(FactorQuestionLink.SINGLEREFERENCE_Factor))
{
// We will need to retrieve it
idsToFetch.add (id.longValue());
}
else
{
LogMgr.log (FactorQuestionLinkPersistence, LogLevel.DEBUG2, "Persistent set preloaded id:", id);
/* Non Polymorphic */
FactorQuestionLink result = new FactorQuestionLink ();
result.setFromPersistentSets(id, allPSets);
context.addRetrievedObject(result);
results.add (result);
}
}
if (idsToFetch.size () > 0)
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}factor_lin " +
"WHERE " + SELECT_JOINS + "{PREFIX}factor_lin.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 factor_linPSet = allPSets.getPersistentSet(objectID, "factor_lin");
if (factor_linPSet.getStatus () != PersistentSetStatus.PROCESSED &&
factor_linPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}factor_lin " +
"SET reverse_score_flag = ?, factor_number = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE factor_lin.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_ReverseScore.getForSQL(dummyReverseScore, factor_linPSet.getAttrib (FactorQuestionLink.FIELD_ReverseScore))).listEntry (SQLManager.CheckNull((Long)(factor_linPSet.getAttrib (FactorQuestionLink.SINGLEREFERENCE_Factor)))).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}factor_lin 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[] { "factor_lin", objectID.longID (), obj.getObjectLastModified (), d },
sqlMgr.getPortabilityServices ());
LogMgr.log (FactorQuestionLinkPersistence, LogLevel.BUSINESS1, errorMsg);
throw new ConcurrentUpdateConflictException (obj, "factor_lin");
}
else
{
String errorMsg = "Attempt to update nonexistent row in table:factor_lin for row:" + objectID + " objDate:" + obj.getObjectLastModified ();
LogMgr.log (FactorQuestionLinkPersistence, LogLevel.BUSINESS1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
factor_linPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
else
{
LogMgr.log (FactorQuestionLinkPersistence, 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 factor_linPSet = allPSets.getPersistentSet(objectID, "factor_lin");
LogMgr.log (FactorQuestionLinkPersistence, LogLevel.DEBUG2, "Deleting:", objectID);
if (factor_linPSet.getStatus () != PersistentSetStatus.PROCESSED &&
factor_linPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsDeleted = executeStatement (sqlMgr,
"DELETE " +
"FROM {PREFIX}factor_lin " +
"WHERE factor_lin.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}factor_lin WHERE object_id = ?",
new Object[] { objectID.longID() });
if (r.next ())
{
throw new ConcurrentUpdateConflictException (obj, "factor_lin");
}
else
{
String errorMsg = "Attempt to delete nonexistent row in table:factor_lin for row:" + objectID;
LogMgr.log (FactorQuestionLinkPersistence, LogLevel.SYSTEMERROR1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
factor_linPSet.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, FactorQuestionLink> results = new LinkedHashMap ();
ResultSet r = executeQuery (sqlMgr, query, params);
while (r.next())
{
ThreadUtils.checkInterrupted ();
ObjectID objectID = new ObjectID (FactorQuestionLink.REFERENCE_FactorQuestionLink.getObjectIDSpace (), r.getLong ("id"));
FactorQuestionLink 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, FactorQuestionLink.REFERENCE_FactorQuestionLink);
if (cachedElement instanceof FactorQuestionLink)
{
LogMgr.log (FactorQuestionLinkPersistence, LogLevel.TRACE, "Cache hit for id:", objectID);
resultElement = (FactorQuestionLink)cachedElement;
}
else
{
throw new StorageException ("Cache collision for id:" + objectID + " with object " + cachedElement + "while fetching a FactorQuestionLink");
}
}
else
{
PersistentSet factor_linPSet = allPSets.getPersistentSet(objectID, "factor_lin", PersistentSetStatus.FETCHED);
createPersistentSetFromRS(allPSets, r, objectID);
resultElement = new FactorQuestionLink ();
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 (FactorQuestionLinkPersistence, 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}factor_lin " + 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 factor_linPSet = allPSets.getPersistentSet(objectID, "factor_lin", PersistentSetStatus.FETCHED);
// Object Modified
factor_linPSet.setAttrib(BaseBusinessClass.FIELD_ObjectLastModified, r.getTimestamp ("LAST_UPDATED_DATE"));
// Object Created
factor_linPSet.setAttrib(BaseBusinessClass.FIELD_ObjectCreated, r.getTimestamp ("CREATED_DATE"));
factor_linPSet.setAttrib(FactorQuestionLink.FIELD_ReverseScore, HELPER_ReverseScore.getFromRS(dummyReverseScore, r, "reverse_score_flag"));
factor_linPSet.setAttrib(FactorQuestionLink.SINGLEREFERENCE_Factor, r.getObject ("factor_number"));
}
public void create(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet factor_linPSet = allPSets.getPersistentSet(objectID, "factor_lin");
if (factor_linPSet.getStatus () != PersistentSetStatus.PROCESSED &&
factor_linPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
executeStatement (sqlMgr,
"INSERT INTO {PREFIX}factor_lin " +
" (reverse_score_flag, factor_number, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " +
" (?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_ReverseScore.getForSQL(dummyReverseScore, factor_linPSet.getAttrib (FactorQuestionLink.FIELD_ReverseScore))) .listEntry (SQLManager.CheckNull((Long)(factor_linPSet.getAttrib (FactorQuestionLink.SINGLEREFERENCE_Factor)))) .listEntry (objectID.longID ()).toList().toArray());
factor_linPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
}
package performa.orm;
public class FactorScoreResult extends BaseFactorScoreResult
{
private static final long serialVersionUID = 0L;
// This constructor should not be called
public FactorScoreResult ()
{
// 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="FactorScoreResult" package="performa.orm">
<TABLE name="level_factor" tablePrefix="object" polymorphic="FALSE">
<ATTRIB name="FromScore" type="Integer" dbcol="from_score"/>
<ATTRIB name="ToScore" type="Integer" dbcol="to_score"/>
<ATTRIB name="NarrativeCode" type="String" dbcol="narrative_code" length="15"/>
<ATTRIB name="ColorCode" type="String" dbcol="color_code" length="15"/>
<SINGLEREFERENCE name="Factor" type="Factor" dbcol="factor_number" />
<SINGLEREFERENCE name="Level" type="Level" dbcol="level_number" />
</TABLE>
</BUSINESSCLASS>
</ROOT>
package performa.orm;
import java.io.*;
import java.util.*;
import java.sql.ResultSet;
import java.sql.SQLException;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.objstore.assocs.*;
import oneit.objstore.rdbms.*;
import oneit.objstore.utils.*;
import oneit.sql.*;
import oneit.utils.resource.*;
import oneit.utils.*;
import oneit.utils.threading.*;
/**
* IMPORTANT!!!! Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2[oneit.objstore.PersistenceMgrTemplate.xsl]
*/
public class FactorScoreResultPersistenceMgr extends ObjectPersistenceMgr
{
private static final LoggingArea FactorScoreResultPersistence = LoggingArea.createLoggingArea(ObjectPersistenceMgr.OBJECT_PERSISTENCE, "FactorScoreResult");
// Private attributes corresponding to business object data
private Integer dummyFromScore;
private Integer dummyToScore;
private String dummyNarrativeCode;
private String dummyColorCode;
// Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper HELPER_FromScore = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_ToScore = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_NarrativeCode = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_ColorCode = DefaultAttributeHelper.INSTANCE;
public FactorScoreResultPersistenceMgr ()
{
dummyFromScore = (Integer)(HELPER_FromScore.initialise (dummyFromScore));
dummyToScore = (Integer)(HELPER_ToScore.initialise (dummyToScore));
dummyNarrativeCode = (String)(HELPER_NarrativeCode.initialise (dummyNarrativeCode));
dummyColorCode = (String)(HELPER_ColorCode.initialise (dummyColorCode));
}
private String SELECT_COLUMNS = "{PREFIX}level_factor.object_id as id, {PREFIX}level_factor.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}level_factor.object_CREATED_DATE as CREATED_DATE, {PREFIX}level_factor.from_score, {PREFIX}level_factor.to_score, {PREFIX}level_factor.narrative_code, {PREFIX}level_factor.color_code, {PREFIX}level_factor.factor_number, {PREFIX}level_factor.level_number, 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, FactorScoreResult.REFERENCE_FactorScoreResult);
if (objectToReturn instanceof FactorScoreResult)
{
LogMgr.log (FactorScoreResultPersistence, 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 FactorScoreResult");
}
}
PersistentSet level_factorPSet = allPSets.getPersistentSet(id, "level_factor", PersistentSetStatus.FETCHED);
// Check for persistent sets already prefetched
if (false || !level_factorPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!level_factorPSet.containsAttrib(FactorScoreResult.FIELD_FromScore)||
!level_factorPSet.containsAttrib(FactorScoreResult.FIELD_ToScore)||
!level_factorPSet.containsAttrib(FactorScoreResult.FIELD_NarrativeCode)||
!level_factorPSet.containsAttrib(FactorScoreResult.FIELD_ColorCode)||
!level_factorPSet.containsAttrib(FactorScoreResult.SINGLEREFERENCE_Factor)||
!level_factorPSet.containsAttrib(FactorScoreResult.SINGLEREFERENCE_Level))
{
// We will need to retrieve it
idsToFetch.add (id.longValue());
}
else
{
LogMgr.log (FactorScoreResultPersistence, LogLevel.DEBUG2, "Persistent set preloaded id:", id);
/* Non Polymorphic */
FactorScoreResult result = new FactorScoreResult ();
result.setFromPersistentSets(id, allPSets);
context.addRetrievedObject(result);
results.add (result);
}
}
if (idsToFetch.size () > 0)
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}level_factor " +
"WHERE " + SELECT_JOINS + "{PREFIX}level_factor.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 level_factorPSet = allPSets.getPersistentSet(objectID, "level_factor");
if (level_factorPSet.getStatus () != PersistentSetStatus.PROCESSED &&
level_factorPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}level_factor " +
"SET from_score = ?, to_score = ?, narrative_code = ?, color_code = ?, factor_number = ? , level_number = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE level_factor.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_FromScore.getForSQL(dummyFromScore, level_factorPSet.getAttrib (FactorScoreResult.FIELD_FromScore))).listEntry (HELPER_ToScore.getForSQL(dummyToScore, level_factorPSet.getAttrib (FactorScoreResult.FIELD_ToScore))).listEntry (HELPER_NarrativeCode.getForSQL(dummyNarrativeCode, level_factorPSet.getAttrib (FactorScoreResult.FIELD_NarrativeCode))).listEntry (HELPER_ColorCode.getForSQL(dummyColorCode, level_factorPSet.getAttrib (FactorScoreResult.FIELD_ColorCode))).listEntry (SQLManager.CheckNull((Long)(level_factorPSet.getAttrib (FactorScoreResult.SINGLEREFERENCE_Factor)))).listEntry (SQLManager.CheckNull((Long)(level_factorPSet.getAttrib (FactorScoreResult.SINGLEREFERENCE_Level)))).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}level_factor 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[] { "level_factor", objectID.longID (), obj.getObjectLastModified (), d },
sqlMgr.getPortabilityServices ());
LogMgr.log (FactorScoreResultPersistence, LogLevel.BUSINESS1, errorMsg);
throw new ConcurrentUpdateConflictException (obj, "level_factor");
}
else
{
String errorMsg = "Attempt to update nonexistent row in table:level_factor for row:" + objectID + " objDate:" + obj.getObjectLastModified ();
LogMgr.log (FactorScoreResultPersistence, LogLevel.BUSINESS1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
level_factorPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
else
{
LogMgr.log (FactorScoreResultPersistence, 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 level_factorPSet = allPSets.getPersistentSet(objectID, "level_factor");
LogMgr.log (FactorScoreResultPersistence, LogLevel.DEBUG2, "Deleting:", objectID);
if (level_factorPSet.getStatus () != PersistentSetStatus.PROCESSED &&
level_factorPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsDeleted = executeStatement (sqlMgr,
"DELETE " +
"FROM {PREFIX}level_factor " +
"WHERE level_factor.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}level_factor WHERE object_id = ?",
new Object[] { objectID.longID() });
if (r.next ())
{
throw new ConcurrentUpdateConflictException (obj, "level_factor");
}
else
{
String errorMsg = "Attempt to delete nonexistent row in table:level_factor for row:" + objectID;
LogMgr.log (FactorScoreResultPersistence, LogLevel.SYSTEMERROR1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
level_factorPSet.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, FactorScoreResult> results = new LinkedHashMap ();
ResultSet r = executeQuery (sqlMgr, query, params);
while (r.next())
{
ThreadUtils.checkInterrupted ();
ObjectID objectID = new ObjectID (FactorScoreResult.REFERENCE_FactorScoreResult.getObjectIDSpace (), r.getLong ("id"));
FactorScoreResult 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, FactorScoreResult.REFERENCE_FactorScoreResult);
if (cachedElement instanceof FactorScoreResult)
{
LogMgr.log (FactorScoreResultPersistence, LogLevel.TRACE, "Cache hit for id:", objectID);
resultElement = (FactorScoreResult)cachedElement;
}
else
{
throw new StorageException ("Cache collision for id:" + objectID + " with object " + cachedElement + "while fetching a FactorScoreResult");
}
}
else
{
PersistentSet level_factorPSet = allPSets.getPersistentSet(objectID, "level_factor", PersistentSetStatus.FETCHED);
createPersistentSetFromRS(allPSets, r, objectID);
resultElement = new FactorScoreResult ();
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 (FactorScoreResultPersistence, 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}level_factor " + 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 level_factorPSet = allPSets.getPersistentSet(objectID, "level_factor", PersistentSetStatus.FETCHED);
// Object Modified
level_factorPSet.setAttrib(BaseBusinessClass.FIELD_ObjectLastModified, r.getTimestamp ("LAST_UPDATED_DATE"));
// Object Created
level_factorPSet.setAttrib(BaseBusinessClass.FIELD_ObjectCreated, r.getTimestamp ("CREATED_DATE"));
level_factorPSet.setAttrib(FactorScoreResult.FIELD_FromScore, HELPER_FromScore.getFromRS(dummyFromScore, r, "from_score"));
level_factorPSet.setAttrib(FactorScoreResult.FIELD_ToScore, HELPER_ToScore.getFromRS(dummyToScore, r, "to_score"));
level_factorPSet.setAttrib(FactorScoreResult.FIELD_NarrativeCode, HELPER_NarrativeCode.getFromRS(dummyNarrativeCode, r, "narrative_code"));
level_factorPSet.setAttrib(FactorScoreResult.FIELD_ColorCode, HELPER_ColorCode.getFromRS(dummyColorCode, r, "color_code"));
level_factorPSet.setAttrib(FactorScoreResult.SINGLEREFERENCE_Factor, r.getObject ("factor_number"));
level_factorPSet.setAttrib(FactorScoreResult.SINGLEREFERENCE_Level, r.getObject ("level_number"));
}
public void create(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet level_factorPSet = allPSets.getPersistentSet(objectID, "level_factor");
if (level_factorPSet.getStatus () != PersistentSetStatus.PROCESSED &&
level_factorPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
executeStatement (sqlMgr,
"INSERT INTO {PREFIX}level_factor " +
" (from_score, to_score, narrative_code, color_code, factor_number, level_number, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " +
" (?, ?, ?, ?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_FromScore.getForSQL(dummyFromScore, level_factorPSet.getAttrib (FactorScoreResult.FIELD_FromScore))).listEntry (HELPER_ToScore.getForSQL(dummyToScore, level_factorPSet.getAttrib (FactorScoreResult.FIELD_ToScore))).listEntry (HELPER_NarrativeCode.getForSQL(dummyNarrativeCode, level_factorPSet.getAttrib (FactorScoreResult.FIELD_NarrativeCode))).listEntry (HELPER_ColorCode.getForSQL(dummyColorCode, level_factorPSet.getAttrib (FactorScoreResult.FIELD_ColorCode))) .listEntry (SQLManager.CheckNull((Long)(level_factorPSet.getAttrib (FactorScoreResult.SINGLEREFERENCE_Factor)))).listEntry (SQLManager.CheckNull((Long)(level_factorPSet.getAttrib (FactorScoreResult.SINGLEREFERENCE_Level)))) .listEntry (objectID.longID ()).toList().toArray());
level_factorPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
}
package performa.orm;
public class Level extends BaseLevel
{
private static final long serialVersionUID = 0L;
// This constructor should not be called
public Level ()
{
// 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="Level" package="performa.orm">
<MULTIPLEREFERENCE name="Factors" type="Factor" backreferenceName="Level" />
<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="LevelNotes" type="String" dbcol="level_notes"/>
</TABLE>
</BUSINESSCLASS>
</ROOT>
package performa.orm;
import java.io.*;
import java.util.*;
import java.sql.ResultSet;
import java.sql.SQLException;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.objstore.assocs.*;
import oneit.objstore.rdbms.*;
import oneit.objstore.utils.*;
import oneit.sql.*;
import oneit.utils.resource.*;
import oneit.utils.*;
import oneit.utils.threading.*;
/**
* IMPORTANT!!!! Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2[oneit.objstore.PersistenceMgrTemplate.xsl]
*/
public class LevelPersistenceMgr extends ObjectPersistenceMgr
{
private static final LoggingArea LevelPersistence = LoggingArea.createLoggingArea(ObjectPersistenceMgr.OBJECT_PERSISTENCE, "Level");
// Private attributes corresponding to business object data
private Integer dummyLevelNo;
private String dummyLevelDescription;
private String dummyLevelNotes;
// 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_LevelNotes = DefaultAttributeHelper.INSTANCE;
public LevelPersistenceMgr ()
{
dummyLevelNo = (Integer)(HELPER_LevelNo.initialise (dummyLevelNo));
dummyLevelDescription = (String)(HELPER_LevelDescription.initialise (dummyLevelDescription));
dummyLevelNotes = (String)(HELPER_LevelNotes.initialise (dummyLevelNotes));
}
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_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, Level.REFERENCE_Level);
if (objectToReturn instanceof Level)
{
LogMgr.log (LevelPersistence, 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 Level");
}
}
PersistentSet levelPSet = allPSets.getPersistentSet(id, "level", PersistentSetStatus.FETCHED);
// Check for persistent sets already prefetched
if (false || !levelPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!levelPSet.containsAttrib(Level.FIELD_LevelNo)||
!levelPSet.containsAttrib(Level.FIELD_LevelDescription)||
!levelPSet.containsAttrib(Level.FIELD_LevelNotes))
{
// We will need to retrieve it
idsToFetch.add (id.longValue());
}
else
{
LogMgr.log (LevelPersistence, LogLevel.DEBUG2, "Persistent set preloaded id:", id);
/* Non Polymorphic */
Level result = new Level ();
result.setFromPersistentSets(id, allPSets);
context.addRetrievedObject(result);
results.add (result);
}
}
if (idsToFetch.size () > 0)
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}level " +
"WHERE " + SELECT_JOINS + "{PREFIX}level.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 levelPSet = allPSets.getPersistentSet(objectID, "level");
if (levelPSet.getStatus () != PersistentSetStatus.PROCESSED &&
levelPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}level " +
"SET level_number = ?, level_desc = ?, level_notes = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"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());
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}level 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[] { "level", objectID.longID (), obj.getObjectLastModified (), d },
sqlMgr.getPortabilityServices ());
LogMgr.log (LevelPersistence, LogLevel.BUSINESS1, errorMsg);
throw new ConcurrentUpdateConflictException (obj, "level");
}
else
{
String errorMsg = "Attempt to update nonexistent row in table:level for row:" + objectID + " objDate:" + obj.getObjectLastModified ();
LogMgr.log (LevelPersistence, LogLevel.BUSINESS1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
levelPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
else
{
LogMgr.log (LevelPersistence, 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 levelPSet = allPSets.getPersistentSet(objectID, "level");
LogMgr.log (LevelPersistence, LogLevel.DEBUG2, "Deleting:", objectID);
if (levelPSet.getStatus () != PersistentSetStatus.PROCESSED &&
levelPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsDeleted = executeStatement (sqlMgr,
"DELETE " +
"FROM {PREFIX}level " +
"WHERE level.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}level WHERE object_id = ?",
new Object[] { objectID.longID() });
if (r.next ())
{
throw new ConcurrentUpdateConflictException (obj, "level");
}
else
{
String errorMsg = "Attempt to delete nonexistent row in table:level for row:" + objectID;
LogMgr.log (LevelPersistence, LogLevel.SYSTEMERROR1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
levelPSet.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, Level> results = new LinkedHashMap ();
ResultSet r = executeQuery (sqlMgr, query, params);
while (r.next())
{
ThreadUtils.checkInterrupted ();
ObjectID objectID = new ObjectID (Level.REFERENCE_Level.getObjectIDSpace (), r.getLong ("id"));
Level 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, Level.REFERENCE_Level);
if (cachedElement instanceof Level)
{
LogMgr.log (LevelPersistence, LogLevel.TRACE, "Cache hit for id:", objectID);
resultElement = (Level)cachedElement;
}
else
{
throw new StorageException ("Cache collision for id:" + objectID + " with object " + cachedElement + "while fetching a Level");
}
}
else
{
PersistentSet levelPSet = allPSets.getPersistentSet(objectID, "level", PersistentSetStatus.FETCHED);
createPersistentSetFromRS(allPSets, r, objectID);
resultElement = new Level ();
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 (LevelPersistence, 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}level " + 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 levelPSet = allPSets.getPersistentSet(objectID, "level", PersistentSetStatus.FETCHED);
// Object Modified
levelPSet.setAttrib(BaseBusinessClass.FIELD_ObjectLastModified, r.getTimestamp ("LAST_UPDATED_DATE"));
// Object Created
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_LevelNotes, HELPER_LevelNotes.getFromRS(dummyLevelNotes, r, "level_notes"));
}
public void create(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet levelPSet = allPSets.getPersistentSet(objectID, "level");
if (levelPSet.getStatus () != PersistentSetStatus.PROCESSED &&
levelPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
executeStatement (sqlMgr,
"INSERT INTO {PREFIX}level " +
" (level_number, level_desc, level_notes, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " +
" (?, ?, ?, ?, " + 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());
levelPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
}
package performa.orm; package performa.orm;
import java.io.*;
import java.util.*;
import oneit.appservices.config.*;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.utils.*;
public class Question extends BaseQuestion public class Question extends BaseQuestion
{ {
...@@ -22,6 +10,4 @@ public class Question extends BaseQuestion ...@@ -22,6 +10,4 @@ public class Question extends BaseQuestion
{ {
// Do not add any code to this, always put it in initialiseNewObject // Do not add any code to this, always put it in initialiseNewObject
} }
} }
\ No newline at end of file
...@@ -6,20 +6,12 @@ ...@@ -6,20 +6,12 @@
<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="LeftQuestionNo" type="Integer" dbcol="left_quest_number"/>
<ATTRIB name="LeftQuestion" 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="RightQuestionNo" type="Integer" dbcol="right_quest_number"/>
<ATTRIB name="RightQuestion" type="String" dbcol="right_quest" length="80"/> <ATTRIB name="RightQuestion" type="String" dbcol="right_quest" length="80"/>
<ATTRIB name="LeftQuestionSchinese" type="String" dbcol="left_quest_schinese"/>
<ATTRIB name="RightQuestionSchinese" type="String" dbcol="right_quest_schinese"/> <!--<SINGLEREFERENCE name="Section" type="Section" dbcol="section_number" />-->
<ATTRIB name="LeftQuestionChinese" type="String" dbcol="left_quest_chinese"/>
<ATTRIB name="RightQuestionChinese" type="String" dbcol="right_quest_chinese"/>
<ATTRIB name="LeftQuestionKorean" type="String" dbcol="left_quest_korean"/>
<ATTRIB name="RightQuestionKorean" type="String" dbcol="right_quest_korean"/>
<ATTRIB name="LeftQuestionThai" type="String" dbcol="left_quest_thai"/>
<ATTRIB name="RightQuestionThai" type="String" dbcol="right_quest_thai"/>
<ATTRIB name="LeftQuestionViet" type="String" dbcol="left_quest_viet"/>
<ATTRIB name="RightQuestionViet" type="String" dbcol="right_quest_viet"/>
</TABLE> </TABLE>
......
...@@ -30,16 +30,6 @@ public class QuestionPersistenceMgr extends ObjectPersistenceMgr ...@@ -30,16 +30,6 @@ public class QuestionPersistenceMgr extends ObjectPersistenceMgr
private String dummyLeftQuestion; private String dummyLeftQuestion;
private Integer dummyRightQuestionNo; private Integer dummyRightQuestionNo;
private String dummyRightQuestion; private String dummyRightQuestion;
private String dummyLeftQuestionSchinese;
private String dummyRightQuestionSchinese;
private String dummyLeftQuestionChinese;
private String dummyRightQuestionChinese;
private String dummyLeftQuestionKorean;
private String dummyRightQuestionKorean;
private String dummyLeftQuestionThai;
private String dummyRightQuestionThai;
private String dummyLeftQuestionViet;
private String dummyRightQuestionViet;
// Static constants corresponding to attribute helpers // Static constants corresponding to attribute helpers
...@@ -47,16 +37,6 @@ public class QuestionPersistenceMgr extends ObjectPersistenceMgr ...@@ -47,16 +37,6 @@ public class QuestionPersistenceMgr extends ObjectPersistenceMgr
private static final DefaultAttributeHelper HELPER_LeftQuestion = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper HELPER_LeftQuestion = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_RightQuestionNo = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper HELPER_RightQuestionNo = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_RightQuestion = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper HELPER_RightQuestion = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_LeftQuestionSchinese = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_RightQuestionSchinese = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_LeftQuestionChinese = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_RightQuestionChinese = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_LeftQuestionKorean = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_RightQuestionKorean = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_LeftQuestionThai = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_RightQuestionThai = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_LeftQuestionViet = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_RightQuestionViet = DefaultAttributeHelper.INSTANCE;
...@@ -67,20 +47,10 @@ public class QuestionPersistenceMgr extends ObjectPersistenceMgr ...@@ -67,20 +47,10 @@ public class QuestionPersistenceMgr extends ObjectPersistenceMgr
dummyLeftQuestion = (String)(HELPER_LeftQuestion.initialise (dummyLeftQuestion)); dummyLeftQuestion = (String)(HELPER_LeftQuestion.initialise (dummyLeftQuestion));
dummyRightQuestionNo = (Integer)(HELPER_RightQuestionNo.initialise (dummyRightQuestionNo)); dummyRightQuestionNo = (Integer)(HELPER_RightQuestionNo.initialise (dummyRightQuestionNo));
dummyRightQuestion = (String)(HELPER_RightQuestion.initialise (dummyRightQuestion)); dummyRightQuestion = (String)(HELPER_RightQuestion.initialise (dummyRightQuestion));
dummyLeftQuestionSchinese = (String)(HELPER_LeftQuestionSchinese.initialise (dummyLeftQuestionSchinese));
dummyRightQuestionSchinese = (String)(HELPER_RightQuestionSchinese.initialise (dummyRightQuestionSchinese));
dummyLeftQuestionChinese = (String)(HELPER_LeftQuestionChinese.initialise (dummyLeftQuestionChinese));
dummyRightQuestionChinese = (String)(HELPER_RightQuestionChinese.initialise (dummyRightQuestionChinese));
dummyLeftQuestionKorean = (String)(HELPER_LeftQuestionKorean.initialise (dummyLeftQuestionKorean));
dummyRightQuestionKorean = (String)(HELPER_RightQuestionKorean.initialise (dummyRightQuestionKorean));
dummyLeftQuestionThai = (String)(HELPER_LeftQuestionThai.initialise (dummyLeftQuestionThai));
dummyRightQuestionThai = (String)(HELPER_RightQuestionThai.initialise (dummyRightQuestionThai));
dummyLeftQuestionViet = (String)(HELPER_LeftQuestionViet.initialise (dummyLeftQuestionViet));
dummyRightQuestionViet = (String)(HELPER_RightQuestionViet.initialise (dummyRightQuestionViet));
} }
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, {PREFIX}quest_lin.left_quest_schinese, {PREFIX}quest_lin.right_quest_schinese, {PREFIX}quest_lin.left_quest_chinese, {PREFIX}quest_lin.right_quest_chinese, {PREFIX}quest_lin.left_quest_korean, {PREFIX}quest_lin.right_quest_korean, {PREFIX}quest_lin.left_quest_thai, {PREFIX}quest_lin.right_quest_thai, {PREFIX}quest_lin.left_quest_viet, {PREFIX}quest_lin.right_quest_viet, 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_number, {PREFIX}quest_lin.left_quest, {PREFIX}quest_lin.right_quest_number, {PREFIX}quest_lin.right_quest, 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
...@@ -134,17 +104,7 @@ public class QuestionPersistenceMgr extends ObjectPersistenceMgr ...@@ -134,17 +104,7 @@ public class QuestionPersistenceMgr extends ObjectPersistenceMgr
!quest_linPSet.containsAttrib(Question.FIELD_LeftQuestionNo)|| !quest_linPSet.containsAttrib(Question.FIELD_LeftQuestionNo)||
!quest_linPSet.containsAttrib(Question.FIELD_LeftQuestion)|| !quest_linPSet.containsAttrib(Question.FIELD_LeftQuestion)||
!quest_linPSet.containsAttrib(Question.FIELD_RightQuestionNo)|| !quest_linPSet.containsAttrib(Question.FIELD_RightQuestionNo)||
!quest_linPSet.containsAttrib(Question.FIELD_RightQuestion)|| !quest_linPSet.containsAttrib(Question.FIELD_RightQuestion))
!quest_linPSet.containsAttrib(Question.FIELD_LeftQuestionSchinese)||
!quest_linPSet.containsAttrib(Question.FIELD_RightQuestionSchinese)||
!quest_linPSet.containsAttrib(Question.FIELD_LeftQuestionChinese)||
!quest_linPSet.containsAttrib(Question.FIELD_RightQuestionChinese)||
!quest_linPSet.containsAttrib(Question.FIELD_LeftQuestionKorean)||
!quest_linPSet.containsAttrib(Question.FIELD_RightQuestionKorean)||
!quest_linPSet.containsAttrib(Question.FIELD_LeftQuestionThai)||
!quest_linPSet.containsAttrib(Question.FIELD_RightQuestionThai)||
!quest_linPSet.containsAttrib(Question.FIELD_LeftQuestionViet)||
!quest_linPSet.containsAttrib(Question.FIELD_RightQuestionViet))
{ {
// We will need to retrieve it // We will need to retrieve it
idsToFetch.add (id.longValue()); idsToFetch.add (id.longValue());
...@@ -214,10 +174,10 @@ public class QuestionPersistenceMgr extends ObjectPersistenceMgr ...@@ -214,10 +174,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 = ?, left_quest_schinese = ?, right_quest_schinese = ?, left_quest_chinese = ?, right_quest_chinese = ?, left_quest_korean = ?, right_quest_korean = ?, left_quest_thai = ?, right_quest_thai = ?, left_quest_viet = ?, right_quest_viet = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " + "SET left_quest_number = ?, left_quest = ?, right_quest_number = ?, right_quest = ? , 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 (HELPER_LeftQuestionSchinese.getForSQL(dummyLeftQuestionSchinese, quest_linPSet.getAttrib (Question.FIELD_LeftQuestionSchinese))).listEntry (HELPER_RightQuestionSchinese.getForSQL(dummyRightQuestionSchinese, quest_linPSet.getAttrib (Question.FIELD_RightQuestionSchinese))).listEntry (HELPER_LeftQuestionChinese.getForSQL(dummyLeftQuestionChinese, quest_linPSet.getAttrib (Question.FIELD_LeftQuestionChinese))).listEntry (HELPER_RightQuestionChinese.getForSQL(dummyRightQuestionChinese, quest_linPSet.getAttrib (Question.FIELD_RightQuestionChinese))).listEntry (HELPER_LeftQuestionKorean.getForSQL(dummyLeftQuestionKorean, quest_linPSet.getAttrib (Question.FIELD_LeftQuestionKorean))).listEntry (HELPER_RightQuestionKorean.getForSQL(dummyRightQuestionKorean, quest_linPSet.getAttrib (Question.FIELD_RightQuestionKorean))).listEntry (HELPER_LeftQuestionThai.getForSQL(dummyLeftQuestionThai, quest_linPSet.getAttrib (Question.FIELD_LeftQuestionThai))).listEntry (HELPER_RightQuestionThai.getForSQL(dummyRightQuestionThai, quest_linPSet.getAttrib (Question.FIELD_RightQuestionThai))).listEntry (HELPER_LeftQuestionViet.getForSQL(dummyLeftQuestionViet, quest_linPSet.getAttrib (Question.FIELD_LeftQuestionViet))).listEntry (HELPER_RightQuestionViet.getForSQL(dummyRightQuestionViet, quest_linPSet.getAttrib (Question.FIELD_RightQuestionViet))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray()); 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());
if (rowsUpdated != 1) if (rowsUpdated != 1)
{ {
...@@ -435,16 +395,6 @@ public class QuestionPersistenceMgr extends ObjectPersistenceMgr ...@@ -435,16 +395,6 @@ public class QuestionPersistenceMgr extends ObjectPersistenceMgr
quest_linPSet.setAttrib(Question.FIELD_LeftQuestion, HELPER_LeftQuestion.getFromRS(dummyLeftQuestion, 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_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.FIELD_RightQuestion, HELPER_RightQuestion.getFromRS(dummyRightQuestion, r, "right_quest"));
quest_linPSet.setAttrib(Question.FIELD_LeftQuestionSchinese, HELPER_LeftQuestionSchinese.getFromRS(dummyLeftQuestionSchinese, r, "left_quest_schinese"));
quest_linPSet.setAttrib(Question.FIELD_RightQuestionSchinese, HELPER_RightQuestionSchinese.getFromRS(dummyRightQuestionSchinese, r, "right_quest_schinese"));
quest_linPSet.setAttrib(Question.FIELD_LeftQuestionChinese, HELPER_LeftQuestionChinese.getFromRS(dummyLeftQuestionChinese, r, "left_quest_chinese"));
quest_linPSet.setAttrib(Question.FIELD_RightQuestionChinese, HELPER_RightQuestionChinese.getFromRS(dummyRightQuestionChinese, r, "right_quest_chinese"));
quest_linPSet.setAttrib(Question.FIELD_LeftQuestionKorean, HELPER_LeftQuestionKorean.getFromRS(dummyLeftQuestionKorean, r, "left_quest_korean"));
quest_linPSet.setAttrib(Question.FIELD_RightQuestionKorean, HELPER_RightQuestionKorean.getFromRS(dummyRightQuestionKorean, r, "right_quest_korean"));
quest_linPSet.setAttrib(Question.FIELD_LeftQuestionThai, HELPER_LeftQuestionThai.getFromRS(dummyLeftQuestionThai, r, "left_quest_thai"));
quest_linPSet.setAttrib(Question.FIELD_RightQuestionThai, HELPER_RightQuestionThai.getFromRS(dummyRightQuestionThai, r, "right_quest_thai"));
quest_linPSet.setAttrib(Question.FIELD_LeftQuestionViet, HELPER_LeftQuestionViet.getFromRS(dummyLeftQuestionViet, r, "left_quest_viet"));
quest_linPSet.setAttrib(Question.FIELD_RightQuestionViet, HELPER_RightQuestionViet.getFromRS(dummyRightQuestionViet, r, "right_quest_viet"));
} }
...@@ -462,10 +412,10 @@ public class QuestionPersistenceMgr extends ObjectPersistenceMgr ...@@ -462,10 +412,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, left_quest_schinese, right_quest_schinese, left_quest_chinese, right_quest_chinese, left_quest_korean, right_quest_korean, left_quest_thai, right_quest_thai, left_quest_viet, right_quest_viet, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " + " (left_quest_number, left_quest, right_quest_number, right_quest, 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 (HELPER_LeftQuestionSchinese.getForSQL(dummyLeftQuestionSchinese, quest_linPSet.getAttrib (Question.FIELD_LeftQuestionSchinese))).listEntry (HELPER_RightQuestionSchinese.getForSQL(dummyRightQuestionSchinese, quest_linPSet.getAttrib (Question.FIELD_RightQuestionSchinese))).listEntry (HELPER_LeftQuestionChinese.getForSQL(dummyLeftQuestionChinese, quest_linPSet.getAttrib (Question.FIELD_LeftQuestionChinese))).listEntry (HELPER_RightQuestionChinese.getForSQL(dummyRightQuestionChinese, quest_linPSet.getAttrib (Question.FIELD_RightQuestionChinese))).listEntry (HELPER_LeftQuestionKorean.getForSQL(dummyLeftQuestionKorean, quest_linPSet.getAttrib (Question.FIELD_LeftQuestionKorean))).listEntry (HELPER_RightQuestionKorean.getForSQL(dummyRightQuestionKorean, quest_linPSet.getAttrib (Question.FIELD_RightQuestionKorean))).listEntry (HELPER_LeftQuestionThai.getForSQL(dummyLeftQuestionThai, quest_linPSet.getAttrib (Question.FIELD_LeftQuestionThai))).listEntry (HELPER_RightQuestionThai.getForSQL(dummyRightQuestionThai, quest_linPSet.getAttrib (Question.FIELD_RightQuestionThai))).listEntry (HELPER_LeftQuestionViet.getForSQL(dummyLeftQuestionViet, quest_linPSet.getAttrib (Question.FIELD_LeftQuestionViet))).listEntry (HELPER_RightQuestionViet.getForSQL(dummyRightQuestionViet, quest_linPSet.getAttrib (Question.FIELD_RightQuestionViet))) .listEntry (objectID.longID ()).toList().toArray()); 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());
quest_linPSet.setStatus (PersistentSetStatus.PROCESSED); quest_linPSet.setStatus (PersistentSetStatus.PROCESSED);
} }
......
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