Commit 86187315 by Nilu

Factor and FactorLevelLink BO change

parent 7451bc59
...@@ -4,24 +4,11 @@ ...@@ -4,24 +4,11 @@
<OBJECTS name="" xmlns:oneit="http://www.1iT.com.au"><NODE name="Script" factory="Vector"> <OBJECTS name="" xmlns:oneit="http://www.1iT.com.au"><NODE name="Script" factory="Vector">
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.DefineTableOperation"> <NODE name="DDL" factory="Participant" class="oneit.sql.transfer.DefineTableOperation">
<tableName factory="String">factor_hdr</tableName> <tableName factory="String">factor</tableName>
<column name="object_id" type="Long" nullable="false" length="11"/> <column name="object_id" type="Long" nullable="false" length="11"/>
<column name="object_last_updated_date" type="Date" nullable="false" length="22"/> <column name="object_last_updated_date" type="Date" nullable="false" length="22"/>
<column name="object_created_date" type="Date" nullable="false" length="22"/> <column name="object_created_date" type="Date" nullable="false" length="22"/>
<column name="factor_hdr_desc" type="String" nullable="true" length="30"/> <column name="factor_hdr_desc" type="String" nullable="true" length="30"/>
<column name="class_code" type="String" nullable="true" length="15"/>
<column name="factor_hdr_notes" type="CLOB" nullable="true"/>
<column name="left_annot" type="String" nullable="true" length="60"/>
<column name="right_annot" type="String" nullable="true" length="60"/>
<column name="factor_hdr_desc_schinese" type="String" nullable="true" length="120"/>
<column name="factor_hdr_desc_chinese" type="String" nullable="true" length="120"/>
<column name="factor_hdr_desc_korean" type="String" nullable="true" length="120"/>
<column name="factor_hdr_desc_thai" type="String" nullable="true" length="120"/>
<column name="z_score_wght" type="Double" nullable="true"/>
<column name="z_score_wght_2" type="Double" nullable="true"/>
<column name="level_number" type="Long" length="11" nullable="true"/>
</NODE> </NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="factor_hdr" indexName="idx_factor_hdr_level_number" isUnique="false"><column name="level_number"/></NODE>
</NODE></OBJECTS> </NODE></OBJECTS>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun -->
<OBJECTS name="" xmlns:oneit="http://www.1iT.com.au"><NODE name="Script" factory="Vector">
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.DefineTableOperation">
<tableName factory="String">factor_hdr</tableName>
<column name="object_id" type="Long" nullable="false" length="11"/>
<column name="object_last_updated_date" type="Date" nullable="false" length="22"/>
<column name="object_created_date" type="Date" nullable="false" length="22"/>
<column name="factor_hdr_desc" type="String" nullable="true" length="30"/>
<column name="class_code" type="String" nullable="true" length="15"/>
<column name="factor_hdr_notes" type="CLOB" nullable="true"/>
<column name="left_annot" type="String" nullable="true" length="60"/>
<column name="right_annot" type="String" nullable="true" length="60"/>
<column name="z_score_wght" type="Double" nullable="true"/>
<column name="z_score_wght_2" type="Double" nullable="true"/>
<column name="level_number" type="Long" length="11" nullable="true"/>
<column name="factor_number" type="Long" length="11" nullable="true"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="factor_hdr" indexName="idx_factor_hdr_level_number" isUnique="false"><column name="level_number"/></NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="factor_hdr" indexName="idx_factor_hdr_factor_number" isUnique="false"><column name="factor_number"/></NODE>
</NODE></OBJECTS>
\ No newline at end of file
-- DROP TABLE factor_hdr; -- DROP TABLE factor;
CREATE TABLE factor_hdr ( CREATE TABLE factor (
object_id int NOT NULL , object_id int NOT NULL ,
object_last_updated_date datetime DEFAULT getdate() NOT NULL , object_last_updated_date datetime DEFAULT getdate() NOT NULL ,
object_created_date datetime DEFAULT getdate() NOT NULL object_created_date datetime DEFAULT getdate() NOT NULL
, ,
factor_hdr_desc varchar(30) NULL, factor_hdr_desc varchar(30) NULL
class_code varchar(15) NULL,
factor_hdr_notes text NULL,
left_annot varchar(60) NULL,
right_annot varchar(60) NULL,
factor_hdr_desc_schinese varchar(120) NULL,
factor_hdr_desc_chinese varchar(120) NULL,
factor_hdr_desc_korean varchar(120) NULL,
factor_hdr_desc_thai varchar(120) NULL,
z_score_wght numeric(20,5) NULL,
z_score_wght_2 numeric(20,5) NULL,
level_number numeric(12) NULL
); );
ALTER TABLE factor_hdr ADD ALTER TABLE factor ADD
CONSTRAINT PK_factor_hdr PRIMARY KEY CONSTRAINT PK_factor PRIMARY KEY
( (
object_id object_id
) ; ) ;
\ No newline at end of file
CREATE INDEX idx_factor_hdr_level_number
ON factor_hdr (level_number);
-- DROP TABLE factor_hdr;
CREATE TABLE factor_hdr (
object_id int NOT NULL ,
object_last_updated_date datetime DEFAULT getdate() NOT NULL ,
object_created_date datetime DEFAULT getdate() NOT NULL
,
factor_hdr_desc varchar(30) NULL,
class_code varchar(15) NULL,
factor_hdr_notes text NULL,
left_annot varchar(60) NULL,
right_annot varchar(60) NULL,
z_score_wght numeric(20,5) NULL,
z_score_wght_2 numeric(20,5) NULL,
level_number numeric(12) NULL,
factor_number numeric(12) NULL
);
ALTER TABLE factor_hdr ADD
CONSTRAINT PK_factor_hdr PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_factor_hdr_level_number
ON factor_hdr (level_number);
CREATE INDEX idx_factor_hdr_factor_number
ON factor_hdr (factor_number);
-- DROP TABLE factor_hdr; -- DROP TABLE factor;
CREATE TABLE factor_hdr ( CREATE TABLE factor (
object_id number(12) NOT NULL , object_id number(12) NOT NULL ,
object_last_updated_date date DEFAULT SYSDATE NOT NULL , object_last_updated_date date DEFAULT SYSDATE NOT NULL ,
object_created_date date DEFAULT SYSDATE NOT NULL object_created_date date DEFAULT SYSDATE NOT NULL
, ,
factor_hdr_desc varchar2(30) NULL, factor_hdr_desc varchar2(30) NULL
class_code varchar2(15) NULL,
factor_hdr_notes clob NULL,
left_annot varchar2(60) NULL,
right_annot varchar2(60) NULL,
factor_hdr_desc_schinese varchar2(120) NULL,
factor_hdr_desc_chinese varchar2(120) NULL,
factor_hdr_desc_korean varchar2(120) NULL,
factor_hdr_desc_thai varchar2(120) NULL,
z_score_wght number(20,5) NULL,
z_score_wght_2 number(20,5) NULL,
level_number number(12) NULL
); );
ALTER TABLE factor_hdr ADD ALTER TABLE factor ADD
CONSTRAINT PK_factor_hdr PRIMARY KEY CONSTRAINT PK_factor PRIMARY KEY
( (
object_id object_id
) ; ) ;
\ No newline at end of file
CREATE INDEX idx_factor_hdr_level_number
ON factor_hdr (level_number);
-- DROP TABLE factor_hdr;
CREATE TABLE factor_hdr (
object_id number(12) NOT NULL ,
object_last_updated_date date DEFAULT SYSDATE NOT NULL ,
object_created_date date DEFAULT SYSDATE NOT NULL
,
factor_hdr_desc varchar2(30) NULL,
class_code varchar2(15) NULL,
factor_hdr_notes clob NULL,
left_annot varchar2(60) NULL,
right_annot varchar2(60) NULL,
z_score_wght number(20,5) NULL,
z_score_wght_2 number(20,5) NULL,
level_number number(12) NULL,
factor_number number(12) NULL
);
ALTER TABLE factor_hdr ADD
CONSTRAINT PK_factor_hdr PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_factor_hdr_level_number
ON factor_hdr (level_number);
CREATE INDEX idx_factor_hdr_factor_number
ON factor_hdr (factor_number);
-- @AutoRun -- @AutoRun
-- drop table factor_hdr; -- drop table factor;
CREATE TABLE factor_hdr ( CREATE TABLE factor (
object_id numeric(12) NOT NULL , object_id numeric(12) NOT NULL ,
object_last_updated_date timestamp DEFAULT NOW() NOT NULL , object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
object_created_date timestamp DEFAULT NOW() NOT NULL object_created_date timestamp DEFAULT NOW() NOT NULL
, ,
factor_hdr_desc varchar(30) NULL, factor_hdr_desc varchar(30) NULL
class_code varchar(15) NULL,
factor_hdr_notes text NULL,
left_annot varchar(60) NULL,
right_annot varchar(60) NULL,
factor_hdr_desc_schinese varchar(120) NULL,
factor_hdr_desc_chinese varchar(120) NULL,
factor_hdr_desc_korean varchar(120) NULL,
factor_hdr_desc_thai varchar(120) NULL,
z_score_wght numeric(20,5) NULL,
z_score_wght_2 numeric(20,5) NULL,
level_number numeric(12) NULL
); );
ALTER TABLE factor_hdr ADD ALTER TABLE factor ADD
CONSTRAINT pk_factor_hdr PRIMARY KEY CONSTRAINT pk_factor PRIMARY KEY
( (
object_id object_id
) ; ) ;
\ No newline at end of file
CREATE INDEX idx_factor_hdr_level_number
ON factor_hdr (level_number);
-- @AutoRun
-- drop table factor_hdr;
CREATE TABLE factor_hdr (
object_id numeric(12) NOT NULL ,
object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
object_created_date timestamp DEFAULT NOW() NOT NULL
,
factor_hdr_desc varchar(30) NULL,
class_code varchar(15) NULL,
factor_hdr_notes text NULL,
left_annot varchar(60) NULL,
right_annot varchar(60) NULL,
z_score_wght numeric(20,5) NULL,
z_score_wght_2 numeric(20,5) NULL,
level_number numeric(12) NULL,
factor_number numeric(12) NULL
);
ALTER TABLE factor_hdr ADD
CONSTRAINT pk_factor_hdr PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_factor_hdr_level_number
ON factor_hdr (level_number);
CREATE INDEX idx_factor_hdr_factor_number
ON factor_hdr (factor_number);
This source diff could not be displayed because it is too large. You can view the blob instead.
/*
* IMPORTANT!!!! XSL Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2 rev3 [oneit.objstore.BusinessObjectTemplate.xsl]
*
* Version: 1.0
* Vendor: Apache Software Foundation (Xalan XSLTC)
* Vendor URL: http://xml.apache.org/xalan-j
*/
package performa.orm;
import java.io.*;
import java.util.*;
import oneit.appservices.config.*;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.objstore.assocs.*;
import oneit.objstore.attributes.*;
import oneit.objstore.rdbms.filters.*;
import oneit.objstore.parser.*;
import oneit.objstore.validator.*;
import oneit.objstore.utils.*;
import oneit.utils.*;
import oneit.utils.filter.Filter;
import oneit.utils.transform.*;
import oneit.utils.parsers.FieldException;
public abstract class BaseFactorLevelLink extends BaseBusinessClass
{
// Reference instance for the object
public static final FactorLevelLink REFERENCE_FactorLevelLink = new FactorLevelLink ();
// Reference instance for the object
public static final FactorLevelLink DUMMY_FactorLevelLink = new DummyFactorLevelLink ();
// Static constants corresponding to field names
public static final String FIELD_Description = "Description";
public static final String FIELD_ClassCode = "ClassCode";
public static final String FIELD_Notes = "Notes";
public static final String FIELD_LeftAnnot = "LeftAnnot";
public static final String FIELD_RightAnnot = "RightAnnot";
public static final String FIELD_ZScoreWeight = "ZScoreWeight";
public static final String FIELD_ZScoreWeight2 = "ZScoreWeight2";
public static final String SINGLEREFERENCE_Level = "Level";
public static final String BACKREF_Level = "";
public static final String SINGLEREFERENCE_Factor = "Factor";
public static final String BACKREF_Factor = "";
// Static constants corresponding to searches
// Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper<FactorLevelLink> HELPER_Description = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<FactorLevelLink> HELPER_ClassCode = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<FactorLevelLink> HELPER_Notes = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<FactorLevelLink> HELPER_LeftAnnot = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<FactorLevelLink> HELPER_RightAnnot = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<FactorLevelLink> HELPER_ZScoreWeight = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<FactorLevelLink> HELPER_ZScoreWeight2 = DefaultAttributeHelper.INSTANCE;
// Private attributes corresponding to business object data
private String _Description;
private String _ClassCode;
private String _Notes;
private String _LeftAnnot;
private String _RightAnnot;
private Double _ZScoreWeight;
private Double _ZScoreWeight2;
// Private attributes corresponding to single references
private SingleAssociation<FactorLevelLink, Level> _Level;
private SingleAssociation<FactorLevelLink, Factor> _Factor;
// Private attributes corresponding to multiple references
// Map of maps of metadata
private static final Map ATTRIBUTES_METADATA_FactorLevelLink = new HashMap ();
// Arrays of validators for each attribute
private static final AttributeValidator[] FIELD_Description_Validators;
private static final AttributeValidator[] FIELD_ClassCode_Validators;
private static final AttributeValidator[] FIELD_Notes_Validators;
private static final AttributeValidator[] FIELD_LeftAnnot_Validators;
private static final AttributeValidator[] FIELD_RightAnnot_Validators;
private static final AttributeValidator[] FIELD_ZScoreWeight_Validators;
private static final AttributeValidator[] FIELD_ZScoreWeight2_Validators;
// Arrays of behaviour decorators
private static final FactorLevelLinkBehaviourDecorator[] FactorLevelLink_BehaviourDecorators;
static
{
try
{
String tmp_Level = Level.BACKREF_FactorLinks;
String tmp_Factor = Factor.BACKREF_FactorLinks;
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
setupAssocMetaData_Level();
setupAssocMetaData_Factor();
FIELD_Description_Validators = (AttributeValidator[])setupAttribMetaData_Description(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_ClassCode_Validators = (AttributeValidator[])setupAttribMetaData_ClassCode(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_Notes_Validators = (AttributeValidator[])setupAttribMetaData_Notes(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_LeftAnnot_Validators = (AttributeValidator[])setupAttribMetaData_LeftAnnot(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_RightAnnot_Validators = (AttributeValidator[])setupAttribMetaData_RightAnnot(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_ZScoreWeight_Validators = (AttributeValidator[])setupAttribMetaData_ZScoreWeight(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_ZScoreWeight2_Validators = (AttributeValidator[])setupAttribMetaData_ZScoreWeight2(validatorMapping).toArray (new AttributeValidator[0]);
REFERENCE_FactorLevelLink.initialiseReference ();
DUMMY_FactorLevelLink.initialiseReference ();
FactorLevelLink_BehaviourDecorators = BaseBusinessClass.getBBCBehaviours(FactorLevelLink.class).toArray(new FactorLevelLinkBehaviourDecorator[0]);
}
catch (RuntimeException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR1, e, "Error initialising");
throw e;
}
}
// Meta Info setup
private static void setupAssocMetaData_Level()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "FactorLinks");
metaInfo.put ("dbcol", "level_number");
metaInfo.put ("name", "Level");
metaInfo.put ("type", "Level");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for FactorLevelLink.Level:", metaInfo);
ATTRIBUTES_METADATA_FactorLevelLink.put (SINGLEREFERENCE_Level, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static void setupAssocMetaData_Factor()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "FactorLinks");
metaInfo.put ("dbcol", "factor_number");
metaInfo.put ("name", "Factor");
metaInfo.put ("type", "Factor");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for FactorLevelLink.Factor:", metaInfo);
ATTRIBUTES_METADATA_FactorLevelLink.put (SINGLEREFERENCE_Factor, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static List setupAttribMetaData_Description(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "factor_hdr_desc");
metaInfo.put ("length", "30");
metaInfo.put ("name", "Description");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for FactorLevelLink.Description:", metaInfo);
ATTRIBUTES_METADATA_FactorLevelLink.put (FIELD_Description, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(FactorLevelLink.class, "Description", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for FactorLevelLink.Description:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_ClassCode(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "class_code");
metaInfo.put ("length", "15");
metaInfo.put ("name", "ClassCode");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for FactorLevelLink.ClassCode:", metaInfo);
ATTRIBUTES_METADATA_FactorLevelLink.put (FIELD_ClassCode, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(FactorLevelLink.class, "ClassCode", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for FactorLevelLink.ClassCode:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_Notes(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "factor_hdr_notes");
metaInfo.put ("name", "Notes");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for FactorLevelLink.Notes:", metaInfo);
ATTRIBUTES_METADATA_FactorLevelLink.put (FIELD_Notes, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(FactorLevelLink.class, "Notes", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for FactorLevelLink.Notes:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_LeftAnnot(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "left_annot");
metaInfo.put ("length", "60");
metaInfo.put ("name", "LeftAnnot");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for FactorLevelLink.LeftAnnot:", metaInfo);
ATTRIBUTES_METADATA_FactorLevelLink.put (FIELD_LeftAnnot, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(FactorLevelLink.class, "LeftAnnot", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for FactorLevelLink.LeftAnnot:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_RightAnnot(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "right_annot");
metaInfo.put ("length", "60");
metaInfo.put ("name", "RightAnnot");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for FactorLevelLink.RightAnnot:", metaInfo);
ATTRIBUTES_METADATA_FactorLevelLink.put (FIELD_RightAnnot, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(FactorLevelLink.class, "RightAnnot", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for FactorLevelLink.RightAnnot:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_ZScoreWeight(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "z_score_wght");
metaInfo.put ("name", "ZScoreWeight");
metaInfo.put ("type", "Double");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for FactorLevelLink.ZScoreWeight:", metaInfo);
ATTRIBUTES_METADATA_FactorLevelLink.put (FIELD_ZScoreWeight, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(FactorLevelLink.class, "ZScoreWeight", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for FactorLevelLink.ZScoreWeight:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_ZScoreWeight2(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "z_score_wght_2");
metaInfo.put ("name", "ZScoreWeight2");
metaInfo.put ("type", "Double");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for FactorLevelLink.ZScoreWeight2:", metaInfo);
ATTRIBUTES_METADATA_FactorLevelLink.put (FIELD_ZScoreWeight2, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(FactorLevelLink.class, "ZScoreWeight2", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for FactorLevelLink.ZScoreWeight2:", validators);
return validators;
}
// END OF STATIC METADATA DEFINITION
// This constructor should not be called
protected BaseFactorLevelLink ()
{
}
protected BBCBehaviourDecorator[] getBehaviours()
{
return FactorLevelLink_BehaviourDecorators;
}
// Initialise the attributes
protected void _initialiseNewObjAttributes (ObjectTransaction transaction) throws StorageException
{
super._initialiseNewObjAttributes (transaction);
_Description = (String)(HELPER_Description.initialise (_Description));
_ClassCode = (String)(HELPER_ClassCode.initialise (_ClassCode));
_Notes = (String)(HELPER_Notes.initialise (_Notes));
_LeftAnnot = (String)(HELPER_LeftAnnot.initialise (_LeftAnnot));
_RightAnnot = (String)(HELPER_RightAnnot.initialise (_RightAnnot));
_ZScoreWeight = (Double)(HELPER_ZScoreWeight.initialise (_ZScoreWeight));
_ZScoreWeight2 = (Double)(HELPER_ZScoreWeight2.initialise (_ZScoreWeight2));
}
// Initialise the associations
protected void _initialiseAssociations ()
{
super._initialiseAssociations ();
_Level = new SingleAssociation<FactorLevelLink, Level> (this, SINGLEREFERENCE_Level, Level.MULTIPLEREFERENCE_FactorLinks, Level.REFERENCE_Level, "factor_hdr");
_Factor = new SingleAssociation<FactorLevelLink, Factor> (this, SINGLEREFERENCE_Factor, Factor.MULTIPLEREFERENCE_FactorLinks, Factor.REFERENCE_Factor, "factor_hdr");
}
// Initialise the associations
protected BaseBusinessClass initialiseReference ()
{
super.initialiseReference ();
_Level = new SingleAssociation<FactorLevelLink, Level> (this, SINGLEREFERENCE_Level, Level.MULTIPLEREFERENCE_FactorLinks, Level.REFERENCE_Level, "factor_hdr");
_Factor = new SingleAssociation<FactorLevelLink, Factor> (this, SINGLEREFERENCE_Factor, Factor.MULTIPLEREFERENCE_FactorLinks, Factor.REFERENCE_Factor, "factor_hdr");
return this;
}
/**
* Get the attribute Description
*/
public String getDescription ()
{
assertValid();
String valToReturn = _Description;
for (FactorLevelLinkBehaviourDecorator bhd : FactorLevelLink_BehaviourDecorators)
{
valToReturn = bhd.getDescription ((FactorLevelLink)this, valToReturn);
}
return valToReturn;
}
/**
* Called prior to the attribute changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preDescriptionChange (String newDescription) throws FieldException
{
}
/**
* Called after the attribute changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postDescriptionChange () throws FieldException
{
}
public FieldWriteability getWriteability_Description ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute Description. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setDescription (String newDescription) throws FieldException
{
boolean oldAndNewIdentical = HELPER_Description.compare (_Description, newDescription);
try
{
for (FactorLevelLinkBehaviourDecorator bhd : FactorLevelLink_BehaviourDecorators)
{
newDescription = bhd.setDescription ((FactorLevelLink)this, newDescription);
oldAndNewIdentical = HELPER_Description.compare (_Description, newDescription);
}
if (FIELD_Description_Validators.length > 0)
{
Object newDescriptionObj = HELPER_Description.toObject (newDescription);
if (newDescriptionObj != null)
{
int loopMax = FIELD_Description_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_FactorLevelLink.get (FIELD_Description);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_Description_Validators[v].checkAttribute (this, FIELD_Description, metadata, newDescriptionObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_Description () != FieldWriteability.FALSE, "Field Description is not writeable");
preDescriptionChange (newDescription);
markFieldChange (FIELD_Description);
_Description = newDescription;
postFieldChange (FIELD_Description);
postDescriptionChange ();
}
}
/**
* Get the attribute ClassCode
*/
public String getClassCode ()
{
assertValid();
String valToReturn = _ClassCode;
for (FactorLevelLinkBehaviourDecorator bhd : FactorLevelLink_BehaviourDecorators)
{
valToReturn = bhd.getClassCode ((FactorLevelLink)this, valToReturn);
}
return valToReturn;
}
/**
* Called prior to the attribute changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preClassCodeChange (String newClassCode) throws FieldException
{
}
/**
* Called after the attribute changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postClassCodeChange () throws FieldException
{
}
public FieldWriteability getWriteability_ClassCode ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute ClassCode. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setClassCode (String newClassCode) throws FieldException
{
boolean oldAndNewIdentical = HELPER_ClassCode.compare (_ClassCode, newClassCode);
try
{
for (FactorLevelLinkBehaviourDecorator bhd : FactorLevelLink_BehaviourDecorators)
{
newClassCode = bhd.setClassCode ((FactorLevelLink)this, newClassCode);
oldAndNewIdentical = HELPER_ClassCode.compare (_ClassCode, newClassCode);
}
if (FIELD_ClassCode_Validators.length > 0)
{
Object newClassCodeObj = HELPER_ClassCode.toObject (newClassCode);
if (newClassCodeObj != null)
{
int loopMax = FIELD_ClassCode_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_FactorLevelLink.get (FIELD_ClassCode);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_ClassCode_Validators[v].checkAttribute (this, FIELD_ClassCode, metadata, newClassCodeObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_ClassCode () != FieldWriteability.FALSE, "Field ClassCode is not writeable");
preClassCodeChange (newClassCode);
markFieldChange (FIELD_ClassCode);
_ClassCode = newClassCode;
postFieldChange (FIELD_ClassCode);
postClassCodeChange ();
}
}
/**
* Get the attribute Notes
*/
public String getNotes ()
{
assertValid();
String valToReturn = _Notes;
for (FactorLevelLinkBehaviourDecorator bhd : FactorLevelLink_BehaviourDecorators)
{
valToReturn = bhd.getNotes ((FactorLevelLink)this, valToReturn);
}
return valToReturn;
}
/**
* Called prior to the attribute changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preNotesChange (String newNotes) throws FieldException
{
}
/**
* Called after the attribute changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postNotesChange () throws FieldException
{
}
public FieldWriteability getWriteability_Notes ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute Notes. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setNotes (String newNotes) throws FieldException
{
boolean oldAndNewIdentical = HELPER_Notes.compare (_Notes, newNotes);
try
{
for (FactorLevelLinkBehaviourDecorator bhd : FactorLevelLink_BehaviourDecorators)
{
newNotes = bhd.setNotes ((FactorLevelLink)this, newNotes);
oldAndNewIdentical = HELPER_Notes.compare (_Notes, newNotes);
}
if (FIELD_Notes_Validators.length > 0)
{
Object newNotesObj = HELPER_Notes.toObject (newNotes);
if (newNotesObj != null)
{
int loopMax = FIELD_Notes_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_FactorLevelLink.get (FIELD_Notes);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_Notes_Validators[v].checkAttribute (this, FIELD_Notes, metadata, newNotesObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_Notes () != FieldWriteability.FALSE, "Field Notes is not writeable");
preNotesChange (newNotes);
markFieldChange (FIELD_Notes);
_Notes = newNotes;
postFieldChange (FIELD_Notes);
postNotesChange ();
}
}
/**
* Get the attribute LeftAnnot
*/
public String getLeftAnnot ()
{
assertValid();
String valToReturn = _LeftAnnot;
for (FactorLevelLinkBehaviourDecorator bhd : FactorLevelLink_BehaviourDecorators)
{
valToReturn = bhd.getLeftAnnot ((FactorLevelLink)this, valToReturn);
}
return valToReturn;
}
/**
* Called prior to the attribute changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preLeftAnnotChange (String newLeftAnnot) throws FieldException
{
}
/**
* Called after the attribute changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postLeftAnnotChange () throws FieldException
{
}
public FieldWriteability getWriteability_LeftAnnot ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute LeftAnnot. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setLeftAnnot (String newLeftAnnot) throws FieldException
{
boolean oldAndNewIdentical = HELPER_LeftAnnot.compare (_LeftAnnot, newLeftAnnot);
try
{
for (FactorLevelLinkBehaviourDecorator bhd : FactorLevelLink_BehaviourDecorators)
{
newLeftAnnot = bhd.setLeftAnnot ((FactorLevelLink)this, newLeftAnnot);
oldAndNewIdentical = HELPER_LeftAnnot.compare (_LeftAnnot, newLeftAnnot);
}
if (FIELD_LeftAnnot_Validators.length > 0)
{
Object newLeftAnnotObj = HELPER_LeftAnnot.toObject (newLeftAnnot);
if (newLeftAnnotObj != null)
{
int loopMax = FIELD_LeftAnnot_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_FactorLevelLink.get (FIELD_LeftAnnot);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_LeftAnnot_Validators[v].checkAttribute (this, FIELD_LeftAnnot, metadata, newLeftAnnotObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_LeftAnnot () != FieldWriteability.FALSE, "Field LeftAnnot is not writeable");
preLeftAnnotChange (newLeftAnnot);
markFieldChange (FIELD_LeftAnnot);
_LeftAnnot = newLeftAnnot;
postFieldChange (FIELD_LeftAnnot);
postLeftAnnotChange ();
}
}
/**
* Get the attribute RightAnnot
*/
public String getRightAnnot ()
{
assertValid();
String valToReturn = _RightAnnot;
for (FactorLevelLinkBehaviourDecorator bhd : FactorLevelLink_BehaviourDecorators)
{
valToReturn = bhd.getRightAnnot ((FactorLevelLink)this, valToReturn);
}
return valToReturn;
}
/**
* Called prior to the attribute changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preRightAnnotChange (String newRightAnnot) throws FieldException
{
}
/**
* Called after the attribute changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postRightAnnotChange () throws FieldException
{
}
public FieldWriteability getWriteability_RightAnnot ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute RightAnnot. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setRightAnnot (String newRightAnnot) throws FieldException
{
boolean oldAndNewIdentical = HELPER_RightAnnot.compare (_RightAnnot, newRightAnnot);
try
{
for (FactorLevelLinkBehaviourDecorator bhd : FactorLevelLink_BehaviourDecorators)
{
newRightAnnot = bhd.setRightAnnot ((FactorLevelLink)this, newRightAnnot);
oldAndNewIdentical = HELPER_RightAnnot.compare (_RightAnnot, newRightAnnot);
}
if (FIELD_RightAnnot_Validators.length > 0)
{
Object newRightAnnotObj = HELPER_RightAnnot.toObject (newRightAnnot);
if (newRightAnnotObj != null)
{
int loopMax = FIELD_RightAnnot_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_FactorLevelLink.get (FIELD_RightAnnot);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_RightAnnot_Validators[v].checkAttribute (this, FIELD_RightAnnot, metadata, newRightAnnotObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_RightAnnot () != FieldWriteability.FALSE, "Field RightAnnot is not writeable");
preRightAnnotChange (newRightAnnot);
markFieldChange (FIELD_RightAnnot);
_RightAnnot = newRightAnnot;
postFieldChange (FIELD_RightAnnot);
postRightAnnotChange ();
}
}
/**
* Get the attribute ZScoreWeight
*/
public Double getZScoreWeight ()
{
assertValid();
Double valToReturn = _ZScoreWeight;
for (FactorLevelLinkBehaviourDecorator bhd : FactorLevelLink_BehaviourDecorators)
{
valToReturn = bhd.getZScoreWeight ((FactorLevelLink)this, valToReturn);
}
return valToReturn;
}
/**
* Called prior to the attribute changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preZScoreWeightChange (Double newZScoreWeight) throws FieldException
{
}
/**
* Called after the attribute changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postZScoreWeightChange () throws FieldException
{
}
public FieldWriteability getWriteability_ZScoreWeight ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute ZScoreWeight. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setZScoreWeight (Double newZScoreWeight) throws FieldException
{
boolean oldAndNewIdentical = HELPER_ZScoreWeight.compare (_ZScoreWeight, newZScoreWeight);
try
{
for (FactorLevelLinkBehaviourDecorator bhd : FactorLevelLink_BehaviourDecorators)
{
newZScoreWeight = bhd.setZScoreWeight ((FactorLevelLink)this, newZScoreWeight);
oldAndNewIdentical = HELPER_ZScoreWeight.compare (_ZScoreWeight, newZScoreWeight);
}
if (FIELD_ZScoreWeight_Validators.length > 0)
{
Object newZScoreWeightObj = HELPER_ZScoreWeight.toObject (newZScoreWeight);
if (newZScoreWeightObj != null)
{
int loopMax = FIELD_ZScoreWeight_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_FactorLevelLink.get (FIELD_ZScoreWeight);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_ZScoreWeight_Validators[v].checkAttribute (this, FIELD_ZScoreWeight, metadata, newZScoreWeightObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_ZScoreWeight () != FieldWriteability.FALSE, "Field ZScoreWeight is not writeable");
preZScoreWeightChange (newZScoreWeight);
markFieldChange (FIELD_ZScoreWeight);
_ZScoreWeight = newZScoreWeight;
postFieldChange (FIELD_ZScoreWeight);
postZScoreWeightChange ();
}
}
/**
* Get the attribute ZScoreWeight2
*/
public Double getZScoreWeight2 ()
{
assertValid();
Double valToReturn = _ZScoreWeight2;
for (FactorLevelLinkBehaviourDecorator bhd : FactorLevelLink_BehaviourDecorators)
{
valToReturn = bhd.getZScoreWeight2 ((FactorLevelLink)this, valToReturn);
}
return valToReturn;
}
/**
* Called prior to the attribute changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preZScoreWeight2Change (Double newZScoreWeight2) throws FieldException
{
}
/**
* Called after the attribute changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postZScoreWeight2Change () throws FieldException
{
}
public FieldWriteability getWriteability_ZScoreWeight2 ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute ZScoreWeight2. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setZScoreWeight2 (Double newZScoreWeight2) throws FieldException
{
boolean oldAndNewIdentical = HELPER_ZScoreWeight2.compare (_ZScoreWeight2, newZScoreWeight2);
try
{
for (FactorLevelLinkBehaviourDecorator bhd : FactorLevelLink_BehaviourDecorators)
{
newZScoreWeight2 = bhd.setZScoreWeight2 ((FactorLevelLink)this, newZScoreWeight2);
oldAndNewIdentical = HELPER_ZScoreWeight2.compare (_ZScoreWeight2, newZScoreWeight2);
}
if (FIELD_ZScoreWeight2_Validators.length > 0)
{
Object newZScoreWeight2Obj = HELPER_ZScoreWeight2.toObject (newZScoreWeight2);
if (newZScoreWeight2Obj != null)
{
int loopMax = FIELD_ZScoreWeight2_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_FactorLevelLink.get (FIELD_ZScoreWeight2);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_ZScoreWeight2_Validators[v].checkAttribute (this, FIELD_ZScoreWeight2, metadata, newZScoreWeight2Obj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_ZScoreWeight2 () != FieldWriteability.FALSE, "Field ZScoreWeight2 is not writeable");
preZScoreWeight2Change (newZScoreWeight2);
markFieldChange (FIELD_ZScoreWeight2);
_ZScoreWeight2 = newZScoreWeight2;
postFieldChange (FIELD_ZScoreWeight2);
postZScoreWeight2Change ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getSingleAssocs()
{
List result = super.getSingleAssocs ();
result.add("Level");
result.add("Factor");
return result;
}
public BaseBusinessClass getSingleAssocReferenceInstance (String assocName)
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Level))
{
return _Level.getReferencedType ();
}else if (assocName.equals (SINGLEREFERENCE_Factor))
{
return _Factor.getReferencedType ();
}
else
{
return super.getSingleAssocReferenceInstance (assocName);
}
}
public String getSingleAssocBackReference(String assocName)
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Level))
{
return Level.MULTIPLEREFERENCE_FactorLinks ;
}else if (assocName.equals (SINGLEREFERENCE_Factor))
{
return Factor.MULTIPLEREFERENCE_FactorLinks ;
}
else
{
return super.getSingleAssocBackReference (assocName);
}
}
public BaseBusinessClass getSingleAssoc (String assocName) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Level))
{
return getLevel ();
}else if (assocName.equals (SINGLEREFERENCE_Factor))
{
return getFactor ();
}
else
{
return super.getSingleAssoc (assocName);
}
}
public BaseBusinessClass getSingleAssoc (String assocName, Get getType) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Level))
{
return getLevel (getType);
}else if (assocName.equals (SINGLEREFERENCE_Factor))
{
return getFactor (getType);
}
else
{
return super.getSingleAssoc (assocName, getType);
}
}
public Long getSingleAssocID (String assocName) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Level))
{
return getLevelID ();
}else if (assocName.equals (SINGLEREFERENCE_Factor))
{
return getFactorID ();
}
else
{
return super.getSingleAssocID (assocName);
}
}
public void setSingleAssoc (String assocName, BaseBusinessClass newValue) throws StorageException, FieldException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Level))
{
setLevel ((Level)(newValue));
}else if (assocName.equals (SINGLEREFERENCE_Factor))
{
setFactor ((Factor)(newValue));
}
else
{
super.setSingleAssoc (assocName, newValue);
}
}
/**
* Get the reference Level
*/
public Level getLevel () throws StorageException
{
assertValid();
try
{
return (Level)(_Level.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in FactorLevelLink:", this.getObjectID (), ", was trying to get Level:", getLevelID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _Level.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Level getLevel (Get getType) throws StorageException
{
assertValid();
return _Level.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getLevelID ()
{
assertValid();
if (_Level == null)
{
return null;
}
else
{
return _Level.getID ();
}
}
/**
* Called prior to the assoc changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preLevelChange (Level newLevel) throws FieldException
{
}
/**
* Called after the assoc changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postLevelChange () throws FieldException
{
}
public FieldWriteability getWriteability_Level ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference Level. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setLevel (Level newLevel) throws StorageException, FieldException
{
if (_Level.wouldReferencedChange (newLevel))
{
assertValid();
Debug.assertion (getWriteability_Level () != FieldWriteability.FALSE, "Assoc Level is not writeable");
preLevelChange (newLevel);
Level oldLevel = getLevel ();
if (oldLevel != null)
{
// This is to stop validation from triggering when we are removed
_Level.set (null);
oldLevel.removeFromFactorLinks ((FactorLevelLink)(this));
}
_Level.set (newLevel);
if (newLevel != null)
{
newLevel.addToFactorLinks ((FactorLevelLink)(this));
}
postLevelChange ();
}
}
/**
* Get the reference Factor
*/
public Factor getFactor () throws StorageException
{
assertValid();
try
{
return (Factor)(_Factor.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in FactorLevelLink:", this.getObjectID (), ", was trying to get Factor:", getFactorID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _Factor.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Factor getFactor (Get getType) throws StorageException
{
assertValid();
return _Factor.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getFactorID ()
{
assertValid();
if (_Factor == null)
{
return null;
}
else
{
return _Factor.getID ();
}
}
/**
* Called prior to the assoc changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preFactorChange (Factor newFactor) throws FieldException
{
}
/**
* Called after the assoc changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postFactorChange () throws FieldException
{
}
public FieldWriteability getWriteability_Factor ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference Factor. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setFactor (Factor newFactor) throws StorageException, FieldException
{
if (_Factor.wouldReferencedChange (newFactor))
{
assertValid();
Debug.assertion (getWriteability_Factor () != FieldWriteability.FALSE, "Assoc Factor is not writeable");
preFactorChange (newFactor);
Factor oldFactor = getFactor ();
if (oldFactor != null)
{
// This is to stop validation from triggering when we are removed
_Factor.set (null);
oldFactor.removeFromFactorLinks ((FactorLevelLink)(this));
}
_Factor.set (newFactor);
if (newFactor != null)
{
newFactor.addToFactorLinks ((FactorLevelLink)(this));
}
postFactorChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getMultiAssocs()
{
List result = super.getMultiAssocs ();
return result;
}
/**
* Get the reference instance for the multi assoc name.
*/
public BaseBusinessClass getMultiAssocReferenceInstance(String attribName)
{
return super.getMultiAssocReferenceInstance(attribName);
}
public String getMultiAssocBackReference(String attribName)
{
return super.getMultiAssocBackReference(attribName);
}
/**
* Get the assoc count for the multi assoc name.
*/
public int getMultiAssocCount(String attribName) throws StorageException
{
return super.getMultiAssocCount(attribName);
}
/**
* Get the assoc at a particular index
*/
public BaseBusinessClass getMultiAssocAt(String attribName, int index) throws StorageException
{
return super.getMultiAssocAt(attribName, index);
}
/**
* Add to a multi assoc by attribute name
*/
public void addToMultiAssoc(String attribName, BaseBusinessClass newElement) throws StorageException
{
super.addToMultiAssoc(attribName, newElement);
}
/**
* Remove from a multi assoc by attribute name
*/
public void removeFromMultiAssoc(String attribName, BaseBusinessClass oldElement) throws StorageException
{
super.removeFromMultiAssoc(attribName, oldElement);
}
protected void __loadMultiAssoc (String attribName, BaseBusinessClass[] elements)
{
super.__loadMultiAssoc(attribName, elements);
}
protected boolean __isMultiAssocLoaded (String attribName)
{
return super.__isMultiAssocLoaded(attribName);
}
public void onDelete ()
{
try
{
// Ensure we are removed from any loaded multi-associations that aren't mandatory
if (_Level.isLoaded () || getTransaction ().isObjectLoaded (_Level.getReferencedType (), getLevelID ()))
{
Level referenced = getLevel ();
if (referenced != null)
{
// Stop the callback
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null FactorLinks from ", getObjectID (), " to ", referenced.getObjectID ());
_Level.set (null);
referenced.removeFromFactorLinks ((FactorLevelLink)this);
}
}
// 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 FactorLinks from ", getObjectID (), " to ", referenced.getObjectID ());
_Factor.set (null);
referenced.removeFromFactorLinks ((FactorLevelLink)this);
}
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
super.onDelete ();
}
public FactorLevelLink newInstance ()
{
return new FactorLevelLink ();
}
public FactorLevelLink referenceInstance ()
{
return REFERENCE_FactorLevelLink;
}
public FactorLevelLink getInTransaction (ObjectTransaction t) throws StorageException
{
return getFactorLevelLinkByID (t, getObjectID());
}
public BaseBusinessClass dummyInstance ()
{
return DUMMY_FactorLevelLink;
}
public String getBaseSetName ()
{
return "factor_hdr";
}
/**
* This is where an object returns the Persistent sets that will
* store it into the database.
* The should be entered into allSets
*/
public void getPersistentSets (PersistentSetCollection allSets)
{
ObjectStatus myStatus = getStatus ();
PersistentSetStatus myPSetStatus = myStatus.getPSetStatus();
ObjectID myID = getID();
super.getPersistentSets (allSets);
PersistentSet factor_hdrPSet = allSets.getPersistentSet (myID, "factor_hdr", myPSetStatus);
factor_hdrPSet.setAttrib (FIELD_ObjectID, myID);
factor_hdrPSet.setAttrib (FIELD_Description, HELPER_Description.toObject (_Description)); //
factor_hdrPSet.setAttrib (FIELD_ClassCode, HELPER_ClassCode.toObject (_ClassCode)); //
factor_hdrPSet.setAttrib (FIELD_Notes, HELPER_Notes.toObject (_Notes)); //
factor_hdrPSet.setAttrib (FIELD_LeftAnnot, HELPER_LeftAnnot.toObject (_LeftAnnot)); //
factor_hdrPSet.setAttrib (FIELD_RightAnnot, HELPER_RightAnnot.toObject (_RightAnnot)); //
factor_hdrPSet.setAttrib (FIELD_ZScoreWeight, HELPER_ZScoreWeight.toObject (_ZScoreWeight)); //
factor_hdrPSet.setAttrib (FIELD_ZScoreWeight2, HELPER_ZScoreWeight2.toObject (_ZScoreWeight2)); //
_Level.getPersistentSets (allSets);
_Factor.getPersistentSets (allSets);
}
/**
* Sets the objects state based on Persistent sets.
*/
public void setFromPersistentSets (ObjectID objectID, PersistentSetCollection allSets)
{
super.setFromPersistentSets (objectID, allSets);
PersistentSet factor_hdrPSet = allSets.getPersistentSet (objectID, "factor_hdr");
_Description = (String)(HELPER_Description.fromObject (_Description, factor_hdrPSet.getAttrib (FIELD_Description))); //
_ClassCode = (String)(HELPER_ClassCode.fromObject (_ClassCode, factor_hdrPSet.getAttrib (FIELD_ClassCode))); //
_Notes = (String)(HELPER_Notes.fromObject (_Notes, factor_hdrPSet.getAttrib (FIELD_Notes))); //
_LeftAnnot = (String)(HELPER_LeftAnnot.fromObject (_LeftAnnot, factor_hdrPSet.getAttrib (FIELD_LeftAnnot))); //
_RightAnnot = (String)(HELPER_RightAnnot.fromObject (_RightAnnot, factor_hdrPSet.getAttrib (FIELD_RightAnnot))); //
_ZScoreWeight = (Double)(HELPER_ZScoreWeight.fromObject (_ZScoreWeight, factor_hdrPSet.getAttrib (FIELD_ZScoreWeight))); //
_ZScoreWeight2 = (Double)(HELPER_ZScoreWeight2.fromObject (_ZScoreWeight2, factor_hdrPSet.getAttrib (FIELD_ZScoreWeight2))); //
_Level.setFromPersistentSets (objectID, allSets);
_Factor.setFromPersistentSets (objectID, allSets);
}
public void setAttributesFrom (BaseBusinessClass other, MultiException e)
{
super.setAttributesFrom (other, e);
if (other instanceof FactorLevelLink)
{
FactorLevelLink otherFactorLevelLink = (FactorLevelLink)other;
try
{
setDescription (otherFactorLevelLink.getDescription ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setClassCode (otherFactorLevelLink.getClassCode ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setNotes (otherFactorLevelLink.getNotes ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setLeftAnnot (otherFactorLevelLink.getLeftAnnot ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setRightAnnot (otherFactorLevelLink.getRightAnnot ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setZScoreWeight (otherFactorLevelLink.getZScoreWeight ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setZScoreWeight2 (otherFactorLevelLink.getZScoreWeight2 ());
}
catch (FieldException ex)
{
e.addException (ex);
}
}
}
/**
* Set the attributes in this to copies of the attributes in source.
*/
public void copyAttributesFrom (BaseBusinessClass source)
{
super.copyAttributesFrom (source);
if (source instanceof BaseFactorLevelLink)
{
BaseFactorLevelLink sourceFactorLevelLink = (BaseFactorLevelLink)(source);
_Description = sourceFactorLevelLink._Description;
_ClassCode = sourceFactorLevelLink._ClassCode;
_Notes = sourceFactorLevelLink._Notes;
_LeftAnnot = sourceFactorLevelLink._LeftAnnot;
_RightAnnot = sourceFactorLevelLink._RightAnnot;
_ZScoreWeight = sourceFactorLevelLink._ZScoreWeight;
_ZScoreWeight2 = sourceFactorLevelLink._ZScoreWeight2;
}
}
/**
* Set the associations in this to copies of the attributes in source.
*/
public void copySingleAssociationsFrom (BaseBusinessClass source, boolean linkToGhosts)
{
super.copySingleAssociationsFrom (source, linkToGhosts);
if (source instanceof BaseFactorLevelLink)
{
BaseFactorLevelLink sourceFactorLevelLink = (BaseFactorLevelLink)(source);
_Level.copyFrom (sourceFactorLevelLink._Level, linkToGhosts);
_Factor.copyFrom (sourceFactorLevelLink._Factor, linkToGhosts);
}
}
/**
* Set the associations in this to copies of the attributes in source.
*/
public void copyAssociationsFrom (BaseBusinessClass source, boolean linkToGhosts)
{
super.copyAssociationsFrom (source, linkToGhosts);
if (source instanceof BaseFactorLevelLink)
{
BaseFactorLevelLink sourceFactorLevelLink = (BaseFactorLevelLink)(source);
}
}
public void validate (ValidationContext context)
{
super.validate (context);
}
/**
* Subclasses must override this to read in their attributes
*/
protected void readExternalData(Map<String, Object> vals) throws IOException, ClassNotFoundException
{
super.readExternalData(vals);
_Description = (String)(HELPER_Description.readExternal (_Description, vals.get(FIELD_Description))); //
_ClassCode = (String)(HELPER_ClassCode.readExternal (_ClassCode, vals.get(FIELD_ClassCode))); //
_Notes = (String)(HELPER_Notes.readExternal (_Notes, vals.get(FIELD_Notes))); //
_LeftAnnot = (String)(HELPER_LeftAnnot.readExternal (_LeftAnnot, vals.get(FIELD_LeftAnnot))); //
_RightAnnot = (String)(HELPER_RightAnnot.readExternal (_RightAnnot, vals.get(FIELD_RightAnnot))); //
_ZScoreWeight = (Double)(HELPER_ZScoreWeight.readExternal (_ZScoreWeight, vals.get(FIELD_ZScoreWeight))); //
_ZScoreWeight2 = (Double)(HELPER_ZScoreWeight2.readExternal (_ZScoreWeight2, vals.get(FIELD_ZScoreWeight2))); //
_Level.readExternalData(vals.get(SINGLEREFERENCE_Level));
_Factor.readExternalData(vals.get(SINGLEREFERENCE_Factor));
}
/**
* Subclasses must override this to write out their attributes
*/
protected void writeExternalData(Map<String, Object> vals) throws IOException
{
super.writeExternalData(vals);
vals.put (FIELD_Description, HELPER_Description.writeExternal (_Description));
vals.put (FIELD_ClassCode, HELPER_ClassCode.writeExternal (_ClassCode));
vals.put (FIELD_Notes, HELPER_Notes.writeExternal (_Notes));
vals.put (FIELD_LeftAnnot, HELPER_LeftAnnot.writeExternal (_LeftAnnot));
vals.put (FIELD_RightAnnot, HELPER_RightAnnot.writeExternal (_RightAnnot));
vals.put (FIELD_ZScoreWeight, HELPER_ZScoreWeight.writeExternal (_ZScoreWeight));
vals.put (FIELD_ZScoreWeight2, HELPER_ZScoreWeight2.writeExternal (_ZScoreWeight2));
vals.put (SINGLEREFERENCE_Level, _Level.writeExternalData());
vals.put (SINGLEREFERENCE_Factor, _Factor.writeExternalData());
}
public void compare (BaseBusinessClass other, AttributeChangeListener listener) throws StorageException
{
super.compare (other, listener);
if (other instanceof BaseFactorLevelLink)
{
BaseFactorLevelLink otherFactorLevelLink = (BaseFactorLevelLink)(other);
if (!HELPER_Description.compare(this._Description, otherFactorLevelLink._Description))
{
listener.notifyFieldChange(this, other, FIELD_Description, HELPER_Description.toObject(this._Description), HELPER_Description.toObject(otherFactorLevelLink._Description));
}
if (!HELPER_ClassCode.compare(this._ClassCode, otherFactorLevelLink._ClassCode))
{
listener.notifyFieldChange(this, other, FIELD_ClassCode, HELPER_ClassCode.toObject(this._ClassCode), HELPER_ClassCode.toObject(otherFactorLevelLink._ClassCode));
}
if (!HELPER_Notes.compare(this._Notes, otherFactorLevelLink._Notes))
{
listener.notifyFieldChange(this, other, FIELD_Notes, HELPER_Notes.toObject(this._Notes), HELPER_Notes.toObject(otherFactorLevelLink._Notes));
}
if (!HELPER_LeftAnnot.compare(this._LeftAnnot, otherFactorLevelLink._LeftAnnot))
{
listener.notifyFieldChange(this, other, FIELD_LeftAnnot, HELPER_LeftAnnot.toObject(this._LeftAnnot), HELPER_LeftAnnot.toObject(otherFactorLevelLink._LeftAnnot));
}
if (!HELPER_RightAnnot.compare(this._RightAnnot, otherFactorLevelLink._RightAnnot))
{
listener.notifyFieldChange(this, other, FIELD_RightAnnot, HELPER_RightAnnot.toObject(this._RightAnnot), HELPER_RightAnnot.toObject(otherFactorLevelLink._RightAnnot));
}
if (!HELPER_ZScoreWeight.compare(this._ZScoreWeight, otherFactorLevelLink._ZScoreWeight))
{
listener.notifyFieldChange(this, other, FIELD_ZScoreWeight, HELPER_ZScoreWeight.toObject(this._ZScoreWeight), HELPER_ZScoreWeight.toObject(otherFactorLevelLink._ZScoreWeight));
}
if (!HELPER_ZScoreWeight2.compare(this._ZScoreWeight2, otherFactorLevelLink._ZScoreWeight2))
{
listener.notifyFieldChange(this, other, FIELD_ZScoreWeight2, HELPER_ZScoreWeight2.toObject(this._ZScoreWeight2), HELPER_ZScoreWeight2.toObject(otherFactorLevelLink._ZScoreWeight2));
}
// Compare single assocs
_Level.compare (otherFactorLevelLink._Level, listener);
_Factor.compare (otherFactorLevelLink._Factor, listener);
// Compare multiple assocs
}
}
public void visitTransients (AttributeVisitor visitor) throws StorageException
{
super.visitAttributes (visitor);
}
public void visitAttributes (AttributeVisitor visitor) throws StorageException
{
super.visitAttributes (visitor);
visitor.visitField(this, FIELD_Description, HELPER_Description.toObject(getDescription()));
visitor.visitField(this, FIELD_ClassCode, HELPER_ClassCode.toObject(getClassCode()));
visitor.visitField(this, FIELD_Notes, HELPER_Notes.toObject(getNotes()));
visitor.visitField(this, FIELD_LeftAnnot, HELPER_LeftAnnot.toObject(getLeftAnnot()));
visitor.visitField(this, FIELD_RightAnnot, HELPER_RightAnnot.toObject(getRightAnnot()));
visitor.visitField(this, FIELD_ZScoreWeight, HELPER_ZScoreWeight.toObject(getZScoreWeight()));
visitor.visitField(this, FIELD_ZScoreWeight2, HELPER_ZScoreWeight2.toObject(getZScoreWeight2()));
visitor.visitAssociation (_Level);
visitor.visitAssociation (_Factor);
}
public void visitAssociations (AssociationVisitor visitor, AssociatedScope scope) throws StorageException
{
super.visitAssociations (visitor, scope);
if (scope.includes (_Level))
{
visitor.visit (_Level);
}
if (scope.includes (_Factor))
{
visitor.visit (_Factor);
}
}
public static FactorLevelLink createFactorLevelLink (ObjectTransaction transaction) throws StorageException
{
FactorLevelLink result = new FactorLevelLink ();
result.initialiseNewObject (transaction);
return result;
}
public static FactorLevelLink getFactorLevelLinkByID (ObjectTransaction transaction, Long objectID) throws StorageException
{
return (FactorLevelLink)(transaction.getObjectByID (REFERENCE_FactorLevelLink, objectID));
}
public boolean testFilter (String attribName, QueryFilter filter) throws StorageException
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_Description))
{
return filter.matches (getDescription ());
}
else if (attribName.equals (FIELD_ClassCode))
{
return filter.matches (getClassCode ());
}
else if (attribName.equals (FIELD_Notes))
{
return filter.matches (getNotes ());
}
else if (attribName.equals (FIELD_LeftAnnot))
{
return filter.matches (getLeftAnnot ());
}
else if (attribName.equals (FIELD_RightAnnot))
{
return filter.matches (getRightAnnot ());
}
else if (attribName.equals (FIELD_ZScoreWeight))
{
return filter.matches (getZScoreWeight ());
}
else if (attribName.equals (FIELD_ZScoreWeight2))
{
return filter.matches (getZScoreWeight2 ());
}
else if (attribName.equals (SINGLEREFERENCE_Level))
{
return filter.matches (getLevel ());
}
else if (attribName.equals (SINGLEREFERENCE_Factor))
{
return filter.matches (getFactor ());
}
else
{
return super.testFilter (attribName, filter);
}
}
public Object getAttribute (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_Description))
{
return HELPER_Description.toObject (getDescription ());
}
else if (attribName.equals (FIELD_ClassCode))
{
return HELPER_ClassCode.toObject (getClassCode ());
}
else if (attribName.equals (FIELD_Notes))
{
return HELPER_Notes.toObject (getNotes ());
}
else if (attribName.equals (FIELD_LeftAnnot))
{
return HELPER_LeftAnnot.toObject (getLeftAnnot ());
}
else if (attribName.equals (FIELD_RightAnnot))
{
return HELPER_RightAnnot.toObject (getRightAnnot ());
}
else if (attribName.equals (FIELD_ZScoreWeight))
{
return HELPER_ZScoreWeight.toObject (getZScoreWeight ());
}
else if (attribName.equals (FIELD_ZScoreWeight2))
{
return HELPER_ZScoreWeight2.toObject (getZScoreWeight2 ());
}
else
{
return super.getAttribute (attribName);
}
}
public AttributeHelper getAttributeHelper (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_Description))
{
return HELPER_Description;
}
else if (attribName.equals (FIELD_ClassCode))
{
return HELPER_ClassCode;
}
else if (attribName.equals (FIELD_Notes))
{
return HELPER_Notes;
}
else if (attribName.equals (FIELD_LeftAnnot))
{
return HELPER_LeftAnnot;
}
else if (attribName.equals (FIELD_RightAnnot))
{
return HELPER_RightAnnot;
}
else if (attribName.equals (FIELD_ZScoreWeight))
{
return HELPER_ZScoreWeight;
}
else if (attribName.equals (FIELD_ZScoreWeight2))
{
return HELPER_ZScoreWeight2;
}
else
{
return super.getAttributeHelper (attribName);
}
}
public void setAttribute (String attribName, Object attribValue) throws FieldException
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_Description))
{
setDescription ((String)(HELPER_Description.fromObject (_Description, attribValue)));
}
else if (attribName.equals (FIELD_ClassCode))
{
setClassCode ((String)(HELPER_ClassCode.fromObject (_ClassCode, attribValue)));
}
else if (attribName.equals (FIELD_Notes))
{
setNotes ((String)(HELPER_Notes.fromObject (_Notes, attribValue)));
}
else if (attribName.equals (FIELD_LeftAnnot))
{
setLeftAnnot ((String)(HELPER_LeftAnnot.fromObject (_LeftAnnot, attribValue)));
}
else if (attribName.equals (FIELD_RightAnnot))
{
setRightAnnot ((String)(HELPER_RightAnnot.fromObject (_RightAnnot, attribValue)));
}
else if (attribName.equals (FIELD_ZScoreWeight))
{
setZScoreWeight ((Double)(HELPER_ZScoreWeight.fromObject (_ZScoreWeight, attribValue)));
}
else if (attribName.equals (FIELD_ZScoreWeight2))
{
setZScoreWeight2 ((Double)(HELPER_ZScoreWeight2.fromObject (_ZScoreWeight2, attribValue)));
}
else
{
super.setAttribute (attribName, attribValue);
}
}
public boolean isWriteable (String fieldName)
{
return getWriteable (fieldName) == FieldWriteability.TRUE;
}
public FieldWriteability getWriteable (String fieldName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (fieldName.equals (FIELD_Description))
{
return getWriteability_Description ();
}
else if (fieldName.equals (FIELD_ClassCode))
{
return getWriteability_ClassCode ();
}
else if (fieldName.equals (FIELD_Notes))
{
return getWriteability_Notes ();
}
else if (fieldName.equals (FIELD_LeftAnnot))
{
return getWriteability_LeftAnnot ();
}
else if (fieldName.equals (FIELD_RightAnnot))
{
return getWriteability_RightAnnot ();
}
else if (fieldName.equals (FIELD_ZScoreWeight))
{
return getWriteability_ZScoreWeight ();
}
else if (fieldName.equals (FIELD_ZScoreWeight2))
{
return getWriteability_ZScoreWeight2 ();
}
else if (fieldName.equals (SINGLEREFERENCE_Level))
{
return getWriteability_Level ();
}
else if (fieldName.equals (SINGLEREFERENCE_Factor))
{
return getWriteability_Factor ();
}
else
{
return super.getWriteable (fieldName);
}
}
public void putUnwriteable (Set<String> fields)
{
if (getWriteability_Description () != FieldWriteability.TRUE)
{
fields.add (FIELD_Description);
}
if (getWriteability_ClassCode () != FieldWriteability.TRUE)
{
fields.add (FIELD_ClassCode);
}
if (getWriteability_Notes () != FieldWriteability.TRUE)
{
fields.add (FIELD_Notes);
}
if (getWriteability_LeftAnnot () != FieldWriteability.TRUE)
{
fields.add (FIELD_LeftAnnot);
}
if (getWriteability_RightAnnot () != FieldWriteability.TRUE)
{
fields.add (FIELD_RightAnnot);
}
if (getWriteability_ZScoreWeight () != FieldWriteability.TRUE)
{
fields.add (FIELD_ZScoreWeight);
}
if (getWriteability_ZScoreWeight2 () != FieldWriteability.TRUE)
{
fields.add (FIELD_ZScoreWeight2);
}
super.putUnwriteable (fields);
}
public List<AbstractAttribute> getAttributes ()
{
List result = super.getAttributes ();
result.add(HELPER_Description.getAttribObject (getClass (), _Description, false, FIELD_Description));
result.add(HELPER_ClassCode.getAttribObject (getClass (), _ClassCode, false, FIELD_ClassCode));
result.add(HELPER_Notes.getAttribObject (getClass (), _Notes, false, FIELD_Notes));
result.add(HELPER_LeftAnnot.getAttribObject (getClass (), _LeftAnnot, false, FIELD_LeftAnnot));
result.add(HELPER_RightAnnot.getAttribObject (getClass (), _RightAnnot, false, FIELD_RightAnnot));
result.add(HELPER_ZScoreWeight.getAttribObject (getClass (), _ZScoreWeight, false, FIELD_ZScoreWeight));
result.add(HELPER_ZScoreWeight2.getAttribObject (getClass (), _ZScoreWeight2, false, FIELD_ZScoreWeight2));
return result;
}
public Map getAttributeMetadata (String attribute)
{
if (ATTRIBUTES_METADATA_FactorLevelLink.containsKey (attribute))
{
return (Map)ATTRIBUTES_METADATA_FactorLevelLink.get (attribute);
}
else
{
return super.getAttributeMetadata (attribute);
}
}
public Object getAttributeMetadata (String attribute, String metadata)
{
if (ATTRIBUTES_METADATA_FactorLevelLink.containsKey (attribute))
{
return ((Map)ATTRIBUTES_METADATA_FactorLevelLink.get (attribute)).get(metadata);
}
else
{
return super.getAttributeMetadata (attribute, metadata);
}
}
public void preCommit (boolean willBeStored) throws Exception
{
super.preCommit(willBeStored);
if(willBeStored)
{
}
}
public oneit.servlets.objstore.binary.BinaryContentHandler getBinaryContentHandler(String attribName)
{
return super.getBinaryContentHandler(attribName);
}
public static class FactorLevelLinkBehaviourDecorator extends BaseBusinessClass.BBCBehaviourDecorator<FactorLevelLink>
{
/**
* Get the attribute Description
*/
public String getDescription (FactorLevelLink obj, String original)
{
return original;
}
/**
* Change the value set for attribute Description.
* May modify the field beforehand
* Occurs before validation.
*/
public String setDescription (FactorLevelLink obj, String newDescription) throws FieldException
{
return newDescription;
}
/**
* Get the attribute ClassCode
*/
public String getClassCode (FactorLevelLink obj, String original)
{
return original;
}
/**
* Change the value set for attribute ClassCode.
* May modify the field beforehand
* Occurs before validation.
*/
public String setClassCode (FactorLevelLink obj, String newClassCode) throws FieldException
{
return newClassCode;
}
/**
* Get the attribute Notes
*/
public String getNotes (FactorLevelLink obj, String original)
{
return original;
}
/**
* Change the value set for attribute Notes.
* May modify the field beforehand
* Occurs before validation.
*/
public String setNotes (FactorLevelLink obj, String newNotes) throws FieldException
{
return newNotes;
}
/**
* Get the attribute LeftAnnot
*/
public String getLeftAnnot (FactorLevelLink obj, String original)
{
return original;
}
/**
* Change the value set for attribute LeftAnnot.
* May modify the field beforehand
* Occurs before validation.
*/
public String setLeftAnnot (FactorLevelLink obj, String newLeftAnnot) throws FieldException
{
return newLeftAnnot;
}
/**
* Get the attribute RightAnnot
*/
public String getRightAnnot (FactorLevelLink obj, String original)
{
return original;
}
/**
* Change the value set for attribute RightAnnot.
* May modify the field beforehand
* Occurs before validation.
*/
public String setRightAnnot (FactorLevelLink obj, String newRightAnnot) throws FieldException
{
return newRightAnnot;
}
/**
* Get the attribute ZScoreWeight
*/
public Double getZScoreWeight (FactorLevelLink obj, Double original)
{
return original;
}
/**
* Change the value set for attribute ZScoreWeight.
* May modify the field beforehand
* Occurs before validation.
*/
public Double setZScoreWeight (FactorLevelLink obj, Double newZScoreWeight) throws FieldException
{
return newZScoreWeight;
}
/**
* Get the attribute ZScoreWeight2
*/
public Double getZScoreWeight2 (FactorLevelLink obj, Double original)
{
return original;
}
/**
* Change the value set for attribute ZScoreWeight2.
* May modify the field beforehand
* Occurs before validation.
*/
public Double setZScoreWeight2 (FactorLevelLink obj, Double newZScoreWeight2) throws FieldException
{
return newZScoreWeight2;
}
}
public ORMPipeLine pipes()
{
return new FactorLevelLinkPipeLineFactory<FactorLevelLink, FactorLevelLink> ((FactorLevelLink)this);
}
/**
* Use this instead of pipes() to get rid of type casting.
*/
public FactorLevelLinkPipeLineFactory<FactorLevelLink, FactorLevelLink> pipelineFactorLevelLink()
{
return (FactorLevelLinkPipeLineFactory<FactorLevelLink, FactorLevelLink>) pipes();
}
public static FactorLevelLinkPipeLineFactory<FactorLevelLink, FactorLevelLink> pipesFactorLevelLink(Collection<FactorLevelLink> items)
{
return REFERENCE_FactorLevelLink.new FactorLevelLinkPipeLineFactory<FactorLevelLink, FactorLevelLink> (items);
}
public static FactorLevelLinkPipeLineFactory<FactorLevelLink, FactorLevelLink> pipesFactorLevelLink(FactorLevelLink[] _items)
{
return pipesFactorLevelLink(Arrays.asList (_items));
}
public static FactorLevelLinkPipeLineFactory<FactorLevelLink, FactorLevelLink> pipesFactorLevelLink()
{
return pipesFactorLevelLink((Collection)null);
}
public class FactorLevelLinkPipeLineFactory<From extends BaseBusinessClass, Me extends FactorLevelLink> extends BaseBusinessClass.ORMPipeLine<From, Me>
{
public <Prev> FactorLevelLinkPipeLineFactory (PipeLine<From, Prev> pipeLine, Pipe<Prev, Me> nextPipe)
{
super (pipeLine, nextPipe);
}
public FactorLevelLinkPipeLineFactory (From seed)
{
super(seed);
}
public FactorLevelLinkPipeLineFactory (Collection<From> seed)
{
super(seed);
}
public PipeLine<From, ? extends Object> to(String name)
{
if (name.equals ("Description"))
{
return toDescription ();
}
if (name.equals ("ClassCode"))
{
return toClassCode ();
}
if (name.equals ("Notes"))
{
return toNotes ();
}
if (name.equals ("LeftAnnot"))
{
return toLeftAnnot ();
}
if (name.equals ("RightAnnot"))
{
return toRightAnnot ();
}
if (name.equals ("ZScoreWeight"))
{
return toZScoreWeight ();
}
if (name.equals ("ZScoreWeight2"))
{
return toZScoreWeight2 ();
}
if (name.equals ("Level"))
{
return toLevel ();
}
if (name.equals ("Factor"))
{
return toFactor ();
}
return super.to(name);
}
public PipeLine<From, String> toDescription () { return pipe(new ORMAttributePipe<Me, String>(FIELD_Description)); }
public PipeLine<From, String> toClassCode () { return pipe(new ORMAttributePipe<Me, String>(FIELD_ClassCode)); }
public PipeLine<From, String> toNotes () { return pipe(new ORMAttributePipe<Me, String>(FIELD_Notes)); }
public PipeLine<From, String> toLeftAnnot () { return pipe(new ORMAttributePipe<Me, String>(FIELD_LeftAnnot)); }
public PipeLine<From, String> toRightAnnot () { return pipe(new ORMAttributePipe<Me, String>(FIELD_RightAnnot)); }
public PipeLine<From, Double> toZScoreWeight () { return pipe(new ORMAttributePipe<Me, Double>(FIELD_ZScoreWeight)); }
public PipeLine<From, Double> toZScoreWeight2 () { return pipe(new ORMAttributePipe<Me, Double>(FIELD_ZScoreWeight2)); }
public Level.LevelPipeLineFactory<From, Level> toLevel () { return toLevel (Filter.ALL); }
public Level.LevelPipeLineFactory<From, Level> toLevel (Filter<Level> filter)
{
return Level.REFERENCE_Level.new LevelPipeLineFactory<From, Level> (this, new ORMSingleAssocPipe<Me, Level>(SINGLEREFERENCE_Level, filter));
}
public Factor.FactorPipeLineFactory<From, Factor> toFactor () { return toFactor (Filter.ALL); }
public Factor.FactorPipeLineFactory<From, Factor> toFactor (Filter<Factor> filter)
{
return Factor.REFERENCE_Factor.new FactorPipeLineFactory<From, Factor> (this, new ORMSingleAssocPipe<Me, Factor>(SINGLEREFERENCE_Factor, filter));
}
}
public boolean isTransientAttrib(String attribName)
{
return super.isTransientAttrib(attribName);
}
public boolean isTransientSingleReference(String assocName)
{
return super.isTransientSingleReference(assocName);
}
}
class DummyFactorLevelLink extends FactorLevelLink
{
// Default constructor primarily to support Externalisable
public DummyFactorLevelLink()
{
super();
}
public void assertValid ()
{
}
public Level getLevel () throws StorageException
{
return (Level)(Level.DUMMY_Level);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getLevelID ()
{
return Level.DUMMY_Level.getObjectID();
}
public Factor getFactor () throws StorageException
{
return (Factor)(Factor.DUMMY_Factor);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getFactorID ()
{
return Factor.DUMMY_Factor.getObjectID();
}
}
...@@ -41,8 +41,8 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -41,8 +41,8 @@ public abstract class BaseLevel extends BaseBusinessClass
public static final String FIELD_LevelDescription = "LevelDescription"; public static final String FIELD_LevelDescription = "LevelDescription";
public static final String FIELD_LevelNotes = "LevelNotes"; public static final String FIELD_LevelNotes = "LevelNotes";
public static final String FIELD_ReportHeader = "ReportHeader"; public static final String FIELD_ReportHeader = "ReportHeader";
public static final String MULTIPLEREFERENCE_Factors = "Factors"; public static final String MULTIPLEREFERENCE_FactorLinks = "FactorLinks";
public static final String BACKREF_Factors = ""; public static final String BACKREF_FactorLinks = "";
// Static constants corresponding to searches // Static constants corresponding to searches
...@@ -63,7 +63,7 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -63,7 +63,7 @@ public abstract class BaseLevel extends BaseBusinessClass
// Private attributes corresponding to multiple references // Private attributes corresponding to multiple references
private MultipleAssociation<Level, Factor> _Factors; private MultipleAssociation<Level, FactorLevelLink> _FactorLinks;
// Map of maps of metadata // Map of maps of metadata
...@@ -83,11 +83,11 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -83,11 +83,11 @@ public abstract class BaseLevel extends BaseBusinessClass
try try
{ {
String tmp_Factors = Factor.BACKREF_Level; String tmp_FactorLinks = FactorLevelLink.BACKREF_Level;
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping")); Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
setupAssocMetaData_Factors(); setupAssocMetaData_FactorLinks();
FIELD_LevelDescription_Validators = (AttributeValidator[])setupAttribMetaData_LevelDescription(validatorMapping).toArray (new AttributeValidator[0]); FIELD_LevelDescription_Validators = (AttributeValidator[])setupAttribMetaData_LevelDescription(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_LevelNotes_Validators = (AttributeValidator[])setupAttribMetaData_LevelNotes(validatorMapping).toArray (new AttributeValidator[0]); FIELD_LevelNotes_Validators = (AttributeValidator[])setupAttribMetaData_LevelNotes(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_ReportHeader_Validators = (AttributeValidator[])setupAttribMetaData_ReportHeader(validatorMapping).toArray (new AttributeValidator[0]); FIELD_ReportHeader_Validators = (AttributeValidator[])setupAttribMetaData_ReportHeader(validatorMapping).toArray (new AttributeValidator[0]);
...@@ -106,16 +106,16 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -106,16 +106,16 @@ public abstract class BaseLevel extends BaseBusinessClass
// Meta Info setup // Meta Info setup
private static void setupAssocMetaData_Factors() private static void setupAssocMetaData_FactorLinks()
{ {
Map metaInfo = new HashMap (); Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "Level"); metaInfo.put ("backreferenceName", "Level");
metaInfo.put ("name", "Factors"); metaInfo.put ("name", "FactorLinks");
metaInfo.put ("type", "Factor"); metaInfo.put ("type", "FactorLevelLink");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Level.Factors:", metaInfo); LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Level.FactorLinks:", metaInfo);
ATTRIBUTES_METADATA_Level.put (MULTIPLEREFERENCE_Factors, Collections.unmodifiableMap (metaInfo)); ATTRIBUTES_METADATA_Level.put (MULTIPLEREFERENCE_FactorLinks, Collections.unmodifiableMap (metaInfo));
} }
...@@ -212,7 +212,7 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -212,7 +212,7 @@ public abstract class BaseLevel extends BaseBusinessClass
{ {
super._initialiseAssociations (); super._initialiseAssociations ();
_Factors = new MultipleAssociation<Level, Factor> (this, MULTIPLEREFERENCE_Factors, Factor.SINGLEREFERENCE_Level, Factor.REFERENCE_Factor); _FactorLinks = new MultipleAssociation<Level, FactorLevelLink> (this, MULTIPLEREFERENCE_FactorLinks, FactorLevelLink.SINGLEREFERENCE_Level, FactorLevelLink.REFERENCE_FactorLevelLink);
} }
...@@ -222,7 +222,7 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -222,7 +222,7 @@ public abstract class BaseLevel extends BaseBusinessClass
{ {
super.initialiseReference (); super.initialiseReference ();
_Factors = new MultipleAssociation<Level, Factor> (this, MULTIPLEREFERENCE_Factors, Factor.SINGLEREFERENCE_Level, Factor.REFERENCE_Factor); _FactorLinks = new MultipleAssociation<Level, FactorLevelLink> (this, MULTIPLEREFERENCE_FactorLinks, FactorLevelLink.SINGLEREFERENCE_Level, FactorLevelLink.REFERENCE_FactorLevelLink);
return this; return this;
...@@ -632,7 +632,7 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -632,7 +632,7 @@ public abstract class BaseLevel extends BaseBusinessClass
List result = super.getMultiAssocs (); List result = super.getMultiAssocs ();
result.add("Factors"); result.add("FactorLinks");
return result; return result;
...@@ -645,9 +645,9 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -645,9 +645,9 @@ public abstract class BaseLevel extends BaseBusinessClass
public BaseBusinessClass getMultiAssocReferenceInstance(String attribName) public BaseBusinessClass getMultiAssocReferenceInstance(String attribName)
{ {
if (MULTIPLEREFERENCE_Factors.equals(attribName)) if (MULTIPLEREFERENCE_FactorLinks.equals(attribName))
{ {
return Factor.REFERENCE_Factor ; return FactorLevelLink.REFERENCE_FactorLevelLink ;
} }
...@@ -658,9 +658,9 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -658,9 +658,9 @@ public abstract class BaseLevel extends BaseBusinessClass
public String getMultiAssocBackReference(String attribName) public String getMultiAssocBackReference(String attribName)
{ {
if (MULTIPLEREFERENCE_Factors.equals(attribName)) if (MULTIPLEREFERENCE_FactorLinks.equals(attribName))
{ {
return Factor.SINGLEREFERENCE_Level ; return FactorLevelLink.SINGLEREFERENCE_Level ;
} }
...@@ -674,9 +674,9 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -674,9 +674,9 @@ public abstract class BaseLevel extends BaseBusinessClass
public int getMultiAssocCount(String attribName) throws StorageException public int getMultiAssocCount(String attribName) throws StorageException
{ {
if (MULTIPLEREFERENCE_Factors.equals(attribName)) if (MULTIPLEREFERENCE_FactorLinks.equals(attribName))
{ {
return this.getFactorsCount(); return this.getFactorLinksCount();
} }
...@@ -690,9 +690,9 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -690,9 +690,9 @@ public abstract class BaseLevel extends BaseBusinessClass
public BaseBusinessClass getMultiAssocAt(String attribName, int index) throws StorageException public BaseBusinessClass getMultiAssocAt(String attribName, int index) throws StorageException
{ {
if (MULTIPLEREFERENCE_Factors.equals(attribName)) if (MULTIPLEREFERENCE_FactorLinks.equals(attribName))
{ {
return this.getFactorsAt(index); return this.getFactorLinksAt(index);
} }
...@@ -706,9 +706,9 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -706,9 +706,9 @@ public abstract class BaseLevel extends BaseBusinessClass
public void addToMultiAssoc(String attribName, BaseBusinessClass newElement) throws StorageException public void addToMultiAssoc(String attribName, BaseBusinessClass newElement) throws StorageException
{ {
if (MULTIPLEREFERENCE_Factors.equals(attribName)) if (MULTIPLEREFERENCE_FactorLinks.equals(attribName))
{ {
addToFactors((Factor)newElement); addToFactorLinks((FactorLevelLink)newElement);
return; return;
} }
...@@ -723,9 +723,9 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -723,9 +723,9 @@ public abstract class BaseLevel extends BaseBusinessClass
public void removeFromMultiAssoc(String attribName, BaseBusinessClass oldElement) throws StorageException public void removeFromMultiAssoc(String attribName, BaseBusinessClass oldElement) throws StorageException
{ {
if (MULTIPLEREFERENCE_Factors.equals(attribName)) if (MULTIPLEREFERENCE_FactorLinks.equals(attribName))
{ {
removeFromFactors((Factor)oldElement); removeFromFactorLinks((FactorLevelLink)oldElement);
return; return;
} }
...@@ -738,9 +738,9 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -738,9 +738,9 @@ public abstract class BaseLevel extends BaseBusinessClass
protected void __loadMultiAssoc (String attribName, BaseBusinessClass[] elements) protected void __loadMultiAssoc (String attribName, BaseBusinessClass[] elements)
{ {
if (MULTIPLEREFERENCE_Factors.equals(attribName)) if (MULTIPLEREFERENCE_FactorLinks.equals(attribName))
{ {
_Factors.__loadAssociation (elements); _FactorLinks.__loadAssociation (elements);
return; return;
} }
...@@ -752,9 +752,9 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -752,9 +752,9 @@ public abstract class BaseLevel extends BaseBusinessClass
protected boolean __isMultiAssocLoaded (String attribName) protected boolean __isMultiAssocLoaded (String attribName)
{ {
if (MULTIPLEREFERENCE_Factors.equals(attribName)) if (MULTIPLEREFERENCE_FactorLinks.equals(attribName))
{ {
return _Factors.isLoaded (); return _FactorLinks.isLoaded ();
} }
...@@ -763,26 +763,26 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -763,26 +763,26 @@ public abstract class BaseLevel extends BaseBusinessClass
public FieldWriteability getWriteability_Factors () public FieldWriteability getWriteability_FactorLinks ()
{ {
return getFieldWritabilityUtil (FieldWriteability.TRUE); return getFieldWritabilityUtil (FieldWriteability.TRUE);
} }
public int getFactorsCount () throws StorageException public int getFactorLinksCount () throws StorageException
{ {
assertValid(); assertValid();
return _Factors.getReferencedObjectsCount (); return _FactorLinks.getReferencedObjectsCount ();
} }
public void addToFactors (Factor newElement) throws StorageException public void addToFactorLinks (FactorLevelLink newElement) throws StorageException
{ {
if (_Factors.wouldAddChange (newElement)) if (_FactorLinks.wouldAddChange (newElement))
{ {
assertValid(); assertValid();
Debug.assertion (getWriteability_Factors () != FieldWriteability.FALSE, "MultiAssoc Factors is not writeable (add)"); Debug.assertion (getWriteability_FactorLinks () != FieldWriteability.FALSE, "MultiAssoc FactorLinks is not writeable (add)");
_Factors.appendElement (newElement); _FactorLinks.appendElement (newElement);
try try
{ {
...@@ -799,13 +799,13 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -799,13 +799,13 @@ public abstract class BaseLevel extends BaseBusinessClass
} }
public void removeFromFactors (Factor elementToRemove) throws StorageException public void removeFromFactorLinks (FactorLevelLink elementToRemove) throws StorageException
{ {
if (_Factors.wouldRemoveChange (elementToRemove)) if (_FactorLinks.wouldRemoveChange (elementToRemove))
{ {
assertValid(); assertValid();
Debug.assertion (getWriteability_Factors () != FieldWriteability.FALSE, "MultiAssoc Factors is not writeable (remove)"); Debug.assertion (getWriteability_FactorLinks () != FieldWriteability.FALSE, "MultiAssoc FactorLinks is not writeable (remove)");
_Factors.removeElement (elementToRemove); _FactorLinks.removeElement (elementToRemove);
try try
{ {
if (elementToRemove.getLevel () != null) if (elementToRemove.getLevel () != null)
...@@ -821,15 +821,15 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -821,15 +821,15 @@ public abstract class BaseLevel extends BaseBusinessClass
} }
public Factor getFactorsAt (int index) throws StorageException public FactorLevelLink getFactorLinksAt (int index) throws StorageException
{ {
return (Factor)(_Factors.getElementAt (index)); return (FactorLevelLink)(_FactorLinks.getElementAt (index));
} }
public SortedSet<Factor> getFactorsSet () throws StorageException public SortedSet<FactorLevelLink> getFactorLinksSet () throws StorageException
{ {
return _Factors.getSet (); return _FactorLinks.getSet ();
} }
...@@ -838,7 +838,7 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -838,7 +838,7 @@ public abstract class BaseLevel extends BaseBusinessClass
{ {
try try
{ {
for(Factor referenced : CollectionUtils.reverse(getFactorsSet())) for(FactorLevelLink referenced : CollectionUtils.reverse(getFactorLinksSet()))
{ {
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null Level from ", getObjectID (), " to ", referenced.getObjectID ()); LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null Level from ", getObjectID (), " to ", referenced.getObjectID ());
referenced.setLevel(null); referenced.setLevel(null);
...@@ -1016,7 +1016,7 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -1016,7 +1016,7 @@ public abstract class BaseLevel extends BaseBusinessClass
{ {
BaseLevel sourceLevel = (BaseLevel)(source); BaseLevel sourceLevel = (BaseLevel)(source);
_Factors.copyFrom (sourceLevel._Factors, linkToGhosts); _FactorLinks.copyFrom (sourceLevel._FactorLinks, linkToGhosts);
} }
} }
...@@ -1040,7 +1040,7 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -1040,7 +1040,7 @@ public abstract class BaseLevel extends BaseBusinessClass
_LevelDescription = (String)(HELPER_LevelDescription.readExternal (_LevelDescription, vals.get(FIELD_LevelDescription))); // _LevelDescription = (String)(HELPER_LevelDescription.readExternal (_LevelDescription, vals.get(FIELD_LevelDescription))); //
_LevelNotes = (String)(HELPER_LevelNotes.readExternal (_LevelNotes, vals.get(FIELD_LevelNotes))); // _LevelNotes = (String)(HELPER_LevelNotes.readExternal (_LevelNotes, vals.get(FIELD_LevelNotes))); //
_ReportHeader = (String)(HELPER_ReportHeader.readExternal (_ReportHeader, vals.get(FIELD_ReportHeader))); // _ReportHeader = (String)(HELPER_ReportHeader.readExternal (_ReportHeader, vals.get(FIELD_ReportHeader))); //
_Factors.readExternalData(vals.get(MULTIPLEREFERENCE_Factors)); _FactorLinks.readExternalData(vals.get(MULTIPLEREFERENCE_FactorLinks));
} }
...@@ -1055,7 +1055,7 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -1055,7 +1055,7 @@ public abstract class BaseLevel extends BaseBusinessClass
vals.put (FIELD_LevelDescription, HELPER_LevelDescription.writeExternal (_LevelDescription)); vals.put (FIELD_LevelDescription, HELPER_LevelDescription.writeExternal (_LevelDescription));
vals.put (FIELD_LevelNotes, HELPER_LevelNotes.writeExternal (_LevelNotes)); vals.put (FIELD_LevelNotes, HELPER_LevelNotes.writeExternal (_LevelNotes));
vals.put (FIELD_ReportHeader, HELPER_ReportHeader.writeExternal (_ReportHeader)); vals.put (FIELD_ReportHeader, HELPER_ReportHeader.writeExternal (_ReportHeader));
vals.put (MULTIPLEREFERENCE_Factors, _Factors.writeExternalData()); vals.put (MULTIPLEREFERENCE_FactorLinks, _FactorLinks.writeExternalData());
} }
...@@ -1086,7 +1086,7 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -1086,7 +1086,7 @@ public abstract class BaseLevel extends BaseBusinessClass
// Compare multiple assocs // Compare multiple assocs
_Factors.compare (otherLevel._Factors, listener); _FactorLinks.compare (otherLevel._FactorLinks, listener);
} }
} }
...@@ -1107,7 +1107,7 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -1107,7 +1107,7 @@ public abstract class BaseLevel extends BaseBusinessClass
visitor.visitField(this, FIELD_LevelDescription, HELPER_LevelDescription.toObject(getLevelDescription())); visitor.visitField(this, FIELD_LevelDescription, HELPER_LevelDescription.toObject(getLevelDescription()));
visitor.visitField(this, FIELD_LevelNotes, HELPER_LevelNotes.toObject(getLevelNotes())); visitor.visitField(this, FIELD_LevelNotes, HELPER_LevelNotes.toObject(getLevelNotes()));
visitor.visitField(this, FIELD_ReportHeader, HELPER_ReportHeader.toObject(getReportHeader())); visitor.visitField(this, FIELD_ReportHeader, HELPER_ReportHeader.toObject(getReportHeader()));
visitor.visitAssociation (_Factors); visitor.visitAssociation (_FactorLinks);
} }
...@@ -1116,9 +1116,9 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -1116,9 +1116,9 @@ public abstract class BaseLevel extends BaseBusinessClass
{ {
super.visitAssociations (visitor, scope); super.visitAssociations (visitor, scope);
if (scope.includes (_Factors)) if (scope.includes (_FactorLinks))
{ {
visitor.visit (_Factors); visitor.visit (_FactorLinks);
} }
} }
...@@ -1266,9 +1266,9 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -1266,9 +1266,9 @@ public abstract class BaseLevel extends BaseBusinessClass
{ {
return getWriteability_ReportHeader (); return getWriteability_ReportHeader ();
} }
else if (fieldName.equals (MULTIPLEREFERENCE_Factors)) else if (fieldName.equals (MULTIPLEREFERENCE_FactorLinks))
{ {
return getWriteability_Factors (); return getWriteability_FactorLinks ();
} }
else else
{ {
...@@ -1463,9 +1463,9 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -1463,9 +1463,9 @@ public abstract class BaseLevel extends BaseBusinessClass
public PipeLine<From, ? extends Object> to(String name) public PipeLine<From, ? extends Object> to(String name)
{ {
if (name.equals ("Factors")) if (name.equals ("FactorLinks"))
{ {
return toFactors (); return toFactorLinks ();
} }
if (name.equals ("LevelDescription")) if (name.equals ("LevelDescription"))
{ {
...@@ -1490,11 +1490,11 @@ public abstract class BaseLevel extends BaseBusinessClass ...@@ -1490,11 +1490,11 @@ public abstract class BaseLevel extends BaseBusinessClass
public PipeLine<From, String> toLevelNotes () { return pipe(new ORMAttributePipe<Me, String>(FIELD_LevelNotes)); } public PipeLine<From, String> toLevelNotes () { return pipe(new ORMAttributePipe<Me, String>(FIELD_LevelNotes)); }
public PipeLine<From, String> toReportHeader () { return pipe(new ORMAttributePipe<Me, String>(FIELD_ReportHeader)); } public PipeLine<From, String> toReportHeader () { return pipe(new ORMAttributePipe<Me, String>(FIELD_ReportHeader)); }
public Factor.FactorPipeLineFactory<From, Factor> toFactors () { return toFactors(Filter.ALL); } public FactorLevelLink.FactorLevelLinkPipeLineFactory<From, FactorLevelLink> toFactorLinks () { return toFactorLinks(Filter.ALL); }
public Factor.FactorPipeLineFactory<From, Factor> toFactors (Filter<Factor> filter) public FactorLevelLink.FactorLevelLinkPipeLineFactory<From, FactorLevelLink> toFactorLinks (Filter<FactorLevelLink> filter)
{ {
return Factor.REFERENCE_Factor.new FactorPipeLineFactory<From, Factor> (this, new ORMMultiAssocPipe<Me, Factor>(MULTIPLEREFERENCE_Factors, filter)); return FactorLevelLink.REFERENCE_FactorLevelLink.new FactorLevelLinkPipeLineFactory<From, FactorLevelLink> (this, new ORMMultiAssocPipe<Me, FactorLevelLink>(MULTIPLEREFERENCE_FactorLinks, filter));
} }
} }
...@@ -1527,19 +1527,19 @@ class DummyLevel extends Level ...@@ -1527,19 +1527,19 @@ class DummyLevel extends Level
} }
public int getFactorsCount () throws StorageException public int getFactorLinksCount () throws StorageException
{ {
return 0; return 0;
} }
public Factor getFactorsAt (int index) throws StorageException public FactorLevelLink getFactorLinksAt (int index) throws StorageException
{ {
throw new RuntimeException ("No elements in a dummy object in association Factors"); throw new RuntimeException ("No elements in a dummy object in association FactorLinks");
} }
public SortedSet getFactorsSet () throws StorageException public SortedSet getFactorLinksSet () throws StorageException
{ {
return new TreeSet(); return new TreeSet();
} }
......
...@@ -4,21 +4,11 @@ ...@@ -4,21 +4,11 @@
<BUSINESSCLASS name="Factor" package="performa.orm"> <BUSINESSCLASS name="Factor" package="performa.orm">
<TABLE name="factor_hdr" tablePrefix="object" polymorphic="FALSE"> <MULTIPLEREFERENCE name="FactorLinks" type="FactorLevelLink" backreferenceName="Factor" />
<TABLE name="factor" tablePrefix="object" polymorphic="FALSE">
<ATTRIB name="Description" type="String" dbcol="factor_hdr_desc" length="30"/> <ATTRIB name="Description" type="String" dbcol="factor_hdr_desc" length="30"/>
<ATTRIB name="ClassCode" type="String" dbcol="class_code" length="15"/>
<ATTRIB name="Notes" type="String" dbcol="factor_hdr_notes"/>
<ATTRIB name="LeftAnnot" type="String" dbcol="left_annot" length="60"/>
<ATTRIB name="RightAnnot" type="String" dbcol="right_annot" length="60"/>
<ATTRIB name="DescriptionSchinese" type="String" dbcol="factor_hdr_desc_schinese" length="120"/>
<ATTRIB name="DescriptionChinese" type="String" dbcol="factor_hdr_desc_chinese" length="120"/>
<ATTRIB name="DescriptionKorean" type="String" dbcol="factor_hdr_desc_korean" length="120"/>
<ATTRIB name="DescriptionThai" type="String" dbcol="factor_hdr_desc_thai" length="120"/>
<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="Factors" />
</TABLE> </TABLE>
......
package performa.orm;
public class FactorLevelLink extends BaseFactorLevelLink
{
private static final long serialVersionUID = 0L;
// This constructor should not be called
public FactorLevelLink ()
{
// 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="FactorLevelLink" package="performa.orm">
<TABLE name="factor_hdr" tablePrefix="object" polymorphic="FALSE">
<ATTRIB name="Description" type="String" dbcol="factor_hdr_desc" length="30"/>
<ATTRIB name="ClassCode" type="String" dbcol="class_code" length="15"/>
<ATTRIB name="Notes" type="String" dbcol="factor_hdr_notes"/>
<ATTRIB name="LeftAnnot" type="String" dbcol="left_annot" length="60"/>
<ATTRIB name="RightAnnot" type="String" dbcol="right_annot" length="60"/>
<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" />
</TABLE>
</BUSINESSCLASS>
</ROOT>
\ No newline at end of file
package performa.orm;
import java.io.*;
import java.util.*;
import java.sql.ResultSet;
import java.sql.SQLException;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.objstore.assocs.*;
import oneit.objstore.rdbms.*;
import oneit.objstore.utils.*;
import oneit.sql.*;
import oneit.utils.resource.*;
import oneit.utils.*;
import oneit.utils.threading.*;
/**
* IMPORTANT!!!! Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2[oneit.objstore.PersistenceMgrTemplate.xsl]
*/
public class FactorLevelLinkPersistenceMgr extends ObjectPersistenceMgr
{
private static final LoggingArea FactorLevelLinkPersistence = LoggingArea.createLoggingArea(ObjectPersistenceMgr.OBJECT_PERSISTENCE, "FactorLevelLink");
// Private attributes corresponding to business object data
private String dummyDescription;
private String dummyClassCode;
private String dummyNotes;
private String dummyLeftAnnot;
private String dummyRightAnnot;
private Double dummyZScoreWeight;
private Double dummyZScoreWeight2;
// Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper HELPER_Description = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_ClassCode = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_Notes = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_LeftAnnot = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_RightAnnot = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_ZScoreWeight = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_ZScoreWeight2 = DefaultAttributeHelper.INSTANCE;
public FactorLevelLinkPersistenceMgr ()
{
dummyDescription = (String)(HELPER_Description.initialise (dummyDescription));
dummyClassCode = (String)(HELPER_ClassCode.initialise (dummyClassCode));
dummyNotes = (String)(HELPER_Notes.initialise (dummyNotes));
dummyLeftAnnot = (String)(HELPER_LeftAnnot.initialise (dummyLeftAnnot));
dummyRightAnnot = (String)(HELPER_RightAnnot.initialise (dummyRightAnnot));
dummyZScoreWeight = (Double)(HELPER_ZScoreWeight.initialise (dummyZScoreWeight));
dummyZScoreWeight2 = (Double)(HELPER_ZScoreWeight2.initialise (dummyZScoreWeight2));
}
private String SELECT_COLUMNS = "{PREFIX}factor_hdr.object_id as id, {PREFIX}factor_hdr.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}factor_hdr.object_CREATED_DATE as CREATED_DATE, {PREFIX}factor_hdr.factor_hdr_desc, {PREFIX}factor_hdr.class_code, {PREFIX}factor_hdr.factor_hdr_notes, {PREFIX}factor_hdr.left_annot, {PREFIX}factor_hdr.right_annot, {PREFIX}factor_hdr.z_score_wght, {PREFIX}factor_hdr.z_score_wght_2, {PREFIX}factor_hdr.level_number, {PREFIX}factor_hdr.factor_number, 1 AS commasafe ";
private String SELECT_JOINS = "";
public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
Set<BaseBusinessClass> resultByIDs = fetchByIDs(Collections.singleton (id), allPSets, context, sqlMgr);
if (resultByIDs.isEmpty ())
{
return null;
}
else if (resultByIDs.size () > 1)
{
throw new StorageException ("Multiple results for id:" + id);
}
else
{
return resultByIDs.iterator ().next ();
}
}
public Set<BaseBusinessClass> fetchByIDs(Set<ObjectID> ids, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
Set<BaseBusinessClass> results = new HashSet ();
Set<Long> idsToFetch = new HashSet ();
for (ObjectID id : ids)
{
if (context.containsObject(id)) // Check for cached version
{
BaseBusinessClass objectToReturn = context.getObjectToReplace(id, FactorLevelLink.REFERENCE_FactorLevelLink);
if (objectToReturn instanceof FactorLevelLink)
{
LogMgr.log (FactorLevelLinkPersistence, LogLevel.TRACE, "Cache hit for id:", id);
results.add (objectToReturn);
}
else
{
throw new StorageException ("Cache collision for id:" + id + " with object " + objectToReturn + "while fetching a FactorLevelLink");
}
}
PersistentSet factor_hdrPSet = allPSets.getPersistentSet(id, "factor_hdr", PersistentSetStatus.FETCHED);
// Check for persistent sets already prefetched
if (false || !factor_hdrPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!factor_hdrPSet.containsAttrib(FactorLevelLink.FIELD_Description)||
!factor_hdrPSet.containsAttrib(FactorLevelLink.FIELD_ClassCode)||
!factor_hdrPSet.containsAttrib(FactorLevelLink.FIELD_Notes)||
!factor_hdrPSet.containsAttrib(FactorLevelLink.FIELD_LeftAnnot)||
!factor_hdrPSet.containsAttrib(FactorLevelLink.FIELD_RightAnnot)||
!factor_hdrPSet.containsAttrib(FactorLevelLink.FIELD_ZScoreWeight)||
!factor_hdrPSet.containsAttrib(FactorLevelLink.FIELD_ZScoreWeight2)||
!factor_hdrPSet.containsAttrib(FactorLevelLink.SINGLEREFERENCE_Level)||
!factor_hdrPSet.containsAttrib(FactorLevelLink.SINGLEREFERENCE_Factor))
{
// We will need to retrieve it
idsToFetch.add (id.longValue());
}
else
{
LogMgr.log (FactorLevelLinkPersistence, LogLevel.DEBUG2, "Persistent set preloaded id:", id);
/* Non Polymorphic */
FactorLevelLink result = new FactorLevelLink ();
result.setFromPersistentSets(id, allPSets);
context.addRetrievedObject(result);
results.add (result);
}
}
if (idsToFetch.size () > 0)
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}factor_hdr " +
"WHERE " + SELECT_JOINS + "{PREFIX}factor_hdr.object_id IN ?";
BaseBusinessClass[] resultsFetched = loadQuery (allPSets, sqlMgr, context, query, new Object[] { idsToFetch }, null, false);
for (BaseBusinessClass objFetched : resultsFetched)
{
results.add (objFetched);
}
}
return results;
}
public BaseBusinessClass[] getReferencedObjects(ObjectID _objectID, String refName, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
if (false)
{
throw new RuntimeException ();
}
else if (refName.equals (FactorLevelLink.SINGLEREFERENCE_Level))
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}factor_hdr " +
"WHERE " + SELECT_JOINS + "level_number = ?";
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, new Object[] { _objectID.longID () }, null, false);
return results;
}
else if (refName.equals (FactorLevelLink.SINGLEREFERENCE_Factor))
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}factor_hdr " +
"WHERE " + SELECT_JOINS + "factor_number = ?";
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, new Object[] { _objectID.longID () }, null, false);
return results;
}
else
{
throw new IllegalArgumentException ("Illegal reference type:" + refName);
}
}
public void update(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, ConcurrentUpdateConflictException, StorageException
{
EqualityResult test = EqualityResult.compare (obj, obj.getBackup ());
ObjectID objectID = obj.getID ();
if (!test.areAttributesEqual () || !test.areSingleAssocsEqual () || obj.getForcedSave())
{
PersistentSet factor_hdrPSet = allPSets.getPersistentSet(objectID, "factor_hdr");
if (factor_hdrPSet.getStatus () != PersistentSetStatus.PROCESSED &&
factor_hdrPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}factor_hdr " +
"SET factor_hdr_desc = ?, class_code = ?, factor_hdr_notes = ?, left_annot = ?, right_annot = ?, z_score_wght = ?, z_score_wght_2 = ?, level_number = ? , factor_number = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE factor_hdr.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_Description.getForSQL(dummyDescription, factor_hdrPSet.getAttrib (FactorLevelLink.FIELD_Description))).listEntry (HELPER_ClassCode.getForSQL(dummyClassCode, factor_hdrPSet.getAttrib (FactorLevelLink.FIELD_ClassCode))).listEntry (HELPER_Notes.getForSQL(dummyNotes, factor_hdrPSet.getAttrib (FactorLevelLink.FIELD_Notes))).listEntry (HELPER_LeftAnnot.getForSQL(dummyLeftAnnot, factor_hdrPSet.getAttrib (FactorLevelLink.FIELD_LeftAnnot))).listEntry (HELPER_RightAnnot.getForSQL(dummyRightAnnot, factor_hdrPSet.getAttrib (FactorLevelLink.FIELD_RightAnnot))).listEntry (HELPER_ZScoreWeight.getForSQL(dummyZScoreWeight, factor_hdrPSet.getAttrib (FactorLevelLink.FIELD_ZScoreWeight))).listEntry (HELPER_ZScoreWeight2.getForSQL(dummyZScoreWeight2, factor_hdrPSet.getAttrib (FactorLevelLink.FIELD_ZScoreWeight2))).listEntry (SQLManager.CheckNull((Long)(factor_hdrPSet.getAttrib (FactorLevelLink.SINGLEREFERENCE_Level)))).listEntry (SQLManager.CheckNull((Long)(factor_hdrPSet.getAttrib (FactorLevelLink.SINGLEREFERENCE_Factor)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
if (rowsUpdated != 1)
{
// Error, either a concurrency error or a not-exists error
ResultSet r = executeQuery (sqlMgr,
"SELECT object_id, object_LAST_UPDATED_DATE FROM {PREFIX}factor_hdr WHERE object_id = ?",
new Object[] { objectID.longID () });
if (r.next ())
{
Date d = new java.util.Date (r.getTimestamp (2).getTime());
String errorMsg = QueryBuilder.buildQueryString ("Concurrent update error:[?] for row:[?] objDate:[?] dbDate:[?]",
new Object[] { "factor_hdr", objectID.longID (), obj.getObjectLastModified (), d },
sqlMgr.getPortabilityServices ());
LogMgr.log (FactorLevelLinkPersistence, LogLevel.BUSINESS1, errorMsg);
throw new ConcurrentUpdateConflictException (obj, "factor_hdr");
}
else
{
String errorMsg = "Attempt to update nonexistent row in table:factor_hdr for row:" + objectID + " objDate:" + obj.getObjectLastModified ();
LogMgr.log (FactorLevelLinkPersistence, LogLevel.BUSINESS1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
factor_hdrPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
else
{
LogMgr.log (FactorLevelLinkPersistence, LogLevel.DEBUG1, "Skipping update since no attribs or simple assocs changed on ", objectID);
}
}
public void delete(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, ConcurrentUpdateConflictException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet factor_hdrPSet = allPSets.getPersistentSet(objectID, "factor_hdr");
LogMgr.log (FactorLevelLinkPersistence, LogLevel.DEBUG2, "Deleting:", objectID);
if (factor_hdrPSet.getStatus () != PersistentSetStatus.PROCESSED &&
factor_hdrPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsDeleted = executeStatement (sqlMgr,
"DELETE " +
"FROM {PREFIX}factor_hdr " +
"WHERE factor_hdr.object_id = ? AND " + sqlMgr.getPortabilityServices ().getTruncatedTimestampColumn ("object_LAST_UPDATED_DATE") + " = " + sqlMgr.getPortabilityServices ().getTruncatedTimestampParam("?") + " ",
new Object[] { objectID.longID(), obj.getObjectLastModified () });
if (rowsDeleted != 1)
{
// Error, either a concurrency error or a not-exists error
ResultSet r = executeQuery (sqlMgr,
"SELECT object_id FROM {PREFIX}factor_hdr WHERE object_id = ?",
new Object[] { objectID.longID() });
if (r.next ())
{
throw new ConcurrentUpdateConflictException (obj, "factor_hdr");
}
else
{
String errorMsg = "Attempt to delete nonexistent row in table:factor_hdr for row:" + objectID;
LogMgr.log (FactorLevelLinkPersistence, LogLevel.SYSTEMERROR1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
factor_hdrPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
public BaseBusinessClass[] loadQuery (PersistentSetCollection allPSets, SQLManager sqlMgr, RDBMSPersistenceContext context, String query, Object[] params, Integer maxRows, boolean truncateExtra) throws SQLException, StorageException
{
LinkedHashMap<ObjectID, FactorLevelLink> results = new LinkedHashMap ();
ResultSet r = executeQuery (sqlMgr, query, params);
while (r.next())
{
ThreadUtils.checkInterrupted ();
ObjectID objectID = new ObjectID (FactorLevelLink.REFERENCE_FactorLevelLink.getObjectIDSpace (), r.getLong ("id"));
FactorLevelLink resultElement;
if (maxRows != null && !results.containsKey (objectID) && results.size () >= maxRows)
{
if (truncateExtra)
{
break;
}
else
{
throw new SearchRowsExceededException ("Maximum rows exceeded:" + maxRows);
}
}
if (context.containsObject(objectID))
{
BaseBusinessClass cachedElement = context.getObjectToReplace(objectID, FactorLevelLink.REFERENCE_FactorLevelLink);
if (cachedElement instanceof FactorLevelLink)
{
LogMgr.log (FactorLevelLinkPersistence, LogLevel.TRACE, "Cache hit for id:", objectID);
resultElement = (FactorLevelLink)cachedElement;
}
else
{
throw new StorageException ("Cache collision for id:" + objectID + " with object " + cachedElement + "while fetching a FactorLevelLink");
}
}
else
{
PersistentSet factor_hdrPSet = allPSets.getPersistentSet(objectID, "factor_hdr", PersistentSetStatus.FETCHED);
createPersistentSetFromRS(allPSets, r, objectID);
resultElement = new FactorLevelLink ();
resultElement.setFromPersistentSets(objectID, allPSets);
context.addRetrievedObject(resultElement);
}
results.put (objectID, resultElement);
}
BaseBusinessClass[] resultsArr = new BaseBusinessClass[results.size ()];
return results.values ().toArray (resultsArr);
}
public BaseBusinessClass[] find(String searchType, PersistentSetCollection allPSets, Hashtable criteria, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
LogMgr.log (FactorLevelLinkPersistence, LogLevel.DEBUG2, "Search executing:", searchType, " criteria:", criteria);
String customParamFilter = (String)criteria.get (SEARCH_CustomFilter);
String customOrderBy = (String)criteria.get (SEARCH_OrderBy);
String customTables = (String)criteria.get (SEARCH_CustomExtraTables);
Boolean noCommaBeforeCustomExtraTables = (Boolean)criteria.get (SEARCH_CustomExtraTablesNoComma);
if (searchType.equals (SEARCH_CustomSQL))
{
Set<ObjectID> processedIDs = new HashSet();
SearchParamTransform tx = new SearchParamTransform (criteria);
Object[] searchParams;
customParamFilter = StringUtils.replaceParams (customParamFilter, tx);
searchParams = tx.getParamsArray();
if (customOrderBy != null)
{
customOrderBy = " ORDER BY " + customOrderBy;
}
else
{
customOrderBy = "";
}
ResultSet r;
String concatCustomTableWith = CollectionUtils.equals(noCommaBeforeCustomExtraTables, true) ? " " : ", ";
String tables = StringUtils.subBlanks(customTables) == null ? " " : concatCustomTableWith + customTables + " ";
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}factor_hdr " + tables +
"WHERE " + SELECT_JOINS + " " + customParamFilter + customOrderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, null, false);
return results;
}
else
{
throw new IllegalArgumentException ("Illegal search type:" + searchType);
}
}
private void createPersistentSetFromRS(PersistentSetCollection allPSets, ResultSet r, ObjectID objectID) throws SQLException
{
PersistentSet factor_hdrPSet = allPSets.getPersistentSet(objectID, "factor_hdr", PersistentSetStatus.FETCHED);
// Object Modified
factor_hdrPSet.setAttrib(BaseBusinessClass.FIELD_ObjectLastModified, r.getTimestamp ("LAST_UPDATED_DATE"));
// Object Created
factor_hdrPSet.setAttrib(BaseBusinessClass.FIELD_ObjectCreated, r.getTimestamp ("CREATED_DATE"));
factor_hdrPSet.setAttrib(FactorLevelLink.FIELD_Description, HELPER_Description.getFromRS(dummyDescription, r, "factor_hdr_desc"));
factor_hdrPSet.setAttrib(FactorLevelLink.FIELD_ClassCode, HELPER_ClassCode.getFromRS(dummyClassCode, r, "class_code"));
factor_hdrPSet.setAttrib(FactorLevelLink.FIELD_Notes, HELPER_Notes.getFromRS(dummyNotes, r, "factor_hdr_notes"));
factor_hdrPSet.setAttrib(FactorLevelLink.FIELD_LeftAnnot, HELPER_LeftAnnot.getFromRS(dummyLeftAnnot, r, "left_annot"));
factor_hdrPSet.setAttrib(FactorLevelLink.FIELD_RightAnnot, HELPER_RightAnnot.getFromRS(dummyRightAnnot, r, "right_annot"));
factor_hdrPSet.setAttrib(FactorLevelLink.FIELD_ZScoreWeight, HELPER_ZScoreWeight.getFromRS(dummyZScoreWeight, r, "z_score_wght"));
factor_hdrPSet.setAttrib(FactorLevelLink.FIELD_ZScoreWeight2, HELPER_ZScoreWeight2.getFromRS(dummyZScoreWeight2, r, "z_score_wght_2"));
factor_hdrPSet.setAttrib(FactorLevelLink.SINGLEREFERENCE_Level, r.getObject ("level_number"));
factor_hdrPSet.setAttrib(FactorLevelLink.SINGLEREFERENCE_Factor, r.getObject ("factor_number"));
}
public void create(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet factor_hdrPSet = allPSets.getPersistentSet(objectID, "factor_hdr");
if (factor_hdrPSet.getStatus () != PersistentSetStatus.PROCESSED &&
factor_hdrPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
executeStatement (sqlMgr,
"INSERT INTO {PREFIX}factor_hdr " +
" (factor_hdr_desc, class_code, factor_hdr_notes, left_annot, right_annot, z_score_wght, z_score_wght_2, level_number, factor_number, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " +
" (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_Description.getForSQL(dummyDescription, factor_hdrPSet.getAttrib (FactorLevelLink.FIELD_Description))).listEntry (HELPER_ClassCode.getForSQL(dummyClassCode, factor_hdrPSet.getAttrib (FactorLevelLink.FIELD_ClassCode))).listEntry (HELPER_Notes.getForSQL(dummyNotes, factor_hdrPSet.getAttrib (FactorLevelLink.FIELD_Notes))).listEntry (HELPER_LeftAnnot.getForSQL(dummyLeftAnnot, factor_hdrPSet.getAttrib (FactorLevelLink.FIELD_LeftAnnot))).listEntry (HELPER_RightAnnot.getForSQL(dummyRightAnnot, factor_hdrPSet.getAttrib (FactorLevelLink.FIELD_RightAnnot))).listEntry (HELPER_ZScoreWeight.getForSQL(dummyZScoreWeight, factor_hdrPSet.getAttrib (FactorLevelLink.FIELD_ZScoreWeight))).listEntry (HELPER_ZScoreWeight2.getForSQL(dummyZScoreWeight2, factor_hdrPSet.getAttrib (FactorLevelLink.FIELD_ZScoreWeight2))) .listEntry (SQLManager.CheckNull((Long)(factor_hdrPSet.getAttrib (FactorLevelLink.SINGLEREFERENCE_Level)))).listEntry (SQLManager.CheckNull((Long)(factor_hdrPSet.getAttrib (FactorLevelLink.SINGLEREFERENCE_Factor)))) .listEntry (objectID.longID ()).toList().toArray());
factor_hdrPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
}
...@@ -27,30 +27,10 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr ...@@ -27,30 +27,10 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr
// Private attributes corresponding to business object data // Private attributes corresponding to business object data
private String dummyDescription; private String dummyDescription;
private String dummyClassCode;
private String dummyNotes;
private String dummyLeftAnnot;
private String dummyRightAnnot;
private String dummyDescriptionSchinese;
private String dummyDescriptionChinese;
private String dummyDescriptionKorean;
private String dummyDescriptionThai;
private Double dummyZScoreWeight;
private Double dummyZScoreWeight2;
// Static constants corresponding to attribute helpers // Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper HELPER_Description = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper HELPER_Description = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_ClassCode = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_Notes = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_LeftAnnot = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_RightAnnot = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_DescriptionSchinese = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_DescriptionChinese = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_DescriptionKorean = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_DescriptionThai = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_ZScoreWeight = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_ZScoreWeight2 = DefaultAttributeHelper.INSTANCE;
...@@ -58,20 +38,10 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr ...@@ -58,20 +38,10 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr
public FactorPersistenceMgr () public FactorPersistenceMgr ()
{ {
dummyDescription = (String)(HELPER_Description.initialise (dummyDescription)); dummyDescription = (String)(HELPER_Description.initialise (dummyDescription));
dummyClassCode = (String)(HELPER_ClassCode.initialise (dummyClassCode));
dummyNotes = (String)(HELPER_Notes.initialise (dummyNotes));
dummyLeftAnnot = (String)(HELPER_LeftAnnot.initialise (dummyLeftAnnot));
dummyRightAnnot = (String)(HELPER_RightAnnot.initialise (dummyRightAnnot));
dummyDescriptionSchinese = (String)(HELPER_DescriptionSchinese.initialise (dummyDescriptionSchinese));
dummyDescriptionChinese = (String)(HELPER_DescriptionChinese.initialise (dummyDescriptionChinese));
dummyDescriptionKorean = (String)(HELPER_DescriptionKorean.initialise (dummyDescriptionKorean));
dummyDescriptionThai = (String)(HELPER_DescriptionThai.initialise (dummyDescriptionThai));
dummyZScoreWeight = (Double)(HELPER_ZScoreWeight.initialise (dummyZScoreWeight));
dummyZScoreWeight2 = (Double)(HELPER_ZScoreWeight2.initialise (dummyZScoreWeight2));
} }
private String SELECT_COLUMNS = "{PREFIX}factor_hdr.object_id as id, {PREFIX}factor_hdr.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}factor_hdr.object_CREATED_DATE as CREATED_DATE, {PREFIX}factor_hdr.factor_hdr_desc, {PREFIX}factor_hdr.class_code, {PREFIX}factor_hdr.factor_hdr_notes, {PREFIX}factor_hdr.left_annot, {PREFIX}factor_hdr.right_annot, {PREFIX}factor_hdr.factor_hdr_desc_schinese, {PREFIX}factor_hdr.factor_hdr_desc_chinese, {PREFIX}factor_hdr.factor_hdr_desc_korean, {PREFIX}factor_hdr.factor_hdr_desc_thai, {PREFIX}factor_hdr.z_score_wght, {PREFIX}factor_hdr.z_score_wght_2, {PREFIX}factor_hdr.level_number, 1 AS commasafe "; private String SELECT_COLUMNS = "{PREFIX}factor.object_id as id, {PREFIX}factor.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}factor.object_CREATED_DATE as CREATED_DATE, {PREFIX}factor.factor_hdr_desc, 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
...@@ -116,24 +86,13 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr ...@@ -116,24 +86,13 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr
} }
} }
PersistentSet factor_hdrPSet = allPSets.getPersistentSet(id, "factor_hdr", PersistentSetStatus.FETCHED); PersistentSet factorPSet = allPSets.getPersistentSet(id, "factor", PersistentSetStatus.FETCHED);
// Check for persistent sets already prefetched // Check for persistent sets already prefetched
if (false || !factor_hdrPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) || if (false || !factorPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!factor_hdrPSet.containsAttrib(Factor.FIELD_Description)|| !factorPSet.containsAttrib(Factor.FIELD_Description))
!factor_hdrPSet.containsAttrib(Factor.FIELD_ClassCode)||
!factor_hdrPSet.containsAttrib(Factor.FIELD_Notes)||
!factor_hdrPSet.containsAttrib(Factor.FIELD_LeftAnnot)||
!factor_hdrPSet.containsAttrib(Factor.FIELD_RightAnnot)||
!factor_hdrPSet.containsAttrib(Factor.FIELD_DescriptionSchinese)||
!factor_hdrPSet.containsAttrib(Factor.FIELD_DescriptionChinese)||
!factor_hdrPSet.containsAttrib(Factor.FIELD_DescriptionKorean)||
!factor_hdrPSet.containsAttrib(Factor.FIELD_DescriptionThai)||
!factor_hdrPSet.containsAttrib(Factor.FIELD_ZScoreWeight)||
!factor_hdrPSet.containsAttrib(Factor.FIELD_ZScoreWeight2)||
!factor_hdrPSet.containsAttrib(Factor.SINGLEREFERENCE_Level))
{ {
// We will need to retrieve it // We will need to retrieve it
idsToFetch.add (id.longValue()); idsToFetch.add (id.longValue());
...@@ -156,8 +115,8 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr ...@@ -156,8 +115,8 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr
if (idsToFetch.size () > 0) if (idsToFetch.size () > 0)
{ {
String query = "SELECT " + SELECT_COLUMNS + String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}factor_hdr " + "FROM {PREFIX}factor " +
"WHERE " + SELECT_JOINS + "{PREFIX}factor_hdr.object_id IN ?"; "WHERE " + SELECT_JOINS + "{PREFIX}factor.object_id IN ?";
BaseBusinessClass[] resultsFetched = loadQuery (allPSets, sqlMgr, context, query, new Object[] { idsToFetch }, null, false); BaseBusinessClass[] resultsFetched = loadQuery (allPSets, sqlMgr, context, query, new Object[] { idsToFetch }, null, false);
...@@ -179,16 +138,6 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr ...@@ -179,16 +138,6 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr
{ {
throw new RuntimeException (); throw new RuntimeException ();
} }
else if (refName.equals (Factor.SINGLEREFERENCE_Level))
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}factor_hdr " +
"WHERE " + SELECT_JOINS + "level_number = ?";
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, new Object[] { _objectID.longID () }, null, false);
return results;
}
else else
{ {
throw new IllegalArgumentException ("Illegal reference type:" + refName); throw new IllegalArgumentException ("Illegal reference type:" + refName);
...@@ -204,47 +153,47 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr ...@@ -204,47 +153,47 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr
if (!test.areAttributesEqual () || !test.areSingleAssocsEqual () || obj.getForcedSave()) if (!test.areAttributesEqual () || !test.areSingleAssocsEqual () || obj.getForcedSave())
{ {
PersistentSet factor_hdrPSet = allPSets.getPersistentSet(objectID, "factor_hdr"); PersistentSet factorPSet = allPSets.getPersistentSet(objectID, "factor");
if (factor_hdrPSet.getStatus () != PersistentSetStatus.PROCESSED && if (factorPSet.getStatus () != PersistentSetStatus.PROCESSED &&
factor_hdrPSet.getStatus () != PersistentSetStatus.DEFERRED) factorPSet.getStatus () != PersistentSetStatus.DEFERRED)
{ {
int rowsUpdated = executeStatement (sqlMgr, int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}factor_hdr " + "UPDATE {PREFIX}factor " +
"SET factor_hdr_desc = ?, class_code = ?, factor_hdr_notes = ?, left_annot = ?, right_annot = ?, factor_hdr_desc_schinese = ?, factor_hdr_desc_chinese = ?, factor_hdr_desc_korean = ?, factor_hdr_desc_thai = ?, z_score_wght = ?, z_score_wght_2 = ?, level_number = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " + "SET factor_hdr_desc = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE factor_hdr.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ", "WHERE factor.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_Description.getForSQL(dummyDescription, factor_hdrPSet.getAttrib (Factor.FIELD_Description))).listEntry (HELPER_ClassCode.getForSQL(dummyClassCode, factor_hdrPSet.getAttrib (Factor.FIELD_ClassCode))).listEntry (HELPER_Notes.getForSQL(dummyNotes, factor_hdrPSet.getAttrib (Factor.FIELD_Notes))).listEntry (HELPER_LeftAnnot.getForSQL(dummyLeftAnnot, factor_hdrPSet.getAttrib (Factor.FIELD_LeftAnnot))).listEntry (HELPER_RightAnnot.getForSQL(dummyRightAnnot, factor_hdrPSet.getAttrib (Factor.FIELD_RightAnnot))).listEntry (HELPER_DescriptionSchinese.getForSQL(dummyDescriptionSchinese, factor_hdrPSet.getAttrib (Factor.FIELD_DescriptionSchinese))).listEntry (HELPER_DescriptionChinese.getForSQL(dummyDescriptionChinese, factor_hdrPSet.getAttrib (Factor.FIELD_DescriptionChinese))).listEntry (HELPER_DescriptionKorean.getForSQL(dummyDescriptionKorean, factor_hdrPSet.getAttrib (Factor.FIELD_DescriptionKorean))).listEntry (HELPER_DescriptionThai.getForSQL(dummyDescriptionThai, factor_hdrPSet.getAttrib (Factor.FIELD_DescriptionThai))).listEntry (HELPER_ZScoreWeight.getForSQL(dummyZScoreWeight, factor_hdrPSet.getAttrib (Factor.FIELD_ZScoreWeight))).listEntry (HELPER_ZScoreWeight2.getForSQL(dummyZScoreWeight2, factor_hdrPSet.getAttrib (Factor.FIELD_ZScoreWeight2))).listEntry (SQLManager.CheckNull((Long)(factor_hdrPSet.getAttrib (Factor.SINGLEREFERENCE_Level)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray()); CollectionUtils.listEntry (HELPER_Description.getForSQL(dummyDescription, factorPSet.getAttrib (Factor.FIELD_Description))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
if (rowsUpdated != 1) if (rowsUpdated != 1)
{ {
// Error, either a concurrency error or a not-exists error // Error, either a concurrency error or a not-exists error
ResultSet r = executeQuery (sqlMgr, ResultSet r = executeQuery (sqlMgr,
"SELECT object_id, object_LAST_UPDATED_DATE FROM {PREFIX}factor_hdr WHERE object_id = ?", "SELECT object_id, object_LAST_UPDATED_DATE FROM {PREFIX}factor WHERE object_id = ?",
new Object[] { objectID.longID () }); new Object[] { objectID.longID () });
if (r.next ()) if (r.next ())
{ {
Date d = new java.util.Date (r.getTimestamp (2).getTime()); Date d = new java.util.Date (r.getTimestamp (2).getTime());
String errorMsg = QueryBuilder.buildQueryString ("Concurrent update error:[?] for row:[?] objDate:[?] dbDate:[?]", String errorMsg = QueryBuilder.buildQueryString ("Concurrent update error:[?] for row:[?] objDate:[?] dbDate:[?]",
new Object[] { "factor_hdr", objectID.longID (), obj.getObjectLastModified (), d }, new Object[] { "factor", objectID.longID (), obj.getObjectLastModified (), d },
sqlMgr.getPortabilityServices ()); sqlMgr.getPortabilityServices ());
LogMgr.log (FactorPersistence, LogLevel.BUSINESS1, errorMsg); LogMgr.log (FactorPersistence, LogLevel.BUSINESS1, errorMsg);
throw new ConcurrentUpdateConflictException (obj, "factor_hdr"); throw new ConcurrentUpdateConflictException (obj, "factor");
} }
else else
{ {
String errorMsg = "Attempt to update nonexistent row in table:factor_hdr for row:" + objectID + " objDate:" + obj.getObjectLastModified (); String errorMsg = "Attempt to update nonexistent row in table:factor for row:" + objectID + " objDate:" + obj.getObjectLastModified ();
LogMgr.log (FactorPersistence, LogLevel.BUSINESS1, errorMsg); LogMgr.log (FactorPersistence, LogLevel.BUSINESS1, errorMsg);
throw new RuntimeException (errorMsg); throw new RuntimeException (errorMsg);
} }
} }
factor_hdrPSet.setStatus (PersistentSetStatus.PROCESSED); factorPSet.setStatus (PersistentSetStatus.PROCESSED);
} }
} }
...@@ -259,42 +208,42 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr ...@@ -259,42 +208,42 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr
public void delete(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, ConcurrentUpdateConflictException, StorageException public void delete(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, ConcurrentUpdateConflictException, StorageException
{ {
ObjectID objectID = obj.getID (); ObjectID objectID = obj.getID ();
PersistentSet factor_hdrPSet = allPSets.getPersistentSet(objectID, "factor_hdr"); PersistentSet factorPSet = allPSets.getPersistentSet(objectID, "factor");
LogMgr.log (FactorPersistence, LogLevel.DEBUG2, "Deleting:", objectID); LogMgr.log (FactorPersistence, LogLevel.DEBUG2, "Deleting:", objectID);
if (factor_hdrPSet.getStatus () != PersistentSetStatus.PROCESSED && if (factorPSet.getStatus () != PersistentSetStatus.PROCESSED &&
factor_hdrPSet.getStatus () != PersistentSetStatus.DEFERRED) factorPSet.getStatus () != PersistentSetStatus.DEFERRED)
{ {
int rowsDeleted = executeStatement (sqlMgr, int rowsDeleted = executeStatement (sqlMgr,
"DELETE " + "DELETE " +
"FROM {PREFIX}factor_hdr " + "FROM {PREFIX}factor " +
"WHERE factor_hdr.object_id = ? AND " + sqlMgr.getPortabilityServices ().getTruncatedTimestampColumn ("object_LAST_UPDATED_DATE") + " = " + sqlMgr.getPortabilityServices ().getTruncatedTimestampParam("?") + " ", "WHERE factor.object_id = ? AND " + sqlMgr.getPortabilityServices ().getTruncatedTimestampColumn ("object_LAST_UPDATED_DATE") + " = " + sqlMgr.getPortabilityServices ().getTruncatedTimestampParam("?") + " ",
new Object[] { objectID.longID(), obj.getObjectLastModified () }); new Object[] { objectID.longID(), obj.getObjectLastModified () });
if (rowsDeleted != 1) if (rowsDeleted != 1)
{ {
// Error, either a concurrency error or a not-exists error // Error, either a concurrency error or a not-exists error
ResultSet r = executeQuery (sqlMgr, ResultSet r = executeQuery (sqlMgr,
"SELECT object_id FROM {PREFIX}factor_hdr WHERE object_id = ?", "SELECT object_id FROM {PREFIX}factor WHERE object_id = ?",
new Object[] { objectID.longID() }); new Object[] { objectID.longID() });
if (r.next ()) if (r.next ())
{ {
throw new ConcurrentUpdateConflictException (obj, "factor_hdr"); throw new ConcurrentUpdateConflictException (obj, "factor");
} }
else else
{ {
String errorMsg = "Attempt to delete nonexistent row in table:factor_hdr for row:" + objectID; String errorMsg = "Attempt to delete nonexistent row in table:factor for row:" + objectID;
LogMgr.log (FactorPersistence, LogLevel.SYSTEMERROR1, errorMsg); LogMgr.log (FactorPersistence, LogLevel.SYSTEMERROR1, errorMsg);
throw new RuntimeException (errorMsg); throw new RuntimeException (errorMsg);
} }
} }
factor_hdrPSet.setStatus (PersistentSetStatus.PROCESSED); factorPSet.setStatus (PersistentSetStatus.PROCESSED);
} }
} }
...@@ -345,7 +294,7 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr ...@@ -345,7 +294,7 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr
} }
else else
{ {
PersistentSet factor_hdrPSet = allPSets.getPersistentSet(objectID, "factor_hdr", PersistentSetStatus.FETCHED); PersistentSet factorPSet = allPSets.getPersistentSet(objectID, "factor", PersistentSetStatus.FETCHED);
createPersistentSetFromRS(allPSets, r, objectID); createPersistentSetFromRS(allPSets, r, objectID);
...@@ -404,7 +353,7 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr ...@@ -404,7 +353,7 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr
String query = "SELECT " + SELECT_COLUMNS + String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}factor_hdr " + tables + "FROM {PREFIX}factor " + tables +
"WHERE " + SELECT_JOINS + " " + customParamFilter + customOrderBy; "WHERE " + SELECT_JOINS + " " + customParamFilter + customOrderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, null, false); BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, null, false);
...@@ -422,27 +371,16 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr ...@@ -422,27 +371,16 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr
private void createPersistentSetFromRS(PersistentSetCollection allPSets, ResultSet r, ObjectID objectID) throws SQLException private void createPersistentSetFromRS(PersistentSetCollection allPSets, ResultSet r, ObjectID objectID) throws SQLException
{ {
PersistentSet factor_hdrPSet = allPSets.getPersistentSet(objectID, "factor_hdr", PersistentSetStatus.FETCHED); PersistentSet factorPSet = allPSets.getPersistentSet(objectID, "factor", PersistentSetStatus.FETCHED);
// Object Modified // Object Modified
factor_hdrPSet.setAttrib(BaseBusinessClass.FIELD_ObjectLastModified, r.getTimestamp ("LAST_UPDATED_DATE")); factorPSet.setAttrib(BaseBusinessClass.FIELD_ObjectLastModified, r.getTimestamp ("LAST_UPDATED_DATE"));
// Object Created // Object Created
factor_hdrPSet.setAttrib(BaseBusinessClass.FIELD_ObjectCreated, r.getTimestamp ("CREATED_DATE")); factorPSet.setAttrib(BaseBusinessClass.FIELD_ObjectCreated, r.getTimestamp ("CREATED_DATE"));
factor_hdrPSet.setAttrib(Factor.FIELD_Description, HELPER_Description.getFromRS(dummyDescription, r, "factor_hdr_desc")); factorPSet.setAttrib(Factor.FIELD_Description, HELPER_Description.getFromRS(dummyDescription, r, "factor_hdr_desc"));
factor_hdrPSet.setAttrib(Factor.FIELD_ClassCode, HELPER_ClassCode.getFromRS(dummyClassCode, r, "class_code"));
factor_hdrPSet.setAttrib(Factor.FIELD_Notes, HELPER_Notes.getFromRS(dummyNotes, r, "factor_hdr_notes"));
factor_hdrPSet.setAttrib(Factor.FIELD_LeftAnnot, HELPER_LeftAnnot.getFromRS(dummyLeftAnnot, r, "left_annot"));
factor_hdrPSet.setAttrib(Factor.FIELD_RightAnnot, HELPER_RightAnnot.getFromRS(dummyRightAnnot, r, "right_annot"));
factor_hdrPSet.setAttrib(Factor.FIELD_DescriptionSchinese, HELPER_DescriptionSchinese.getFromRS(dummyDescriptionSchinese, r, "factor_hdr_desc_schinese"));
factor_hdrPSet.setAttrib(Factor.FIELD_DescriptionChinese, HELPER_DescriptionChinese.getFromRS(dummyDescriptionChinese, r, "factor_hdr_desc_chinese"));
factor_hdrPSet.setAttrib(Factor.FIELD_DescriptionKorean, HELPER_DescriptionKorean.getFromRS(dummyDescriptionKorean, r, "factor_hdr_desc_korean"));
factor_hdrPSet.setAttrib(Factor.FIELD_DescriptionThai, HELPER_DescriptionThai.getFromRS(dummyDescriptionThai, r, "factor_hdr_desc_thai"));
factor_hdrPSet.setAttrib(Factor.FIELD_ZScoreWeight, HELPER_ZScoreWeight.getFromRS(dummyZScoreWeight, r, "z_score_wght"));
factor_hdrPSet.setAttrib(Factor.FIELD_ZScoreWeight2, HELPER_ZScoreWeight2.getFromRS(dummyZScoreWeight2, r, "z_score_wght_2"));
factor_hdrPSet.setAttrib(Factor.SINGLEREFERENCE_Level, r.getObject ("level_number"));
} }
...@@ -450,21 +388,21 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr ...@@ -450,21 +388,21 @@ public class FactorPersistenceMgr extends ObjectPersistenceMgr
public void create(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException public void create(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{ {
ObjectID objectID = obj.getID (); ObjectID objectID = obj.getID ();
PersistentSet factor_hdrPSet = allPSets.getPersistentSet(objectID, "factor_hdr"); PersistentSet factorPSet = allPSets.getPersistentSet(objectID, "factor");
if (factor_hdrPSet.getStatus () != PersistentSetStatus.PROCESSED && if (factorPSet.getStatus () != PersistentSetStatus.PROCESSED &&
factor_hdrPSet.getStatus () != PersistentSetStatus.DEFERRED) factorPSet.getStatus () != PersistentSetStatus.DEFERRED)
{ {
executeStatement (sqlMgr, executeStatement (sqlMgr,
"INSERT INTO {PREFIX}factor_hdr " + "INSERT INTO {PREFIX}factor " +
" (factor_hdr_desc, class_code, factor_hdr_notes, left_annot, right_annot, factor_hdr_desc_schinese, factor_hdr_desc_chinese, factor_hdr_desc_korean, factor_hdr_desc_thai, z_score_wght, z_score_wght_2, level_number, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " + " (factor_hdr_desc, 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_Description.getForSQL(dummyDescription, factor_hdrPSet.getAttrib (Factor.FIELD_Description))).listEntry (HELPER_ClassCode.getForSQL(dummyClassCode, factor_hdrPSet.getAttrib (Factor.FIELD_ClassCode))).listEntry (HELPER_Notes.getForSQL(dummyNotes, factor_hdrPSet.getAttrib (Factor.FIELD_Notes))).listEntry (HELPER_LeftAnnot.getForSQL(dummyLeftAnnot, factor_hdrPSet.getAttrib (Factor.FIELD_LeftAnnot))).listEntry (HELPER_RightAnnot.getForSQL(dummyRightAnnot, factor_hdrPSet.getAttrib (Factor.FIELD_RightAnnot))).listEntry (HELPER_DescriptionSchinese.getForSQL(dummyDescriptionSchinese, factor_hdrPSet.getAttrib (Factor.FIELD_DescriptionSchinese))).listEntry (HELPER_DescriptionChinese.getForSQL(dummyDescriptionChinese, factor_hdrPSet.getAttrib (Factor.FIELD_DescriptionChinese))).listEntry (HELPER_DescriptionKorean.getForSQL(dummyDescriptionKorean, factor_hdrPSet.getAttrib (Factor.FIELD_DescriptionKorean))).listEntry (HELPER_DescriptionThai.getForSQL(dummyDescriptionThai, factor_hdrPSet.getAttrib (Factor.FIELD_DescriptionThai))).listEntry (HELPER_ZScoreWeight.getForSQL(dummyZScoreWeight, factor_hdrPSet.getAttrib (Factor.FIELD_ZScoreWeight))).listEntry (HELPER_ZScoreWeight2.getForSQL(dummyZScoreWeight2, factor_hdrPSet.getAttrib (Factor.FIELD_ZScoreWeight2))) .listEntry (SQLManager.CheckNull((Long)(factor_hdrPSet.getAttrib (Factor.SINGLEREFERENCE_Level)))) .listEntry (objectID.longID ()).toList().toArray()); CollectionUtils.listEntry (HELPER_Description.getForSQL(dummyDescription, factorPSet.getAttrib (Factor.FIELD_Description))) .listEntry (objectID.longID ()).toList().toArray());
factor_hdrPSet.setStatus (PersistentSetStatus.PROCESSED); factorPSet.setStatus (PersistentSetStatus.PROCESSED);
} }
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<BUSINESSCLASS name="Level" package="performa.orm"> <BUSINESSCLASS name="Level" package="performa.orm">
<MULTIPLEREFERENCE name="Factors" type="Factor" backreferenceName="Level" /> <MULTIPLEREFERENCE name="FactorLinks" type="FactorLevelLink" backreferenceName="Level" />
<TABLE name="level" tablePrefix="object" polymorphic="FALSE"> <TABLE name="level" tablePrefix="object" polymorphic="FALSE">
......
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