Commit ee8a47d1 by Jay

Message Engine BO.

parent 8a9f4f3f
<?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">tl_message_engine</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="subject" type="String" nullable="true" length="200"/>
<column name="application_status" type="String" nullable="true" length="200"/>
<column name="delay" type="Double" nullable="true"/>
<column name="variance" type="Long" nullable="true"/>
<column name="business_hours_only" type="Boolean" nullable="true"/>
<column name="message_content" type="CLOB" nullable="true"/>
</NODE>
</NODE></OBJECTS>
\ No newline at end of file
-- DROP TABLE tl_message_engine;
CREATE TABLE tl_message_engine (
object_id int NOT NULL ,
object_last_updated_date datetime DEFAULT getdate() NOT NULL ,
object_created_date datetime DEFAULT getdate() NOT NULL
,
subject varchar(200) NULL,
application_status varchar(200) NULL,
delay numeric(20,5) NULL,
variance numeric(12) NULL,
business_hours_only char(1) NULL,
message_content text NULL
);
ALTER TABLE tl_message_engine ADD
CONSTRAINT PK_tl_message_engine PRIMARY KEY
(
object_id
) ;
\ No newline at end of file
-- DROP TABLE tl_message_engine;
CREATE TABLE tl_message_engine (
object_id number(12) NOT NULL ,
object_last_updated_date date DEFAULT SYSDATE NOT NULL ,
object_created_date date DEFAULT SYSDATE NOT NULL
,
subject varchar2(200) NULL,
application_status varchar2(200) NULL,
delay number(20,5) NULL,
variance number(12) NULL,
business_hours_only char(1) NULL,
message_content clob NULL
);
ALTER TABLE tl_message_engine ADD
CONSTRAINT PK_tl_message_engine PRIMARY KEY
(
object_id
) ;
\ No newline at end of file
-- @AutoRun
-- drop table tl_message_engine;
CREATE TABLE tl_message_engine (
object_id numeric(12) NOT NULL ,
object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
object_created_date timestamp DEFAULT NOW() NOT NULL
,
subject varchar(200) NULL,
application_status varchar(200) NULL,
delay numeric(20,5) NULL,
variance numeric(12) NULL,
business_hours_only char(1) NULL,
message_content text NULL
);
ALTER TABLE tl_message_engine ADD
CONSTRAINT pk_tl_message_engine PRIMARY KEY
(
object_id
) ;
\ No newline at end of file
/*
* IMPORTANT!!!! XSL Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2 rev3 [oneit.objstore.BusinessObjectTemplate.xsl]
*
* Version: 1.0
* Vendor: Apache Software Foundation (Xalan XSLTC)
* Vendor URL: http://xml.apache.org/xalan-j
*/
package performa.orm;
import java.io.*;
import java.util.*;
import oneit.appservices.config.*;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.objstore.assocs.*;
import oneit.objstore.attributes.*;
import oneit.objstore.rdbms.filters.*;
import oneit.objstore.parser.*;
import oneit.objstore.validator.*;
import oneit.objstore.utils.*;
import oneit.utils.*;
import oneit.utils.filter.Filter;
import oneit.utils.transform.*;
import oneit.utils.parsers.FieldException;
import performa.orm.types.*;
import performa.orm.*;
public abstract class BaseMessageEngine extends BaseBusinessClass
{
// Reference instance for the object
public static final MessageEngine REFERENCE_MessageEngine = new MessageEngine ();
// Reference instance for the object
public static final MessageEngine DUMMY_MessageEngine = new DummyMessageEngine ();
// Static constants corresponding to field names
public static final String FIELD_Subject = "Subject";
public static final String FIELD_ApplicationStatus = "ApplicationStatus";
public static final String FIELD_Delay = "Delay";
public static final String FIELD_Variance = "Variance";
public static final String FIELD_BusinessHoursOnly = "BusinessHoursOnly";
public static final String FIELD_MessageContent = "MessageContent";
// Static constants corresponding to searches
// Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper<MessageEngine> HELPER_Subject = DefaultAttributeHelper.INSTANCE;
private static final EnumeratedAttributeHelper<MessageEngine, ApplicationStatus> HELPER_ApplicationStatus = new EnumeratedAttributeHelper<MessageEngine, ApplicationStatus> (ApplicationStatus.FACTORY_ApplicationStatus);
private static final DefaultAttributeHelper<MessageEngine> HELPER_Delay = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<MessageEngine> HELPER_Variance = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<MessageEngine> HELPER_BusinessHoursOnly = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<MessageEngine> HELPER_MessageContent = DefaultAttributeHelper.INSTANCE;
// Private attributes corresponding to business object data
private String _Subject;
private ApplicationStatus _ApplicationStatus;
private Double _Delay;
private Integer _Variance;
private Boolean _BusinessHoursOnly;
private String _MessageContent;
// Private attributes corresponding to single references
// Private attributes corresponding to multiple references
// Map of maps of metadata
private static final Map ATTRIBUTES_METADATA_MessageEngine = new HashMap ();
// Arrays of validators for each attribute
private static final AttributeValidator[] FIELD_Subject_Validators;
private static final AttributeValidator[] FIELD_ApplicationStatus_Validators;
private static final AttributeValidator[] FIELD_Delay_Validators;
private static final AttributeValidator[] FIELD_Variance_Validators;
private static final AttributeValidator[] FIELD_BusinessHoursOnly_Validators;
private static final AttributeValidator[] FIELD_MessageContent_Validators;
// Arrays of behaviour decorators
private static final MessageEngineBehaviourDecorator[] MessageEngine_BehaviourDecorators;
static
{
try
{
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
FIELD_Subject_Validators = (AttributeValidator[])setupAttribMetaData_Subject(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_ApplicationStatus_Validators = (AttributeValidator[])setupAttribMetaData_ApplicationStatus(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_Delay_Validators = (AttributeValidator[])setupAttribMetaData_Delay(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_Variance_Validators = (AttributeValidator[])setupAttribMetaData_Variance(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_BusinessHoursOnly_Validators = (AttributeValidator[])setupAttribMetaData_BusinessHoursOnly(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_MessageContent_Validators = (AttributeValidator[])setupAttribMetaData_MessageContent(validatorMapping).toArray (new AttributeValidator[0]);
REFERENCE_MessageEngine.initialiseReference ();
DUMMY_MessageEngine.initialiseReference ();
MessageEngine_BehaviourDecorators = BaseBusinessClass.getBBCBehaviours(MessageEngine.class).toArray(new MessageEngineBehaviourDecorator[0]);
}
catch (RuntimeException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR1, e, "Error initialising");
throw e;
}
}
// Meta Info setup
private static List setupAttribMetaData_Subject(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "subject");
metaInfo.put ("length", "200");
metaInfo.put ("mandatory", "false");
metaInfo.put ("name", "Subject");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for MessageEngine.Subject:", metaInfo);
ATTRIBUTES_METADATA_MessageEngine.put (FIELD_Subject, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(MessageEngine.class, "Subject", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for MessageEngine.Subject:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_ApplicationStatus(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("attribHelper", "EnumeratedAttributeHelper");
metaInfo.put ("dbcol", "application_status");
metaInfo.put ("defaultValue", "ApplicationStatus.DRAFT");
metaInfo.put ("mandatory", "false");
metaInfo.put ("name", "ApplicationStatus");
metaInfo.put ("type", "ApplicationStatus");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for MessageEngine.ApplicationStatus:", metaInfo);
ATTRIBUTES_METADATA_MessageEngine.put (FIELD_ApplicationStatus, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(MessageEngine.class, "ApplicationStatus", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for MessageEngine.ApplicationStatus:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_Delay(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "delay");
metaInfo.put ("mandatory", "false");
metaInfo.put ("name", "Delay");
metaInfo.put ("type", "Double");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for MessageEngine.Delay:", metaInfo);
ATTRIBUTES_METADATA_MessageEngine.put (FIELD_Delay, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(MessageEngine.class, "Delay", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for MessageEngine.Delay:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_Variance(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "variance");
metaInfo.put ("mandatory", "false");
metaInfo.put ("name", "Variance");
metaInfo.put ("type", "Integer");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for MessageEngine.Variance:", metaInfo);
ATTRIBUTES_METADATA_MessageEngine.put (FIELD_Variance, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(MessageEngine.class, "Variance", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for MessageEngine.Variance:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_BusinessHoursOnly(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "business_hours_only");
metaInfo.put ("mandatory", "false");
metaInfo.put ("name", "BusinessHoursOnly");
metaInfo.put ("type", "Boolean");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for MessageEngine.BusinessHoursOnly:", metaInfo);
ATTRIBUTES_METADATA_MessageEngine.put (FIELD_BusinessHoursOnly, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(MessageEngine.class, "BusinessHoursOnly", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for MessageEngine.BusinessHoursOnly:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_MessageContent(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "message_content");
metaInfo.put ("mandatory", "false");
metaInfo.put ("name", "MessageContent");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for MessageEngine.MessageContent:", metaInfo);
ATTRIBUTES_METADATA_MessageEngine.put (FIELD_MessageContent, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(MessageEngine.class, "MessageContent", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for MessageEngine.MessageContent:", validators);
return validators;
}
// END OF STATIC METADATA DEFINITION
// This constructor should not be called
protected BaseMessageEngine ()
{
}
protected BBCBehaviourDecorator[] getBehaviours()
{
return MessageEngine_BehaviourDecorators;
}
// Initialise the attributes
protected void _initialiseNewObjAttributes (ObjectTransaction transaction) throws StorageException
{
super._initialiseNewObjAttributes (transaction);
_Subject = (String)(HELPER_Subject.initialise (_Subject));
_ApplicationStatus = (ApplicationStatus)(ApplicationStatus.DRAFT);
_Delay = (Double)(HELPER_Delay.initialise (_Delay));
_Variance = (Integer)(HELPER_Variance.initialise (_Variance));
_BusinessHoursOnly = (Boolean)(HELPER_BusinessHoursOnly.initialise (_BusinessHoursOnly));
_MessageContent = (String)(HELPER_MessageContent.initialise (_MessageContent));
}
// Initialise the associations
protected void _initialiseAssociations ()
{
super._initialiseAssociations ();
}
// Initialise the associations
protected BaseBusinessClass initialiseReference ()
{
super.initialiseReference ();
return this;
}
/**
* Get the attribute Subject
*/
public String getSubject ()
{
assertValid();
String valToReturn = _Subject;
for (MessageEngineBehaviourDecorator bhd : MessageEngine_BehaviourDecorators)
{
valToReturn = bhd.getSubject ((MessageEngine)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 preSubjectChange (String newSubject) 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 postSubjectChange () throws FieldException
{
}
public FieldWriteability getWriteability_Subject ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute Subject. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setSubject (String newSubject) throws FieldException
{
boolean oldAndNewIdentical = HELPER_Subject.compare (_Subject, newSubject);
try
{
for (MessageEngineBehaviourDecorator bhd : MessageEngine_BehaviourDecorators)
{
newSubject = bhd.setSubject ((MessageEngine)this, newSubject);
oldAndNewIdentical = HELPER_Subject.compare (_Subject, newSubject);
}
if (FIELD_Subject_Validators.length > 0)
{
Object newSubjectObj = HELPER_Subject.toObject (newSubject);
if (newSubjectObj != null)
{
int loopMax = FIELD_Subject_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_MessageEngine.get (FIELD_Subject);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_Subject_Validators[v].checkAttribute (this, FIELD_Subject, metadata, newSubjectObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_Subject () != FieldWriteability.FALSE, "Field Subject is not writeable");
preSubjectChange (newSubject);
markFieldChange (FIELD_Subject);
_Subject = newSubject;
postFieldChange (FIELD_Subject);
postSubjectChange ();
}
}
/**
* Get the attribute ApplicationStatus
*/
public ApplicationStatus getApplicationStatus ()
{
assertValid();
ApplicationStatus valToReturn = _ApplicationStatus;
for (MessageEngineBehaviourDecorator bhd : MessageEngine_BehaviourDecorators)
{
valToReturn = bhd.getApplicationStatus ((MessageEngine)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 preApplicationStatusChange (ApplicationStatus newApplicationStatus) 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 postApplicationStatusChange () throws FieldException
{
}
public FieldWriteability getWriteability_ApplicationStatus ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute ApplicationStatus. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setApplicationStatus (ApplicationStatus newApplicationStatus) throws FieldException
{
boolean oldAndNewIdentical = HELPER_ApplicationStatus.compare (_ApplicationStatus, newApplicationStatus);
try
{
for (MessageEngineBehaviourDecorator bhd : MessageEngine_BehaviourDecorators)
{
newApplicationStatus = bhd.setApplicationStatus ((MessageEngine)this, newApplicationStatus);
oldAndNewIdentical = HELPER_ApplicationStatus.compare (_ApplicationStatus, newApplicationStatus);
}
if (FIELD_ApplicationStatus_Validators.length > 0)
{
Object newApplicationStatusObj = HELPER_ApplicationStatus.toObject (newApplicationStatus);
if (newApplicationStatusObj != null)
{
int loopMax = FIELD_ApplicationStatus_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_MessageEngine.get (FIELD_ApplicationStatus);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_ApplicationStatus_Validators[v].checkAttribute (this, FIELD_ApplicationStatus, metadata, newApplicationStatusObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_ApplicationStatus () != FieldWriteability.FALSE, "Field ApplicationStatus is not writeable");
preApplicationStatusChange (newApplicationStatus);
markFieldChange (FIELD_ApplicationStatus);
_ApplicationStatus = newApplicationStatus;
postFieldChange (FIELD_ApplicationStatus);
postApplicationStatusChange ();
}
}
/**
* Get the attribute Delay
*/
public Double getDelay ()
{
assertValid();
Double valToReturn = _Delay;
for (MessageEngineBehaviourDecorator bhd : MessageEngine_BehaviourDecorators)
{
valToReturn = bhd.getDelay ((MessageEngine)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 preDelayChange (Double newDelay) 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 postDelayChange () throws FieldException
{
}
public FieldWriteability getWriteability_Delay ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute Delay. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setDelay (Double newDelay) throws FieldException
{
boolean oldAndNewIdentical = HELPER_Delay.compare (_Delay, newDelay);
try
{
for (MessageEngineBehaviourDecorator bhd : MessageEngine_BehaviourDecorators)
{
newDelay = bhd.setDelay ((MessageEngine)this, newDelay);
oldAndNewIdentical = HELPER_Delay.compare (_Delay, newDelay);
}
if (FIELD_Delay_Validators.length > 0)
{
Object newDelayObj = HELPER_Delay.toObject (newDelay);
if (newDelayObj != null)
{
int loopMax = FIELD_Delay_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_MessageEngine.get (FIELD_Delay);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_Delay_Validators[v].checkAttribute (this, FIELD_Delay, metadata, newDelayObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_Delay () != FieldWriteability.FALSE, "Field Delay is not writeable");
preDelayChange (newDelay);
markFieldChange (FIELD_Delay);
_Delay = newDelay;
postFieldChange (FIELD_Delay);
postDelayChange ();
}
}
/**
* Get the attribute Variance
*/
public Integer getVariance ()
{
assertValid();
Integer valToReturn = _Variance;
for (MessageEngineBehaviourDecorator bhd : MessageEngine_BehaviourDecorators)
{
valToReturn = bhd.getVariance ((MessageEngine)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 preVarianceChange (Integer newVariance) 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 postVarianceChange () throws FieldException
{
}
public FieldWriteability getWriteability_Variance ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute Variance. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setVariance (Integer newVariance) throws FieldException
{
boolean oldAndNewIdentical = HELPER_Variance.compare (_Variance, newVariance);
try
{
for (MessageEngineBehaviourDecorator bhd : MessageEngine_BehaviourDecorators)
{
newVariance = bhd.setVariance ((MessageEngine)this, newVariance);
oldAndNewIdentical = HELPER_Variance.compare (_Variance, newVariance);
}
if (FIELD_Variance_Validators.length > 0)
{
Object newVarianceObj = HELPER_Variance.toObject (newVariance);
if (newVarianceObj != null)
{
int loopMax = FIELD_Variance_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_MessageEngine.get (FIELD_Variance);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_Variance_Validators[v].checkAttribute (this, FIELD_Variance, metadata, newVarianceObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_Variance () != FieldWriteability.FALSE, "Field Variance is not writeable");
preVarianceChange (newVariance);
markFieldChange (FIELD_Variance);
_Variance = newVariance;
postFieldChange (FIELD_Variance);
postVarianceChange ();
}
}
/**
* Get the attribute BusinessHoursOnly
*/
public Boolean getBusinessHoursOnly ()
{
assertValid();
Boolean valToReturn = _BusinessHoursOnly;
for (MessageEngineBehaviourDecorator bhd : MessageEngine_BehaviourDecorators)
{
valToReturn = bhd.getBusinessHoursOnly ((MessageEngine)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 preBusinessHoursOnlyChange (Boolean newBusinessHoursOnly) 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 postBusinessHoursOnlyChange () throws FieldException
{
}
public FieldWriteability getWriteability_BusinessHoursOnly ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute BusinessHoursOnly. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setBusinessHoursOnly (Boolean newBusinessHoursOnly) throws FieldException
{
boolean oldAndNewIdentical = HELPER_BusinessHoursOnly.compare (_BusinessHoursOnly, newBusinessHoursOnly);
try
{
for (MessageEngineBehaviourDecorator bhd : MessageEngine_BehaviourDecorators)
{
newBusinessHoursOnly = bhd.setBusinessHoursOnly ((MessageEngine)this, newBusinessHoursOnly);
oldAndNewIdentical = HELPER_BusinessHoursOnly.compare (_BusinessHoursOnly, newBusinessHoursOnly);
}
if (FIELD_BusinessHoursOnly_Validators.length > 0)
{
Object newBusinessHoursOnlyObj = HELPER_BusinessHoursOnly.toObject (newBusinessHoursOnly);
if (newBusinessHoursOnlyObj != null)
{
int loopMax = FIELD_BusinessHoursOnly_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_MessageEngine.get (FIELD_BusinessHoursOnly);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_BusinessHoursOnly_Validators[v].checkAttribute (this, FIELD_BusinessHoursOnly, metadata, newBusinessHoursOnlyObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_BusinessHoursOnly () != FieldWriteability.FALSE, "Field BusinessHoursOnly is not writeable");
preBusinessHoursOnlyChange (newBusinessHoursOnly);
markFieldChange (FIELD_BusinessHoursOnly);
_BusinessHoursOnly = newBusinessHoursOnly;
postFieldChange (FIELD_BusinessHoursOnly);
postBusinessHoursOnlyChange ();
}
}
/**
* Get the attribute MessageContent
*/
public String getMessageContent ()
{
assertValid();
String valToReturn = _MessageContent;
for (MessageEngineBehaviourDecorator bhd : MessageEngine_BehaviourDecorators)
{
valToReturn = bhd.getMessageContent ((MessageEngine)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 preMessageContentChange (String newMessageContent) 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 postMessageContentChange () throws FieldException
{
}
public FieldWriteability getWriteability_MessageContent ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute MessageContent. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setMessageContent (String newMessageContent) throws FieldException
{
boolean oldAndNewIdentical = HELPER_MessageContent.compare (_MessageContent, newMessageContent);
try
{
for (MessageEngineBehaviourDecorator bhd : MessageEngine_BehaviourDecorators)
{
newMessageContent = bhd.setMessageContent ((MessageEngine)this, newMessageContent);
oldAndNewIdentical = HELPER_MessageContent.compare (_MessageContent, newMessageContent);
}
if (FIELD_MessageContent_Validators.length > 0)
{
Object newMessageContentObj = HELPER_MessageContent.toObject (newMessageContent);
if (newMessageContentObj != null)
{
int loopMax = FIELD_MessageContent_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_MessageEngine.get (FIELD_MessageContent);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_MessageContent_Validators[v].checkAttribute (this, FIELD_MessageContent, metadata, newMessageContentObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_MessageContent () != FieldWriteability.FALSE, "Field MessageContent is not writeable");
preMessageContentChange (newMessageContent);
markFieldChange (FIELD_MessageContent);
_MessageContent = newMessageContent;
postFieldChange (FIELD_MessageContent);
postMessageContentChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getSingleAssocs()
{
List result = super.getSingleAssocs ();
return result;
}
public BaseBusinessClass getSingleAssocReferenceInstance (String assocName)
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else
{
return super.getSingleAssocReferenceInstance (assocName);
}
}
public String getSingleAssocBackReference(String assocName)
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else
{
return super.getSingleAssocBackReference (assocName);
}
}
public BaseBusinessClass getSingleAssoc (String assocName) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else
{
return super.getSingleAssoc (assocName);
}
}
public BaseBusinessClass getSingleAssoc (String assocName, Get getType) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else
{
return super.getSingleAssoc (assocName, getType);
}
}
public Long getSingleAssocID (String assocName) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else
{
return super.getSingleAssocID (assocName);
}
}
public void setSingleAssoc (String assocName, BaseBusinessClass newValue) throws StorageException, FieldException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else
{
super.setSingleAssoc (assocName, newValue);
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getMultiAssocs()
{
List result = super.getMultiAssocs ();
return result;
}
/**
* Get the reference instance for the multi assoc name.
*/
public BaseBusinessClass getMultiAssocReferenceInstance(String attribName)
{
return super.getMultiAssocReferenceInstance(attribName);
}
public String getMultiAssocBackReference(String attribName)
{
return super.getMultiAssocBackReference(attribName);
}
/**
* Get the assoc count for the multi assoc name.
*/
public int getMultiAssocCount(String attribName) throws StorageException
{
return super.getMultiAssocCount(attribName);
}
/**
* Get the assoc at a particular index
*/
public BaseBusinessClass getMultiAssocAt(String attribName, int index) throws StorageException
{
return super.getMultiAssocAt(attribName, index);
}
/**
* Add to a multi assoc by attribute name
*/
public void addToMultiAssoc(String attribName, BaseBusinessClass newElement) throws StorageException
{
super.addToMultiAssoc(attribName, newElement);
}
/**
* Remove from a multi assoc by attribute name
*/
public void removeFromMultiAssoc(String attribName, BaseBusinessClass oldElement) throws StorageException
{
super.removeFromMultiAssoc(attribName, oldElement);
}
protected void __loadMultiAssoc (String attribName, BaseBusinessClass[] elements)
{
super.__loadMultiAssoc(attribName, elements);
}
protected boolean __isMultiAssocLoaded (String attribName)
{
return super.__isMultiAssocLoaded(attribName);
}
public void onDelete ()
{
try
{
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
super.onDelete ();
}
public MessageEngine newInstance ()
{
return new MessageEngine ();
}
public MessageEngine referenceInstance ()
{
return REFERENCE_MessageEngine;
}
public MessageEngine getInTransaction (ObjectTransaction t) throws StorageException
{
return getMessageEngineByID (t, getObjectID());
}
public BaseBusinessClass dummyInstance ()
{
return DUMMY_MessageEngine;
}
public String getBaseSetName ()
{
return "tl_message_engine";
}
/**
* 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 tl_message_enginePSet = allSets.getPersistentSet (myID, "tl_message_engine", myPSetStatus);
tl_message_enginePSet.setAttrib (FIELD_ObjectID, myID);
tl_message_enginePSet.setAttrib (FIELD_Subject, HELPER_Subject.toObject (_Subject)); //
tl_message_enginePSet.setAttrib (FIELD_ApplicationStatus, HELPER_ApplicationStatus.toObject (_ApplicationStatus)); //
tl_message_enginePSet.setAttrib (FIELD_Delay, HELPER_Delay.toObject (_Delay)); //
tl_message_enginePSet.setAttrib (FIELD_Variance, HELPER_Variance.toObject (_Variance)); //
tl_message_enginePSet.setAttrib (FIELD_BusinessHoursOnly, HELPER_BusinessHoursOnly.toObject (_BusinessHoursOnly)); //
tl_message_enginePSet.setAttrib (FIELD_MessageContent, HELPER_MessageContent.toObject (_MessageContent)); //
}
/**
* Sets the objects state based on Persistent sets.
*/
public void setFromPersistentSets (ObjectID objectID, PersistentSetCollection allSets)
{
super.setFromPersistentSets (objectID, allSets);
PersistentSet tl_message_enginePSet = allSets.getPersistentSet (objectID, "tl_message_engine");
_Subject = (String)(HELPER_Subject.fromObject (_Subject, tl_message_enginePSet.getAttrib (FIELD_Subject))); //
_ApplicationStatus = (ApplicationStatus)(HELPER_ApplicationStatus.fromObject (_ApplicationStatus, tl_message_enginePSet.getAttrib (FIELD_ApplicationStatus))); //
_Delay = (Double)(HELPER_Delay.fromObject (_Delay, tl_message_enginePSet.getAttrib (FIELD_Delay))); //
_Variance = (Integer)(HELPER_Variance.fromObject (_Variance, tl_message_enginePSet.getAttrib (FIELD_Variance))); //
_BusinessHoursOnly = (Boolean)(HELPER_BusinessHoursOnly.fromObject (_BusinessHoursOnly, tl_message_enginePSet.getAttrib (FIELD_BusinessHoursOnly))); //
_MessageContent = (String)(HELPER_MessageContent.fromObject (_MessageContent, tl_message_enginePSet.getAttrib (FIELD_MessageContent))); //
}
public void setAttributesFrom (BaseBusinessClass other, MultiException e)
{
super.setAttributesFrom (other, e);
if (other instanceof MessageEngine)
{
MessageEngine otherMessageEngine = (MessageEngine)other;
try
{
setSubject (otherMessageEngine.getSubject ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setApplicationStatus (otherMessageEngine.getApplicationStatus ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setDelay (otherMessageEngine.getDelay ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setVariance (otherMessageEngine.getVariance ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setBusinessHoursOnly (otherMessageEngine.getBusinessHoursOnly ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setMessageContent (otherMessageEngine.getMessageContent ());
}
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 BaseMessageEngine)
{
BaseMessageEngine sourceMessageEngine = (BaseMessageEngine)(source);
_Subject = sourceMessageEngine._Subject;
_ApplicationStatus = sourceMessageEngine._ApplicationStatus;
_Delay = sourceMessageEngine._Delay;
_Variance = sourceMessageEngine._Variance;
_BusinessHoursOnly = sourceMessageEngine._BusinessHoursOnly;
_MessageContent = sourceMessageEngine._MessageContent;
}
}
/**
* 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 BaseMessageEngine)
{
BaseMessageEngine sourceMessageEngine = (BaseMessageEngine)(source);
}
}
/**
* Set the associations in this to copies of the attributes in source.
*/
public void copyAssociationsFrom (BaseBusinessClass source, boolean linkToGhosts)
{
super.copyAssociationsFrom (source, linkToGhosts);
if (source instanceof BaseMessageEngine)
{
BaseMessageEngine sourceMessageEngine = (BaseMessageEngine)(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);
_Subject = (String)(HELPER_Subject.readExternal (_Subject, vals.get(FIELD_Subject))); //
_ApplicationStatus = (ApplicationStatus)(HELPER_ApplicationStatus.readExternal (_ApplicationStatus, vals.get(FIELD_ApplicationStatus))); //
_Delay = (Double)(HELPER_Delay.readExternal (_Delay, vals.get(FIELD_Delay))); //
_Variance = (Integer)(HELPER_Variance.readExternal (_Variance, vals.get(FIELD_Variance))); //
_BusinessHoursOnly = (Boolean)(HELPER_BusinessHoursOnly.readExternal (_BusinessHoursOnly, vals.get(FIELD_BusinessHoursOnly))); //
_MessageContent = (String)(HELPER_MessageContent.readExternal (_MessageContent, vals.get(FIELD_MessageContent))); //
}
/**
* Subclasses must override this to write out their attributes
*/
protected void writeExternalData(Map<String, Object> vals) throws IOException
{
super.writeExternalData(vals);
vals.put (FIELD_Subject, HELPER_Subject.writeExternal (_Subject));
vals.put (FIELD_ApplicationStatus, HELPER_ApplicationStatus.writeExternal (_ApplicationStatus));
vals.put (FIELD_Delay, HELPER_Delay.writeExternal (_Delay));
vals.put (FIELD_Variance, HELPER_Variance.writeExternal (_Variance));
vals.put (FIELD_BusinessHoursOnly, HELPER_BusinessHoursOnly.writeExternal (_BusinessHoursOnly));
vals.put (FIELD_MessageContent, HELPER_MessageContent.writeExternal (_MessageContent));
}
public void compare (BaseBusinessClass other, AttributeChangeListener listener) throws StorageException
{
super.compare (other, listener);
if (other instanceof BaseMessageEngine)
{
BaseMessageEngine otherMessageEngine = (BaseMessageEngine)(other);
if (!HELPER_Subject.compare(this._Subject, otherMessageEngine._Subject))
{
listener.notifyFieldChange(this, other, FIELD_Subject, HELPER_Subject.toObject(this._Subject), HELPER_Subject.toObject(otherMessageEngine._Subject));
}
if (!HELPER_ApplicationStatus.compare(this._ApplicationStatus, otherMessageEngine._ApplicationStatus))
{
listener.notifyFieldChange(this, other, FIELD_ApplicationStatus, HELPER_ApplicationStatus.toObject(this._ApplicationStatus), HELPER_ApplicationStatus.toObject(otherMessageEngine._ApplicationStatus));
}
if (!HELPER_Delay.compare(this._Delay, otherMessageEngine._Delay))
{
listener.notifyFieldChange(this, other, FIELD_Delay, HELPER_Delay.toObject(this._Delay), HELPER_Delay.toObject(otherMessageEngine._Delay));
}
if (!HELPER_Variance.compare(this._Variance, otherMessageEngine._Variance))
{
listener.notifyFieldChange(this, other, FIELD_Variance, HELPER_Variance.toObject(this._Variance), HELPER_Variance.toObject(otherMessageEngine._Variance));
}
if (!HELPER_BusinessHoursOnly.compare(this._BusinessHoursOnly, otherMessageEngine._BusinessHoursOnly))
{
listener.notifyFieldChange(this, other, FIELD_BusinessHoursOnly, HELPER_BusinessHoursOnly.toObject(this._BusinessHoursOnly), HELPER_BusinessHoursOnly.toObject(otherMessageEngine._BusinessHoursOnly));
}
if (!HELPER_MessageContent.compare(this._MessageContent, otherMessageEngine._MessageContent))
{
listener.notifyFieldChange(this, other, FIELD_MessageContent, HELPER_MessageContent.toObject(this._MessageContent), HELPER_MessageContent.toObject(otherMessageEngine._MessageContent));
}
// Compare single assocs
// 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_Subject, HELPER_Subject.toObject(getSubject()));
visitor.visitField(this, FIELD_ApplicationStatus, HELPER_ApplicationStatus.toObject(getApplicationStatus()));
visitor.visitField(this, FIELD_Delay, HELPER_Delay.toObject(getDelay()));
visitor.visitField(this, FIELD_Variance, HELPER_Variance.toObject(getVariance()));
visitor.visitField(this, FIELD_BusinessHoursOnly, HELPER_BusinessHoursOnly.toObject(getBusinessHoursOnly()));
visitor.visitField(this, FIELD_MessageContent, HELPER_MessageContent.toObject(getMessageContent()));
}
public void visitAssociations (AssociationVisitor visitor, AssociatedScope scope) throws StorageException
{
super.visitAssociations (visitor, scope);
}
public static MessageEngine createMessageEngine (ObjectTransaction transaction) throws StorageException
{
MessageEngine result = new MessageEngine ();
result.initialiseNewObject (transaction);
return result;
}
public static MessageEngine getMessageEngineByID (ObjectTransaction transaction, Long objectID) throws StorageException
{
return (MessageEngine)(transaction.getObjectByID (REFERENCE_MessageEngine, objectID));
}
public boolean testFilter (String attribName, QueryFilter filter) throws StorageException
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_Subject))
{
return filter.matches (getSubject ());
}
else if (attribName.equals (FIELD_ApplicationStatus))
{
return filter.matches (getApplicationStatus ());
}
else if (attribName.equals (FIELD_Delay))
{
return filter.matches (getDelay ());
}
else if (attribName.equals (FIELD_Variance))
{
return filter.matches (getVariance ());
}
else if (attribName.equals (FIELD_BusinessHoursOnly))
{
return filter.matches (getBusinessHoursOnly ());
}
else if (attribName.equals (FIELD_MessageContent))
{
return filter.matches (getMessageContent ());
}
else
{
return super.testFilter (attribName, filter);
}
}
public Object getAttribute (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_Subject))
{
return HELPER_Subject.toObject (getSubject ());
}
else if (attribName.equals (FIELD_ApplicationStatus))
{
return HELPER_ApplicationStatus.toObject (getApplicationStatus ());
}
else if (attribName.equals (FIELD_Delay))
{
return HELPER_Delay.toObject (getDelay ());
}
else if (attribName.equals (FIELD_Variance))
{
return HELPER_Variance.toObject (getVariance ());
}
else if (attribName.equals (FIELD_BusinessHoursOnly))
{
return HELPER_BusinessHoursOnly.toObject (getBusinessHoursOnly ());
}
else if (attribName.equals (FIELD_MessageContent))
{
return HELPER_MessageContent.toObject (getMessageContent ());
}
else
{
return super.getAttribute (attribName);
}
}
public AttributeHelper getAttributeHelper (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_Subject))
{
return HELPER_Subject;
}
else if (attribName.equals (FIELD_ApplicationStatus))
{
return HELPER_ApplicationStatus;
}
else if (attribName.equals (FIELD_Delay))
{
return HELPER_Delay;
}
else if (attribName.equals (FIELD_Variance))
{
return HELPER_Variance;
}
else if (attribName.equals (FIELD_BusinessHoursOnly))
{
return HELPER_BusinessHoursOnly;
}
else if (attribName.equals (FIELD_MessageContent))
{
return HELPER_MessageContent;
}
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_Subject))
{
setSubject ((String)(HELPER_Subject.fromObject (_Subject, attribValue)));
}
else if (attribName.equals (FIELD_ApplicationStatus))
{
setApplicationStatus ((ApplicationStatus)(HELPER_ApplicationStatus.fromObject (_ApplicationStatus, attribValue)));
}
else if (attribName.equals (FIELD_Delay))
{
setDelay ((Double)(HELPER_Delay.fromObject (_Delay, attribValue)));
}
else if (attribName.equals (FIELD_Variance))
{
setVariance ((Integer)(HELPER_Variance.fromObject (_Variance, attribValue)));
}
else if (attribName.equals (FIELD_BusinessHoursOnly))
{
setBusinessHoursOnly ((Boolean)(HELPER_BusinessHoursOnly.fromObject (_BusinessHoursOnly, attribValue)));
}
else if (attribName.equals (FIELD_MessageContent))
{
setMessageContent ((String)(HELPER_MessageContent.fromObject (_MessageContent, 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_Subject))
{
return getWriteability_Subject ();
}
else if (fieldName.equals (FIELD_ApplicationStatus))
{
return getWriteability_ApplicationStatus ();
}
else if (fieldName.equals (FIELD_Delay))
{
return getWriteability_Delay ();
}
else if (fieldName.equals (FIELD_Variance))
{
return getWriteability_Variance ();
}
else if (fieldName.equals (FIELD_BusinessHoursOnly))
{
return getWriteability_BusinessHoursOnly ();
}
else if (fieldName.equals (FIELD_MessageContent))
{
return getWriteability_MessageContent ();
}
else
{
return super.getWriteable (fieldName);
}
}
public void putUnwriteable (Set<String> fields)
{
if (getWriteability_Subject () != FieldWriteability.TRUE)
{
fields.add (FIELD_Subject);
}
if (getWriteability_ApplicationStatus () != FieldWriteability.TRUE)
{
fields.add (FIELD_ApplicationStatus);
}
if (getWriteability_Delay () != FieldWriteability.TRUE)
{
fields.add (FIELD_Delay);
}
if (getWriteability_Variance () != FieldWriteability.TRUE)
{
fields.add (FIELD_Variance);
}
if (getWriteability_BusinessHoursOnly () != FieldWriteability.TRUE)
{
fields.add (FIELD_BusinessHoursOnly);
}
if (getWriteability_MessageContent () != FieldWriteability.TRUE)
{
fields.add (FIELD_MessageContent);
}
super.putUnwriteable (fields);
}
public List<AbstractAttribute> getAttributes ()
{
List result = super.getAttributes ();
result.add(HELPER_Subject.getAttribObject (getClass (), _Subject, false, FIELD_Subject));
result.add(HELPER_ApplicationStatus.getAttribObject (getClass (), _ApplicationStatus, false, FIELD_ApplicationStatus));
result.add(HELPER_Delay.getAttribObject (getClass (), _Delay, false, FIELD_Delay));
result.add(HELPER_Variance.getAttribObject (getClass (), _Variance, false, FIELD_Variance));
result.add(HELPER_BusinessHoursOnly.getAttribObject (getClass (), _BusinessHoursOnly, false, FIELD_BusinessHoursOnly));
result.add(HELPER_MessageContent.getAttribObject (getClass (), _MessageContent, false, FIELD_MessageContent));
return result;
}
public Map getAttributeMetadata (String attribute)
{
if (ATTRIBUTES_METADATA_MessageEngine.containsKey (attribute))
{
return (Map)ATTRIBUTES_METADATA_MessageEngine.get (attribute);
}
else
{
return super.getAttributeMetadata (attribute);
}
}
public Object getAttributeMetadata (String attribute, String metadata)
{
if (ATTRIBUTES_METADATA_MessageEngine.containsKey (attribute))
{
return ((Map)ATTRIBUTES_METADATA_MessageEngine.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 MessageEngineBehaviourDecorator extends BaseBusinessClass.BBCBehaviourDecorator<MessageEngine>
{
/**
* Get the attribute Subject
*/
public String getSubject (MessageEngine obj, String original)
{
return original;
}
/**
* Change the value set for attribute Subject.
* May modify the field beforehand
* Occurs before validation.
*/
public String setSubject (MessageEngine obj, String newSubject) throws FieldException
{
return newSubject;
}
/**
* Get the attribute ApplicationStatus
*/
public ApplicationStatus getApplicationStatus (MessageEngine obj, ApplicationStatus original)
{
return original;
}
/**
* Change the value set for attribute ApplicationStatus.
* May modify the field beforehand
* Occurs before validation.
*/
public ApplicationStatus setApplicationStatus (MessageEngine obj, ApplicationStatus newApplicationStatus) throws FieldException
{
return newApplicationStatus;
}
/**
* Get the attribute Delay
*/
public Double getDelay (MessageEngine obj, Double original)
{
return original;
}
/**
* Change the value set for attribute Delay.
* May modify the field beforehand
* Occurs before validation.
*/
public Double setDelay (MessageEngine obj, Double newDelay) throws FieldException
{
return newDelay;
}
/**
* Get the attribute Variance
*/
public Integer getVariance (MessageEngine obj, Integer original)
{
return original;
}
/**
* Change the value set for attribute Variance.
* May modify the field beforehand
* Occurs before validation.
*/
public Integer setVariance (MessageEngine obj, Integer newVariance) throws FieldException
{
return newVariance;
}
/**
* Get the attribute BusinessHoursOnly
*/
public Boolean getBusinessHoursOnly (MessageEngine obj, Boolean original)
{
return original;
}
/**
* Change the value set for attribute BusinessHoursOnly.
* May modify the field beforehand
* Occurs before validation.
*/
public Boolean setBusinessHoursOnly (MessageEngine obj, Boolean newBusinessHoursOnly) throws FieldException
{
return newBusinessHoursOnly;
}
/**
* Get the attribute MessageContent
*/
public String getMessageContent (MessageEngine obj, String original)
{
return original;
}
/**
* Change the value set for attribute MessageContent.
* May modify the field beforehand
* Occurs before validation.
*/
public String setMessageContent (MessageEngine obj, String newMessageContent) throws FieldException
{
return newMessageContent;
}
}
public ORMPipeLine pipes()
{
return new MessageEnginePipeLineFactory<MessageEngine, MessageEngine> ((MessageEngine)this);
}
/**
* Use this instead of pipes() to get rid of type casting.
*/
public MessageEnginePipeLineFactory<MessageEngine, MessageEngine> pipelineMessageEngine()
{
return (MessageEnginePipeLineFactory<MessageEngine, MessageEngine>) pipes();
}
public static MessageEnginePipeLineFactory<MessageEngine, MessageEngine> pipesMessageEngine(Collection<MessageEngine> items)
{
return REFERENCE_MessageEngine.new MessageEnginePipeLineFactory<MessageEngine, MessageEngine> (items);
}
public static MessageEnginePipeLineFactory<MessageEngine, MessageEngine> pipesMessageEngine(MessageEngine[] _items)
{
return pipesMessageEngine(Arrays.asList (_items));
}
public static MessageEnginePipeLineFactory<MessageEngine, MessageEngine> pipesMessageEngine()
{
return pipesMessageEngine((Collection)null);
}
public class MessageEnginePipeLineFactory<From extends BaseBusinessClass, Me extends MessageEngine> extends BaseBusinessClass.ORMPipeLine<From, Me>
{
public <Prev> MessageEnginePipeLineFactory (PipeLine<From, Prev> pipeLine, Pipe<Prev, Me> nextPipe)
{
super (pipeLine, nextPipe);
}
public MessageEnginePipeLineFactory (From seed)
{
super(seed);
}
public MessageEnginePipeLineFactory (Collection<From> seed)
{
super(seed);
}
public PipeLine<From, ? extends Object> to(String name)
{
if (name.equals ("Subject"))
{
return toSubject ();
}
if (name.equals ("ApplicationStatus"))
{
return toApplicationStatus ();
}
if (name.equals ("Delay"))
{
return toDelay ();
}
if (name.equals ("Variance"))
{
return toVariance ();
}
if (name.equals ("BusinessHoursOnly"))
{
return toBusinessHoursOnly ();
}
if (name.equals ("MessageContent"))
{
return toMessageContent ();
}
return super.to(name);
}
public PipeLine<From, String> toSubject () { return pipe(new ORMAttributePipe<Me, String>(FIELD_Subject)); }
public PipeLine<From, ApplicationStatus> toApplicationStatus () { return pipe(new ORMAttributePipe<Me, ApplicationStatus>(FIELD_ApplicationStatus)); }
public PipeLine<From, Double> toDelay () { return pipe(new ORMAttributePipe<Me, Double>(FIELD_Delay)); }
public PipeLine<From, Integer> toVariance () { return pipe(new ORMAttributePipe<Me, Integer>(FIELD_Variance)); }
public PipeLine<From, Boolean> toBusinessHoursOnly () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_BusinessHoursOnly)); }
public PipeLine<From, String> toMessageContent () { return pipe(new ORMAttributePipe<Me, String>(FIELD_MessageContent)); }
}
public boolean isTransientAttrib(String attribName)
{
return super.isTransientAttrib(attribName);
}
public boolean isTransientSingleReference(String assocName)
{
return super.isTransientSingleReference(assocName);
}
}
class DummyMessageEngine extends MessageEngine
{
// Default constructor primarily to support Externalisable
public DummyMessageEngine()
{
super();
}
public void assertValid ()
{
}
}
package performa.orm;
import java.io.*;
import java.util.*;
import oneit.appservices.config.*;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.utils.*;
import performa.orm.types.*;
import performa.orm.*;
public class MessageEngine extends BaseMessageEngine
{
private static final long serialVersionUID = 0L;
// This constructor should not be called
public MessageEngine ()
{
// Do not add any code to this, always put it in initialiseNewObject
}
}
<?xml version="1.0" encoding="UTF-8"?>
<ROOT>
<BUSINESSCLASS name="MessageEngine" package="performa.orm">
<IMPORT value="performa.orm.types.*"/>
<IMPORT value="performa.orm.*"/>
<TABLE name="tl_message_engine" tablePrefix="object" polymorphic="FALSE">
<ATTRIB name="Subject" type="String" dbcol="subject" mandatory="false" length="200" />
<ATTRIB name="ApplicationStatus" type="ApplicationStatus" dbcol="application_status" attribHelper="EnumeratedAttributeHelper" defaultValue="ApplicationStatus.DRAFT" mandatory="false"/>
<ATTRIB name="Delay" type="Double" dbcol="delay" mandatory="false" />
<ATTRIB name="Variance" type="Integer" dbcol="variance" mandatory="false" />
<ATTRIB name="BusinessHoursOnly" type="Boolean" dbcol="business_hours_only" mandatory="false" />
<ATTRIB name="MessageContent" type="String" dbcol="message_content" mandatory="false" />
</TABLE>
</BUSINESSCLASS>
</ROOT>
\ No newline at end of file
package performa.orm;
import java.io.*;
import java.util.*;
import java.sql.ResultSet;
import java.sql.SQLException;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.objstore.assocs.*;
import oneit.objstore.rdbms.*;
import oneit.objstore.utils.*;
import oneit.sql.*;
import oneit.utils.resource.*;
import oneit.utils.*;
import oneit.utils.threading.*;
import performa.orm.types.*;
import performa.orm.*;
/**
* IMPORTANT!!!! Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2[oneit.objstore.PersistenceMgrTemplate.xsl]
*/
public class MessageEnginePersistenceMgr extends ObjectPersistenceMgr
{
private static final LoggingArea MessageEnginePersistence = LoggingArea.createLoggingArea(ObjectPersistenceMgr.OBJECT_PERSISTENCE, "MessageEngine");
// Private attributes corresponding to business object data
private String dummySubject;
private ApplicationStatus dummyApplicationStatus;
private Double dummyDelay;
private Integer dummyVariance;
private Boolean dummyBusinessHoursOnly;
private String dummyMessageContent;
// Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper HELPER_Subject = DefaultAttributeHelper.INSTANCE;
private static final EnumeratedAttributeHelper HELPER_ApplicationStatus = new EnumeratedAttributeHelper (ApplicationStatus.FACTORY_ApplicationStatus);
private static final DefaultAttributeHelper HELPER_Delay = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_Variance = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_BusinessHoursOnly = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_MessageContent = DefaultAttributeHelper.INSTANCE;
public MessageEnginePersistenceMgr ()
{
dummySubject = (String)(HELPER_Subject.initialise (dummySubject));
dummyApplicationStatus = (ApplicationStatus)(HELPER_ApplicationStatus.initialise (dummyApplicationStatus));
dummyDelay = (Double)(HELPER_Delay.initialise (dummyDelay));
dummyVariance = (Integer)(HELPER_Variance.initialise (dummyVariance));
dummyBusinessHoursOnly = (Boolean)(HELPER_BusinessHoursOnly.initialise (dummyBusinessHoursOnly));
dummyMessageContent = (String)(HELPER_MessageContent.initialise (dummyMessageContent));
}
private String SELECT_COLUMNS = "{PREFIX}tl_message_engine.object_id as id, {PREFIX}tl_message_engine.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_message_engine.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_message_engine.subject, {PREFIX}tl_message_engine.application_status, {PREFIX}tl_message_engine.delay, {PREFIX}tl_message_engine.variance, {PREFIX}tl_message_engine.business_hours_only, {PREFIX}tl_message_engine.message_content, 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, MessageEngine.REFERENCE_MessageEngine);
if (objectToReturn instanceof MessageEngine)
{
LogMgr.log (MessageEnginePersistence, 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 MessageEngine");
}
}
PersistentSet tl_message_enginePSet = allPSets.getPersistentSet(id, "tl_message_engine", PersistentSetStatus.FETCHED);
// Check for persistent sets already prefetched
if (false || !tl_message_enginePSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!tl_message_enginePSet.containsAttrib(MessageEngine.FIELD_Subject)||
!tl_message_enginePSet.containsAttrib(MessageEngine.FIELD_ApplicationStatus)||
!tl_message_enginePSet.containsAttrib(MessageEngine.FIELD_Delay)||
!tl_message_enginePSet.containsAttrib(MessageEngine.FIELD_Variance)||
!tl_message_enginePSet.containsAttrib(MessageEngine.FIELD_BusinessHoursOnly)||
!tl_message_enginePSet.containsAttrib(MessageEngine.FIELD_MessageContent))
{
// We will need to retrieve it
idsToFetch.add (id.longValue());
}
else
{
LogMgr.log (MessageEnginePersistence, LogLevel.DEBUG2, "Persistent set preloaded id:", id);
/* Non Polymorphic */
MessageEngine result = new MessageEngine ();
result.setFromPersistentSets(id, allPSets);
context.addRetrievedObject(result);
results.add (result);
}
}
if (idsToFetch.size () > 0)
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_message_engine " +
"WHERE " + SELECT_JOINS + "{PREFIX}tl_message_engine.object_id IN ?";
BaseBusinessClass[] resultsFetched = loadQuery (allPSets, sqlMgr, context, query, new Object[] { idsToFetch }, null, false);
for (BaseBusinessClass objFetched : resultsFetched)
{
results.add (objFetched);
}
}
return results;
}
public BaseBusinessClass[] getReferencedObjects(ObjectID _objectID, String refName, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
if (false)
{
throw new RuntimeException ();
}
else
{
throw new IllegalArgumentException ("Illegal reference type:" + refName);
}
}
public void update(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, ConcurrentUpdateConflictException, StorageException
{
EqualityResult test = EqualityResult.compare (obj, obj.getBackup ());
ObjectID objectID = obj.getID ();
if (!test.areAttributesEqual () || !test.areSingleAssocsEqual () || obj.getForcedSave())
{
PersistentSet tl_message_enginePSet = allPSets.getPersistentSet(objectID, "tl_message_engine");
if (tl_message_enginePSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_message_enginePSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}tl_message_engine " +
"SET subject = ?, application_status = ?, delay = ?, variance = ?, business_hours_only = ?, message_content = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE tl_message_engine.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_Subject.getForSQL(dummySubject, tl_message_enginePSet.getAttrib (MessageEngine.FIELD_Subject))).listEntry (HELPER_ApplicationStatus.getForSQL(dummyApplicationStatus, tl_message_enginePSet.getAttrib (MessageEngine.FIELD_ApplicationStatus))).listEntry (HELPER_Delay.getForSQL(dummyDelay, tl_message_enginePSet.getAttrib (MessageEngine.FIELD_Delay))).listEntry (HELPER_Variance.getForSQL(dummyVariance, tl_message_enginePSet.getAttrib (MessageEngine.FIELD_Variance))).listEntry (HELPER_BusinessHoursOnly.getForSQL(dummyBusinessHoursOnly, tl_message_enginePSet.getAttrib (MessageEngine.FIELD_BusinessHoursOnly))).listEntry (HELPER_MessageContent.getForSQL(dummyMessageContent, tl_message_enginePSet.getAttrib (MessageEngine.FIELD_MessageContent))).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}tl_message_engine 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[] { "tl_message_engine", objectID.longID (), obj.getObjectLastModified (), d },
sqlMgr.getPortabilityServices ());
LogMgr.log (MessageEnginePersistence, LogLevel.BUSINESS1, errorMsg);
throw new ConcurrentUpdateConflictException (obj, "tl_message_engine");
}
else
{
String errorMsg = "Attempt to update nonexistent row in table:tl_message_engine for row:" + objectID + " objDate:" + obj.getObjectLastModified ();
LogMgr.log (MessageEnginePersistence, LogLevel.BUSINESS1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
tl_message_enginePSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
else
{
LogMgr.log (MessageEnginePersistence, 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 tl_message_enginePSet = allPSets.getPersistentSet(objectID, "tl_message_engine");
LogMgr.log (MessageEnginePersistence, LogLevel.DEBUG2, "Deleting:", objectID);
if (tl_message_enginePSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_message_enginePSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsDeleted = executeStatement (sqlMgr,
"DELETE " +
"FROM {PREFIX}tl_message_engine " +
"WHERE tl_message_engine.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}tl_message_engine WHERE object_id = ?",
new Object[] { objectID.longID() });
if (r.next ())
{
throw new ConcurrentUpdateConflictException (obj, "tl_message_engine");
}
else
{
String errorMsg = "Attempt to delete nonexistent row in table:tl_message_engine for row:" + objectID;
LogMgr.log (MessageEnginePersistence, LogLevel.SYSTEMERROR1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
tl_message_enginePSet.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, MessageEngine> results = new LinkedHashMap ();
ResultSet r = executeQuery (sqlMgr, query, params);
while (r.next())
{
ThreadUtils.checkInterrupted ();
ObjectID objectID = new ObjectID (MessageEngine.REFERENCE_MessageEngine.getObjectIDSpace (), r.getLong ("id"));
MessageEngine 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, MessageEngine.REFERENCE_MessageEngine);
if (cachedElement instanceof MessageEngine)
{
LogMgr.log (MessageEnginePersistence, LogLevel.TRACE, "Cache hit for id:", objectID);
resultElement = (MessageEngine)cachedElement;
}
else
{
throw new StorageException ("Cache collision for id:" + objectID + " with object " + cachedElement + "while fetching a MessageEngine");
}
}
else
{
PersistentSet tl_message_enginePSet = allPSets.getPersistentSet(objectID, "tl_message_engine", PersistentSetStatus.FETCHED);
createPersistentSetFromRS(allPSets, r, objectID);
resultElement = new MessageEngine ();
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 (MessageEnginePersistence, 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}tl_message_engine " + 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 tl_message_enginePSet = allPSets.getPersistentSet(objectID, "tl_message_engine", PersistentSetStatus.FETCHED);
// Object Modified
tl_message_enginePSet.setAttrib(BaseBusinessClass.FIELD_ObjectLastModified, r.getTimestamp ("LAST_UPDATED_DATE"));
// Object Created
tl_message_enginePSet.setAttrib(BaseBusinessClass.FIELD_ObjectCreated, r.getTimestamp ("CREATED_DATE"));
tl_message_enginePSet.setAttrib(MessageEngine.FIELD_Subject, HELPER_Subject.getFromRS(dummySubject, r, "subject"));
tl_message_enginePSet.setAttrib(MessageEngine.FIELD_ApplicationStatus, HELPER_ApplicationStatus.getFromRS(dummyApplicationStatus, r, "application_status"));
tl_message_enginePSet.setAttrib(MessageEngine.FIELD_Delay, HELPER_Delay.getFromRS(dummyDelay, r, "delay"));
tl_message_enginePSet.setAttrib(MessageEngine.FIELD_Variance, HELPER_Variance.getFromRS(dummyVariance, r, "variance"));
tl_message_enginePSet.setAttrib(MessageEngine.FIELD_BusinessHoursOnly, HELPER_BusinessHoursOnly.getFromRS(dummyBusinessHoursOnly, r, "business_hours_only"));
tl_message_enginePSet.setAttrib(MessageEngine.FIELD_MessageContent, HELPER_MessageContent.getFromRS(dummyMessageContent, r, "message_content"));
}
public void create(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet tl_message_enginePSet = allPSets.getPersistentSet(objectID, "tl_message_engine");
if (tl_message_enginePSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_message_enginePSet.getStatus () != PersistentSetStatus.DEFERRED)
{
executeStatement (sqlMgr,
"INSERT INTO {PREFIX}tl_message_engine " +
" (subject, application_status, delay, variance, business_hours_only, message_content, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " +
" (?, ?, ?, ?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_Subject.getForSQL(dummySubject, tl_message_enginePSet.getAttrib (MessageEngine.FIELD_Subject))).listEntry (HELPER_ApplicationStatus.getForSQL(dummyApplicationStatus, tl_message_enginePSet.getAttrib (MessageEngine.FIELD_ApplicationStatus))).listEntry (HELPER_Delay.getForSQL(dummyDelay, tl_message_enginePSet.getAttrib (MessageEngine.FIELD_Delay))).listEntry (HELPER_Variance.getForSQL(dummyVariance, tl_message_enginePSet.getAttrib (MessageEngine.FIELD_Variance))).listEntry (HELPER_BusinessHoursOnly.getForSQL(dummyBusinessHoursOnly, tl_message_enginePSet.getAttrib (MessageEngine.FIELD_BusinessHoursOnly))).listEntry (HELPER_MessageContent.getForSQL(dummyMessageContent, tl_message_enginePSet.getAttrib (MessageEngine.FIELD_MessageContent))) .listEntry (objectID.longID ()).toList().toArray());
tl_message_enginePSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment