Commit 8c2028a6 by Nilu

Bo changes. added search and multi ref to where possible.

parent 86187315
......@@ -13,4 +13,8 @@
<column name="quest_number" type="Long" length="11" nullable="true"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="factor_lin" indexName="idx_factor_lin_factor_number" isUnique="false"><column name="factor_number"/></NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="factor_lin" indexName="idx_factor_lin_quest_number" isUnique="false"><column name="quest_number"/></NODE>
</NODE></OBJECTS>
\ No newline at end of file
......@@ -10,10 +10,16 @@
<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="200"/>
<column name="factor_number" type="Long" length="11" nullable="true"/>
<column name="level_number" type="Long" length="11" nullable="true"/>
<column name="narrative_id" type="Long" length="11" nullable="true"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="level_factor" indexName="idx_level_factor_factor_number" isUnique="false"><column name="factor_number"/></NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="level_factor" indexName="idx_level_factor_level_number" isUnique="false"><column name="level_number"/></NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="level_factor" indexName="idx_level_factor_narrative_id" isUnique="false"><column name="narrative_id"/></NODE>
</NODE></OBJECTS>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun -->
<OBJECTS name="" xmlns:oneit="http://www.1iT.com.au"><NODE name="Script" factory="Vector">
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.DefineTableOperation">
<tableName factory="String">narrative</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="narrative_code" type="String" nullable="false" length="15"/>
<column name="narrative_desc" type="String" nullable="true" length="30"/>
<column name="graphic_notes" type="CLOB" nullable="true"/>
<column name="exec_sum_notes" type="CLOB" nullable="true"/>
<column name="mod_connect_flag" type="String" nullable="true" length="15"/>
<column name="narrative_notes" type="CLOB" nullable="true"/>
<column name="devel_narrative" type="String" nullable="true" length="128"/>
<column name="question" type="CLOB" nullable="true"/>
<column name="level_number" type="Long" length="11" nullable="true"/>
</NODE>
</NODE></OBJECTS>
\ No newline at end of file
......@@ -23,3 +23,8 @@ ALTER TABLE factor_lin ADD
CREATE INDEX idx_factor_lin_factor_number
ON factor_lin (factor_number);
CREATE INDEX idx_factor_lin_quest_number
ON factor_lin (quest_number);
......@@ -10,10 +10,10 @@ CREATE TABLE level_factor (
,
from_score numeric(12) NULL,
to_score numeric(12) NULL,
narrative_code varchar(15) NULL,
color_code varchar(200) NULL,
factor_number numeric(12) NULL,
level_number numeric(12) NULL
level_number numeric(12) NULL,
narrative_id numeric(12) NULL
);
......@@ -26,3 +26,11 @@ ALTER TABLE level_factor ADD
CREATE INDEX idx_level_factor_factor_number
ON level_factor (factor_number);
CREATE INDEX idx_level_factor_level_number
ON level_factor (level_number);
CREATE INDEX idx_level_factor_narrative_id
ON level_factor (narrative_id);
-- DROP TABLE narrative;
CREATE TABLE narrative (
object_id int NOT NULL ,
object_last_updated_date datetime DEFAULT getdate() NOT NULL ,
object_created_date datetime DEFAULT getdate() NOT NULL
,
narrative_code varchar(15) NOT NULL,
narrative_desc varchar(30) NULL,
graphic_notes text NULL,
exec_sum_notes text NULL,
mod_connect_flag varchar(15) NULL,
narrative_notes text NULL,
devel_narrative varchar(128) NULL,
question text NULL,
level_number numeric(12) NULL
);
ALTER TABLE narrative ADD
CONSTRAINT PK_narrative PRIMARY KEY
(
object_id
) ;
\ No newline at end of file
......@@ -24,3 +24,8 @@ ALTER TABLE factor_lin ADD
CREATE INDEX idx_factor_lin_factor_number
ON factor_lin (factor_number);
CREATE INDEX idx_factor_lin_quest_number
ON factor_lin (quest_number);
......@@ -11,10 +11,10 @@ CREATE TABLE level_factor (
,
from_score number(12) NULL,
to_score number(12) NULL,
narrative_code varchar2(15) NULL,
color_code varchar2(200) NULL,
factor_number number(12) NULL,
level_number number(12) NULL
level_number number(12) NULL,
narrative_id number(12) NULL
);
......@@ -27,3 +27,11 @@ ALTER TABLE level_factor ADD
CREATE INDEX idx_level_factor_factor_number
ON level_factor (factor_number);
CREATE INDEX idx_level_factor_level_number
ON level_factor (level_number);
CREATE INDEX idx_level_factor_narrative_id
ON level_factor (narrative_id);
-- DROP TABLE narrative;
CREATE TABLE narrative (
object_id number(12) NOT NULL ,
object_last_updated_date date DEFAULT SYSDATE NOT NULL ,
object_created_date date DEFAULT SYSDATE NOT NULL
,
narrative_code varchar2(15) NOT NULL,
narrative_desc varchar2(30) NULL,
graphic_notes clob NULL,
exec_sum_notes clob NULL,
mod_connect_flag varchar2(15) NULL,
narrative_notes clob NULL,
devel_narrative varchar2(128) NULL,
question clob NULL,
level_number number(12) NULL
);
ALTER TABLE narrative ADD
CONSTRAINT PK_narrative PRIMARY KEY
(
object_id
) ;
\ No newline at end of file
......@@ -24,3 +24,8 @@ ALTER TABLE factor_lin ADD
CREATE INDEX idx_factor_lin_factor_number
ON factor_lin (factor_number);
CREATE INDEX idx_factor_lin_quest_number
ON factor_lin (quest_number);
......@@ -11,10 +11,10 @@ CREATE TABLE level_factor (
,
from_score numeric(12) NULL,
to_score numeric(12) NULL,
narrative_code varchar(15) NULL,
color_code varchar(200) NULL,
factor_number numeric(12) NULL,
level_number numeric(12) NULL
level_number numeric(12) NULL,
narrative_id numeric(12) NULL
);
......@@ -27,3 +27,11 @@ ALTER TABLE level_factor ADD
CREATE INDEX idx_level_factor_factor_number
ON level_factor (factor_number);
CREATE INDEX idx_level_factor_level_number
ON level_factor (level_number);
CREATE INDEX idx_level_factor_narrative_id
ON level_factor (narrative_id);
-- @AutoRun
-- drop table narrative;
CREATE TABLE narrative (
object_id numeric(12) NOT NULL ,
object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
object_created_date timestamp DEFAULT NOW() NOT NULL
,
narrative_code varchar(15) NOT NULL,
narrative_desc varchar(30) NULL,
graphic_notes text NULL,
exec_sum_notes text NULL,
mod_connect_flag varchar(15) NULL,
narrative_notes text NULL,
devel_narrative varchar(128) NULL,
question text NULL,
level_number numeric(12) NULL
);
ALTER TABLE narrative ADD
CONSTRAINT pk_narrative PRIMARY KEY
(
object_id
) ;
\ No newline at end of file
......@@ -14,6 +14,8 @@
</TABLE>
<SEARCH type="All" paramFilter="answer.object_id is not null" orderBy="answer.object_id" />
</BUSINESSCLASS>
</ROOT>
\ No newline at end of file
......@@ -251,6 +251,10 @@ public class AnswerPersistenceMgr extends ObjectPersistenceMgr
}
public ResultSet executeSearchQueryAll (SQLManager sqlMgr) throws SQLException
{
throw new RuntimeException ("NOT implemented: executeSearchQueryAll");
}
......@@ -362,6 +366,44 @@ public class AnswerPersistenceMgr extends ObjectPersistenceMgr
return results;
}
else if (searchType.equals (Answer.SEARCH_All))
{
// Local scope for transformed variables
{
}
String orderBy = " ORDER BY answer.object_id";
String tables = " ";
Set<String> joinTableSet = new HashSet<String>();
String filter;
Object[] searchParams; // paramFilter: answer.object_id is not null
String preFilter = "(answer.object_id is not null)"
+ " ";
preFilter += context.getLoadingAttributes ().getCustomSQL() ;
SearchParamTransform tx = new SearchParamTransform (criteria);
filter = StringUtils.replaceParams (preFilter, tx);
searchParams = tx.getParamsArray();
Integer maxRows = context.getLoadingAttributes ().getMaxRows ();
boolean truncateExtra = !context.getLoadingAttributes ().isFailIfMaxExceeded();
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}answer " + tables + tableSetToSQL(joinTableSet) +
"WHERE " + SELECT_JOINS + " " + filter + orderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, maxRows, truncateExtra);
return results;
}
else
{
......
......@@ -43,6 +43,7 @@ public abstract class BaseAnswer extends BaseBusinessClass
public static final String SINGLEREFERENCE_Question = "Question";
// Static constants corresponding to searches
public static final String SEARCH_All = "All";
// Static constants corresponding to attribute helpers
......@@ -1017,6 +1018,75 @@ public abstract class BaseAnswer extends BaseBusinessClass
}
public static SearchAll SearchByAll () { return new SearchAll (); }
public static class SearchAll extends SearchObject<Answer>
{
public SearchAll andObjectID (QueryFilter<Long> filter)
{
filter.addFilter (context, "answer.object_id", FIELD_ObjectID);
return this;
}
public SearchAll andObjectCreated (QueryFilter<Date> filter)
{
filter.addFilter (context, "answer.object_created_date", FIELD_ObjectCreated);
return this;
}
public SearchAll andObjectLastModified (QueryFilter<Date> filter)
{
filter.addFilter (context, "answer.object_last_updated_date", FIELD_ObjectLastModified);
return this;
}
public SearchAll andAnswerNo (QueryFilter<Integer> filter)
{
filter.addFilter (context, "answer.answer_number", "AnswerNo");
return this;
}
public SearchAll andCandidate (QueryFilter<Candidate> filter)
{
filter.addFilter (context, "answer.candidate_id", "Candidate");
return this;
}
public SearchAll andQuestion (QueryFilter<Question> filter)
{
filter.addFilter (context, "answer.quest_number", "Question");
return this;
}
public Answer[]
search (ObjectTransaction transaction) throws StorageException
{
BaseBusinessClass[] results = super.search (transaction, REFERENCE_Answer, SEARCH_All, criteria);
Set<Answer> typedResults = new LinkedHashSet <Answer> ();
for (BaseBusinessClass bbcResult : results)
{
Answer aResult = (Answer)bbcResult;
typedResults.add (aResult);
}
return ObjstoreUtils.removeDeleted(transaction, typedResults).toArray (new Answer[0]);
}
}
public static Answer[]
searchAll (ObjectTransaction transaction) throws StorageException
{
return SearchByAll ()
.search (transaction);
}
public Object getAttribute (String attribName)
......
......@@ -54,6 +54,7 @@ public abstract class BaseCandidate extends BaseBusinessClass
public static final String FIELD_Email = "Email";
// Static constants corresponding to searches
public static final String SEARCH_All = "All";
// Static constants corresponding to attribute helpers
......@@ -2617,6 +2618,141 @@ public abstract class BaseCandidate extends BaseBusinessClass
}
public static SearchAll SearchByAll () { return new SearchAll (); }
public static class SearchAll extends SearchObject<Candidate>
{
public SearchAll andObjectID (QueryFilter<Long> filter)
{
filter.addFilter (context, "candidate.object_id", FIELD_ObjectID);
return this;
}
public SearchAll andObjectCreated (QueryFilter<Date> filter)
{
filter.addFilter (context, "candidate.object_created_date", FIELD_ObjectCreated);
return this;
}
public SearchAll andObjectLastModified (QueryFilter<Date> filter)
{
filter.addFilter (context, "candidate.object_last_updated_date", FIELD_ObjectLastModified);
return this;
}
public SearchAll andFirstName (QueryFilter<String> filter)
{
filter.addFilter (context, "candidate.first_name", "FirstName");
return this;
}
public SearchAll andMiddleName (QueryFilter<String> filter)
{
filter.addFilter (context, "candidate.middle_name", "MiddleName");
return this;
}
public SearchAll andLastName (QueryFilter<String> filter)
{
filter.addFilter (context, "candidate.last_name", "LastName");
return this;
}
public SearchAll andPreferredName (QueryFilter<String> filter)
{
filter.addFilter (context, "candidate.preferred_name", "PreferredName");
return this;
}
public SearchAll andSalutation (QueryFilter<String> filter)
{
filter.addFilter (context, "candidate.salutation", "Salutation");
return this;
}
public SearchAll andPosition (QueryFilter<String> filter)
{
filter.addFilter (context, "candidate.position", "Position");
return this;
}
public SearchAll andDateOfBirth (QueryFilter<Date> filter)
{
filter.addFilter (context, "candidate.date_of_birth", "DateOfBirth");
return this;
}
public SearchAll andDateRegistered (QueryFilter<Date> filter)
{
filter.addFilter (context, "candidate.date_registered", "DateRegistered");
return this;
}
public SearchAll andGender (QueryFilter<String> filter)
{
filter.addFilter (context, "candidate.gender", "Gender");
return this;
}
public SearchAll andPassword (QueryFilter<String> filter)
{
filter.addFilter (context, "candidate.password", "Password");
return this;
}
public SearchAll andDateTaken (QueryFilter<Date> filter)
{
filter.addFilter (context, "candidate.date_taken", "DateTaken");
return this;
}
public SearchAll andLocation (QueryFilter<String> filter)
{
filter.addFilter (context, "candidate.location", "Location");
return this;
}
public SearchAll andPhone (QueryFilter<String> filter)
{
filter.addFilter (context, "candidate.contact_phone", "Phone");
return this;
}
public SearchAll andEmail (QueryFilter<String> filter)
{
filter.addFilter (context, "candidate.email", "Email");
return this;
}
public Candidate[]
search (ObjectTransaction transaction) throws StorageException
{
BaseBusinessClass[] results = super.search (transaction, REFERENCE_Candidate, SEARCH_All, criteria);
Set<Candidate> typedResults = new LinkedHashSet <Candidate> ();
for (BaseBusinessClass bbcResult : results)
{
Candidate aResult = (Candidate)bbcResult;
typedResults.add (aResult);
}
return ObjstoreUtils.removeDeleted(transaction, typedResults).toArray (new Candidate[0]);
}
}
public static Candidate[]
searchAll (ObjectTransaction transaction) throws StorageException
{
return SearchByAll ()
.search (transaction);
}
public Object getAttribute (String attribName)
......
......@@ -40,7 +40,9 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
public static final String FIELD_ReverseScore = "ReverseScore";
public static final String SINGLEREFERENCE_Factor = "Factor";
public static final String BACKREF_Factor = "";
public static final String SINGLEREFERENCE_Question = "Question";
public static final String BACKREF_Question = "";
// Static constants corresponding to searches
public static final String SEARCH_All = "All";
......@@ -77,6 +79,8 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
try
{
String tmp_Factor = Factor.BACKREF_Questions;
String tmp_Question = Question.BACKREF_Factors;
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
......@@ -102,6 +106,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "Questions");
metaInfo.put ("dbcol", "factor_number");
metaInfo.put ("name", "Factor");
metaInfo.put ("type", "Factor");
......@@ -116,6 +121,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "Factors");
metaInfo.put ("dbcol", "quest_number");
metaInfo.put ("name", "Question");
metaInfo.put ("type", "Question");
......@@ -179,8 +185,8 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
{
super._initialiseAssociations ();
_Factor = new SingleAssociation<FactorQuestionLink, Factor> (this, SINGLEREFERENCE_Factor, null, Factor.REFERENCE_Factor, "factor_lin");
_Question = new SingleAssociation<FactorQuestionLink, Question> (this, SINGLEREFERENCE_Question, null, Question.REFERENCE_Question, "factor_lin");
_Factor = new SingleAssociation<FactorQuestionLink, Factor> (this, SINGLEREFERENCE_Factor, Factor.MULTIPLEREFERENCE_Questions, Factor.REFERENCE_Factor, "factor_lin");
_Question = new SingleAssociation<FactorQuestionLink, Question> (this, SINGLEREFERENCE_Question, Question.MULTIPLEREFERENCE_Factors, Question.REFERENCE_Question, "factor_lin");
}
......@@ -190,8 +196,8 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
{
super.initialiseReference ();
_Factor = new SingleAssociation<FactorQuestionLink, Factor> (this, SINGLEREFERENCE_Factor, null, Factor.REFERENCE_Factor, "factor_lin");
_Question = new SingleAssociation<FactorQuestionLink, Question> (this, SINGLEREFERENCE_Question, null, Question.REFERENCE_Question, "factor_lin");
_Factor = new SingleAssociation<FactorQuestionLink, Factor> (this, SINGLEREFERENCE_Factor, Factor.MULTIPLEREFERENCE_Questions, Factor.REFERENCE_Factor, "factor_lin");
_Question = new SingleAssociation<FactorQuestionLink, Question> (this, SINGLEREFERENCE_Question, Question.MULTIPLEREFERENCE_Factors, Question.REFERENCE_Question, "factor_lin");
return this;
......@@ -344,10 +350,10 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
}
else if (assocName.equals (SINGLEREFERENCE_Factor))
{
return null ;
return Factor.MULTIPLEREFERENCE_Questions ;
}else if (assocName.equals (SINGLEREFERENCE_Question))
{
return null ;
return Question.MULTIPLEREFERENCE_Factors ;
}
else
{
......@@ -524,9 +530,22 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
assertValid();
Debug.assertion (getWriteability_Factor () != FieldWriteability.FALSE, "Assoc Factor is not writeable");
preFactorChange (newFactor);
Factor oldFactor = getFactor ();
if (oldFactor != null)
{
// This is to stop validation from triggering when we are removed
_Factor.set (null);
oldFactor.removeFromQuestions ((FactorQuestionLink)(this));
}
_Factor.set (newFactor);
if (newFactor != null)
{
newFactor.addToQuestions ((FactorQuestionLink)(this));
}
postFactorChange ();
}
}
......@@ -618,9 +637,22 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
assertValid();
Debug.assertion (getWriteability_Question () != FieldWriteability.FALSE, "Assoc Question is not writeable");
preQuestionChange (newQuestion);
Question oldQuestion = getQuestion ();
if (oldQuestion != null)
{
// This is to stop validation from triggering when we are removed
_Question.set (null);
oldQuestion.removeFromFactors ((FactorQuestionLink)(this));
}
_Question.set (newQuestion);
if (newQuestion != null)
{
newQuestion.addToFactors ((FactorQuestionLink)(this));
}
postQuestionChange ();
}
}
......@@ -723,6 +755,34 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
{
try
{
// Ensure we are removed from any loaded multi-associations that aren't mandatory
if (_Factor.isLoaded () || getTransaction ().isObjectLoaded (_Factor.getReferencedType (), getFactorID ()))
{
Factor referenced = getFactor ();
if (referenced != null)
{
// Stop the callback
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null Questions from ", getObjectID (), " to ", referenced.getObjectID ());
_Factor.set (null);
referenced.removeFromQuestions ((FactorQuestionLink)this);
}
}
// Ensure we are removed from any loaded multi-associations that aren't mandatory
if (_Question.isLoaded () || getTransaction ().isObjectLoaded (_Question.getReferencedType (), getQuestionID ()))
{
Question referenced = getQuestion ();
if (referenced != null)
{
// Stop the callback
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null Factors from ", getObjectID (), " to ", referenced.getObjectID ());
_Question.set (null);
referenced.removeFromFactors ((FactorQuestionLink)this);
}
}
}
catch (Exception e)
{
......
......@@ -46,6 +46,7 @@ public abstract class BaseSection extends BaseBusinessClass
public static final String BACKREF_Questions = "";
// Static constants corresponding to searches
public static final String SEARCH_All = "All";
// Static constants corresponding to attribute helpers
......@@ -1022,6 +1023,69 @@ public abstract class BaseSection extends BaseBusinessClass
}
public static SearchAll SearchByAll () { return new SearchAll (); }
public static class SearchAll extends SearchObject<Section>
{
public SearchAll andObjectID (QueryFilter<Long> filter)
{
filter.addFilter (context, "quest_hdr.object_id", FIELD_ObjectID);
return this;
}
public SearchAll andObjectCreated (QueryFilter<Date> filter)
{
filter.addFilter (context, "quest_hdr.object_created_date", FIELD_ObjectCreated);
return this;
}
public SearchAll andObjectLastModified (QueryFilter<Date> filter)
{
filter.addFilter (context, "quest_hdr.object_last_updated_date", FIELD_ObjectLastModified);
return this;
}
public SearchAll andDescription (QueryFilter<String> filter)
{
filter.addFilter (context, "quest_hdr.quest_hdr_desc", "Description");
return this;
}
public SearchAll andQuestionType (QueryFilter<QuestionType> filter)
{
filter.addFilter (context, "quest_hdr.quest_type_flag", "QuestionType");
return this;
}
public Section[]
search (ObjectTransaction transaction) throws StorageException
{
BaseBusinessClass[] results = super.search (transaction, REFERENCE_Section, SEARCH_All, criteria);
Set<Section> typedResults = new LinkedHashSet <Section> ();
for (BaseBusinessClass bbcResult : results)
{
Section aResult = (Section)bbcResult;
typedResults.add (aResult);
}
return ObjstoreUtils.removeDeleted(transaction, typedResults).toArray (new Section[0]);
}
}
public static Section[]
searchAll (ObjectTransaction transaction) throws StorageException
{
return SearchByAll ()
.search (transaction);
}
public Object getAttribute (String attribName)
......
......@@ -23,6 +23,8 @@
</TABLE>
<SEARCH type="All" paramFilter="candidate.object_id is not null" orderBy="candidate.object_id" />
</BUSINESSCLASS>
</ROOT>
\ No newline at end of file
......@@ -301,6 +301,10 @@ public class CandidatePersistenceMgr extends ObjectPersistenceMgr
}
public ResultSet executeSearchQueryAll (SQLManager sqlMgr) throws SQLException
{
throw new RuntimeException ("NOT implemented: executeSearchQueryAll");
}
......@@ -412,6 +416,44 @@ public class CandidatePersistenceMgr extends ObjectPersistenceMgr
return results;
}
else if (searchType.equals (Candidate.SEARCH_All))
{
// Local scope for transformed variables
{
}
String orderBy = " ORDER BY candidate.object_id";
String tables = " ";
Set<String> joinTableSet = new HashSet<String>();
String filter;
Object[] searchParams; // paramFilter: candidate.object_id is not null
String preFilter = "(candidate.object_id is not null)"
+ " ";
preFilter += context.getLoadingAttributes ().getCustomSQL() ;
SearchParamTransform tx = new SearchParamTransform (criteria);
filter = StringUtils.replaceParams (preFilter, tx);
searchParams = tx.getParamsArray();
Integer maxRows = context.getLoadingAttributes ().getMaxRows ();
boolean truncateExtra = !context.getLoadingAttributes ().isFailIfMaxExceeded();
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}candidate " + tables + tableSetToSQL(joinTableSet) +
"WHERE " + SELECT_JOINS + " " + filter + orderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, maxRows, truncateExtra);
return results;
}
else
{
......
......@@ -4,7 +4,9 @@
<BUSINESSCLASS name="Factor" package="performa.orm">
<MULTIPLEREFERENCE name="FactorLinks" type="FactorLevelLink" backreferenceName="Factor" />
<MULTIPLEREFERENCE name="Levels" type="FactorLevelLink" backreferenceName="Factor" />
<MULTIPLEREFERENCE name="Questions" type="FactorQuestionLink" backreferenceName="Factor" />
<MULTIPLEREFERENCE name="Results" type="FactorScoreResult" backreferenceName="Factor" />
<TABLE name="factor" tablePrefix="object" polymorphic="FALSE">
......@@ -12,6 +14,8 @@
</TABLE>
<SEARCH type="All" paramFilter="factor.object_id is not null" orderBy="factor.object_id" />
</BUSINESSCLASS>
</ROOT>
\ No newline at end of file
......@@ -14,11 +14,13 @@
<ATTRIB name="ZScoreWeight" type="Double" dbcol="z_score_wght"/>
<ATTRIB name="ZScoreWeight2" type="Double" dbcol="z_score_wght_2"/>
<SINGLEREFERENCE name="Level" type="Level" dbcol="level_number" backreferenceName="FactorLinks" />
<SINGLEREFERENCE name="Factor" type="Factor" dbcol="factor_number" backreferenceName="FactorLinks" />
<SINGLEREFERENCE name="Level" type="Level" dbcol="level_number" backreferenceName="Factors" />
<SINGLEREFERENCE name="Factor" type="Factor" dbcol="factor_number" backreferenceName="Levels" />
</TABLE>
<SEARCH type="All" paramFilter="factor_hdr.object_id is not null" orderBy="factor_hdr.object_id" />
</BUSINESSCLASS>
</ROOT>
\ No newline at end of file
......@@ -295,6 +295,10 @@ public class FactorLevelLinkPersistenceMgr extends ObjectPersistenceMgr
}
public ResultSet executeSearchQueryAll (SQLManager sqlMgr) throws SQLException
{
throw new RuntimeException ("NOT implemented: executeSearchQueryAll");
}
......@@ -406,6 +410,44 @@ public class FactorLevelLinkPersistenceMgr extends ObjectPersistenceMgr
return results;
}
else if (searchType.equals (FactorLevelLink.SEARCH_All))
{
// Local scope for transformed variables
{
}
String orderBy = " ORDER BY factor_hdr.object_id";
String tables = " ";
Set<String> joinTableSet = new HashSet<String>();
String filter;
Object[] searchParams; // paramFilter: factor_hdr.object_id is not null
String preFilter = "(factor_hdr.object_id is not null)"
+ " ";
preFilter += context.getLoadingAttributes ().getCustomSQL() ;
SearchParamTransform tx = new SearchParamTransform (criteria);
filter = StringUtils.replaceParams (preFilter, tx);
searchParams = tx.getParamsArray();
Integer maxRows = context.getLoadingAttributes ().getMaxRows ();
boolean truncateExtra = !context.getLoadingAttributes ().isFailIfMaxExceeded();
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}factor_hdr " + tables + tableSetToSQL(joinTableSet) +
"WHERE " + SELECT_JOINS + " " + filter + orderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, maxRows, truncateExtra);
return results;
}
else
{
......
......@@ -249,6 +249,10 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr
}
public ResultSet executeSearchQueryAll (SQLManager sqlMgr) throws SQLException
{
throw new RuntimeException ("NOT implemented: executeSearchQueryAll");
}
......@@ -360,6 +364,44 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr
return results;
}
else if (searchType.equals (Factor.SEARCH_All))
{
// Local scope for transformed variables
{
}
String orderBy = " ORDER BY factor.object_id";
String tables = " ";
Set<String> joinTableSet = new HashSet<String>();
String filter;
Object[] searchParams; // paramFilter: factor.object_id is not null
String preFilter = "(factor.object_id is not null)"
+ " ";
preFilter += context.getLoadingAttributes ().getCustomSQL() ;
SearchParamTransform tx = new SearchParamTransform (criteria);
filter = StringUtils.replaceParams (preFilter, tx);
searchParams = tx.getParamsArray();
Integer maxRows = context.getLoadingAttributes ().getMaxRows ();
boolean truncateExtra = !context.getLoadingAttributes ().isFailIfMaxExceeded();
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}factor " + tables + tableSetToSQL(joinTableSet) +
"WHERE " + SELECT_JOINS + " " + filter + orderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, maxRows, truncateExtra);
return results;
}
else
{
......
......@@ -8,8 +8,8 @@
<ATTRIB name="ReverseScore" type="Boolean" dbcol="reverse_score_flag"/>
<SINGLEREFERENCE name="Factor" type="Factor" dbcol="factor_number" />
<SINGLEREFERENCE name="Question" type="Question" dbcol="quest_number" />
<SINGLEREFERENCE name="Factor" type="Factor" dbcol="factor_number" backreferenceName="Questions"/>
<SINGLEREFERENCE name="Question" type="Question" dbcol="quest_number" backreferenceName="Factors" />
</TABLE>
......
......@@ -140,6 +140,26 @@ public class FactorQuestionLinkPersistenceMgr extends ObjectPersistenceMgr
{
throw new RuntimeException ();
}
else if (refName.equals (FactorQuestionLink.SINGLEREFERENCE_Factor))
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}factor_lin " +
"WHERE " + SELECT_JOINS + "factor_number = ?";
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, new Object[] { _objectID.longID () }, null, false);
return results;
}
else if (refName.equals (FactorQuestionLink.SINGLEREFERENCE_Question))
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}factor_lin " +
"WHERE " + SELECT_JOINS + "quest_number = ?";
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, new Object[] { _objectID.longID () }, null, false);
return results;
}
else
{
throw new IllegalArgumentException ("Illegal reference type:" + refName);
......
......@@ -9,11 +9,11 @@
<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="ColorCode" dbcol="color_code" attribHelper="EnumeratedAttributeHelper" />
<SINGLEREFERENCE name="Factor" type="Factor" dbcol="factor_number" />
<SINGLEREFERENCE name="Level" type="Level" dbcol="level_number" />
<SINGLEREFERENCE name="Factor" type="Factor" dbcol="factor_number" backreferenceName="Results"/>
<SINGLEREFERENCE name="Level" type="Level" dbcol="level_number" backreferenceName="Results"/>
<SINGLEREFERENCE name="Narrative" type="Narrative" dbcol="narrative_id" backreferenceName="Results"/>
</TABLE>
......
......@@ -4,7 +4,8 @@
<BUSINESSCLASS name="Level" package="performa.orm">
<MULTIPLEREFERENCE name="FactorLinks" type="FactorLevelLink" backreferenceName="Level" />
<MULTIPLEREFERENCE name="Factors" type="FactorLevelLink" backreferenceName="Level" />
<MULTIPLEREFERENCE name="Results" type="FactorScoreResult" backreferenceName="Level" />
<TABLE name="level" tablePrefix="object" polymorphic="FALSE">
......@@ -14,6 +15,8 @@
</TABLE>
<SEARCH type="All" paramFilter="level.object_id is not null" orderBy="level.object_id" />
</BUSINESSCLASS>
</ROOT>
......@@ -257,6 +257,10 @@ public class LevelPersistenceMgr extends ObjectPersistenceMgr
}
public ResultSet executeSearchQueryAll (SQLManager sqlMgr) throws SQLException
{
throw new RuntimeException ("NOT implemented: executeSearchQueryAll");
}
......@@ -368,6 +372,44 @@ public class LevelPersistenceMgr extends ObjectPersistenceMgr
return results;
}
else if (searchType.equals (Level.SEARCH_All))
{
// Local scope for transformed variables
{
}
String orderBy = " ORDER BY level.object_id";
String tables = " ";
Set<String> joinTableSet = new HashSet<String>();
String filter;
Object[] searchParams; // paramFilter: level.object_id is not null
String preFilter = "(level.object_id is not null)"
+ " ";
preFilter += context.getLoadingAttributes ().getCustomSQL() ;
SearchParamTransform tx = new SearchParamTransform (criteria);
filter = StringUtils.replaceParams (preFilter, tx);
searchParams = tx.getParamsArray();
Integer maxRows = context.getLoadingAttributes ().getMaxRows ();
boolean truncateExtra = !context.getLoadingAttributes ().isFailIfMaxExceeded();
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}level " + tables + tableSetToSQL(joinTableSet) +
"WHERE " + SELECT_JOINS + " " + filter + orderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, maxRows, truncateExtra);
return results;
}
else
{
......
package performa.orm;
public class Narrative extends BaseNarrative
{
private static final long serialVersionUID = 0L;
// This constructor should not be called
public Narrative ()
{
// 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="Narrative" package="performa.orm">
<MULTIPLEREFERENCE name="Results" type="FactorScoreResult" backreferenceName="Narrative" />
<TABLE name="narrative" tablePrefix="object" polymorphic="FALSE">
<ATTRIB name="NarrativeCode" type="String" dbcol="narrative_code" length="15" mandatory="true"/>
<ATTRIB name="Description" type="String" dbcol="narrative_desc" length="30"/>
<ATTRIB name="GraphicNotes" type="String" dbcol="graphic_notes"/>
<ATTRIB name="SummaryNotes" type="String" dbcol="exec_sum_notes"/>
<ATTRIB name="ModConnect" type="String" dbcol="mod_connect_flag" length="15"/>
<ATTRIB name="NarrativeNotes" type="String" dbcol="narrative_notes"/>
<ATTRIB name="DevelNarrative" type="String" dbcol="devel_narrative" length="128"/>
<ATTRIB name="Question" type="String" dbcol="question"/>
<SINGLEREFERENCE name="Level" type="Level" dbcol="level_number"/>
</TABLE>
<SEARCH type="All" paramFilter="narrative.object_id is not null" orderBy="narrative.object_id" />
</BUSINESSCLASS>
</ROOT>
\ No newline at end of file
......@@ -4,6 +4,8 @@
<BUSINESSCLASS name="Question" package="performa.orm">
<MULTIPLEREFERENCE name="Factors" type="FactorQuestionLink" backreferenceName="Question" />
<TABLE name="quest_lin" tablePrefix="object" polymorphic="FALSE">
<ATTRIB name="Description" type="String" dbcol="left_quest" length="80"/>
......@@ -12,6 +14,8 @@
</TABLE>
<SEARCH type="All" paramFilter="quest_lin.object_id is not null" orderBy="quest_lin.object_id" />
</BUSINESSCLASS>
</ROOT>
\ No newline at end of file
......@@ -260,6 +260,10 @@ public class QuestionPersistenceMgr extends ObjectPersistenceMgr
}
public ResultSet executeSearchQueryAll (SQLManager sqlMgr) throws SQLException
{
throw new RuntimeException ("NOT implemented: executeSearchQueryAll");
}
......@@ -371,6 +375,44 @@ public class QuestionPersistenceMgr extends ObjectPersistenceMgr
return results;
}
else if (searchType.equals (Question.SEARCH_All))
{
// Local scope for transformed variables
{
}
String orderBy = " ORDER BY quest_lin.object_id";
String tables = " ";
Set<String> joinTableSet = new HashSet<String>();
String filter;
Object[] searchParams; // paramFilter: quest_lin.object_id is not null
String preFilter = "(quest_lin.object_id is not null)"
+ " ";
preFilter += context.getLoadingAttributes ().getCustomSQL() ;
SearchParamTransform tx = new SearchParamTransform (criteria);
filter = StringUtils.replaceParams (preFilter, tx);
searchParams = tx.getParamsArray();
Integer maxRows = context.getLoadingAttributes ().getMaxRows ();
boolean truncateExtra = !context.getLoadingAttributes ().isFailIfMaxExceeded();
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}quest_lin " + tables + tableSetToSQL(joinTableSet) +
"WHERE " + SELECT_JOINS + " " + filter + orderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, maxRows, truncateExtra);
return results;
}
else
{
......
......@@ -14,6 +14,8 @@
</TABLE>
<SEARCH type="All" paramFilter="quest_hdr.object_id is not null" orderBy="quest_hdr.object_id" />
</BUSINESSCLASS>
</ROOT>
\ No newline at end of file
......@@ -254,6 +254,10 @@ public class SectionPersistenceMgr extends ObjectPersistenceMgr
}
public ResultSet executeSearchQueryAll (SQLManager sqlMgr) throws SQLException
{
throw new RuntimeException ("NOT implemented: executeSearchQueryAll");
}
......@@ -365,6 +369,44 @@ public class SectionPersistenceMgr extends ObjectPersistenceMgr
return results;
}
else if (searchType.equals (Section.SEARCH_All))
{
// Local scope for transformed variables
{
}
String orderBy = " ORDER BY quest_hdr.object_id";
String tables = " ";
Set<String> joinTableSet = new HashSet<String>();
String filter;
Object[] searchParams; // paramFilter: quest_hdr.object_id is not null
String preFilter = "(quest_hdr.object_id is not null)"
+ " ";
preFilter += context.getLoadingAttributes ().getCustomSQL() ;
SearchParamTransform tx = new SearchParamTransform (criteria);
filter = StringUtils.replaceParams (preFilter, tx);
searchParams = tx.getParamsArray();
Integer maxRows = context.getLoadingAttributes ().getMaxRows ();
boolean truncateExtra = !context.getLoadingAttributes ().isFailIfMaxExceeded();
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}quest_hdr " + tables + tableSetToSQL(joinTableSet) +
"WHERE " + SELECT_JOINS + " " + filter + orderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, maxRows, truncateExtra);
return results;
}
else
{
......
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