Commit bcc64b13 by Nilu

basic steps of analyse engine

parent 72f8b4ef
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
<column name="quest_number" type="Long" nullable="true"/> <column name="quest_number" type="Long" nullable="true"/>
<column name="answer_number" type="Long" nullable="true"/> <column name="answer_number" type="Long" nullable="true"/>
<column name="candidate_id" type="Long" length="11" nullable="true"/> <column name="candidate_id" type="Long" length="11" nullable="true"/>
<column name="quest_number" type="Long" length="11" nullable="true"/>
</NODE> </NODE>
</NODE></OBJECTS> </NODE></OBJECTS>
\ No newline at end of file
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
<column name="object_created_date" type="Date" nullable="false" length="22"/> <column name="object_created_date" type="Date" nullable="false" length="22"/>
<column name="reverse_score_flag" type="String" nullable="true" length="15"/> <column name="reverse_score_flag" type="String" nullable="true" length="15"/>
<column name="factor_number" type="Long" length="11" nullable="true"/> <column name="factor_number" type="Long" length="11" nullable="true"/>
<column name="quest_number" type="Long" length="11" nullable="true"/>
</NODE> </NODE>
</NODE></OBJECTS> </NODE></OBJECTS>
\ No newline at end of file
...@@ -10,7 +10,8 @@ CREATE TABLE answer ( ...@@ -10,7 +10,8 @@ CREATE TABLE answer (
, ,
quest_number numeric(12) NULL, quest_number numeric(12) NULL,
answer_number numeric(12) NULL, answer_number numeric(12) NULL,
candidate_id numeric(12) NULL candidate_id numeric(12) NULL,
quest_number numeric(12) NULL
); );
......
...@@ -9,7 +9,8 @@ CREATE TABLE factor_lin ( ...@@ -9,7 +9,8 @@ CREATE TABLE factor_lin (
object_created_date datetime DEFAULT getdate() NOT NULL object_created_date datetime DEFAULT getdate() NOT NULL
, ,
reverse_score_flag varchar(15) NULL, reverse_score_flag varchar(15) NULL,
factor_number numeric(12) NULL factor_number numeric(12) NULL,
quest_number numeric(12) NULL
); );
......
...@@ -11,7 +11,8 @@ CREATE TABLE answer ( ...@@ -11,7 +11,8 @@ CREATE TABLE answer (
, ,
quest_number number(12) NULL, quest_number number(12) NULL,
answer_number number(12) NULL, answer_number number(12) NULL,
candidate_id number(12) NULL candidate_id number(12) NULL,
quest_number number(12) NULL
); );
......
...@@ -10,7 +10,8 @@ CREATE TABLE factor_lin ( ...@@ -10,7 +10,8 @@ CREATE TABLE factor_lin (
object_created_date date DEFAULT SYSDATE NOT NULL object_created_date date DEFAULT SYSDATE NOT NULL
, ,
reverse_score_flag varchar2(15) NULL, reverse_score_flag varchar2(15) NULL,
factor_number number(12) NULL factor_number number(12) NULL,
quest_number number(12) NULL
); );
......
...@@ -11,7 +11,8 @@ CREATE TABLE answer ( ...@@ -11,7 +11,8 @@ CREATE TABLE answer (
, ,
quest_number numeric(12) NULL, quest_number numeric(12) NULL,
answer_number numeric(12) NULL, answer_number numeric(12) NULL,
candidate_id numeric(12) NULL candidate_id numeric(12) NULL,
quest_number numeric(12) NULL
); );
......
...@@ -10,7 +10,8 @@ CREATE TABLE factor_lin ( ...@@ -10,7 +10,8 @@ CREATE TABLE factor_lin (
object_created_date timestamp DEFAULT NOW() NOT NULL object_created_date timestamp DEFAULT NOW() NOT NULL
, ,
reverse_score_flag varchar(15) NULL, reverse_score_flag varchar(15) NULL,
factor_number numeric(12) NULL factor_number numeric(12) NULL,
quest_number numeric(12) NULL
); );
......
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package performa.form;
import java.util.HashMap;
import java.util.Map;
import oneit.objstore.ObjectTransaction;
import oneit.objstore.rdbms.filters.EqualsFilter;
import oneit.objstore.rdbms.filters.GreaterThanEqualFilter;
import oneit.objstore.rdbms.filters.LessThanEqualFilter;
import performa.orm.Answer;
import performa.orm.Factor;
import performa.orm.FactorQuestionLink;
import performa.orm.FactorScoreResult;
import performa.orm.Level;
/**
*
* @author nilu
*/
public class AnalysisEngine
{
public void analyseAnswers(Answer[] answers, Level level)
{
ObjectTransaction objTran = level.getTransaction();
Map<Factor, Integer> factorScoreMap = new HashMap<>();
for (Answer answer : answers)
{
FactorQuestionLink[] links = FactorQuestionLink.SearchByAll()
.andQuestion(new EqualsFilter<>(answer.getQuestion()))
.search(objTran);
int factorScore = 0;
for (FactorQuestionLink link: links)
{
Factor factor = link.getFactor();
if(factorScoreMap.containsKey(factor))
{
factorScore += factorScoreMap.get(factor);
}
if(link.getReverseScore().equals("Yes"))
{
// ipsative is stored in quest_hdr. bo not created yet
factorScore += (10 - answer.getAnswerNo());
}
else
{
factorScore += answer.getAnswerNo();
}
factorScoreMap.put(factor, factorScore);
}
}
for (Map.Entry<Factor, Integer> entrySet : factorScoreMap.entrySet())
{
Factor factor = entrySet.getKey();
Integer factorScore = entrySet.getValue();
FactorScoreResult result = FactorScoreResult.SearchByFactorScore()
.andFactor(new EqualsFilter<>(factor))
.andLevel(new EqualsFilter<>(level))
.andFromScore(new GreaterThanEqualFilter<>(factorScore))
.andToScore(new LessThanEqualFilter<>(factorScore))
.search(objTran);
int score = 0;
switch (result.getColorCode())
{
case "Green":
score = 10;
break;
case "Amber":
score = 5;
break;
case "Red":
score = 1;
break;
}
// TODO: calculate normalised score based on importance
}
}
}
\ No newline at end of file
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
<!--<SINGLEREFERENCE name="Section" type="Section" dbcol="section_number" />--> <!--<SINGLEREFERENCE name="Section" type="Section" dbcol="section_number" />-->
<SINGLEREFERENCE name="Candidate" type="Candidate" dbcol="candidate_id" /> <SINGLEREFERENCE name="Candidate" type="Candidate" dbcol="candidate_id" />
<SINGLEREFERENCE name="Question" type="Question" dbcol="quest_number" />
</TABLE> </TABLE>
......
...@@ -44,7 +44,7 @@ public class AnswerPersistenceMgr extends ObjectPersistenceMgr ...@@ -44,7 +44,7 @@ public class AnswerPersistenceMgr extends ObjectPersistenceMgr
} }
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_COLUMNS = "{PREFIX}answer.object_id as id, {PREFIX}answer.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}answer.object_CREATED_DATE as CREATED_DATE, {PREFIX}answer.quest_number, {PREFIX}answer.answer_number, {PREFIX}answer.candidate_id, {PREFIX}answer.quest_number, 1 AS commasafe ";
private String SELECT_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
...@@ -97,7 +97,8 @@ public class AnswerPersistenceMgr extends ObjectPersistenceMgr ...@@ -97,7 +97,8 @@ public class AnswerPersistenceMgr extends ObjectPersistenceMgr
if (false || !answerPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) || if (false || !answerPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!answerPSet.containsAttrib(Answer.FIELD_QuestionNo)|| !answerPSet.containsAttrib(Answer.FIELD_QuestionNo)||
!answerPSet.containsAttrib(Answer.FIELD_AnswerNo)|| !answerPSet.containsAttrib(Answer.FIELD_AnswerNo)||
!answerPSet.containsAttrib(Answer.SINGLEREFERENCE_Candidate)) !answerPSet.containsAttrib(Answer.SINGLEREFERENCE_Candidate)||
!answerPSet.containsAttrib(Answer.SINGLEREFERENCE_Question))
{ {
// We will need to retrieve it // We will need to retrieve it
idsToFetch.add (id.longValue()); idsToFetch.add (id.longValue());
...@@ -167,10 +168,10 @@ public class AnswerPersistenceMgr extends ObjectPersistenceMgr ...@@ -167,10 +168,10 @@ public class AnswerPersistenceMgr extends ObjectPersistenceMgr
{ {
int rowsUpdated = executeStatement (sqlMgr, int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}answer " + "UPDATE {PREFIX}answer " +
"SET quest_number = ?, answer_number = ?, candidate_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " + "SET quest_number = ?, answer_number = ?, candidate_id = ? , quest_number = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE answer.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ", "WHERE answer.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_QuestionNo.getForSQL(dummyQuestionNo, answerPSet.getAttrib (Answer.FIELD_QuestionNo))).listEntry (HELPER_AnswerNo.getForSQL(dummyAnswerNo, answerPSet.getAttrib (Answer.FIELD_AnswerNo))).listEntry (SQLManager.CheckNull((Long)(answerPSet.getAttrib (Answer.SINGLEREFERENCE_Candidate)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray()); CollectionUtils.listEntry (HELPER_QuestionNo.getForSQL(dummyQuestionNo, answerPSet.getAttrib (Answer.FIELD_QuestionNo))).listEntry (HELPER_AnswerNo.getForSQL(dummyAnswerNo, answerPSet.getAttrib (Answer.FIELD_AnswerNo))).listEntry (SQLManager.CheckNull((Long)(answerPSet.getAttrib (Answer.SINGLEREFERENCE_Candidate)))).listEntry (SQLManager.CheckNull((Long)(answerPSet.getAttrib (Answer.SINGLEREFERENCE_Question)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
if (rowsUpdated != 1) if (rowsUpdated != 1)
{ {
...@@ -388,6 +389,7 @@ public class AnswerPersistenceMgr extends ObjectPersistenceMgr ...@@ -388,6 +389,7 @@ public class AnswerPersistenceMgr extends ObjectPersistenceMgr
answerPSet.setAttrib(Answer.FIELD_AnswerNo, HELPER_AnswerNo.getFromRS(dummyAnswerNo, r, "answer_number")); answerPSet.setAttrib(Answer.FIELD_AnswerNo, HELPER_AnswerNo.getFromRS(dummyAnswerNo, r, "answer_number"));
answerPSet.setAttrib(Answer.SINGLEREFERENCE_Candidate, r.getObject ("candidate_id")); answerPSet.setAttrib(Answer.SINGLEREFERENCE_Candidate, r.getObject ("candidate_id"));
answerPSet.setAttrib(Answer.SINGLEREFERENCE_Question, r.getObject ("quest_number"));
} }
...@@ -404,10 +406,10 @@ public class AnswerPersistenceMgr extends ObjectPersistenceMgr ...@@ -404,10 +406,10 @@ public class AnswerPersistenceMgr extends ObjectPersistenceMgr
{ {
executeStatement (sqlMgr, executeStatement (sqlMgr,
"INSERT INTO {PREFIX}answer " + "INSERT INTO {PREFIX}answer " +
" (quest_number, answer_number, candidate_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " + " (quest_number, answer_number, candidate_id, quest_number, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " + "VALUES " +
" (?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")", " (?, ?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_QuestionNo.getForSQL(dummyQuestionNo, answerPSet.getAttrib (Answer.FIELD_QuestionNo))).listEntry (HELPER_AnswerNo.getForSQL(dummyAnswerNo, answerPSet.getAttrib (Answer.FIELD_AnswerNo))) .listEntry (SQLManager.CheckNull((Long)(answerPSet.getAttrib (Answer.SINGLEREFERENCE_Candidate)))) .listEntry (objectID.longID ()).toList().toArray()); CollectionUtils.listEntry (HELPER_QuestionNo.getForSQL(dummyQuestionNo, answerPSet.getAttrib (Answer.FIELD_QuestionNo))).listEntry (HELPER_AnswerNo.getForSQL(dummyAnswerNo, answerPSet.getAttrib (Answer.FIELD_AnswerNo))) .listEntry (SQLManager.CheckNull((Long)(answerPSet.getAttrib (Answer.SINGLEREFERENCE_Candidate)))).listEntry (SQLManager.CheckNull((Long)(answerPSet.getAttrib (Answer.SINGLEREFERENCE_Question)))) .listEntry (objectID.longID ()).toList().toArray());
answerPSet.setStatus (PersistentSetStatus.PROCESSED); answerPSet.setStatus (PersistentSetStatus.PROCESSED);
} }
......
...@@ -41,6 +41,7 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -41,6 +41,7 @@ public abstract class BaseAnswer extends BaseBusinessClass
public static final String FIELD_QuestionNo = "QuestionNo"; public static final String FIELD_QuestionNo = "QuestionNo";
public static final String FIELD_AnswerNo = "AnswerNo"; public static final String FIELD_AnswerNo = "AnswerNo";
public static final String SINGLEREFERENCE_Candidate = "Candidate"; public static final String SINGLEREFERENCE_Candidate = "Candidate";
public static final String SINGLEREFERENCE_Question = "Question";
// Static constants corresponding to searches // Static constants corresponding to searches
...@@ -57,6 +58,7 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -57,6 +58,7 @@ public abstract class BaseAnswer extends BaseBusinessClass
// Private attributes corresponding to single references // Private attributes corresponding to single references
private SingleAssociation<Answer, Candidate> _Candidate; private SingleAssociation<Answer, Candidate> _Candidate;
private SingleAssociation<Answer, Question> _Question;
// Private attributes corresponding to multiple references // Private attributes corresponding to multiple references
...@@ -82,6 +84,7 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -82,6 +84,7 @@ public abstract class BaseAnswer extends BaseBusinessClass
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping")); Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
setupAssocMetaData_Candidate(); setupAssocMetaData_Candidate();
setupAssocMetaData_Question();
FIELD_QuestionNo_Validators = (AttributeValidator[])setupAttribMetaData_QuestionNo(validatorMapping).toArray (new AttributeValidator[0]); FIELD_QuestionNo_Validators = (AttributeValidator[])setupAttribMetaData_QuestionNo(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_AnswerNo_Validators = (AttributeValidator[])setupAttribMetaData_AnswerNo(validatorMapping).toArray (new AttributeValidator[0]); FIELD_AnswerNo_Validators = (AttributeValidator[])setupAttribMetaData_AnswerNo(validatorMapping).toArray (new AttributeValidator[0]);
...@@ -113,6 +116,20 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -113,6 +116,20 @@ public abstract class BaseAnswer extends BaseBusinessClass
// Meta Info setup // Meta Info setup
private static void setupAssocMetaData_Question()
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "quest_number");
metaInfo.put ("name", "Question");
metaInfo.put ("type", "Question");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Answer.Question:", metaInfo);
ATTRIBUTES_METADATA_Answer.put (SINGLEREFERENCE_Question, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static List setupAttribMetaData_QuestionNo(Map validatorMapping) private static List setupAttribMetaData_QuestionNo(Map validatorMapping)
{ {
Map metaInfo = new HashMap (); Map metaInfo = new HashMap ();
...@@ -186,6 +203,7 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -186,6 +203,7 @@ public abstract class BaseAnswer extends BaseBusinessClass
super._initialiseAssociations (); super._initialiseAssociations ();
_Candidate = new SingleAssociation<Answer, Candidate> (this, SINGLEREFERENCE_Candidate, null, Candidate.REFERENCE_Candidate, "answer"); _Candidate = new SingleAssociation<Answer, Candidate> (this, SINGLEREFERENCE_Candidate, null, Candidate.REFERENCE_Candidate, "answer");
_Question = new SingleAssociation<Answer, Question> (this, SINGLEREFERENCE_Question, null, Question.REFERENCE_Question, "answer");
} }
...@@ -196,6 +214,7 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -196,6 +214,7 @@ public abstract class BaseAnswer extends BaseBusinessClass
super.initialiseReference (); super.initialiseReference ();
_Candidate = new SingleAssociation<Answer, Candidate> (this, SINGLEREFERENCE_Candidate, null, Candidate.REFERENCE_Candidate, "answer"); _Candidate = new SingleAssociation<Answer, Candidate> (this, SINGLEREFERENCE_Candidate, null, Candidate.REFERENCE_Candidate, "answer");
_Question = new SingleAssociation<Answer, Question> (this, SINGLEREFERENCE_Question, null, Question.REFERENCE_Question, "answer");
return this; return this;
...@@ -411,6 +430,8 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -411,6 +430,8 @@ public abstract class BaseAnswer extends BaseBusinessClass
result.add("Candidate"); result.add("Candidate");
result.add("Question");
return result; return result;
} }
...@@ -425,6 +446,9 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -425,6 +446,9 @@ public abstract class BaseAnswer extends BaseBusinessClass
else if (assocName.equals (SINGLEREFERENCE_Candidate)) else if (assocName.equals (SINGLEREFERENCE_Candidate))
{ {
return _Candidate.getReferencedType (); return _Candidate.getReferencedType ();
}else if (assocName.equals (SINGLEREFERENCE_Question))
{
return _Question.getReferencedType ();
} }
else else
{ {
...@@ -442,6 +466,9 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -442,6 +466,9 @@ public abstract class BaseAnswer extends BaseBusinessClass
else if (assocName.equals (SINGLEREFERENCE_Candidate)) else if (assocName.equals (SINGLEREFERENCE_Candidate))
{ {
return null ; return null ;
}else if (assocName.equals (SINGLEREFERENCE_Question))
{
return null ;
} }
else else
{ {
...@@ -459,6 +486,9 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -459,6 +486,9 @@ public abstract class BaseAnswer extends BaseBusinessClass
else if (assocName.equals (SINGLEREFERENCE_Candidate)) else if (assocName.equals (SINGLEREFERENCE_Candidate))
{ {
return getCandidate (); return getCandidate ();
}else if (assocName.equals (SINGLEREFERENCE_Question))
{
return getQuestion ();
} }
else else
{ {
...@@ -476,6 +506,9 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -476,6 +506,9 @@ public abstract class BaseAnswer extends BaseBusinessClass
else if (assocName.equals (SINGLEREFERENCE_Candidate)) else if (assocName.equals (SINGLEREFERENCE_Candidate))
{ {
return getCandidate (getType); return getCandidate (getType);
}else if (assocName.equals (SINGLEREFERENCE_Question))
{
return getQuestion (getType);
} }
else else
{ {
...@@ -493,6 +526,9 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -493,6 +526,9 @@ public abstract class BaseAnswer extends BaseBusinessClass
else if (assocName.equals (SINGLEREFERENCE_Candidate)) else if (assocName.equals (SINGLEREFERENCE_Candidate))
{ {
return getCandidateID (); return getCandidateID ();
}else if (assocName.equals (SINGLEREFERENCE_Question))
{
return getQuestionID ();
} }
else else
{ {
...@@ -510,6 +546,9 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -510,6 +546,9 @@ public abstract class BaseAnswer extends BaseBusinessClass
else if (assocName.equals (SINGLEREFERENCE_Candidate)) else if (assocName.equals (SINGLEREFERENCE_Candidate))
{ {
setCandidate ((Candidate)(newValue)); setCandidate ((Candidate)(newValue));
}else if (assocName.equals (SINGLEREFERENCE_Question))
{
setQuestion ((Question)(newValue));
} }
else else
{ {
...@@ -614,6 +653,100 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -614,6 +653,100 @@ public abstract class BaseAnswer extends BaseBusinessClass
} }
/** /**
* Get the reference Question
*/
public Question getQuestion () throws StorageException
{
assertValid();
try
{
return (Question)(_Question.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in Answer:", this.getObjectID (), ", was trying to get Question:", getQuestionID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _Question.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Question getQuestion (Get getType) throws StorageException
{
assertValid();
return _Question.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getQuestionID ()
{
assertValid();
if (_Question == null)
{
return null;
}
else
{
return _Question.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 preQuestionChange (Question newQuestion) 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 postQuestionChange () throws FieldException
{
}
public FieldWriteability getWriteability_Question ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference Question. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setQuestion (Question newQuestion) throws StorageException, FieldException
{
if (_Question.wouldReferencedChange (newQuestion))
{
assertValid();
Debug.assertion (getWriteability_Question () != FieldWriteability.FALSE, "Assoc Question is not writeable");
preQuestionChange (newQuestion);
_Question.set (newQuestion);
postQuestionChange ();
}
}
/**
* 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()
...@@ -774,6 +907,7 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -774,6 +907,7 @@ public abstract class BaseAnswer extends BaseBusinessClass
answerPSet.setAttrib (FIELD_QuestionNo, HELPER_QuestionNo.toObject (_QuestionNo)); // answerPSet.setAttrib (FIELD_QuestionNo, HELPER_QuestionNo.toObject (_QuestionNo)); //
answerPSet.setAttrib (FIELD_AnswerNo, HELPER_AnswerNo.toObject (_AnswerNo)); // answerPSet.setAttrib (FIELD_AnswerNo, HELPER_AnswerNo.toObject (_AnswerNo)); //
_Candidate.getPersistentSets (allSets); _Candidate.getPersistentSets (allSets);
_Question.getPersistentSets (allSets);
} }
...@@ -791,6 +925,7 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -791,6 +925,7 @@ public abstract class BaseAnswer extends BaseBusinessClass
_QuestionNo = (Integer)(HELPER_QuestionNo.fromObject (_QuestionNo, answerPSet.getAttrib (FIELD_QuestionNo))); // _QuestionNo = (Integer)(HELPER_QuestionNo.fromObject (_QuestionNo, answerPSet.getAttrib (FIELD_QuestionNo))); //
_AnswerNo = (Integer)(HELPER_AnswerNo.fromObject (_AnswerNo, answerPSet.getAttrib (FIELD_AnswerNo))); // _AnswerNo = (Integer)(HELPER_AnswerNo.fromObject (_AnswerNo, answerPSet.getAttrib (FIELD_AnswerNo))); //
_Candidate.setFromPersistentSets (objectID, allSets); _Candidate.setFromPersistentSets (objectID, allSets);
_Question.setFromPersistentSets (objectID, allSets);
} }
...@@ -858,6 +993,7 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -858,6 +993,7 @@ public abstract class BaseAnswer extends BaseBusinessClass
BaseAnswer sourceAnswer = (BaseAnswer)(source); BaseAnswer sourceAnswer = (BaseAnswer)(source);
_Candidate.copyFrom (sourceAnswer._Candidate, linkToGhosts); _Candidate.copyFrom (sourceAnswer._Candidate, linkToGhosts);
_Question.copyFrom (sourceAnswer._Question, linkToGhosts);
} }
} }
...@@ -897,6 +1033,7 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -897,6 +1033,7 @@ public abstract class BaseAnswer extends BaseBusinessClass
_QuestionNo = (Integer)(HELPER_QuestionNo.readExternal (_QuestionNo, vals.get(FIELD_QuestionNo))); // _QuestionNo = (Integer)(HELPER_QuestionNo.readExternal (_QuestionNo, vals.get(FIELD_QuestionNo))); //
_AnswerNo = (Integer)(HELPER_AnswerNo.readExternal (_AnswerNo, vals.get(FIELD_AnswerNo))); // _AnswerNo = (Integer)(HELPER_AnswerNo.readExternal (_AnswerNo, vals.get(FIELD_AnswerNo))); //
_Candidate.readExternalData(vals.get(SINGLEREFERENCE_Candidate)); _Candidate.readExternalData(vals.get(SINGLEREFERENCE_Candidate));
_Question.readExternalData(vals.get(SINGLEREFERENCE_Question));
} }
...@@ -911,6 +1048,7 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -911,6 +1048,7 @@ public abstract class BaseAnswer extends BaseBusinessClass
vals.put (FIELD_QuestionNo, HELPER_QuestionNo.writeExternal (_QuestionNo)); vals.put (FIELD_QuestionNo, HELPER_QuestionNo.writeExternal (_QuestionNo));
vals.put (FIELD_AnswerNo, HELPER_AnswerNo.writeExternal (_AnswerNo)); vals.put (FIELD_AnswerNo, HELPER_AnswerNo.writeExternal (_AnswerNo));
vals.put (SINGLEREFERENCE_Candidate, _Candidate.writeExternalData()); vals.put (SINGLEREFERENCE_Candidate, _Candidate.writeExternalData());
vals.put (SINGLEREFERENCE_Question, _Question.writeExternalData());
} }
...@@ -935,6 +1073,7 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -935,6 +1073,7 @@ public abstract class BaseAnswer extends BaseBusinessClass
// Compare single assocs // Compare single assocs
_Candidate.compare (otherAnswer._Candidate, listener); _Candidate.compare (otherAnswer._Candidate, listener);
_Question.compare (otherAnswer._Question, listener);
// Compare multiple assocs // Compare multiple assocs
...@@ -958,6 +1097,7 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -958,6 +1097,7 @@ public abstract class BaseAnswer extends BaseBusinessClass
visitor.visitField(this, FIELD_QuestionNo, HELPER_QuestionNo.toObject(getQuestionNo())); visitor.visitField(this, FIELD_QuestionNo, HELPER_QuestionNo.toObject(getQuestionNo()));
visitor.visitField(this, FIELD_AnswerNo, HELPER_AnswerNo.toObject(getAnswerNo())); visitor.visitField(this, FIELD_AnswerNo, HELPER_AnswerNo.toObject(getAnswerNo()));
visitor.visitAssociation (_Candidate); visitor.visitAssociation (_Candidate);
visitor.visitAssociation (_Question);
} }
...@@ -970,6 +1110,10 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -970,6 +1110,10 @@ public abstract class BaseAnswer extends BaseBusinessClass
{ {
visitor.visit (_Candidate); visitor.visit (_Candidate);
} }
if (scope.includes (_Question))
{
visitor.visit (_Question);
}
} }
...@@ -1007,6 +1151,10 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -1007,6 +1151,10 @@ public abstract class BaseAnswer extends BaseBusinessClass
{ {
return filter.matches (getCandidate ()); return filter.matches (getCandidate ());
} }
else if (attribName.equals (SINGLEREFERENCE_Question))
{
return filter.matches (getQuestion ());
}
else else
{ {
return super.testFilter (attribName, filter); return super.testFilter (attribName, filter);
...@@ -1104,6 +1252,10 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -1104,6 +1252,10 @@ public abstract class BaseAnswer extends BaseBusinessClass
{ {
return getWriteability_Candidate (); return getWriteability_Candidate ();
} }
else if (fieldName.equals (SINGLEREFERENCE_Question))
{
return getWriteability_Question ();
}
else else
{ {
return super.getWriteable (fieldName); return super.getWriteable (fieldName);
...@@ -1285,6 +1437,10 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -1285,6 +1437,10 @@ public abstract class BaseAnswer extends BaseBusinessClass
{ {
return toCandidate (); return toCandidate ();
} }
if (name.equals ("Question"))
{
return toQuestion ();
}
return super.to(name); return super.to(name);
...@@ -1300,6 +1456,12 @@ public abstract class BaseAnswer extends BaseBusinessClass ...@@ -1300,6 +1456,12 @@ public abstract class BaseAnswer extends BaseBusinessClass
{ {
return Candidate.REFERENCE_Candidate.new CandidatePipeLineFactory<From, Candidate> (this, new ORMSingleAssocPipe<Me, Candidate>(SINGLEREFERENCE_Candidate, filter)); return Candidate.REFERENCE_Candidate.new CandidatePipeLineFactory<From, Candidate> (this, new ORMSingleAssocPipe<Me, Candidate>(SINGLEREFERENCE_Candidate, filter));
} }
public Question.QuestionPipeLineFactory<From, Question> toQuestion () { return toQuestion (Filter.ALL); }
public Question.QuestionPipeLineFactory<From, Question> toQuestion (Filter<Question> filter)
{
return Question.REFERENCE_Question.new QuestionPipeLineFactory<From, Question> (this, new ORMSingleAssocPipe<Me, Question>(SINGLEREFERENCE_Question, filter));
}
} }
...@@ -1345,6 +1507,20 @@ class DummyAnswer extends Answer ...@@ -1345,6 +1507,20 @@ class DummyAnswer extends Answer
return Candidate.DUMMY_Candidate.getObjectID(); return Candidate.DUMMY_Candidate.getObjectID();
} }
public Question getQuestion () throws StorageException
{
return (Question)(Question.DUMMY_Question);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getQuestionID ()
{
return Question.DUMMY_Question.getObjectID();
}
} }
...@@ -40,8 +40,10 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass ...@@ -40,8 +40,10 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
public static final String FIELD_ReverseScore = "ReverseScore"; public static final String FIELD_ReverseScore = "ReverseScore";
public static final String SINGLEREFERENCE_Factor = "Factor"; public static final String SINGLEREFERENCE_Factor = "Factor";
public static final String SINGLEREFERENCE_Question = "Question";
// Static constants corresponding to searches // Static constants corresponding to searches
public static final String SEARCH_All = "All";
// Static constants corresponding to attribute helpers // Static constants corresponding to attribute helpers
...@@ -54,6 +56,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass ...@@ -54,6 +56,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
// Private attributes corresponding to single references // Private attributes corresponding to single references
private SingleAssociation<FactorQuestionLink, Factor> _Factor; private SingleAssociation<FactorQuestionLink, Factor> _Factor;
private SingleAssociation<FactorQuestionLink, Question> _Question;
// Private attributes corresponding to multiple references // Private attributes corresponding to multiple references
...@@ -78,6 +81,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass ...@@ -78,6 +81,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping")); Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
setupAssocMetaData_Factor(); setupAssocMetaData_Factor();
setupAssocMetaData_Question();
FIELD_ReverseScore_Validators = (AttributeValidator[])setupAttribMetaData_ReverseScore(validatorMapping).toArray (new AttributeValidator[0]); FIELD_ReverseScore_Validators = (AttributeValidator[])setupAttribMetaData_ReverseScore(validatorMapping).toArray (new AttributeValidator[0]);
...@@ -108,6 +112,20 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass ...@@ -108,6 +112,20 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
// Meta Info setup // Meta Info setup
private static void setupAssocMetaData_Question()
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "quest_number");
metaInfo.put ("name", "Question");
metaInfo.put ("type", "Question");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for FactorQuestionLink.Question:", metaInfo);
ATTRIBUTES_METADATA_FactorQuestionLink.put (SINGLEREFERENCE_Question, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static List setupAttribMetaData_ReverseScore(Map validatorMapping) private static List setupAttribMetaData_ReverseScore(Map validatorMapping)
{ {
Map metaInfo = new HashMap (); Map metaInfo = new HashMap ();
...@@ -163,6 +181,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass ...@@ -163,6 +181,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
super._initialiseAssociations (); super._initialiseAssociations ();
_Factor = new SingleAssociation<FactorQuestionLink, Factor> (this, SINGLEREFERENCE_Factor, null, Factor.REFERENCE_Factor, "factor_lin"); _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");
} }
...@@ -173,6 +192,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass ...@@ -173,6 +192,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
super.initialiseReference (); super.initialiseReference ();
_Factor = new SingleAssociation<FactorQuestionLink, Factor> (this, SINGLEREFERENCE_Factor, null, Factor.REFERENCE_Factor, "factor_lin"); _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");
return this; return this;
...@@ -290,6 +310,8 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass ...@@ -290,6 +310,8 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
result.add("Factor"); result.add("Factor");
result.add("Question");
return result; return result;
} }
...@@ -304,6 +326,9 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass ...@@ -304,6 +326,9 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
else if (assocName.equals (SINGLEREFERENCE_Factor)) else if (assocName.equals (SINGLEREFERENCE_Factor))
{ {
return _Factor.getReferencedType (); return _Factor.getReferencedType ();
}else if (assocName.equals (SINGLEREFERENCE_Question))
{
return _Question.getReferencedType ();
} }
else else
{ {
...@@ -321,6 +346,9 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass ...@@ -321,6 +346,9 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
else if (assocName.equals (SINGLEREFERENCE_Factor)) else if (assocName.equals (SINGLEREFERENCE_Factor))
{ {
return null ; return null ;
}else if (assocName.equals (SINGLEREFERENCE_Question))
{
return null ;
} }
else else
{ {
...@@ -338,6 +366,9 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass ...@@ -338,6 +366,9 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
else if (assocName.equals (SINGLEREFERENCE_Factor)) else if (assocName.equals (SINGLEREFERENCE_Factor))
{ {
return getFactor (); return getFactor ();
}else if (assocName.equals (SINGLEREFERENCE_Question))
{
return getQuestion ();
} }
else else
{ {
...@@ -355,6 +386,9 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass ...@@ -355,6 +386,9 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
else if (assocName.equals (SINGLEREFERENCE_Factor)) else if (assocName.equals (SINGLEREFERENCE_Factor))
{ {
return getFactor (getType); return getFactor (getType);
}else if (assocName.equals (SINGLEREFERENCE_Question))
{
return getQuestion (getType);
} }
else else
{ {
...@@ -372,6 +406,9 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass ...@@ -372,6 +406,9 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
else if (assocName.equals (SINGLEREFERENCE_Factor)) else if (assocName.equals (SINGLEREFERENCE_Factor))
{ {
return getFactorID (); return getFactorID ();
}else if (assocName.equals (SINGLEREFERENCE_Question))
{
return getQuestionID ();
} }
else else
{ {
...@@ -389,6 +426,9 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass ...@@ -389,6 +426,9 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
else if (assocName.equals (SINGLEREFERENCE_Factor)) else if (assocName.equals (SINGLEREFERENCE_Factor))
{ {
setFactor ((Factor)(newValue)); setFactor ((Factor)(newValue));
}else if (assocName.equals (SINGLEREFERENCE_Question))
{
setQuestion ((Question)(newValue));
} }
else else
{ {
...@@ -493,6 +533,100 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass ...@@ -493,6 +533,100 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
} }
/** /**
* Get the reference Question
*/
public Question getQuestion () throws StorageException
{
assertValid();
try
{
return (Question)(_Question.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in FactorQuestionLink:", this.getObjectID (), ", was trying to get Question:", getQuestionID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _Question.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Question getQuestion (Get getType) throws StorageException
{
assertValid();
return _Question.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getQuestionID ()
{
assertValid();
if (_Question == null)
{
return null;
}
else
{
return _Question.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 preQuestionChange (Question newQuestion) 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 postQuestionChange () throws FieldException
{
}
public FieldWriteability getWriteability_Question ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference Question. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setQuestion (Question newQuestion) throws StorageException, FieldException
{
if (_Question.wouldReferencedChange (newQuestion))
{
assertValid();
Debug.assertion (getWriteability_Question () != FieldWriteability.FALSE, "Assoc Question is not writeable");
preQuestionChange (newQuestion);
_Question.set (newQuestion);
postQuestionChange ();
}
}
/**
* 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()
...@@ -652,6 +786,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass ...@@ -652,6 +786,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
factor_linPSet.setAttrib (FIELD_ObjectID, myID); factor_linPSet.setAttrib (FIELD_ObjectID, myID);
factor_linPSet.setAttrib (FIELD_ReverseScore, HELPER_ReverseScore.toObject (_ReverseScore)); // factor_linPSet.setAttrib (FIELD_ReverseScore, HELPER_ReverseScore.toObject (_ReverseScore)); //
_Factor.getPersistentSets (allSets); _Factor.getPersistentSets (allSets);
_Question.getPersistentSets (allSets);
} }
...@@ -668,6 +803,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass ...@@ -668,6 +803,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
_ReverseScore = (String)(HELPER_ReverseScore.fromObject (_ReverseScore, factor_linPSet.getAttrib (FIELD_ReverseScore))); // _ReverseScore = (String)(HELPER_ReverseScore.fromObject (_ReverseScore, factor_linPSet.getAttrib (FIELD_ReverseScore))); //
_Factor.setFromPersistentSets (objectID, allSets); _Factor.setFromPersistentSets (objectID, allSets);
_Question.setFromPersistentSets (objectID, allSets);
} }
...@@ -725,6 +861,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass ...@@ -725,6 +861,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
BaseFactorQuestionLink sourceFactorQuestionLink = (BaseFactorQuestionLink)(source); BaseFactorQuestionLink sourceFactorQuestionLink = (BaseFactorQuestionLink)(source);
_Factor.copyFrom (sourceFactorQuestionLink._Factor, linkToGhosts); _Factor.copyFrom (sourceFactorQuestionLink._Factor, linkToGhosts);
_Question.copyFrom (sourceFactorQuestionLink._Question, linkToGhosts);
} }
} }
...@@ -763,6 +900,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass ...@@ -763,6 +900,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
_ReverseScore = (String)(HELPER_ReverseScore.readExternal (_ReverseScore, vals.get(FIELD_ReverseScore))); // _ReverseScore = (String)(HELPER_ReverseScore.readExternal (_ReverseScore, vals.get(FIELD_ReverseScore))); //
_Factor.readExternalData(vals.get(SINGLEREFERENCE_Factor)); _Factor.readExternalData(vals.get(SINGLEREFERENCE_Factor));
_Question.readExternalData(vals.get(SINGLEREFERENCE_Question));
} }
...@@ -776,6 +914,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass ...@@ -776,6 +914,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
vals.put (FIELD_ReverseScore, HELPER_ReverseScore.writeExternal (_ReverseScore)); vals.put (FIELD_ReverseScore, HELPER_ReverseScore.writeExternal (_ReverseScore));
vals.put (SINGLEREFERENCE_Factor, _Factor.writeExternalData()); vals.put (SINGLEREFERENCE_Factor, _Factor.writeExternalData());
vals.put (SINGLEREFERENCE_Question, _Question.writeExternalData());
} }
...@@ -796,6 +935,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass ...@@ -796,6 +935,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
// Compare single assocs // Compare single assocs
_Factor.compare (otherFactorQuestionLink._Factor, listener); _Factor.compare (otherFactorQuestionLink._Factor, listener);
_Question.compare (otherFactorQuestionLink._Question, listener);
// Compare multiple assocs // Compare multiple assocs
...@@ -818,6 +958,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass ...@@ -818,6 +958,7 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
visitor.visitField(this, FIELD_ReverseScore, HELPER_ReverseScore.toObject(getReverseScore())); visitor.visitField(this, FIELD_ReverseScore, HELPER_ReverseScore.toObject(getReverseScore()));
visitor.visitAssociation (_Factor); visitor.visitAssociation (_Factor);
visitor.visitAssociation (_Question);
} }
...@@ -830,6 +971,10 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass ...@@ -830,6 +971,10 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
{ {
visitor.visit (_Factor); visitor.visit (_Factor);
} }
if (scope.includes (_Question))
{
visitor.visit (_Question);
}
} }
...@@ -863,6 +1008,10 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass ...@@ -863,6 +1008,10 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
{ {
return filter.matches (getFactor ()); return filter.matches (getFactor ());
} }
else if (attribName.equals (SINGLEREFERENCE_Question))
{
return filter.matches (getQuestion ());
}
else else
{ {
return super.testFilter (attribName, filter); return super.testFilter (attribName, filter);
...@@ -870,6 +1019,75 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass ...@@ -870,6 +1019,75 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
} }
public static SearchAll SearchByAll () { return new SearchAll (); }
public static class SearchAll extends SearchObject<FactorQuestionLink>
{
public SearchAll andObjectID (QueryFilter<Long> filter)
{
filter.addFilter (context, "factor_lin.object_id", FIELD_ObjectID);
return this;
}
public SearchAll andObjectCreated (QueryFilter<Date> filter)
{
filter.addFilter (context, "factor_lin.object_created_date", FIELD_ObjectCreated);
return this;
}
public SearchAll andObjectLastModified (QueryFilter<Date> filter)
{
filter.addFilter (context, "factor_lin.object_last_updated_date", FIELD_ObjectLastModified);
return this;
}
public SearchAll andReverseScore (QueryFilter<String> filter)
{
filter.addFilter (context, "factor_lin.reverse_score_flag", "ReverseScore");
return this;
}
public SearchAll andFactor (QueryFilter<Factor> filter)
{
filter.addFilter (context, "factor_lin.factor_number", "Factor");
return this;
}
public SearchAll andQuestion (QueryFilter<Question> filter)
{
filter.addFilter (context, "factor_lin.quest_number", "Question");
return this;
}
public FactorQuestionLink[]
search (ObjectTransaction transaction) throws StorageException
{
BaseBusinessClass[] results = super.search (transaction, REFERENCE_FactorQuestionLink, SEARCH_All, criteria);
Set<FactorQuestionLink> typedResults = new LinkedHashSet <FactorQuestionLink> ();
for (BaseBusinessClass bbcResult : results)
{
FactorQuestionLink aResult = (FactorQuestionLink)bbcResult;
typedResults.add (aResult);
}
return ObjstoreUtils.removeDeleted(transaction, typedResults).toArray (new FactorQuestionLink[0]);
}
}
public static FactorQuestionLink[]
searchAll (ObjectTransaction transaction) throws StorageException
{
return SearchByAll ()
.search (transaction);
}
public Object getAttribute (String attribName) public Object getAttribute (String attribName)
...@@ -944,6 +1162,10 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass ...@@ -944,6 +1162,10 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
{ {
return getWriteability_Factor (); return getWriteability_Factor ();
} }
else if (fieldName.equals (SINGLEREFERENCE_Question))
{
return getWriteability_Question ();
}
else else
{ {
return super.getWriteable (fieldName); return super.getWriteable (fieldName);
...@@ -1097,6 +1319,10 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass ...@@ -1097,6 +1319,10 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
{ {
return toFactor (); return toFactor ();
} }
if (name.equals ("Question"))
{
return toQuestion ();
}
return super.to(name); return super.to(name);
...@@ -1110,6 +1336,12 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass ...@@ -1110,6 +1336,12 @@ public abstract class BaseFactorQuestionLink extends BaseBusinessClass
{ {
return Factor.REFERENCE_Factor.new FactorPipeLineFactory<From, Factor> (this, new ORMSingleAssocPipe<Me, Factor>(SINGLEREFERENCE_Factor, filter)); return Factor.REFERENCE_Factor.new FactorPipeLineFactory<From, Factor> (this, new ORMSingleAssocPipe<Me, Factor>(SINGLEREFERENCE_Factor, filter));
} }
public Question.QuestionPipeLineFactory<From, Question> toQuestion () { return toQuestion (Filter.ALL); }
public Question.QuestionPipeLineFactory<From, Question> toQuestion (Filter<Question> filter)
{
return Question.REFERENCE_Question.new QuestionPipeLineFactory<From, Question> (this, new ORMSingleAssocPipe<Me, Question>(SINGLEREFERENCE_Question, filter));
}
} }
...@@ -1155,6 +1387,20 @@ class DummyFactorQuestionLink extends FactorQuestionLink ...@@ -1155,6 +1387,20 @@ class DummyFactorQuestionLink extends FactorQuestionLink
return Factor.DUMMY_Factor.getObjectID(); return Factor.DUMMY_Factor.getObjectID();
} }
public Question getQuestion () throws StorageException
{
return (Question)(Question.DUMMY_Question);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getQuestionID ()
{
return Question.DUMMY_Question.getObjectID();
}
} }
...@@ -46,6 +46,8 @@ public abstract class BaseFactorScoreResult extends BaseBusinessClass ...@@ -46,6 +46,8 @@ public abstract class BaseFactorScoreResult extends BaseBusinessClass
public static final String SINGLEREFERENCE_Level = "Level"; public static final String SINGLEREFERENCE_Level = "Level";
// Static constants corresponding to searches // Static constants corresponding to searches
public static final String SEARCH_All = "All";
public static final String SEARCH_FactorScore = "FactorScore";
// Static constants corresponding to attribute helpers // Static constants corresponding to attribute helpers
...@@ -1454,6 +1456,178 @@ public abstract class BaseFactorScoreResult extends BaseBusinessClass ...@@ -1454,6 +1456,178 @@ public abstract class BaseFactorScoreResult extends BaseBusinessClass
} }
public static SearchAll SearchByAll () { return new SearchAll (); }
public static class SearchAll extends SearchObject<FactorScoreResult>
{
public SearchAll andObjectID (QueryFilter<Long> filter)
{
filter.addFilter (context, "level_factor.object_id", FIELD_ObjectID);
return this;
}
public SearchAll andObjectCreated (QueryFilter<Date> filter)
{
filter.addFilter (context, "level_factor.object_created_date", FIELD_ObjectCreated);
return this;
}
public SearchAll andObjectLastModified (QueryFilter<Date> filter)
{
filter.addFilter (context, "level_factor.object_last_updated_date", FIELD_ObjectLastModified);
return this;
}
public SearchAll andFromScore (QueryFilter<Integer> filter)
{
filter.addFilter (context, "level_factor.from_score", "FromScore");
return this;
}
public SearchAll andToScore (QueryFilter<Integer> filter)
{
filter.addFilter (context, "level_factor.to_score", "ToScore");
return this;
}
public SearchAll andNarrativeCode (QueryFilter<String> filter)
{
filter.addFilter (context, "level_factor.narrative_code", "NarrativeCode");
return this;
}
public SearchAll andColorCode (QueryFilter<String> filter)
{
filter.addFilter (context, "level_factor.color_code", "ColorCode");
return this;
}
public SearchAll andFactor (QueryFilter<Factor> filter)
{
filter.addFilter (context, "level_factor.factor_number", "Factor");
return this;
}
public SearchAll andLevel (QueryFilter<Level> filter)
{
filter.addFilter (context, "level_factor.level_number", "Level");
return this;
}
public FactorScoreResult[]
search (ObjectTransaction transaction) throws StorageException
{
BaseBusinessClass[] results = super.search (transaction, REFERENCE_FactorScoreResult, SEARCH_All, criteria);
Set<FactorScoreResult> typedResults = new LinkedHashSet <FactorScoreResult> ();
for (BaseBusinessClass bbcResult : results)
{
FactorScoreResult aResult = (FactorScoreResult)bbcResult;
typedResults.add (aResult);
}
return ObjstoreUtils.removeDeleted(transaction, typedResults).toArray (new FactorScoreResult[0]);
}
}
public static FactorScoreResult[]
searchAll (ObjectTransaction transaction) throws StorageException
{
return SearchByAll ()
.search (transaction);
}
public static SearchFactorScore SearchByFactorScore () { return new SearchFactorScore (); }
public static class SearchFactorScore extends SearchObject<FactorScoreResult>
{
public SearchFactorScore andObjectID (QueryFilter<Long> filter)
{
filter.addFilter (context, "level_factor.object_id", FIELD_ObjectID);
return this;
}
public SearchFactorScore andObjectCreated (QueryFilter<Date> filter)
{
filter.addFilter (context, "level_factor.object_created_date", FIELD_ObjectCreated);
return this;
}
public SearchFactorScore andObjectLastModified (QueryFilter<Date> filter)
{
filter.addFilter (context, "level_factor.object_last_updated_date", FIELD_ObjectLastModified);
return this;
}
public SearchFactorScore andFromScore (QueryFilter<Integer> filter)
{
filter.addFilter (context, "level_factor.from_score", "FromScore");
return this;
}
public SearchFactorScore andToScore (QueryFilter<Integer> filter)
{
filter.addFilter (context, "level_factor.to_score", "ToScore");
return this;
}
public SearchFactorScore andNarrativeCode (QueryFilter<String> filter)
{
filter.addFilter (context, "level_factor.narrative_code", "NarrativeCode");
return this;
}
public SearchFactorScore andColorCode (QueryFilter<String> filter)
{
filter.addFilter (context, "level_factor.color_code", "ColorCode");
return this;
}
public SearchFactorScore andFactor (QueryFilter<Factor> filter)
{
filter.addFilter (context, "level_factor.factor_number", "Factor");
return this;
}
public SearchFactorScore andLevel (QueryFilter<Level> filter)
{
filter.addFilter (context, "level_factor.level_number", "Level");
return this;
}
public FactorScoreResult search (ObjectTransaction transaction) throws StorageException
{
BaseBusinessClass[] results = super.search (transaction, REFERENCE_FactorScoreResult, SEARCH_FactorScore, criteria);
Set<FactorScoreResult> typedResults = new LinkedHashSet <FactorScoreResult> ();
for (BaseBusinessClass bbcResult : results)
{
FactorScoreResult aResult = (FactorScoreResult)bbcResult;
typedResults.add (aResult);
}
return (FactorScoreResult)singletonResult(ObjstoreUtils.removeDeleted(transaction, typedResults).toArray(new BaseBusinessClass[0]), "FactorScoreResult", "");
}
}
public static FactorScoreResult searchFactorScore (ObjectTransaction transaction) throws StorageException
{
return SearchByFactorScore ()
.search (transaction);
}
public Object getAttribute (String attribName) public Object getAttribute (String attribName)
......
...@@ -9,9 +9,12 @@ ...@@ -9,9 +9,12 @@
<ATTRIB name="ReverseScore" type="String" dbcol="reverse_score_flag" length="15"/> <ATTRIB name="ReverseScore" type="String" dbcol="reverse_score_flag" length="15"/>
<SINGLEREFERENCE name="Factor" type="Factor" dbcol="factor_number" /> <SINGLEREFERENCE name="Factor" type="Factor" dbcol="factor_number" />
<SINGLEREFERENCE name="Question" type="Question" dbcol="quest_number" />
</TABLE> </TABLE>
<SEARCH type="All" paramFilter="factor_lin.object_id is not null" orderBy="factor_lin.object_id" />
</BUSINESSCLASS> </BUSINESSCLASS>
</ROOT> </ROOT>
\ No newline at end of file
...@@ -41,7 +41,7 @@ public class FactorQuestionLinkPersistenceMgr extends ObjectPersistenceMgr ...@@ -41,7 +41,7 @@ public class FactorQuestionLinkPersistenceMgr extends ObjectPersistenceMgr
} }
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_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, {PREFIX}factor_lin.quest_number, 1 AS commasafe ";
private String SELECT_JOINS = ""; private String SELECT_JOINS = "";
public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
...@@ -93,7 +93,8 @@ public class FactorQuestionLinkPersistenceMgr extends ObjectPersistenceMgr ...@@ -93,7 +93,8 @@ public class FactorQuestionLinkPersistenceMgr extends ObjectPersistenceMgr
// Check for persistent sets already prefetched // Check for persistent sets already prefetched
if (false || !factor_linPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) || if (false || !factor_linPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!factor_linPSet.containsAttrib(FactorQuestionLink.FIELD_ReverseScore)|| !factor_linPSet.containsAttrib(FactorQuestionLink.FIELD_ReverseScore)||
!factor_linPSet.containsAttrib(FactorQuestionLink.SINGLEREFERENCE_Factor)) !factor_linPSet.containsAttrib(FactorQuestionLink.SINGLEREFERENCE_Factor)||
!factor_linPSet.containsAttrib(FactorQuestionLink.SINGLEREFERENCE_Question))
{ {
// We will need to retrieve it // We will need to retrieve it
idsToFetch.add (id.longValue()); idsToFetch.add (id.longValue());
...@@ -163,10 +164,10 @@ public class FactorQuestionLinkPersistenceMgr extends ObjectPersistenceMgr ...@@ -163,10 +164,10 @@ public class FactorQuestionLinkPersistenceMgr extends ObjectPersistenceMgr
{ {
int rowsUpdated = executeStatement (sqlMgr, int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}factor_lin " + "UPDATE {PREFIX}factor_lin " +
"SET reverse_score_flag = ?, factor_number = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " + "SET reverse_score_flag = ?, factor_number = ? , quest_number = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE factor_lin.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ", "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()); CollectionUtils.listEntry (HELPER_ReverseScore.getForSQL(dummyReverseScore, factor_linPSet.getAttrib (FactorQuestionLink.FIELD_ReverseScore))).listEntry (SQLManager.CheckNull((Long)(factor_linPSet.getAttrib (FactorQuestionLink.SINGLEREFERENCE_Factor)))).listEntry (SQLManager.CheckNull((Long)(factor_linPSet.getAttrib (FactorQuestionLink.SINGLEREFERENCE_Question)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
if (rowsUpdated != 1) if (rowsUpdated != 1)
{ {
...@@ -250,6 +251,10 @@ public class FactorQuestionLinkPersistenceMgr extends ObjectPersistenceMgr ...@@ -250,6 +251,10 @@ public class FactorQuestionLinkPersistenceMgr extends ObjectPersistenceMgr
} }
public ResultSet executeSearchQueryAll (SQLManager sqlMgr) throws SQLException
{
throw new RuntimeException ("NOT implemented: executeSearchQueryAll");
}
...@@ -361,6 +366,44 @@ public class FactorQuestionLinkPersistenceMgr extends ObjectPersistenceMgr ...@@ -361,6 +366,44 @@ public class FactorQuestionLinkPersistenceMgr extends ObjectPersistenceMgr
return results; return results;
} }
else if (searchType.equals (FactorQuestionLink.SEARCH_All))
{
// Local scope for transformed variables
{
}
String orderBy = " ORDER BY factor_lin.object_id";
String tables = " ";
Set<String> joinTableSet = new HashSet<String>();
String filter;
Object[] searchParams; // paramFilter: factor_lin.object_id is not null
String preFilter = "(factor_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}factor_lin " + tables + tableSetToSQL(joinTableSet) +
"WHERE " + SELECT_JOINS + " " + filter + orderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, maxRows, truncateExtra);
return results;
}
else else
{ {
...@@ -383,6 +426,7 @@ public class FactorQuestionLinkPersistenceMgr extends ObjectPersistenceMgr ...@@ -383,6 +426,7 @@ public class FactorQuestionLinkPersistenceMgr extends ObjectPersistenceMgr
factor_linPSet.setAttrib(FactorQuestionLink.FIELD_ReverseScore, HELPER_ReverseScore.getFromRS(dummyReverseScore, r, "reverse_score_flag")); factor_linPSet.setAttrib(FactorQuestionLink.FIELD_ReverseScore, HELPER_ReverseScore.getFromRS(dummyReverseScore, r, "reverse_score_flag"));
factor_linPSet.setAttrib(FactorQuestionLink.SINGLEREFERENCE_Factor, r.getObject ("factor_number")); factor_linPSet.setAttrib(FactorQuestionLink.SINGLEREFERENCE_Factor, r.getObject ("factor_number"));
factor_linPSet.setAttrib(FactorQuestionLink.SINGLEREFERENCE_Question, r.getObject ("quest_number"));
} }
...@@ -399,10 +443,10 @@ public class FactorQuestionLinkPersistenceMgr extends ObjectPersistenceMgr ...@@ -399,10 +443,10 @@ public class FactorQuestionLinkPersistenceMgr extends ObjectPersistenceMgr
{ {
executeStatement (sqlMgr, executeStatement (sqlMgr,
"INSERT INTO {PREFIX}factor_lin " + "INSERT INTO {PREFIX}factor_lin " +
" (reverse_score_flag, factor_number, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " + " (reverse_score_flag, factor_number, quest_number, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " + "VALUES " +
" (?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")", " (?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_ReverseScore.getForSQL(dummyReverseScore, factor_linPSet.getAttrib (FactorQuestionLink.FIELD_ReverseScore))) .listEntry (SQLManager.CheckNull((Long)(factor_linPSet.getAttrib (FactorQuestionLink.SINGLEREFERENCE_Factor)))) .listEntry (objectID.longID ()).toList().toArray()); CollectionUtils.listEntry (HELPER_ReverseScore.getForSQL(dummyReverseScore, factor_linPSet.getAttrib (FactorQuestionLink.FIELD_ReverseScore))) .listEntry (SQLManager.CheckNull((Long)(factor_linPSet.getAttrib (FactorQuestionLink.SINGLEREFERENCE_Factor)))).listEntry (SQLManager.CheckNull((Long)(factor_linPSet.getAttrib (FactorQuestionLink.SINGLEREFERENCE_Question)))) .listEntry (objectID.longID ()).toList().toArray());
factor_linPSet.setStatus (PersistentSetStatus.PROCESSED); factor_linPSet.setStatus (PersistentSetStatus.PROCESSED);
} }
......
...@@ -16,6 +16,10 @@ ...@@ -16,6 +16,10 @@
</TABLE> </TABLE>
<SEARCH type="All" paramFilter="level_factor.object_id is not null" orderBy="level_factor.object_id" />
<SEARCH type="FactorScore" paramFilter="level_factor.object_id is not null" singleton="TRUE"/>
</BUSINESSCLASS> </BUSINESSCLASS>
</ROOT> </ROOT>
...@@ -263,6 +263,14 @@ public class FactorScoreResultPersistenceMgr extends ObjectPersistenceMgr ...@@ -263,6 +263,14 @@ public class FactorScoreResultPersistenceMgr extends ObjectPersistenceMgr
} }
public ResultSet executeSearchQueryAll (SQLManager sqlMgr) throws SQLException
{
throw new RuntimeException ("NOT implemented: executeSearchQueryAll");
}
public ResultSet executeSearchQueryFactorScore (SQLManager sqlMgr) throws SQLException
{
throw new RuntimeException ("NOT implemented: executeSearchQueryFactorScore");
}
...@@ -374,6 +382,82 @@ public class FactorScoreResultPersistenceMgr extends ObjectPersistenceMgr ...@@ -374,6 +382,82 @@ public class FactorScoreResultPersistenceMgr extends ObjectPersistenceMgr
return results; return results;
} }
else if (searchType.equals (FactorScoreResult.SEARCH_All))
{
// Local scope for transformed variables
{
}
String orderBy = " ORDER BY level_factor.object_id";
String tables = " ";
Set<String> joinTableSet = new HashSet<String>();
String filter;
Object[] searchParams; // paramFilter: level_factor.object_id is not null
String preFilter = "(level_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}level_factor " + tables + tableSetToSQL(joinTableSet) +
"WHERE " + SELECT_JOINS + " " + filter + orderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, maxRows, truncateExtra);
return results;
}
else if (searchType.equals (FactorScoreResult.SEARCH_FactorScore))
{
// Local scope for transformed variables
{
}
String orderBy = " ";
String tables = " ";
Set<String> joinTableSet = new HashSet<String>();
String filter;
Object[] searchParams; // paramFilter: level_factor.object_id is not null
String preFilter = "(level_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}level_factor " + tables + tableSetToSQL(joinTableSet) +
"WHERE " + SELECT_JOINS + " " + filter + orderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, maxRows, truncateExtra);
return results;
}
else 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