Commit 5a844232 by Chamath

ORM changes.

parent cb8f0b0e
<?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_chat_attachment</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="file" type="BLOB" nullable="true"/>
<column name="message_id" type="Long" length="11" nullable="true"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_chat_attachment" indexName="idx_tl_chat_attachment_message_id" isUnique="false"><column name="message_id"/></NODE>
</NODE></OBJECTS>
\ No newline at end of file
......@@ -44,8 +44,11 @@
<column name="shortened_url_id" type="Long" length="11" nullable="true"/>
<column name="template_id" type="Long" length="11" nullable="true"/>
<column name="job_title_id" type="Long" length="11" nullable="false"/>
<column name="work_flow_template_id" type="Long" length="11" nullable="true"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_job" indexName="idx_tl_job_client_id" isUnique="false"><column name="client_id"/></NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_job" indexName="idx_tl_job_work_flow_template_id" isUnique="false"><column name="work_flow_template_id"/></NODE>
</NODE></OBJECTS>
\ No newline at end of file
......@@ -18,6 +18,7 @@
<column name="is_email_ingest" type="Boolean" nullable="true"/>
<column name="candidate_id" type="Long" length="11" nullable="false"/>
<column name="job_id" type="Long" length="11" nullable="false"/>
<column name="work_flow_stage_id" type="Long" length="11" nullable="true"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_job_application" indexName="idx_tl_job_application_candidate_id" isUnique="false"><column name="candidate_id"/></NODE>
......
<?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</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="sent_via" type="String" nullable="true" length="200"/>
<column name="message_content" type="CLOB" nullable="true"/>
<column name="is_read" type="Boolean" nullable="true"/>
<column name="sent_by" type="Long" length="11" nullable="true"/>
<column name="work_flow_message" type="Long" length="11" nullable="true"/>
<column name="job_application_id" type="Long" length="11" nullable="true"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_message" indexName="idx_tl_message_job_application_id" isUnique="false"><column name="job_application_id"/></NODE>
</NODE></OBJECTS>
\ No newline at end of file
......@@ -17,6 +17,11 @@
<column name="variance" type="Long" nullable="true"/>
<column name="business_hours_only" type="Boolean" nullable="true"/>
<column name="message_content" type="CLOB" nullable="false"/>
<column name="template_type" type="String" nullable="true" length="200"/>
<column name="is_global_template" type="Boolean" nullable="true"/>
<column name="hiring_team_id" type="Long" length="11" nullable="true"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_message_template" indexName="idx_tl_message_template_hiring_team_id" isUnique="false"><column name="hiring_team_id"/></NODE>
</NODE></OBJECTS>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun -->
<OBJECTS name="" xmlns:oneit="http://www.1iT.com.au"><NODE name="Script" factory="Vector">
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.DefineTableOperation">
<tableName factory="String">tl_work_flow_message</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="delay" type="CLOB" nullable="true"/>
<column name="variance" type="CLOB" nullable="true"/>
<column name="business_hours_only" type="Boolean" nullable="true"/>
<column name="is_withdrawal_message" type="Boolean" nullable="true"/>
<column name="message_template_id" type="Long" length="11" nullable="true"/>
<column name="work_flow_stage_id" type="Long" length="11" nullable="true"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_work_flow_message" indexName="idx_tl_work_flow_message_work_flow_stage_id" isUnique="false"><column name="work_flow_stage_id"/></NODE>
</NODE></OBJECTS>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun -->
<OBJECTS name="" xmlns:oneit="http://www.1iT.com.au"><NODE name="Script" factory="Vector">
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.DefineTableOperation">
<tableName factory="String">tl_work_flow_stage</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="name" type="CLOB" nullable="false"/>
<column name="use_messaging" type="Boolean" nullable="true"/>
<column name="stage_type" type="String" nullable="false" length="200"/>
<column name="sort_order" type="Long" nullable="false"/>
<column name="withdrawal_message_id" type="Long" length="11" nullable="true"/>
<column name="work_flow_template_id" type="Long" length="11" nullable="false"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_work_flow_stage" indexName="idx_tl_work_flow_stage_work_flow_template_id" isUnique="false"><column name="work_flow_template_id"/></NODE>
</NODE></OBJECTS>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun -->
<OBJECTS name="" xmlns:oneit="http://www.1iT.com.au"><NODE name="Script" factory="Vector">
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.DefineTableOperation">
<tableName factory="String">tl_work_flow_template</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="template_name" type="CLOB" nullable="false"/>
<column name="landing_button_text" type="CLOB" nullable="true"/>
<column name="verification_header_text" type="CLOB" nullable="true"/>
<column name="capture_cv" type="Boolean" nullable="true"/>
<column name="is_cv_mandatory" type="Boolean" nullable="true"/>
<column name="capture_cl" type="Boolean" nullable="true"/>
<column name="is_cl_mandatory" type="Boolean" nullable="true"/>
<column name="application_button_text" type="CLOB" nullable="true"/>
<column name="application_response_action" type="String" nullable="false" length="200"/>
<column name="thank_you_header_text" type="CLOB" nullable="true"/>
<column name="thank_you_secondary_text" type="CLOB" nullable="true"/>
<column name="job_outline_button_text" type="CLOB" nullable="true"/>
<column name="is_global_template" type="Boolean" nullable="true"/>
<column name="withdrawal_message_id" type="Long" length="11" nullable="true"/>
<column name="hiring_team_id" type="Long" length="11" nullable="true"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_work_flow_template" indexName="idx_tl_work_flow_template_hiring_team_id" isUnique="false"><column name="hiring_team_id"/></NODE>
</NODE></OBJECTS>
\ No newline at end of file
-- DROP TABLE tl_chat_attachment;
CREATE TABLE tl_chat_attachment (
object_id int NOT NULL ,
object_last_updated_date datetime DEFAULT getdate() NOT NULL ,
object_created_date datetime DEFAULT getdate() NOT NULL
,
file image NULL,
message_id numeric(12) NULL
);
ALTER TABLE tl_chat_attachment ADD
CONSTRAINT PK_tl_chat_attachment PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_chat_attachment_message_id
ON tl_chat_attachment (message_id);
......@@ -43,7 +43,8 @@ CREATE TABLE tl_job (
occupation_id numeric(12) NOT NULL,
shortened_url_id numeric(12) NULL,
template_id numeric(12) NULL,
job_title_id numeric(12) NOT NULL
job_title_id numeric(12) NOT NULL,
work_flow_template_id numeric(12) NULL
);
......@@ -58,3 +59,6 @@ ALTER TABLE tl_job ADD
CREATE INDEX idx_tl_job_client_id
ON tl_job (client_id);
CREATE INDEX idx_tl_job_work_flow_template_id
ON tl_job (work_flow_template_id);
......@@ -17,7 +17,8 @@ CREATE TABLE tl_job_application (
happy_to_relocate char(1) NULL,
is_email_ingest char(1) NULL,
candidate_id numeric(12) NOT NULL,
job_id numeric(12) NOT NULL
job_id numeric(12) NOT NULL,
work_flow_stage_id numeric(12) NULL
);
......
-- DROP TABLE tl_message;
CREATE TABLE tl_message (
object_id int NOT NULL ,
object_last_updated_date datetime DEFAULT getdate() NOT NULL ,
object_created_date datetime DEFAULT getdate() NOT NULL
,
sent_via varchar(200) NULL,
message_content text NULL,
is_read char(1) NULL,
sent_by numeric(12) NULL,
work_flow_message numeric(12) NULL,
job_application_id numeric(12) NULL
);
ALTER TABLE tl_message ADD
CONSTRAINT PK_tl_message PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_message_job_application_id
ON tl_message (job_application_id);
......@@ -16,7 +16,10 @@ CREATE TABLE tl_message_template (
delay_min numeric(12) NULL,
variance numeric(12) NULL,
business_hours_only char(1) NULL,
message_content text NOT NULL
message_content text NOT NULL,
template_type varchar(200) NULL,
is_global_template char(1) NULL,
hiring_team_id numeric(12) NULL
);
......@@ -29,3 +32,5 @@ ALTER TABLE tl_message_template ADD
CREATE INDEX idx_tl_message_template_hiring_team_id
ON tl_message_template (hiring_team_id);
-- DROP TABLE tl_work_flow_message;
CREATE TABLE tl_work_flow_message (
object_id int NOT NULL ,
object_last_updated_date datetime DEFAULT getdate() NOT NULL ,
object_created_date datetime DEFAULT getdate() NOT NULL
,
delay text NULL,
variance text NULL,
business_hours_only char(1) NULL,
is_withdrawal_message char(1) NULL,
message_template_id numeric(12) NULL,
work_flow_stage_id numeric(12) NULL
);
ALTER TABLE tl_work_flow_message ADD
CONSTRAINT PK_tl_work_flow_message PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_work_flow_message_work_flow_stage_id
ON tl_work_flow_message (work_flow_stage_id);
-- DROP TABLE tl_work_flow_stage;
CREATE TABLE tl_work_flow_stage (
object_id int NOT NULL ,
object_last_updated_date datetime DEFAULT getdate() NOT NULL ,
object_created_date datetime DEFAULT getdate() NOT NULL
,
name text NOT NULL,
use_messaging char(1) NULL,
stage_type varchar(200) NOT NULL,
sort_order numeric(12) NOT NULL,
withdrawal_message_id numeric(12) NULL,
work_flow_template_id numeric(12) NOT NULL
);
ALTER TABLE tl_work_flow_stage ADD
CONSTRAINT PK_tl_work_flow_stage PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_work_flow_stage_work_flow_template_id
ON tl_work_flow_stage (work_flow_template_id);
-- DROP TABLE tl_work_flow_template;
CREATE TABLE tl_work_flow_template (
object_id int NOT NULL ,
object_last_updated_date datetime DEFAULT getdate() NOT NULL ,
object_created_date datetime DEFAULT getdate() NOT NULL
,
template_name text NOT NULL,
landing_button_text text NULL,
verification_header_text text NULL,
capture_cv char(1) NULL,
is_cv_mandatory char(1) NULL,
capture_cl char(1) NULL,
is_cl_mandatory char(1) NULL,
application_button_text text NULL,
application_response_action varchar(200) NOT NULL,
thank_you_header_text text NULL,
thank_you_secondary_text text NULL,
job_outline_button_text text NULL,
is_global_template char(1) NULL,
withdrawal_message_id numeric(12) NULL,
hiring_team_id numeric(12) NULL
);
ALTER TABLE tl_work_flow_template ADD
CONSTRAINT PK_tl_work_flow_template PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_work_flow_template_hiring_team_id
ON tl_work_flow_template (hiring_team_id);
-- DROP TABLE tl_chat_attachment;
CREATE TABLE tl_chat_attachment (
object_id number(12) NOT NULL ,
object_last_updated_date date DEFAULT SYSDATE NOT NULL ,
object_created_date date DEFAULT SYSDATE NOT NULL
,
file blob NULL,
message_id number(12) NULL
);
ALTER TABLE tl_chat_attachment ADD
CONSTRAINT PK_tl_chat_attachment PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_chat_attachment_message_id
ON tl_chat_attachment (message_id);
......@@ -44,7 +44,8 @@ CREATE TABLE tl_job (
occupation_id number(12) NOT NULL,
shortened_url_id number(12) NULL,
template_id number(12) NULL,
job_title_id number(12) NOT NULL
job_title_id number(12) NOT NULL,
work_flow_template_id number(12) NULL
);
......@@ -59,3 +60,6 @@ ALTER TABLE tl_job ADD
CREATE INDEX idx_tl_job_client_id
ON tl_job (client_id);
CREATE INDEX idx_tl_job_work_flow_template_id
ON tl_job (work_flow_template_id);
......@@ -18,7 +18,8 @@ CREATE TABLE tl_job_application (
happy_to_relocate char(1) NULL,
is_email_ingest char(1) NULL,
candidate_id number(12) NOT NULL,
job_id number(12) NOT NULL
job_id number(12) NOT NULL,
work_flow_stage_id number(12) NULL
);
......
-- DROP TABLE tl_message;
CREATE TABLE tl_message (
object_id number(12) NOT NULL ,
object_last_updated_date date DEFAULT SYSDATE NOT NULL ,
object_created_date date DEFAULT SYSDATE NOT NULL
,
sent_via varchar2(200) NULL,
message_content clob NULL,
is_read char(1) NULL,
sent_by number(12) NULL,
work_flow_message number(12) NULL,
job_application_id number(12) NULL
);
ALTER TABLE tl_message ADD
CONSTRAINT PK_tl_message PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_message_job_application_id
ON tl_message (job_application_id);
......@@ -17,7 +17,10 @@ CREATE TABLE tl_message_template (
delay_min number(12) NULL,
variance number(12) NULL,
business_hours_only char(1) NULL,
message_content clob NOT NULL
message_content clob NOT NULL,
template_type varchar2(200) NULL,
is_global_template char(1) NULL,
hiring_team_id number(12) NULL
);
......@@ -30,3 +33,5 @@ ALTER TABLE tl_message_template ADD
CREATE INDEX idx_tl_message_template_hiring_team_id
ON tl_message_template (hiring_team_id);
-- DROP TABLE tl_work_flow_message;
CREATE TABLE tl_work_flow_message (
object_id number(12) NOT NULL ,
object_last_updated_date date DEFAULT SYSDATE NOT NULL ,
object_created_date date DEFAULT SYSDATE NOT NULL
,
delay clob NULL,
variance clob NULL,
business_hours_only char(1) NULL,
is_withdrawal_message char(1) NULL,
message_template_id number(12) NULL,
work_flow_stage_id number(12) NULL
);
ALTER TABLE tl_work_flow_message ADD
CONSTRAINT PK_tl_work_flow_message PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_work_flow_message_work_flow_stage_id
ON tl_work_flow_message (work_flow_stage_id);
-- DROP TABLE tl_work_flow_stage;
CREATE TABLE tl_work_flow_stage (
object_id number(12) NOT NULL ,
object_last_updated_date date DEFAULT SYSDATE NOT NULL ,
object_created_date date DEFAULT SYSDATE NOT NULL
,
name clob NOT NULL,
use_messaging char(1) NULL,
stage_type varchar2(200) NOT NULL,
sort_order number(12) NOT NULL,
withdrawal_message_id number(12) NULL,
work_flow_template_id number(12) NOT NULL
);
ALTER TABLE tl_work_flow_stage ADD
CONSTRAINT PK_tl_work_flow_stage PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_work_flow_stage_work_flow_template_id
ON tl_work_flow_stage (work_flow_template_id);
-- DROP TABLE tl_work_flow_template;
CREATE TABLE tl_work_flow_template (
object_id number(12) NOT NULL ,
object_last_updated_date date DEFAULT SYSDATE NOT NULL ,
object_created_date date DEFAULT SYSDATE NOT NULL
,
template_name clob NOT NULL,
landing_button_text clob NULL,
verification_header_text clob NULL,
capture_cv char(1) NULL,
is_cv_mandatory char(1) NULL,
capture_cl char(1) NULL,
is_cl_mandatory char(1) NULL,
application_button_text clob NULL,
application_response_action varchar2(200) NOT NULL,
thank_you_header_text clob NULL,
thank_you_secondary_text clob NULL,
job_outline_button_text clob NULL,
is_global_template char(1) NULL,
withdrawal_message_id number(12) NULL,
hiring_team_id number(12) NULL
);
ALTER TABLE tl_work_flow_template ADD
CONSTRAINT PK_tl_work_flow_template PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_work_flow_template_hiring_team_id
ON tl_work_flow_template (hiring_team_id);
-- @AutoRun
-- drop table tl_chat_attachment;
CREATE TABLE tl_chat_attachment (
object_id numeric(12) NOT NULL ,
object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
object_created_date timestamp DEFAULT NOW() NOT NULL
,
file bytea NULL,
message_id numeric(12) NULL
);
ALTER TABLE tl_chat_attachment ADD
CONSTRAINT pk_tl_chat_attachment PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_chat_attachment_message_id
ON tl_chat_attachment (message_id);
......@@ -44,7 +44,8 @@ CREATE TABLE tl_job (
occupation_id numeric(12) NOT NULL,
shortened_url_id numeric(12) NULL,
template_id numeric(12) NULL,
job_title_id numeric(12) NOT NULL
job_title_id numeric(12) NOT NULL,
work_flow_template_id numeric(12) NULL
);
......@@ -59,3 +60,6 @@ ALTER TABLE tl_job ADD
CREATE INDEX idx_tl_job_client_id
ON tl_job (client_id);
CREATE INDEX idx_tl_job_work_flow_template_id
ON tl_job (work_flow_template_id);
......@@ -18,7 +18,8 @@ CREATE TABLE tl_job_application (
happy_to_relocate char(1) NULL,
is_email_ingest char(1) NULL,
candidate_id numeric(12) NOT NULL,
job_id numeric(12) NOT NULL
job_id numeric(12) NOT NULL,
work_flow_stage_id numeric(12) NULL
);
......
-- @AutoRun
-- drop table tl_message;
CREATE TABLE tl_message (
object_id numeric(12) NOT NULL ,
object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
object_created_date timestamp DEFAULT NOW() NOT NULL
,
sent_via varchar(200) NULL,
message_content text NULL,
is_read char(1) NULL,
sent_by numeric(12) NULL,
work_flow_message numeric(12) NULL,
job_application_id numeric(12) NULL
);
ALTER TABLE tl_message ADD
CONSTRAINT pk_tl_message PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_message_job_application_id
ON tl_message (job_application_id);
......@@ -17,7 +17,10 @@ CREATE TABLE tl_message_template (
delay_min numeric(12) NULL,
variance numeric(12) NULL,
business_hours_only char(1) NULL,
message_content text NOT NULL
message_content text NOT NULL,
template_type varchar(200) NULL,
is_global_template char(1) NULL,
hiring_team_id numeric(12) NULL
);
......@@ -30,3 +33,5 @@ ALTER TABLE tl_message_template ADD
CREATE INDEX idx_tl_message_template_hiring_team_id
ON tl_message_template (hiring_team_id);
-- @AutoRun
-- drop table tl_work_flow_message;
CREATE TABLE tl_work_flow_message (
object_id numeric(12) NOT NULL ,
object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
object_created_date timestamp DEFAULT NOW() NOT NULL
,
delay text NULL,
variance text NULL,
business_hours_only char(1) NULL,
is_withdrawal_message char(1) NULL,
message_template_id numeric(12) NULL,
work_flow_stage_id numeric(12) NULL
);
ALTER TABLE tl_work_flow_message ADD
CONSTRAINT pk_tl_work_flow_message PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_work_flow_message_work_flow_stage_id
ON tl_work_flow_message (work_flow_stage_id);
-- @AutoRun
-- drop table tl_work_flow_stage;
CREATE TABLE tl_work_flow_stage (
object_id numeric(12) NOT NULL ,
object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
object_created_date timestamp DEFAULT NOW() NOT NULL
,
name text NOT NULL,
use_messaging char(1) NULL,
stage_type varchar(200) NOT NULL,
sort_order numeric(12) NOT NULL,
withdrawal_message_id numeric(12) NULL,
work_flow_template_id numeric(12) NOT NULL
);
ALTER TABLE tl_work_flow_stage ADD
CONSTRAINT pk_tl_work_flow_stage PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_work_flow_stage_work_flow_template_id
ON tl_work_flow_stage (work_flow_template_id);
-- @AutoRun
-- drop table tl_work_flow_template;
CREATE TABLE tl_work_flow_template (
object_id numeric(12) NOT NULL ,
object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
object_created_date timestamp DEFAULT NOW() NOT NULL
,
template_name text NOT NULL,
landing_button_text text NULL,
verification_header_text text NULL,
capture_cv char(1) NULL,
is_cv_mandatory char(1) NULL,
capture_cl char(1) NULL,
is_cl_mandatory char(1) NULL,
application_button_text text NULL,
application_response_action varchar(200) NOT NULL,
thank_you_header_text text NULL,
thank_you_secondary_text text NULL,
job_outline_button_text text NULL,
is_global_template char(1) NULL,
withdrawal_message_id numeric(12) NULL,
hiring_team_id numeric(12) NULL
);
ALTER TABLE tl_work_flow_template ADD
CONSTRAINT pk_tl_work_flow_template PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_work_flow_template_hiring_team_id
ON tl_work_flow_template (hiring_team_id);
/*
* IMPORTANT!!!! XSL Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure9.0 [oneit.objstore.BusinessObjectTemplate.xsl]
* Vendor: Apache Software Foundation (Xalan XSLTC) (Version: 1.0)
*/
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 BaseChatAttachment extends BaseBusinessClass
{
// Reference instance for the object
public static final ChatAttachment REFERENCE_ChatAttachment = new ChatAttachment ();
// Reference instance for the object
public static final ChatAttachment DUMMY_ChatAttachment = new DummyChatAttachment ();
// Static constants corresponding to field names
public static final String FIELD_File = "File";
public static final String SINGLEREFERENCE_Message = "Message";
public static final String BACKREF_Message = "";
// Static constants corresponding to searches
// Static constants corresponding to attribute helpers
private static final BLOBAttributeHelper HELPER_File = BLOBAttributeHelper.INSTANCE;
// Private attributes corresponding to business object data
private BinaryContent _File;
// Private attributes corresponding to single references
private SingleAssociation<ChatAttachment, Message> _Message;
// Private attributes corresponding to multiple references
// Map of maps of metadata
private static final Map ATTRIBUTES_METADATA_ChatAttachment = new LinkedHashMap ();
// Arrays of validators for each attribute
private static final AttributeValidator[] FIELD_File_Validators;
// Arrays of AttributeDecorators for each attribute
private static final AttributeDecorator<ChatAttachment, BinaryContent>[] FIELD_File_Decorators;
// Arrays of SingleAssocDecorators for each attribute
private static final SingleAssocDecorator<ChatAttachment, Message>[] SINGLEREFERENCE_Message_Decorators;
// Arrays of MultiAssocDecorators for each attribute
// Arrays of behaviour decorators
private static final ChatAttachmentBehaviourDecorator[] ChatAttachment_BehaviourDecorators;
static
{
try
{
String tmp_Message = Message.BACKREF_Attachments;
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
setupAssocMetaData_Message();
FIELD_File_Validators = (AttributeValidator[])setupAttribMetaData_File(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_File_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_ChatAttachment, FIELD_File).toArray (new AttributeDecorator[0]);
SINGLEREFERENCE_Message_Decorators = (SingleAssocDecorator[])AttributeDecoratorUtils.getSingleAssocDecorators(REFERENCE_ChatAttachment, SINGLEREFERENCE_Message).toArray (new SingleAssocDecorator[0]);
REFERENCE_ChatAttachment.initialiseReference ();
DUMMY_ChatAttachment.initialiseReference ();
ChatAttachment_BehaviourDecorators = BaseBusinessClass.getBBCBehaviours(ChatAttachment.class).toArray(new ChatAttachmentBehaviourDecorator[0]);
}
catch (RuntimeException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR1, e, "Error initialising");
throw e;
}
}
private static void setupAssocMetaData_Message()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "Attachments");
metaInfo.put ("dbcol", "message_id");
metaInfo.put ("name", "Message");
metaInfo.put ("type", "Message");
metaInfo.put (METADATA_DB_TABLENAME, "tl_chat_attachment");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for ChatAttachment.Message:", metaInfo);
ATTRIBUTES_METADATA_ChatAttachment.put (SINGLEREFERENCE_Message, Collections.unmodifiableMap (metaInfo));
}
private static List setupAttribMetaData_File(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("attribHelper", "BLOBAttributeHelper");
metaInfo.put ("attribHelperInstance", "BLOBAttributeHelper.INSTANCE");
metaInfo.put ("binaryHandler", "loggedin");
metaInfo.put ("dbcol", "file");
metaInfo.put ("name", "File");
metaInfo.put ("type", "BinaryContent");
metaInfo.put (METADATA_DB_TABLENAME, "tl_chat_attachment");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for ChatAttachment.File:", metaInfo);
ATTRIBUTES_METADATA_ChatAttachment.put (FIELD_File, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(ChatAttachment.class, "File", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for ChatAttachment.File:", validators);
return validators;
}
// END OF STATIC METADATA DEFINITION
// This constructor should not be called
protected BaseChatAttachment ()
{
}
protected BBCBehaviourDecorator[] getBehaviours()
{
return ChatAttachment_BehaviourDecorators;
}
protected void _initialiseNewObjAttributes (ObjectTransaction transaction) throws StorageException
{
super._initialiseNewObjAttributes (transaction);
_File = (BinaryContent)(HELPER_File.initialise (_File));
}
protected void _initialiseAssociations ()
{
super._initialiseAssociations ();
_Message = new SingleAssociation<ChatAttachment, Message> (this, SINGLEREFERENCE_Message, Message.MULTIPLEREFERENCE_Attachments, Message.REFERENCE_Message, "tl_chat_attachment");
}
protected BaseBusinessClass initialiseReference ()
{
super.initialiseReference ();
_Message = new SingleAssociation<ChatAttachment, Message> (this, SINGLEREFERENCE_Message, Message.MULTIPLEREFERENCE_Attachments, Message.REFERENCE_Message, "tl_chat_attachment");
return this;
}
/**
* Attribute File
*/
public BinaryContent getFile ()
{
assertValid();
BinaryContent valToReturn = AttributeDecoratorUtils.getValue (FIELD_File_Decorators, (ChatAttachment)this, FIELD_File, _File);
for (ChatAttachmentBehaviourDecorator bhd : ChatAttachment_BehaviourDecorators)
{
valToReturn = bhd.getFile ((ChatAttachment)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 preFileChange (BinaryContent newFile) 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 postFileChange () throws FieldException
{
}
public FieldWriteability getWriteability_File ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute File. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setFile (BinaryContent newFile) throws FieldException
{
newFile = AttributeDecoratorUtils.setValue (FIELD_File_Decorators, (ChatAttachment)this, FIELD_File, newFile);
boolean oldAndNewIdentical = HELPER_File.compare (_File, newFile);
try
{
for (ChatAttachmentBehaviourDecorator bhd : ChatAttachment_BehaviourDecorators)
{
newFile = bhd.setFile ((ChatAttachment)this, newFile);
oldAndNewIdentical = HELPER_File.compare (_File, newFile);
}
if (FIELD_File_Validators.length > 0)
{
Object newFileObj = HELPER_File.toObject (newFile);
if (newFileObj != null)
{
int loopMax = FIELD_File_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_ChatAttachment.get (FIELD_File);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_File_Validators[v].checkAttribute (this, FIELD_File, metadata, newFileObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (AttributeDecoratorUtils.getWriteability (FIELD_File_Decorators, (ChatAttachment)this, FIELD_File ,getWriteability_File ()) != FieldWriteability.FALSE, "Field File is not writeable");
preFileChange (newFile);
markFieldChange (FIELD_File);
_File = newFile;
postFieldChange (FIELD_File);
postFileChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getSingleAssocs()
{
List result = super.getSingleAssocs ();
result.add("Message");
return result;
}
public BaseBusinessClass getSingleAssocReferenceInstance (String assocName)
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Message))
{
return _Message.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_Message))
{
return Message.MULTIPLEREFERENCE_Attachments ;
}
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_Message))
{
return getMessage ();
}
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_Message))
{
return getMessage (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_Message))
{
return getMessageID ();
}
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_Message))
{
setMessage ((Message)(newValue));
}
else
{
super.setSingleAssoc (assocName, newValue);
}
}
/**
* Get the reference Message
*/
public Message getMessage () throws StorageException
{
assertValid();
try
{
return (Message)(_Message.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in ChatAttachment:", this.getObjectID (), ", was trying to get Message:", getMessageID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _Message.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Message getMessage (Get getType) throws StorageException
{
assertValid();
return _Message.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getMessageID ()
{
assertValid();
if (_Message == null)
{
return null;
}
else
{
return _Message.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 preMessageChange (Message newMessage) 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 postMessageChange () throws FieldException
{
}
public FieldWriteability getWriteability_Message ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference Message. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setMessage (Message newMessage) throws StorageException, FieldException
{
if (_Message.wouldReferencedChange (newMessage))
{
assertValid();
Debug.assertion (AttributeDecoratorUtils.getWriteability (SINGLEREFERENCE_Message_Decorators, (ChatAttachment)this, SINGLEREFERENCE_Message ,getWriteability_Message ()) != FieldWriteability.FALSE, "Assoc Message is not writeable");
preMessageChange (newMessage);
Message oldMessage = getMessage ();
if (oldMessage != null)
{
// This is to stop validation from triggering when we are removed
_Message.set (null);
oldMessage.removeFromAttachments ((ChatAttachment)(this));
}
_Message.set (newMessage);
if (newMessage != null)
{
newMessage.addToAttachments ((ChatAttachment)(this));
}
postMessageChange ();
}
}
/**
* 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 (_Message.isLoaded () || getTransaction ().isObjectLoaded (_Message.getReferencedType (), getMessageID ()))
{
Message referenced = getMessage ();
if (referenced != null)
{
// Stop the callback
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null Attachments from ", getObjectID (), " to ", referenced.getObjectID ());
_Message.set (null);
referenced.removeFromAttachments ((ChatAttachment)this);
}
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
super.onDelete ();
}
public ChatAttachment newInstance ()
{
return new ChatAttachment ();
}
public ChatAttachment referenceInstance ()
{
return REFERENCE_ChatAttachment;
}
public ChatAttachment getInTransaction (ObjectTransaction t) throws StorageException
{
return getChatAttachmentByID (t, getObjectID());
}
public BaseBusinessClass dummyInstance ()
{
return DUMMY_ChatAttachment;
}
public String getBaseSetName ()
{
return "tl_chat_attachment";
}
/**
* 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_chat_attachmentPSet = allSets.getPersistentSet (myID, "tl_chat_attachment", myPSetStatus);
tl_chat_attachmentPSet.setAttrib (FIELD_ObjectID, myID);
tl_chat_attachmentPSet.setAttrib (FIELD_File, HELPER_File.toObject (_File)); //
_Message.getPersistentSets (allSets);
}
/**
* Sets the objects state based on Persistent sets.
*/
public void setFromPersistentSets (ObjectID objectID, PersistentSetCollection allSets)
{
super.setFromPersistentSets (objectID, allSets);
PersistentSet tl_chat_attachmentPSet = allSets.getPersistentSet (objectID, "tl_chat_attachment");
_File = (BinaryContent)(HELPER_File.fromObject (_File, tl_chat_attachmentPSet.getAttrib (FIELD_File))); //
_Message.setFromPersistentSets (objectID, allSets);
}
public void setAttributesFrom (BaseBusinessClass other, MultiException e)
{
super.setAttributesFrom (other, e);
if (other instanceof ChatAttachment)
{
ChatAttachment otherChatAttachment = (ChatAttachment)other;
try
{
setFile (otherChatAttachment.getFile ());
}
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 BaseChatAttachment)
{
BaseChatAttachment sourceChatAttachment = (BaseChatAttachment)(source);
_File = sourceChatAttachment._File;
}
}
/**
* 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 BaseChatAttachment)
{
BaseChatAttachment sourceChatAttachment = (BaseChatAttachment)(source);
_Message.copyFrom (sourceChatAttachment._Message, 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 BaseChatAttachment)
{
BaseChatAttachment sourceChatAttachment = (BaseChatAttachment)(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);
_File = (BinaryContent)(HELPER_File.readExternal (_File, vals.get(FIELD_File))); //
_Message.readExternalData(vals.get(SINGLEREFERENCE_Message));
}
/**
* Subclasses must override this to write out their attributes
*/
protected void writeExternalData(Map<String, Object> vals) throws IOException
{
super.writeExternalData(vals);
vals.put (FIELD_File, HELPER_File.writeExternal (_File));
vals.put (SINGLEREFERENCE_Message, _Message.writeExternalData());
}
public void compare (BaseBusinessClass other, AttributeChangeListener listener) throws StorageException
{
super.compare (other, listener);
if (other instanceof BaseChatAttachment)
{
BaseChatAttachment otherChatAttachment = (BaseChatAttachment)(other);
if (!HELPER_File.compare(this._File, otherChatAttachment._File))
{
listener.notifyFieldChange(this, other, FIELD_File, HELPER_File.toObject(this._File), HELPER_File.toObject(otherChatAttachment._File));
}
// Compare single assocs
_Message.compare (otherChatAttachment._Message, 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_File, HELPER_File.toObject(getFile()));
visitor.visitAssociation (_Message);
}
public void visitAssociations (AssociationVisitor visitor, AssociatedScope scope) throws StorageException
{
super.visitAssociations (visitor, scope);
if (scope.includes (_Message))
{
visitor.visit (_Message);
}
}
public static ChatAttachment createChatAttachment (ObjectTransaction transaction) throws StorageException
{
ChatAttachment result = new ChatAttachment ();
result.initialiseNewObject (transaction);
return result;
}
public static ChatAttachment getChatAttachmentByID (ObjectTransaction transaction, Long objectID) throws StorageException
{
return (ChatAttachment)(transaction.getObjectByID (REFERENCE_ChatAttachment, objectID));
}
public boolean testFilter (String attribName, QueryFilter filter) throws StorageException
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_File))
{
return filter.matches (getFile ());
}
else if (attribName.equals (SINGLEREFERENCE_Message))
{
return filter.matches (getMessage ());
}
else
{
return super.testFilter (attribName, filter);
}
}
public Object getAttribute (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_File))
{
return HELPER_File.toObject (getFile ());
}
else
{
return super.getAttribute (attribName);
}
}
public AttributeHelper getAttributeHelper (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_File))
{
return HELPER_File;
}
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_File))
{
setFile ((BinaryContent)(HELPER_File.fromObject (_File, attribValue)));
}
else
{
super.setAttribute (attribName, attribValue);
}
}
public boolean isWriteable (String fieldName)
{
return getWriteable (fieldName) == FieldWriteability.TRUE;
}
public boolean isReadable ()
{
return super.isReadable();
}
public boolean isReadable (String fieldName)
{
return super.isReadable(fieldName);
}
public FieldWriteability getWriteable (String fieldName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (fieldName.equals (FIELD_File))
{
return getWriteability_File ();
}
else if (fieldName.equals (SINGLEREFERENCE_Message))
{
return getWriteability_Message ();
}
else
{
return super.getWriteable (fieldName);
}
}
public void putUnwriteable (Set<String> fields)
{
if (getWriteability_File () != FieldWriteability.TRUE)
{
fields.add (FIELD_File);
}
super.putUnwriteable (fields);
}
public String[] getAllTableNames()
{
return new String[] {"tl_chat_attachment"};
}
public boolean isPolymorphic(String tableName)
{
return super.isPolymorphic(tableName);
}
public List<AbstractAttribute> getAttributes ()
{
List result = super.getAttributes ();
result.add(HELPER_File.getAttribObject (getClass (), _File, false, FIELD_File));
return result;
}
public Map getAttributeMetadata (String attribute)
{
if (ATTRIBUTES_METADATA_ChatAttachment.containsKey (attribute))
{
return (Map)ATTRIBUTES_METADATA_ChatAttachment.get (attribute);
}
else
{
return super.getAttributeMetadata (attribute);
}
}
public Object getAttributeMetadata (String attribute, String metadata)
{
if (ATTRIBUTES_METADATA_ChatAttachment.containsKey (attribute))
{
return ((Map)ATTRIBUTES_METADATA_ChatAttachment.get (attribute)).get(metadata);
}
else
{
return super.getAttributeMetadata (attribute, metadata);
}
}
public void copyAllAttributeMetadata (Map copyInto)
{
super.copyAllAttributeMetadata(copyInto);
copyInto.putAll(ATTRIBUTES_METADATA_ChatAttachment);
}
public void preCommit (boolean willBeStored) throws Exception
{
super.preCommit(willBeStored);
if(willBeStored)
{
{
oneit.servlets.objstore.binary.BinaryContentHandler bchandler = oneit.servlets.objstore.binary.BinaryContentServlet.getHandler("loggedin");
if(bchandler != null)
{
bchandler.preCommit(willBeStored, this, "File");
}
else
{
LogMgr.log(BUSINESS_OBJECTS, LogLevel.SYSTEMWARNING, "Unknown BinaryContentHandler loggedin on attribute File");
}
}
}
}
public oneit.servlets.objstore.binary.BinaryContentHandler getBinaryContentHandler(String attribName)
{
if(CollectionUtils.equals(attribName, "File"))
{
return oneit.servlets.objstore.binary.BinaryContentServlet.getHandler("loggedin");
}
return super.getBinaryContentHandler(attribName);
}
public static class ChatAttachmentBehaviourDecorator extends BaseBusinessClass.BBCBehaviourDecorator<ChatAttachment>
{
/**
* Get the attribute File
*/
public BinaryContent getFile (ChatAttachment obj, BinaryContent original)
{
return original;
}
/**
* Change the value set for attribute File.
* May modify the field beforehand
* Occurs before validation.
*/
public BinaryContent setFile (ChatAttachment obj, BinaryContent newFile) throws FieldException
{
return newFile;
}
}
@Override
public ORMPipeLine pipes()
{
return new ChatAttachmentPipeLineFactory<ChatAttachment, ChatAttachment> ((ChatAttachment)this);
}
@Override
public ORMPipeLine pipes(Collection _items)
{
return pipesChatAttachment(_items);
}
/**
* Use this instead of pipes() to get rid of type casting.
*/
public ChatAttachmentPipeLineFactory<ChatAttachment, ChatAttachment> pipelineChatAttachment()
{
return (ChatAttachmentPipeLineFactory<ChatAttachment, ChatAttachment>) pipes();
}
public static ChatAttachmentPipeLineFactory<ChatAttachment, ChatAttachment> pipesChatAttachment(Collection<ChatAttachment> items)
{
return REFERENCE_ChatAttachment.new ChatAttachmentPipeLineFactory<ChatAttachment, ChatAttachment> (items);
}
public static ChatAttachmentPipeLineFactory<ChatAttachment, ChatAttachment> pipesChatAttachment(ChatAttachment[] _items)
{
return pipesChatAttachment(Arrays.asList (_items));
}
public static ChatAttachmentPipeLineFactory<ChatAttachment, ChatAttachment> pipesChatAttachment()
{
return pipesChatAttachment((Collection)null);
}
public class ChatAttachmentPipeLineFactory<From extends BaseBusinessClass, Me extends ChatAttachment> extends BaseBusinessClass.ORMPipeLine<From, Me>
{
public <Prev> ChatAttachmentPipeLineFactory (PipeLine<From, Prev> pipeLine, Pipe<Prev, Me> nextPipe)
{
super (pipeLine, nextPipe);
}
public ChatAttachmentPipeLineFactory (From seed)
{
super(seed);
}
public ChatAttachmentPipeLineFactory (Collection<From> seed)
{
super(seed);
}
public PipeLine<From, ? extends Object> to(String name)
{
if (name.equals ("File"))
{
return toFile ();
}
if (name.equals ("Message"))
{
return toMessage ();
}
return super.to(name);
}
public PipeLine<From, BinaryContent> toFile () { return pipe(new ORMAttributePipe<Me, BinaryContent>(FIELD_File)); }
public Message.MessagePipeLineFactory<From, Message> toMessage () { return toMessage (Filter.ALL); }
public Message.MessagePipeLineFactory<From, Message> toMessage (Filter<Message> filter)
{
return Message.REFERENCE_Message.new MessagePipeLineFactory<From, Message> (this, new ORMSingleAssocPipe<Me, Message>(SINGLEREFERENCE_Message, filter));
}
}
public boolean isTransientAttrib(String attribName)
{
return super.isTransientAttrib(attribName);
}
public boolean isTransientSingleReference(String assocName)
{
return super.isTransientSingleReference(assocName);
}
}
class DummyChatAttachment extends ChatAttachment
{
// Default constructor primarily to support Externalisable
public DummyChatAttachment()
{
super();
}
public void assertValid ()
{
}
public Message getMessage () throws StorageException
{
return (Message)(Message.DUMMY_Message);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getMessageID ()
{
return Message.DUMMY_Message.getObjectID();
}
}
......@@ -95,6 +95,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
public static final String BACKREF_BillingTeams = "";
public static final String MULTIPLEREFERENCE_DiversityQuestions = "DiversityQuestions";
public static final String BACKREF_DiversityQuestions = "";
public static final String MULTIPLEREFERENCE_WorkFlowTemplates = "WorkFlowTemplates";
public static final String BACKREF_WorkFlowTemplates = "";
public static final String MULTIPLEREFERENCE_MessageTemplates = "MessageTemplates";
public static final String BACKREF_MessageTemplates = "";
// Static constants corresponding to searches
public static final String SEARCH_All = "All";
......@@ -207,6 +211,8 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
private MultipleAssociation<HiringTeam, Client> _Clients;
private MultipleAssociation<HiringTeam, HiringTeam> _BillingTeams;
private MultipleAssociation<HiringTeam, HTDiversityQuestion> _DiversityQuestions;
private MultipleAssociation<HiringTeam, WorkFlowTemplate> _WorkFlowTemplates;
private MultipleAssociation<HiringTeam, MessageTemplate> _MessageTemplates;
// Map of maps of metadata
......@@ -317,6 +323,8 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
private static final MultiAssocDecorator<HiringTeam, Client>[] MULTIPLEREFERENCE_Clients_Decorators;
private static final MultiAssocDecorator<HiringTeam, HiringTeam>[] MULTIPLEREFERENCE_BillingTeams_Decorators;
private static final MultiAssocDecorator<HiringTeam, HTDiversityQuestion>[] MULTIPLEREFERENCE_DiversityQuestions_Decorators;
private static final MultiAssocDecorator<HiringTeam, WorkFlowTemplate>[] MULTIPLEREFERENCE_WorkFlowTemplates_Decorators;
private static final MultiAssocDecorator<HiringTeam, MessageTemplate>[] MULTIPLEREFERENCE_MessageTemplates_Decorators;
// Arrays of behaviour decorators
......@@ -331,6 +339,8 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
String tmp_Clients = Client.BACKREF_HiringTeam;
String tmp_BillingTeams = HiringTeam.BACKREF_BilledByTeam;
String tmp_DiversityQuestions = HTDiversityQuestion.BACKREF_HiringTeam;
String tmp_WorkFlowTemplates = WorkFlowTemplate.BACKREF_HiringTeam;
String tmp_MessageTemplates = MessageTemplate.BACKREF_HiringTeam;
String tmp_Company = Company.BACKREF_HiringTeams;
String tmp_BilledByTeam = HiringTeam.BACKREF_BillingTeams;
......@@ -340,6 +350,8 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
setupAssocMetaData_Clients();
setupAssocMetaData_BillingTeams();
setupAssocMetaData_DiversityQuestions();
setupAssocMetaData_WorkFlowTemplates();
setupAssocMetaData_MessageTemplates();
setupAssocMetaData_Company();
setupAssocMetaData_BilledByTeam();
setupAssocMetaData_AddedByUser();
......@@ -440,6 +452,8 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
MULTIPLEREFERENCE_Clients_Decorators = (MultiAssocDecorator[])AttributeDecoratorUtils.getMultiAssocDecorators(REFERENCE_HiringTeam, MULTIPLEREFERENCE_Clients).toArray (new MultiAssocDecorator[0]);
MULTIPLEREFERENCE_BillingTeams_Decorators = (MultiAssocDecorator[])AttributeDecoratorUtils.getMultiAssocDecorators(REFERENCE_HiringTeam, MULTIPLEREFERENCE_BillingTeams).toArray (new MultiAssocDecorator[0]);
MULTIPLEREFERENCE_DiversityQuestions_Decorators = (MultiAssocDecorator[])AttributeDecoratorUtils.getMultiAssocDecorators(REFERENCE_HiringTeam, MULTIPLEREFERENCE_DiversityQuestions).toArray (new MultiAssocDecorator[0]);
MULTIPLEREFERENCE_WorkFlowTemplates_Decorators = (MultiAssocDecorator[])AttributeDecoratorUtils.getMultiAssocDecorators(REFERENCE_HiringTeam, MULTIPLEREFERENCE_WorkFlowTemplates).toArray (new MultiAssocDecorator[0]);
MULTIPLEREFERENCE_MessageTemplates_Decorators = (MultiAssocDecorator[])AttributeDecoratorUtils.getMultiAssocDecorators(REFERENCE_HiringTeam, MULTIPLEREFERENCE_MessageTemplates).toArray (new MultiAssocDecorator[0]);
REFERENCE_HiringTeam.initialiseReference ();
......@@ -506,6 +520,32 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
}
private static void setupAssocMetaData_WorkFlowTemplates()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "HiringTeam");
metaInfo.put ("name", "WorkFlowTemplates");
metaInfo.put ("type", "WorkFlowTemplate");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for HiringTeam.WorkFlowTemplates:", metaInfo);
ATTRIBUTES_METADATA_HiringTeam.put (MULTIPLEREFERENCE_WorkFlowTemplates, Collections.unmodifiableMap (metaInfo));
}
private static void setupAssocMetaData_MessageTemplates()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "HiringTeam");
metaInfo.put ("name", "MessageTemplates");
metaInfo.put ("type", "MessageTemplate");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for HiringTeam.MessageTemplates:", metaInfo);
ATTRIBUTES_METADATA_HiringTeam.put (MULTIPLEREFERENCE_MessageTemplates, Collections.unmodifiableMap (metaInfo));
}
private static void setupAssocMetaData_Company()
{
Map metaInfo = new HashMap ();
......@@ -1427,7 +1467,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
_AddedByUser = new SingleAssociation<HiringTeam, CompanyUser> (this, SINGLEREFERENCE_AddedByUser, null, CompanyUser.REFERENCE_CompanyUser, "tl_hiring_team");
_PaymentPlan = new SingleAssociation<HiringTeam, PaymentPlan> (this, SINGLEREFERENCE_PaymentPlan, null, PaymentPlan.REFERENCE_PaymentPlan, "tl_hiring_team");
_Coupon = new SingleAssociation<HiringTeam, StripeCoupon> (this, SINGLEREFERENCE_Coupon, null, StripeCoupon.REFERENCE_StripeCoupon, "tl_hiring_team");
_Users = new MultipleAssociation<HiringTeam, CompanyUserHiringTeamLink> (this, MULTIPLEREFERENCE_Users, CompanyUserHiringTeamLink.SINGLEREFERENCE_HiringTeam, CompanyUserHiringTeamLink.REFERENCE_CompanyUserHiringTeamLink);_Clients = new MultipleAssociation<HiringTeam, Client> (this, MULTIPLEREFERENCE_Clients, Client.SINGLEREFERENCE_HiringTeam, Client.REFERENCE_Client);_BillingTeams = new MultipleAssociation<HiringTeam, HiringTeam> (this, MULTIPLEREFERENCE_BillingTeams, HiringTeam.SINGLEREFERENCE_BilledByTeam, HiringTeam.REFERENCE_HiringTeam);_DiversityQuestions = new MultipleAssociation<HiringTeam, HTDiversityQuestion> (this, MULTIPLEREFERENCE_DiversityQuestions, HTDiversityQuestion.SINGLEREFERENCE_HiringTeam, HTDiversityQuestion.REFERENCE_HTDiversityQuestion);
_Users = new MultipleAssociation<HiringTeam, CompanyUserHiringTeamLink> (this, MULTIPLEREFERENCE_Users, CompanyUserHiringTeamLink.SINGLEREFERENCE_HiringTeam, CompanyUserHiringTeamLink.REFERENCE_CompanyUserHiringTeamLink);_Clients = new MultipleAssociation<HiringTeam, Client> (this, MULTIPLEREFERENCE_Clients, Client.SINGLEREFERENCE_HiringTeam, Client.REFERENCE_Client);_BillingTeams = new MultipleAssociation<HiringTeam, HiringTeam> (this, MULTIPLEREFERENCE_BillingTeams, HiringTeam.SINGLEREFERENCE_BilledByTeam, HiringTeam.REFERENCE_HiringTeam);_DiversityQuestions = new MultipleAssociation<HiringTeam, HTDiversityQuestion> (this, MULTIPLEREFERENCE_DiversityQuestions, HTDiversityQuestion.SINGLEREFERENCE_HiringTeam, HTDiversityQuestion.REFERENCE_HTDiversityQuestion);_WorkFlowTemplates = new MultipleAssociation<HiringTeam, WorkFlowTemplate> (this, MULTIPLEREFERENCE_WorkFlowTemplates, WorkFlowTemplate.SINGLEREFERENCE_HiringTeam, WorkFlowTemplate.REFERENCE_WorkFlowTemplate);_MessageTemplates = new MultipleAssociation<HiringTeam, MessageTemplate> (this, MULTIPLEREFERENCE_MessageTemplates, MessageTemplate.SINGLEREFERENCE_HiringTeam, MessageTemplate.REFERENCE_MessageTemplate);
}
......@@ -1440,7 +1480,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
_AddedByUser = new SingleAssociation<HiringTeam, CompanyUser> (this, SINGLEREFERENCE_AddedByUser, null, CompanyUser.REFERENCE_CompanyUser, "tl_hiring_team");
_PaymentPlan = new SingleAssociation<HiringTeam, PaymentPlan> (this, SINGLEREFERENCE_PaymentPlan, null, PaymentPlan.REFERENCE_PaymentPlan, "tl_hiring_team");
_Coupon = new SingleAssociation<HiringTeam, StripeCoupon> (this, SINGLEREFERENCE_Coupon, null, StripeCoupon.REFERENCE_StripeCoupon, "tl_hiring_team");
_Users = new MultipleAssociation<HiringTeam, CompanyUserHiringTeamLink> (this, MULTIPLEREFERENCE_Users, CompanyUserHiringTeamLink.SINGLEREFERENCE_HiringTeam, CompanyUserHiringTeamLink.REFERENCE_CompanyUserHiringTeamLink);_Clients = new MultipleAssociation<HiringTeam, Client> (this, MULTIPLEREFERENCE_Clients, Client.SINGLEREFERENCE_HiringTeam, Client.REFERENCE_Client);_BillingTeams = new MultipleAssociation<HiringTeam, HiringTeam> (this, MULTIPLEREFERENCE_BillingTeams, HiringTeam.SINGLEREFERENCE_BilledByTeam, HiringTeam.REFERENCE_HiringTeam);_DiversityQuestions = new MultipleAssociation<HiringTeam, HTDiversityQuestion> (this, MULTIPLEREFERENCE_DiversityQuestions, HTDiversityQuestion.SINGLEREFERENCE_HiringTeam, HTDiversityQuestion.REFERENCE_HTDiversityQuestion);
_Users = new MultipleAssociation<HiringTeam, CompanyUserHiringTeamLink> (this, MULTIPLEREFERENCE_Users, CompanyUserHiringTeamLink.SINGLEREFERENCE_HiringTeam, CompanyUserHiringTeamLink.REFERENCE_CompanyUserHiringTeamLink);_Clients = new MultipleAssociation<HiringTeam, Client> (this, MULTIPLEREFERENCE_Clients, Client.SINGLEREFERENCE_HiringTeam, Client.REFERENCE_Client);_BillingTeams = new MultipleAssociation<HiringTeam, HiringTeam> (this, MULTIPLEREFERENCE_BillingTeams, HiringTeam.SINGLEREFERENCE_BilledByTeam, HiringTeam.REFERENCE_HiringTeam);_DiversityQuestions = new MultipleAssociation<HiringTeam, HTDiversityQuestion> (this, MULTIPLEREFERENCE_DiversityQuestions, HTDiversityQuestion.SINGLEREFERENCE_HiringTeam, HTDiversityQuestion.REFERENCE_HTDiversityQuestion);_WorkFlowTemplates = new MultipleAssociation<HiringTeam, WorkFlowTemplate> (this, MULTIPLEREFERENCE_WorkFlowTemplates, WorkFlowTemplate.SINGLEREFERENCE_HiringTeam, WorkFlowTemplate.REFERENCE_WorkFlowTemplate);_MessageTemplates = new MultipleAssociation<HiringTeam, MessageTemplate> (this, MULTIPLEREFERENCE_MessageTemplates, MessageTemplate.SINGLEREFERENCE_HiringTeam, MessageTemplate.REFERENCE_MessageTemplate);
return this;
}
......@@ -6462,6 +6502,8 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
result.add("Clients");
result.add("BillingTeams");
result.add("DiversityQuestions");
result.add("WorkFlowTemplates");
result.add("MessageTemplates");
return result;
}
......@@ -6488,6 +6530,14 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{
return HTDiversityQuestion.REFERENCE_HTDiversityQuestion ;
}
if (MULTIPLEREFERENCE_WorkFlowTemplates.equals(attribName))
{
return WorkFlowTemplate.REFERENCE_WorkFlowTemplate ;
}
if (MULTIPLEREFERENCE_MessageTemplates.equals(attribName))
{
return MessageTemplate.REFERENCE_MessageTemplate ;
}
return super.getMultiAssocReferenceInstance(attribName);
}
......@@ -6511,6 +6561,14 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{
return HTDiversityQuestion.SINGLEREFERENCE_HiringTeam ;
}
if (MULTIPLEREFERENCE_WorkFlowTemplates.equals(attribName))
{
return WorkFlowTemplate.SINGLEREFERENCE_HiringTeam ;
}
if (MULTIPLEREFERENCE_MessageTemplates.equals(attribName))
{
return MessageTemplate.SINGLEREFERENCE_HiringTeam ;
}
return super.getMultiAssocBackReference(attribName);
}
......@@ -6537,6 +6595,14 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{
return this.getDiversityQuestionsCount();
}
if (MULTIPLEREFERENCE_WorkFlowTemplates.equals(attribName))
{
return this.getWorkFlowTemplatesCount();
}
if (MULTIPLEREFERENCE_MessageTemplates.equals(attribName))
{
return this.getMessageTemplatesCount();
}
return super.getMultiAssocCount(attribName);
}
......@@ -6563,6 +6629,14 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{
return this.getDiversityQuestionsAt(index);
}
if (MULTIPLEREFERENCE_WorkFlowTemplates.equals(attribName))
{
return this.getWorkFlowTemplatesAt(index);
}
if (MULTIPLEREFERENCE_MessageTemplates.equals(attribName))
{
return this.getMessageTemplatesAt(index);
}
return super.getMultiAssocAt(attribName, index);
}
......@@ -6593,6 +6667,16 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
addToDiversityQuestions((HTDiversityQuestion)newElement);
return;
}
if (MULTIPLEREFERENCE_WorkFlowTemplates.equals(attribName))
{
addToWorkFlowTemplates((WorkFlowTemplate)newElement);
return;
}
if (MULTIPLEREFERENCE_MessageTemplates.equals(attribName))
{
addToMessageTemplates((MessageTemplate)newElement);
return;
}
super.addToMultiAssoc(attribName, newElement);
}
......@@ -6622,6 +6706,16 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
removeFromDiversityQuestions((HTDiversityQuestion)oldElement);
return;
}
if (MULTIPLEREFERENCE_WorkFlowTemplates.equals(attribName))
{
removeFromWorkFlowTemplates((WorkFlowTemplate)oldElement);
return;
}
if (MULTIPLEREFERENCE_MessageTemplates.equals(attribName))
{
removeFromMessageTemplates((MessageTemplate)oldElement);
return;
}
super.removeFromMultiAssoc(attribName, oldElement);
}
......@@ -6649,6 +6743,16 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
_DiversityQuestions.__loadAssociation (elements);
return;
}
if (MULTIPLEREFERENCE_WorkFlowTemplates.equals(attribName))
{
_WorkFlowTemplates.__loadAssociation (elements);
return;
}
if (MULTIPLEREFERENCE_MessageTemplates.equals(attribName))
{
_MessageTemplates.__loadAssociation (elements);
return;
}
super.__loadMultiAssoc(attribName, elements);
}
......@@ -6672,6 +6776,14 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{
return _DiversityQuestions.isLoaded ();
}
if (MULTIPLEREFERENCE_WorkFlowTemplates.equals(attribName))
{
return _WorkFlowTemplates.isLoaded ();
}
if (MULTIPLEREFERENCE_MessageTemplates.equals(attribName))
{
return _MessageTemplates.isLoaded ();
}
return super.__isMultiAssocLoaded(attribName);
}
......@@ -6953,6 +7065,144 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
return _DiversityQuestions.getSet ();
}
public FieldWriteability getWriteability_WorkFlowTemplates ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
public int getWorkFlowTemplatesCount () throws StorageException
{
assertValid();
return _WorkFlowTemplates.getReferencedObjectsCount ();
}
public void addToWorkFlowTemplates (WorkFlowTemplate newElement) throws StorageException
{
if (_WorkFlowTemplates.wouldAddChange (newElement))
{
assertValid();
Debug.assertion (AttributeDecoratorUtils.getWriteability (MULTIPLEREFERENCE_WorkFlowTemplates_Decorators, (HiringTeam)this, MULTIPLEREFERENCE_WorkFlowTemplates ,getWriteability_WorkFlowTemplates ()) != FieldWriteability.FALSE, "MultiAssoc WorkFlowTemplates is not writeable (add)");
_WorkFlowTemplates.appendElement (newElement);
try
{
if (newElement.getHiringTeam () != this)
{
newElement.setHiringTeam ((HiringTeam)(this));
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
}
}
public void removeFromWorkFlowTemplates (WorkFlowTemplate elementToRemove) throws StorageException
{
if (_WorkFlowTemplates.wouldRemoveChange (elementToRemove))
{
assertValid();
Debug.assertion (AttributeDecoratorUtils.getWriteability (MULTIPLEREFERENCE_WorkFlowTemplates_Decorators, (HiringTeam)this, MULTIPLEREFERENCE_WorkFlowTemplates ,getWriteability_WorkFlowTemplates ()) != FieldWriteability.FALSE, "MultiAssoc WorkFlowTemplates is not writeable (remove)");
_WorkFlowTemplates.removeElement (elementToRemove);
try
{
if (elementToRemove.getHiringTeam () != null)
{
elementToRemove.setHiringTeam (null);
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
}
}
public WorkFlowTemplate getWorkFlowTemplatesAt (int index) throws StorageException
{
return (WorkFlowTemplate)(_WorkFlowTemplates.getElementAt (index));
}
public SortedSet<WorkFlowTemplate> getWorkFlowTemplatesSet () throws StorageException
{
return _WorkFlowTemplates.getSet ();
}
public FieldWriteability getWriteability_MessageTemplates ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
public int getMessageTemplatesCount () throws StorageException
{
assertValid();
return _MessageTemplates.getReferencedObjectsCount ();
}
public void addToMessageTemplates (MessageTemplate newElement) throws StorageException
{
if (_MessageTemplates.wouldAddChange (newElement))
{
assertValid();
Debug.assertion (AttributeDecoratorUtils.getWriteability (MULTIPLEREFERENCE_MessageTemplates_Decorators, (HiringTeam)this, MULTIPLEREFERENCE_MessageTemplates ,getWriteability_MessageTemplates ()) != FieldWriteability.FALSE, "MultiAssoc MessageTemplates is not writeable (add)");
_MessageTemplates.appendElement (newElement);
try
{
if (newElement.getHiringTeam () != this)
{
newElement.setHiringTeam ((HiringTeam)(this));
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
}
}
public void removeFromMessageTemplates (MessageTemplate elementToRemove) throws StorageException
{
if (_MessageTemplates.wouldRemoveChange (elementToRemove))
{
assertValid();
Debug.assertion (AttributeDecoratorUtils.getWriteability (MULTIPLEREFERENCE_MessageTemplates_Decorators, (HiringTeam)this, MULTIPLEREFERENCE_MessageTemplates ,getWriteability_MessageTemplates ()) != FieldWriteability.FALSE, "MultiAssoc MessageTemplates is not writeable (remove)");
_MessageTemplates.removeElement (elementToRemove);
try
{
if (elementToRemove.getHiringTeam () != null)
{
elementToRemove.setHiringTeam (null);
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
}
}
public MessageTemplate getMessageTemplatesAt (int index) throws StorageException
{
return (MessageTemplate)(_MessageTemplates.getElementAt (index));
}
public SortedSet<MessageTemplate> getMessageTemplatesSet () throws StorageException
{
return _MessageTemplates.getSet ();
}
public void onDelete ()
......@@ -7011,6 +7261,18 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
referenced.setHiringTeam(null);
}
for(WorkFlowTemplate referenced : CollectionUtils.reverse(getWorkFlowTemplatesSet()))
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null HiringTeam from ", getObjectID (), " to ", referenced.getObjectID ());
referenced.setHiringTeam(null);
}
for(MessageTemplate referenced : CollectionUtils.reverse(getMessageTemplatesSet()))
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null HiringTeam from ", getObjectID (), " to ", referenced.getObjectID ());
referenced.setHiringTeam(null);
}
}
catch (Exception e)
{
......@@ -7576,6 +7838,8 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
_Clients.copyFrom (sourceHiringTeam._Clients, linkToGhosts);
_BillingTeams.copyFrom (sourceHiringTeam._BillingTeams, linkToGhosts);
_DiversityQuestions.copyFrom (sourceHiringTeam._DiversityQuestions, linkToGhosts);
_WorkFlowTemplates.copyFrom (sourceHiringTeam._WorkFlowTemplates, linkToGhosts);
_MessageTemplates.copyFrom (sourceHiringTeam._MessageTemplates, linkToGhosts);
}
}
......@@ -7652,6 +7916,8 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
_Clients.readExternalData(vals.get(MULTIPLEREFERENCE_Clients));
_BillingTeams.readExternalData(vals.get(MULTIPLEREFERENCE_BillingTeams));
_DiversityQuestions.readExternalData(vals.get(MULTIPLEREFERENCE_DiversityQuestions));
_WorkFlowTemplates.readExternalData(vals.get(MULTIPLEREFERENCE_WorkFlowTemplates));
_MessageTemplates.readExternalData(vals.get(MULTIPLEREFERENCE_MessageTemplates));
}
......@@ -7715,6 +7981,8 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
vals.put (MULTIPLEREFERENCE_Clients, _Clients.writeExternalData());
vals.put (MULTIPLEREFERENCE_BillingTeams, _BillingTeams.writeExternalData());
vals.put (MULTIPLEREFERENCE_DiversityQuestions, _DiversityQuestions.writeExternalData());
vals.put (MULTIPLEREFERENCE_WorkFlowTemplates, _WorkFlowTemplates.writeExternalData());
vals.put (MULTIPLEREFERENCE_MessageTemplates, _MessageTemplates.writeExternalData());
}
......@@ -7878,6 +8146,8 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
_Clients.compare (otherHiringTeam._Clients, listener);
_BillingTeams.compare (otherHiringTeam._BillingTeams, listener);
_DiversityQuestions.compare (otherHiringTeam._DiversityQuestions, listener);
_WorkFlowTemplates.compare (otherHiringTeam._WorkFlowTemplates, listener);
_MessageTemplates.compare (otherHiringTeam._MessageTemplates, listener);
}
}
......@@ -7947,6 +8217,8 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
visitor.visitAssociation (_Clients);
visitor.visitAssociation (_BillingTeams);
visitor.visitAssociation (_DiversityQuestions);
visitor.visitAssociation (_WorkFlowTemplates);
visitor.visitAssociation (_MessageTemplates);
}
......@@ -7991,6 +8263,14 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{
visitor.visit (_DiversityQuestions);
}
if (scope.includes (_WorkFlowTemplates))
{
visitor.visit (_WorkFlowTemplates);
}
if (scope.includes (_MessageTemplates))
{
visitor.visit (_MessageTemplates);
}
}
......@@ -9760,6 +10040,14 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{
return getWriteability_DiversityQuestions ();
}
else if (fieldName.equals (MULTIPLEREFERENCE_WorkFlowTemplates))
{
return getWriteability_WorkFlowTemplates ();
}
else if (fieldName.equals (MULTIPLEREFERENCE_MessageTemplates))
{
return getWriteability_MessageTemplates ();
}
else if (fieldName.equals (SINGLEREFERENCE_Company))
{
return getWriteability_Company ();
......@@ -11026,6 +11314,14 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{
return toDiversityQuestions ();
}
if (name.equals ("WorkFlowTemplates"))
{
return toWorkFlowTemplates ();
}
if (name.equals ("MessageTemplates"))
{
return toMessageTemplates ();
}
if (name.equals ("ExistingCustomer"))
{
return toExistingCustomer ();
......@@ -11399,6 +11695,20 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{
return HTDiversityQuestion.REFERENCE_HTDiversityQuestion.new HTDiversityQuestionPipeLineFactory<From, HTDiversityQuestion> (this, new ORMMultiAssocPipe<Me, HTDiversityQuestion>(MULTIPLEREFERENCE_DiversityQuestions, filter));
}
public WorkFlowTemplate.WorkFlowTemplatePipeLineFactory<From, WorkFlowTemplate> toWorkFlowTemplates () { return toWorkFlowTemplates(Filter.ALL); }
public WorkFlowTemplate.WorkFlowTemplatePipeLineFactory<From, WorkFlowTemplate> toWorkFlowTemplates (Filter<WorkFlowTemplate> filter)
{
return WorkFlowTemplate.REFERENCE_WorkFlowTemplate.new WorkFlowTemplatePipeLineFactory<From, WorkFlowTemplate> (this, new ORMMultiAssocPipe<Me, WorkFlowTemplate>(MULTIPLEREFERENCE_WorkFlowTemplates, filter));
}
public MessageTemplate.MessageTemplatePipeLineFactory<From, MessageTemplate> toMessageTemplates () { return toMessageTemplates(Filter.ALL); }
public MessageTemplate.MessageTemplatePipeLineFactory<From, MessageTemplate> toMessageTemplates (Filter<MessageTemplate> filter)
{
return MessageTemplate.REFERENCE_MessageTemplate.new MessageTemplatePipeLineFactory<From, MessageTemplate> (this, new ORMMultiAssocPipe<Me, MessageTemplate>(MULTIPLEREFERENCE_MessageTemplates, filter));
}
}
public boolean isTransientAttrib(String attribName)
......@@ -11612,6 +11922,40 @@ class DummyHiringTeam extends HiringTeam
return new TreeSet();
}
public int getWorkFlowTemplatesCount () throws StorageException
{
return 0;
}
public WorkFlowTemplate getWorkFlowTemplatesAt (int index) throws StorageException
{
throw new RuntimeException ("No elements in a dummy object in association WorkFlowTemplates");
}
public SortedSet getWorkFlowTemplatesSet () throws StorageException
{
return new TreeSet();
}
public int getMessageTemplatesCount () throws StorageException
{
return 0;
}
public MessageTemplate getMessageTemplatesAt (int index) throws StorageException
{
throw new RuntimeException ("No elements in a dummy object in association MessageTemplates");
}
public SortedSet getMessageTemplatesSet () throws StorageException
{
return new TreeSet();
}
}
......@@ -92,6 +92,8 @@ public abstract class BaseJob extends BaseBusinessClass
public static final String SINGLEREFERENCE_ShortenedURL = "ShortenedURL";
public static final String SINGLEREFERENCE_AssessmentTemplate = "AssessmentTemplate";
public static final String SINGLEREFERENCE_ILOJobTitle = "ILOJobTitle";
public static final String SINGLEREFERENCE_WorkFlowTemplate = "WorkFlowTemplate";
public static final String BACKREF_WorkFlowTemplate = "";
public static final String MULTIPLEREFERENCE_JobApplications = "JobApplications";
public static final String BACKREF_JobApplications = "";
public static final String MULTIPLEREFERENCE_AssessmentCriterias = "AssessmentCriterias";
......@@ -211,6 +213,7 @@ public abstract class BaseJob extends BaseBusinessClass
private SingleAssociation<Job, ShortenedURL> _ShortenedURL;
private SingleAssociation<Job, AssessmentCriteriaTemplate> _AssessmentTemplate;
private SingleAssociation<Job, ILOJobTitle> _ILOJobTitle;
private SingleAssociation<Job, WorkFlowTemplate> _WorkFlowTemplate;
// Private attributes corresponding to multiple references
......@@ -326,6 +329,7 @@ public abstract class BaseJob extends BaseBusinessClass
private static final SingleAssocDecorator<Job, ShortenedURL>[] SINGLEREFERENCE_ShortenedURL_Decorators;
private static final SingleAssocDecorator<Job, AssessmentCriteriaTemplate>[] SINGLEREFERENCE_AssessmentTemplate_Decorators;
private static final SingleAssocDecorator<Job, ILOJobTitle>[] SINGLEREFERENCE_ILOJobTitle_Decorators;
private static final SingleAssocDecorator<Job, WorkFlowTemplate>[] SINGLEREFERENCE_WorkFlowTemplate_Decorators;
// Arrays of MultiAssocDecorators for each attribute
......@@ -348,6 +352,7 @@ public abstract class BaseJob extends BaseBusinessClass
String tmp_CultureCriterias = CultureCriteria.BACKREF_Job;
String tmp_WorkFlows = WorkFlow.BACKREF_Job;
String tmp_Client = Client.BACKREF_Jobs;
String tmp_WorkFlowTemplate = WorkFlowTemplate.BACKREF_Jobs;
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
......@@ -367,6 +372,7 @@ public abstract class BaseJob extends BaseBusinessClass
setupAssocMetaData_ShortenedURL();
setupAssocMetaData_AssessmentTemplate();
setupAssocMetaData_ILOJobTitle();
setupAssocMetaData_WorkFlowTemplate();
FIELD_Email_Validators = (AttributeValidator[])setupAttribMetaData_Email(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_Password_Validators = (AttributeValidator[])setupAttribMetaData_Password(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_ConfirmPassword_Validators = (AttributeValidator[])setupAttribMetaData_ConfirmPassword(validatorMapping).toArray (new AttributeValidator[0]);
......@@ -463,6 +469,7 @@ public abstract class BaseJob extends BaseBusinessClass
SINGLEREFERENCE_ShortenedURL_Decorators = (SingleAssocDecorator[])AttributeDecoratorUtils.getSingleAssocDecorators(REFERENCE_Job, SINGLEREFERENCE_ShortenedURL).toArray (new SingleAssocDecorator[0]);
SINGLEREFERENCE_AssessmentTemplate_Decorators = (SingleAssocDecorator[])AttributeDecoratorUtils.getSingleAssocDecorators(REFERENCE_Job, SINGLEREFERENCE_AssessmentTemplate).toArray (new SingleAssocDecorator[0]);
SINGLEREFERENCE_ILOJobTitle_Decorators = (SingleAssocDecorator[])AttributeDecoratorUtils.getSingleAssocDecorators(REFERENCE_Job, SINGLEREFERENCE_ILOJobTitle).toArray (new SingleAssocDecorator[0]);
SINGLEREFERENCE_WorkFlowTemplate_Decorators = (SingleAssocDecorator[])AttributeDecoratorUtils.getSingleAssocDecorators(REFERENCE_Job, SINGLEREFERENCE_WorkFlowTemplate).toArray (new SingleAssocDecorator[0]);
MULTIPLEREFERENCE_JobApplications_Decorators = (MultiAssocDecorator[])AttributeDecoratorUtils.getMultiAssocDecorators(REFERENCE_Job, MULTIPLEREFERENCE_JobApplications).toArray (new MultiAssocDecorator[0]);
MULTIPLEREFERENCE_AssessmentCriterias_Decorators = (MultiAssocDecorator[])AttributeDecoratorUtils.getMultiAssocDecorators(REFERENCE_Job, MULTIPLEREFERENCE_AssessmentCriterias).toArray (new MultiAssocDecorator[0]);
MULTIPLEREFERENCE_CultureCriterias_Decorators = (MultiAssocDecorator[])AttributeDecoratorUtils.getMultiAssocDecorators(REFERENCE_Job, MULTIPLEREFERENCE_CultureCriterias).toArray (new MultiAssocDecorator[0]);
......@@ -690,6 +697,21 @@ public abstract class BaseJob extends BaseBusinessClass
}
private static void setupAssocMetaData_WorkFlowTemplate()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "Jobs");
metaInfo.put ("dbcol", "work_flow_template_id");
metaInfo.put ("mandatory", "false");
metaInfo.put ("name", "WorkFlowTemplate");
metaInfo.put ("type", "WorkFlowTemplate");
metaInfo.put (METADATA_DB_TABLENAME, "tl_job");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Job.WorkFlowTemplate:", metaInfo);
ATTRIBUTES_METADATA_Job.put (SINGLEREFERENCE_WorkFlowTemplate, Collections.unmodifiableMap (metaInfo));
}
private static List setupAttribMetaData_Email(Map validatorMapping)
{
Map metaInfo = new HashMap ();
......@@ -1520,6 +1542,7 @@ public abstract class BaseJob extends BaseBusinessClass
_ShortenedURL = new SingleAssociation<Job, ShortenedURL> (this, SINGLEREFERENCE_ShortenedURL, null, ShortenedURL.REFERENCE_ShortenedURL, "tl_job");
_AssessmentTemplate = new SingleAssociation<Job, AssessmentCriteriaTemplate> (this, SINGLEREFERENCE_AssessmentTemplate, null, AssessmentCriteriaTemplate.REFERENCE_AssessmentCriteriaTemplate, "tl_job");
_ILOJobTitle = new SingleAssociation<Job, ILOJobTitle> (this, SINGLEREFERENCE_ILOJobTitle, null, ILOJobTitle.REFERENCE_ILOJobTitle, "tl_job");
_WorkFlowTemplate = new SingleAssociation<Job, WorkFlowTemplate> (this, SINGLEREFERENCE_WorkFlowTemplate, WorkFlowTemplate.MULTIPLEREFERENCE_Jobs, WorkFlowTemplate.REFERENCE_WorkFlowTemplate, "tl_job");
_JobApplications = new MultipleAssociation<Job, JobApplication> (this, MULTIPLEREFERENCE_JobApplications, JobApplication.SINGLEREFERENCE_Job, JobApplication.REFERENCE_JobApplication);_AssessmentCriterias = new MultipleAssociation<Job, AssessmentCriteria> (this, MULTIPLEREFERENCE_AssessmentCriterias, AssessmentCriteria.SINGLEREFERENCE_Job, AssessmentCriteria.REFERENCE_AssessmentCriteria);_CultureCriterias = new MultipleAssociation<Job, CultureCriteria> (this, MULTIPLEREFERENCE_CultureCriterias, CultureCriteria.SINGLEREFERENCE_Job, CultureCriteria.REFERENCE_CultureCriteria);_WorkFlows = new MultipleAssociation<Job, WorkFlow> (this, MULTIPLEREFERENCE_WorkFlows, WorkFlow.SINGLEREFERENCE_Job, WorkFlow.REFERENCE_WorkFlow);
}
......@@ -1540,6 +1563,7 @@ public abstract class BaseJob extends BaseBusinessClass
_ShortenedURL = new SingleAssociation<Job, ShortenedURL> (this, SINGLEREFERENCE_ShortenedURL, null, ShortenedURL.REFERENCE_ShortenedURL, "tl_job");
_AssessmentTemplate = new SingleAssociation<Job, AssessmentCriteriaTemplate> (this, SINGLEREFERENCE_AssessmentTemplate, null, AssessmentCriteriaTemplate.REFERENCE_AssessmentCriteriaTemplate, "tl_job");
_ILOJobTitle = new SingleAssociation<Job, ILOJobTitle> (this, SINGLEREFERENCE_ILOJobTitle, null, ILOJobTitle.REFERENCE_ILOJobTitle, "tl_job");
_WorkFlowTemplate = new SingleAssociation<Job, WorkFlowTemplate> (this, SINGLEREFERENCE_WorkFlowTemplate, WorkFlowTemplate.MULTIPLEREFERENCE_Jobs, WorkFlowTemplate.REFERENCE_WorkFlowTemplate, "tl_job");
_JobApplications = new MultipleAssociation<Job, JobApplication> (this, MULTIPLEREFERENCE_JobApplications, JobApplication.SINGLEREFERENCE_Job, JobApplication.REFERENCE_JobApplication);_AssessmentCriterias = new MultipleAssociation<Job, AssessmentCriteria> (this, MULTIPLEREFERENCE_AssessmentCriterias, AssessmentCriteria.SINGLEREFERENCE_Job, AssessmentCriteria.REFERENCE_AssessmentCriteria);_CultureCriterias = new MultipleAssociation<Job, CultureCriteria> (this, MULTIPLEREFERENCE_CultureCriterias, CultureCriteria.SINGLEREFERENCE_Job, CultureCriteria.REFERENCE_CultureCriteria);_WorkFlows = new MultipleAssociation<Job, WorkFlow> (this, MULTIPLEREFERENCE_WorkFlows, WorkFlow.SINGLEREFERENCE_Job, WorkFlow.REFERENCE_WorkFlow);
return this;
......@@ -5777,6 +5801,7 @@ public abstract class BaseJob extends BaseBusinessClass
result.add("ShortenedURL");
result.add("AssessmentTemplate");
result.add("ILOJobTitle");
result.add("WorkFlowTemplate");
return result;
}
......@@ -5836,6 +5861,10 @@ public abstract class BaseJob extends BaseBusinessClass
{
return _ILOJobTitle.getReferencedType ();
}
else if (assocName.equals (SINGLEREFERENCE_WorkFlowTemplate))
{
return _WorkFlowTemplate.getReferencedType ();
}
else
{
return super.getSingleAssocReferenceInstance (assocName);
......@@ -5885,6 +5914,10 @@ public abstract class BaseJob extends BaseBusinessClass
{
return null ;
}
else if (assocName.equals (SINGLEREFERENCE_WorkFlowTemplate))
{
return WorkFlowTemplate.MULTIPLEREFERENCE_Jobs ;
}
else
{
return super.getSingleAssocBackReference (assocName);
......@@ -5946,6 +5979,10 @@ public abstract class BaseJob extends BaseBusinessClass
{
return getILOJobTitle ();
}
else if (assocName.equals (SINGLEREFERENCE_WorkFlowTemplate))
{
return getWorkFlowTemplate ();
}
else
{
return super.getSingleAssoc (assocName);
......@@ -6007,6 +6044,10 @@ public abstract class BaseJob extends BaseBusinessClass
{
return getILOJobTitle (getType);
}
else if (assocName.equals (SINGLEREFERENCE_WorkFlowTemplate))
{
return getWorkFlowTemplate (getType);
}
else
{
return super.getSingleAssoc (assocName, getType);
......@@ -6068,6 +6109,10 @@ public abstract class BaseJob extends BaseBusinessClass
{
return getILOJobTitleID ();
}
else if (assocName.equals (SINGLEREFERENCE_WorkFlowTemplate))
{
return getWorkFlowTemplateID ();
}
else
{
return super.getSingleAssocID (assocName);
......@@ -6129,6 +6174,10 @@ public abstract class BaseJob extends BaseBusinessClass
{
setILOJobTitle ((ILOJobTitle)(newValue));
}
else if (assocName.equals (SINGLEREFERENCE_WorkFlowTemplate))
{
setWorkFlowTemplate ((WorkFlowTemplate)(newValue));
}
else
{
super.setSingleAssoc (assocName, newValue);
......@@ -7247,6 +7296,110 @@ public abstract class BaseJob extends BaseBusinessClass
}
/**
* Get the reference WorkFlowTemplate
*/
public WorkFlowTemplate getWorkFlowTemplate () throws StorageException
{
assertValid();
try
{
return (WorkFlowTemplate)(_WorkFlowTemplate.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in Job:", this.getObjectID (), ", was trying to get WorkFlowTemplate:", getWorkFlowTemplateID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _WorkFlowTemplate.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public WorkFlowTemplate getWorkFlowTemplate (Get getType) throws StorageException
{
assertValid();
return _WorkFlowTemplate.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getWorkFlowTemplateID ()
{
assertValid();
if (_WorkFlowTemplate == null)
{
return null;
}
else
{
return _WorkFlowTemplate.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 preWorkFlowTemplateChange (WorkFlowTemplate newWorkFlowTemplate) 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 postWorkFlowTemplateChange () throws FieldException
{
}
public FieldWriteability getWriteability_WorkFlowTemplate ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference WorkFlowTemplate. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setWorkFlowTemplate (WorkFlowTemplate newWorkFlowTemplate) throws StorageException, FieldException
{
if (_WorkFlowTemplate.wouldReferencedChange (newWorkFlowTemplate))
{
assertValid();
Debug.assertion (AttributeDecoratorUtils.getWriteability (SINGLEREFERENCE_WorkFlowTemplate_Decorators, (Job)this, SINGLEREFERENCE_WorkFlowTemplate ,getWriteability_WorkFlowTemplate ()) != FieldWriteability.FALSE, "Assoc WorkFlowTemplate is not writeable");
preWorkFlowTemplateChange (newWorkFlowTemplate);
WorkFlowTemplate oldWorkFlowTemplate = getWorkFlowTemplate ();
if (oldWorkFlowTemplate != null)
{
// This is to stop validation from triggering when we are removed
_WorkFlowTemplate.set (null);
oldWorkFlowTemplate.removeFromJobs ((Job)(this));
}
_WorkFlowTemplate.set (newWorkFlowTemplate);
if (newWorkFlowTemplate != null)
{
newWorkFlowTemplate.addToJobs ((Job)(this));
}
postWorkFlowTemplateChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getMultiAssocs()
......@@ -7768,6 +7921,20 @@ public abstract class BaseJob extends BaseBusinessClass
}
}
// Ensure we are removed from any loaded multi-associations that aren't mandatory
if (_WorkFlowTemplate.isLoaded () || getTransaction ().isObjectLoaded (_WorkFlowTemplate.getReferencedType (), getWorkFlowTemplateID ()))
{
WorkFlowTemplate referenced = getWorkFlowTemplate ();
if (referenced != null)
{
// Stop the callback
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null Jobs from ", getObjectID (), " to ", referenced.getObjectID ());
_WorkFlowTemplate.set (null);
referenced.removeFromJobs ((Job)this);
}
}
for(JobApplication referenced : CollectionUtils.reverse(getJobApplicationsSet()))
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null Job from ", getObjectID (), " to ", referenced.getObjectID ());
......@@ -7885,6 +8052,7 @@ public abstract class BaseJob extends BaseBusinessClass
_ShortenedURL.getPersistentSets (allSets);
_AssessmentTemplate.getPersistentSets (allSets);
_ILOJobTitle.getPersistentSets (allSets);
_WorkFlowTemplate.getPersistentSets (allSets);
}
......@@ -7934,6 +8102,7 @@ public abstract class BaseJob extends BaseBusinessClass
_ShortenedURL.setFromPersistentSets (objectID, allSets);
_AssessmentTemplate.setFromPersistentSets (objectID, allSets);
_ILOJobTitle.setFromPersistentSets (objectID, allSets);
_WorkFlowTemplate.setFromPersistentSets (objectID, allSets);
}
......@@ -8274,6 +8443,7 @@ public abstract class BaseJob extends BaseBusinessClass
_ShortenedURL.copyFrom (sourceJob._ShortenedURL, linkToGhosts);
_AssessmentTemplate.copyFrom (sourceJob._AssessmentTemplate, linkToGhosts);
_ILOJobTitle.copyFrom (sourceJob._ILOJobTitle, linkToGhosts);
_WorkFlowTemplate.copyFrom (sourceJob._WorkFlowTemplate, linkToGhosts);
}
}
......@@ -8372,6 +8542,7 @@ public abstract class BaseJob extends BaseBusinessClass
_ShortenedURL.readExternalData(vals.get(SINGLEREFERENCE_ShortenedURL));
_AssessmentTemplate.readExternalData(vals.get(SINGLEREFERENCE_AssessmentTemplate));
_ILOJobTitle.readExternalData(vals.get(SINGLEREFERENCE_ILOJobTitle));
_WorkFlowTemplate.readExternalData(vals.get(SINGLEREFERENCE_WorkFlowTemplate));
_JobApplications.readExternalData(vals.get(MULTIPLEREFERENCE_JobApplications));
_AssessmentCriterias.readExternalData(vals.get(MULTIPLEREFERENCE_AssessmentCriterias));
_CultureCriterias.readExternalData(vals.get(MULTIPLEREFERENCE_CultureCriterias));
......@@ -8441,6 +8612,7 @@ public abstract class BaseJob extends BaseBusinessClass
vals.put (SINGLEREFERENCE_ShortenedURL, _ShortenedURL.writeExternalData());
vals.put (SINGLEREFERENCE_AssessmentTemplate, _AssessmentTemplate.writeExternalData());
vals.put (SINGLEREFERENCE_ILOJobTitle, _ILOJobTitle.writeExternalData());
vals.put (SINGLEREFERENCE_WorkFlowTemplate, _WorkFlowTemplate.writeExternalData());
vals.put (MULTIPLEREFERENCE_JobApplications, _JobApplications.writeExternalData());
vals.put (MULTIPLEREFERENCE_AssessmentCriterias, _AssessmentCriterias.writeExternalData());
vals.put (MULTIPLEREFERENCE_CultureCriterias, _CultureCriterias.writeExternalData());
......@@ -8580,6 +8752,7 @@ public abstract class BaseJob extends BaseBusinessClass
_ShortenedURL.compare (otherJob._ShortenedURL, listener);
_AssessmentTemplate.compare (otherJob._AssessmentTemplate, listener);
_ILOJobTitle.compare (otherJob._ILOJobTitle, listener);
_WorkFlowTemplate.compare (otherJob._WorkFlowTemplate, listener);
// Compare multiple assocs
......@@ -8658,6 +8831,7 @@ public abstract class BaseJob extends BaseBusinessClass
visitor.visitAssociation (_ShortenedURL);
visitor.visitAssociation (_AssessmentTemplate);
visitor.visitAssociation (_ILOJobTitle);
visitor.visitAssociation (_WorkFlowTemplate);
visitor.visitAssociation (_JobApplications);
visitor.visitAssociation (_AssessmentCriterias);
visitor.visitAssociation (_CultureCriterias);
......@@ -8718,6 +8892,10 @@ public abstract class BaseJob extends BaseBusinessClass
{
visitor.visit (_ILOJobTitle);
}
if (scope.includes (_WorkFlowTemplate))
{
visitor.visit (_WorkFlowTemplate);
}
if (scope.includes (_JobApplications))
{
visitor.visit (_JobApplications);
......@@ -8903,6 +9081,10 @@ public abstract class BaseJob extends BaseBusinessClass
{
return filter.matches (getILOJobTitle ());
}
else if (attribName.equals (SINGLEREFERENCE_WorkFlowTemplate))
{
return filter.matches (getWorkFlowTemplate ());
}
else
{
return super.testFilter (attribName, filter);
......@@ -9149,6 +9331,12 @@ public abstract class BaseJob extends BaseBusinessClass
return this;
}
public SearchAll andWorkFlowTemplate (QueryFilter<WorkFlowTemplate> filter)
{
filter.addFilter (context, "tl_job.work_flow_template_id", "WorkFlowTemplate");
return this;
}
public Job[] search (ObjectTransaction transaction) throws StorageException
{
......@@ -9424,6 +9612,12 @@ public abstract class BaseJob extends BaseBusinessClass
return this;
}
public SearchJobKey andWorkFlowTemplate (QueryFilter<WorkFlowTemplate> filter)
{
filter.addFilter (context, "tl_job.work_flow_template_id", "WorkFlowTemplate");
return this;
}
public Job search (ObjectTransaction transaction) throws StorageException
{
......@@ -9693,6 +9887,12 @@ public abstract class BaseJob extends BaseBusinessClass
return this;
}
public SearchCompany andWorkFlowTemplate (QueryFilter<WorkFlowTemplate> filter)
{
filter.addFilter (context, "tl_job.work_flow_template_id", "WorkFlowTemplate");
return this;
}
public Job[] search (ObjectTransaction transaction) throws StorageException
{
......@@ -9962,6 +10162,12 @@ public abstract class BaseJob extends BaseBusinessClass
return this;
}
public SearchDetails andWorkFlowTemplate (QueryFilter<WorkFlowTemplate> filter)
{
filter.addFilter (context, "tl_job.work_flow_template_id", "WorkFlowTemplate");
return this;
}
public Job[] search (ObjectTransaction transaction) throws StorageException
{
......@@ -10714,6 +10920,10 @@ public abstract class BaseJob extends BaseBusinessClass
{
return getWriteability_ILOJobTitle ();
}
else if (fieldName.equals (SINGLEREFERENCE_WorkFlowTemplate))
{
return getWriteability_WorkFlowTemplate ();
}
else if (fieldName.equals (FIELD_Email))
{
return getWriteability_Email ();
......@@ -12170,6 +12380,10 @@ public abstract class BaseJob extends BaseBusinessClass
{
return toILOJobTitle ();
}
if (name.equals ("WorkFlowTemplate"))
{
return toWorkFlowTemplate ();
}
return super.to(name);
......@@ -12374,6 +12588,13 @@ public abstract class BaseJob extends BaseBusinessClass
return ILOJobTitle.REFERENCE_ILOJobTitle.new ILOJobTitlePipeLineFactory<From, ILOJobTitle> (this, new ORMSingleAssocPipe<Me, ILOJobTitle>(SINGLEREFERENCE_ILOJobTitle, filter));
}
public WorkFlowTemplate.WorkFlowTemplatePipeLineFactory<From, WorkFlowTemplate> toWorkFlowTemplate () { return toWorkFlowTemplate (Filter.ALL); }
public WorkFlowTemplate.WorkFlowTemplatePipeLineFactory<From, WorkFlowTemplate> toWorkFlowTemplate (Filter<WorkFlowTemplate> filter)
{
return WorkFlowTemplate.REFERENCE_WorkFlowTemplate.new WorkFlowTemplatePipeLineFactory<From, WorkFlowTemplate> (this, new ORMSingleAssocPipe<Me, WorkFlowTemplate>(SINGLEREFERENCE_WorkFlowTemplate, filter));
}
public JobApplication.JobApplicationPipeLineFactory<From, JobApplication> toJobApplications () { return toJobApplications(Filter.ALL); }
public JobApplication.JobApplicationPipeLineFactory<From, JobApplication> toJobApplications (Filter<JobApplication> filter)
......@@ -12689,6 +12910,20 @@ class DummyJob extends Job
return ILOJobTitle.DUMMY_ILOJobTitle.getObjectID();
}
public WorkFlowTemplate getWorkFlowTemplate () throws StorageException
{
return (WorkFlowTemplate)(WorkFlowTemplate.DUMMY_WorkFlowTemplate);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getWorkFlowTemplateID ()
{
return WorkFlowTemplate.DUMMY_WorkFlowTemplate.getObjectID();
}
public int getJobApplicationsCount () throws StorageException
{
return 0;
......
......@@ -56,6 +56,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass
public static final String BACKREF_Candidate = "";
public static final String SINGLEREFERENCE_Job = "Job";
public static final String BACKREF_Job = "";
public static final String SINGLEREFERENCE_WorkFlowStage = "WorkFlowStage";
public static final String MULTIPLEREFERENCE_AssessmentCriteriaAnswers = "AssessmentCriteriaAnswers";
public static final String BACKREF_AssessmentCriteriaAnswers = "";
public static final String MULTIPLEREFERENCE_Notes = "Notes";
......@@ -64,6 +65,8 @@ public abstract class BaseJobApplication extends BaseBusinessClass
public static final String BACKREF_ScheduledEmails = "";
public static final String MULTIPLEREFERENCE_SentEmails = "SentEmails";
public static final String BACKREF_SentEmails = "";
public static final String MULTIPLEREFERENCE_Messages = "Messages";
public static final String BACKREF_Messages = "";
// Static constants corresponding to searches
public static final String SEARCH_All = "All";
......@@ -111,6 +114,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass
private SingleAssociation<JobApplication, WorkFlow> _WorkFlow;
private SingleAssociation<JobApplication, Candidate> _Candidate;
private SingleAssociation<JobApplication, Job> _Job;
private SingleAssociation<JobApplication, WorkFlowStage> _WorkFlowStage;
// Private attributes corresponding to multiple references
......@@ -118,6 +122,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass
private MultipleAssociation<JobApplication, Note> _Notes;
private MultipleAssociation<JobApplication, ScheduledEmail> _ScheduledEmails;
private MultipleAssociation<JobApplication, SentEmail> _SentEmails;
private MultipleAssociation<JobApplication, Message> _Messages;
// Map of maps of metadata
......@@ -163,6 +168,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass
private static final SingleAssocDecorator<JobApplication, WorkFlow>[] SINGLEREFERENCE_WorkFlow_Decorators;
private static final SingleAssocDecorator<JobApplication, Candidate>[] SINGLEREFERENCE_Candidate_Decorators;
private static final SingleAssocDecorator<JobApplication, Job>[] SINGLEREFERENCE_Job_Decorators;
private static final SingleAssocDecorator<JobApplication, WorkFlowStage>[] SINGLEREFERENCE_WorkFlowStage_Decorators;
// Arrays of MultiAssocDecorators for each attribute
......@@ -170,6 +176,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass
private static final MultiAssocDecorator<JobApplication, Note>[] MULTIPLEREFERENCE_Notes_Decorators;
private static final MultiAssocDecorator<JobApplication, ScheduledEmail>[] MULTIPLEREFERENCE_ScheduledEmails_Decorators;
private static final MultiAssocDecorator<JobApplication, SentEmail>[] MULTIPLEREFERENCE_SentEmails_Decorators;
private static final MultiAssocDecorator<JobApplication, Message>[] MULTIPLEREFERENCE_Messages_Decorators;
// Arrays of behaviour decorators
......@@ -184,6 +191,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass
String tmp_Notes = Note.BACKREF_JobApplication;
String tmp_ScheduledEmails = ScheduledEmail.BACKREF_JobApplication;
String tmp_SentEmails = SentEmail.BACKREF_JobApplication;
String tmp_Messages = Message.BACKREF_JobApplication;
String tmp_Candidate = Candidate.BACKREF_JobApplications;
String tmp_Job = Job.BACKREF_JobApplications;
......@@ -193,9 +201,11 @@ public abstract class BaseJobApplication extends BaseBusinessClass
setupAssocMetaData_Notes();
setupAssocMetaData_ScheduledEmails();
setupAssocMetaData_SentEmails();
setupAssocMetaData_Messages();
setupAssocMetaData_WorkFlow();
setupAssocMetaData_Candidate();
setupAssocMetaData_Job();
setupAssocMetaData_WorkFlowStage();
FIELD_AppProcessOption_Validators = (AttributeValidator[])setupAttribMetaData_AppProcessOption(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_OverallRank_Validators = (AttributeValidator[])setupAttribMetaData_OverallRank(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_RoleFit_Validators = (AttributeValidator[])setupAttribMetaData_RoleFit(validatorMapping).toArray (new AttributeValidator[0]);
......@@ -229,10 +239,12 @@ public abstract class BaseJobApplication extends BaseBusinessClass
SINGLEREFERENCE_WorkFlow_Decorators = (SingleAssocDecorator[])AttributeDecoratorUtils.getSingleAssocDecorators(REFERENCE_JobApplication, SINGLEREFERENCE_WorkFlow).toArray (new SingleAssocDecorator[0]);
SINGLEREFERENCE_Candidate_Decorators = (SingleAssocDecorator[])AttributeDecoratorUtils.getSingleAssocDecorators(REFERENCE_JobApplication, SINGLEREFERENCE_Candidate).toArray (new SingleAssocDecorator[0]);
SINGLEREFERENCE_Job_Decorators = (SingleAssocDecorator[])AttributeDecoratorUtils.getSingleAssocDecorators(REFERENCE_JobApplication, SINGLEREFERENCE_Job).toArray (new SingleAssocDecorator[0]);
SINGLEREFERENCE_WorkFlowStage_Decorators = (SingleAssocDecorator[])AttributeDecoratorUtils.getSingleAssocDecorators(REFERENCE_JobApplication, SINGLEREFERENCE_WorkFlowStage).toArray (new SingleAssocDecorator[0]);
MULTIPLEREFERENCE_AssessmentCriteriaAnswers_Decorators = (MultiAssocDecorator[])AttributeDecoratorUtils.getMultiAssocDecorators(REFERENCE_JobApplication, MULTIPLEREFERENCE_AssessmentCriteriaAnswers).toArray (new MultiAssocDecorator[0]);
MULTIPLEREFERENCE_Notes_Decorators = (MultiAssocDecorator[])AttributeDecoratorUtils.getMultiAssocDecorators(REFERENCE_JobApplication, MULTIPLEREFERENCE_Notes).toArray (new MultiAssocDecorator[0]);
MULTIPLEREFERENCE_ScheduledEmails_Decorators = (MultiAssocDecorator[])AttributeDecoratorUtils.getMultiAssocDecorators(REFERENCE_JobApplication, MULTIPLEREFERENCE_ScheduledEmails).toArray (new MultiAssocDecorator[0]);
MULTIPLEREFERENCE_SentEmails_Decorators = (MultiAssocDecorator[])AttributeDecoratorUtils.getMultiAssocDecorators(REFERENCE_JobApplication, MULTIPLEREFERENCE_SentEmails).toArray (new MultiAssocDecorator[0]);
MULTIPLEREFERENCE_Messages_Decorators = (MultiAssocDecorator[])AttributeDecoratorUtils.getMultiAssocDecorators(REFERENCE_JobApplication, MULTIPLEREFERENCE_Messages).toArray (new MultiAssocDecorator[0]);
REFERENCE_JobApplication.initialiseReference ();
......@@ -299,6 +311,19 @@ public abstract class BaseJobApplication extends BaseBusinessClass
}
private static void setupAssocMetaData_Messages()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "JobApplication");
metaInfo.put ("name", "Messages");
metaInfo.put ("type", "Message");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for JobApplication.Messages:", metaInfo);
ATTRIBUTES_METADATA_JobApplication.put (MULTIPLEREFERENCE_Messages, Collections.unmodifiableMap (metaInfo));
}
private static void setupAssocMetaData_WorkFlow()
{
Map metaInfo = new HashMap ();
......@@ -341,6 +366,20 @@ public abstract class BaseJobApplication extends BaseBusinessClass
}
private static void setupAssocMetaData_WorkFlowStage()
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "work_flow_stage_id");
metaInfo.put ("mandatory", "false");
metaInfo.put ("name", "WorkFlowStage");
metaInfo.put ("type", "WorkFlowStage");
metaInfo.put (METADATA_DB_TABLENAME, "tl_job_application");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for JobApplication.WorkFlowStage:", metaInfo);
ATTRIBUTES_METADATA_JobApplication.put (SINGLEREFERENCE_WorkFlowStage, Collections.unmodifiableMap (metaInfo));
}
private static List setupAttribMetaData_AppProcessOption(Map validatorMapping)
{
Map metaInfo = new HashMap ();
......@@ -660,7 +699,8 @@ public abstract class BaseJobApplication extends BaseBusinessClass
_WorkFlow = new SingleAssociation<JobApplication, WorkFlow> (this, SINGLEREFERENCE_WorkFlow, null, WorkFlow.REFERENCE_WorkFlow, "");
_Candidate = new SingleAssociation<JobApplication, Candidate> (this, SINGLEREFERENCE_Candidate, Candidate.MULTIPLEREFERENCE_JobApplications, Candidate.REFERENCE_Candidate, "tl_job_application");
_Job = new SingleAssociation<JobApplication, Job> (this, SINGLEREFERENCE_Job, Job.MULTIPLEREFERENCE_JobApplications, Job.REFERENCE_Job, "tl_job_application");
_AssessmentCriteriaAnswers = new MultipleAssociation<JobApplication, AssessmentCriteriaAnswer> (this, MULTIPLEREFERENCE_AssessmentCriteriaAnswers, AssessmentCriteriaAnswer.SINGLEREFERENCE_JobApplication, AssessmentCriteriaAnswer.REFERENCE_AssessmentCriteriaAnswer);_Notes = new MultipleAssociation<JobApplication, Note> (this, MULTIPLEREFERENCE_Notes, Note.SINGLEREFERENCE_JobApplication, Note.REFERENCE_Note);_ScheduledEmails = new MultipleAssociation<JobApplication, ScheduledEmail> (this, MULTIPLEREFERENCE_ScheduledEmails, ScheduledEmail.SINGLEREFERENCE_JobApplication, ScheduledEmail.REFERENCE_ScheduledEmail);_SentEmails = new MultipleAssociation<JobApplication, SentEmail> (this, MULTIPLEREFERENCE_SentEmails, SentEmail.SINGLEREFERENCE_JobApplication, SentEmail.REFERENCE_SentEmail);
_WorkFlowStage = new SingleAssociation<JobApplication, WorkFlowStage> (this, SINGLEREFERENCE_WorkFlowStage, null, WorkFlowStage.REFERENCE_WorkFlowStage, "tl_job_application");
_AssessmentCriteriaAnswers = new MultipleAssociation<JobApplication, AssessmentCriteriaAnswer> (this, MULTIPLEREFERENCE_AssessmentCriteriaAnswers, AssessmentCriteriaAnswer.SINGLEREFERENCE_JobApplication, AssessmentCriteriaAnswer.REFERENCE_AssessmentCriteriaAnswer);_Notes = new MultipleAssociation<JobApplication, Note> (this, MULTIPLEREFERENCE_Notes, Note.SINGLEREFERENCE_JobApplication, Note.REFERENCE_Note);_ScheduledEmails = new MultipleAssociation<JobApplication, ScheduledEmail> (this, MULTIPLEREFERENCE_ScheduledEmails, ScheduledEmail.SINGLEREFERENCE_JobApplication, ScheduledEmail.REFERENCE_ScheduledEmail);_SentEmails = new MultipleAssociation<JobApplication, SentEmail> (this, MULTIPLEREFERENCE_SentEmails, SentEmail.SINGLEREFERENCE_JobApplication, SentEmail.REFERENCE_SentEmail);_Messages = new MultipleAssociation<JobApplication, Message> (this, MULTIPLEREFERENCE_Messages, Message.SINGLEREFERENCE_JobApplication, Message.REFERENCE_Message);
}
......@@ -671,7 +711,8 @@ public abstract class BaseJobApplication extends BaseBusinessClass
_WorkFlow = new SingleAssociation<JobApplication, WorkFlow> (this, SINGLEREFERENCE_WorkFlow, null, WorkFlow.REFERENCE_WorkFlow, "");
_Candidate = new SingleAssociation<JobApplication, Candidate> (this, SINGLEREFERENCE_Candidate, Candidate.MULTIPLEREFERENCE_JobApplications, Candidate.REFERENCE_Candidate, "tl_job_application");
_Job = new SingleAssociation<JobApplication, Job> (this, SINGLEREFERENCE_Job, Job.MULTIPLEREFERENCE_JobApplications, Job.REFERENCE_Job, "tl_job_application");
_AssessmentCriteriaAnswers = new MultipleAssociation<JobApplication, AssessmentCriteriaAnswer> (this, MULTIPLEREFERENCE_AssessmentCriteriaAnswers, AssessmentCriteriaAnswer.SINGLEREFERENCE_JobApplication, AssessmentCriteriaAnswer.REFERENCE_AssessmentCriteriaAnswer);_Notes = new MultipleAssociation<JobApplication, Note> (this, MULTIPLEREFERENCE_Notes, Note.SINGLEREFERENCE_JobApplication, Note.REFERENCE_Note);_ScheduledEmails = new MultipleAssociation<JobApplication, ScheduledEmail> (this, MULTIPLEREFERENCE_ScheduledEmails, ScheduledEmail.SINGLEREFERENCE_JobApplication, ScheduledEmail.REFERENCE_ScheduledEmail);_SentEmails = new MultipleAssociation<JobApplication, SentEmail> (this, MULTIPLEREFERENCE_SentEmails, SentEmail.SINGLEREFERENCE_JobApplication, SentEmail.REFERENCE_SentEmail);
_WorkFlowStage = new SingleAssociation<JobApplication, WorkFlowStage> (this, SINGLEREFERENCE_WorkFlowStage, null, WorkFlowStage.REFERENCE_WorkFlowStage, "tl_job_application");
_AssessmentCriteriaAnswers = new MultipleAssociation<JobApplication, AssessmentCriteriaAnswer> (this, MULTIPLEREFERENCE_AssessmentCriteriaAnswers, AssessmentCriteriaAnswer.SINGLEREFERENCE_JobApplication, AssessmentCriteriaAnswer.REFERENCE_AssessmentCriteriaAnswer);_Notes = new MultipleAssociation<JobApplication, Note> (this, MULTIPLEREFERENCE_Notes, Note.SINGLEREFERENCE_JobApplication, Note.REFERENCE_Note);_ScheduledEmails = new MultipleAssociation<JobApplication, ScheduledEmail> (this, MULTIPLEREFERENCE_ScheduledEmails, ScheduledEmail.SINGLEREFERENCE_JobApplication, ScheduledEmail.REFERENCE_ScheduledEmail);_SentEmails = new MultipleAssociation<JobApplication, SentEmail> (this, MULTIPLEREFERENCE_SentEmails, SentEmail.SINGLEREFERENCE_JobApplication, SentEmail.REFERENCE_SentEmail);_Messages = new MultipleAssociation<JobApplication, Message> (this, MULTIPLEREFERENCE_Messages, Message.SINGLEREFERENCE_JobApplication, Message.REFERENCE_Message);
return this;
}
......@@ -2190,6 +2231,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass
result.add("WorkFlow");
result.add("Candidate");
result.add("Job");
result.add("WorkFlowStage");
return result;
}
......@@ -2213,6 +2255,10 @@ public abstract class BaseJobApplication extends BaseBusinessClass
{
return _Job.getReferencedType ();
}
else if (assocName.equals (SINGLEREFERENCE_WorkFlowStage))
{
return _WorkFlowStage.getReferencedType ();
}
else
{
return super.getSingleAssocReferenceInstance (assocName);
......@@ -2234,6 +2280,10 @@ public abstract class BaseJobApplication extends BaseBusinessClass
{
return Job.MULTIPLEREFERENCE_JobApplications ;
}
else if (assocName.equals (SINGLEREFERENCE_WorkFlowStage))
{
return null ;
}
else
{
return super.getSingleAssocBackReference (assocName);
......@@ -2259,6 +2309,10 @@ public abstract class BaseJobApplication extends BaseBusinessClass
{
return getJob ();
}
else if (assocName.equals (SINGLEREFERENCE_WorkFlowStage))
{
return getWorkFlowStage ();
}
else
{
return super.getSingleAssoc (assocName);
......@@ -2284,6 +2338,10 @@ public abstract class BaseJobApplication extends BaseBusinessClass
{
return getJob (getType);
}
else if (assocName.equals (SINGLEREFERENCE_WorkFlowStage))
{
return getWorkFlowStage (getType);
}
else
{
return super.getSingleAssoc (assocName, getType);
......@@ -2309,6 +2367,10 @@ public abstract class BaseJobApplication extends BaseBusinessClass
{
return getJobID ();
}
else if (assocName.equals (SINGLEREFERENCE_WorkFlowStage))
{
return getWorkFlowStageID ();
}
else
{
return super.getSingleAssocID (assocName);
......@@ -2334,6 +2396,10 @@ public abstract class BaseJobApplication extends BaseBusinessClass
{
setJob ((Job)(newValue));
}
else if (assocName.equals (SINGLEREFERENCE_WorkFlowStage))
{
setWorkFlowStage ((WorkFlowStage)(newValue));
}
else
{
super.setSingleAssoc (assocName, newValue);
......@@ -2646,6 +2712,97 @@ public abstract class BaseJobApplication extends BaseBusinessClass
}
/**
* Get the reference WorkFlowStage
*/
public WorkFlowStage getWorkFlowStage () throws StorageException
{
assertValid();
try
{
return (WorkFlowStage)(_WorkFlowStage.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in JobApplication:", this.getObjectID (), ", was trying to get WorkFlowStage:", getWorkFlowStageID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _WorkFlowStage.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public WorkFlowStage getWorkFlowStage (Get getType) throws StorageException
{
assertValid();
return _WorkFlowStage.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getWorkFlowStageID ()
{
assertValid();
if (_WorkFlowStage == null)
{
return null;
}
else
{
return _WorkFlowStage.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 preWorkFlowStageChange (WorkFlowStage newWorkFlowStage) 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 postWorkFlowStageChange () throws FieldException
{
}
public FieldWriteability getWriteability_WorkFlowStage ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference WorkFlowStage. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setWorkFlowStage (WorkFlowStage newWorkFlowStage) throws StorageException, FieldException
{
if (_WorkFlowStage.wouldReferencedChange (newWorkFlowStage))
{
assertValid();
Debug.assertion (AttributeDecoratorUtils.getWriteability (SINGLEREFERENCE_WorkFlowStage_Decorators, (JobApplication)this, SINGLEREFERENCE_WorkFlowStage ,getWriteability_WorkFlowStage ()) != FieldWriteability.FALSE, "Assoc WorkFlowStage is not writeable");
preWorkFlowStageChange (newWorkFlowStage);
_WorkFlowStage.set (newWorkFlowStage);
postWorkFlowStageChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getMultiAssocs()
......@@ -2656,6 +2813,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass
result.add("Notes");
result.add("ScheduledEmails");
result.add("SentEmails");
result.add("Messages");
return result;
}
......@@ -2682,6 +2840,10 @@ public abstract class BaseJobApplication extends BaseBusinessClass
{
return SentEmail.REFERENCE_SentEmail ;
}
if (MULTIPLEREFERENCE_Messages.equals(attribName))
{
return Message.REFERENCE_Message ;
}
return super.getMultiAssocReferenceInstance(attribName);
}
......@@ -2705,6 +2867,10 @@ public abstract class BaseJobApplication extends BaseBusinessClass
{
return SentEmail.SINGLEREFERENCE_JobApplication ;
}
if (MULTIPLEREFERENCE_Messages.equals(attribName))
{
return Message.SINGLEREFERENCE_JobApplication ;
}
return super.getMultiAssocBackReference(attribName);
}
......@@ -2731,6 +2897,10 @@ public abstract class BaseJobApplication extends BaseBusinessClass
{
return this.getSentEmailsCount();
}
if (MULTIPLEREFERENCE_Messages.equals(attribName))
{
return this.getMessagesCount();
}
return super.getMultiAssocCount(attribName);
}
......@@ -2757,6 +2927,10 @@ public abstract class BaseJobApplication extends BaseBusinessClass
{
return this.getSentEmailsAt(index);
}
if (MULTIPLEREFERENCE_Messages.equals(attribName))
{
return this.getMessagesAt(index);
}
return super.getMultiAssocAt(attribName, index);
}
......@@ -2787,6 +2961,11 @@ public abstract class BaseJobApplication extends BaseBusinessClass
addToSentEmails((SentEmail)newElement);
return;
}
if (MULTIPLEREFERENCE_Messages.equals(attribName))
{
addToMessages((Message)newElement);
return;
}
super.addToMultiAssoc(attribName, newElement);
}
......@@ -2816,6 +2995,11 @@ public abstract class BaseJobApplication extends BaseBusinessClass
removeFromSentEmails((SentEmail)oldElement);
return;
}
if (MULTIPLEREFERENCE_Messages.equals(attribName))
{
removeFromMessages((Message)oldElement);
return;
}
super.removeFromMultiAssoc(attribName, oldElement);
}
......@@ -2843,6 +3027,11 @@ public abstract class BaseJobApplication extends BaseBusinessClass
_SentEmails.__loadAssociation (elements);
return;
}
if (MULTIPLEREFERENCE_Messages.equals(attribName))
{
_Messages.__loadAssociation (elements);
return;
}
super.__loadMultiAssoc(attribName, elements);
}
......@@ -2866,6 +3055,10 @@ public abstract class BaseJobApplication extends BaseBusinessClass
{
return _SentEmails.isLoaded ();
}
if (MULTIPLEREFERENCE_Messages.equals(attribName))
{
return _Messages.isLoaded ();
}
return super.__isMultiAssocLoaded(attribName);
}
......@@ -3147,6 +3340,75 @@ public abstract class BaseJobApplication extends BaseBusinessClass
return _SentEmails.getSet ();
}
public FieldWriteability getWriteability_Messages ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
public int getMessagesCount () throws StorageException
{
assertValid();
return _Messages.getReferencedObjectsCount ();
}
public void addToMessages (Message newElement) throws StorageException
{
if (_Messages.wouldAddChange (newElement))
{
assertValid();
Debug.assertion (AttributeDecoratorUtils.getWriteability (MULTIPLEREFERENCE_Messages_Decorators, (JobApplication)this, MULTIPLEREFERENCE_Messages ,getWriteability_Messages ()) != FieldWriteability.FALSE, "MultiAssoc Messages is not writeable (add)");
_Messages.appendElement (newElement);
try
{
if (newElement.getJobApplication () != this)
{
newElement.setJobApplication ((JobApplication)(this));
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
}
}
public void removeFromMessages (Message elementToRemove) throws StorageException
{
if (_Messages.wouldRemoveChange (elementToRemove))
{
assertValid();
Debug.assertion (AttributeDecoratorUtils.getWriteability (MULTIPLEREFERENCE_Messages_Decorators, (JobApplication)this, MULTIPLEREFERENCE_Messages ,getWriteability_Messages ()) != FieldWriteability.FALSE, "MultiAssoc Messages is not writeable (remove)");
_Messages.removeElement (elementToRemove);
try
{
if (elementToRemove.getJobApplication () != null)
{
elementToRemove.setJobApplication (null);
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
}
}
public Message getMessagesAt (int index) throws StorageException
{
return (Message)(_Messages.getElementAt (index));
}
public SortedSet<Message> getMessagesSet () throws StorageException
{
return _Messages.getSet ();
}
public void onDelete ()
......@@ -3205,6 +3467,12 @@ public abstract class BaseJobApplication extends BaseBusinessClass
referenced.setJobApplication(null);
}
for(Message referenced : CollectionUtils.reverse(getMessagesSet()))
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null JobApplication from ", getObjectID (), " to ", referenced.getObjectID ());
referenced.setJobApplication(null);
}
}
catch (Exception e)
{
......@@ -3272,6 +3540,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass
tl_job_applicationPSet.setAttrib (FIELD_IsEmailIngest, HELPER_IsEmailIngest.toObject (_IsEmailIngest)); //
_Candidate.getPersistentSets (allSets);
_Job.getPersistentSets (allSets);
_WorkFlowStage.getPersistentSets (allSets);
}
......@@ -3295,6 +3564,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass
_IsEmailIngest = (Boolean)(HELPER_IsEmailIngest.fromObject (_IsEmailIngest, tl_job_applicationPSet.getAttrib (FIELD_IsEmailIngest))); //
_Candidate.setFromPersistentSets (objectID, allSets);
_Job.setFromPersistentSets (objectID, allSets);
_WorkFlowStage.setFromPersistentSets (objectID, allSets);
}
......@@ -3428,6 +3698,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass
_WorkFlow.copyFrom (sourceJobApplication._WorkFlow, linkToGhosts);
_Candidate.copyFrom (sourceJobApplication._Candidate, linkToGhosts);
_Job.copyFrom (sourceJobApplication._Job, linkToGhosts);
_WorkFlowStage.copyFrom (sourceJobApplication._WorkFlowStage, linkToGhosts);
}
}
......@@ -3448,6 +3719,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass
_Notes.copyFrom (sourceJobApplication._Notes, linkToGhosts);
_ScheduledEmails.copyFrom (sourceJobApplication._ScheduledEmails, linkToGhosts);
_SentEmails.copyFrom (sourceJobApplication._SentEmails, linkToGhosts);
_Messages.copyFrom (sourceJobApplication._Messages, linkToGhosts);
}
}
......@@ -3490,10 +3762,12 @@ public abstract class BaseJobApplication extends BaseBusinessClass
_WorkFlow.readExternalData(vals.get(SINGLEREFERENCE_WorkFlow));
_Candidate.readExternalData(vals.get(SINGLEREFERENCE_Candidate));
_Job.readExternalData(vals.get(SINGLEREFERENCE_Job));
_WorkFlowStage.readExternalData(vals.get(SINGLEREFERENCE_WorkFlowStage));
_AssessmentCriteriaAnswers.readExternalData(vals.get(MULTIPLEREFERENCE_AssessmentCriteriaAnswers));
_Notes.readExternalData(vals.get(MULTIPLEREFERENCE_Notes));
_ScheduledEmails.readExternalData(vals.get(MULTIPLEREFERENCE_ScheduledEmails));
_SentEmails.readExternalData(vals.get(MULTIPLEREFERENCE_SentEmails));
_Messages.readExternalData(vals.get(MULTIPLEREFERENCE_Messages));
}
......@@ -3523,10 +3797,12 @@ public abstract class BaseJobApplication extends BaseBusinessClass
vals.put (SINGLEREFERENCE_WorkFlow, _WorkFlow.writeExternalData());
vals.put (SINGLEREFERENCE_Candidate, _Candidate.writeExternalData());
vals.put (SINGLEREFERENCE_Job, _Job.writeExternalData());
vals.put (SINGLEREFERENCE_WorkFlowStage, _WorkFlowStage.writeExternalData());
vals.put (MULTIPLEREFERENCE_AssessmentCriteriaAnswers, _AssessmentCriteriaAnswers.writeExternalData());
vals.put (MULTIPLEREFERENCE_Notes, _Notes.writeExternalData());
vals.put (MULTIPLEREFERENCE_ScheduledEmails, _ScheduledEmails.writeExternalData());
vals.put (MULTIPLEREFERENCE_SentEmails, _SentEmails.writeExternalData());
vals.put (MULTIPLEREFERENCE_Messages, _Messages.writeExternalData());
}
......@@ -3577,6 +3853,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass
_WorkFlow.compare (otherJobApplication._WorkFlow, listener);
_Candidate.compare (otherJobApplication._Candidate, listener);
_Job.compare (otherJobApplication._Job, listener);
_WorkFlowStage.compare (otherJobApplication._WorkFlowStage, listener);
// Compare multiple assocs
......@@ -3584,6 +3861,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass
_Notes.compare (otherJobApplication._Notes, listener);
_ScheduledEmails.compare (otherJobApplication._ScheduledEmails, listener);
_SentEmails.compare (otherJobApplication._SentEmails, listener);
_Messages.compare (otherJobApplication._Messages, listener);
}
}
......@@ -3619,10 +3897,12 @@ public abstract class BaseJobApplication extends BaseBusinessClass
visitor.visitAssociation (_WorkFlow);
visitor.visitAssociation (_Candidate);
visitor.visitAssociation (_Job);
visitor.visitAssociation (_WorkFlowStage);
visitor.visitAssociation (_AssessmentCriteriaAnswers);
visitor.visitAssociation (_Notes);
visitor.visitAssociation (_ScheduledEmails);
visitor.visitAssociation (_SentEmails);
visitor.visitAssociation (_Messages);
}
......@@ -3643,6 +3923,10 @@ public abstract class BaseJobApplication extends BaseBusinessClass
{
visitor.visit (_Job);
}
if (scope.includes (_WorkFlowStage))
{
visitor.visit (_WorkFlowStage);
}
if (scope.includes (_AssessmentCriteriaAnswers))
{
visitor.visit (_AssessmentCriteriaAnswers);
......@@ -3659,6 +3943,10 @@ public abstract class BaseJobApplication extends BaseBusinessClass
{
visitor.visit (_SentEmails);
}
if (scope.includes (_Messages))
{
visitor.visit (_Messages);
}
}
......@@ -3724,6 +4012,10 @@ public abstract class BaseJobApplication extends BaseBusinessClass
{
return filter.matches (getJob ());
}
else if (attribName.equals (SINGLEREFERENCE_WorkFlowStage))
{
return filter.matches (getWorkFlowStage ());
}
else
{
return super.testFilter (attribName, filter);
......@@ -3814,6 +4106,12 @@ public abstract class BaseJobApplication extends BaseBusinessClass
return this;
}
public SearchAll andWorkFlowStage (QueryFilter<WorkFlowStage> filter)
{
filter.addFilter (context, "tl_job_application.work_flow_stage_id", "WorkFlowStage");
return this;
}
public JobApplication[] search (ObjectTransaction transaction) throws StorageException
{
......@@ -3935,6 +4233,12 @@ public abstract class BaseJobApplication extends BaseBusinessClass
return this;
}
public SearchCandidateJob andWorkFlowStage (QueryFilter<WorkFlowStage> filter)
{
filter.addFilter (context, "tl_job_application.work_flow_stage_id", "WorkFlowStage");
return this;
}
public JobApplication search (ObjectTransaction transaction) throws StorageException
{Candidate Candidate = (Candidate)criteria.get ("Candidate");
Job Job = (Job)criteria.get ("Job");
......@@ -4072,6 +4376,12 @@ public abstract class BaseJobApplication extends BaseBusinessClass
return this;
}
public SearchDetails andWorkFlowStage (QueryFilter<WorkFlowStage> filter)
{
filter.addFilter (context, "tl_job_application.work_flow_stage_id", "WorkFlowStage");
return this;
}
public JobApplication[] search (ObjectTransaction transaction) throws StorageException
{
......@@ -4388,6 +4698,10 @@ public abstract class BaseJobApplication extends BaseBusinessClass
{
return getWriteability_SentEmails ();
}
else if (fieldName.equals (MULTIPLEREFERENCE_Messages))
{
return getWriteability_Messages ();
}
else if (fieldName.equals (SINGLEREFERENCE_Candidate))
{
return getWriteability_Candidate ();
......@@ -4396,6 +4710,10 @@ public abstract class BaseJobApplication extends BaseBusinessClass
{
return getWriteability_Job ();
}
else if (fieldName.equals (SINGLEREFERENCE_WorkFlowStage))
{
return getWriteability_WorkFlowStage ();
}
else if (fieldName.equals (FIELD_AppProcessOption))
{
return getWriteability_AppProcessOption ();
......@@ -4984,6 +5302,10 @@ public abstract class BaseJobApplication extends BaseBusinessClass
{
return toSentEmails ();
}
if (name.equals ("Messages"))
{
return toMessages ();
}
if (name.equals ("AppProcessOption"))
{
return toAppProcessOption ();
......@@ -5056,6 +5378,10 @@ public abstract class BaseJobApplication extends BaseBusinessClass
{
return toJob ();
}
if (name.equals ("WorkFlowStage"))
{
return toWorkFlowStage ();
}
return super.to(name);
......@@ -5119,6 +5445,13 @@ public abstract class BaseJobApplication extends BaseBusinessClass
return Job.REFERENCE_Job.new JobPipeLineFactory<From, Job> (this, new ORMSingleAssocPipe<Me, Job>(SINGLEREFERENCE_Job, filter));
}
public WorkFlowStage.WorkFlowStagePipeLineFactory<From, WorkFlowStage> toWorkFlowStage () { return toWorkFlowStage (Filter.ALL); }
public WorkFlowStage.WorkFlowStagePipeLineFactory<From, WorkFlowStage> toWorkFlowStage (Filter<WorkFlowStage> filter)
{
return WorkFlowStage.REFERENCE_WorkFlowStage.new WorkFlowStagePipeLineFactory<From, WorkFlowStage> (this, new ORMSingleAssocPipe<Me, WorkFlowStage>(SINGLEREFERENCE_WorkFlowStage, filter));
}
public AssessmentCriteriaAnswer.AssessmentCriteriaAnswerPipeLineFactory<From, AssessmentCriteriaAnswer> toAssessmentCriteriaAnswers () { return toAssessmentCriteriaAnswers(Filter.ALL); }
public AssessmentCriteriaAnswer.AssessmentCriteriaAnswerPipeLineFactory<From, AssessmentCriteriaAnswer> toAssessmentCriteriaAnswers (Filter<AssessmentCriteriaAnswer> filter)
......@@ -5146,6 +5479,13 @@ public abstract class BaseJobApplication extends BaseBusinessClass
{
return SentEmail.REFERENCE_SentEmail.new SentEmailPipeLineFactory<From, SentEmail> (this, new ORMMultiAssocPipe<Me, SentEmail>(MULTIPLEREFERENCE_SentEmails, filter));
}
public Message.MessagePipeLineFactory<From, Message> toMessages () { return toMessages(Filter.ALL); }
public Message.MessagePipeLineFactory<From, Message> toMessages (Filter<Message> filter)
{
return Message.REFERENCE_Message.new MessagePipeLineFactory<From, Message> (this, new ORMMultiAssocPipe<Me, Message>(MULTIPLEREFERENCE_Messages, filter));
}
}
public boolean isTransientAttrib(String attribName)
......@@ -5258,6 +5598,20 @@ class DummyJobApplication extends JobApplication
return Job.DUMMY_Job.getObjectID();
}
public WorkFlowStage getWorkFlowStage () throws StorageException
{
return (WorkFlowStage)(WorkFlowStage.DUMMY_WorkFlowStage);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getWorkFlowStageID ()
{
return WorkFlowStage.DUMMY_WorkFlowStage.getObjectID();
}
public int getAssessmentCriteriaAnswersCount () throws StorageException
{
return 0;
......@@ -5326,6 +5680,23 @@ class DummyJobApplication extends JobApplication
return new TreeSet();
}
public int getMessagesCount () throws StorageException
{
return 0;
}
public Message getMessagesAt (int index) throws StorageException
{
throw new RuntimeException ("No elements in a dummy object in association Messages");
}
public SortedSet getMessagesSet () throws StorageException
{
return new TreeSet();
}
}
/*
* IMPORTANT!!!! XSL Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure9.0 [oneit.objstore.BusinessObjectTemplate.xsl]
* Vendor: Apache Software Foundation (Xalan XSLTC) (Version: 1.0)
*/
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 oneit.security.*;
public abstract class BaseMessage extends BaseBusinessClass
{
// Reference instance for the object
public static final Message REFERENCE_Message = new Message ();
// Reference instance for the object
public static final Message DUMMY_Message = new DummyMessage ();
// Static constants corresponding to field names
public static final String FIELD_SentVia = "SentVia";
public static final String FIELD_MessageContent = "MessageContent";
public static final String FIELD_IsRead = "IsRead";
public static final String SINGLEREFERENCE_SentBy = "SentBy";
public static final String SINGLEREFERENCE_WorkFlowMessage = "WorkFlowMessage";
public static final String SINGLEREFERENCE_JobApplication = "JobApplication";
public static final String BACKREF_JobApplication = "";
public static final String MULTIPLEREFERENCE_Attachments = "Attachments";
public static final String BACKREF_Attachments = "";
// Static constants corresponding to searches
public static final String SEARCH_All = "All";
// Static constants corresponding to attribute helpers
private static final EnumeratedAttributeHelper<Message, SentVia> HELPER_SentVia = new EnumeratedAttributeHelper<Message, SentVia> (SentVia.FACTORY_SentVia);
private static final DefaultAttributeHelper<Message> HELPER_MessageContent = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Message> HELPER_IsRead = DefaultAttributeHelper.INSTANCE;
// Private attributes corresponding to business object data
private SentVia _SentVia;
private String _MessageContent;
private Boolean _IsRead;
// Private attributes corresponding to single references
private SingleAssociation<Message, SecUser> _SentBy;
private SingleAssociation<Message, WorkFlowMessage> _WorkFlowMessage;
private SingleAssociation<Message, JobApplication> _JobApplication;
// Private attributes corresponding to multiple references
private MultipleAssociation<Message, ChatAttachment> _Attachments;
// Map of maps of metadata
private static final Map ATTRIBUTES_METADATA_Message = new LinkedHashMap ();
// Arrays of validators for each attribute
private static final AttributeValidator[] FIELD_SentVia_Validators;
private static final AttributeValidator[] FIELD_MessageContent_Validators;
private static final AttributeValidator[] FIELD_IsRead_Validators;
// Arrays of AttributeDecorators for each attribute
private static final AttributeDecorator<Message, SentVia>[] FIELD_SentVia_Decorators;
private static final AttributeDecorator<Message, String>[] FIELD_MessageContent_Decorators;
private static final AttributeDecorator<Message, Boolean>[] FIELD_IsRead_Decorators;
// Arrays of SingleAssocDecorators for each attribute
private static final SingleAssocDecorator<Message, SecUser>[] SINGLEREFERENCE_SentBy_Decorators;
private static final SingleAssocDecorator<Message, WorkFlowMessage>[] SINGLEREFERENCE_WorkFlowMessage_Decorators;
private static final SingleAssocDecorator<Message, JobApplication>[] SINGLEREFERENCE_JobApplication_Decorators;
// Arrays of MultiAssocDecorators for each attribute
private static final MultiAssocDecorator<Message, ChatAttachment>[] MULTIPLEREFERENCE_Attachments_Decorators;
// Arrays of behaviour decorators
private static final MessageBehaviourDecorator[] Message_BehaviourDecorators;
static
{
try
{
String tmp_Attachments = ChatAttachment.BACKREF_Message;
String tmp_JobApplication = JobApplication.BACKREF_Messages;
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
setupAssocMetaData_Attachments();
setupAssocMetaData_SentBy();
setupAssocMetaData_WorkFlowMessage();
setupAssocMetaData_JobApplication();
FIELD_SentVia_Validators = (AttributeValidator[])setupAttribMetaData_SentVia(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_MessageContent_Validators = (AttributeValidator[])setupAttribMetaData_MessageContent(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_IsRead_Validators = (AttributeValidator[])setupAttribMetaData_IsRead(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_SentVia_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_Message, FIELD_SentVia).toArray (new AttributeDecorator[0]);
FIELD_MessageContent_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_Message, FIELD_MessageContent).toArray (new AttributeDecorator[0]);
FIELD_IsRead_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_Message, FIELD_IsRead).toArray (new AttributeDecorator[0]);
SINGLEREFERENCE_SentBy_Decorators = (SingleAssocDecorator[])AttributeDecoratorUtils.getSingleAssocDecorators(REFERENCE_Message, SINGLEREFERENCE_SentBy).toArray (new SingleAssocDecorator[0]);
SINGLEREFERENCE_WorkFlowMessage_Decorators = (SingleAssocDecorator[])AttributeDecoratorUtils.getSingleAssocDecorators(REFERENCE_Message, SINGLEREFERENCE_WorkFlowMessage).toArray (new SingleAssocDecorator[0]);
SINGLEREFERENCE_JobApplication_Decorators = (SingleAssocDecorator[])AttributeDecoratorUtils.getSingleAssocDecorators(REFERENCE_Message, SINGLEREFERENCE_JobApplication).toArray (new SingleAssocDecorator[0]);
MULTIPLEREFERENCE_Attachments_Decorators = (MultiAssocDecorator[])AttributeDecoratorUtils.getMultiAssocDecorators(REFERENCE_Message, MULTIPLEREFERENCE_Attachments).toArray (new MultiAssocDecorator[0]);
REFERENCE_Message.initialiseReference ();
DUMMY_Message.initialiseReference ();
Message_BehaviourDecorators = BaseBusinessClass.getBBCBehaviours(Message.class).toArray(new MessageBehaviourDecorator[0]);
}
catch (RuntimeException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR1, e, "Error initialising");
throw e;
}
}
private static void setupAssocMetaData_Attachments()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "Message");
metaInfo.put ("name", "Attachments");
metaInfo.put ("type", "ChatAttachment");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Message.Attachments:", metaInfo);
ATTRIBUTES_METADATA_Message.put (MULTIPLEREFERENCE_Attachments, Collections.unmodifiableMap (metaInfo));
}
private static void setupAssocMetaData_SentBy()
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "sent_by");
metaInfo.put ("name", "SentBy");
metaInfo.put ("type", "SecUser");
metaInfo.put (METADATA_DB_TABLENAME, "tl_message");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Message.SentBy:", metaInfo);
ATTRIBUTES_METADATA_Message.put (SINGLEREFERENCE_SentBy, Collections.unmodifiableMap (metaInfo));
}
private static void setupAssocMetaData_WorkFlowMessage()
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "work_flow_message");
metaInfo.put ("name", "WorkFlowMessage");
metaInfo.put ("type", "WorkFlowMessage");
metaInfo.put (METADATA_DB_TABLENAME, "tl_message");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Message.WorkFlowMessage:", metaInfo);
ATTRIBUTES_METADATA_Message.put (SINGLEREFERENCE_WorkFlowMessage, Collections.unmodifiableMap (metaInfo));
}
private static void setupAssocMetaData_JobApplication()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "Messages");
metaInfo.put ("dbcol", "job_application_id");
metaInfo.put ("mandatory", "false");
metaInfo.put ("name", "JobApplication");
metaInfo.put ("type", "JobApplication");
metaInfo.put (METADATA_DB_TABLENAME, "tl_message");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Message.JobApplication:", metaInfo);
ATTRIBUTES_METADATA_Message.put (SINGLEREFERENCE_JobApplication, Collections.unmodifiableMap (metaInfo));
}
private static List setupAttribMetaData_SentVia(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("attribHelper", "EnumeratedAttributeHelper");
metaInfo.put ("dbcol", "sent_via");
metaInfo.put ("mandatory", "false");
metaInfo.put ("name", "SentVia");
metaInfo.put ("type", "SentVia");
metaInfo.put (METADATA_DB_TABLENAME, "tl_message");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Message.SentVia:", metaInfo);
ATTRIBUTES_METADATA_Message.put (FIELD_SentVia, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(Message.class, "SentVia", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for Message.SentVia:", validators);
return validators;
}
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");
metaInfo.put (METADATA_DB_TABLENAME, "tl_message");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Message.MessageContent:", metaInfo);
ATTRIBUTES_METADATA_Message.put (FIELD_MessageContent, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(Message.class, "MessageContent", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for Message.MessageContent:", validators);
return validators;
}
private static List setupAttribMetaData_IsRead(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "is_read");
metaInfo.put ("mandatory", "false");
metaInfo.put ("name", "IsRead");
metaInfo.put ("type", "Boolean");
metaInfo.put (METADATA_DB_TABLENAME, "tl_message");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Message.IsRead:", metaInfo);
ATTRIBUTES_METADATA_Message.put (FIELD_IsRead, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(Message.class, "IsRead", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for Message.IsRead:", validators);
return validators;
}
// END OF STATIC METADATA DEFINITION
// This constructor should not be called
protected BaseMessage ()
{
}
protected BBCBehaviourDecorator[] getBehaviours()
{
return Message_BehaviourDecorators;
}
protected void _initialiseNewObjAttributes (ObjectTransaction transaction) throws StorageException
{
super._initialiseNewObjAttributes (transaction);
_SentVia = (SentVia)(HELPER_SentVia.initialise (_SentVia));
_MessageContent = (String)(HELPER_MessageContent.initialise (_MessageContent));
_IsRead = (Boolean)(HELPER_IsRead.initialise (_IsRead));
}
protected void _initialiseAssociations ()
{
super._initialiseAssociations ();
_SentBy = new SingleAssociation<Message, SecUser> (this, SINGLEREFERENCE_SentBy, null, SecUser.REFERENCE_SecUser, "tl_message");
_WorkFlowMessage = new SingleAssociation<Message, WorkFlowMessage> (this, SINGLEREFERENCE_WorkFlowMessage, null, WorkFlowMessage.REFERENCE_WorkFlowMessage, "tl_message");
_JobApplication = new SingleAssociation<Message, JobApplication> (this, SINGLEREFERENCE_JobApplication, JobApplication.MULTIPLEREFERENCE_Messages, JobApplication.REFERENCE_JobApplication, "tl_message");
_Attachments = new MultipleAssociation<Message, ChatAttachment> (this, MULTIPLEREFERENCE_Attachments, ChatAttachment.SINGLEREFERENCE_Message, ChatAttachment.REFERENCE_ChatAttachment);
}
protected BaseBusinessClass initialiseReference ()
{
super.initialiseReference ();
_SentBy = new SingleAssociation<Message, SecUser> (this, SINGLEREFERENCE_SentBy, null, SecUser.REFERENCE_SecUser, "tl_message");
_WorkFlowMessage = new SingleAssociation<Message, WorkFlowMessage> (this, SINGLEREFERENCE_WorkFlowMessage, null, WorkFlowMessage.REFERENCE_WorkFlowMessage, "tl_message");
_JobApplication = new SingleAssociation<Message, JobApplication> (this, SINGLEREFERENCE_JobApplication, JobApplication.MULTIPLEREFERENCE_Messages, JobApplication.REFERENCE_JobApplication, "tl_message");
_Attachments = new MultipleAssociation<Message, ChatAttachment> (this, MULTIPLEREFERENCE_Attachments, ChatAttachment.SINGLEREFERENCE_Message, ChatAttachment.REFERENCE_ChatAttachment);
return this;
}
/**
* Attribute SentVia
*/
public SentVia getSentVia ()
{
assertValid();
SentVia valToReturn = AttributeDecoratorUtils.getValue (FIELD_SentVia_Decorators, (Message)this, FIELD_SentVia, _SentVia);
for (MessageBehaviourDecorator bhd : Message_BehaviourDecorators)
{
valToReturn = bhd.getSentVia ((Message)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 preSentViaChange (SentVia newSentVia) 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 postSentViaChange () throws FieldException
{
}
public FieldWriteability getWriteability_SentVia ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute SentVia. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setSentVia (SentVia newSentVia) throws FieldException
{
newSentVia = AttributeDecoratorUtils.setValue (FIELD_SentVia_Decorators, (Message)this, FIELD_SentVia, newSentVia);
boolean oldAndNewIdentical = HELPER_SentVia.compare (_SentVia, newSentVia);
try
{
for (MessageBehaviourDecorator bhd : Message_BehaviourDecorators)
{
newSentVia = bhd.setSentVia ((Message)this, newSentVia);
oldAndNewIdentical = HELPER_SentVia.compare (_SentVia, newSentVia);
}
if (FIELD_SentVia_Validators.length > 0)
{
Object newSentViaObj = HELPER_SentVia.toObject (newSentVia);
if (newSentViaObj != null)
{
int loopMax = FIELD_SentVia_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_Message.get (FIELD_SentVia);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_SentVia_Validators[v].checkAttribute (this, FIELD_SentVia, metadata, newSentViaObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (AttributeDecoratorUtils.getWriteability (FIELD_SentVia_Decorators, (Message)this, FIELD_SentVia ,getWriteability_SentVia ()) != FieldWriteability.FALSE, "Field SentVia is not writeable");
preSentViaChange (newSentVia);
markFieldChange (FIELD_SentVia);
_SentVia = newSentVia;
postFieldChange (FIELD_SentVia);
postSentViaChange ();
}
}
/**
* Attribute MessageContent
*/
public String getMessageContent ()
{
assertValid();
String valToReturn = AttributeDecoratorUtils.getValue (FIELD_MessageContent_Decorators, (Message)this, FIELD_MessageContent, _MessageContent);
for (MessageBehaviourDecorator bhd : Message_BehaviourDecorators)
{
valToReturn = bhd.getMessageContent ((Message)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
{
newMessageContent = AttributeDecoratorUtils.setValue (FIELD_MessageContent_Decorators, (Message)this, FIELD_MessageContent, newMessageContent);
boolean oldAndNewIdentical = HELPER_MessageContent.compare (_MessageContent, newMessageContent);
try
{
for (MessageBehaviourDecorator bhd : Message_BehaviourDecorators)
{
newMessageContent = bhd.setMessageContent ((Message)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_Message.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 (AttributeDecoratorUtils.getWriteability (FIELD_MessageContent_Decorators, (Message)this, FIELD_MessageContent ,getWriteability_MessageContent ()) != FieldWriteability.FALSE, "Field MessageContent is not writeable");
preMessageContentChange (newMessageContent);
markFieldChange (FIELD_MessageContent);
_MessageContent = newMessageContent;
postFieldChange (FIELD_MessageContent);
postMessageContentChange ();
}
}
/**
* Attribute IsRead
*/
public Boolean getIsRead ()
{
assertValid();
Boolean valToReturn = AttributeDecoratorUtils.getValue (FIELD_IsRead_Decorators, (Message)this, FIELD_IsRead, _IsRead);
for (MessageBehaviourDecorator bhd : Message_BehaviourDecorators)
{
valToReturn = bhd.getIsRead ((Message)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 preIsReadChange (Boolean newIsRead) 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 postIsReadChange () throws FieldException
{
}
public FieldWriteability getWriteability_IsRead ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute IsRead. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setIsRead (Boolean newIsRead) throws FieldException
{
newIsRead = AttributeDecoratorUtils.setValue (FIELD_IsRead_Decorators, (Message)this, FIELD_IsRead, newIsRead);
boolean oldAndNewIdentical = HELPER_IsRead.compare (_IsRead, newIsRead);
try
{
for (MessageBehaviourDecorator bhd : Message_BehaviourDecorators)
{
newIsRead = bhd.setIsRead ((Message)this, newIsRead);
oldAndNewIdentical = HELPER_IsRead.compare (_IsRead, newIsRead);
}
if (FIELD_IsRead_Validators.length > 0)
{
Object newIsReadObj = HELPER_IsRead.toObject (newIsRead);
if (newIsReadObj != null)
{
int loopMax = FIELD_IsRead_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_Message.get (FIELD_IsRead);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_IsRead_Validators[v].checkAttribute (this, FIELD_IsRead, metadata, newIsReadObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (AttributeDecoratorUtils.getWriteability (FIELD_IsRead_Decorators, (Message)this, FIELD_IsRead ,getWriteability_IsRead ()) != FieldWriteability.FALSE, "Field IsRead is not writeable");
preIsReadChange (newIsRead);
markFieldChange (FIELD_IsRead);
_IsRead = newIsRead;
postFieldChange (FIELD_IsRead);
postIsReadChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getSingleAssocs()
{
List result = super.getSingleAssocs ();
result.add("SentBy");
result.add("WorkFlowMessage");
result.add("JobApplication");
return result;
}
public BaseBusinessClass getSingleAssocReferenceInstance (String assocName)
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_SentBy))
{
return _SentBy.getReferencedType ();
}
else if (assocName.equals (SINGLEREFERENCE_WorkFlowMessage))
{
return _WorkFlowMessage.getReferencedType ();
}
else if (assocName.equals (SINGLEREFERENCE_JobApplication))
{
return _JobApplication.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_SentBy))
{
return null ;
}
else if (assocName.equals (SINGLEREFERENCE_WorkFlowMessage))
{
return null ;
}
else if (assocName.equals (SINGLEREFERENCE_JobApplication))
{
return JobApplication.MULTIPLEREFERENCE_Messages ;
}
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_SentBy))
{
return getSentBy ();
}
else if (assocName.equals (SINGLEREFERENCE_WorkFlowMessage))
{
return getWorkFlowMessage ();
}
else if (assocName.equals (SINGLEREFERENCE_JobApplication))
{
return getJobApplication ();
}
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_SentBy))
{
return getSentBy (getType);
}
else if (assocName.equals (SINGLEREFERENCE_WorkFlowMessage))
{
return getWorkFlowMessage (getType);
}
else if (assocName.equals (SINGLEREFERENCE_JobApplication))
{
return getJobApplication (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_SentBy))
{
return getSentByID ();
}
else if (assocName.equals (SINGLEREFERENCE_WorkFlowMessage))
{
return getWorkFlowMessageID ();
}
else if (assocName.equals (SINGLEREFERENCE_JobApplication))
{
return getJobApplicationID ();
}
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_SentBy))
{
setSentBy ((SecUser)(newValue));
}
else if (assocName.equals (SINGLEREFERENCE_WorkFlowMessage))
{
setWorkFlowMessage ((WorkFlowMessage)(newValue));
}
else if (assocName.equals (SINGLEREFERENCE_JobApplication))
{
setJobApplication ((JobApplication)(newValue));
}
else
{
super.setSingleAssoc (assocName, newValue);
}
}
/**
* Get the reference SentBy
*/
public SecUser getSentBy () throws StorageException
{
assertValid();
try
{
return (SecUser)(_SentBy.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in Message:", this.getObjectID (), ", was trying to get SecUser:", getSentByID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _SentBy.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public SecUser getSentBy (Get getType) throws StorageException
{
assertValid();
return _SentBy.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getSentByID ()
{
assertValid();
if (_SentBy == null)
{
return null;
}
else
{
return _SentBy.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 preSentByChange (SecUser newSentBy) 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 postSentByChange () throws FieldException
{
}
public FieldWriteability getWriteability_SentBy ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference SentBy. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setSentBy (SecUser newSentBy) throws StorageException, FieldException
{
if (_SentBy.wouldReferencedChange (newSentBy))
{
assertValid();
Debug.assertion (AttributeDecoratorUtils.getWriteability (SINGLEREFERENCE_SentBy_Decorators, (Message)this, SINGLEREFERENCE_SentBy ,getWriteability_SentBy ()) != FieldWriteability.FALSE, "Assoc SentBy is not writeable");
preSentByChange (newSentBy);
_SentBy.set (newSentBy);
postSentByChange ();
}
}
/**
* Get the reference WorkFlowMessage
*/
public WorkFlowMessage getWorkFlowMessage () throws StorageException
{
assertValid();
try
{
return (WorkFlowMessage)(_WorkFlowMessage.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in Message:", this.getObjectID (), ", was trying to get WorkFlowMessage:", getWorkFlowMessageID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _WorkFlowMessage.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public WorkFlowMessage getWorkFlowMessage (Get getType) throws StorageException
{
assertValid();
return _WorkFlowMessage.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getWorkFlowMessageID ()
{
assertValid();
if (_WorkFlowMessage == null)
{
return null;
}
else
{
return _WorkFlowMessage.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 preWorkFlowMessageChange (WorkFlowMessage newWorkFlowMessage) 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 postWorkFlowMessageChange () throws FieldException
{
}
public FieldWriteability getWriteability_WorkFlowMessage ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference WorkFlowMessage. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setWorkFlowMessage (WorkFlowMessage newWorkFlowMessage) throws StorageException, FieldException
{
if (_WorkFlowMessage.wouldReferencedChange (newWorkFlowMessage))
{
assertValid();
Debug.assertion (AttributeDecoratorUtils.getWriteability (SINGLEREFERENCE_WorkFlowMessage_Decorators, (Message)this, SINGLEREFERENCE_WorkFlowMessage ,getWriteability_WorkFlowMessage ()) != FieldWriteability.FALSE, "Assoc WorkFlowMessage is not writeable");
preWorkFlowMessageChange (newWorkFlowMessage);
_WorkFlowMessage.set (newWorkFlowMessage);
postWorkFlowMessageChange ();
}
}
/**
* Get the reference JobApplication
*/
public JobApplication getJobApplication () throws StorageException
{
assertValid();
try
{
return (JobApplication)(_JobApplication.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in Message:", this.getObjectID (), ", was trying to get JobApplication:", getJobApplicationID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _JobApplication.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public JobApplication getJobApplication (Get getType) throws StorageException
{
assertValid();
return _JobApplication.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getJobApplicationID ()
{
assertValid();
if (_JobApplication == null)
{
return null;
}
else
{
return _JobApplication.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 preJobApplicationChange (JobApplication newJobApplication) 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 postJobApplicationChange () throws FieldException
{
}
public FieldWriteability getWriteability_JobApplication ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference JobApplication. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setJobApplication (JobApplication newJobApplication) throws StorageException, FieldException
{
if (_JobApplication.wouldReferencedChange (newJobApplication))
{
assertValid();
Debug.assertion (AttributeDecoratorUtils.getWriteability (SINGLEREFERENCE_JobApplication_Decorators, (Message)this, SINGLEREFERENCE_JobApplication ,getWriteability_JobApplication ()) != FieldWriteability.FALSE, "Assoc JobApplication is not writeable");
preJobApplicationChange (newJobApplication);
JobApplication oldJobApplication = getJobApplication ();
if (oldJobApplication != null)
{
// This is to stop validation from triggering when we are removed
_JobApplication.set (null);
oldJobApplication.removeFromMessages ((Message)(this));
}
_JobApplication.set (newJobApplication);
if (newJobApplication != null)
{
newJobApplication.addToMessages ((Message)(this));
}
postJobApplicationChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getMultiAssocs()
{
List result = super.getMultiAssocs ();
result.add("Attachments");
return result;
}
/**
* Get the reference instance for the multi assoc name.
*/
public BaseBusinessClass getMultiAssocReferenceInstance(String attribName)
{
if (MULTIPLEREFERENCE_Attachments.equals(attribName))
{
return ChatAttachment.REFERENCE_ChatAttachment ;
}
return super.getMultiAssocReferenceInstance(attribName);
}
public String getMultiAssocBackReference(String attribName)
{
if (MULTIPLEREFERENCE_Attachments.equals(attribName))
{
return ChatAttachment.SINGLEREFERENCE_Message ;
}
return super.getMultiAssocBackReference(attribName);
}
/**
* Get the assoc count for the multi assoc name.
*/
public int getMultiAssocCount(String attribName) throws StorageException
{
if (MULTIPLEREFERENCE_Attachments.equals(attribName))
{
return this.getAttachmentsCount();
}
return super.getMultiAssocCount(attribName);
}
/**
* Get the assoc at a particular index
*/
public BaseBusinessClass getMultiAssocAt(String attribName, int index) throws StorageException
{
if (MULTIPLEREFERENCE_Attachments.equals(attribName))
{
return this.getAttachmentsAt(index);
}
return super.getMultiAssocAt(attribName, index);
}
/**
* Add to a multi assoc by attribute name
*/
public void addToMultiAssoc(String attribName, BaseBusinessClass newElement) throws StorageException
{
if (MULTIPLEREFERENCE_Attachments.equals(attribName))
{
addToAttachments((ChatAttachment)newElement);
return;
}
super.addToMultiAssoc(attribName, newElement);
}
/**
* Remove from a multi assoc by attribute name
*/
public void removeFromMultiAssoc(String attribName, BaseBusinessClass oldElement) throws StorageException
{
if (MULTIPLEREFERENCE_Attachments.equals(attribName))
{
removeFromAttachments((ChatAttachment)oldElement);
return;
}
super.removeFromMultiAssoc(attribName, oldElement);
}
protected void __loadMultiAssoc (String attribName, BaseBusinessClass[] elements)
{
if (MULTIPLEREFERENCE_Attachments.equals(attribName))
{
_Attachments.__loadAssociation (elements);
return;
}
super.__loadMultiAssoc(attribName, elements);
}
protected boolean __isMultiAssocLoaded (String attribName)
{
if (MULTIPLEREFERENCE_Attachments.equals(attribName))
{
return _Attachments.isLoaded ();
}
return super.__isMultiAssocLoaded(attribName);
}
public FieldWriteability getWriteability_Attachments ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
public int getAttachmentsCount () throws StorageException
{
assertValid();
return _Attachments.getReferencedObjectsCount ();
}
public void addToAttachments (ChatAttachment newElement) throws StorageException
{
if (_Attachments.wouldAddChange (newElement))
{
assertValid();
Debug.assertion (AttributeDecoratorUtils.getWriteability (MULTIPLEREFERENCE_Attachments_Decorators, (Message)this, MULTIPLEREFERENCE_Attachments ,getWriteability_Attachments ()) != FieldWriteability.FALSE, "MultiAssoc Attachments is not writeable (add)");
_Attachments.appendElement (newElement);
try
{
if (newElement.getMessage () != this)
{
newElement.setMessage ((Message)(this));
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
}
}
public void removeFromAttachments (ChatAttachment elementToRemove) throws StorageException
{
if (_Attachments.wouldRemoveChange (elementToRemove))
{
assertValid();
Debug.assertion (AttributeDecoratorUtils.getWriteability (MULTIPLEREFERENCE_Attachments_Decorators, (Message)this, MULTIPLEREFERENCE_Attachments ,getWriteability_Attachments ()) != FieldWriteability.FALSE, "MultiAssoc Attachments is not writeable (remove)");
_Attachments.removeElement (elementToRemove);
try
{
if (elementToRemove.getMessage () != null)
{
elementToRemove.setMessage (null);
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
}
}
public ChatAttachment getAttachmentsAt (int index) throws StorageException
{
return (ChatAttachment)(_Attachments.getElementAt (index));
}
public SortedSet<ChatAttachment> getAttachmentsSet () throws StorageException
{
return _Attachments.getSet ();
}
public void onDelete ()
{
try
{
// Ensure we are removed from any loaded multi-associations that aren't mandatory
if (_JobApplication.isLoaded () || getTransaction ().isObjectLoaded (_JobApplication.getReferencedType (), getJobApplicationID ()))
{
JobApplication referenced = getJobApplication ();
if (referenced != null)
{
// Stop the callback
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null Messages from ", getObjectID (), " to ", referenced.getObjectID ());
_JobApplication.set (null);
referenced.removeFromMessages ((Message)this);
}
}
for(ChatAttachment referenced : CollectionUtils.reverse(getAttachmentsSet()))
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null Message from ", getObjectID (), " to ", referenced.getObjectID ());
referenced.setMessage(null);
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
super.onDelete ();
}
public Message newInstance ()
{
return new Message ();
}
public Message referenceInstance ()
{
return REFERENCE_Message;
}
public Message getInTransaction (ObjectTransaction t) throws StorageException
{
return getMessageByID (t, getObjectID());
}
public BaseBusinessClass dummyInstance ()
{
return DUMMY_Message;
}
public String getBaseSetName ()
{
return "tl_message";
}
/**
* 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_messagePSet = allSets.getPersistentSet (myID, "tl_message", myPSetStatus);
tl_messagePSet.setAttrib (FIELD_ObjectID, myID);
tl_messagePSet.setAttrib (FIELD_SentVia, HELPER_SentVia.toObject (_SentVia)); //
tl_messagePSet.setAttrib (FIELD_MessageContent, HELPER_MessageContent.toObject (_MessageContent)); //
tl_messagePSet.setAttrib (FIELD_IsRead, HELPER_IsRead.toObject (_IsRead)); //
_SentBy.getPersistentSets (allSets);
_WorkFlowMessage.getPersistentSets (allSets);
_JobApplication.getPersistentSets (allSets);
}
/**
* Sets the objects state based on Persistent sets.
*/
public void setFromPersistentSets (ObjectID objectID, PersistentSetCollection allSets)
{
super.setFromPersistentSets (objectID, allSets);
PersistentSet tl_messagePSet = allSets.getPersistentSet (objectID, "tl_message");
_SentVia = (SentVia)(HELPER_SentVia.fromObject (_SentVia, tl_messagePSet.getAttrib (FIELD_SentVia))); //
_MessageContent = (String)(HELPER_MessageContent.fromObject (_MessageContent, tl_messagePSet.getAttrib (FIELD_MessageContent))); //
_IsRead = (Boolean)(HELPER_IsRead.fromObject (_IsRead, tl_messagePSet.getAttrib (FIELD_IsRead))); //
_SentBy.setFromPersistentSets (objectID, allSets);
_WorkFlowMessage.setFromPersistentSets (objectID, allSets);
_JobApplication.setFromPersistentSets (objectID, allSets);
}
public void setAttributesFrom (BaseBusinessClass other, MultiException e)
{
super.setAttributesFrom (other, e);
if (other instanceof Message)
{
Message otherMessage = (Message)other;
try
{
setSentVia (otherMessage.getSentVia ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setMessageContent (otherMessage.getMessageContent ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setIsRead (otherMessage.getIsRead ());
}
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 BaseMessage)
{
BaseMessage sourceMessage = (BaseMessage)(source);
_SentVia = sourceMessage._SentVia;
_MessageContent = sourceMessage._MessageContent;
_IsRead = sourceMessage._IsRead;
}
}
/**
* 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 BaseMessage)
{
BaseMessage sourceMessage = (BaseMessage)(source);
_SentBy.copyFrom (sourceMessage._SentBy, linkToGhosts);
_WorkFlowMessage.copyFrom (sourceMessage._WorkFlowMessage, linkToGhosts);
_JobApplication.copyFrom (sourceMessage._JobApplication, 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 BaseMessage)
{
BaseMessage sourceMessage = (BaseMessage)(source);
_Attachments.copyFrom (sourceMessage._Attachments, linkToGhosts);
}
}
public void validate (ValidationContext context)
{
super.validate (context);
}
/**
* Subclasses must override this to read in their attributes
*/
protected void readExternalData(Map<String, Object> vals) throws IOException, ClassNotFoundException
{
super.readExternalData(vals);
_SentVia = (SentVia)(HELPER_SentVia.readExternal (_SentVia, vals.get(FIELD_SentVia))); //
_MessageContent = (String)(HELPER_MessageContent.readExternal (_MessageContent, vals.get(FIELD_MessageContent))); //
_IsRead = (Boolean)(HELPER_IsRead.readExternal (_IsRead, vals.get(FIELD_IsRead))); //
_SentBy.readExternalData(vals.get(SINGLEREFERENCE_SentBy));
_WorkFlowMessage.readExternalData(vals.get(SINGLEREFERENCE_WorkFlowMessage));
_JobApplication.readExternalData(vals.get(SINGLEREFERENCE_JobApplication));
_Attachments.readExternalData(vals.get(MULTIPLEREFERENCE_Attachments));
}
/**
* Subclasses must override this to write out their attributes
*/
protected void writeExternalData(Map<String, Object> vals) throws IOException
{
super.writeExternalData(vals);
vals.put (FIELD_SentVia, HELPER_SentVia.writeExternal (_SentVia));
vals.put (FIELD_MessageContent, HELPER_MessageContent.writeExternal (_MessageContent));
vals.put (FIELD_IsRead, HELPER_IsRead.writeExternal (_IsRead));
vals.put (SINGLEREFERENCE_SentBy, _SentBy.writeExternalData());
vals.put (SINGLEREFERENCE_WorkFlowMessage, _WorkFlowMessage.writeExternalData());
vals.put (SINGLEREFERENCE_JobApplication, _JobApplication.writeExternalData());
vals.put (MULTIPLEREFERENCE_Attachments, _Attachments.writeExternalData());
}
public void compare (BaseBusinessClass other, AttributeChangeListener listener) throws StorageException
{
super.compare (other, listener);
if (other instanceof BaseMessage)
{
BaseMessage otherMessage = (BaseMessage)(other);
if (!HELPER_SentVia.compare(this._SentVia, otherMessage._SentVia))
{
listener.notifyFieldChange(this, other, FIELD_SentVia, HELPER_SentVia.toObject(this._SentVia), HELPER_SentVia.toObject(otherMessage._SentVia));
}
if (!HELPER_MessageContent.compare(this._MessageContent, otherMessage._MessageContent))
{
listener.notifyFieldChange(this, other, FIELD_MessageContent, HELPER_MessageContent.toObject(this._MessageContent), HELPER_MessageContent.toObject(otherMessage._MessageContent));
}
if (!HELPER_IsRead.compare(this._IsRead, otherMessage._IsRead))
{
listener.notifyFieldChange(this, other, FIELD_IsRead, HELPER_IsRead.toObject(this._IsRead), HELPER_IsRead.toObject(otherMessage._IsRead));
}
// Compare single assocs
_SentBy.compare (otherMessage._SentBy, listener);
_WorkFlowMessage.compare (otherMessage._WorkFlowMessage, listener);
_JobApplication.compare (otherMessage._JobApplication, listener);
// Compare multiple assocs
_Attachments.compare (otherMessage._Attachments, listener);
}
}
public void visitTransients (AttributeVisitor visitor) throws StorageException
{
super.visitAttributes (visitor);
}
public void visitAttributes (AttributeVisitor visitor) throws StorageException
{
super.visitAttributes (visitor);
visitor.visitField(this, FIELD_SentVia, HELPER_SentVia.toObject(getSentVia()));
visitor.visitField(this, FIELD_MessageContent, HELPER_MessageContent.toObject(getMessageContent()));
visitor.visitField(this, FIELD_IsRead, HELPER_IsRead.toObject(getIsRead()));
visitor.visitAssociation (_SentBy);
visitor.visitAssociation (_WorkFlowMessage);
visitor.visitAssociation (_JobApplication);
visitor.visitAssociation (_Attachments);
}
public void visitAssociations (AssociationVisitor visitor, AssociatedScope scope) throws StorageException
{
super.visitAssociations (visitor, scope);
if (scope.includes (_SentBy))
{
visitor.visit (_SentBy);
}
if (scope.includes (_WorkFlowMessage))
{
visitor.visit (_WorkFlowMessage);
}
if (scope.includes (_JobApplication))
{
visitor.visit (_JobApplication);
}
if (scope.includes (_Attachments))
{
visitor.visit (_Attachments);
}
}
public static Message createMessage (ObjectTransaction transaction) throws StorageException
{
Message result = new Message ();
result.initialiseNewObject (transaction);
return result;
}
public static Message getMessageByID (ObjectTransaction transaction, Long objectID) throws StorageException
{
return (Message)(transaction.getObjectByID (REFERENCE_Message, objectID));
}
public boolean testFilter (String attribName, QueryFilter filter) throws StorageException
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_SentVia))
{
return filter.matches (getSentVia ());
}
else if (attribName.equals (FIELD_MessageContent))
{
return filter.matches (getMessageContent ());
}
else if (attribName.equals (FIELD_IsRead))
{
return filter.matches (getIsRead ());
}
else if (attribName.equals (SINGLEREFERENCE_SentBy))
{
return filter.matches (getSentBy ());
}
else if (attribName.equals (SINGLEREFERENCE_WorkFlowMessage))
{
return filter.matches (getWorkFlowMessage ());
}
else if (attribName.equals (SINGLEREFERENCE_JobApplication))
{
return filter.matches (getJobApplication ());
}
else
{
return super.testFilter (attribName, filter);
}
}
public static SearchAll SearchByAll () { return new SearchAll (); }
public static class SearchAll extends SearchObject<Message>
{
public SearchAll andObjectID (QueryFilter<Long> filter)
{
filter.addFilter (context, "tl_message.object_id", FIELD_ObjectID);
return this;
}
public SearchAll andObjectCreated (QueryFilter<Date> filter)
{
filter.addFilter (context, "tl_message.object_created_date", FIELD_ObjectCreated);
return this;
}
public SearchAll andObjectLastModified (QueryFilter<Date> filter)
{
filter.addFilter (context, "tl_message.object_last_updated_date", FIELD_ObjectLastModified);
return this;
}
public SearchAll andSentVia (QueryFilter<SentVia> filter)
{
filter.addFilter (context, "tl_message.sent_via", "SentVia");
return this;
}
public SearchAll andMessageContent (QueryFilter<String> filter)
{
filter.addFilter (context, "tl_message.message_content", "MessageContent");
return this;
}
public SearchAll andIsRead (QueryFilter<Boolean> filter)
{
filter.addFilter (context, "tl_message.is_read", "IsRead");
return this;
}
public SearchAll andSentBy (QueryFilter<SecUser> filter)
{
filter.addFilter (context, "tl_message.sent_by", "SentBy");
return this;
}
public SearchAll andWorkFlowMessage (QueryFilter<WorkFlowMessage> filter)
{
filter.addFilter (context, "tl_message.work_flow_message", "WorkFlowMessage");
return this;
}
public SearchAll andJobApplication (QueryFilter<JobApplication> filter)
{
filter.addFilter (context, "tl_message.job_application_id", "JobApplication");
return this;
}
public Message[] search (ObjectTransaction transaction) throws StorageException
{
BaseBusinessClass[] results = super.search (transaction, REFERENCE_Message, SEARCH_All, criteria);
Set<Message> typedResults = new LinkedHashSet <Message> ();
for (BaseBusinessClass bbcResult : results)
{
Message aResult = (Message)bbcResult;
typedResults.add (aResult);
}
return ObjstoreUtils.removeDeleted(transaction, typedResults).toArray (new Message[0]);
}
}
public static Message[] searchAll (ObjectTransaction transaction) throws StorageException
{
return SearchByAll ()
.search (transaction);
}
public Object getAttribute (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_SentVia))
{
return HELPER_SentVia.toObject (getSentVia ());
}
else if (attribName.equals (FIELD_MessageContent))
{
return HELPER_MessageContent.toObject (getMessageContent ());
}
else if (attribName.equals (FIELD_IsRead))
{
return HELPER_IsRead.toObject (getIsRead ());
}
else
{
return super.getAttribute (attribName);
}
}
public AttributeHelper getAttributeHelper (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_SentVia))
{
return HELPER_SentVia;
}
else if (attribName.equals (FIELD_MessageContent))
{
return HELPER_MessageContent;
}
else if (attribName.equals (FIELD_IsRead))
{
return HELPER_IsRead;
}
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_SentVia))
{
setSentVia ((SentVia)(HELPER_SentVia.fromObject (_SentVia, attribValue)));
}
else if (attribName.equals (FIELD_MessageContent))
{
setMessageContent ((String)(HELPER_MessageContent.fromObject (_MessageContent, attribValue)));
}
else if (attribName.equals (FIELD_IsRead))
{
setIsRead ((Boolean)(HELPER_IsRead.fromObject (_IsRead, attribValue)));
}
else
{
super.setAttribute (attribName, attribValue);
}
}
public boolean isWriteable (String fieldName)
{
return getWriteable (fieldName) == FieldWriteability.TRUE;
}
public boolean isReadable ()
{
return super.isReadable();
}
public boolean isReadable (String fieldName)
{
return super.isReadable(fieldName);
}
public FieldWriteability getWriteable (String fieldName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (fieldName.equals (FIELD_SentVia))
{
return getWriteability_SentVia ();
}
else if (fieldName.equals (FIELD_MessageContent))
{
return getWriteability_MessageContent ();
}
else if (fieldName.equals (FIELD_IsRead))
{
return getWriteability_IsRead ();
}
else if (fieldName.equals (MULTIPLEREFERENCE_Attachments))
{
return getWriteability_Attachments ();
}
else if (fieldName.equals (SINGLEREFERENCE_SentBy))
{
return getWriteability_SentBy ();
}
else if (fieldName.equals (SINGLEREFERENCE_WorkFlowMessage))
{
return getWriteability_WorkFlowMessage ();
}
else if (fieldName.equals (SINGLEREFERENCE_JobApplication))
{
return getWriteability_JobApplication ();
}
else
{
return super.getWriteable (fieldName);
}
}
public void putUnwriteable (Set<String> fields)
{
if (getWriteability_SentVia () != FieldWriteability.TRUE)
{
fields.add (FIELD_SentVia);
}
if (getWriteability_MessageContent () != FieldWriteability.TRUE)
{
fields.add (FIELD_MessageContent);
}
if (getWriteability_IsRead () != FieldWriteability.TRUE)
{
fields.add (FIELD_IsRead);
}
super.putUnwriteable (fields);
}
public String[] getAllTableNames()
{
return new String[] {"tl_message"};
}
public boolean isPolymorphic(String tableName)
{
return super.isPolymorphic(tableName);
}
public List<AbstractAttribute> getAttributes ()
{
List result = super.getAttributes ();
result.add(HELPER_SentVia.getAttribObject (getClass (), _SentVia, false, FIELD_SentVia));
result.add(HELPER_MessageContent.getAttribObject (getClass (), _MessageContent, false, FIELD_MessageContent));
result.add(HELPER_IsRead.getAttribObject (getClass (), _IsRead, false, FIELD_IsRead));
return result;
}
public Map getAttributeMetadata (String attribute)
{
if (ATTRIBUTES_METADATA_Message.containsKey (attribute))
{
return (Map)ATTRIBUTES_METADATA_Message.get (attribute);
}
else
{
return super.getAttributeMetadata (attribute);
}
}
public Object getAttributeMetadata (String attribute, String metadata)
{
if (ATTRIBUTES_METADATA_Message.containsKey (attribute))
{
return ((Map)ATTRIBUTES_METADATA_Message.get (attribute)).get(metadata);
}
else
{
return super.getAttributeMetadata (attribute, metadata);
}
}
public void copyAllAttributeMetadata (Map copyInto)
{
super.copyAllAttributeMetadata(copyInto);
copyInto.putAll(ATTRIBUTES_METADATA_Message);
}
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 MessageBehaviourDecorator extends BaseBusinessClass.BBCBehaviourDecorator<Message>
{
/**
* Get the attribute SentVia
*/
public SentVia getSentVia (Message obj, SentVia original)
{
return original;
}
/**
* Change the value set for attribute SentVia.
* May modify the field beforehand
* Occurs before validation.
*/
public SentVia setSentVia (Message obj, SentVia newSentVia) throws FieldException
{
return newSentVia;
}
/**
* Get the attribute MessageContent
*/
public String getMessageContent (Message obj, String original)
{
return original;
}
/**
* Change the value set for attribute MessageContent.
* May modify the field beforehand
* Occurs before validation.
*/
public String setMessageContent (Message obj, String newMessageContent) throws FieldException
{
return newMessageContent;
}
/**
* Get the attribute IsRead
*/
public Boolean getIsRead (Message obj, Boolean original)
{
return original;
}
/**
* Change the value set for attribute IsRead.
* May modify the field beforehand
* Occurs before validation.
*/
public Boolean setIsRead (Message obj, Boolean newIsRead) throws FieldException
{
return newIsRead;
}
}
@Override
public ORMPipeLine pipes()
{
return new MessagePipeLineFactory<Message, Message> ((Message)this);
}
@Override
public ORMPipeLine pipes(Collection _items)
{
return pipesMessage(_items);
}
/**
* Use this instead of pipes() to get rid of type casting.
*/
public MessagePipeLineFactory<Message, Message> pipelineMessage()
{
return (MessagePipeLineFactory<Message, Message>) pipes();
}
public static MessagePipeLineFactory<Message, Message> pipesMessage(Collection<Message> items)
{
return REFERENCE_Message.new MessagePipeLineFactory<Message, Message> (items);
}
public static MessagePipeLineFactory<Message, Message> pipesMessage(Message[] _items)
{
return pipesMessage(Arrays.asList (_items));
}
public static MessagePipeLineFactory<Message, Message> pipesMessage()
{
return pipesMessage((Collection)null);
}
public class MessagePipeLineFactory<From extends BaseBusinessClass, Me extends Message> extends BaseBusinessClass.ORMPipeLine<From, Me>
{
public <Prev> MessagePipeLineFactory (PipeLine<From, Prev> pipeLine, Pipe<Prev, Me> nextPipe)
{
super (pipeLine, nextPipe);
}
public MessagePipeLineFactory (From seed)
{
super(seed);
}
public MessagePipeLineFactory (Collection<From> seed)
{
super(seed);
}
public PipeLine<From, ? extends Object> to(String name)
{
if (name.equals ("Attachments"))
{
return toAttachments ();
}
if (name.equals ("SentVia"))
{
return toSentVia ();
}
if (name.equals ("MessageContent"))
{
return toMessageContent ();
}
if (name.equals ("IsRead"))
{
return toIsRead ();
}
if (name.equals ("SentBy"))
{
return toSentBy ();
}
if (name.equals ("WorkFlowMessage"))
{
return toWorkFlowMessage ();
}
if (name.equals ("JobApplication"))
{
return toJobApplication ();
}
return super.to(name);
}
public SentVia.SentViaPipeLineFactory<From, SentVia> toSentVia ()
{
return new SentVia.SentViaPipeLineFactory<> (this, new ORMAttributePipe<>(FIELD_SentVia));
}
public PipeLine<From, String> toMessageContent () { return pipe(new ORMAttributePipe<Me, String>(FIELD_MessageContent)); }
public PipeLine<From, Boolean> toIsRead () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_IsRead)); }
public SecUser.SecUserPipeLineFactory<From, SecUser> toSentBy () { return toSentBy (Filter.ALL); }
public SecUser.SecUserPipeLineFactory<From, SecUser> toSentBy (Filter<SecUser> filter)
{
return SecUser.REFERENCE_SecUser.new SecUserPipeLineFactory<From, SecUser> (this, new ORMSingleAssocPipe<Me, SecUser>(SINGLEREFERENCE_SentBy, filter));
}
public WorkFlowMessage.WorkFlowMessagePipeLineFactory<From, WorkFlowMessage> toWorkFlowMessage () { return toWorkFlowMessage (Filter.ALL); }
public WorkFlowMessage.WorkFlowMessagePipeLineFactory<From, WorkFlowMessage> toWorkFlowMessage (Filter<WorkFlowMessage> filter)
{
return WorkFlowMessage.REFERENCE_WorkFlowMessage.new WorkFlowMessagePipeLineFactory<From, WorkFlowMessage> (this, new ORMSingleAssocPipe<Me, WorkFlowMessage>(SINGLEREFERENCE_WorkFlowMessage, filter));
}
public JobApplication.JobApplicationPipeLineFactory<From, JobApplication> toJobApplication () { return toJobApplication (Filter.ALL); }
public JobApplication.JobApplicationPipeLineFactory<From, JobApplication> toJobApplication (Filter<JobApplication> filter)
{
return JobApplication.REFERENCE_JobApplication.new JobApplicationPipeLineFactory<From, JobApplication> (this, new ORMSingleAssocPipe<Me, JobApplication>(SINGLEREFERENCE_JobApplication, filter));
}
public ChatAttachment.ChatAttachmentPipeLineFactory<From, ChatAttachment> toAttachments () { return toAttachments(Filter.ALL); }
public ChatAttachment.ChatAttachmentPipeLineFactory<From, ChatAttachment> toAttachments (Filter<ChatAttachment> filter)
{
return ChatAttachment.REFERENCE_ChatAttachment.new ChatAttachmentPipeLineFactory<From, ChatAttachment> (this, new ORMMultiAssocPipe<Me, ChatAttachment>(MULTIPLEREFERENCE_Attachments, filter));
}
}
public boolean isTransientAttrib(String attribName)
{
return super.isTransientAttrib(attribName);
}
public boolean isTransientSingleReference(String assocName)
{
return super.isTransientSingleReference(assocName);
}
}
class DummyMessage extends Message
{
// Default constructor primarily to support Externalisable
public DummyMessage()
{
super();
}
public void assertValid ()
{
}
public SecUser getSentBy () throws StorageException
{
return (SecUser)(SecUser.DUMMY_SecUser);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getSentByID ()
{
return SecUser.DUMMY_SecUser.getObjectID();
}
public WorkFlowMessage getWorkFlowMessage () throws StorageException
{
return (WorkFlowMessage)(WorkFlowMessage.DUMMY_WorkFlowMessage);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getWorkFlowMessageID ()
{
return WorkFlowMessage.DUMMY_WorkFlowMessage.getObjectID();
}
public JobApplication getJobApplication () throws StorageException
{
return (JobApplication)(JobApplication.DUMMY_JobApplication);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getJobApplicationID ()
{
return JobApplication.DUMMY_JobApplication.getObjectID();
}
public int getAttachmentsCount () throws StorageException
{
return 0;
}
public ChatAttachment getAttachmentsAt (int index) throws StorageException
{
throw new RuntimeException ("No elements in a dummy object in association Attachments");
}
public SortedSet getAttachmentsSet () throws StorageException
{
return new TreeSet();
}
}
......@@ -45,6 +45,10 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
public static final String FIELD_Variance = "Variance";
public static final String FIELD_BusinessHoursOnly = "BusinessHoursOnly";
public static final String FIELD_MessageContent = "MessageContent";
public static final String FIELD_TemplateType = "TemplateType";
public static final String FIELD_IsGlobalTemplate = "IsGlobalTemplate";
public static final String SINGLEREFERENCE_HiringTeam = "HiringTeam";
public static final String BACKREF_HiringTeam = "";
// Static constants corresponding to searches
public static final String SEARCH_All = "All";
......@@ -60,6 +64,8 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
private static final DefaultAttributeHelper<MessageTemplate> HELPER_Variance = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<MessageTemplate> HELPER_BusinessHoursOnly = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<MessageTemplate> HELPER_MessageContent = DefaultAttributeHelper.INSTANCE;
private static final EnumeratedAttributeHelper<MessageTemplate, TemplateType> HELPER_TemplateType = new EnumeratedAttributeHelper<MessageTemplate, TemplateType> (TemplateType.FACTORY_TemplateType);
private static final DefaultAttributeHelper<MessageTemplate> HELPER_IsGlobalTemplate = DefaultAttributeHelper.INSTANCE;
// Private attributes corresponding to business object data
......@@ -72,9 +78,12 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
private Integer _Variance;
private Boolean _BusinessHoursOnly;
private String _MessageContent;
private TemplateType _TemplateType;
private Boolean _IsGlobalTemplate;
// Private attributes corresponding to single references
private SingleAssociation<MessageTemplate, HiringTeam> _HiringTeam;
// Private attributes corresponding to multiple references
......@@ -93,6 +102,8 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
private static final AttributeValidator[] FIELD_Variance_Validators;
private static final AttributeValidator[] FIELD_BusinessHoursOnly_Validators;
private static final AttributeValidator[] FIELD_MessageContent_Validators;
private static final AttributeValidator[] FIELD_TemplateType_Validators;
private static final AttributeValidator[] FIELD_IsGlobalTemplate_Validators;
// Arrays of AttributeDecorators for each attribute
......@@ -105,9 +116,12 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
private static final AttributeDecorator<MessageTemplate, Integer>[] FIELD_Variance_Decorators;
private static final AttributeDecorator<MessageTemplate, Boolean>[] FIELD_BusinessHoursOnly_Decorators;
private static final AttributeDecorator<MessageTemplate, String>[] FIELD_MessageContent_Decorators;
private static final AttributeDecorator<MessageTemplate, TemplateType>[] FIELD_TemplateType_Decorators;
private static final AttributeDecorator<MessageTemplate, Boolean>[] FIELD_IsGlobalTemplate_Decorators;
// Arrays of SingleAssocDecorators for each attribute
private static final SingleAssocDecorator<MessageTemplate, HiringTeam>[] SINGLEREFERENCE_HiringTeam_Decorators;
// Arrays of MultiAssocDecorators for each attribute
......@@ -121,9 +135,11 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
try
{
String tmp_HiringTeam = HiringTeam.BACKREF_MessageTemplates;
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
setupAssocMetaData_HiringTeam();
FIELD_MessageID_Validators = (AttributeValidator[])setupAttribMetaData_MessageID(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_TemplateName_Validators = (AttributeValidator[])setupAttribMetaData_TemplateName(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_Subject_Validators = (AttributeValidator[])setupAttribMetaData_Subject(validatorMapping).toArray (new AttributeValidator[0]);
......@@ -133,6 +149,8 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
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]);
FIELD_TemplateType_Validators = (AttributeValidator[])setupAttribMetaData_TemplateType(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_IsGlobalTemplate_Validators = (AttributeValidator[])setupAttribMetaData_IsGlobalTemplate(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_MessageID_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_MessageTemplate, FIELD_MessageID).toArray (new AttributeDecorator[0]);
FIELD_TemplateName_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_MessageTemplate, FIELD_TemplateName).toArray (new AttributeDecorator[0]);
FIELD_Subject_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_MessageTemplate, FIELD_Subject).toArray (new AttributeDecorator[0]);
......@@ -142,6 +160,9 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
FIELD_Variance_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_MessageTemplate, FIELD_Variance).toArray (new AttributeDecorator[0]);
FIELD_BusinessHoursOnly_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_MessageTemplate, FIELD_BusinessHoursOnly).toArray (new AttributeDecorator[0]);
FIELD_MessageContent_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_MessageTemplate, FIELD_MessageContent).toArray (new AttributeDecorator[0]);
FIELD_TemplateType_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_MessageTemplate, FIELD_TemplateType).toArray (new AttributeDecorator[0]);
FIELD_IsGlobalTemplate_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_MessageTemplate, FIELD_IsGlobalTemplate).toArray (new AttributeDecorator[0]);
SINGLEREFERENCE_HiringTeam_Decorators = (SingleAssocDecorator[])AttributeDecoratorUtils.getSingleAssocDecorators(REFERENCE_MessageTemplate, SINGLEREFERENCE_HiringTeam).toArray (new SingleAssocDecorator[0]);
REFERENCE_MessageTemplate.initialiseReference ();
......@@ -156,6 +177,21 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
}
private static void setupAssocMetaData_HiringTeam()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "MessageTemplates");
metaInfo.put ("dbcol", "hiring_team_id");
metaInfo.put ("mandatory", "false");
metaInfo.put ("name", "HiringTeam");
metaInfo.put ("type", "HiringTeam");
metaInfo.put (METADATA_DB_TABLENAME, "tl_message_template");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for MessageTemplate.HiringTeam:", metaInfo);
ATTRIBUTES_METADATA_MessageTemplate.put (SINGLEREFERENCE_HiringTeam, Collections.unmodifiableMap (metaInfo));
}
private static List setupAttribMetaData_MessageID(Map validatorMapping)
{
Map metaInfo = new HashMap ();
......@@ -327,6 +363,43 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
return validators;
}
private static List setupAttribMetaData_TemplateType(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("attribHelper", "EnumeratedAttributeHelper");
metaInfo.put ("dbcol", "template_type");
metaInfo.put ("mandatory", "false");
metaInfo.put ("name", "TemplateType");
metaInfo.put ("type", "TemplateType");
metaInfo.put (METADATA_DB_TABLENAME, "tl_message_template");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for MessageTemplate.TemplateType:", metaInfo);
ATTRIBUTES_METADATA_MessageTemplate.put (FIELD_TemplateType, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(MessageTemplate.class, "TemplateType", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for MessageTemplate.TemplateType:", validators);
return validators;
}
private static List setupAttribMetaData_IsGlobalTemplate(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "is_global_template");
metaInfo.put ("mandatory", "false");
metaInfo.put ("name", "IsGlobalTemplate");
metaInfo.put ("type", "Boolean");
metaInfo.put (METADATA_DB_TABLENAME, "tl_message_template");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for MessageTemplate.IsGlobalTemplate:", metaInfo);
ATTRIBUTES_METADATA_MessageTemplate.put (FIELD_IsGlobalTemplate, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(MessageTemplate.class, "IsGlobalTemplate", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for MessageTemplate.IsGlobalTemplate:", validators);
return validators;
}
// END OF STATIC METADATA DEFINITION
......@@ -359,6 +432,8 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
_Variance = (Integer)(0);
_BusinessHoursOnly = (Boolean)(Boolean.FALSE);
_MessageContent = (String)(HELPER_MessageContent.initialise (_MessageContent));
_TemplateType = (TemplateType)(HELPER_TemplateType.initialise (_TemplateType));
_IsGlobalTemplate = (Boolean)(HELPER_IsGlobalTemplate.initialise (_IsGlobalTemplate));
}
......@@ -366,6 +441,7 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
{
super._initialiseAssociations ();
_HiringTeam = new SingleAssociation<MessageTemplate, HiringTeam> (this, SINGLEREFERENCE_HiringTeam, HiringTeam.MULTIPLEREFERENCE_MessageTemplates, HiringTeam.REFERENCE_HiringTeam, "tl_message_template");
}
......@@ -374,6 +450,7 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
{
super.initialiseReference ();
_HiringTeam = new SingleAssociation<MessageTemplate, HiringTeam> (this, SINGLEREFERENCE_HiringTeam, HiringTeam.MULTIPLEREFERENCE_MessageTemplates, HiringTeam.REFERENCE_HiringTeam, "tl_message_template");
return this;
......@@ -1285,6 +1362,206 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
}
}
/**
* Attribute TemplateType
*/
public TemplateType getTemplateType ()
{
assertValid();
TemplateType valToReturn = AttributeDecoratorUtils.getValue (FIELD_TemplateType_Decorators, (MessageTemplate)this, FIELD_TemplateType, _TemplateType);
for (MessageTemplateBehaviourDecorator bhd : MessageTemplate_BehaviourDecorators)
{
valToReturn = bhd.getTemplateType ((MessageTemplate)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 preTemplateTypeChange (TemplateType newTemplateType) 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 postTemplateTypeChange () throws FieldException
{
}
public FieldWriteability getWriteability_TemplateType ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute TemplateType. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setTemplateType (TemplateType newTemplateType) throws FieldException
{
newTemplateType = AttributeDecoratorUtils.setValue (FIELD_TemplateType_Decorators, (MessageTemplate)this, FIELD_TemplateType, newTemplateType);
boolean oldAndNewIdentical = HELPER_TemplateType.compare (_TemplateType, newTemplateType);
try
{
for (MessageTemplateBehaviourDecorator bhd : MessageTemplate_BehaviourDecorators)
{
newTemplateType = bhd.setTemplateType ((MessageTemplate)this, newTemplateType);
oldAndNewIdentical = HELPER_TemplateType.compare (_TemplateType, newTemplateType);
}
if (FIELD_TemplateType_Validators.length > 0)
{
Object newTemplateTypeObj = HELPER_TemplateType.toObject (newTemplateType);
if (newTemplateTypeObj != null)
{
int loopMax = FIELD_TemplateType_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_MessageTemplate.get (FIELD_TemplateType);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_TemplateType_Validators[v].checkAttribute (this, FIELD_TemplateType, metadata, newTemplateTypeObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (AttributeDecoratorUtils.getWriteability (FIELD_TemplateType_Decorators, (MessageTemplate)this, FIELD_TemplateType ,getWriteability_TemplateType ()) != FieldWriteability.FALSE, "Field TemplateType is not writeable");
preTemplateTypeChange (newTemplateType);
markFieldChange (FIELD_TemplateType);
_TemplateType = newTemplateType;
postFieldChange (FIELD_TemplateType);
postTemplateTypeChange ();
}
}
/**
* Attribute IsGlobalTemplate
*/
public Boolean getIsGlobalTemplate ()
{
assertValid();
Boolean valToReturn = AttributeDecoratorUtils.getValue (FIELD_IsGlobalTemplate_Decorators, (MessageTemplate)this, FIELD_IsGlobalTemplate, _IsGlobalTemplate);
for (MessageTemplateBehaviourDecorator bhd : MessageTemplate_BehaviourDecorators)
{
valToReturn = bhd.getIsGlobalTemplate ((MessageTemplate)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 preIsGlobalTemplateChange (Boolean newIsGlobalTemplate) 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 postIsGlobalTemplateChange () throws FieldException
{
}
public FieldWriteability getWriteability_IsGlobalTemplate ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute IsGlobalTemplate. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setIsGlobalTemplate (Boolean newIsGlobalTemplate) throws FieldException
{
newIsGlobalTemplate = AttributeDecoratorUtils.setValue (FIELD_IsGlobalTemplate_Decorators, (MessageTemplate)this, FIELD_IsGlobalTemplate, newIsGlobalTemplate);
boolean oldAndNewIdentical = HELPER_IsGlobalTemplate.compare (_IsGlobalTemplate, newIsGlobalTemplate);
try
{
for (MessageTemplateBehaviourDecorator bhd : MessageTemplate_BehaviourDecorators)
{
newIsGlobalTemplate = bhd.setIsGlobalTemplate ((MessageTemplate)this, newIsGlobalTemplate);
oldAndNewIdentical = HELPER_IsGlobalTemplate.compare (_IsGlobalTemplate, newIsGlobalTemplate);
}
if (FIELD_IsGlobalTemplate_Validators.length > 0)
{
Object newIsGlobalTemplateObj = HELPER_IsGlobalTemplate.toObject (newIsGlobalTemplate);
if (newIsGlobalTemplateObj != null)
{
int loopMax = FIELD_IsGlobalTemplate_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_MessageTemplate.get (FIELD_IsGlobalTemplate);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_IsGlobalTemplate_Validators[v].checkAttribute (this, FIELD_IsGlobalTemplate, metadata, newIsGlobalTemplateObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (AttributeDecoratorUtils.getWriteability (FIELD_IsGlobalTemplate_Decorators, (MessageTemplate)this, FIELD_IsGlobalTemplate ,getWriteability_IsGlobalTemplate ()) != FieldWriteability.FALSE, "Field IsGlobalTemplate is not writeable");
preIsGlobalTemplateChange (newIsGlobalTemplate);
markFieldChange (FIELD_IsGlobalTemplate);
_IsGlobalTemplate = newIsGlobalTemplate;
postFieldChange (FIELD_IsGlobalTemplate);
postIsGlobalTemplateChange ();
}
}
/**
......@@ -1294,6 +1571,7 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
{
List result = super.getSingleAssocs ();
result.add("HiringTeam");
return result;
}
......@@ -1305,6 +1583,10 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_HiringTeam))
{
return _HiringTeam.getReferencedType ();
}
else
{
return super.getSingleAssocReferenceInstance (assocName);
......@@ -1318,6 +1600,10 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_HiringTeam))
{
return HiringTeam.MULTIPLEREFERENCE_MessageTemplates ;
}
else
{
return super.getSingleAssocBackReference (assocName);
......@@ -1331,6 +1617,10 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_HiringTeam))
{
return getHiringTeam ();
}
else
{
return super.getSingleAssoc (assocName);
......@@ -1344,6 +1634,10 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_HiringTeam))
{
return getHiringTeam (getType);
}
else
{
return super.getSingleAssoc (assocName, getType);
......@@ -1357,6 +1651,10 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_HiringTeam))
{
return getHiringTeamID ();
}
else
{
return super.getSingleAssocID (assocName);
......@@ -1370,6 +1668,10 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_HiringTeam))
{
setHiringTeam ((HiringTeam)(newValue));
}
else
{
super.setSingleAssoc (assocName, newValue);
......@@ -1379,6 +1681,110 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
/**
* Get the reference HiringTeam
*/
public HiringTeam getHiringTeam () throws StorageException
{
assertValid();
try
{
return (HiringTeam)(_HiringTeam.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in MessageTemplate:", this.getObjectID (), ", was trying to get HiringTeam:", getHiringTeamID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _HiringTeam.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public HiringTeam getHiringTeam (Get getType) throws StorageException
{
assertValid();
return _HiringTeam.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getHiringTeamID ()
{
assertValid();
if (_HiringTeam == null)
{
return null;
}
else
{
return _HiringTeam.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 preHiringTeamChange (HiringTeam newHiringTeam) 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 postHiringTeamChange () throws FieldException
{
}
public FieldWriteability getWriteability_HiringTeam ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference HiringTeam. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setHiringTeam (HiringTeam newHiringTeam) throws StorageException, FieldException
{
if (_HiringTeam.wouldReferencedChange (newHiringTeam))
{
assertValid();
Debug.assertion (AttributeDecoratorUtils.getWriteability (SINGLEREFERENCE_HiringTeam_Decorators, (MessageTemplate)this, SINGLEREFERENCE_HiringTeam ,getWriteability_HiringTeam ()) != FieldWriteability.FALSE, "Assoc HiringTeam is not writeable");
preHiringTeamChange (newHiringTeam);
HiringTeam oldHiringTeam = getHiringTeam ();
if (oldHiringTeam != null)
{
// This is to stop validation from triggering when we are removed
_HiringTeam.set (null);
oldHiringTeam.removeFromMessageTemplates ((MessageTemplate)(this));
}
_HiringTeam.set (newHiringTeam);
if (newHiringTeam != null)
{
newHiringTeam.addToMessageTemplates ((MessageTemplate)(this));
}
postHiringTeamChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getMultiAssocs()
......@@ -1466,6 +1872,20 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
{
try
{
// Ensure we are removed from any loaded multi-associations that aren't mandatory
if (_HiringTeam.isLoaded () || getTransaction ().isObjectLoaded (_HiringTeam.getReferencedType (), getHiringTeamID ()))
{
HiringTeam referenced = getHiringTeam ();
if (referenced != null)
{
// Stop the callback
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null MessageTemplates from ", getObjectID (), " to ", referenced.getObjectID ());
_HiringTeam.set (null);
referenced.removeFromMessageTemplates ((MessageTemplate)this);
}
}
}
catch (Exception e)
{
......@@ -1532,6 +1952,9 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
tl_message_templatePSet.setAttrib (FIELD_Variance, HELPER_Variance.toObject (_Variance)); //
tl_message_templatePSet.setAttrib (FIELD_BusinessHoursOnly, HELPER_BusinessHoursOnly.toObject (_BusinessHoursOnly)); //
tl_message_templatePSet.setAttrib (FIELD_MessageContent, HELPER_MessageContent.toObject (_MessageContent)); //
tl_message_templatePSet.setAttrib (FIELD_TemplateType, HELPER_TemplateType.toObject (_TemplateType)); //
tl_message_templatePSet.setAttrib (FIELD_IsGlobalTemplate, HELPER_IsGlobalTemplate.toObject (_IsGlobalTemplate)); //
_HiringTeam.getPersistentSets (allSets);
}
......@@ -1554,6 +1977,9 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
_Variance = (Integer)(HELPER_Variance.fromObject (_Variance, tl_message_templatePSet.getAttrib (FIELD_Variance))); //
_BusinessHoursOnly = (Boolean)(HELPER_BusinessHoursOnly.fromObject (_BusinessHoursOnly, tl_message_templatePSet.getAttrib (FIELD_BusinessHoursOnly))); //
_MessageContent = (String)(HELPER_MessageContent.fromObject (_MessageContent, tl_message_templatePSet.getAttrib (FIELD_MessageContent))); //
_TemplateType = (TemplateType)(HELPER_TemplateType.fromObject (_TemplateType, tl_message_templatePSet.getAttrib (FIELD_TemplateType))); //
_IsGlobalTemplate = (Boolean)(HELPER_IsGlobalTemplate.fromObject (_IsGlobalTemplate, tl_message_templatePSet.getAttrib (FIELD_IsGlobalTemplate))); //
_HiringTeam.setFromPersistentSets (objectID, allSets);
}
......@@ -1647,6 +2073,24 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
{
e.addException (ex);
}
try
{
setTemplateType (otherMessageTemplate.getTemplateType ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setIsGlobalTemplate (otherMessageTemplate.getIsGlobalTemplate ());
}
catch (FieldException ex)
{
e.addException (ex);
}
}
}
......@@ -1671,6 +2115,8 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
_Variance = sourceMessageTemplate._Variance;
_BusinessHoursOnly = sourceMessageTemplate._BusinessHoursOnly;
_MessageContent = sourceMessageTemplate._MessageContent;
_TemplateType = sourceMessageTemplate._TemplateType;
_IsGlobalTemplate = sourceMessageTemplate._IsGlobalTemplate;
}
}
......@@ -1687,6 +2133,7 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
{
BaseMessageTemplate sourceMessageTemplate = (BaseMessageTemplate)(source);
_HiringTeam.copyFrom (sourceMessageTemplate._HiringTeam, linkToGhosts);
}
}
......@@ -1732,6 +2179,9 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
_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))); //
_TemplateType = (TemplateType)(HELPER_TemplateType.readExternal (_TemplateType, vals.get(FIELD_TemplateType))); //
_IsGlobalTemplate = (Boolean)(HELPER_IsGlobalTemplate.readExternal (_IsGlobalTemplate, vals.get(FIELD_IsGlobalTemplate))); //
_HiringTeam.readExternalData(vals.get(SINGLEREFERENCE_HiringTeam));
}
......@@ -1752,6 +2202,9 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
vals.put (FIELD_Variance, HELPER_Variance.writeExternal (_Variance));
vals.put (FIELD_BusinessHoursOnly, HELPER_BusinessHoursOnly.writeExternal (_BusinessHoursOnly));
vals.put (FIELD_MessageContent, HELPER_MessageContent.writeExternal (_MessageContent));
vals.put (FIELD_TemplateType, HELPER_TemplateType.writeExternal (_TemplateType));
vals.put (FIELD_IsGlobalTemplate, HELPER_IsGlobalTemplate.writeExternal (_IsGlobalTemplate));
vals.put (SINGLEREFERENCE_HiringTeam, _HiringTeam.writeExternalData());
}
......@@ -1801,8 +2254,17 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
{
listener.notifyFieldChange(this, other, FIELD_MessageContent, HELPER_MessageContent.toObject(this._MessageContent), HELPER_MessageContent.toObject(otherMessageTemplate._MessageContent));
}
if (!HELPER_TemplateType.compare(this._TemplateType, otherMessageTemplate._TemplateType))
{
listener.notifyFieldChange(this, other, FIELD_TemplateType, HELPER_TemplateType.toObject(this._TemplateType), HELPER_TemplateType.toObject(otherMessageTemplate._TemplateType));
}
if (!HELPER_IsGlobalTemplate.compare(this._IsGlobalTemplate, otherMessageTemplate._IsGlobalTemplate))
{
listener.notifyFieldChange(this, other, FIELD_IsGlobalTemplate, HELPER_IsGlobalTemplate.toObject(this._IsGlobalTemplate), HELPER_IsGlobalTemplate.toObject(otherMessageTemplate._IsGlobalTemplate));
}
// Compare single assocs
_HiringTeam.compare (otherMessageTemplate._HiringTeam, listener);
// Compare multiple assocs
......@@ -1832,6 +2294,9 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
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()));
visitor.visitField(this, FIELD_TemplateType, HELPER_TemplateType.toObject(getTemplateType()));
visitor.visitField(this, FIELD_IsGlobalTemplate, HELPER_IsGlobalTemplate.toObject(getIsGlobalTemplate()));
visitor.visitAssociation (_HiringTeam);
}
......@@ -1840,6 +2305,10 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
{
super.visitAssociations (visitor, scope);
if (scope.includes (_HiringTeam))
{
visitor.visit (_HiringTeam);
}
}
......@@ -1901,6 +2370,18 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
{
return filter.matches (getMessageContent ());
}
else if (attribName.equals (FIELD_TemplateType))
{
return filter.matches (getTemplateType ());
}
else if (attribName.equals (FIELD_IsGlobalTemplate))
{
return filter.matches (getIsGlobalTemplate ());
}
else if (attribName.equals (SINGLEREFERENCE_HiringTeam))
{
return filter.matches (getHiringTeam ());
}
else
{
return super.testFilter (attribName, filter);
......@@ -1985,6 +2466,24 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
return this;
}
public SearchAll andTemplateType (QueryFilter<TemplateType> filter)
{
filter.addFilter (context, "tl_message_template.template_type", "TemplateType");
return this;
}
public SearchAll andIsGlobalTemplate (QueryFilter<Boolean> filter)
{
filter.addFilter (context, "tl_message_template.is_global_template", "IsGlobalTemplate");
return this;
}
public SearchAll andHiringTeam (QueryFilter<HiringTeam> filter)
{
filter.addFilter (context, "tl_message_template.hiring_team_id", "HiringTeam");
return this;
}
public MessageTemplate[] search (ObjectTransaction transaction) throws StorageException
{
......@@ -2053,6 +2552,14 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
{
return HELPER_MessageContent.toObject (getMessageContent ());
}
else if (attribName.equals (FIELD_TemplateType))
{
return HELPER_TemplateType.toObject (getTemplateType ());
}
else if (attribName.equals (FIELD_IsGlobalTemplate))
{
return HELPER_IsGlobalTemplate.toObject (getIsGlobalTemplate ());
}
else
{
return super.getAttribute (attribName);
......@@ -2102,6 +2609,14 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
{
return HELPER_MessageContent;
}
else if (attribName.equals (FIELD_TemplateType))
{
return HELPER_TemplateType;
}
else if (attribName.equals (FIELD_IsGlobalTemplate))
{
return HELPER_IsGlobalTemplate;
}
else
{
return super.getAttributeHelper (attribName);
......@@ -2151,6 +2666,14 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
{
setMessageContent ((String)(HELPER_MessageContent.fromObject (_MessageContent, attribValue)));
}
else if (attribName.equals (FIELD_TemplateType))
{
setTemplateType ((TemplateType)(HELPER_TemplateType.fromObject (_TemplateType, attribValue)));
}
else if (attribName.equals (FIELD_IsGlobalTemplate))
{
setIsGlobalTemplate ((Boolean)(HELPER_IsGlobalTemplate.fromObject (_IsGlobalTemplate, attribValue)));
}
else
{
super.setAttribute (attribName, attribValue);
......@@ -2217,6 +2740,18 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
{
return getWriteability_MessageContent ();
}
else if (fieldName.equals (FIELD_TemplateType))
{
return getWriteability_TemplateType ();
}
else if (fieldName.equals (FIELD_IsGlobalTemplate))
{
return getWriteability_IsGlobalTemplate ();
}
else if (fieldName.equals (SINGLEREFERENCE_HiringTeam))
{
return getWriteability_HiringTeam ();
}
else
{
return super.getWriteable (fieldName);
......@@ -2271,6 +2806,16 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
fields.add (FIELD_MessageContent);
}
if (getWriteability_TemplateType () != FieldWriteability.TRUE)
{
fields.add (FIELD_TemplateType);
}
if (getWriteability_IsGlobalTemplate () != FieldWriteability.TRUE)
{
fields.add (FIELD_IsGlobalTemplate);
}
super.putUnwriteable (fields);
}
......@@ -2300,6 +2845,8 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
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, true, FIELD_MessageContent));
result.add(HELPER_TemplateType.getAttribObject (getClass (), _TemplateType, false, FIELD_TemplateType));
result.add(HELPER_IsGlobalTemplate.getAttribObject (getClass (), _IsGlobalTemplate, false, FIELD_IsGlobalTemplate));
return result;
}
......@@ -2519,6 +3066,42 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
return newMessageContent;
}
/**
* Get the attribute TemplateType
*/
public TemplateType getTemplateType (MessageTemplate obj, TemplateType original)
{
return original;
}
/**
* Change the value set for attribute TemplateType.
* May modify the field beforehand
* Occurs before validation.
*/
public TemplateType setTemplateType (MessageTemplate obj, TemplateType newTemplateType) throws FieldException
{
return newTemplateType;
}
/**
* Get the attribute IsGlobalTemplate
*/
public Boolean getIsGlobalTemplate (MessageTemplate obj, Boolean original)
{
return original;
}
/**
* Change the value set for attribute IsGlobalTemplate.
* May modify the field beforehand
* Occurs before validation.
*/
public Boolean setIsGlobalTemplate (MessageTemplate obj, Boolean newIsGlobalTemplate) throws FieldException
{
return newIsGlobalTemplate;
}
}
@Override
......@@ -2613,6 +3196,18 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
{
return toMessageContent ();
}
if (name.equals ("TemplateType"))
{
return toTemplateType ();
}
if (name.equals ("IsGlobalTemplate"))
{
return toIsGlobalTemplate ();
}
if (name.equals ("HiringTeam"))
{
return toHiringTeam ();
}
return super.to(name);
......@@ -2639,6 +3234,20 @@ public abstract class BaseMessageTemplate extends BaseBusinessClass
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 TemplateType.TemplateTypePipeLineFactory<From, TemplateType> toTemplateType ()
{
return new TemplateType.TemplateTypePipeLineFactory<> (this, new ORMAttributePipe<>(FIELD_TemplateType));
}
public PipeLine<From, Boolean> toIsGlobalTemplate () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_IsGlobalTemplate)); }
public HiringTeam.HiringTeamPipeLineFactory<From, HiringTeam> toHiringTeam () { return toHiringTeam (Filter.ALL); }
public HiringTeam.HiringTeamPipeLineFactory<From, HiringTeam> toHiringTeam (Filter<HiringTeam> filter)
{
return HiringTeam.REFERENCE_HiringTeam.new HiringTeamPipeLineFactory<From, HiringTeam> (this, new ORMSingleAssocPipe<Me, HiringTeam>(SINGLEREFERENCE_HiringTeam, filter));
}
}
public boolean isTransientAttrib(String attribName)
......@@ -2669,5 +3278,19 @@ class DummyMessageTemplate extends MessageTemplate
}
public HiringTeam getHiringTeam () throws StorageException
{
return (HiringTeam)(HiringTeam.DUMMY_HiringTeam);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getHiringTeamID ()
{
return HiringTeam.DUMMY_HiringTeam.getObjectID();
}
}
/*
* IMPORTANT!!!! XSL Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure9.0 [oneit.objstore.BusinessObjectTemplate.xsl]
* Vendor: Apache Software Foundation (Xalan XSLTC) (Version: 1.0)
*/
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.*;
public abstract class BaseWorkFlowMessage extends BaseBusinessClass
{
// Reference instance for the object
public static final WorkFlowMessage REFERENCE_WorkFlowMessage = new WorkFlowMessage ();
// Reference instance for the object
public static final WorkFlowMessage DUMMY_WorkFlowMessage = new DummyWorkFlowMessage ();
// Static constants corresponding to field names
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_IsWithdrawalMessage = "IsWithdrawalMessage";
public static final String SINGLEREFERENCE_MessageTemplate = "MessageTemplate";
public static final String SINGLEREFERENCE_WorkFlowStage = "WorkFlowStage";
public static final String BACKREF_WorkFlowStage = "";
// Static constants corresponding to searches
public static final String SEARCH_All = "All";
// Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper<WorkFlowMessage> HELPER_Delay = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<WorkFlowMessage> HELPER_Variance = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<WorkFlowMessage> HELPER_BusinessHoursOnly = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<WorkFlowMessage> HELPER_IsWithdrawalMessage = DefaultAttributeHelper.INSTANCE;
// Private attributes corresponding to business object data
private String _Delay;
private String _Variance;
private Boolean _BusinessHoursOnly;
private Boolean _IsWithdrawalMessage;
// Private attributes corresponding to single references
private SingleAssociation<WorkFlowMessage, MessageTemplate> _MessageTemplate;
private SingleAssociation<WorkFlowMessage, WorkFlowStage> _WorkFlowStage;
// Private attributes corresponding to multiple references
// Map of maps of metadata
private static final Map ATTRIBUTES_METADATA_WorkFlowMessage = new LinkedHashMap ();
// Arrays of validators for each attribute
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_IsWithdrawalMessage_Validators;
// Arrays of AttributeDecorators for each attribute
private static final AttributeDecorator<WorkFlowMessage, String>[] FIELD_Delay_Decorators;
private static final AttributeDecorator<WorkFlowMessage, String>[] FIELD_Variance_Decorators;
private static final AttributeDecorator<WorkFlowMessage, Boolean>[] FIELD_BusinessHoursOnly_Decorators;
private static final AttributeDecorator<WorkFlowMessage, Boolean>[] FIELD_IsWithdrawalMessage_Decorators;
// Arrays of SingleAssocDecorators for each attribute
private static final SingleAssocDecorator<WorkFlowMessage, MessageTemplate>[] SINGLEREFERENCE_MessageTemplate_Decorators;
private static final SingleAssocDecorator<WorkFlowMessage, WorkFlowStage>[] SINGLEREFERENCE_WorkFlowStage_Decorators;
// Arrays of MultiAssocDecorators for each attribute
// Arrays of behaviour decorators
private static final WorkFlowMessageBehaviourDecorator[] WorkFlowMessage_BehaviourDecorators;
static
{
try
{
String tmp_WorkFlowStage = WorkFlowStage.BACKREF_WorkFlowMessages;
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
setupAssocMetaData_MessageTemplate();
setupAssocMetaData_WorkFlowStage();
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_IsWithdrawalMessage_Validators = (AttributeValidator[])setupAttribMetaData_IsWithdrawalMessage(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_Delay_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_WorkFlowMessage, FIELD_Delay).toArray (new AttributeDecorator[0]);
FIELD_Variance_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_WorkFlowMessage, FIELD_Variance).toArray (new AttributeDecorator[0]);
FIELD_BusinessHoursOnly_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_WorkFlowMessage, FIELD_BusinessHoursOnly).toArray (new AttributeDecorator[0]);
FIELD_IsWithdrawalMessage_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_WorkFlowMessage, FIELD_IsWithdrawalMessage).toArray (new AttributeDecorator[0]);
SINGLEREFERENCE_MessageTemplate_Decorators = (SingleAssocDecorator[])AttributeDecoratorUtils.getSingleAssocDecorators(REFERENCE_WorkFlowMessage, SINGLEREFERENCE_MessageTemplate).toArray (new SingleAssocDecorator[0]);
SINGLEREFERENCE_WorkFlowStage_Decorators = (SingleAssocDecorator[])AttributeDecoratorUtils.getSingleAssocDecorators(REFERENCE_WorkFlowMessage, SINGLEREFERENCE_WorkFlowStage).toArray (new SingleAssocDecorator[0]);
REFERENCE_WorkFlowMessage.initialiseReference ();
DUMMY_WorkFlowMessage.initialiseReference ();
WorkFlowMessage_BehaviourDecorators = BaseBusinessClass.getBBCBehaviours(WorkFlowMessage.class).toArray(new WorkFlowMessageBehaviourDecorator[0]);
}
catch (RuntimeException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR1, e, "Error initialising");
throw e;
}
}
private static void setupAssocMetaData_MessageTemplate()
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "message_template_id");
metaInfo.put ("name", "MessageTemplate");
metaInfo.put ("type", "MessageTemplate");
metaInfo.put (METADATA_DB_TABLENAME, "tl_work_flow_message");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for WorkFlowMessage.MessageTemplate:", metaInfo);
ATTRIBUTES_METADATA_WorkFlowMessage.put (SINGLEREFERENCE_MessageTemplate, Collections.unmodifiableMap (metaInfo));
}
private static void setupAssocMetaData_WorkFlowStage()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "WorkFlowMessages");
metaInfo.put ("dbcol", "work_flow_stage_id");
metaInfo.put ("mandatory", "false");
metaInfo.put ("name", "WorkFlowStage");
metaInfo.put ("type", "WorkFlowStage");
metaInfo.put (METADATA_DB_TABLENAME, "tl_work_flow_message");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for WorkFlowMessage.WorkFlowStage:", metaInfo);
ATTRIBUTES_METADATA_WorkFlowMessage.put (SINGLEREFERENCE_WorkFlowStage, Collections.unmodifiableMap (metaInfo));
}
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", "String");
metaInfo.put (METADATA_DB_TABLENAME, "tl_work_flow_message");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for WorkFlowMessage.Delay:", metaInfo);
ATTRIBUTES_METADATA_WorkFlowMessage.put (FIELD_Delay, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(WorkFlowMessage.class, "Delay", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for WorkFlowMessage.Delay:", validators);
return validators;
}
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", "String");
metaInfo.put (METADATA_DB_TABLENAME, "tl_work_flow_message");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for WorkFlowMessage.Variance:", metaInfo);
ATTRIBUTES_METADATA_WorkFlowMessage.put (FIELD_Variance, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(WorkFlowMessage.class, "Variance", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for WorkFlowMessage.Variance:", validators);
return validators;
}
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");
metaInfo.put (METADATA_DB_TABLENAME, "tl_work_flow_message");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for WorkFlowMessage.BusinessHoursOnly:", metaInfo);
ATTRIBUTES_METADATA_WorkFlowMessage.put (FIELD_BusinessHoursOnly, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(WorkFlowMessage.class, "BusinessHoursOnly", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for WorkFlowMessage.BusinessHoursOnly:", validators);
return validators;
}
private static List setupAttribMetaData_IsWithdrawalMessage(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "is_withdrawal_message");
metaInfo.put ("mandatory", "false");
metaInfo.put ("name", "IsWithdrawalMessage");
metaInfo.put ("type", "Boolean");
metaInfo.put (METADATA_DB_TABLENAME, "tl_work_flow_message");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for WorkFlowMessage.IsWithdrawalMessage:", metaInfo);
ATTRIBUTES_METADATA_WorkFlowMessage.put (FIELD_IsWithdrawalMessage, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(WorkFlowMessage.class, "IsWithdrawalMessage", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for WorkFlowMessage.IsWithdrawalMessage:", validators);
return validators;
}
// END OF STATIC METADATA DEFINITION
// This constructor should not be called
protected BaseWorkFlowMessage ()
{
}
protected BBCBehaviourDecorator[] getBehaviours()
{
return WorkFlowMessage_BehaviourDecorators;
}
protected void _initialiseNewObjAttributes (ObjectTransaction transaction) throws StorageException
{
super._initialiseNewObjAttributes (transaction);
_Delay = (String)(HELPER_Delay.initialise (_Delay));
_Variance = (String)(HELPER_Variance.initialise (_Variance));
_BusinessHoursOnly = (Boolean)(HELPER_BusinessHoursOnly.initialise (_BusinessHoursOnly));
_IsWithdrawalMessage = (Boolean)(HELPER_IsWithdrawalMessage.initialise (_IsWithdrawalMessage));
}
protected void _initialiseAssociations ()
{
super._initialiseAssociations ();
_MessageTemplate = new SingleAssociation<WorkFlowMessage, MessageTemplate> (this, SINGLEREFERENCE_MessageTemplate, null, MessageTemplate.REFERENCE_MessageTemplate, "tl_work_flow_message");
_WorkFlowStage = new SingleAssociation<WorkFlowMessage, WorkFlowStage> (this, SINGLEREFERENCE_WorkFlowStage, WorkFlowStage.MULTIPLEREFERENCE_WorkFlowMessages, WorkFlowStage.REFERENCE_WorkFlowStage, "tl_work_flow_message");
}
protected BaseBusinessClass initialiseReference ()
{
super.initialiseReference ();
_MessageTemplate = new SingleAssociation<WorkFlowMessage, MessageTemplate> (this, SINGLEREFERENCE_MessageTemplate, null, MessageTemplate.REFERENCE_MessageTemplate, "tl_work_flow_message");
_WorkFlowStage = new SingleAssociation<WorkFlowMessage, WorkFlowStage> (this, SINGLEREFERENCE_WorkFlowStage, WorkFlowStage.MULTIPLEREFERENCE_WorkFlowMessages, WorkFlowStage.REFERENCE_WorkFlowStage, "tl_work_flow_message");
return this;
}
/**
* Attribute Delay
*/
public String getDelay ()
{
assertValid();
String valToReturn = AttributeDecoratorUtils.getValue (FIELD_Delay_Decorators, (WorkFlowMessage)this, FIELD_Delay, _Delay);
for (WorkFlowMessageBehaviourDecorator bhd : WorkFlowMessage_BehaviourDecorators)
{
valToReturn = bhd.getDelay ((WorkFlowMessage)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 (String 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 (String newDelay) throws FieldException
{
newDelay = AttributeDecoratorUtils.setValue (FIELD_Delay_Decorators, (WorkFlowMessage)this, FIELD_Delay, newDelay);
boolean oldAndNewIdentical = HELPER_Delay.compare (_Delay, newDelay);
try
{
for (WorkFlowMessageBehaviourDecorator bhd : WorkFlowMessage_BehaviourDecorators)
{
newDelay = bhd.setDelay ((WorkFlowMessage)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_WorkFlowMessage.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 (AttributeDecoratorUtils.getWriteability (FIELD_Delay_Decorators, (WorkFlowMessage)this, FIELD_Delay ,getWriteability_Delay ()) != FieldWriteability.FALSE, "Field Delay is not writeable");
preDelayChange (newDelay);
markFieldChange (FIELD_Delay);
_Delay = newDelay;
postFieldChange (FIELD_Delay);
postDelayChange ();
}
}
/**
* Attribute Variance
*/
public String getVariance ()
{
assertValid();
String valToReturn = AttributeDecoratorUtils.getValue (FIELD_Variance_Decorators, (WorkFlowMessage)this, FIELD_Variance, _Variance);
for (WorkFlowMessageBehaviourDecorator bhd : WorkFlowMessage_BehaviourDecorators)
{
valToReturn = bhd.getVariance ((WorkFlowMessage)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 (String 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 (String newVariance) throws FieldException
{
newVariance = AttributeDecoratorUtils.setValue (FIELD_Variance_Decorators, (WorkFlowMessage)this, FIELD_Variance, newVariance);
boolean oldAndNewIdentical = HELPER_Variance.compare (_Variance, newVariance);
try
{
for (WorkFlowMessageBehaviourDecorator bhd : WorkFlowMessage_BehaviourDecorators)
{
newVariance = bhd.setVariance ((WorkFlowMessage)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_WorkFlowMessage.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 (AttributeDecoratorUtils.getWriteability (FIELD_Variance_Decorators, (WorkFlowMessage)this, FIELD_Variance ,getWriteability_Variance ()) != FieldWriteability.FALSE, "Field Variance is not writeable");
preVarianceChange (newVariance);
markFieldChange (FIELD_Variance);
_Variance = newVariance;
postFieldChange (FIELD_Variance);
postVarianceChange ();
}
}
/**
* Attribute BusinessHoursOnly
*/
public Boolean getBusinessHoursOnly ()
{
assertValid();
Boolean valToReturn = AttributeDecoratorUtils.getValue (FIELD_BusinessHoursOnly_Decorators, (WorkFlowMessage)this, FIELD_BusinessHoursOnly, _BusinessHoursOnly);
for (WorkFlowMessageBehaviourDecorator bhd : WorkFlowMessage_BehaviourDecorators)
{
valToReturn = bhd.getBusinessHoursOnly ((WorkFlowMessage)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
{
newBusinessHoursOnly = AttributeDecoratorUtils.setValue (FIELD_BusinessHoursOnly_Decorators, (WorkFlowMessage)this, FIELD_BusinessHoursOnly, newBusinessHoursOnly);
boolean oldAndNewIdentical = HELPER_BusinessHoursOnly.compare (_BusinessHoursOnly, newBusinessHoursOnly);
try
{
for (WorkFlowMessageBehaviourDecorator bhd : WorkFlowMessage_BehaviourDecorators)
{
newBusinessHoursOnly = bhd.setBusinessHoursOnly ((WorkFlowMessage)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_WorkFlowMessage.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 (AttributeDecoratorUtils.getWriteability (FIELD_BusinessHoursOnly_Decorators, (WorkFlowMessage)this, FIELD_BusinessHoursOnly ,getWriteability_BusinessHoursOnly ()) != FieldWriteability.FALSE, "Field BusinessHoursOnly is not writeable");
preBusinessHoursOnlyChange (newBusinessHoursOnly);
markFieldChange (FIELD_BusinessHoursOnly);
_BusinessHoursOnly = newBusinessHoursOnly;
postFieldChange (FIELD_BusinessHoursOnly);
postBusinessHoursOnlyChange ();
}
}
/**
* Attribute IsWithdrawalMessage
*/
public Boolean getIsWithdrawalMessage ()
{
assertValid();
Boolean valToReturn = AttributeDecoratorUtils.getValue (FIELD_IsWithdrawalMessage_Decorators, (WorkFlowMessage)this, FIELD_IsWithdrawalMessage, _IsWithdrawalMessage);
for (WorkFlowMessageBehaviourDecorator bhd : WorkFlowMessage_BehaviourDecorators)
{
valToReturn = bhd.getIsWithdrawalMessage ((WorkFlowMessage)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 preIsWithdrawalMessageChange (Boolean newIsWithdrawalMessage) 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 postIsWithdrawalMessageChange () throws FieldException
{
}
public FieldWriteability getWriteability_IsWithdrawalMessage ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute IsWithdrawalMessage. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setIsWithdrawalMessage (Boolean newIsWithdrawalMessage) throws FieldException
{
newIsWithdrawalMessage = AttributeDecoratorUtils.setValue (FIELD_IsWithdrawalMessage_Decorators, (WorkFlowMessage)this, FIELD_IsWithdrawalMessage, newIsWithdrawalMessage);
boolean oldAndNewIdentical = HELPER_IsWithdrawalMessage.compare (_IsWithdrawalMessage, newIsWithdrawalMessage);
try
{
for (WorkFlowMessageBehaviourDecorator bhd : WorkFlowMessage_BehaviourDecorators)
{
newIsWithdrawalMessage = bhd.setIsWithdrawalMessage ((WorkFlowMessage)this, newIsWithdrawalMessage);
oldAndNewIdentical = HELPER_IsWithdrawalMessage.compare (_IsWithdrawalMessage, newIsWithdrawalMessage);
}
if (FIELD_IsWithdrawalMessage_Validators.length > 0)
{
Object newIsWithdrawalMessageObj = HELPER_IsWithdrawalMessage.toObject (newIsWithdrawalMessage);
if (newIsWithdrawalMessageObj != null)
{
int loopMax = FIELD_IsWithdrawalMessage_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_WorkFlowMessage.get (FIELD_IsWithdrawalMessage);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_IsWithdrawalMessage_Validators[v].checkAttribute (this, FIELD_IsWithdrawalMessage, metadata, newIsWithdrawalMessageObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (AttributeDecoratorUtils.getWriteability (FIELD_IsWithdrawalMessage_Decorators, (WorkFlowMessage)this, FIELD_IsWithdrawalMessage ,getWriteability_IsWithdrawalMessage ()) != FieldWriteability.FALSE, "Field IsWithdrawalMessage is not writeable");
preIsWithdrawalMessageChange (newIsWithdrawalMessage);
markFieldChange (FIELD_IsWithdrawalMessage);
_IsWithdrawalMessage = newIsWithdrawalMessage;
postFieldChange (FIELD_IsWithdrawalMessage);
postIsWithdrawalMessageChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getSingleAssocs()
{
List result = super.getSingleAssocs ();
result.add("MessageTemplate");
result.add("WorkFlowStage");
return result;
}
public BaseBusinessClass getSingleAssocReferenceInstance (String assocName)
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_MessageTemplate))
{
return _MessageTemplate.getReferencedType ();
}
else if (assocName.equals (SINGLEREFERENCE_WorkFlowStage))
{
return _WorkFlowStage.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_MessageTemplate))
{
return null ;
}
else if (assocName.equals (SINGLEREFERENCE_WorkFlowStage))
{
return WorkFlowStage.MULTIPLEREFERENCE_WorkFlowMessages ;
}
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_MessageTemplate))
{
return getMessageTemplate ();
}
else if (assocName.equals (SINGLEREFERENCE_WorkFlowStage))
{
return getWorkFlowStage ();
}
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_MessageTemplate))
{
return getMessageTemplate (getType);
}
else if (assocName.equals (SINGLEREFERENCE_WorkFlowStage))
{
return getWorkFlowStage (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_MessageTemplate))
{
return getMessageTemplateID ();
}
else if (assocName.equals (SINGLEREFERENCE_WorkFlowStage))
{
return getWorkFlowStageID ();
}
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_MessageTemplate))
{
setMessageTemplate ((MessageTemplate)(newValue));
}
else if (assocName.equals (SINGLEREFERENCE_WorkFlowStage))
{
setWorkFlowStage ((WorkFlowStage)(newValue));
}
else
{
super.setSingleAssoc (assocName, newValue);
}
}
/**
* Get the reference MessageTemplate
*/
public MessageTemplate getMessageTemplate () throws StorageException
{
assertValid();
try
{
return (MessageTemplate)(_MessageTemplate.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in WorkFlowMessage:", this.getObjectID (), ", was trying to get MessageTemplate:", getMessageTemplateID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _MessageTemplate.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public MessageTemplate getMessageTemplate (Get getType) throws StorageException
{
assertValid();
return _MessageTemplate.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getMessageTemplateID ()
{
assertValid();
if (_MessageTemplate == null)
{
return null;
}
else
{
return _MessageTemplate.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 preMessageTemplateChange (MessageTemplate newMessageTemplate) 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 postMessageTemplateChange () throws FieldException
{
}
public FieldWriteability getWriteability_MessageTemplate ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference MessageTemplate. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setMessageTemplate (MessageTemplate newMessageTemplate) throws StorageException, FieldException
{
if (_MessageTemplate.wouldReferencedChange (newMessageTemplate))
{
assertValid();
Debug.assertion (AttributeDecoratorUtils.getWriteability (SINGLEREFERENCE_MessageTemplate_Decorators, (WorkFlowMessage)this, SINGLEREFERENCE_MessageTemplate ,getWriteability_MessageTemplate ()) != FieldWriteability.FALSE, "Assoc MessageTemplate is not writeable");
preMessageTemplateChange (newMessageTemplate);
_MessageTemplate.set (newMessageTemplate);
postMessageTemplateChange ();
}
}
/**
* Get the reference WorkFlowStage
*/
public WorkFlowStage getWorkFlowStage () throws StorageException
{
assertValid();
try
{
return (WorkFlowStage)(_WorkFlowStage.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in WorkFlowMessage:", this.getObjectID (), ", was trying to get WorkFlowStage:", getWorkFlowStageID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _WorkFlowStage.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public WorkFlowStage getWorkFlowStage (Get getType) throws StorageException
{
assertValid();
return _WorkFlowStage.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getWorkFlowStageID ()
{
assertValid();
if (_WorkFlowStage == null)
{
return null;
}
else
{
return _WorkFlowStage.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 preWorkFlowStageChange (WorkFlowStage newWorkFlowStage) 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 postWorkFlowStageChange () throws FieldException
{
}
public FieldWriteability getWriteability_WorkFlowStage ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference WorkFlowStage. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setWorkFlowStage (WorkFlowStage newWorkFlowStage) throws StorageException, FieldException
{
if (_WorkFlowStage.wouldReferencedChange (newWorkFlowStage))
{
assertValid();
Debug.assertion (AttributeDecoratorUtils.getWriteability (SINGLEREFERENCE_WorkFlowStage_Decorators, (WorkFlowMessage)this, SINGLEREFERENCE_WorkFlowStage ,getWriteability_WorkFlowStage ()) != FieldWriteability.FALSE, "Assoc WorkFlowStage is not writeable");
preWorkFlowStageChange (newWorkFlowStage);
WorkFlowStage oldWorkFlowStage = getWorkFlowStage ();
if (oldWorkFlowStage != null)
{
// This is to stop validation from triggering when we are removed
_WorkFlowStage.set (null);
oldWorkFlowStage.removeFromWorkFlowMessages ((WorkFlowMessage)(this));
}
_WorkFlowStage.set (newWorkFlowStage);
if (newWorkFlowStage != null)
{
newWorkFlowStage.addToWorkFlowMessages ((WorkFlowMessage)(this));
}
postWorkFlowStageChange ();
}
}
/**
* 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 (_WorkFlowStage.isLoaded () || getTransaction ().isObjectLoaded (_WorkFlowStage.getReferencedType (), getWorkFlowStageID ()))
{
WorkFlowStage referenced = getWorkFlowStage ();
if (referenced != null)
{
// Stop the callback
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null WorkFlowMessages from ", getObjectID (), " to ", referenced.getObjectID ());
_WorkFlowStage.set (null);
referenced.removeFromWorkFlowMessages ((WorkFlowMessage)this);
}
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
super.onDelete ();
}
public WorkFlowMessage newInstance ()
{
return new WorkFlowMessage ();
}
public WorkFlowMessage referenceInstance ()
{
return REFERENCE_WorkFlowMessage;
}
public WorkFlowMessage getInTransaction (ObjectTransaction t) throws StorageException
{
return getWorkFlowMessageByID (t, getObjectID());
}
public BaseBusinessClass dummyInstance ()
{
return DUMMY_WorkFlowMessage;
}
public String getBaseSetName ()
{
return "tl_work_flow_message";
}
/**
* 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_work_flow_messagePSet = allSets.getPersistentSet (myID, "tl_work_flow_message", myPSetStatus);
tl_work_flow_messagePSet.setAttrib (FIELD_ObjectID, myID);
tl_work_flow_messagePSet.setAttrib (FIELD_Delay, HELPER_Delay.toObject (_Delay)); //
tl_work_flow_messagePSet.setAttrib (FIELD_Variance, HELPER_Variance.toObject (_Variance)); //
tl_work_flow_messagePSet.setAttrib (FIELD_BusinessHoursOnly, HELPER_BusinessHoursOnly.toObject (_BusinessHoursOnly)); //
tl_work_flow_messagePSet.setAttrib (FIELD_IsWithdrawalMessage, HELPER_IsWithdrawalMessage.toObject (_IsWithdrawalMessage)); //
_MessageTemplate.getPersistentSets (allSets);
_WorkFlowStage.getPersistentSets (allSets);
}
/**
* Sets the objects state based on Persistent sets.
*/
public void setFromPersistentSets (ObjectID objectID, PersistentSetCollection allSets)
{
super.setFromPersistentSets (objectID, allSets);
PersistentSet tl_work_flow_messagePSet = allSets.getPersistentSet (objectID, "tl_work_flow_message");
_Delay = (String)(HELPER_Delay.fromObject (_Delay, tl_work_flow_messagePSet.getAttrib (FIELD_Delay))); //
_Variance = (String)(HELPER_Variance.fromObject (_Variance, tl_work_flow_messagePSet.getAttrib (FIELD_Variance))); //
_BusinessHoursOnly = (Boolean)(HELPER_BusinessHoursOnly.fromObject (_BusinessHoursOnly, tl_work_flow_messagePSet.getAttrib (FIELD_BusinessHoursOnly))); //
_IsWithdrawalMessage = (Boolean)(HELPER_IsWithdrawalMessage.fromObject (_IsWithdrawalMessage, tl_work_flow_messagePSet.getAttrib (FIELD_IsWithdrawalMessage))); //
_MessageTemplate.setFromPersistentSets (objectID, allSets);
_WorkFlowStage.setFromPersistentSets (objectID, allSets);
}
public void setAttributesFrom (BaseBusinessClass other, MultiException e)
{
super.setAttributesFrom (other, e);
if (other instanceof WorkFlowMessage)
{
WorkFlowMessage otherWorkFlowMessage = (WorkFlowMessage)other;
try
{
setDelay (otherWorkFlowMessage.getDelay ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setVariance (otherWorkFlowMessage.getVariance ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setBusinessHoursOnly (otherWorkFlowMessage.getBusinessHoursOnly ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setIsWithdrawalMessage (otherWorkFlowMessage.getIsWithdrawalMessage ());
}
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 BaseWorkFlowMessage)
{
BaseWorkFlowMessage sourceWorkFlowMessage = (BaseWorkFlowMessage)(source);
_Delay = sourceWorkFlowMessage._Delay;
_Variance = sourceWorkFlowMessage._Variance;
_BusinessHoursOnly = sourceWorkFlowMessage._BusinessHoursOnly;
_IsWithdrawalMessage = sourceWorkFlowMessage._IsWithdrawalMessage;
}
}
/**
* 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 BaseWorkFlowMessage)
{
BaseWorkFlowMessage sourceWorkFlowMessage = (BaseWorkFlowMessage)(source);
_MessageTemplate.copyFrom (sourceWorkFlowMessage._MessageTemplate, linkToGhosts);
_WorkFlowStage.copyFrom (sourceWorkFlowMessage._WorkFlowStage, 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 BaseWorkFlowMessage)
{
BaseWorkFlowMessage sourceWorkFlowMessage = (BaseWorkFlowMessage)(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);
_Delay = (String)(HELPER_Delay.readExternal (_Delay, vals.get(FIELD_Delay))); //
_Variance = (String)(HELPER_Variance.readExternal (_Variance, vals.get(FIELD_Variance))); //
_BusinessHoursOnly = (Boolean)(HELPER_BusinessHoursOnly.readExternal (_BusinessHoursOnly, vals.get(FIELD_BusinessHoursOnly))); //
_IsWithdrawalMessage = (Boolean)(HELPER_IsWithdrawalMessage.readExternal (_IsWithdrawalMessage, vals.get(FIELD_IsWithdrawalMessage))); //
_MessageTemplate.readExternalData(vals.get(SINGLEREFERENCE_MessageTemplate));
_WorkFlowStage.readExternalData(vals.get(SINGLEREFERENCE_WorkFlowStage));
}
/**
* Subclasses must override this to write out their attributes
*/
protected void writeExternalData(Map<String, Object> vals) throws IOException
{
super.writeExternalData(vals);
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_IsWithdrawalMessage, HELPER_IsWithdrawalMessage.writeExternal (_IsWithdrawalMessage));
vals.put (SINGLEREFERENCE_MessageTemplate, _MessageTemplate.writeExternalData());
vals.put (SINGLEREFERENCE_WorkFlowStage, _WorkFlowStage.writeExternalData());
}
public void compare (BaseBusinessClass other, AttributeChangeListener listener) throws StorageException
{
super.compare (other, listener);
if (other instanceof BaseWorkFlowMessage)
{
BaseWorkFlowMessage otherWorkFlowMessage = (BaseWorkFlowMessage)(other);
if (!HELPER_Delay.compare(this._Delay, otherWorkFlowMessage._Delay))
{
listener.notifyFieldChange(this, other, FIELD_Delay, HELPER_Delay.toObject(this._Delay), HELPER_Delay.toObject(otherWorkFlowMessage._Delay));
}
if (!HELPER_Variance.compare(this._Variance, otherWorkFlowMessage._Variance))
{
listener.notifyFieldChange(this, other, FIELD_Variance, HELPER_Variance.toObject(this._Variance), HELPER_Variance.toObject(otherWorkFlowMessage._Variance));
}
if (!HELPER_BusinessHoursOnly.compare(this._BusinessHoursOnly, otherWorkFlowMessage._BusinessHoursOnly))
{
listener.notifyFieldChange(this, other, FIELD_BusinessHoursOnly, HELPER_BusinessHoursOnly.toObject(this._BusinessHoursOnly), HELPER_BusinessHoursOnly.toObject(otherWorkFlowMessage._BusinessHoursOnly));
}
if (!HELPER_IsWithdrawalMessage.compare(this._IsWithdrawalMessage, otherWorkFlowMessage._IsWithdrawalMessage))
{
listener.notifyFieldChange(this, other, FIELD_IsWithdrawalMessage, HELPER_IsWithdrawalMessage.toObject(this._IsWithdrawalMessage), HELPER_IsWithdrawalMessage.toObject(otherWorkFlowMessage._IsWithdrawalMessage));
}
// Compare single assocs
_MessageTemplate.compare (otherWorkFlowMessage._MessageTemplate, listener);
_WorkFlowStage.compare (otherWorkFlowMessage._WorkFlowStage, 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_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_IsWithdrawalMessage, HELPER_IsWithdrawalMessage.toObject(getIsWithdrawalMessage()));
visitor.visitAssociation (_MessageTemplate);
visitor.visitAssociation (_WorkFlowStage);
}
public void visitAssociations (AssociationVisitor visitor, AssociatedScope scope) throws StorageException
{
super.visitAssociations (visitor, scope);
if (scope.includes (_MessageTemplate))
{
visitor.visit (_MessageTemplate);
}
if (scope.includes (_WorkFlowStage))
{
visitor.visit (_WorkFlowStage);
}
}
public static WorkFlowMessage createWorkFlowMessage (ObjectTransaction transaction) throws StorageException
{
WorkFlowMessage result = new WorkFlowMessage ();
result.initialiseNewObject (transaction);
return result;
}
public static WorkFlowMessage getWorkFlowMessageByID (ObjectTransaction transaction, Long objectID) throws StorageException
{
return (WorkFlowMessage)(transaction.getObjectByID (REFERENCE_WorkFlowMessage, objectID));
}
public boolean testFilter (String attribName, QueryFilter filter) throws StorageException
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
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_IsWithdrawalMessage))
{
return filter.matches (getIsWithdrawalMessage ());
}
else if (attribName.equals (SINGLEREFERENCE_MessageTemplate))
{
return filter.matches (getMessageTemplate ());
}
else if (attribName.equals (SINGLEREFERENCE_WorkFlowStage))
{
return filter.matches (getWorkFlowStage ());
}
else
{
return super.testFilter (attribName, filter);
}
}
public static SearchAll SearchByAll () { return new SearchAll (); }
public static class SearchAll extends SearchObject<WorkFlowMessage>
{
public SearchAll andObjectID (QueryFilter<Long> filter)
{
filter.addFilter (context, "tl_work_flow_message.object_id", FIELD_ObjectID);
return this;
}
public SearchAll andObjectCreated (QueryFilter<Date> filter)
{
filter.addFilter (context, "tl_work_flow_message.object_created_date", FIELD_ObjectCreated);
return this;
}
public SearchAll andObjectLastModified (QueryFilter<Date> filter)
{
filter.addFilter (context, "tl_work_flow_message.object_last_updated_date", FIELD_ObjectLastModified);
return this;
}
public SearchAll andDelay (QueryFilter<String> filter)
{
filter.addFilter (context, "tl_work_flow_message.delay", "Delay");
return this;
}
public SearchAll andVariance (QueryFilter<String> filter)
{
filter.addFilter (context, "tl_work_flow_message.variance", "Variance");
return this;
}
public SearchAll andBusinessHoursOnly (QueryFilter<Boolean> filter)
{
filter.addFilter (context, "tl_work_flow_message.business_hours_only", "BusinessHoursOnly");
return this;
}
public SearchAll andIsWithdrawalMessage (QueryFilter<Boolean> filter)
{
filter.addFilter (context, "tl_work_flow_message.is_withdrawal_message", "IsWithdrawalMessage");
return this;
}
public SearchAll andMessageTemplate (QueryFilter<MessageTemplate> filter)
{
filter.addFilter (context, "tl_work_flow_message.message_template_id", "MessageTemplate");
return this;
}
public SearchAll andWorkFlowStage (QueryFilter<WorkFlowStage> filter)
{
filter.addFilter (context, "tl_work_flow_message.work_flow_stage_id", "WorkFlowStage");
return this;
}
public WorkFlowMessage[] search (ObjectTransaction transaction) throws StorageException
{
BaseBusinessClass[] results = super.search (transaction, REFERENCE_WorkFlowMessage, SEARCH_All, criteria);
Set<WorkFlowMessage> typedResults = new LinkedHashSet <WorkFlowMessage> ();
for (BaseBusinessClass bbcResult : results)
{
WorkFlowMessage aResult = (WorkFlowMessage)bbcResult;
typedResults.add (aResult);
}
return ObjstoreUtils.removeDeleted(transaction, typedResults).toArray (new WorkFlowMessage[0]);
}
}
public static WorkFlowMessage[] searchAll (ObjectTransaction transaction) throws StorageException
{
return SearchByAll ()
.search (transaction);
}
public Object getAttribute (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
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_IsWithdrawalMessage))
{
return HELPER_IsWithdrawalMessage.toObject (getIsWithdrawalMessage ());
}
else
{
return super.getAttribute (attribName);
}
}
public AttributeHelper getAttributeHelper (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
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_IsWithdrawalMessage))
{
return HELPER_IsWithdrawalMessage;
}
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_Delay))
{
setDelay ((String)(HELPER_Delay.fromObject (_Delay, attribValue)));
}
else if (attribName.equals (FIELD_Variance))
{
setVariance ((String)(HELPER_Variance.fromObject (_Variance, attribValue)));
}
else if (attribName.equals (FIELD_BusinessHoursOnly))
{
setBusinessHoursOnly ((Boolean)(HELPER_BusinessHoursOnly.fromObject (_BusinessHoursOnly, attribValue)));
}
else if (attribName.equals (FIELD_IsWithdrawalMessage))
{
setIsWithdrawalMessage ((Boolean)(HELPER_IsWithdrawalMessage.fromObject (_IsWithdrawalMessage, attribValue)));
}
else
{
super.setAttribute (attribName, attribValue);
}
}
public boolean isWriteable (String fieldName)
{
return getWriteable (fieldName) == FieldWriteability.TRUE;
}
public boolean isReadable ()
{
return super.isReadable();
}
public boolean isReadable (String fieldName)
{
return super.isReadable(fieldName);
}
public FieldWriteability getWriteable (String fieldName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
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_IsWithdrawalMessage))
{
return getWriteability_IsWithdrawalMessage ();
}
else if (fieldName.equals (SINGLEREFERENCE_MessageTemplate))
{
return getWriteability_MessageTemplate ();
}
else if (fieldName.equals (SINGLEREFERENCE_WorkFlowStage))
{
return getWriteability_WorkFlowStage ();
}
else
{
return super.getWriteable (fieldName);
}
}
public void putUnwriteable (Set<String> fields)
{
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_IsWithdrawalMessage () != FieldWriteability.TRUE)
{
fields.add (FIELD_IsWithdrawalMessage);
}
super.putUnwriteable (fields);
}
public String[] getAllTableNames()
{
return new String[] {"tl_work_flow_message"};
}
public boolean isPolymorphic(String tableName)
{
return super.isPolymorphic(tableName);
}
public List<AbstractAttribute> getAttributes ()
{
List result = super.getAttributes ();
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_IsWithdrawalMessage.getAttribObject (getClass (), _IsWithdrawalMessage, false, FIELD_IsWithdrawalMessage));
return result;
}
public Map getAttributeMetadata (String attribute)
{
if (ATTRIBUTES_METADATA_WorkFlowMessage.containsKey (attribute))
{
return (Map)ATTRIBUTES_METADATA_WorkFlowMessage.get (attribute);
}
else
{
return super.getAttributeMetadata (attribute);
}
}
public Object getAttributeMetadata (String attribute, String metadata)
{
if (ATTRIBUTES_METADATA_WorkFlowMessage.containsKey (attribute))
{
return ((Map)ATTRIBUTES_METADATA_WorkFlowMessage.get (attribute)).get(metadata);
}
else
{
return super.getAttributeMetadata (attribute, metadata);
}
}
public void copyAllAttributeMetadata (Map copyInto)
{
super.copyAllAttributeMetadata(copyInto);
copyInto.putAll(ATTRIBUTES_METADATA_WorkFlowMessage);
}
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 WorkFlowMessageBehaviourDecorator extends BaseBusinessClass.BBCBehaviourDecorator<WorkFlowMessage>
{
/**
* Get the attribute Delay
*/
public String getDelay (WorkFlowMessage obj, String original)
{
return original;
}
/**
* Change the value set for attribute Delay.
* May modify the field beforehand
* Occurs before validation.
*/
public String setDelay (WorkFlowMessage obj, String newDelay) throws FieldException
{
return newDelay;
}
/**
* Get the attribute Variance
*/
public String getVariance (WorkFlowMessage obj, String original)
{
return original;
}
/**
* Change the value set for attribute Variance.
* May modify the field beforehand
* Occurs before validation.
*/
public String setVariance (WorkFlowMessage obj, String newVariance) throws FieldException
{
return newVariance;
}
/**
* Get the attribute BusinessHoursOnly
*/
public Boolean getBusinessHoursOnly (WorkFlowMessage obj, Boolean original)
{
return original;
}
/**
* Change the value set for attribute BusinessHoursOnly.
* May modify the field beforehand
* Occurs before validation.
*/
public Boolean setBusinessHoursOnly (WorkFlowMessage obj, Boolean newBusinessHoursOnly) throws FieldException
{
return newBusinessHoursOnly;
}
/**
* Get the attribute IsWithdrawalMessage
*/
public Boolean getIsWithdrawalMessage (WorkFlowMessage obj, Boolean original)
{
return original;
}
/**
* Change the value set for attribute IsWithdrawalMessage.
* May modify the field beforehand
* Occurs before validation.
*/
public Boolean setIsWithdrawalMessage (WorkFlowMessage obj, Boolean newIsWithdrawalMessage) throws FieldException
{
return newIsWithdrawalMessage;
}
}
@Override
public ORMPipeLine pipes()
{
return new WorkFlowMessagePipeLineFactory<WorkFlowMessage, WorkFlowMessage> ((WorkFlowMessage)this);
}
@Override
public ORMPipeLine pipes(Collection _items)
{
return pipesWorkFlowMessage(_items);
}
/**
* Use this instead of pipes() to get rid of type casting.
*/
public WorkFlowMessagePipeLineFactory<WorkFlowMessage, WorkFlowMessage> pipelineWorkFlowMessage()
{
return (WorkFlowMessagePipeLineFactory<WorkFlowMessage, WorkFlowMessage>) pipes();
}
public static WorkFlowMessagePipeLineFactory<WorkFlowMessage, WorkFlowMessage> pipesWorkFlowMessage(Collection<WorkFlowMessage> items)
{
return REFERENCE_WorkFlowMessage.new WorkFlowMessagePipeLineFactory<WorkFlowMessage, WorkFlowMessage> (items);
}
public static WorkFlowMessagePipeLineFactory<WorkFlowMessage, WorkFlowMessage> pipesWorkFlowMessage(WorkFlowMessage[] _items)
{
return pipesWorkFlowMessage(Arrays.asList (_items));
}
public static WorkFlowMessagePipeLineFactory<WorkFlowMessage, WorkFlowMessage> pipesWorkFlowMessage()
{
return pipesWorkFlowMessage((Collection)null);
}
public class WorkFlowMessagePipeLineFactory<From extends BaseBusinessClass, Me extends WorkFlowMessage> extends BaseBusinessClass.ORMPipeLine<From, Me>
{
public <Prev> WorkFlowMessagePipeLineFactory (PipeLine<From, Prev> pipeLine, Pipe<Prev, Me> nextPipe)
{
super (pipeLine, nextPipe);
}
public WorkFlowMessagePipeLineFactory (From seed)
{
super(seed);
}
public WorkFlowMessagePipeLineFactory (Collection<From> seed)
{
super(seed);
}
public PipeLine<From, ? extends Object> to(String name)
{
if (name.equals ("Delay"))
{
return toDelay ();
}
if (name.equals ("Variance"))
{
return toVariance ();
}
if (name.equals ("BusinessHoursOnly"))
{
return toBusinessHoursOnly ();
}
if (name.equals ("IsWithdrawalMessage"))
{
return toIsWithdrawalMessage ();
}
if (name.equals ("MessageTemplate"))
{
return toMessageTemplate ();
}
if (name.equals ("WorkFlowStage"))
{
return toWorkFlowStage ();
}
return super.to(name);
}
public PipeLine<From, String> toDelay () { return pipe(new ORMAttributePipe<Me, String>(FIELD_Delay)); }
public PipeLine<From, String> toVariance () { return pipe(new ORMAttributePipe<Me, String>(FIELD_Variance)); }
public PipeLine<From, Boolean> toBusinessHoursOnly () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_BusinessHoursOnly)); }
public PipeLine<From, Boolean> toIsWithdrawalMessage () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_IsWithdrawalMessage)); }
public MessageTemplate.MessageTemplatePipeLineFactory<From, MessageTemplate> toMessageTemplate () { return toMessageTemplate (Filter.ALL); }
public MessageTemplate.MessageTemplatePipeLineFactory<From, MessageTemplate> toMessageTemplate (Filter<MessageTemplate> filter)
{
return MessageTemplate.REFERENCE_MessageTemplate.new MessageTemplatePipeLineFactory<From, MessageTemplate> (this, new ORMSingleAssocPipe<Me, MessageTemplate>(SINGLEREFERENCE_MessageTemplate, filter));
}
public WorkFlowStage.WorkFlowStagePipeLineFactory<From, WorkFlowStage> toWorkFlowStage () { return toWorkFlowStage (Filter.ALL); }
public WorkFlowStage.WorkFlowStagePipeLineFactory<From, WorkFlowStage> toWorkFlowStage (Filter<WorkFlowStage> filter)
{
return WorkFlowStage.REFERENCE_WorkFlowStage.new WorkFlowStagePipeLineFactory<From, WorkFlowStage> (this, new ORMSingleAssocPipe<Me, WorkFlowStage>(SINGLEREFERENCE_WorkFlowStage, filter));
}
}
public boolean isTransientAttrib(String attribName)
{
return super.isTransientAttrib(attribName);
}
public boolean isTransientSingleReference(String assocName)
{
return super.isTransientSingleReference(assocName);
}
}
class DummyWorkFlowMessage extends WorkFlowMessage
{
// Default constructor primarily to support Externalisable
public DummyWorkFlowMessage()
{
super();
}
public void assertValid ()
{
}
public MessageTemplate getMessageTemplate () throws StorageException
{
return (MessageTemplate)(MessageTemplate.DUMMY_MessageTemplate);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getMessageTemplateID ()
{
return MessageTemplate.DUMMY_MessageTemplate.getObjectID();
}
public WorkFlowStage getWorkFlowStage () throws StorageException
{
return (WorkFlowStage)(WorkFlowStage.DUMMY_WorkFlowStage);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getWorkFlowStageID ()
{
return WorkFlowStage.DUMMY_WorkFlowStage.getObjectID();
}
}
/*
* IMPORTANT!!!! XSL Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure9.0 [oneit.objstore.BusinessObjectTemplate.xsl]
* Vendor: Apache Software Foundation (Xalan XSLTC) (Version: 1.0)
*/
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.*;
public abstract class BaseWorkFlowStage extends BaseBusinessClass
{
// Reference instance for the object
public static final WorkFlowStage REFERENCE_WorkFlowStage = new WorkFlowStage ();
// Reference instance for the object
public static final WorkFlowStage DUMMY_WorkFlowStage = new DummyWorkFlowStage ();
// Static constants corresponding to field names
public static final String FIELD_Name = "Name";
public static final String FIELD_UseMessaging = "UseMessaging";
public static final String FIELD_StageType = "StageType";
public static final String FIELD_SortOrder = "SortOrder";
public static final String SINGLEREFERENCE_WithdrawalMessage = "WithdrawalMessage";
public static final String SINGLEREFERENCE_WorkFlowTemplate = "WorkFlowTemplate";
public static final String BACKREF_WorkFlowTemplate = "";
public static final String MULTIPLEREFERENCE_WorkFlowMessages = "WorkFlowMessages";
public static final String BACKREF_WorkFlowMessages = "";
// Static constants corresponding to searches
public static final String SEARCH_All = "All";
// Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper<WorkFlowStage> HELPER_Name = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<WorkFlowStage> HELPER_UseMessaging = DefaultAttributeHelper.INSTANCE;
private static final EnumeratedAttributeHelper<WorkFlowStage, StageType> HELPER_StageType = new EnumeratedAttributeHelper<WorkFlowStage, StageType> (StageType.FACTORY_StageType);
private static final DefaultAttributeHelper<WorkFlowStage> HELPER_SortOrder = DefaultAttributeHelper.INSTANCE;
// Private attributes corresponding to business object data
private String _Name;
private Boolean _UseMessaging;
private StageType _StageType;
private Integer _SortOrder;
// Private attributes corresponding to single references
private SingleAssociation<WorkFlowStage, WorkFlowMessage> _WithdrawalMessage;
private SingleAssociation<WorkFlowStage, WorkFlowTemplate> _WorkFlowTemplate;
// Private attributes corresponding to multiple references
private MultipleAssociation<WorkFlowStage, WorkFlowMessage> _WorkFlowMessages;
// Map of maps of metadata
private static final Map ATTRIBUTES_METADATA_WorkFlowStage = new LinkedHashMap ();
// Arrays of validators for each attribute
private static final AttributeValidator[] FIELD_Name_Validators;
private static final AttributeValidator[] FIELD_UseMessaging_Validators;
private static final AttributeValidator[] FIELD_StageType_Validators;
private static final AttributeValidator[] FIELD_SortOrder_Validators;
// Arrays of AttributeDecorators for each attribute
private static final AttributeDecorator<WorkFlowStage, String>[] FIELD_Name_Decorators;
private static final AttributeDecorator<WorkFlowStage, Boolean>[] FIELD_UseMessaging_Decorators;
private static final AttributeDecorator<WorkFlowStage, StageType>[] FIELD_StageType_Decorators;
private static final AttributeDecorator<WorkFlowStage, Integer>[] FIELD_SortOrder_Decorators;
// Arrays of SingleAssocDecorators for each attribute
private static final SingleAssocDecorator<WorkFlowStage, WorkFlowMessage>[] SINGLEREFERENCE_WithdrawalMessage_Decorators;
private static final SingleAssocDecorator<WorkFlowStage, WorkFlowTemplate>[] SINGLEREFERENCE_WorkFlowTemplate_Decorators;
// Arrays of MultiAssocDecorators for each attribute
private static final MultiAssocDecorator<WorkFlowStage, WorkFlowMessage>[] MULTIPLEREFERENCE_WorkFlowMessages_Decorators;
// Arrays of behaviour decorators
private static final WorkFlowStageBehaviourDecorator[] WorkFlowStage_BehaviourDecorators;
static
{
try
{
String tmp_WorkFlowMessages = WorkFlowMessage.BACKREF_WorkFlowStage;
String tmp_WorkFlowTemplate = WorkFlowTemplate.BACKREF_WorkFlowStages;
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
setupAssocMetaData_WorkFlowMessages();
setupAssocMetaData_WithdrawalMessage();
setupAssocMetaData_WorkFlowTemplate();
FIELD_Name_Validators = (AttributeValidator[])setupAttribMetaData_Name(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_UseMessaging_Validators = (AttributeValidator[])setupAttribMetaData_UseMessaging(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_StageType_Validators = (AttributeValidator[])setupAttribMetaData_StageType(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_SortOrder_Validators = (AttributeValidator[])setupAttribMetaData_SortOrder(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_Name_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_WorkFlowStage, FIELD_Name).toArray (new AttributeDecorator[0]);
FIELD_UseMessaging_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_WorkFlowStage, FIELD_UseMessaging).toArray (new AttributeDecorator[0]);
FIELD_StageType_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_WorkFlowStage, FIELD_StageType).toArray (new AttributeDecorator[0]);
FIELD_SortOrder_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_WorkFlowStage, FIELD_SortOrder).toArray (new AttributeDecorator[0]);
SINGLEREFERENCE_WithdrawalMessage_Decorators = (SingleAssocDecorator[])AttributeDecoratorUtils.getSingleAssocDecorators(REFERENCE_WorkFlowStage, SINGLEREFERENCE_WithdrawalMessage).toArray (new SingleAssocDecorator[0]);
SINGLEREFERENCE_WorkFlowTemplate_Decorators = (SingleAssocDecorator[])AttributeDecoratorUtils.getSingleAssocDecorators(REFERENCE_WorkFlowStage, SINGLEREFERENCE_WorkFlowTemplate).toArray (new SingleAssocDecorator[0]);
MULTIPLEREFERENCE_WorkFlowMessages_Decorators = (MultiAssocDecorator[])AttributeDecoratorUtils.getMultiAssocDecorators(REFERENCE_WorkFlowStage, MULTIPLEREFERENCE_WorkFlowMessages).toArray (new MultiAssocDecorator[0]);
REFERENCE_WorkFlowStage.initialiseReference ();
DUMMY_WorkFlowStage.initialiseReference ();
WorkFlowStage_BehaviourDecorators = BaseBusinessClass.getBBCBehaviours(WorkFlowStage.class).toArray(new WorkFlowStageBehaviourDecorator[0]);
}
catch (RuntimeException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR1, e, "Error initialising");
throw e;
}
}
private static void setupAssocMetaData_WorkFlowMessages()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "WorkFlowStage");
metaInfo.put ("name", "WorkFlowMessages");
metaInfo.put ("type", "WorkFlowMessage");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for WorkFlowStage.WorkFlowMessages:", metaInfo);
ATTRIBUTES_METADATA_WorkFlowStage.put (MULTIPLEREFERENCE_WorkFlowMessages, Collections.unmodifiableMap (metaInfo));
}
private static void setupAssocMetaData_WithdrawalMessage()
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "withdrawal_message_id");
metaInfo.put ("name", "WithdrawalMessage");
metaInfo.put ("type", "WorkFlowMessage");
metaInfo.put (METADATA_DB_TABLENAME, "tl_work_flow_stage");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for WorkFlowStage.WithdrawalMessage:", metaInfo);
ATTRIBUTES_METADATA_WorkFlowStage.put (SINGLEREFERENCE_WithdrawalMessage, Collections.unmodifiableMap (metaInfo));
}
private static void setupAssocMetaData_WorkFlowTemplate()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "WorkFlowStages");
metaInfo.put ("dbcol", "work_flow_template_id");
metaInfo.put ("mandatory", "true");
metaInfo.put ("name", "WorkFlowTemplate");
metaInfo.put ("type", "WorkFlowTemplate");
metaInfo.put (METADATA_DB_TABLENAME, "tl_work_flow_stage");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for WorkFlowStage.WorkFlowTemplate:", metaInfo);
ATTRIBUTES_METADATA_WorkFlowStage.put (SINGLEREFERENCE_WorkFlowTemplate, Collections.unmodifiableMap (metaInfo));
}
private static List setupAttribMetaData_Name(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "name");
metaInfo.put ("mandatory", "true");
metaInfo.put ("name", "Name");
metaInfo.put ("type", "String");
metaInfo.put (METADATA_DB_TABLENAME, "tl_work_flow_stage");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for WorkFlowStage.Name:", metaInfo);
ATTRIBUTES_METADATA_WorkFlowStage.put (FIELD_Name, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(WorkFlowStage.class, "Name", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for WorkFlowStage.Name:", validators);
return validators;
}
private static List setupAttribMetaData_UseMessaging(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "use_messaging");
metaInfo.put ("mandatory", "false");
metaInfo.put ("name", "UseMessaging");
metaInfo.put ("type", "Boolean");
metaInfo.put (METADATA_DB_TABLENAME, "tl_work_flow_stage");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for WorkFlowStage.UseMessaging:", metaInfo);
ATTRIBUTES_METADATA_WorkFlowStage.put (FIELD_UseMessaging, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(WorkFlowStage.class, "UseMessaging", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for WorkFlowStage.UseMessaging:", validators);
return validators;
}
private static List setupAttribMetaData_StageType(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("attribHelper", "EnumeratedAttributeHelper");
metaInfo.put ("dbcol", "stage_type");
metaInfo.put ("mandatory", "true");
metaInfo.put ("name", "StageType");
metaInfo.put ("type", "StageType");
metaInfo.put (METADATA_DB_TABLENAME, "tl_work_flow_stage");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for WorkFlowStage.StageType:", metaInfo);
ATTRIBUTES_METADATA_WorkFlowStage.put (FIELD_StageType, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(WorkFlowStage.class, "StageType", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for WorkFlowStage.StageType:", validators);
return validators;
}
private static List setupAttribMetaData_SortOrder(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "sort_order");
metaInfo.put ("mandatory", "true");
metaInfo.put ("name", "SortOrder");
metaInfo.put ("type", "Integer");
metaInfo.put (METADATA_DB_TABLENAME, "tl_work_flow_stage");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for WorkFlowStage.SortOrder:", metaInfo);
ATTRIBUTES_METADATA_WorkFlowStage.put (FIELD_SortOrder, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(WorkFlowStage.class, "SortOrder", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for WorkFlowStage.SortOrder:", validators);
return validators;
}
// END OF STATIC METADATA DEFINITION
// This constructor should not be called
protected BaseWorkFlowStage ()
{
}
protected BBCBehaviourDecorator[] getBehaviours()
{
return WorkFlowStage_BehaviourDecorators;
}
protected void _initialiseNewObjAttributes (ObjectTransaction transaction) throws StorageException
{
super._initialiseNewObjAttributes (transaction);
_Name = (String)(HELPER_Name.initialise (_Name));
_UseMessaging = (Boolean)(HELPER_UseMessaging.initialise (_UseMessaging));
_StageType = (StageType)(HELPER_StageType.initialise (_StageType));
_SortOrder = (Integer)(HELPER_SortOrder.initialise (_SortOrder));
}
protected void _initialiseAssociations ()
{
super._initialiseAssociations ();
_WithdrawalMessage = new SingleAssociation<WorkFlowStage, WorkFlowMessage> (this, SINGLEREFERENCE_WithdrawalMessage, null, WorkFlowMessage.REFERENCE_WorkFlowMessage, "tl_work_flow_stage");
_WorkFlowTemplate = new SingleAssociation<WorkFlowStage, WorkFlowTemplate> (this, SINGLEREFERENCE_WorkFlowTemplate, WorkFlowTemplate.MULTIPLEREFERENCE_WorkFlowStages, WorkFlowTemplate.REFERENCE_WorkFlowTemplate, "tl_work_flow_stage");
_WorkFlowMessages = new MultipleAssociation<WorkFlowStage, WorkFlowMessage> (this, MULTIPLEREFERENCE_WorkFlowMessages, WorkFlowMessage.SINGLEREFERENCE_WorkFlowStage, WorkFlowMessage.REFERENCE_WorkFlowMessage);
}
protected BaseBusinessClass initialiseReference ()
{
super.initialiseReference ();
_WithdrawalMessage = new SingleAssociation<WorkFlowStage, WorkFlowMessage> (this, SINGLEREFERENCE_WithdrawalMessage, null, WorkFlowMessage.REFERENCE_WorkFlowMessage, "tl_work_flow_stage");
_WorkFlowTemplate = new SingleAssociation<WorkFlowStage, WorkFlowTemplate> (this, SINGLEREFERENCE_WorkFlowTemplate, WorkFlowTemplate.MULTIPLEREFERENCE_WorkFlowStages, WorkFlowTemplate.REFERENCE_WorkFlowTemplate, "tl_work_flow_stage");
_WorkFlowMessages = new MultipleAssociation<WorkFlowStage, WorkFlowMessage> (this, MULTIPLEREFERENCE_WorkFlowMessages, WorkFlowMessage.SINGLEREFERENCE_WorkFlowStage, WorkFlowMessage.REFERENCE_WorkFlowMessage);
return this;
}
/**
* Attribute Name
*/
public String getName ()
{
assertValid();
String valToReturn = AttributeDecoratorUtils.getValue (FIELD_Name_Decorators, (WorkFlowStage)this, FIELD_Name, _Name);
for (WorkFlowStageBehaviourDecorator bhd : WorkFlowStage_BehaviourDecorators)
{
valToReturn = bhd.getName ((WorkFlowStage)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 preNameChange (String newName) 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 postNameChange () throws FieldException
{
}
public FieldWriteability getWriteability_Name ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute Name. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setName (String newName) throws FieldException
{
newName = AttributeDecoratorUtils.setValue (FIELD_Name_Decorators, (WorkFlowStage)this, FIELD_Name, newName);
boolean oldAndNewIdentical = HELPER_Name.compare (_Name, newName);
try
{
for (WorkFlowStageBehaviourDecorator bhd : WorkFlowStage_BehaviourDecorators)
{
newName = bhd.setName ((WorkFlowStage)this, newName);
oldAndNewIdentical = HELPER_Name.compare (_Name, newName);
}
BusinessObjectParser.assertFieldCondition (newName != null, this, FIELD_Name, "mandatory");
if (FIELD_Name_Validators.length > 0)
{
Object newNameObj = HELPER_Name.toObject (newName);
if (newNameObj != null)
{
int loopMax = FIELD_Name_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_WorkFlowStage.get (FIELD_Name);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_Name_Validators[v].checkAttribute (this, FIELD_Name, metadata, newNameObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (AttributeDecoratorUtils.getWriteability (FIELD_Name_Decorators, (WorkFlowStage)this, FIELD_Name ,getWriteability_Name ()) != FieldWriteability.FALSE, "Field Name is not writeable");
preNameChange (newName);
markFieldChange (FIELD_Name);
_Name = newName;
postFieldChange (FIELD_Name);
postNameChange ();
}
}
/**
* Attribute UseMessaging
*/
public Boolean getUseMessaging ()
{
assertValid();
Boolean valToReturn = AttributeDecoratorUtils.getValue (FIELD_UseMessaging_Decorators, (WorkFlowStage)this, FIELD_UseMessaging, _UseMessaging);
for (WorkFlowStageBehaviourDecorator bhd : WorkFlowStage_BehaviourDecorators)
{
valToReturn = bhd.getUseMessaging ((WorkFlowStage)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 preUseMessagingChange (Boolean newUseMessaging) 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 postUseMessagingChange () throws FieldException
{
}
public FieldWriteability getWriteability_UseMessaging ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute UseMessaging. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setUseMessaging (Boolean newUseMessaging) throws FieldException
{
newUseMessaging = AttributeDecoratorUtils.setValue (FIELD_UseMessaging_Decorators, (WorkFlowStage)this, FIELD_UseMessaging, newUseMessaging);
boolean oldAndNewIdentical = HELPER_UseMessaging.compare (_UseMessaging, newUseMessaging);
try
{
for (WorkFlowStageBehaviourDecorator bhd : WorkFlowStage_BehaviourDecorators)
{
newUseMessaging = bhd.setUseMessaging ((WorkFlowStage)this, newUseMessaging);
oldAndNewIdentical = HELPER_UseMessaging.compare (_UseMessaging, newUseMessaging);
}
if (FIELD_UseMessaging_Validators.length > 0)
{
Object newUseMessagingObj = HELPER_UseMessaging.toObject (newUseMessaging);
if (newUseMessagingObj != null)
{
int loopMax = FIELD_UseMessaging_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_WorkFlowStage.get (FIELD_UseMessaging);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_UseMessaging_Validators[v].checkAttribute (this, FIELD_UseMessaging, metadata, newUseMessagingObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (AttributeDecoratorUtils.getWriteability (FIELD_UseMessaging_Decorators, (WorkFlowStage)this, FIELD_UseMessaging ,getWriteability_UseMessaging ()) != FieldWriteability.FALSE, "Field UseMessaging is not writeable");
preUseMessagingChange (newUseMessaging);
markFieldChange (FIELD_UseMessaging);
_UseMessaging = newUseMessaging;
postFieldChange (FIELD_UseMessaging);
postUseMessagingChange ();
}
}
/**
* Attribute StageType
*/
public StageType getStageType ()
{
assertValid();
StageType valToReturn = AttributeDecoratorUtils.getValue (FIELD_StageType_Decorators, (WorkFlowStage)this, FIELD_StageType, _StageType);
for (WorkFlowStageBehaviourDecorator bhd : WorkFlowStage_BehaviourDecorators)
{
valToReturn = bhd.getStageType ((WorkFlowStage)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 preStageTypeChange (StageType newStageType) 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 postStageTypeChange () throws FieldException
{
}
public FieldWriteability getWriteability_StageType ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute StageType. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setStageType (StageType newStageType) throws FieldException
{
newStageType = AttributeDecoratorUtils.setValue (FIELD_StageType_Decorators, (WorkFlowStage)this, FIELD_StageType, newStageType);
boolean oldAndNewIdentical = HELPER_StageType.compare (_StageType, newStageType);
try
{
for (WorkFlowStageBehaviourDecorator bhd : WorkFlowStage_BehaviourDecorators)
{
newStageType = bhd.setStageType ((WorkFlowStage)this, newStageType);
oldAndNewIdentical = HELPER_StageType.compare (_StageType, newStageType);
}
BusinessObjectParser.assertFieldCondition (newStageType != null, this, FIELD_StageType, "mandatory");
if (FIELD_StageType_Validators.length > 0)
{
Object newStageTypeObj = HELPER_StageType.toObject (newStageType);
if (newStageTypeObj != null)
{
int loopMax = FIELD_StageType_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_WorkFlowStage.get (FIELD_StageType);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_StageType_Validators[v].checkAttribute (this, FIELD_StageType, metadata, newStageTypeObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (AttributeDecoratorUtils.getWriteability (FIELD_StageType_Decorators, (WorkFlowStage)this, FIELD_StageType ,getWriteability_StageType ()) != FieldWriteability.FALSE, "Field StageType is not writeable");
preStageTypeChange (newStageType);
markFieldChange (FIELD_StageType);
_StageType = newStageType;
postFieldChange (FIELD_StageType);
postStageTypeChange ();
}
}
/**
* Attribute SortOrder
*/
public Integer getSortOrder ()
{
assertValid();
Integer valToReturn = AttributeDecoratorUtils.getValue (FIELD_SortOrder_Decorators, (WorkFlowStage)this, FIELD_SortOrder, _SortOrder);
for (WorkFlowStageBehaviourDecorator bhd : WorkFlowStage_BehaviourDecorators)
{
valToReturn = bhd.getSortOrder ((WorkFlowStage)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 preSortOrderChange (Integer newSortOrder) 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 postSortOrderChange () throws FieldException
{
}
public FieldWriteability getWriteability_SortOrder ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute SortOrder. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setSortOrder (Integer newSortOrder) throws FieldException
{
newSortOrder = AttributeDecoratorUtils.setValue (FIELD_SortOrder_Decorators, (WorkFlowStage)this, FIELD_SortOrder, newSortOrder);
boolean oldAndNewIdentical = HELPER_SortOrder.compare (_SortOrder, newSortOrder);
try
{
for (WorkFlowStageBehaviourDecorator bhd : WorkFlowStage_BehaviourDecorators)
{
newSortOrder = bhd.setSortOrder ((WorkFlowStage)this, newSortOrder);
oldAndNewIdentical = HELPER_SortOrder.compare (_SortOrder, newSortOrder);
}
BusinessObjectParser.assertFieldCondition (newSortOrder != null, this, FIELD_SortOrder, "mandatory");
if (FIELD_SortOrder_Validators.length > 0)
{
Object newSortOrderObj = HELPER_SortOrder.toObject (newSortOrder);
if (newSortOrderObj != null)
{
int loopMax = FIELD_SortOrder_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_WorkFlowStage.get (FIELD_SortOrder);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_SortOrder_Validators[v].checkAttribute (this, FIELD_SortOrder, metadata, newSortOrderObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (AttributeDecoratorUtils.getWriteability (FIELD_SortOrder_Decorators, (WorkFlowStage)this, FIELD_SortOrder ,getWriteability_SortOrder ()) != FieldWriteability.FALSE, "Field SortOrder is not writeable");
preSortOrderChange (newSortOrder);
markFieldChange (FIELD_SortOrder);
_SortOrder = newSortOrder;
postFieldChange (FIELD_SortOrder);
postSortOrderChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getSingleAssocs()
{
List result = super.getSingleAssocs ();
result.add("WithdrawalMessage");
result.add("WorkFlowTemplate");
return result;
}
public BaseBusinessClass getSingleAssocReferenceInstance (String assocName)
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_WithdrawalMessage))
{
return _WithdrawalMessage.getReferencedType ();
}
else if (assocName.equals (SINGLEREFERENCE_WorkFlowTemplate))
{
return _WorkFlowTemplate.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_WithdrawalMessage))
{
return null ;
}
else if (assocName.equals (SINGLEREFERENCE_WorkFlowTemplate))
{
return WorkFlowTemplate.MULTIPLEREFERENCE_WorkFlowStages ;
}
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_WithdrawalMessage))
{
return getWithdrawalMessage ();
}
else if (assocName.equals (SINGLEREFERENCE_WorkFlowTemplate))
{
return getWorkFlowTemplate ();
}
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_WithdrawalMessage))
{
return getWithdrawalMessage (getType);
}
else if (assocName.equals (SINGLEREFERENCE_WorkFlowTemplate))
{
return getWorkFlowTemplate (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_WithdrawalMessage))
{
return getWithdrawalMessageID ();
}
else if (assocName.equals (SINGLEREFERENCE_WorkFlowTemplate))
{
return getWorkFlowTemplateID ();
}
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_WithdrawalMessage))
{
setWithdrawalMessage ((WorkFlowMessage)(newValue));
}
else if (assocName.equals (SINGLEREFERENCE_WorkFlowTemplate))
{
setWorkFlowTemplate ((WorkFlowTemplate)(newValue));
}
else
{
super.setSingleAssoc (assocName, newValue);
}
}
/**
* Get the reference WithdrawalMessage
*/
public WorkFlowMessage getWithdrawalMessage () throws StorageException
{
assertValid();
try
{
return (WorkFlowMessage)(_WithdrawalMessage.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in WorkFlowStage:", this.getObjectID (), ", was trying to get WorkFlowMessage:", getWithdrawalMessageID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _WithdrawalMessage.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public WorkFlowMessage getWithdrawalMessage (Get getType) throws StorageException
{
assertValid();
return _WithdrawalMessage.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getWithdrawalMessageID ()
{
assertValid();
if (_WithdrawalMessage == null)
{
return null;
}
else
{
return _WithdrawalMessage.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 preWithdrawalMessageChange (WorkFlowMessage newWithdrawalMessage) 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 postWithdrawalMessageChange () throws FieldException
{
}
public FieldWriteability getWriteability_WithdrawalMessage ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference WithdrawalMessage. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setWithdrawalMessage (WorkFlowMessage newWithdrawalMessage) throws StorageException, FieldException
{
if (_WithdrawalMessage.wouldReferencedChange (newWithdrawalMessage))
{
assertValid();
Debug.assertion (AttributeDecoratorUtils.getWriteability (SINGLEREFERENCE_WithdrawalMessage_Decorators, (WorkFlowStage)this, SINGLEREFERENCE_WithdrawalMessage ,getWriteability_WithdrawalMessage ()) != FieldWriteability.FALSE, "Assoc WithdrawalMessage is not writeable");
preWithdrawalMessageChange (newWithdrawalMessage);
_WithdrawalMessage.set (newWithdrawalMessage);
postWithdrawalMessageChange ();
}
}
/**
* Get the reference WorkFlowTemplate
*/
public WorkFlowTemplate getWorkFlowTemplate () throws StorageException
{
assertValid();
try
{
return (WorkFlowTemplate)(_WorkFlowTemplate.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in WorkFlowStage:", this.getObjectID (), ", was trying to get WorkFlowTemplate:", getWorkFlowTemplateID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _WorkFlowTemplate.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public WorkFlowTemplate getWorkFlowTemplate (Get getType) throws StorageException
{
assertValid();
return _WorkFlowTemplate.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getWorkFlowTemplateID ()
{
assertValid();
if (_WorkFlowTemplate == null)
{
return null;
}
else
{
return _WorkFlowTemplate.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 preWorkFlowTemplateChange (WorkFlowTemplate newWorkFlowTemplate) 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 postWorkFlowTemplateChange () throws FieldException
{
}
public FieldWriteability getWriteability_WorkFlowTemplate ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference WorkFlowTemplate. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setWorkFlowTemplate (WorkFlowTemplate newWorkFlowTemplate) throws StorageException, FieldException
{
BusinessObjectParser.assertFieldCondition (newWorkFlowTemplate != null, this, SINGLEREFERENCE_WorkFlowTemplate, "mandatory");
if (_WorkFlowTemplate.wouldReferencedChange (newWorkFlowTemplate))
{
assertValid();
Debug.assertion (AttributeDecoratorUtils.getWriteability (SINGLEREFERENCE_WorkFlowTemplate_Decorators, (WorkFlowStage)this, SINGLEREFERENCE_WorkFlowTemplate ,getWriteability_WorkFlowTemplate ()) != FieldWriteability.FALSE, "Assoc WorkFlowTemplate is not writeable");
preWorkFlowTemplateChange (newWorkFlowTemplate);
WorkFlowTemplate oldWorkFlowTemplate = getWorkFlowTemplate ();
if (oldWorkFlowTemplate != null)
{
// This is to stop validation from triggering when we are removed
_WorkFlowTemplate.set (null);
oldWorkFlowTemplate.removeFromWorkFlowStages ((WorkFlowStage)(this));
}
_WorkFlowTemplate.set (newWorkFlowTemplate);
if (newWorkFlowTemplate != null)
{
newWorkFlowTemplate.addToWorkFlowStages ((WorkFlowStage)(this));
}
postWorkFlowTemplateChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getMultiAssocs()
{
List result = super.getMultiAssocs ();
result.add("WorkFlowMessages");
return result;
}
/**
* Get the reference instance for the multi assoc name.
*/
public BaseBusinessClass getMultiAssocReferenceInstance(String attribName)
{
if (MULTIPLEREFERENCE_WorkFlowMessages.equals(attribName))
{
return WorkFlowMessage.REFERENCE_WorkFlowMessage ;
}
return super.getMultiAssocReferenceInstance(attribName);
}
public String getMultiAssocBackReference(String attribName)
{
if (MULTIPLEREFERENCE_WorkFlowMessages.equals(attribName))
{
return WorkFlowMessage.SINGLEREFERENCE_WorkFlowStage ;
}
return super.getMultiAssocBackReference(attribName);
}
/**
* Get the assoc count for the multi assoc name.
*/
public int getMultiAssocCount(String attribName) throws StorageException
{
if (MULTIPLEREFERENCE_WorkFlowMessages.equals(attribName))
{
return this.getWorkFlowMessagesCount();
}
return super.getMultiAssocCount(attribName);
}
/**
* Get the assoc at a particular index
*/
public BaseBusinessClass getMultiAssocAt(String attribName, int index) throws StorageException
{
if (MULTIPLEREFERENCE_WorkFlowMessages.equals(attribName))
{
return this.getWorkFlowMessagesAt(index);
}
return super.getMultiAssocAt(attribName, index);
}
/**
* Add to a multi assoc by attribute name
*/
public void addToMultiAssoc(String attribName, BaseBusinessClass newElement) throws StorageException
{
if (MULTIPLEREFERENCE_WorkFlowMessages.equals(attribName))
{
addToWorkFlowMessages((WorkFlowMessage)newElement);
return;
}
super.addToMultiAssoc(attribName, newElement);
}
/**
* Remove from a multi assoc by attribute name
*/
public void removeFromMultiAssoc(String attribName, BaseBusinessClass oldElement) throws StorageException
{
if (MULTIPLEREFERENCE_WorkFlowMessages.equals(attribName))
{
removeFromWorkFlowMessages((WorkFlowMessage)oldElement);
return;
}
super.removeFromMultiAssoc(attribName, oldElement);
}
protected void __loadMultiAssoc (String attribName, BaseBusinessClass[] elements)
{
if (MULTIPLEREFERENCE_WorkFlowMessages.equals(attribName))
{
_WorkFlowMessages.__loadAssociation (elements);
return;
}
super.__loadMultiAssoc(attribName, elements);
}
protected boolean __isMultiAssocLoaded (String attribName)
{
if (MULTIPLEREFERENCE_WorkFlowMessages.equals(attribName))
{
return _WorkFlowMessages.isLoaded ();
}
return super.__isMultiAssocLoaded(attribName);
}
public FieldWriteability getWriteability_WorkFlowMessages ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
public int getWorkFlowMessagesCount () throws StorageException
{
assertValid();
return _WorkFlowMessages.getReferencedObjectsCount ();
}
public void addToWorkFlowMessages (WorkFlowMessage newElement) throws StorageException
{
if (_WorkFlowMessages.wouldAddChange (newElement))
{
assertValid();
Debug.assertion (AttributeDecoratorUtils.getWriteability (MULTIPLEREFERENCE_WorkFlowMessages_Decorators, (WorkFlowStage)this, MULTIPLEREFERENCE_WorkFlowMessages ,getWriteability_WorkFlowMessages ()) != FieldWriteability.FALSE, "MultiAssoc WorkFlowMessages is not writeable (add)");
_WorkFlowMessages.appendElement (newElement);
try
{
if (newElement.getWorkFlowStage () != this)
{
newElement.setWorkFlowStage ((WorkFlowStage)(this));
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
}
}
public void removeFromWorkFlowMessages (WorkFlowMessage elementToRemove) throws StorageException
{
if (_WorkFlowMessages.wouldRemoveChange (elementToRemove))
{
assertValid();
Debug.assertion (AttributeDecoratorUtils.getWriteability (MULTIPLEREFERENCE_WorkFlowMessages_Decorators, (WorkFlowStage)this, MULTIPLEREFERENCE_WorkFlowMessages ,getWriteability_WorkFlowMessages ()) != FieldWriteability.FALSE, "MultiAssoc WorkFlowMessages is not writeable (remove)");
_WorkFlowMessages.removeElement (elementToRemove);
try
{
if (elementToRemove.getWorkFlowStage () != null)
{
elementToRemove.setWorkFlowStage (null);
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
}
}
public WorkFlowMessage getWorkFlowMessagesAt (int index) throws StorageException
{
return (WorkFlowMessage)(_WorkFlowMessages.getElementAt (index));
}
public SortedSet<WorkFlowMessage> getWorkFlowMessagesSet () throws StorageException
{
return _WorkFlowMessages.getSet ();
}
public void onDelete ()
{
try
{
// Ensure we are removed from any loaded multi-associations that aren't mandatory
if (_WorkFlowTemplate.isLoaded () || getTransaction ().isObjectLoaded (_WorkFlowTemplate.getReferencedType (), getWorkFlowTemplateID ()))
{
WorkFlowTemplate referenced = getWorkFlowTemplate ();
if (referenced != null)
{
// Stop the callback
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null WorkFlowStages from ", getObjectID (), " to ", referenced.getObjectID ());
_WorkFlowTemplate.set (null);
referenced.removeFromWorkFlowStages ((WorkFlowStage)this);
}
}
for(WorkFlowMessage referenced : CollectionUtils.reverse(getWorkFlowMessagesSet()))
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null WorkFlowStage from ", getObjectID (), " to ", referenced.getObjectID ());
referenced.setWorkFlowStage(null);
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
super.onDelete ();
}
public WorkFlowStage newInstance ()
{
return new WorkFlowStage ();
}
public WorkFlowStage referenceInstance ()
{
return REFERENCE_WorkFlowStage;
}
public WorkFlowStage getInTransaction (ObjectTransaction t) throws StorageException
{
return getWorkFlowStageByID (t, getObjectID());
}
public BaseBusinessClass dummyInstance ()
{
return DUMMY_WorkFlowStage;
}
public String getBaseSetName ()
{
return "tl_work_flow_stage";
}
/**
* 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_work_flow_stagePSet = allSets.getPersistentSet (myID, "tl_work_flow_stage", myPSetStatus);
tl_work_flow_stagePSet.setAttrib (FIELD_ObjectID, myID);
tl_work_flow_stagePSet.setAttrib (FIELD_Name, HELPER_Name.toObject (_Name)); //
tl_work_flow_stagePSet.setAttrib (FIELD_UseMessaging, HELPER_UseMessaging.toObject (_UseMessaging)); //
tl_work_flow_stagePSet.setAttrib (FIELD_StageType, HELPER_StageType.toObject (_StageType)); //
tl_work_flow_stagePSet.setAttrib (FIELD_SortOrder, HELPER_SortOrder.toObject (_SortOrder)); //
_WithdrawalMessage.getPersistentSets (allSets);
_WorkFlowTemplate.getPersistentSets (allSets);
}
/**
* Sets the objects state based on Persistent sets.
*/
public void setFromPersistentSets (ObjectID objectID, PersistentSetCollection allSets)
{
super.setFromPersistentSets (objectID, allSets);
PersistentSet tl_work_flow_stagePSet = allSets.getPersistentSet (objectID, "tl_work_flow_stage");
_Name = (String)(HELPER_Name.fromObject (_Name, tl_work_flow_stagePSet.getAttrib (FIELD_Name))); //
_UseMessaging = (Boolean)(HELPER_UseMessaging.fromObject (_UseMessaging, tl_work_flow_stagePSet.getAttrib (FIELD_UseMessaging))); //
_StageType = (StageType)(HELPER_StageType.fromObject (_StageType, tl_work_flow_stagePSet.getAttrib (FIELD_StageType))); //
_SortOrder = (Integer)(HELPER_SortOrder.fromObject (_SortOrder, tl_work_flow_stagePSet.getAttrib (FIELD_SortOrder))); //
_WithdrawalMessage.setFromPersistentSets (objectID, allSets);
_WorkFlowTemplate.setFromPersistentSets (objectID, allSets);
}
public void setAttributesFrom (BaseBusinessClass other, MultiException e)
{
super.setAttributesFrom (other, e);
if (other instanceof WorkFlowStage)
{
WorkFlowStage otherWorkFlowStage = (WorkFlowStage)other;
try
{
setName (otherWorkFlowStage.getName ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setUseMessaging (otherWorkFlowStage.getUseMessaging ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setStageType (otherWorkFlowStage.getStageType ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setSortOrder (otherWorkFlowStage.getSortOrder ());
}
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 BaseWorkFlowStage)
{
BaseWorkFlowStage sourceWorkFlowStage = (BaseWorkFlowStage)(source);
_Name = sourceWorkFlowStage._Name;
_UseMessaging = sourceWorkFlowStage._UseMessaging;
_StageType = sourceWorkFlowStage._StageType;
_SortOrder = sourceWorkFlowStage._SortOrder;
}
}
/**
* 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 BaseWorkFlowStage)
{
BaseWorkFlowStage sourceWorkFlowStage = (BaseWorkFlowStage)(source);
_WithdrawalMessage.copyFrom (sourceWorkFlowStage._WithdrawalMessage, linkToGhosts);
_WorkFlowTemplate.copyFrom (sourceWorkFlowStage._WorkFlowTemplate, 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 BaseWorkFlowStage)
{
BaseWorkFlowStage sourceWorkFlowStage = (BaseWorkFlowStage)(source);
_WorkFlowMessages.copyFrom (sourceWorkFlowStage._WorkFlowMessages, linkToGhosts);
}
}
public void validate (ValidationContext context)
{
super.validate (context);
context.check (getWorkFlowTemplateID() != null, this, SINGLEREFERENCE_WorkFlowTemplate, "mandatory");
}
/**
* Subclasses must override this to read in their attributes
*/
protected void readExternalData(Map<String, Object> vals) throws IOException, ClassNotFoundException
{
super.readExternalData(vals);
_Name = (String)(HELPER_Name.readExternal (_Name, vals.get(FIELD_Name))); //
_UseMessaging = (Boolean)(HELPER_UseMessaging.readExternal (_UseMessaging, vals.get(FIELD_UseMessaging))); //
_StageType = (StageType)(HELPER_StageType.readExternal (_StageType, vals.get(FIELD_StageType))); //
_SortOrder = (Integer)(HELPER_SortOrder.readExternal (_SortOrder, vals.get(FIELD_SortOrder))); //
_WithdrawalMessage.readExternalData(vals.get(SINGLEREFERENCE_WithdrawalMessage));
_WorkFlowTemplate.readExternalData(vals.get(SINGLEREFERENCE_WorkFlowTemplate));
_WorkFlowMessages.readExternalData(vals.get(MULTIPLEREFERENCE_WorkFlowMessages));
}
/**
* Subclasses must override this to write out their attributes
*/
protected void writeExternalData(Map<String, Object> vals) throws IOException
{
super.writeExternalData(vals);
vals.put (FIELD_Name, HELPER_Name.writeExternal (_Name));
vals.put (FIELD_UseMessaging, HELPER_UseMessaging.writeExternal (_UseMessaging));
vals.put (FIELD_StageType, HELPER_StageType.writeExternal (_StageType));
vals.put (FIELD_SortOrder, HELPER_SortOrder.writeExternal (_SortOrder));
vals.put (SINGLEREFERENCE_WithdrawalMessage, _WithdrawalMessage.writeExternalData());
vals.put (SINGLEREFERENCE_WorkFlowTemplate, _WorkFlowTemplate.writeExternalData());
vals.put (MULTIPLEREFERENCE_WorkFlowMessages, _WorkFlowMessages.writeExternalData());
}
public void compare (BaseBusinessClass other, AttributeChangeListener listener) throws StorageException
{
super.compare (other, listener);
if (other instanceof BaseWorkFlowStage)
{
BaseWorkFlowStage otherWorkFlowStage = (BaseWorkFlowStage)(other);
if (!HELPER_Name.compare(this._Name, otherWorkFlowStage._Name))
{
listener.notifyFieldChange(this, other, FIELD_Name, HELPER_Name.toObject(this._Name), HELPER_Name.toObject(otherWorkFlowStage._Name));
}
if (!HELPER_UseMessaging.compare(this._UseMessaging, otherWorkFlowStage._UseMessaging))
{
listener.notifyFieldChange(this, other, FIELD_UseMessaging, HELPER_UseMessaging.toObject(this._UseMessaging), HELPER_UseMessaging.toObject(otherWorkFlowStage._UseMessaging));
}
if (!HELPER_StageType.compare(this._StageType, otherWorkFlowStage._StageType))
{
listener.notifyFieldChange(this, other, FIELD_StageType, HELPER_StageType.toObject(this._StageType), HELPER_StageType.toObject(otherWorkFlowStage._StageType));
}
if (!HELPER_SortOrder.compare(this._SortOrder, otherWorkFlowStage._SortOrder))
{
listener.notifyFieldChange(this, other, FIELD_SortOrder, HELPER_SortOrder.toObject(this._SortOrder), HELPER_SortOrder.toObject(otherWorkFlowStage._SortOrder));
}
// Compare single assocs
_WithdrawalMessage.compare (otherWorkFlowStage._WithdrawalMessage, listener);
_WorkFlowTemplate.compare (otherWorkFlowStage._WorkFlowTemplate, listener);
// Compare multiple assocs
_WorkFlowMessages.compare (otherWorkFlowStage._WorkFlowMessages, listener);
}
}
public void visitTransients (AttributeVisitor visitor) throws StorageException
{
super.visitAttributes (visitor);
}
public void visitAttributes (AttributeVisitor visitor) throws StorageException
{
super.visitAttributes (visitor);
visitor.visitField(this, FIELD_Name, HELPER_Name.toObject(getName()));
visitor.visitField(this, FIELD_UseMessaging, HELPER_UseMessaging.toObject(getUseMessaging()));
visitor.visitField(this, FIELD_StageType, HELPER_StageType.toObject(getStageType()));
visitor.visitField(this, FIELD_SortOrder, HELPER_SortOrder.toObject(getSortOrder()));
visitor.visitAssociation (_WithdrawalMessage);
visitor.visitAssociation (_WorkFlowTemplate);
visitor.visitAssociation (_WorkFlowMessages);
}
public void visitAssociations (AssociationVisitor visitor, AssociatedScope scope) throws StorageException
{
super.visitAssociations (visitor, scope);
if (scope.includes (_WithdrawalMessage))
{
visitor.visit (_WithdrawalMessage);
}
if (scope.includes (_WorkFlowTemplate))
{
visitor.visit (_WorkFlowTemplate);
}
if (scope.includes (_WorkFlowMessages))
{
visitor.visit (_WorkFlowMessages);
}
}
public static WorkFlowStage createWorkFlowStage (ObjectTransaction transaction) throws StorageException
{
WorkFlowStage result = new WorkFlowStage ();
result.initialiseNewObject (transaction);
return result;
}
public static WorkFlowStage getWorkFlowStageByID (ObjectTransaction transaction, Long objectID) throws StorageException
{
return (WorkFlowStage)(transaction.getObjectByID (REFERENCE_WorkFlowStage, objectID));
}
public boolean testFilter (String attribName, QueryFilter filter) throws StorageException
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_Name))
{
return filter.matches (getName ());
}
else if (attribName.equals (FIELD_UseMessaging))
{
return filter.matches (getUseMessaging ());
}
else if (attribName.equals (FIELD_StageType))
{
return filter.matches (getStageType ());
}
else if (attribName.equals (FIELD_SortOrder))
{
return filter.matches (getSortOrder ());
}
else if (attribName.equals (SINGLEREFERENCE_WithdrawalMessage))
{
return filter.matches (getWithdrawalMessage ());
}
else if (attribName.equals (SINGLEREFERENCE_WorkFlowTemplate))
{
return filter.matches (getWorkFlowTemplate ());
}
else
{
return super.testFilter (attribName, filter);
}
}
public static SearchAll SearchByAll () { return new SearchAll (); }
public static class SearchAll extends SearchObject<WorkFlowStage>
{
public SearchAll andObjectID (QueryFilter<Long> filter)
{
filter.addFilter (context, "tl_work_flow_stage.object_id", FIELD_ObjectID);
return this;
}
public SearchAll andObjectCreated (QueryFilter<Date> filter)
{
filter.addFilter (context, "tl_work_flow_stage.object_created_date", FIELD_ObjectCreated);
return this;
}
public SearchAll andObjectLastModified (QueryFilter<Date> filter)
{
filter.addFilter (context, "tl_work_flow_stage.object_last_updated_date", FIELD_ObjectLastModified);
return this;
}
public SearchAll andName (QueryFilter<String> filter)
{
filter.addFilter (context, "tl_work_flow_stage.name", "Name");
return this;
}
public SearchAll andUseMessaging (QueryFilter<Boolean> filter)
{
filter.addFilter (context, "tl_work_flow_stage.use_messaging", "UseMessaging");
return this;
}
public SearchAll andStageType (QueryFilter<StageType> filter)
{
filter.addFilter (context, "tl_work_flow_stage.stage_type", "StageType");
return this;
}
public SearchAll andSortOrder (QueryFilter<Integer> filter)
{
filter.addFilter (context, "tl_work_flow_stage.sort_order", "SortOrder");
return this;
}
public SearchAll andWithdrawalMessage (QueryFilter<WorkFlowMessage> filter)
{
filter.addFilter (context, "tl_work_flow_stage.withdrawal_message_id", "WithdrawalMessage");
return this;
}
public SearchAll andWorkFlowTemplate (QueryFilter<WorkFlowTemplate> filter)
{
filter.addFilter (context, "tl_work_flow_stage.work_flow_template_id", "WorkFlowTemplate");
return this;
}
public WorkFlowStage[] search (ObjectTransaction transaction) throws StorageException
{
BaseBusinessClass[] results = super.search (transaction, REFERENCE_WorkFlowStage, SEARCH_All, criteria);
Set<WorkFlowStage> typedResults = new LinkedHashSet <WorkFlowStage> ();
for (BaseBusinessClass bbcResult : results)
{
WorkFlowStage aResult = (WorkFlowStage)bbcResult;
typedResults.add (aResult);
}
return ObjstoreUtils.removeDeleted(transaction, typedResults).toArray (new WorkFlowStage[0]);
}
}
public static WorkFlowStage[] searchAll (ObjectTransaction transaction) throws StorageException
{
return SearchByAll ()
.search (transaction);
}
public Object getAttribute (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_Name))
{
return HELPER_Name.toObject (getName ());
}
else if (attribName.equals (FIELD_UseMessaging))
{
return HELPER_UseMessaging.toObject (getUseMessaging ());
}
else if (attribName.equals (FIELD_StageType))
{
return HELPER_StageType.toObject (getStageType ());
}
else if (attribName.equals (FIELD_SortOrder))
{
return HELPER_SortOrder.toObject (getSortOrder ());
}
else
{
return super.getAttribute (attribName);
}
}
public AttributeHelper getAttributeHelper (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_Name))
{
return HELPER_Name;
}
else if (attribName.equals (FIELD_UseMessaging))
{
return HELPER_UseMessaging;
}
else if (attribName.equals (FIELD_StageType))
{
return HELPER_StageType;
}
else if (attribName.equals (FIELD_SortOrder))
{
return HELPER_SortOrder;
}
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_Name))
{
setName ((String)(HELPER_Name.fromObject (_Name, attribValue)));
}
else if (attribName.equals (FIELD_UseMessaging))
{
setUseMessaging ((Boolean)(HELPER_UseMessaging.fromObject (_UseMessaging, attribValue)));
}
else if (attribName.equals (FIELD_StageType))
{
setStageType ((StageType)(HELPER_StageType.fromObject (_StageType, attribValue)));
}
else if (attribName.equals (FIELD_SortOrder))
{
setSortOrder ((Integer)(HELPER_SortOrder.fromObject (_SortOrder, attribValue)));
}
else
{
super.setAttribute (attribName, attribValue);
}
}
public boolean isWriteable (String fieldName)
{
return getWriteable (fieldName) == FieldWriteability.TRUE;
}
public boolean isReadable ()
{
return super.isReadable();
}
public boolean isReadable (String fieldName)
{
return super.isReadable(fieldName);
}
public FieldWriteability getWriteable (String fieldName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (fieldName.equals (FIELD_Name))
{
return getWriteability_Name ();
}
else if (fieldName.equals (FIELD_UseMessaging))
{
return getWriteability_UseMessaging ();
}
else if (fieldName.equals (FIELD_StageType))
{
return getWriteability_StageType ();
}
else if (fieldName.equals (FIELD_SortOrder))
{
return getWriteability_SortOrder ();
}
else if (fieldName.equals (MULTIPLEREFERENCE_WorkFlowMessages))
{
return getWriteability_WorkFlowMessages ();
}
else if (fieldName.equals (SINGLEREFERENCE_WithdrawalMessage))
{
return getWriteability_WithdrawalMessage ();
}
else if (fieldName.equals (SINGLEREFERENCE_WorkFlowTemplate))
{
return getWriteability_WorkFlowTemplate ();
}
else
{
return super.getWriteable (fieldName);
}
}
public void putUnwriteable (Set<String> fields)
{
if (getWriteability_Name () != FieldWriteability.TRUE)
{
fields.add (FIELD_Name);
}
if (getWriteability_UseMessaging () != FieldWriteability.TRUE)
{
fields.add (FIELD_UseMessaging);
}
if (getWriteability_StageType () != FieldWriteability.TRUE)
{
fields.add (FIELD_StageType);
}
if (getWriteability_SortOrder () != FieldWriteability.TRUE)
{
fields.add (FIELD_SortOrder);
}
super.putUnwriteable (fields);
}
public String[] getAllTableNames()
{
return new String[] {"tl_work_flow_stage"};
}
public boolean isPolymorphic(String tableName)
{
return super.isPolymorphic(tableName);
}
public List<AbstractAttribute> getAttributes ()
{
List result = super.getAttributes ();
result.add(HELPER_Name.getAttribObject (getClass (), _Name, true, FIELD_Name));
result.add(HELPER_UseMessaging.getAttribObject (getClass (), _UseMessaging, false, FIELD_UseMessaging));
result.add(HELPER_StageType.getAttribObject (getClass (), _StageType, true, FIELD_StageType));
result.add(HELPER_SortOrder.getAttribObject (getClass (), _SortOrder, true, FIELD_SortOrder));
return result;
}
public Map getAttributeMetadata (String attribute)
{
if (ATTRIBUTES_METADATA_WorkFlowStage.containsKey (attribute))
{
return (Map)ATTRIBUTES_METADATA_WorkFlowStage.get (attribute);
}
else
{
return super.getAttributeMetadata (attribute);
}
}
public Object getAttributeMetadata (String attribute, String metadata)
{
if (ATTRIBUTES_METADATA_WorkFlowStage.containsKey (attribute))
{
return ((Map)ATTRIBUTES_METADATA_WorkFlowStage.get (attribute)).get(metadata);
}
else
{
return super.getAttributeMetadata (attribute, metadata);
}
}
public void copyAllAttributeMetadata (Map copyInto)
{
super.copyAllAttributeMetadata(copyInto);
copyInto.putAll(ATTRIBUTES_METADATA_WorkFlowStage);
}
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 WorkFlowStageBehaviourDecorator extends BaseBusinessClass.BBCBehaviourDecorator<WorkFlowStage>
{
/**
* Get the attribute Name
*/
public String getName (WorkFlowStage obj, String original)
{
return original;
}
/**
* Change the value set for attribute Name.
* May modify the field beforehand
* Occurs before validation.
*/
public String setName (WorkFlowStage obj, String newName) throws FieldException
{
return newName;
}
/**
* Get the attribute UseMessaging
*/
public Boolean getUseMessaging (WorkFlowStage obj, Boolean original)
{
return original;
}
/**
* Change the value set for attribute UseMessaging.
* May modify the field beforehand
* Occurs before validation.
*/
public Boolean setUseMessaging (WorkFlowStage obj, Boolean newUseMessaging) throws FieldException
{
return newUseMessaging;
}
/**
* Get the attribute StageType
*/
public StageType getStageType (WorkFlowStage obj, StageType original)
{
return original;
}
/**
* Change the value set for attribute StageType.
* May modify the field beforehand
* Occurs before validation.
*/
public StageType setStageType (WorkFlowStage obj, StageType newStageType) throws FieldException
{
return newStageType;
}
/**
* Get the attribute SortOrder
*/
public Integer getSortOrder (WorkFlowStage obj, Integer original)
{
return original;
}
/**
* Change the value set for attribute SortOrder.
* May modify the field beforehand
* Occurs before validation.
*/
public Integer setSortOrder (WorkFlowStage obj, Integer newSortOrder) throws FieldException
{
return newSortOrder;
}
}
@Override
public ORMPipeLine pipes()
{
return new WorkFlowStagePipeLineFactory<WorkFlowStage, WorkFlowStage> ((WorkFlowStage)this);
}
@Override
public ORMPipeLine pipes(Collection _items)
{
return pipesWorkFlowStage(_items);
}
/**
* Use this instead of pipes() to get rid of type casting.
*/
public WorkFlowStagePipeLineFactory<WorkFlowStage, WorkFlowStage> pipelineWorkFlowStage()
{
return (WorkFlowStagePipeLineFactory<WorkFlowStage, WorkFlowStage>) pipes();
}
public static WorkFlowStagePipeLineFactory<WorkFlowStage, WorkFlowStage> pipesWorkFlowStage(Collection<WorkFlowStage> items)
{
return REFERENCE_WorkFlowStage.new WorkFlowStagePipeLineFactory<WorkFlowStage, WorkFlowStage> (items);
}
public static WorkFlowStagePipeLineFactory<WorkFlowStage, WorkFlowStage> pipesWorkFlowStage(WorkFlowStage[] _items)
{
return pipesWorkFlowStage(Arrays.asList (_items));
}
public static WorkFlowStagePipeLineFactory<WorkFlowStage, WorkFlowStage> pipesWorkFlowStage()
{
return pipesWorkFlowStage((Collection)null);
}
public class WorkFlowStagePipeLineFactory<From extends BaseBusinessClass, Me extends WorkFlowStage> extends BaseBusinessClass.ORMPipeLine<From, Me>
{
public <Prev> WorkFlowStagePipeLineFactory (PipeLine<From, Prev> pipeLine, Pipe<Prev, Me> nextPipe)
{
super (pipeLine, nextPipe);
}
public WorkFlowStagePipeLineFactory (From seed)
{
super(seed);
}
public WorkFlowStagePipeLineFactory (Collection<From> seed)
{
super(seed);
}
public PipeLine<From, ? extends Object> to(String name)
{
if (name.equals ("WorkFlowMessages"))
{
return toWorkFlowMessages ();
}
if (name.equals ("Name"))
{
return toName ();
}
if (name.equals ("UseMessaging"))
{
return toUseMessaging ();
}
if (name.equals ("StageType"))
{
return toStageType ();
}
if (name.equals ("SortOrder"))
{
return toSortOrder ();
}
if (name.equals ("WithdrawalMessage"))
{
return toWithdrawalMessage ();
}
if (name.equals ("WorkFlowTemplate"))
{
return toWorkFlowTemplate ();
}
return super.to(name);
}
public PipeLine<From, String> toName () { return pipe(new ORMAttributePipe<Me, String>(FIELD_Name)); }
public PipeLine<From, Boolean> toUseMessaging () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_UseMessaging)); }
public StageType.StageTypePipeLineFactory<From, StageType> toStageType ()
{
return new StageType.StageTypePipeLineFactory<> (this, new ORMAttributePipe<>(FIELD_StageType));
}
public PipeLine<From, Integer> toSortOrder () { return pipe(new ORMAttributePipe<Me, Integer>(FIELD_SortOrder)); }
public WorkFlowMessage.WorkFlowMessagePipeLineFactory<From, WorkFlowMessage> toWithdrawalMessage () { return toWithdrawalMessage (Filter.ALL); }
public WorkFlowMessage.WorkFlowMessagePipeLineFactory<From, WorkFlowMessage> toWithdrawalMessage (Filter<WorkFlowMessage> filter)
{
return WorkFlowMessage.REFERENCE_WorkFlowMessage.new WorkFlowMessagePipeLineFactory<From, WorkFlowMessage> (this, new ORMSingleAssocPipe<Me, WorkFlowMessage>(SINGLEREFERENCE_WithdrawalMessage, filter));
}
public WorkFlowTemplate.WorkFlowTemplatePipeLineFactory<From, WorkFlowTemplate> toWorkFlowTemplate () { return toWorkFlowTemplate (Filter.ALL); }
public WorkFlowTemplate.WorkFlowTemplatePipeLineFactory<From, WorkFlowTemplate> toWorkFlowTemplate (Filter<WorkFlowTemplate> filter)
{
return WorkFlowTemplate.REFERENCE_WorkFlowTemplate.new WorkFlowTemplatePipeLineFactory<From, WorkFlowTemplate> (this, new ORMSingleAssocPipe<Me, WorkFlowTemplate>(SINGLEREFERENCE_WorkFlowTemplate, filter));
}
public WorkFlowMessage.WorkFlowMessagePipeLineFactory<From, WorkFlowMessage> toWorkFlowMessages () { return toWorkFlowMessages(Filter.ALL); }
public WorkFlowMessage.WorkFlowMessagePipeLineFactory<From, WorkFlowMessage> toWorkFlowMessages (Filter<WorkFlowMessage> filter)
{
return WorkFlowMessage.REFERENCE_WorkFlowMessage.new WorkFlowMessagePipeLineFactory<From, WorkFlowMessage> (this, new ORMMultiAssocPipe<Me, WorkFlowMessage>(MULTIPLEREFERENCE_WorkFlowMessages, filter));
}
}
public boolean isTransientAttrib(String attribName)
{
return super.isTransientAttrib(attribName);
}
public boolean isTransientSingleReference(String assocName)
{
return super.isTransientSingleReference(assocName);
}
}
class DummyWorkFlowStage extends WorkFlowStage
{
// Default constructor primarily to support Externalisable
public DummyWorkFlowStage()
{
super();
}
public void assertValid ()
{
}
public WorkFlowMessage getWithdrawalMessage () throws StorageException
{
return (WorkFlowMessage)(WorkFlowMessage.DUMMY_WorkFlowMessage);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getWithdrawalMessageID ()
{
return WorkFlowMessage.DUMMY_WorkFlowMessage.getObjectID();
}
public WorkFlowTemplate getWorkFlowTemplate () throws StorageException
{
return (WorkFlowTemplate)(WorkFlowTemplate.DUMMY_WorkFlowTemplate);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getWorkFlowTemplateID ()
{
return WorkFlowTemplate.DUMMY_WorkFlowTemplate.getObjectID();
}
public int getWorkFlowMessagesCount () throws StorageException
{
return 0;
}
public WorkFlowMessage getWorkFlowMessagesAt (int index) throws StorageException
{
throw new RuntimeException ("No elements in a dummy object in association WorkFlowMessages");
}
public SortedSet getWorkFlowMessagesSet () throws StorageException
{
return new TreeSet();
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
package performa.orm;
import java.io.*;
import java.util.*;
import oneit.appservices.config.*;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.utils.*;
public class ChatAttachment extends BaseChatAttachment
{
private static final long serialVersionUID = 0L;
// This constructor should not be called
public ChatAttachment ()
{
// Do not add any code to this, always put it in initialiseNewObject
}
}
<?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="ChatAttachment" package="performa.orm">
<TABLE name="tl_chat_attachment" tablePrefix="object" polymorphic="FALSE">
<ATTRIB name="File" type="BinaryContent" dbcol="file" attribHelper="BLOBAttributeHelper" attribHelperInstance="BLOBAttributeHelper.INSTANCE" binaryHandler="loggedin"/>
<SINGLEREFERENCE name="Message" type="Message" dbcol="message_id" backreferenceName="Attachments"/>
</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 ChatAttachmentPersistenceMgr extends ObjectPersistenceMgr
{
private static final LoggingArea ChatAttachmentPersistence = LoggingArea.createLoggingArea(ObjectPersistenceMgr.OBJECT_PERSISTENCE, "ChatAttachment");
// Private attributes corresponding to business object data
private BinaryContent dummyFile;
// Static constants corresponding to attribute helpers
private static final BLOBAttributeHelper HELPER_File = BLOBAttributeHelper.INSTANCE;
public ChatAttachmentPersistenceMgr ()
{
dummyFile = (BinaryContent)(HELPER_File.initialise (dummyFile));
}
private String SELECT_COLUMNS = "{PREFIX}tl_chat_attachment.object_id as id, {PREFIX}tl_chat_attachment.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_chat_attachment.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_chat_attachment.file, {PREFIX}tl_chat_attachment.message_id, 1 AS commasafe ";
private String SELECT_JOINS = "";
public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
Set<BaseBusinessClass> resultByIDs = fetchByIDs(Collections.singleton (id), allPSets, context, sqlMgr);
if (resultByIDs.isEmpty ())
{
return null;
}
else if (resultByIDs.size () > 1)
{
throw new StorageException ("Multiple results for id:" + id);
}
else
{
return resultByIDs.iterator ().next ();
}
}
public Set<BaseBusinessClass> fetchByIDs(Set<ObjectID> ids, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
Set<BaseBusinessClass> results = new HashSet ();
Set<Long> idsToFetch = new HashSet ();
for (ObjectID id : ids)
{
if (context.containsObject(id)) // Check for cached version
{
BaseBusinessClass objectToReturn = context.getObjectToReplace(id, ChatAttachment.REFERENCE_ChatAttachment);
if (objectToReturn instanceof ChatAttachment)
{
LogMgr.log (ChatAttachmentPersistence, 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 ChatAttachment");
}
}
PersistentSet tl_chat_attachmentPSet = allPSets.getPersistentSet(id, "tl_chat_attachment", PersistentSetStatus.FETCHED);
// Check for persistent sets already prefetched
if (false || !tl_chat_attachmentPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!tl_chat_attachmentPSet.containsAttrib(ChatAttachment.FIELD_File)||
!tl_chat_attachmentPSet.containsAttrib(ChatAttachment.SINGLEREFERENCE_Message))
{
// We will need to retrieve it
idsToFetch.add (id.longValue());
}
else
{
LogMgr.log (ChatAttachmentPersistence, LogLevel.DEBUG2, "Persistent set preloaded id:", id);
/* Non Polymorphic */
ChatAttachment result = new ChatAttachment ();
result.setFromPersistentSets(id, allPSets);
context.addRetrievedObject(result);
results.add (result);
}
}
if (idsToFetch.size () > 0)
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_chat_attachment " +
"WHERE " + SELECT_JOINS + "{PREFIX}tl_chat_attachment.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 (ChatAttachment.SINGLEREFERENCE_Message))
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_chat_attachment " +
"WHERE " + SELECT_JOINS + "message_id = ?";
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 tl_chat_attachmentPSet = allPSets.getPersistentSet(objectID, "tl_chat_attachment");
if (tl_chat_attachmentPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_chat_attachmentPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}tl_chat_attachment " +
"SET file = ?, message_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE tl_chat_attachment.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_File.getForSQL(dummyFile, tl_chat_attachmentPSet.getAttrib (ChatAttachment.FIELD_File))).listEntry (SQLManager.CheckNull((Long)(tl_chat_attachmentPSet.getAttrib (ChatAttachment.SINGLEREFERENCE_Message)))).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_chat_attachment 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_chat_attachment", objectID.longID (), obj.getObjectLastModified (), d },
sqlMgr.getPortabilityServices ());
LogMgr.log (ChatAttachmentPersistence, LogLevel.BUSINESS1, errorMsg);
throw new ConcurrentUpdateConflictException (obj, "tl_chat_attachment");
}
else
{
String errorMsg = "Attempt to update nonexistent row in table:tl_chat_attachment for row:" + objectID + " objDate:" + obj.getObjectLastModified ();
LogMgr.log (ChatAttachmentPersistence, LogLevel.BUSINESS1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
tl_chat_attachmentPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
else
{
LogMgr.log (ChatAttachmentPersistence, 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_chat_attachmentPSet = allPSets.getPersistentSet(objectID, "tl_chat_attachment");
LogMgr.log (ChatAttachmentPersistence, LogLevel.DEBUG2, "Deleting:", objectID);
if (tl_chat_attachmentPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_chat_attachmentPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsDeleted = executeStatement (sqlMgr,
"DELETE " +
"FROM {PREFIX}tl_chat_attachment " +
"WHERE tl_chat_attachment.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_chat_attachment WHERE object_id = ?",
new Object[] { objectID.longID() });
if (r.next ())
{
throw new ConcurrentUpdateConflictException (obj, "tl_chat_attachment");
}
else
{
String errorMsg = "Attempt to delete nonexistent row in table:tl_chat_attachment for row:" + objectID;
LogMgr.log (ChatAttachmentPersistence, LogLevel.SYSTEMERROR1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
tl_chat_attachmentPSet.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, ChatAttachment> results = new LinkedHashMap ();
ResultSet r = executeQuery (sqlMgr, query, params);
while (r.next())
{
ThreadUtils.checkInterrupted ();
ObjectID objectID = new ObjectID (ChatAttachment.REFERENCE_ChatAttachment.getObjectIDSpace (), r.getLong ("id"));
ChatAttachment 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, ChatAttachment.REFERENCE_ChatAttachment);
if (cachedElement instanceof ChatAttachment)
{
LogMgr.log (ChatAttachmentPersistence, LogLevel.TRACE, "Cache hit for id:", objectID);
resultElement = (ChatAttachment)cachedElement;
}
else
{
throw new StorageException ("Cache collision for id:" + objectID + " with object " + cachedElement + "while fetching a ChatAttachment");
}
}
else
{
PersistentSet tl_chat_attachmentPSet = allPSets.getPersistentSet(objectID, "tl_chat_attachment", PersistentSetStatus.FETCHED);
createPersistentSetFromRS(allPSets, r, objectID);
resultElement = new ChatAttachment ();
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 (ChatAttachmentPersistence, 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_chat_attachment " + 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_chat_attachmentPSet = allPSets.getPersistentSet(objectID, "tl_chat_attachment", PersistentSetStatus.FETCHED);
// Object Modified
tl_chat_attachmentPSet.setAttrib(BaseBusinessClass.FIELD_ObjectLastModified, r.getTimestamp ("LAST_UPDATED_DATE"));
// Object Created
tl_chat_attachmentPSet.setAttrib(BaseBusinessClass.FIELD_ObjectCreated, r.getTimestamp ("CREATED_DATE"));
tl_chat_attachmentPSet.setAttrib(ChatAttachment.FIELD_File, HELPER_File.getFromRS(dummyFile, r, "file"));
tl_chat_attachmentPSet.setAttrib(ChatAttachment.SINGLEREFERENCE_Message, r.getObject ("message_id"));
}
public void create(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet tl_chat_attachmentPSet = allPSets.getPersistentSet(objectID, "tl_chat_attachment");
if (tl_chat_attachmentPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_chat_attachmentPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
executeStatement (sqlMgr,
"INSERT INTO {PREFIX}tl_chat_attachment " +
" (file, message_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " +
" (?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_File.getForSQL(dummyFile, tl_chat_attachmentPSet.getAttrib (ChatAttachment.FIELD_File))) .listEntry (SQLManager.CheckNull((Long)(tl_chat_attachmentPSet.getAttrib (ChatAttachment.SINGLEREFERENCE_Message)))) .listEntry (objectID.longID ()).toList().toArray());
tl_chat_attachmentPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
}
......@@ -11,6 +11,8 @@
<MULTIPLEREFERENCE name="Clients" type="Client" backreferenceName="HiringTeam" />
<MULTIPLEREFERENCE name="BillingTeams" type="HiringTeam" backreferenceName="BilledByTeam" />
<MULTIPLEREFERENCE name="DiversityQuestions" type="HTDiversityQuestion" backreferenceName="HiringTeam" />
<MULTIPLEREFERENCE name="WorkFlowTemplates" type="WorkFlowTemplate" backreferenceName="HiringTeam" />
<MULTIPLEREFERENCE name="MessageTemplates" type="MessageTemplate" backreferenceName="HiringTeam" />
<TRANSIENT name="ExistingCustomer" type="Boolean" defaultValue="Boolean.TRUE"/>
<TRANSIENT name="IsLogoDeleted" type="Boolean" defaultValue="Boolean.FALSE"/>
......
......@@ -70,6 +70,7 @@
<SINGLEREFERENCE name="ShortenedURL" type="ShortenedURL" dbcol="shortened_url_id" />
<SINGLEREFERENCE name="AssessmentTemplate" type="AssessmentCriteriaTemplate" dbcol="template_id" />
<SINGLEREFERENCE name="ILOJobTitle" type="ILOJobTitle" dbcol="job_title_id" mandatory="true"/>
<SINGLEREFERENCE name="WorkFlowTemplate" type="WorkFlowTemplate" dbcol="work_flow_template_id" backreferenceName="Jobs" mandatory="false"/>
</TABLE>
......
......@@ -10,6 +10,7 @@
<MULTIPLEREFERENCE name="Notes" type="Note" backreferenceName="JobApplication" />
<MULTIPLEREFERENCE name="ScheduledEmails" type="ScheduledEmail" backreferenceName="JobApplication" />
<MULTIPLEREFERENCE name="SentEmails" type="SentEmail" backreferenceName="JobApplication" />
<MULTIPLEREFERENCE name="Messages" type="Message" backreferenceName="JobApplication" />
<TRANSIENT name="AppProcessOption" type="AppProcessOption" attribHelper="EnumeratedAttributeHelper"/>
<TRANSIENT name="OverallRank" type="Integer" />
......@@ -34,6 +35,7 @@
<SINGLEREFERENCE name="Candidate" type="Candidate" dbcol="candidate_id" backreferenceName="JobApplications" mandatory="true"/>
<SINGLEREFERENCE name="Job" type="Job" dbcol="job_id" backreferenceName="JobApplications" mandatory="true"/>
<SINGLEREFERENCE name="WorkFlowStage" type="WorkFlowStage" dbcol="work_flow_stage_id" mandatory="false"/>
</TABLE>
......
......@@ -63,7 +63,7 @@ public class JobApplicationPersistenceMgr extends ObjectPersistenceMgr
}
private String SELECT_COLUMNS = "{PREFIX}tl_job_application.object_id as id, {PREFIX}tl_job_application.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_job_application.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_job_application.cv, {PREFIX}tl_job_application.cover_letter, {PREFIX}tl_job_application.application_status, {PREFIX}tl_job_application.submitted_date, {PREFIX}tl_job_application.google_address_text, {PREFIX}tl_job_application.prefer_remote, {PREFIX}tl_job_application.happy_to_relocate, {PREFIX}tl_job_application.is_email_ingest, {PREFIX}tl_job_application.candidate_id, {PREFIX}tl_job_application.job_id, 1 AS commasafe ";
private String SELECT_COLUMNS = "{PREFIX}tl_job_application.object_id as id, {PREFIX}tl_job_application.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_job_application.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_job_application.cv, {PREFIX}tl_job_application.cover_letter, {PREFIX}tl_job_application.application_status, {PREFIX}tl_job_application.submitted_date, {PREFIX}tl_job_application.google_address_text, {PREFIX}tl_job_application.prefer_remote, {PREFIX}tl_job_application.happy_to_relocate, {PREFIX}tl_job_application.is_email_ingest, {PREFIX}tl_job_application.candidate_id, {PREFIX}tl_job_application.job_id, {PREFIX}tl_job_application.work_flow_stage_id, 1 AS commasafe ";
private String SELECT_JOINS = "";
public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
......@@ -123,7 +123,8 @@ public class JobApplicationPersistenceMgr extends ObjectPersistenceMgr
!tl_job_applicationPSet.containsAttrib(JobApplication.FIELD_HappyToRelocate)||
!tl_job_applicationPSet.containsAttrib(JobApplication.FIELD_IsEmailIngest)||
!tl_job_applicationPSet.containsAttrib(JobApplication.SINGLEREFERENCE_Candidate)||
!tl_job_applicationPSet.containsAttrib(JobApplication.SINGLEREFERENCE_Job))
!tl_job_applicationPSet.containsAttrib(JobApplication.SINGLEREFERENCE_Job)||
!tl_job_applicationPSet.containsAttrib(JobApplication.SINGLEREFERENCE_WorkFlowStage))
{
// We will need to retrieve it
idsToFetch.add (id.longValue());
......@@ -213,10 +214,10 @@ public class JobApplicationPersistenceMgr extends ObjectPersistenceMgr
{
int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}tl_job_application " +
"SET cv = ?, cover_letter = ?, application_status = ?, submitted_date = ?, google_address_text = ?, prefer_remote = ?, happy_to_relocate = ?, is_email_ingest = ?, candidate_id = ? , job_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"SET cv = ?, cover_letter = ?, application_status = ?, submitted_date = ?, google_address_text = ?, prefer_remote = ?, happy_to_relocate = ?, is_email_ingest = ?, candidate_id = ? , job_id = ? , work_flow_stage_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE tl_job_application.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_CV.getForSQL(dummyCV, tl_job_applicationPSet.getAttrib (JobApplication.FIELD_CV))).listEntry (HELPER_CoverLetter.getForSQL(dummyCoverLetter, tl_job_applicationPSet.getAttrib (JobApplication.FIELD_CoverLetter))).listEntry (HELPER_ApplicationStatus.getForSQL(dummyApplicationStatus, tl_job_applicationPSet.getAttrib (JobApplication.FIELD_ApplicationStatus))).listEntry (HELPER_SubmittedDate.getForSQL(dummySubmittedDate, tl_job_applicationPSet.getAttrib (JobApplication.FIELD_SubmittedDate))).listEntry (HELPER_GoogleAddressText.getForSQL(dummyGoogleAddressText, tl_job_applicationPSet.getAttrib (JobApplication.FIELD_GoogleAddressText))).listEntry (HELPER_PreferRemote.getForSQL(dummyPreferRemote, tl_job_applicationPSet.getAttrib (JobApplication.FIELD_PreferRemote))).listEntry (HELPER_HappyToRelocate.getForSQL(dummyHappyToRelocate, tl_job_applicationPSet.getAttrib (JobApplication.FIELD_HappyToRelocate))).listEntry (HELPER_IsEmailIngest.getForSQL(dummyIsEmailIngest, tl_job_applicationPSet.getAttrib (JobApplication.FIELD_IsEmailIngest))).listEntry (SQLManager.CheckNull((Long)(tl_job_applicationPSet.getAttrib (JobApplication.SINGLEREFERENCE_Candidate)))).listEntry (SQLManager.CheckNull((Long)(tl_job_applicationPSet.getAttrib (JobApplication.SINGLEREFERENCE_Job)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
CollectionUtils.listEntry (HELPER_CV.getForSQL(dummyCV, tl_job_applicationPSet.getAttrib (JobApplication.FIELD_CV))).listEntry (HELPER_CoverLetter.getForSQL(dummyCoverLetter, tl_job_applicationPSet.getAttrib (JobApplication.FIELD_CoverLetter))).listEntry (HELPER_ApplicationStatus.getForSQL(dummyApplicationStatus, tl_job_applicationPSet.getAttrib (JobApplication.FIELD_ApplicationStatus))).listEntry (HELPER_SubmittedDate.getForSQL(dummySubmittedDate, tl_job_applicationPSet.getAttrib (JobApplication.FIELD_SubmittedDate))).listEntry (HELPER_GoogleAddressText.getForSQL(dummyGoogleAddressText, tl_job_applicationPSet.getAttrib (JobApplication.FIELD_GoogleAddressText))).listEntry (HELPER_PreferRemote.getForSQL(dummyPreferRemote, tl_job_applicationPSet.getAttrib (JobApplication.FIELD_PreferRemote))).listEntry (HELPER_HappyToRelocate.getForSQL(dummyHappyToRelocate, tl_job_applicationPSet.getAttrib (JobApplication.FIELD_HappyToRelocate))).listEntry (HELPER_IsEmailIngest.getForSQL(dummyIsEmailIngest, tl_job_applicationPSet.getAttrib (JobApplication.FIELD_IsEmailIngest))).listEntry (SQLManager.CheckNull((Long)(tl_job_applicationPSet.getAttrib (JobApplication.SINGLEREFERENCE_Candidate)))).listEntry (SQLManager.CheckNull((Long)(tl_job_applicationPSet.getAttrib (JobApplication.SINGLEREFERENCE_Job)))).listEntry (SQLManager.CheckNull((Long)(tl_job_applicationPSet.getAttrib (JobApplication.SINGLEREFERENCE_WorkFlowStage)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
if (rowsUpdated != 1)
{
......@@ -603,6 +604,7 @@ public class JobApplicationPersistenceMgr extends ObjectPersistenceMgr
tl_job_applicationPSet.setAttrib(JobApplication.SINGLEREFERENCE_Candidate, r.getObject ("candidate_id"));
tl_job_applicationPSet.setAttrib(JobApplication.SINGLEREFERENCE_Job, r.getObject ("job_id"));
tl_job_applicationPSet.setAttrib(JobApplication.SINGLEREFERENCE_WorkFlowStage, r.getObject ("work_flow_stage_id"));
}
......@@ -619,10 +621,10 @@ public class JobApplicationPersistenceMgr extends ObjectPersistenceMgr
{
executeStatement (sqlMgr,
"INSERT INTO {PREFIX}tl_job_application " +
" (cv, cover_letter, application_status, submitted_date, google_address_text, prefer_remote, happy_to_relocate, is_email_ingest, candidate_id, job_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
" (cv, cover_letter, application_status, submitted_date, google_address_text, prefer_remote, happy_to_relocate, is_email_ingest, candidate_id, job_id, work_flow_stage_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " +
" (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_CV.getForSQL(dummyCV, tl_job_applicationPSet.getAttrib (JobApplication.FIELD_CV))).listEntry (HELPER_CoverLetter.getForSQL(dummyCoverLetter, tl_job_applicationPSet.getAttrib (JobApplication.FIELD_CoverLetter))).listEntry (HELPER_ApplicationStatus.getForSQL(dummyApplicationStatus, tl_job_applicationPSet.getAttrib (JobApplication.FIELD_ApplicationStatus))).listEntry (HELPER_SubmittedDate.getForSQL(dummySubmittedDate, tl_job_applicationPSet.getAttrib (JobApplication.FIELD_SubmittedDate))).listEntry (HELPER_GoogleAddressText.getForSQL(dummyGoogleAddressText, tl_job_applicationPSet.getAttrib (JobApplication.FIELD_GoogleAddressText))).listEntry (HELPER_PreferRemote.getForSQL(dummyPreferRemote, tl_job_applicationPSet.getAttrib (JobApplication.FIELD_PreferRemote))).listEntry (HELPER_HappyToRelocate.getForSQL(dummyHappyToRelocate, tl_job_applicationPSet.getAttrib (JobApplication.FIELD_HappyToRelocate))).listEntry (HELPER_IsEmailIngest.getForSQL(dummyIsEmailIngest, tl_job_applicationPSet.getAttrib (JobApplication.FIELD_IsEmailIngest))) .listEntry (SQLManager.CheckNull((Long)(tl_job_applicationPSet.getAttrib (JobApplication.SINGLEREFERENCE_Candidate)))).listEntry (SQLManager.CheckNull((Long)(tl_job_applicationPSet.getAttrib (JobApplication.SINGLEREFERENCE_Job)))) .listEntry (objectID.longID ()).toList().toArray());
" (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_CV.getForSQL(dummyCV, tl_job_applicationPSet.getAttrib (JobApplication.FIELD_CV))).listEntry (HELPER_CoverLetter.getForSQL(dummyCoverLetter, tl_job_applicationPSet.getAttrib (JobApplication.FIELD_CoverLetter))).listEntry (HELPER_ApplicationStatus.getForSQL(dummyApplicationStatus, tl_job_applicationPSet.getAttrib (JobApplication.FIELD_ApplicationStatus))).listEntry (HELPER_SubmittedDate.getForSQL(dummySubmittedDate, tl_job_applicationPSet.getAttrib (JobApplication.FIELD_SubmittedDate))).listEntry (HELPER_GoogleAddressText.getForSQL(dummyGoogleAddressText, tl_job_applicationPSet.getAttrib (JobApplication.FIELD_GoogleAddressText))).listEntry (HELPER_PreferRemote.getForSQL(dummyPreferRemote, tl_job_applicationPSet.getAttrib (JobApplication.FIELD_PreferRemote))).listEntry (HELPER_HappyToRelocate.getForSQL(dummyHappyToRelocate, tl_job_applicationPSet.getAttrib (JobApplication.FIELD_HappyToRelocate))).listEntry (HELPER_IsEmailIngest.getForSQL(dummyIsEmailIngest, tl_job_applicationPSet.getAttrib (JobApplication.FIELD_IsEmailIngest))) .listEntry (SQLManager.CheckNull((Long)(tl_job_applicationPSet.getAttrib (JobApplication.SINGLEREFERENCE_Candidate)))).listEntry (SQLManager.CheckNull((Long)(tl_job_applicationPSet.getAttrib (JobApplication.SINGLEREFERENCE_Job)))).listEntry (SQLManager.CheckNull((Long)(tl_job_applicationPSet.getAttrib (JobApplication.SINGLEREFERENCE_WorkFlowStage)))) .listEntry (objectID.longID ()).toList().toArray());
tl_job_applicationPSet.setStatus (PersistentSetStatus.PROCESSED);
}
......
......@@ -121,7 +121,7 @@ public class JobPersistenceMgr extends ObjectPersistenceMgr
}
private String SELECT_COLUMNS = "{PREFIX}tl_job.object_id as id, {PREFIX}tl_job.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_job.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_job.job_title, {PREFIX}tl_job.job_description, {PREFIX}tl_job.job_status, {PREFIX}tl_job.open_date, {PREFIX}tl_job.apply_by, {PREFIX}tl_job.include_assessment_criteria, {PREFIX}tl_job.include_culture, {PREFIX}tl_job.assessment_type, {PREFIX}tl_job.random_key, {PREFIX}tl_job.job_type, {PREFIX}tl_job.ref_number, {PREFIX}tl_job.last_status_change_date, {PREFIX}tl_job.remote, {PREFIX}tl_job.city, {PREFIX}tl_job.postcode, {PREFIX}tl_job.location_radius, {PREFIX}tl_job.state, {PREFIX}tl_job.country, {PREFIX}tl_job.require_cv, {PREFIX}tl_job.manually_closed, {PREFIX}tl_job.last_edited, {PREFIX}tl_job.is_ppj, {PREFIX}tl_job.industry, {PREFIX}tl_job.culture_statement, {PREFIX}tl_job.draft_location, {PREFIX}tl_job.google_address_text, {PREFIX}tl_job.diversity_included, {PREFIX}tl_job.level_id, {PREFIX}tl_job.client_id, {PREFIX}tl_job.job_owner_id, {PREFIX}tl_job.company_user_id, {PREFIX}tl_job.hiring_team_id, {PREFIX}tl_job.occupation_id, {PREFIX}tl_job.shortened_url_id, {PREFIX}tl_job.template_id, {PREFIX}tl_job.job_title_id, 1 AS commasafe ";
private String SELECT_COLUMNS = "{PREFIX}tl_job.object_id as id, {PREFIX}tl_job.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_job.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_job.job_title, {PREFIX}tl_job.job_description, {PREFIX}tl_job.job_status, {PREFIX}tl_job.open_date, {PREFIX}tl_job.apply_by, {PREFIX}tl_job.include_assessment_criteria, {PREFIX}tl_job.include_culture, {PREFIX}tl_job.assessment_type, {PREFIX}tl_job.random_key, {PREFIX}tl_job.job_type, {PREFIX}tl_job.ref_number, {PREFIX}tl_job.last_status_change_date, {PREFIX}tl_job.remote, {PREFIX}tl_job.city, {PREFIX}tl_job.postcode, {PREFIX}tl_job.location_radius, {PREFIX}tl_job.state, {PREFIX}tl_job.country, {PREFIX}tl_job.require_cv, {PREFIX}tl_job.manually_closed, {PREFIX}tl_job.last_edited, {PREFIX}tl_job.is_ppj, {PREFIX}tl_job.industry, {PREFIX}tl_job.culture_statement, {PREFIX}tl_job.draft_location, {PREFIX}tl_job.google_address_text, {PREFIX}tl_job.diversity_included, {PREFIX}tl_job.level_id, {PREFIX}tl_job.client_id, {PREFIX}tl_job.job_owner_id, {PREFIX}tl_job.company_user_id, {PREFIX}tl_job.hiring_team_id, {PREFIX}tl_job.occupation_id, {PREFIX}tl_job.shortened_url_id, {PREFIX}tl_job.template_id, {PREFIX}tl_job.job_title_id, {PREFIX}tl_job.work_flow_template_id, 1 AS commasafe ";
private String SELECT_JOINS = "";
public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
......@@ -207,7 +207,8 @@ public class JobPersistenceMgr extends ObjectPersistenceMgr
!tl_jobPSet.containsAttrib(Job.SINGLEREFERENCE_Occupation)||
!tl_jobPSet.containsAttrib(Job.SINGLEREFERENCE_ShortenedURL)||
!tl_jobPSet.containsAttrib(Job.SINGLEREFERENCE_AssessmentTemplate)||
!tl_jobPSet.containsAttrib(Job.SINGLEREFERENCE_ILOJobTitle))
!tl_jobPSet.containsAttrib(Job.SINGLEREFERENCE_ILOJobTitle)||
!tl_jobPSet.containsAttrib(Job.SINGLEREFERENCE_WorkFlowTemplate))
{
// We will need to retrieve it
idsToFetch.add (id.longValue());
......@@ -263,6 +264,16 @@ public class JobPersistenceMgr extends ObjectPersistenceMgr
return results;
}
else if (refName.equals (Job.SINGLEREFERENCE_WorkFlowTemplate))
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_job " +
"WHERE " + SELECT_JOINS + "work_flow_template_id = ?";
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, new Object[] { _objectID.longID () }, null, false);
return results;
}
else
{
throw new IllegalArgumentException ("Illegal reference type:" + refName);
......@@ -287,10 +298,10 @@ public class JobPersistenceMgr extends ObjectPersistenceMgr
{
int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}tl_job " +
"SET job_title = ?, job_description = ?, job_status = ?, open_date = ?, apply_by = ?, include_assessment_criteria = ?, include_culture = ?, assessment_type = ?, random_key = ?, job_type = ?, ref_number = ?, last_status_change_date = ?, remote = ?, city = ?, postcode = ?, location_radius = ?, state = ?, country = ?, require_cv = ?, manually_closed = ?, last_edited = ?, is_ppj = ?, industry = ?, culture_statement = ?, draft_location = ?, google_address_text = ?, diversity_included = ?, level_id = ? , client_id = ? , job_owner_id = ? , company_user_id = ? , hiring_team_id = ? , occupation_id = ? , shortened_url_id = ? , template_id = ? , job_title_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"SET job_title = ?, job_description = ?, job_status = ?, open_date = ?, apply_by = ?, include_assessment_criteria = ?, include_culture = ?, assessment_type = ?, random_key = ?, job_type = ?, ref_number = ?, last_status_change_date = ?, remote = ?, city = ?, postcode = ?, location_radius = ?, state = ?, country = ?, require_cv = ?, manually_closed = ?, last_edited = ?, is_ppj = ?, industry = ?, culture_statement = ?, draft_location = ?, google_address_text = ?, diversity_included = ?, level_id = ? , client_id = ? , job_owner_id = ? , company_user_id = ? , hiring_team_id = ? , occupation_id = ? , shortened_url_id = ? , template_id = ? , job_title_id = ? , work_flow_template_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE tl_job.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_JobTitle.getForSQL(dummyJobTitle, tl_jobPSet.getAttrib (Job.FIELD_JobTitle))).listEntry (HELPER_JobDescription.getForSQL(dummyJobDescription, tl_jobPSet.getAttrib (Job.FIELD_JobDescription))).listEntry (HELPER_JobStatus.getForSQL(dummyJobStatus, tl_jobPSet.getAttrib (Job.FIELD_JobStatus))).listEntry (HELPER_OpenDate.getForSQL(dummyOpenDate, tl_jobPSet.getAttrib (Job.FIELD_OpenDate))).listEntry (HELPER_ApplyBy.getForSQL(dummyApplyBy, tl_jobPSet.getAttrib (Job.FIELD_ApplyBy))).listEntry (HELPER_IncludeAssessmentCriteria.getForSQL(dummyIncludeAssessmentCriteria, tl_jobPSet.getAttrib (Job.FIELD_IncludeAssessmentCriteria))).listEntry (HELPER_IncludeCulture.getForSQL(dummyIncludeCulture, tl_jobPSet.getAttrib (Job.FIELD_IncludeCulture))).listEntry (HELPER_AssessmentType.getForSQL(dummyAssessmentType, tl_jobPSet.getAttrib (Job.FIELD_AssessmentType))).listEntry (HELPER_RandomKey.getForSQL(dummyRandomKey, tl_jobPSet.getAttrib (Job.FIELD_RandomKey))).listEntry (HELPER_JobType.getForSQL(dummyJobType, tl_jobPSet.getAttrib (Job.FIELD_JobType))).listEntry (HELPER_ReferenceNumber.getForSQL(dummyReferenceNumber, tl_jobPSet.getAttrib (Job.FIELD_ReferenceNumber))).listEntry (HELPER_LastStatusChangeDate.getForSQL(dummyLastStatusChangeDate, tl_jobPSet.getAttrib (Job.FIELD_LastStatusChangeDate))).listEntry (HELPER_Remote.getForSQL(dummyRemote, tl_jobPSet.getAttrib (Job.FIELD_Remote))).listEntry (HELPER_City.getForSQL(dummyCity, tl_jobPSet.getAttrib (Job.FIELD_City))).listEntry (HELPER_PostCode.getForSQL(dummyPostCode, tl_jobPSet.getAttrib (Job.FIELD_PostCode))).listEntry (HELPER_ExpectedCandidateRadius.getForSQL(dummyExpectedCandidateRadius, tl_jobPSet.getAttrib (Job.FIELD_ExpectedCandidateRadius))).listEntry (HELPER_State.getForSQL(dummyState, tl_jobPSet.getAttrib (Job.FIELD_State))).listEntry (HELPER_Country.getForSQL(dummyCountry, tl_jobPSet.getAttrib (Job.FIELD_Country))).listEntry (HELPER_RequireCV.getForSQL(dummyRequireCV, tl_jobPSet.getAttrib (Job.FIELD_RequireCV))).listEntry (HELPER_IsManuallyClosed.getForSQL(dummyIsManuallyClosed, tl_jobPSet.getAttrib (Job.FIELD_IsManuallyClosed))).listEntry (HELPER_LastEdited.getForSQL(dummyLastEdited, tl_jobPSet.getAttrib (Job.FIELD_LastEdited))).listEntry (HELPER_IsPPJ.getForSQL(dummyIsPPJ, tl_jobPSet.getAttrib (Job.FIELD_IsPPJ))).listEntry (HELPER_Industry.getForSQL(dummyIndustry, tl_jobPSet.getAttrib (Job.FIELD_Industry))).listEntry (HELPER_CultureStatement.getForSQL(dummyCultureStatement, tl_jobPSet.getAttrib (Job.FIELD_CultureStatement))).listEntry (HELPER_DraftLocation.getForSQL(dummyDraftLocation, tl_jobPSet.getAttrib (Job.FIELD_DraftLocation))).listEntry (HELPER_GoogleAddressText.getForSQL(dummyGoogleAddressText, tl_jobPSet.getAttrib (Job.FIELD_GoogleAddressText))).listEntry (HELPER_DiversityIncluded.getForSQL(dummyDiversityIncluded, tl_jobPSet.getAttrib (Job.FIELD_DiversityIncluded))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_Level)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_Client)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_JobOwner)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_CreatedBy)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_HiringTeam)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_Occupation)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_ShortenedURL)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_AssessmentTemplate)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_ILOJobTitle)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
CollectionUtils.listEntry (HELPER_JobTitle.getForSQL(dummyJobTitle, tl_jobPSet.getAttrib (Job.FIELD_JobTitle))).listEntry (HELPER_JobDescription.getForSQL(dummyJobDescription, tl_jobPSet.getAttrib (Job.FIELD_JobDescription))).listEntry (HELPER_JobStatus.getForSQL(dummyJobStatus, tl_jobPSet.getAttrib (Job.FIELD_JobStatus))).listEntry (HELPER_OpenDate.getForSQL(dummyOpenDate, tl_jobPSet.getAttrib (Job.FIELD_OpenDate))).listEntry (HELPER_ApplyBy.getForSQL(dummyApplyBy, tl_jobPSet.getAttrib (Job.FIELD_ApplyBy))).listEntry (HELPER_IncludeAssessmentCriteria.getForSQL(dummyIncludeAssessmentCriteria, tl_jobPSet.getAttrib (Job.FIELD_IncludeAssessmentCriteria))).listEntry (HELPER_IncludeCulture.getForSQL(dummyIncludeCulture, tl_jobPSet.getAttrib (Job.FIELD_IncludeCulture))).listEntry (HELPER_AssessmentType.getForSQL(dummyAssessmentType, tl_jobPSet.getAttrib (Job.FIELD_AssessmentType))).listEntry (HELPER_RandomKey.getForSQL(dummyRandomKey, tl_jobPSet.getAttrib (Job.FIELD_RandomKey))).listEntry (HELPER_JobType.getForSQL(dummyJobType, tl_jobPSet.getAttrib (Job.FIELD_JobType))).listEntry (HELPER_ReferenceNumber.getForSQL(dummyReferenceNumber, tl_jobPSet.getAttrib (Job.FIELD_ReferenceNumber))).listEntry (HELPER_LastStatusChangeDate.getForSQL(dummyLastStatusChangeDate, tl_jobPSet.getAttrib (Job.FIELD_LastStatusChangeDate))).listEntry (HELPER_Remote.getForSQL(dummyRemote, tl_jobPSet.getAttrib (Job.FIELD_Remote))).listEntry (HELPER_City.getForSQL(dummyCity, tl_jobPSet.getAttrib (Job.FIELD_City))).listEntry (HELPER_PostCode.getForSQL(dummyPostCode, tl_jobPSet.getAttrib (Job.FIELD_PostCode))).listEntry (HELPER_ExpectedCandidateRadius.getForSQL(dummyExpectedCandidateRadius, tl_jobPSet.getAttrib (Job.FIELD_ExpectedCandidateRadius))).listEntry (HELPER_State.getForSQL(dummyState, tl_jobPSet.getAttrib (Job.FIELD_State))).listEntry (HELPER_Country.getForSQL(dummyCountry, tl_jobPSet.getAttrib (Job.FIELD_Country))).listEntry (HELPER_RequireCV.getForSQL(dummyRequireCV, tl_jobPSet.getAttrib (Job.FIELD_RequireCV))).listEntry (HELPER_IsManuallyClosed.getForSQL(dummyIsManuallyClosed, tl_jobPSet.getAttrib (Job.FIELD_IsManuallyClosed))).listEntry (HELPER_LastEdited.getForSQL(dummyLastEdited, tl_jobPSet.getAttrib (Job.FIELD_LastEdited))).listEntry (HELPER_IsPPJ.getForSQL(dummyIsPPJ, tl_jobPSet.getAttrib (Job.FIELD_IsPPJ))).listEntry (HELPER_Industry.getForSQL(dummyIndustry, tl_jobPSet.getAttrib (Job.FIELD_Industry))).listEntry (HELPER_CultureStatement.getForSQL(dummyCultureStatement, tl_jobPSet.getAttrib (Job.FIELD_CultureStatement))).listEntry (HELPER_DraftLocation.getForSQL(dummyDraftLocation, tl_jobPSet.getAttrib (Job.FIELD_DraftLocation))).listEntry (HELPER_GoogleAddressText.getForSQL(dummyGoogleAddressText, tl_jobPSet.getAttrib (Job.FIELD_GoogleAddressText))).listEntry (HELPER_DiversityIncluded.getForSQL(dummyDiversityIncluded, tl_jobPSet.getAttrib (Job.FIELD_DiversityIncluded))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_Level)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_Client)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_JobOwner)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_CreatedBy)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_HiringTeam)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_Occupation)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_ShortenedURL)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_AssessmentTemplate)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_ILOJobTitle)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_WorkFlowTemplate)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
if (rowsUpdated != 1)
{
......@@ -747,6 +758,7 @@ public class JobPersistenceMgr extends ObjectPersistenceMgr
tl_jobPSet.setAttrib(Job.SINGLEREFERENCE_ShortenedURL, r.getObject ("shortened_url_id"));
tl_jobPSet.setAttrib(Job.SINGLEREFERENCE_AssessmentTemplate, r.getObject ("template_id"));
tl_jobPSet.setAttrib(Job.SINGLEREFERENCE_ILOJobTitle, r.getObject ("job_title_id"));
tl_jobPSet.setAttrib(Job.SINGLEREFERENCE_WorkFlowTemplate, r.getObject ("work_flow_template_id"));
}
......@@ -763,10 +775,10 @@ public class JobPersistenceMgr extends ObjectPersistenceMgr
{
executeStatement (sqlMgr,
"INSERT INTO {PREFIX}tl_job " +
" (job_title, job_description, job_status, open_date, apply_by, include_assessment_criteria, include_culture, assessment_type, random_key, job_type, ref_number, last_status_change_date, remote, city, postcode, location_radius, state, country, require_cv, manually_closed, last_edited, is_ppj, industry, culture_statement, draft_location, google_address_text, diversity_included, level_id, client_id, job_owner_id, company_user_id, hiring_team_id, occupation_id, shortened_url_id, template_id, job_title_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
" (job_title, job_description, job_status, open_date, apply_by, include_assessment_criteria, include_culture, assessment_type, random_key, job_type, ref_number, last_status_change_date, remote, city, postcode, location_radius, state, country, require_cv, manually_closed, last_edited, is_ppj, industry, culture_statement, draft_location, google_address_text, diversity_included, level_id, client_id, job_owner_id, company_user_id, hiring_team_id, occupation_id, shortened_url_id, template_id, job_title_id, work_flow_template_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " +
" (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_JobTitle.getForSQL(dummyJobTitle, tl_jobPSet.getAttrib (Job.FIELD_JobTitle))).listEntry (HELPER_JobDescription.getForSQL(dummyJobDescription, tl_jobPSet.getAttrib (Job.FIELD_JobDescription))).listEntry (HELPER_JobStatus.getForSQL(dummyJobStatus, tl_jobPSet.getAttrib (Job.FIELD_JobStatus))).listEntry (HELPER_OpenDate.getForSQL(dummyOpenDate, tl_jobPSet.getAttrib (Job.FIELD_OpenDate))).listEntry (HELPER_ApplyBy.getForSQL(dummyApplyBy, tl_jobPSet.getAttrib (Job.FIELD_ApplyBy))).listEntry (HELPER_IncludeAssessmentCriteria.getForSQL(dummyIncludeAssessmentCriteria, tl_jobPSet.getAttrib (Job.FIELD_IncludeAssessmentCriteria))).listEntry (HELPER_IncludeCulture.getForSQL(dummyIncludeCulture, tl_jobPSet.getAttrib (Job.FIELD_IncludeCulture))).listEntry (HELPER_AssessmentType.getForSQL(dummyAssessmentType, tl_jobPSet.getAttrib (Job.FIELD_AssessmentType))).listEntry (HELPER_RandomKey.getForSQL(dummyRandomKey, tl_jobPSet.getAttrib (Job.FIELD_RandomKey))).listEntry (HELPER_JobType.getForSQL(dummyJobType, tl_jobPSet.getAttrib (Job.FIELD_JobType))).listEntry (HELPER_ReferenceNumber.getForSQL(dummyReferenceNumber, tl_jobPSet.getAttrib (Job.FIELD_ReferenceNumber))).listEntry (HELPER_LastStatusChangeDate.getForSQL(dummyLastStatusChangeDate, tl_jobPSet.getAttrib (Job.FIELD_LastStatusChangeDate))).listEntry (HELPER_Remote.getForSQL(dummyRemote, tl_jobPSet.getAttrib (Job.FIELD_Remote))).listEntry (HELPER_City.getForSQL(dummyCity, tl_jobPSet.getAttrib (Job.FIELD_City))).listEntry (HELPER_PostCode.getForSQL(dummyPostCode, tl_jobPSet.getAttrib (Job.FIELD_PostCode))).listEntry (HELPER_ExpectedCandidateRadius.getForSQL(dummyExpectedCandidateRadius, tl_jobPSet.getAttrib (Job.FIELD_ExpectedCandidateRadius))).listEntry (HELPER_State.getForSQL(dummyState, tl_jobPSet.getAttrib (Job.FIELD_State))).listEntry (HELPER_Country.getForSQL(dummyCountry, tl_jobPSet.getAttrib (Job.FIELD_Country))).listEntry (HELPER_RequireCV.getForSQL(dummyRequireCV, tl_jobPSet.getAttrib (Job.FIELD_RequireCV))).listEntry (HELPER_IsManuallyClosed.getForSQL(dummyIsManuallyClosed, tl_jobPSet.getAttrib (Job.FIELD_IsManuallyClosed))).listEntry (HELPER_LastEdited.getForSQL(dummyLastEdited, tl_jobPSet.getAttrib (Job.FIELD_LastEdited))).listEntry (HELPER_IsPPJ.getForSQL(dummyIsPPJ, tl_jobPSet.getAttrib (Job.FIELD_IsPPJ))).listEntry (HELPER_Industry.getForSQL(dummyIndustry, tl_jobPSet.getAttrib (Job.FIELD_Industry))).listEntry (HELPER_CultureStatement.getForSQL(dummyCultureStatement, tl_jobPSet.getAttrib (Job.FIELD_CultureStatement))).listEntry (HELPER_DraftLocation.getForSQL(dummyDraftLocation, tl_jobPSet.getAttrib (Job.FIELD_DraftLocation))).listEntry (HELPER_GoogleAddressText.getForSQL(dummyGoogleAddressText, tl_jobPSet.getAttrib (Job.FIELD_GoogleAddressText))).listEntry (HELPER_DiversityIncluded.getForSQL(dummyDiversityIncluded, tl_jobPSet.getAttrib (Job.FIELD_DiversityIncluded))) .listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_Level)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_Client)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_JobOwner)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_CreatedBy)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_HiringTeam)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_Occupation)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_ShortenedURL)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_AssessmentTemplate)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_ILOJobTitle)))) .listEntry (objectID.longID ()).toList().toArray());
" (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_JobTitle.getForSQL(dummyJobTitle, tl_jobPSet.getAttrib (Job.FIELD_JobTitle))).listEntry (HELPER_JobDescription.getForSQL(dummyJobDescription, tl_jobPSet.getAttrib (Job.FIELD_JobDescription))).listEntry (HELPER_JobStatus.getForSQL(dummyJobStatus, tl_jobPSet.getAttrib (Job.FIELD_JobStatus))).listEntry (HELPER_OpenDate.getForSQL(dummyOpenDate, tl_jobPSet.getAttrib (Job.FIELD_OpenDate))).listEntry (HELPER_ApplyBy.getForSQL(dummyApplyBy, tl_jobPSet.getAttrib (Job.FIELD_ApplyBy))).listEntry (HELPER_IncludeAssessmentCriteria.getForSQL(dummyIncludeAssessmentCriteria, tl_jobPSet.getAttrib (Job.FIELD_IncludeAssessmentCriteria))).listEntry (HELPER_IncludeCulture.getForSQL(dummyIncludeCulture, tl_jobPSet.getAttrib (Job.FIELD_IncludeCulture))).listEntry (HELPER_AssessmentType.getForSQL(dummyAssessmentType, tl_jobPSet.getAttrib (Job.FIELD_AssessmentType))).listEntry (HELPER_RandomKey.getForSQL(dummyRandomKey, tl_jobPSet.getAttrib (Job.FIELD_RandomKey))).listEntry (HELPER_JobType.getForSQL(dummyJobType, tl_jobPSet.getAttrib (Job.FIELD_JobType))).listEntry (HELPER_ReferenceNumber.getForSQL(dummyReferenceNumber, tl_jobPSet.getAttrib (Job.FIELD_ReferenceNumber))).listEntry (HELPER_LastStatusChangeDate.getForSQL(dummyLastStatusChangeDate, tl_jobPSet.getAttrib (Job.FIELD_LastStatusChangeDate))).listEntry (HELPER_Remote.getForSQL(dummyRemote, tl_jobPSet.getAttrib (Job.FIELD_Remote))).listEntry (HELPER_City.getForSQL(dummyCity, tl_jobPSet.getAttrib (Job.FIELD_City))).listEntry (HELPER_PostCode.getForSQL(dummyPostCode, tl_jobPSet.getAttrib (Job.FIELD_PostCode))).listEntry (HELPER_ExpectedCandidateRadius.getForSQL(dummyExpectedCandidateRadius, tl_jobPSet.getAttrib (Job.FIELD_ExpectedCandidateRadius))).listEntry (HELPER_State.getForSQL(dummyState, tl_jobPSet.getAttrib (Job.FIELD_State))).listEntry (HELPER_Country.getForSQL(dummyCountry, tl_jobPSet.getAttrib (Job.FIELD_Country))).listEntry (HELPER_RequireCV.getForSQL(dummyRequireCV, tl_jobPSet.getAttrib (Job.FIELD_RequireCV))).listEntry (HELPER_IsManuallyClosed.getForSQL(dummyIsManuallyClosed, tl_jobPSet.getAttrib (Job.FIELD_IsManuallyClosed))).listEntry (HELPER_LastEdited.getForSQL(dummyLastEdited, tl_jobPSet.getAttrib (Job.FIELD_LastEdited))).listEntry (HELPER_IsPPJ.getForSQL(dummyIsPPJ, tl_jobPSet.getAttrib (Job.FIELD_IsPPJ))).listEntry (HELPER_Industry.getForSQL(dummyIndustry, tl_jobPSet.getAttrib (Job.FIELD_Industry))).listEntry (HELPER_CultureStatement.getForSQL(dummyCultureStatement, tl_jobPSet.getAttrib (Job.FIELD_CultureStatement))).listEntry (HELPER_DraftLocation.getForSQL(dummyDraftLocation, tl_jobPSet.getAttrib (Job.FIELD_DraftLocation))).listEntry (HELPER_GoogleAddressText.getForSQL(dummyGoogleAddressText, tl_jobPSet.getAttrib (Job.FIELD_GoogleAddressText))).listEntry (HELPER_DiversityIncluded.getForSQL(dummyDiversityIncluded, tl_jobPSet.getAttrib (Job.FIELD_DiversityIncluded))) .listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_Level)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_Client)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_JobOwner)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_CreatedBy)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_HiringTeam)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_Occupation)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_ShortenedURL)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_AssessmentTemplate)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_ILOJobTitle)))).listEntry (SQLManager.CheckNull((Long)(tl_jobPSet.getAttrib (Job.SINGLEREFERENCE_WorkFlowTemplate)))) .listEntry (objectID.longID ()).toList().toArray());
tl_jobPSet.setStatus (PersistentSetStatus.PROCESSED);
}
......
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 oneit.security.*;
public class Message extends BaseMessage
{
private static final long serialVersionUID = 0L;
// This constructor should not be called
public Message ()
{
// Do not add any code to this, always put it in initialiseNewObject
}
}
<?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="Message" package="performa.orm">
<IMPORT value="performa.orm.types.*"/>
<IMPORT value="oneit.security.*"/>
<MULTIPLEREFERENCE name="Attachments" type="ChatAttachment" backreferenceName="Message" />
<TABLE name="tl_message" tablePrefix="object" polymorphic="FALSE">
<ATTRIB name="SentVia" type="SentVia" dbcol="sent_via" attribHelper="EnumeratedAttributeHelper" mandatory="false"/>
<ATTRIB name="MessageContent" type="String" dbcol="message_content" mandatory="false"/>
<ATTRIB name="IsRead" type="Boolean" dbcol="is_read" mandatory="false"/>
<SINGLEREFERENCE name="SentBy" type="SecUser" dbcol="sent_by" />
<SINGLEREFERENCE name="WorkFlowMessage" type="WorkFlowMessage" dbcol="work_flow_message" />
<SINGLEREFERENCE name="JobApplication" type="JobApplication" dbcol="job_application_id" backreferenceName="Messages" mandatory="false"/>
</TABLE>
<SEARCH type="All" paramFilter="tl_message.object_id is not null" orderBy="tl_message.object_id" />
</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 oneit.security.*;
/**
* IMPORTANT!!!! Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2[oneit.objstore.PersistenceMgrTemplate.xsl]
*/
public class MessagePersistenceMgr extends ObjectPersistenceMgr
{
private static final LoggingArea MessagePersistence = LoggingArea.createLoggingArea(ObjectPersistenceMgr.OBJECT_PERSISTENCE, "Message");
// Private attributes corresponding to business object data
private SentVia dummySentVia;
private String dummyMessageContent;
private Boolean dummyIsRead;
// Static constants corresponding to attribute helpers
private static final EnumeratedAttributeHelper HELPER_SentVia = new EnumeratedAttributeHelper (SentVia.FACTORY_SentVia);
private static final DefaultAttributeHelper HELPER_MessageContent = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_IsRead = DefaultAttributeHelper.INSTANCE;
public MessagePersistenceMgr ()
{
dummySentVia = (SentVia)(HELPER_SentVia.initialise (dummySentVia));
dummyMessageContent = (String)(HELPER_MessageContent.initialise (dummyMessageContent));
dummyIsRead = (Boolean)(HELPER_IsRead.initialise (dummyIsRead));
}
private String SELECT_COLUMNS = "{PREFIX}tl_message.object_id as id, {PREFIX}tl_message.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_message.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_message.sent_via, {PREFIX}tl_message.message_content, {PREFIX}tl_message.is_read, {PREFIX}tl_message.sent_by, {PREFIX}tl_message.work_flow_message, {PREFIX}tl_message.job_application_id, 1 AS commasafe ";
private String SELECT_JOINS = "";
public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
Set<BaseBusinessClass> resultByIDs = fetchByIDs(Collections.singleton (id), allPSets, context, sqlMgr);
if (resultByIDs.isEmpty ())
{
return null;
}
else if (resultByIDs.size () > 1)
{
throw new StorageException ("Multiple results for id:" + id);
}
else
{
return resultByIDs.iterator ().next ();
}
}
public Set<BaseBusinessClass> fetchByIDs(Set<ObjectID> ids, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
Set<BaseBusinessClass> results = new HashSet ();
Set<Long> idsToFetch = new HashSet ();
for (ObjectID id : ids)
{
if (context.containsObject(id)) // Check for cached version
{
BaseBusinessClass objectToReturn = context.getObjectToReplace(id, Message.REFERENCE_Message);
if (objectToReturn instanceof Message)
{
LogMgr.log (MessagePersistence, 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 Message");
}
}
PersistentSet tl_messagePSet = allPSets.getPersistentSet(id, "tl_message", PersistentSetStatus.FETCHED);
// Check for persistent sets already prefetched
if (false || !tl_messagePSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!tl_messagePSet.containsAttrib(Message.FIELD_SentVia)||
!tl_messagePSet.containsAttrib(Message.FIELD_MessageContent)||
!tl_messagePSet.containsAttrib(Message.FIELD_IsRead)||
!tl_messagePSet.containsAttrib(Message.SINGLEREFERENCE_SentBy)||
!tl_messagePSet.containsAttrib(Message.SINGLEREFERENCE_WorkFlowMessage)||
!tl_messagePSet.containsAttrib(Message.SINGLEREFERENCE_JobApplication))
{
// We will need to retrieve it
idsToFetch.add (id.longValue());
}
else
{
LogMgr.log (MessagePersistence, LogLevel.DEBUG2, "Persistent set preloaded id:", id);
/* Non Polymorphic */
Message result = new Message ();
result.setFromPersistentSets(id, allPSets);
context.addRetrievedObject(result);
results.add (result);
}
}
if (idsToFetch.size () > 0)
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_message " +
"WHERE " + SELECT_JOINS + "{PREFIX}tl_message.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 (Message.SINGLEREFERENCE_JobApplication))
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_message " +
"WHERE " + SELECT_JOINS + "job_application_id = ?";
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 tl_messagePSet = allPSets.getPersistentSet(objectID, "tl_message");
if (tl_messagePSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_messagePSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}tl_message " +
"SET sent_via = ?, message_content = ?, is_read = ?, sent_by = ? , work_flow_message = ? , job_application_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE tl_message.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_SentVia.getForSQL(dummySentVia, tl_messagePSet.getAttrib (Message.FIELD_SentVia))).listEntry (HELPER_MessageContent.getForSQL(dummyMessageContent, tl_messagePSet.getAttrib (Message.FIELD_MessageContent))).listEntry (HELPER_IsRead.getForSQL(dummyIsRead, tl_messagePSet.getAttrib (Message.FIELD_IsRead))).listEntry (SQLManager.CheckNull((Long)(tl_messagePSet.getAttrib (Message.SINGLEREFERENCE_SentBy)))).listEntry (SQLManager.CheckNull((Long)(tl_messagePSet.getAttrib (Message.SINGLEREFERENCE_WorkFlowMessage)))).listEntry (SQLManager.CheckNull((Long)(tl_messagePSet.getAttrib (Message.SINGLEREFERENCE_JobApplication)))).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 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", objectID.longID (), obj.getObjectLastModified (), d },
sqlMgr.getPortabilityServices ());
LogMgr.log (MessagePersistence, LogLevel.BUSINESS1, errorMsg);
throw new ConcurrentUpdateConflictException (obj, "tl_message");
}
else
{
String errorMsg = "Attempt to update nonexistent row in table:tl_message for row:" + objectID + " objDate:" + obj.getObjectLastModified ();
LogMgr.log (MessagePersistence, LogLevel.BUSINESS1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
tl_messagePSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
else
{
LogMgr.log (MessagePersistence, 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_messagePSet = allPSets.getPersistentSet(objectID, "tl_message");
LogMgr.log (MessagePersistence, LogLevel.DEBUG2, "Deleting:", objectID);
if (tl_messagePSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_messagePSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsDeleted = executeStatement (sqlMgr,
"DELETE " +
"FROM {PREFIX}tl_message " +
"WHERE tl_message.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 WHERE object_id = ?",
new Object[] { objectID.longID() });
if (r.next ())
{
throw new ConcurrentUpdateConflictException (obj, "tl_message");
}
else
{
String errorMsg = "Attempt to delete nonexistent row in table:tl_message for row:" + objectID;
LogMgr.log (MessagePersistence, LogLevel.SYSTEMERROR1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
tl_messagePSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
public ResultSet executeSearchQueryAll (SQLManager sqlMgr) throws SQLException
{
throw new RuntimeException ("NOT implemented: executeSearchQueryAll");
}
public BaseBusinessClass[] loadQuery (PersistentSetCollection allPSets, SQLManager sqlMgr, RDBMSPersistenceContext context, String query, Object[] params, Integer maxRows, boolean truncateExtra) throws SQLException, StorageException
{
LinkedHashMap<ObjectID, Message> results = new LinkedHashMap ();
ResultSet r = executeQuery (sqlMgr, query, params);
while (r.next())
{
ThreadUtils.checkInterrupted ();
ObjectID objectID = new ObjectID (Message.REFERENCE_Message.getObjectIDSpace (), r.getLong ("id"));
Message 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, Message.REFERENCE_Message);
if (cachedElement instanceof Message)
{
LogMgr.log (MessagePersistence, LogLevel.TRACE, "Cache hit for id:", objectID);
resultElement = (Message)cachedElement;
}
else
{
throw new StorageException ("Cache collision for id:" + objectID + " with object " + cachedElement + "while fetching a Message");
}
}
else
{
PersistentSet tl_messagePSet = allPSets.getPersistentSet(objectID, "tl_message", PersistentSetStatus.FETCHED);
createPersistentSetFromRS(allPSets, r, objectID);
resultElement = new Message ();
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 (MessagePersistence, 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 " + tables +
"WHERE " + SELECT_JOINS + " " + customParamFilter + customOrderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, null, false);
return results;
}
else if (searchType.equals (Message.SEARCH_All))
{
// Local scope for transformed variables
{
}
String orderBy = " ORDER BY tl_message.object_id";
String tables = " ";
Set<String> joinTableSet = new HashSet<String>();
String filter;
Object[] searchParams; // paramFilter: tl_message.object_id is not null
String preFilter = "(tl_message.object_id is not null)"
+ " ";
preFilter += context.getLoadingAttributes ().getCustomSQL() ;
SearchParamTransform tx = new SearchParamTransform (criteria);
filter = StringUtils.replaceParams (preFilter, tx);
searchParams = tx.getParamsArray();
Integer maxRows = context.getLoadingAttributes ().getMaxRows ();
boolean truncateExtra = !context.getLoadingAttributes ().isFailIfMaxExceeded();
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_message " + tables + tableSetToSQL(joinTableSet) +
"WHERE " + SELECT_JOINS + " " + filter + orderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, maxRows, truncateExtra);
return results;
}
else
{
throw new IllegalArgumentException ("Illegal search type:" + searchType);
}
}
private void createPersistentSetFromRS(PersistentSetCollection allPSets, ResultSet r, ObjectID objectID) throws SQLException
{
PersistentSet tl_messagePSet = allPSets.getPersistentSet(objectID, "tl_message", PersistentSetStatus.FETCHED);
// Object Modified
tl_messagePSet.setAttrib(BaseBusinessClass.FIELD_ObjectLastModified, r.getTimestamp ("LAST_UPDATED_DATE"));
// Object Created
tl_messagePSet.setAttrib(BaseBusinessClass.FIELD_ObjectCreated, r.getTimestamp ("CREATED_DATE"));
tl_messagePSet.setAttrib(Message.FIELD_SentVia, HELPER_SentVia.getFromRS(dummySentVia, r, "sent_via"));
tl_messagePSet.setAttrib(Message.FIELD_MessageContent, HELPER_MessageContent.getFromRS(dummyMessageContent, r, "message_content"));
tl_messagePSet.setAttrib(Message.FIELD_IsRead, HELPER_IsRead.getFromRS(dummyIsRead, r, "is_read"));
tl_messagePSet.setAttrib(Message.SINGLEREFERENCE_SentBy, r.getObject ("sent_by"));
tl_messagePSet.setAttrib(Message.SINGLEREFERENCE_WorkFlowMessage, r.getObject ("work_flow_message"));
tl_messagePSet.setAttrib(Message.SINGLEREFERENCE_JobApplication, r.getObject ("job_application_id"));
}
public void create(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet tl_messagePSet = allPSets.getPersistentSet(objectID, "tl_message");
if (tl_messagePSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_messagePSet.getStatus () != PersistentSetStatus.DEFERRED)
{
executeStatement (sqlMgr,
"INSERT INTO {PREFIX}tl_message " +
" (sent_via, message_content, is_read, sent_by, work_flow_message, job_application_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " +
" (?, ?, ?, ?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_SentVia.getForSQL(dummySentVia, tl_messagePSet.getAttrib (Message.FIELD_SentVia))).listEntry (HELPER_MessageContent.getForSQL(dummyMessageContent, tl_messagePSet.getAttrib (Message.FIELD_MessageContent))).listEntry (HELPER_IsRead.getForSQL(dummyIsRead, tl_messagePSet.getAttrib (Message.FIELD_IsRead))) .listEntry (SQLManager.CheckNull((Long)(tl_messagePSet.getAttrib (Message.SINGLEREFERENCE_SentBy)))).listEntry (SQLManager.CheckNull((Long)(tl_messagePSet.getAttrib (Message.SINGLEREFERENCE_WorkFlowMessage)))).listEntry (SQLManager.CheckNull((Long)(tl_messagePSet.getAttrib (Message.SINGLEREFERENCE_JobApplication)))) .listEntry (objectID.longID ()).toList().toArray());
tl_messagePSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
}
......@@ -15,6 +15,10 @@
<ATTRIB name="Variance" type="Integer" dbcol="variance" mandatory="false" defaultValue="0" />
<ATTRIB name="BusinessHoursOnly" type="Boolean" dbcol="business_hours_only" mandatory="false" defaultValue="Boolean.FALSE"/>
<ATTRIB name="MessageContent" type="String" dbcol="message_content" mandatory="true" />
<ATTRIB name="TemplateType" type="TemplateType" dbcol="template_type" attribHelper="EnumeratedAttributeHelper" mandatory="false"/>
<ATTRIB name="IsGlobalTemplate" type="Boolean" dbcol="is_global_template" mandatory="false"/>
<SINGLEREFERENCE name="HiringTeam" type="HiringTeam" dbcol="hiring_team_id" backreferenceName="MessageTemplates" mandatory="false"/>
</TABLE>
......
......@@ -37,6 +37,8 @@ public class MessageTemplatePersistenceMgr extends ObjectPersistenceMgr
private Integer dummyVariance;
private Boolean dummyBusinessHoursOnly;
private String dummyMessageContent;
private TemplateType dummyTemplateType;
private Boolean dummyIsGlobalTemplate;
// Static constants corresponding to attribute helpers
......@@ -49,6 +51,8 @@ public class MessageTemplatePersistenceMgr extends ObjectPersistenceMgr
private static final DefaultAttributeHelper HELPER_Variance = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_BusinessHoursOnly = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_MessageContent = DefaultAttributeHelper.INSTANCE;
private static final EnumeratedAttributeHelper HELPER_TemplateType = new EnumeratedAttributeHelper (TemplateType.FACTORY_TemplateType);
private static final DefaultAttributeHelper HELPER_IsGlobalTemplate = DefaultAttributeHelper.INSTANCE;
......@@ -64,10 +68,12 @@ public class MessageTemplatePersistenceMgr extends ObjectPersistenceMgr
dummyVariance = (Integer)(HELPER_Variance.initialise (dummyVariance));
dummyBusinessHoursOnly = (Boolean)(HELPER_BusinessHoursOnly.initialise (dummyBusinessHoursOnly));
dummyMessageContent = (String)(HELPER_MessageContent.initialise (dummyMessageContent));
dummyTemplateType = (TemplateType)(HELPER_TemplateType.initialise (dummyTemplateType));
dummyIsGlobalTemplate = (Boolean)(HELPER_IsGlobalTemplate.initialise (dummyIsGlobalTemplate));
}
private String SELECT_COLUMNS = "{PREFIX}tl_message_template.object_id as id, {PREFIX}tl_message_template.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_message_template.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_message_template.message_id, {PREFIX}tl_message_template.template_name, {PREFIX}tl_message_template.subject, {PREFIX}tl_message_template.application_status, {PREFIX}tl_message_template.delay_hrs, {PREFIX}tl_message_template.delay_min, {PREFIX}tl_message_template.variance, {PREFIX}tl_message_template.business_hours_only, {PREFIX}tl_message_template.message_content, 1 AS commasafe ";
private String SELECT_COLUMNS = "{PREFIX}tl_message_template.object_id as id, {PREFIX}tl_message_template.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_message_template.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_message_template.message_id, {PREFIX}tl_message_template.template_name, {PREFIX}tl_message_template.subject, {PREFIX}tl_message_template.application_status, {PREFIX}tl_message_template.delay_hrs, {PREFIX}tl_message_template.delay_min, {PREFIX}tl_message_template.variance, {PREFIX}tl_message_template.business_hours_only, {PREFIX}tl_message_template.message_content, {PREFIX}tl_message_template.template_type, {PREFIX}tl_message_template.is_global_template, {PREFIX}tl_message_template.hiring_team_id, 1 AS commasafe ";
private String SELECT_JOINS = "";
public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
......@@ -126,7 +132,10 @@ public class MessageTemplatePersistenceMgr extends ObjectPersistenceMgr
!tl_message_templatePSet.containsAttrib(MessageTemplate.FIELD_DelayMin)||
!tl_message_templatePSet.containsAttrib(MessageTemplate.FIELD_Variance)||
!tl_message_templatePSet.containsAttrib(MessageTemplate.FIELD_BusinessHoursOnly)||
!tl_message_templatePSet.containsAttrib(MessageTemplate.FIELD_MessageContent))
!tl_message_templatePSet.containsAttrib(MessageTemplate.FIELD_MessageContent)||
!tl_message_templatePSet.containsAttrib(MessageTemplate.FIELD_TemplateType)||
!tl_message_templatePSet.containsAttrib(MessageTemplate.FIELD_IsGlobalTemplate)||
!tl_message_templatePSet.containsAttrib(MessageTemplate.SINGLEREFERENCE_HiringTeam))
{
// We will need to retrieve it
idsToFetch.add (id.longValue());
......@@ -172,6 +181,16 @@ public class MessageTemplatePersistenceMgr extends ObjectPersistenceMgr
{
throw new RuntimeException ();
}
else if (refName.equals (MessageTemplate.SINGLEREFERENCE_HiringTeam))
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_message_template " +
"WHERE " + SELECT_JOINS + "hiring_team_id = ?";
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, new Object[] { _objectID.longID () }, null, false);
return results;
}
else
{
throw new IllegalArgumentException ("Illegal reference type:" + refName);
......@@ -196,10 +215,10 @@ public class MessageTemplatePersistenceMgr extends ObjectPersistenceMgr
{
int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}tl_message_template " +
"SET message_id = ?, template_name = ?, subject = ?, application_status = ?, delay_hrs = ?, delay_min = ?, variance = ?, business_hours_only = ?, message_content = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"SET message_id = ?, template_name = ?, subject = ?, application_status = ?, delay_hrs = ?, delay_min = ?, variance = ?, business_hours_only = ?, message_content = ?, template_type = ?, is_global_template = ?, hiring_team_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE tl_message_template.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_MessageID.getForSQL(dummyMessageID, tl_message_templatePSet.getAttrib (MessageTemplate.FIELD_MessageID))).listEntry (HELPER_TemplateName.getForSQL(dummyTemplateName, tl_message_templatePSet.getAttrib (MessageTemplate.FIELD_TemplateName))).listEntry (HELPER_Subject.getForSQL(dummySubject, tl_message_templatePSet.getAttrib (MessageTemplate.FIELD_Subject))).listEntry (HELPER_ApplicationStatus.getForSQL(dummyApplicationStatus, tl_message_templatePSet.getAttrib (MessageTemplate.FIELD_ApplicationStatus))).listEntry (HELPER_DelayHrs.getForSQL(dummyDelayHrs, tl_message_templatePSet.getAttrib (MessageTemplate.FIELD_DelayHrs))).listEntry (HELPER_DelayMin.getForSQL(dummyDelayMin, tl_message_templatePSet.getAttrib (MessageTemplate.FIELD_DelayMin))).listEntry (HELPER_Variance.getForSQL(dummyVariance, tl_message_templatePSet.getAttrib (MessageTemplate.FIELD_Variance))).listEntry (HELPER_BusinessHoursOnly.getForSQL(dummyBusinessHoursOnly, tl_message_templatePSet.getAttrib (MessageTemplate.FIELD_BusinessHoursOnly))).listEntry (HELPER_MessageContent.getForSQL(dummyMessageContent, tl_message_templatePSet.getAttrib (MessageTemplate.FIELD_MessageContent))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
CollectionUtils.listEntry (HELPER_MessageID.getForSQL(dummyMessageID, tl_message_templatePSet.getAttrib (MessageTemplate.FIELD_MessageID))).listEntry (HELPER_TemplateName.getForSQL(dummyTemplateName, tl_message_templatePSet.getAttrib (MessageTemplate.FIELD_TemplateName))).listEntry (HELPER_Subject.getForSQL(dummySubject, tl_message_templatePSet.getAttrib (MessageTemplate.FIELD_Subject))).listEntry (HELPER_ApplicationStatus.getForSQL(dummyApplicationStatus, tl_message_templatePSet.getAttrib (MessageTemplate.FIELD_ApplicationStatus))).listEntry (HELPER_DelayHrs.getForSQL(dummyDelayHrs, tl_message_templatePSet.getAttrib (MessageTemplate.FIELD_DelayHrs))).listEntry (HELPER_DelayMin.getForSQL(dummyDelayMin, tl_message_templatePSet.getAttrib (MessageTemplate.FIELD_DelayMin))).listEntry (HELPER_Variance.getForSQL(dummyVariance, tl_message_templatePSet.getAttrib (MessageTemplate.FIELD_Variance))).listEntry (HELPER_BusinessHoursOnly.getForSQL(dummyBusinessHoursOnly, tl_message_templatePSet.getAttrib (MessageTemplate.FIELD_BusinessHoursOnly))).listEntry (HELPER_MessageContent.getForSQL(dummyMessageContent, tl_message_templatePSet.getAttrib (MessageTemplate.FIELD_MessageContent))).listEntry (HELPER_TemplateType.getForSQL(dummyTemplateType, tl_message_templatePSet.getAttrib (MessageTemplate.FIELD_TemplateType))).listEntry (HELPER_IsGlobalTemplate.getForSQL(dummyIsGlobalTemplate, tl_message_templatePSet.getAttrib (MessageTemplate.FIELD_IsGlobalTemplate))).listEntry (SQLManager.CheckNull((Long)(tl_message_templatePSet.getAttrib (MessageTemplate.SINGLEREFERENCE_HiringTeam)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
if (rowsUpdated != 1)
{
......@@ -464,7 +483,10 @@ public class MessageTemplatePersistenceMgr extends ObjectPersistenceMgr
tl_message_templatePSet.setAttrib(MessageTemplate.FIELD_Variance, HELPER_Variance.getFromRS(dummyVariance, r, "variance"));
tl_message_templatePSet.setAttrib(MessageTemplate.FIELD_BusinessHoursOnly, HELPER_BusinessHoursOnly.getFromRS(dummyBusinessHoursOnly, r, "business_hours_only"));
tl_message_templatePSet.setAttrib(MessageTemplate.FIELD_MessageContent, HELPER_MessageContent.getFromRS(dummyMessageContent, r, "message_content"));
tl_message_templatePSet.setAttrib(MessageTemplate.FIELD_TemplateType, HELPER_TemplateType.getFromRS(dummyTemplateType, r, "template_type"));
tl_message_templatePSet.setAttrib(MessageTemplate.FIELD_IsGlobalTemplate, HELPER_IsGlobalTemplate.getFromRS(dummyIsGlobalTemplate, r, "is_global_template"));
tl_message_templatePSet.setAttrib(MessageTemplate.SINGLEREFERENCE_HiringTeam, r.getObject ("hiring_team_id"));
}
......@@ -481,10 +503,10 @@ public class MessageTemplatePersistenceMgr extends ObjectPersistenceMgr
{
executeStatement (sqlMgr,
"INSERT INTO {PREFIX}tl_message_template " +
" (message_id, template_name, subject, application_status, delay_hrs, delay_min, variance, business_hours_only, message_content, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
" (message_id, template_name, subject, application_status, delay_hrs, delay_min, variance, business_hours_only, message_content, template_type, is_global_template, hiring_team_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " +
" (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_MessageID.getForSQL(dummyMessageID, tl_message_templatePSet.getAttrib (MessageTemplate.FIELD_MessageID))).listEntry (HELPER_TemplateName.getForSQL(dummyTemplateName, tl_message_templatePSet.getAttrib (MessageTemplate.FIELD_TemplateName))).listEntry (HELPER_Subject.getForSQL(dummySubject, tl_message_templatePSet.getAttrib (MessageTemplate.FIELD_Subject))).listEntry (HELPER_ApplicationStatus.getForSQL(dummyApplicationStatus, tl_message_templatePSet.getAttrib (MessageTemplate.FIELD_ApplicationStatus))).listEntry (HELPER_DelayHrs.getForSQL(dummyDelayHrs, tl_message_templatePSet.getAttrib (MessageTemplate.FIELD_DelayHrs))).listEntry (HELPER_DelayMin.getForSQL(dummyDelayMin, tl_message_templatePSet.getAttrib (MessageTemplate.FIELD_DelayMin))).listEntry (HELPER_Variance.getForSQL(dummyVariance, tl_message_templatePSet.getAttrib (MessageTemplate.FIELD_Variance))).listEntry (HELPER_BusinessHoursOnly.getForSQL(dummyBusinessHoursOnly, tl_message_templatePSet.getAttrib (MessageTemplate.FIELD_BusinessHoursOnly))).listEntry (HELPER_MessageContent.getForSQL(dummyMessageContent, tl_message_templatePSet.getAttrib (MessageTemplate.FIELD_MessageContent))) .listEntry (objectID.longID ()).toList().toArray());
" (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_MessageID.getForSQL(dummyMessageID, tl_message_templatePSet.getAttrib (MessageTemplate.FIELD_MessageID))).listEntry (HELPER_TemplateName.getForSQL(dummyTemplateName, tl_message_templatePSet.getAttrib (MessageTemplate.FIELD_TemplateName))).listEntry (HELPER_Subject.getForSQL(dummySubject, tl_message_templatePSet.getAttrib (MessageTemplate.FIELD_Subject))).listEntry (HELPER_ApplicationStatus.getForSQL(dummyApplicationStatus, tl_message_templatePSet.getAttrib (MessageTemplate.FIELD_ApplicationStatus))).listEntry (HELPER_DelayHrs.getForSQL(dummyDelayHrs, tl_message_templatePSet.getAttrib (MessageTemplate.FIELD_DelayHrs))).listEntry (HELPER_DelayMin.getForSQL(dummyDelayMin, tl_message_templatePSet.getAttrib (MessageTemplate.FIELD_DelayMin))).listEntry (HELPER_Variance.getForSQL(dummyVariance, tl_message_templatePSet.getAttrib (MessageTemplate.FIELD_Variance))).listEntry (HELPER_BusinessHoursOnly.getForSQL(dummyBusinessHoursOnly, tl_message_templatePSet.getAttrib (MessageTemplate.FIELD_BusinessHoursOnly))).listEntry (HELPER_MessageContent.getForSQL(dummyMessageContent, tl_message_templatePSet.getAttrib (MessageTemplate.FIELD_MessageContent))).listEntry (HELPER_TemplateType.getForSQL(dummyTemplateType, tl_message_templatePSet.getAttrib (MessageTemplate.FIELD_TemplateType))).listEntry (HELPER_IsGlobalTemplate.getForSQL(dummyIsGlobalTemplate, tl_message_templatePSet.getAttrib (MessageTemplate.FIELD_IsGlobalTemplate))) .listEntry (SQLManager.CheckNull((Long)(tl_message_templatePSet.getAttrib (MessageTemplate.SINGLEREFERENCE_HiringTeam)))) .listEntry (objectID.longID ()).toList().toArray());
tl_message_templatePSet.setStatus (PersistentSetStatus.PROCESSED);
}
......
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.*;
public class WorkFlowMessage extends BaseWorkFlowMessage
{
private static final long serialVersionUID = 0L;
// This constructor should not be called
public WorkFlowMessage ()
{
// Do not add any code to this, always put it in initialiseNewObject
}
}
<?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="WorkFlowMessage" package="performa.orm">
<IMPORT value="performa.orm.types.*"/>
<TABLE name="tl_work_flow_message" tablePrefix="object" polymorphic="FALSE">
<ATTRIB name="Delay" type="String" dbcol="delay" mandatory="false"/>
<ATTRIB name="Variance" type="String" dbcol="variance" mandatory="false"/>
<ATTRIB name="BusinessHoursOnly" type="Boolean" dbcol="business_hours_only" mandatory="false"/>
<ATTRIB name="IsWithdrawalMessage" type="Boolean" dbcol="is_withdrawal_message" mandatory="false"/>
<SINGLEREFERENCE name="MessageTemplate" type="MessageTemplate" dbcol="message_template_id" />
<SINGLEREFERENCE name="WorkFlowStage" type="WorkFlowStage" dbcol="work_flow_stage_id" backreferenceName="WorkFlowMessages" mandatory="false"/>
</TABLE>
<SEARCH type="All" paramFilter="tl_work_flow_message.object_id is not null" orderBy="tl_work_flow_message.object_id" />
</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.*;
/**
* IMPORTANT!!!! Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2[oneit.objstore.PersistenceMgrTemplate.xsl]
*/
public class WorkFlowMessagePersistenceMgr extends ObjectPersistenceMgr
{
private static final LoggingArea WorkFlowMessagePersistence = LoggingArea.createLoggingArea(ObjectPersistenceMgr.OBJECT_PERSISTENCE, "WorkFlowMessage");
// Private attributes corresponding to business object data
private String dummyDelay;
private String dummyVariance;
private Boolean dummyBusinessHoursOnly;
private Boolean dummyIsWithdrawalMessage;
// Static constants corresponding to attribute helpers
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_IsWithdrawalMessage = DefaultAttributeHelper.INSTANCE;
public WorkFlowMessagePersistenceMgr ()
{
dummyDelay = (String)(HELPER_Delay.initialise (dummyDelay));
dummyVariance = (String)(HELPER_Variance.initialise (dummyVariance));
dummyBusinessHoursOnly = (Boolean)(HELPER_BusinessHoursOnly.initialise (dummyBusinessHoursOnly));
dummyIsWithdrawalMessage = (Boolean)(HELPER_IsWithdrawalMessage.initialise (dummyIsWithdrawalMessage));
}
private String SELECT_COLUMNS = "{PREFIX}tl_work_flow_message.object_id as id, {PREFIX}tl_work_flow_message.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_work_flow_message.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_work_flow_message.delay, {PREFIX}tl_work_flow_message.variance, {PREFIX}tl_work_flow_message.business_hours_only, {PREFIX}tl_work_flow_message.is_withdrawal_message, {PREFIX}tl_work_flow_message.message_template_id, {PREFIX}tl_work_flow_message.work_flow_stage_id, 1 AS commasafe ";
private String SELECT_JOINS = "";
public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
Set<BaseBusinessClass> resultByIDs = fetchByIDs(Collections.singleton (id), allPSets, context, sqlMgr);
if (resultByIDs.isEmpty ())
{
return null;
}
else if (resultByIDs.size () > 1)
{
throw new StorageException ("Multiple results for id:" + id);
}
else
{
return resultByIDs.iterator ().next ();
}
}
public Set<BaseBusinessClass> fetchByIDs(Set<ObjectID> ids, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
Set<BaseBusinessClass> results = new HashSet ();
Set<Long> idsToFetch = new HashSet ();
for (ObjectID id : ids)
{
if (context.containsObject(id)) // Check for cached version
{
BaseBusinessClass objectToReturn = context.getObjectToReplace(id, WorkFlowMessage.REFERENCE_WorkFlowMessage);
if (objectToReturn instanceof WorkFlowMessage)
{
LogMgr.log (WorkFlowMessagePersistence, 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 WorkFlowMessage");
}
}
PersistentSet tl_work_flow_messagePSet = allPSets.getPersistentSet(id, "tl_work_flow_message", PersistentSetStatus.FETCHED);
// Check for persistent sets already prefetched
if (false || !tl_work_flow_messagePSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!tl_work_flow_messagePSet.containsAttrib(WorkFlowMessage.FIELD_Delay)||
!tl_work_flow_messagePSet.containsAttrib(WorkFlowMessage.FIELD_Variance)||
!tl_work_flow_messagePSet.containsAttrib(WorkFlowMessage.FIELD_BusinessHoursOnly)||
!tl_work_flow_messagePSet.containsAttrib(WorkFlowMessage.FIELD_IsWithdrawalMessage)||
!tl_work_flow_messagePSet.containsAttrib(WorkFlowMessage.SINGLEREFERENCE_MessageTemplate)||
!tl_work_flow_messagePSet.containsAttrib(WorkFlowMessage.SINGLEREFERENCE_WorkFlowStage))
{
// We will need to retrieve it
idsToFetch.add (id.longValue());
}
else
{
LogMgr.log (WorkFlowMessagePersistence, LogLevel.DEBUG2, "Persistent set preloaded id:", id);
/* Non Polymorphic */
WorkFlowMessage result = new WorkFlowMessage ();
result.setFromPersistentSets(id, allPSets);
context.addRetrievedObject(result);
results.add (result);
}
}
if (idsToFetch.size () > 0)
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_work_flow_message " +
"WHERE " + SELECT_JOINS + "{PREFIX}tl_work_flow_message.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 (WorkFlowMessage.SINGLEREFERENCE_WorkFlowStage))
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_work_flow_message " +
"WHERE " + SELECT_JOINS + "work_flow_stage_id = ?";
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 tl_work_flow_messagePSet = allPSets.getPersistentSet(objectID, "tl_work_flow_message");
if (tl_work_flow_messagePSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_work_flow_messagePSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}tl_work_flow_message " +
"SET delay = ?, variance = ?, business_hours_only = ?, is_withdrawal_message = ?, message_template_id = ? , work_flow_stage_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE tl_work_flow_message.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_Delay.getForSQL(dummyDelay, tl_work_flow_messagePSet.getAttrib (WorkFlowMessage.FIELD_Delay))).listEntry (HELPER_Variance.getForSQL(dummyVariance, tl_work_flow_messagePSet.getAttrib (WorkFlowMessage.FIELD_Variance))).listEntry (HELPER_BusinessHoursOnly.getForSQL(dummyBusinessHoursOnly, tl_work_flow_messagePSet.getAttrib (WorkFlowMessage.FIELD_BusinessHoursOnly))).listEntry (HELPER_IsWithdrawalMessage.getForSQL(dummyIsWithdrawalMessage, tl_work_flow_messagePSet.getAttrib (WorkFlowMessage.FIELD_IsWithdrawalMessage))).listEntry (SQLManager.CheckNull((Long)(tl_work_flow_messagePSet.getAttrib (WorkFlowMessage.SINGLEREFERENCE_MessageTemplate)))).listEntry (SQLManager.CheckNull((Long)(tl_work_flow_messagePSet.getAttrib (WorkFlowMessage.SINGLEREFERENCE_WorkFlowStage)))).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_work_flow_message 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_work_flow_message", objectID.longID (), obj.getObjectLastModified (), d },
sqlMgr.getPortabilityServices ());
LogMgr.log (WorkFlowMessagePersistence, LogLevel.BUSINESS1, errorMsg);
throw new ConcurrentUpdateConflictException (obj, "tl_work_flow_message");
}
else
{
String errorMsg = "Attempt to update nonexistent row in table:tl_work_flow_message for row:" + objectID + " objDate:" + obj.getObjectLastModified ();
LogMgr.log (WorkFlowMessagePersistence, LogLevel.BUSINESS1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
tl_work_flow_messagePSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
else
{
LogMgr.log (WorkFlowMessagePersistence, 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_work_flow_messagePSet = allPSets.getPersistentSet(objectID, "tl_work_flow_message");
LogMgr.log (WorkFlowMessagePersistence, LogLevel.DEBUG2, "Deleting:", objectID);
if (tl_work_flow_messagePSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_work_flow_messagePSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsDeleted = executeStatement (sqlMgr,
"DELETE " +
"FROM {PREFIX}tl_work_flow_message " +
"WHERE tl_work_flow_message.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_work_flow_message WHERE object_id = ?",
new Object[] { objectID.longID() });
if (r.next ())
{
throw new ConcurrentUpdateConflictException (obj, "tl_work_flow_message");
}
else
{
String errorMsg = "Attempt to delete nonexistent row in table:tl_work_flow_message for row:" + objectID;
LogMgr.log (WorkFlowMessagePersistence, LogLevel.SYSTEMERROR1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
tl_work_flow_messagePSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
public ResultSet executeSearchQueryAll (SQLManager sqlMgr) throws SQLException
{
throw new RuntimeException ("NOT implemented: executeSearchQueryAll");
}
public BaseBusinessClass[] loadQuery (PersistentSetCollection allPSets, SQLManager sqlMgr, RDBMSPersistenceContext context, String query, Object[] params, Integer maxRows, boolean truncateExtra) throws SQLException, StorageException
{
LinkedHashMap<ObjectID, WorkFlowMessage> results = new LinkedHashMap ();
ResultSet r = executeQuery (sqlMgr, query, params);
while (r.next())
{
ThreadUtils.checkInterrupted ();
ObjectID objectID = new ObjectID (WorkFlowMessage.REFERENCE_WorkFlowMessage.getObjectIDSpace (), r.getLong ("id"));
WorkFlowMessage 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, WorkFlowMessage.REFERENCE_WorkFlowMessage);
if (cachedElement instanceof WorkFlowMessage)
{
LogMgr.log (WorkFlowMessagePersistence, LogLevel.TRACE, "Cache hit for id:", objectID);
resultElement = (WorkFlowMessage)cachedElement;
}
else
{
throw new StorageException ("Cache collision for id:" + objectID + " with object " + cachedElement + "while fetching a WorkFlowMessage");
}
}
else
{
PersistentSet tl_work_flow_messagePSet = allPSets.getPersistentSet(objectID, "tl_work_flow_message", PersistentSetStatus.FETCHED);
createPersistentSetFromRS(allPSets, r, objectID);
resultElement = new WorkFlowMessage ();
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 (WorkFlowMessagePersistence, 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_work_flow_message " + tables +
"WHERE " + SELECT_JOINS + " " + customParamFilter + customOrderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, null, false);
return results;
}
else if (searchType.equals (WorkFlowMessage.SEARCH_All))
{
// Local scope for transformed variables
{
}
String orderBy = " ORDER BY tl_work_flow_message.object_id";
String tables = " ";
Set<String> joinTableSet = new HashSet<String>();
String filter;
Object[] searchParams; // paramFilter: tl_work_flow_message.object_id is not null
String preFilter = "(tl_work_flow_message.object_id is not null)"
+ " ";
preFilter += context.getLoadingAttributes ().getCustomSQL() ;
SearchParamTransform tx = new SearchParamTransform (criteria);
filter = StringUtils.replaceParams (preFilter, tx);
searchParams = tx.getParamsArray();
Integer maxRows = context.getLoadingAttributes ().getMaxRows ();
boolean truncateExtra = !context.getLoadingAttributes ().isFailIfMaxExceeded();
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_work_flow_message " + tables + tableSetToSQL(joinTableSet) +
"WHERE " + SELECT_JOINS + " " + filter + orderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, maxRows, truncateExtra);
return results;
}
else
{
throw new IllegalArgumentException ("Illegal search type:" + searchType);
}
}
private void createPersistentSetFromRS(PersistentSetCollection allPSets, ResultSet r, ObjectID objectID) throws SQLException
{
PersistentSet tl_work_flow_messagePSet = allPSets.getPersistentSet(objectID, "tl_work_flow_message", PersistentSetStatus.FETCHED);
// Object Modified
tl_work_flow_messagePSet.setAttrib(BaseBusinessClass.FIELD_ObjectLastModified, r.getTimestamp ("LAST_UPDATED_DATE"));
// Object Created
tl_work_flow_messagePSet.setAttrib(BaseBusinessClass.FIELD_ObjectCreated, r.getTimestamp ("CREATED_DATE"));
tl_work_flow_messagePSet.setAttrib(WorkFlowMessage.FIELD_Delay, HELPER_Delay.getFromRS(dummyDelay, r, "delay"));
tl_work_flow_messagePSet.setAttrib(WorkFlowMessage.FIELD_Variance, HELPER_Variance.getFromRS(dummyVariance, r, "variance"));
tl_work_flow_messagePSet.setAttrib(WorkFlowMessage.FIELD_BusinessHoursOnly, HELPER_BusinessHoursOnly.getFromRS(dummyBusinessHoursOnly, r, "business_hours_only"));
tl_work_flow_messagePSet.setAttrib(WorkFlowMessage.FIELD_IsWithdrawalMessage, HELPER_IsWithdrawalMessage.getFromRS(dummyIsWithdrawalMessage, r, "is_withdrawal_message"));
tl_work_flow_messagePSet.setAttrib(WorkFlowMessage.SINGLEREFERENCE_MessageTemplate, r.getObject ("message_template_id"));
tl_work_flow_messagePSet.setAttrib(WorkFlowMessage.SINGLEREFERENCE_WorkFlowStage, r.getObject ("work_flow_stage_id"));
}
public void create(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet tl_work_flow_messagePSet = allPSets.getPersistentSet(objectID, "tl_work_flow_message");
if (tl_work_flow_messagePSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_work_flow_messagePSet.getStatus () != PersistentSetStatus.DEFERRED)
{
executeStatement (sqlMgr,
"INSERT INTO {PREFIX}tl_work_flow_message " +
" (delay, variance, business_hours_only, is_withdrawal_message, message_template_id, work_flow_stage_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " +
" (?, ?, ?, ?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_Delay.getForSQL(dummyDelay, tl_work_flow_messagePSet.getAttrib (WorkFlowMessage.FIELD_Delay))).listEntry (HELPER_Variance.getForSQL(dummyVariance, tl_work_flow_messagePSet.getAttrib (WorkFlowMessage.FIELD_Variance))).listEntry (HELPER_BusinessHoursOnly.getForSQL(dummyBusinessHoursOnly, tl_work_flow_messagePSet.getAttrib (WorkFlowMessage.FIELD_BusinessHoursOnly))).listEntry (HELPER_IsWithdrawalMessage.getForSQL(dummyIsWithdrawalMessage, tl_work_flow_messagePSet.getAttrib (WorkFlowMessage.FIELD_IsWithdrawalMessage))) .listEntry (SQLManager.CheckNull((Long)(tl_work_flow_messagePSet.getAttrib (WorkFlowMessage.SINGLEREFERENCE_MessageTemplate)))).listEntry (SQLManager.CheckNull((Long)(tl_work_flow_messagePSet.getAttrib (WorkFlowMessage.SINGLEREFERENCE_WorkFlowStage)))) .listEntry (objectID.longID ()).toList().toArray());
tl_work_flow_messagePSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
}
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.*;
public class WorkFlowStage extends BaseWorkFlowStage
{
private static final long serialVersionUID = 0L;
// This constructor should not be called
public WorkFlowStage ()
{
// Do not add any code to this, always put it in initialiseNewObject
}
}
<?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="WorkFlowStage" package="performa.orm">
<IMPORT value="performa.orm.types.*"/>
<MULTIPLEREFERENCE name="WorkFlowMessages" type="WorkFlowMessage" backreferenceName="WorkFlowStage" />
<TABLE name="tl_work_flow_stage" tablePrefix="object" polymorphic="FALSE">
<ATTRIB name="Name" type="String" dbcol="name" mandatory="true"/>
<ATTRIB name="UseMessaging" type="Boolean" dbcol="use_messaging" mandatory="false"/>
<ATTRIB name="StageType" type="StageType" dbcol="stage_type" attribHelper="EnumeratedAttributeHelper" mandatory="true"/>
<ATTRIB name="SortOrder" type="Integer" dbcol="sort_order" mandatory="true"/>
<SINGLEREFERENCE name="WithdrawalMessage" type="WorkFlowMessage" dbcol="withdrawal_message_id" />
<SINGLEREFERENCE name="WorkFlowTemplate" type="WorkFlowTemplate" dbcol="work_flow_template_id" backreferenceName="WorkFlowStages" mandatory="true"/>
</TABLE>
<SEARCH type="All" paramFilter="tl_work_flow_stage.object_id is not null" orderBy="tl_work_flow_stage.object_id" />
</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.*;
/**
* IMPORTANT!!!! Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2[oneit.objstore.PersistenceMgrTemplate.xsl]
*/
public class WorkFlowStagePersistenceMgr extends ObjectPersistenceMgr
{
private static final LoggingArea WorkFlowStagePersistence = LoggingArea.createLoggingArea(ObjectPersistenceMgr.OBJECT_PERSISTENCE, "WorkFlowStage");
// Private attributes corresponding to business object data
private String dummyName;
private Boolean dummyUseMessaging;
private StageType dummyStageType;
private Integer dummySortOrder;
// Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper HELPER_Name = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_UseMessaging = DefaultAttributeHelper.INSTANCE;
private static final EnumeratedAttributeHelper HELPER_StageType = new EnumeratedAttributeHelper (StageType.FACTORY_StageType);
private static final DefaultAttributeHelper HELPER_SortOrder = DefaultAttributeHelper.INSTANCE;
public WorkFlowStagePersistenceMgr ()
{
dummyName = (String)(HELPER_Name.initialise (dummyName));
dummyUseMessaging = (Boolean)(HELPER_UseMessaging.initialise (dummyUseMessaging));
dummyStageType = (StageType)(HELPER_StageType.initialise (dummyStageType));
dummySortOrder = (Integer)(HELPER_SortOrder.initialise (dummySortOrder));
}
private String SELECT_COLUMNS = "{PREFIX}tl_work_flow_stage.object_id as id, {PREFIX}tl_work_flow_stage.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_work_flow_stage.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_work_flow_stage.name, {PREFIX}tl_work_flow_stage.use_messaging, {PREFIX}tl_work_flow_stage.stage_type, {PREFIX}tl_work_flow_stage.sort_order, {PREFIX}tl_work_flow_stage.withdrawal_message_id, {PREFIX}tl_work_flow_stage.work_flow_template_id, 1 AS commasafe ";
private String SELECT_JOINS = "";
public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
Set<BaseBusinessClass> resultByIDs = fetchByIDs(Collections.singleton (id), allPSets, context, sqlMgr);
if (resultByIDs.isEmpty ())
{
return null;
}
else if (resultByIDs.size () > 1)
{
throw new StorageException ("Multiple results for id:" + id);
}
else
{
return resultByIDs.iterator ().next ();
}
}
public Set<BaseBusinessClass> fetchByIDs(Set<ObjectID> ids, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
Set<BaseBusinessClass> results = new HashSet ();
Set<Long> idsToFetch = new HashSet ();
for (ObjectID id : ids)
{
if (context.containsObject(id)) // Check for cached version
{
BaseBusinessClass objectToReturn = context.getObjectToReplace(id, WorkFlowStage.REFERENCE_WorkFlowStage);
if (objectToReturn instanceof WorkFlowStage)
{
LogMgr.log (WorkFlowStagePersistence, 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 WorkFlowStage");
}
}
PersistentSet tl_work_flow_stagePSet = allPSets.getPersistentSet(id, "tl_work_flow_stage", PersistentSetStatus.FETCHED);
// Check for persistent sets already prefetched
if (false || !tl_work_flow_stagePSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!tl_work_flow_stagePSet.containsAttrib(WorkFlowStage.FIELD_Name)||
!tl_work_flow_stagePSet.containsAttrib(WorkFlowStage.FIELD_UseMessaging)||
!tl_work_flow_stagePSet.containsAttrib(WorkFlowStage.FIELD_StageType)||
!tl_work_flow_stagePSet.containsAttrib(WorkFlowStage.FIELD_SortOrder)||
!tl_work_flow_stagePSet.containsAttrib(WorkFlowStage.SINGLEREFERENCE_WithdrawalMessage)||
!tl_work_flow_stagePSet.containsAttrib(WorkFlowStage.SINGLEREFERENCE_WorkFlowTemplate))
{
// We will need to retrieve it
idsToFetch.add (id.longValue());
}
else
{
LogMgr.log (WorkFlowStagePersistence, LogLevel.DEBUG2, "Persistent set preloaded id:", id);
/* Non Polymorphic */
WorkFlowStage result = new WorkFlowStage ();
result.setFromPersistentSets(id, allPSets);
context.addRetrievedObject(result);
results.add (result);
}
}
if (idsToFetch.size () > 0)
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_work_flow_stage " +
"WHERE " + SELECT_JOINS + "{PREFIX}tl_work_flow_stage.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 (WorkFlowStage.SINGLEREFERENCE_WorkFlowTemplate))
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_work_flow_stage " +
"WHERE " + SELECT_JOINS + "work_flow_template_id = ?";
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 tl_work_flow_stagePSet = allPSets.getPersistentSet(objectID, "tl_work_flow_stage");
if (tl_work_flow_stagePSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_work_flow_stagePSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}tl_work_flow_stage " +
"SET name = ?, use_messaging = ?, stage_type = ?, sort_order = ?, withdrawal_message_id = ? , work_flow_template_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE tl_work_flow_stage.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_Name.getForSQL(dummyName, tl_work_flow_stagePSet.getAttrib (WorkFlowStage.FIELD_Name))).listEntry (HELPER_UseMessaging.getForSQL(dummyUseMessaging, tl_work_flow_stagePSet.getAttrib (WorkFlowStage.FIELD_UseMessaging))).listEntry (HELPER_StageType.getForSQL(dummyStageType, tl_work_flow_stagePSet.getAttrib (WorkFlowStage.FIELD_StageType))).listEntry (HELPER_SortOrder.getForSQL(dummySortOrder, tl_work_flow_stagePSet.getAttrib (WorkFlowStage.FIELD_SortOrder))).listEntry (SQLManager.CheckNull((Long)(tl_work_flow_stagePSet.getAttrib (WorkFlowStage.SINGLEREFERENCE_WithdrawalMessage)))).listEntry (SQLManager.CheckNull((Long)(tl_work_flow_stagePSet.getAttrib (WorkFlowStage.SINGLEREFERENCE_WorkFlowTemplate)))).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_work_flow_stage 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_work_flow_stage", objectID.longID (), obj.getObjectLastModified (), d },
sqlMgr.getPortabilityServices ());
LogMgr.log (WorkFlowStagePersistence, LogLevel.BUSINESS1, errorMsg);
throw new ConcurrentUpdateConflictException (obj, "tl_work_flow_stage");
}
else
{
String errorMsg = "Attempt to update nonexistent row in table:tl_work_flow_stage for row:" + objectID + " objDate:" + obj.getObjectLastModified ();
LogMgr.log (WorkFlowStagePersistence, LogLevel.BUSINESS1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
tl_work_flow_stagePSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
else
{
LogMgr.log (WorkFlowStagePersistence, 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_work_flow_stagePSet = allPSets.getPersistentSet(objectID, "tl_work_flow_stage");
LogMgr.log (WorkFlowStagePersistence, LogLevel.DEBUG2, "Deleting:", objectID);
if (tl_work_flow_stagePSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_work_flow_stagePSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsDeleted = executeStatement (sqlMgr,
"DELETE " +
"FROM {PREFIX}tl_work_flow_stage " +
"WHERE tl_work_flow_stage.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_work_flow_stage WHERE object_id = ?",
new Object[] { objectID.longID() });
if (r.next ())
{
throw new ConcurrentUpdateConflictException (obj, "tl_work_flow_stage");
}
else
{
String errorMsg = "Attempt to delete nonexistent row in table:tl_work_flow_stage for row:" + objectID;
LogMgr.log (WorkFlowStagePersistence, LogLevel.SYSTEMERROR1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
tl_work_flow_stagePSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
public ResultSet executeSearchQueryAll (SQLManager sqlMgr) throws SQLException
{
throw new RuntimeException ("NOT implemented: executeSearchQueryAll");
}
public BaseBusinessClass[] loadQuery (PersistentSetCollection allPSets, SQLManager sqlMgr, RDBMSPersistenceContext context, String query, Object[] params, Integer maxRows, boolean truncateExtra) throws SQLException, StorageException
{
LinkedHashMap<ObjectID, WorkFlowStage> results = new LinkedHashMap ();
ResultSet r = executeQuery (sqlMgr, query, params);
while (r.next())
{
ThreadUtils.checkInterrupted ();
ObjectID objectID = new ObjectID (WorkFlowStage.REFERENCE_WorkFlowStage.getObjectIDSpace (), r.getLong ("id"));
WorkFlowStage 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, WorkFlowStage.REFERENCE_WorkFlowStage);
if (cachedElement instanceof WorkFlowStage)
{
LogMgr.log (WorkFlowStagePersistence, LogLevel.TRACE, "Cache hit for id:", objectID);
resultElement = (WorkFlowStage)cachedElement;
}
else
{
throw new StorageException ("Cache collision for id:" + objectID + " with object " + cachedElement + "while fetching a WorkFlowStage");
}
}
else
{
PersistentSet tl_work_flow_stagePSet = allPSets.getPersistentSet(objectID, "tl_work_flow_stage", PersistentSetStatus.FETCHED);
createPersistentSetFromRS(allPSets, r, objectID);
resultElement = new WorkFlowStage ();
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 (WorkFlowStagePersistence, 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_work_flow_stage " + tables +
"WHERE " + SELECT_JOINS + " " + customParamFilter + customOrderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, null, false);
return results;
}
else if (searchType.equals (WorkFlowStage.SEARCH_All))
{
// Local scope for transformed variables
{
}
String orderBy = " ORDER BY tl_work_flow_stage.object_id";
String tables = " ";
Set<String> joinTableSet = new HashSet<String>();
String filter;
Object[] searchParams; // paramFilter: tl_work_flow_stage.object_id is not null
String preFilter = "(tl_work_flow_stage.object_id is not null)"
+ " ";
preFilter += context.getLoadingAttributes ().getCustomSQL() ;
SearchParamTransform tx = new SearchParamTransform (criteria);
filter = StringUtils.replaceParams (preFilter, tx);
searchParams = tx.getParamsArray();
Integer maxRows = context.getLoadingAttributes ().getMaxRows ();
boolean truncateExtra = !context.getLoadingAttributes ().isFailIfMaxExceeded();
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_work_flow_stage " + tables + tableSetToSQL(joinTableSet) +
"WHERE " + SELECT_JOINS + " " + filter + orderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, maxRows, truncateExtra);
return results;
}
else
{
throw new IllegalArgumentException ("Illegal search type:" + searchType);
}
}
private void createPersistentSetFromRS(PersistentSetCollection allPSets, ResultSet r, ObjectID objectID) throws SQLException
{
PersistentSet tl_work_flow_stagePSet = allPSets.getPersistentSet(objectID, "tl_work_flow_stage", PersistentSetStatus.FETCHED);
// Object Modified
tl_work_flow_stagePSet.setAttrib(BaseBusinessClass.FIELD_ObjectLastModified, r.getTimestamp ("LAST_UPDATED_DATE"));
// Object Created
tl_work_flow_stagePSet.setAttrib(BaseBusinessClass.FIELD_ObjectCreated, r.getTimestamp ("CREATED_DATE"));
tl_work_flow_stagePSet.setAttrib(WorkFlowStage.FIELD_Name, HELPER_Name.getFromRS(dummyName, r, "name"));
tl_work_flow_stagePSet.setAttrib(WorkFlowStage.FIELD_UseMessaging, HELPER_UseMessaging.getFromRS(dummyUseMessaging, r, "use_messaging"));
tl_work_flow_stagePSet.setAttrib(WorkFlowStage.FIELD_StageType, HELPER_StageType.getFromRS(dummyStageType, r, "stage_type"));
tl_work_flow_stagePSet.setAttrib(WorkFlowStage.FIELD_SortOrder, HELPER_SortOrder.getFromRS(dummySortOrder, r, "sort_order"));
tl_work_flow_stagePSet.setAttrib(WorkFlowStage.SINGLEREFERENCE_WithdrawalMessage, r.getObject ("withdrawal_message_id"));
tl_work_flow_stagePSet.setAttrib(WorkFlowStage.SINGLEREFERENCE_WorkFlowTemplate, r.getObject ("work_flow_template_id"));
}
public void create(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet tl_work_flow_stagePSet = allPSets.getPersistentSet(objectID, "tl_work_flow_stage");
if (tl_work_flow_stagePSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_work_flow_stagePSet.getStatus () != PersistentSetStatus.DEFERRED)
{
executeStatement (sqlMgr,
"INSERT INTO {PREFIX}tl_work_flow_stage " +
" (name, use_messaging, stage_type, sort_order, withdrawal_message_id, work_flow_template_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " +
" (?, ?, ?, ?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_Name.getForSQL(dummyName, tl_work_flow_stagePSet.getAttrib (WorkFlowStage.FIELD_Name))).listEntry (HELPER_UseMessaging.getForSQL(dummyUseMessaging, tl_work_flow_stagePSet.getAttrib (WorkFlowStage.FIELD_UseMessaging))).listEntry (HELPER_StageType.getForSQL(dummyStageType, tl_work_flow_stagePSet.getAttrib (WorkFlowStage.FIELD_StageType))).listEntry (HELPER_SortOrder.getForSQL(dummySortOrder, tl_work_flow_stagePSet.getAttrib (WorkFlowStage.FIELD_SortOrder))) .listEntry (SQLManager.CheckNull((Long)(tl_work_flow_stagePSet.getAttrib (WorkFlowStage.SINGLEREFERENCE_WithdrawalMessage)))).listEntry (SQLManager.CheckNull((Long)(tl_work_flow_stagePSet.getAttrib (WorkFlowStage.SINGLEREFERENCE_WorkFlowTemplate)))) .listEntry (objectID.longID ()).toList().toArray());
tl_work_flow_stagePSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
}
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.*;
public class WorkFlowTemplate extends BaseWorkFlowTemplate
{
private static final long serialVersionUID = 0L;
// This constructor should not be called
public WorkFlowTemplate ()
{
// Do not add any code to this, always put it in initialiseNewObject
}
}
<?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="WorkFlowTemplate" package="performa.orm">
<IMPORT value="performa.orm.types.*"/>
<MULTIPLEREFERENCE name="WorkFlowStages" type="WorkFlowStage" backreferenceName="WorkFlowTemplate" />
<MULTIPLEREFERENCE name="Jobs" type="Job" backreferenceName="WorkFlowTemplate" />
<TABLE name="tl_work_flow_template" tablePrefix="object" polymorphic="FALSE">
<ATTRIB name="TemplateName" type="String" dbcol="template_name" mandatory="true"/>
<ATTRIB name="LandingButtonText" type="String" dbcol="landing_button_text" mandatory="false"/>
<ATTRIB name="VerificationHeaderText" type="String" dbcol="verification_header_text" mandatory="false"/>
<ATTRIB name="CaptureCV" type="Boolean" dbcol="capture_cv" mandatory="false"/>
<ATTRIB name="IsCVMandatory" type="Boolean" dbcol="is_cv_mandatory" mandatory="false"/>
<ATTRIB name="CaptureCL" type="Boolean" dbcol="capture_cl" mandatory="false"/>
<ATTRIB name="IsCLMandatory" type="Boolean" dbcol="is_cl_mandatory" mandatory="false"/>
<ATTRIB name="ApplicationButtonText" type="String" dbcol="application_button_text" mandatory="false"/>
<ATTRIB name="ApplicationResponseAction" type="ResponseAction" dbcol="application_response_action" attribHelper="EnumeratedAttributeHelper" mandatory="true"/>
<ATTRIB name="ThankYouHeaderText" type="String" dbcol="thank_you_header_text" mandatory="false"/>
<ATTRIB name="ThankYouSecondaryText" type="String" dbcol="thank_you_secondary_text" mandatory="false"/>
<ATTRIB name="JobOutlineButtonText" type="String" dbcol="job_outline_button_text" mandatory="false"/>
<ATTRIB name="IsGlobalTemplate" type="Boolean" dbcol="is_global_template" mandatory="false"/>
<SINGLEREFERENCE name="WithdrawalMessage" type="WorkFlowMessage" dbcol="withdrawal_message_id" />
<SINGLEREFERENCE name="HiringTeam" type="HiringTeam" dbcol="hiring_team_id" backreferenceName="WorkFlowTemplates" mandatory="false"/>
</TABLE>
<SEARCH type="All" paramFilter="tl_work_flow_template.object_id is not null" orderBy="tl_work_flow_template.object_id" />
</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.*;
/**
* IMPORTANT!!!! Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2[oneit.objstore.PersistenceMgrTemplate.xsl]
*/
public class WorkFlowTemplatePersistenceMgr extends ObjectPersistenceMgr
{
private static final LoggingArea WorkFlowTemplatePersistence = LoggingArea.createLoggingArea(ObjectPersistenceMgr.OBJECT_PERSISTENCE, "WorkFlowTemplate");
// Private attributes corresponding to business object data
private String dummyTemplateName;
private String dummyLandingButtonText;
private String dummyVerificationHeaderText;
private Boolean dummyCaptureCV;
private Boolean dummyIsCVMandatory;
private Boolean dummyCaptureCL;
private Boolean dummyIsCLMandatory;
private String dummyApplicationButtonText;
private ResponseAction dummyApplicationResponseAction;
private String dummyThankYouHeaderText;
private String dummyThankYouSecondaryText;
private String dummyJobOutlineButtonText;
private Boolean dummyIsGlobalTemplate;
// Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper HELPER_TemplateName = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_LandingButtonText = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_VerificationHeaderText = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_CaptureCV = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_IsCVMandatory = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_CaptureCL = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_IsCLMandatory = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_ApplicationButtonText = DefaultAttributeHelper.INSTANCE;
private static final EnumeratedAttributeHelper HELPER_ApplicationResponseAction = new EnumeratedAttributeHelper (ResponseAction.FACTORY_ResponseAction);
private static final DefaultAttributeHelper HELPER_ThankYouHeaderText = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_ThankYouSecondaryText = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_JobOutlineButtonText = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_IsGlobalTemplate = DefaultAttributeHelper.INSTANCE;
public WorkFlowTemplatePersistenceMgr ()
{
dummyTemplateName = (String)(HELPER_TemplateName.initialise (dummyTemplateName));
dummyLandingButtonText = (String)(HELPER_LandingButtonText.initialise (dummyLandingButtonText));
dummyVerificationHeaderText = (String)(HELPER_VerificationHeaderText.initialise (dummyVerificationHeaderText));
dummyCaptureCV = (Boolean)(HELPER_CaptureCV.initialise (dummyCaptureCV));
dummyIsCVMandatory = (Boolean)(HELPER_IsCVMandatory.initialise (dummyIsCVMandatory));
dummyCaptureCL = (Boolean)(HELPER_CaptureCL.initialise (dummyCaptureCL));
dummyIsCLMandatory = (Boolean)(HELPER_IsCLMandatory.initialise (dummyIsCLMandatory));
dummyApplicationButtonText = (String)(HELPER_ApplicationButtonText.initialise (dummyApplicationButtonText));
dummyApplicationResponseAction = (ResponseAction)(HELPER_ApplicationResponseAction.initialise (dummyApplicationResponseAction));
dummyThankYouHeaderText = (String)(HELPER_ThankYouHeaderText.initialise (dummyThankYouHeaderText));
dummyThankYouSecondaryText = (String)(HELPER_ThankYouSecondaryText.initialise (dummyThankYouSecondaryText));
dummyJobOutlineButtonText = (String)(HELPER_JobOutlineButtonText.initialise (dummyJobOutlineButtonText));
dummyIsGlobalTemplate = (Boolean)(HELPER_IsGlobalTemplate.initialise (dummyIsGlobalTemplate));
}
private String SELECT_COLUMNS = "{PREFIX}tl_work_flow_template.object_id as id, {PREFIX}tl_work_flow_template.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_work_flow_template.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_work_flow_template.template_name, {PREFIX}tl_work_flow_template.landing_button_text, {PREFIX}tl_work_flow_template.verification_header_text, {PREFIX}tl_work_flow_template.capture_cv, {PREFIX}tl_work_flow_template.is_cv_mandatory, {PREFIX}tl_work_flow_template.capture_cl, {PREFIX}tl_work_flow_template.is_cl_mandatory, {PREFIX}tl_work_flow_template.application_button_text, {PREFIX}tl_work_flow_template.application_response_action, {PREFIX}tl_work_flow_template.thank_you_header_text, {PREFIX}tl_work_flow_template.thank_you_secondary_text, {PREFIX}tl_work_flow_template.job_outline_button_text, {PREFIX}tl_work_flow_template.is_global_template, {PREFIX}tl_work_flow_template.withdrawal_message_id, {PREFIX}tl_work_flow_template.hiring_team_id, 1 AS commasafe ";
private String SELECT_JOINS = "";
public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
Set<BaseBusinessClass> resultByIDs = fetchByIDs(Collections.singleton (id), allPSets, context, sqlMgr);
if (resultByIDs.isEmpty ())
{
return null;
}
else if (resultByIDs.size () > 1)
{
throw new StorageException ("Multiple results for id:" + id);
}
else
{
return resultByIDs.iterator ().next ();
}
}
public Set<BaseBusinessClass> fetchByIDs(Set<ObjectID> ids, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
Set<BaseBusinessClass> results = new HashSet ();
Set<Long> idsToFetch = new HashSet ();
for (ObjectID id : ids)
{
if (context.containsObject(id)) // Check for cached version
{
BaseBusinessClass objectToReturn = context.getObjectToReplace(id, WorkFlowTemplate.REFERENCE_WorkFlowTemplate);
if (objectToReturn instanceof WorkFlowTemplate)
{
LogMgr.log (WorkFlowTemplatePersistence, 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 WorkFlowTemplate");
}
}
PersistentSet tl_work_flow_templatePSet = allPSets.getPersistentSet(id, "tl_work_flow_template", PersistentSetStatus.FETCHED);
// Check for persistent sets already prefetched
if (false || !tl_work_flow_templatePSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!tl_work_flow_templatePSet.containsAttrib(WorkFlowTemplate.FIELD_TemplateName)||
!tl_work_flow_templatePSet.containsAttrib(WorkFlowTemplate.FIELD_LandingButtonText)||
!tl_work_flow_templatePSet.containsAttrib(WorkFlowTemplate.FIELD_VerificationHeaderText)||
!tl_work_flow_templatePSet.containsAttrib(WorkFlowTemplate.FIELD_CaptureCV)||
!tl_work_flow_templatePSet.containsAttrib(WorkFlowTemplate.FIELD_IsCVMandatory)||
!tl_work_flow_templatePSet.containsAttrib(WorkFlowTemplate.FIELD_CaptureCL)||
!tl_work_flow_templatePSet.containsAttrib(WorkFlowTemplate.FIELD_IsCLMandatory)||
!tl_work_flow_templatePSet.containsAttrib(WorkFlowTemplate.FIELD_ApplicationButtonText)||
!tl_work_flow_templatePSet.containsAttrib(WorkFlowTemplate.FIELD_ApplicationResponseAction)||
!tl_work_flow_templatePSet.containsAttrib(WorkFlowTemplate.FIELD_ThankYouHeaderText)||
!tl_work_flow_templatePSet.containsAttrib(WorkFlowTemplate.FIELD_ThankYouSecondaryText)||
!tl_work_flow_templatePSet.containsAttrib(WorkFlowTemplate.FIELD_JobOutlineButtonText)||
!tl_work_flow_templatePSet.containsAttrib(WorkFlowTemplate.FIELD_IsGlobalTemplate)||
!tl_work_flow_templatePSet.containsAttrib(WorkFlowTemplate.SINGLEREFERENCE_WithdrawalMessage)||
!tl_work_flow_templatePSet.containsAttrib(WorkFlowTemplate.SINGLEREFERENCE_HiringTeam))
{
// We will need to retrieve it
idsToFetch.add (id.longValue());
}
else
{
LogMgr.log (WorkFlowTemplatePersistence, LogLevel.DEBUG2, "Persistent set preloaded id:", id);
/* Non Polymorphic */
WorkFlowTemplate result = new WorkFlowTemplate ();
result.setFromPersistentSets(id, allPSets);
context.addRetrievedObject(result);
results.add (result);
}
}
if (idsToFetch.size () > 0)
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_work_flow_template " +
"WHERE " + SELECT_JOINS + "{PREFIX}tl_work_flow_template.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 (WorkFlowTemplate.SINGLEREFERENCE_HiringTeam))
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_work_flow_template " +
"WHERE " + SELECT_JOINS + "hiring_team_id = ?";
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 tl_work_flow_templatePSet = allPSets.getPersistentSet(objectID, "tl_work_flow_template");
if (tl_work_flow_templatePSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_work_flow_templatePSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}tl_work_flow_template " +
"SET template_name = ?, landing_button_text = ?, verification_header_text = ?, capture_cv = ?, is_cv_mandatory = ?, capture_cl = ?, is_cl_mandatory = ?, application_button_text = ?, application_response_action = ?, thank_you_header_text = ?, thank_you_secondary_text = ?, job_outline_button_text = ?, is_global_template = ?, withdrawal_message_id = ? , hiring_team_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE tl_work_flow_template.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_TemplateName.getForSQL(dummyTemplateName, tl_work_flow_templatePSet.getAttrib (WorkFlowTemplate.FIELD_TemplateName))).listEntry (HELPER_LandingButtonText.getForSQL(dummyLandingButtonText, tl_work_flow_templatePSet.getAttrib (WorkFlowTemplate.FIELD_LandingButtonText))).listEntry (HELPER_VerificationHeaderText.getForSQL(dummyVerificationHeaderText, tl_work_flow_templatePSet.getAttrib (WorkFlowTemplate.FIELD_VerificationHeaderText))).listEntry (HELPER_CaptureCV.getForSQL(dummyCaptureCV, tl_work_flow_templatePSet.getAttrib (WorkFlowTemplate.FIELD_CaptureCV))).listEntry (HELPER_IsCVMandatory.getForSQL(dummyIsCVMandatory, tl_work_flow_templatePSet.getAttrib (WorkFlowTemplate.FIELD_IsCVMandatory))).listEntry (HELPER_CaptureCL.getForSQL(dummyCaptureCL, tl_work_flow_templatePSet.getAttrib (WorkFlowTemplate.FIELD_CaptureCL))).listEntry (HELPER_IsCLMandatory.getForSQL(dummyIsCLMandatory, tl_work_flow_templatePSet.getAttrib (WorkFlowTemplate.FIELD_IsCLMandatory))).listEntry (HELPER_ApplicationButtonText.getForSQL(dummyApplicationButtonText, tl_work_flow_templatePSet.getAttrib (WorkFlowTemplate.FIELD_ApplicationButtonText))).listEntry (HELPER_ApplicationResponseAction.getForSQL(dummyApplicationResponseAction, tl_work_flow_templatePSet.getAttrib (WorkFlowTemplate.FIELD_ApplicationResponseAction))).listEntry (HELPER_ThankYouHeaderText.getForSQL(dummyThankYouHeaderText, tl_work_flow_templatePSet.getAttrib (WorkFlowTemplate.FIELD_ThankYouHeaderText))).listEntry (HELPER_ThankYouSecondaryText.getForSQL(dummyThankYouSecondaryText, tl_work_flow_templatePSet.getAttrib (WorkFlowTemplate.FIELD_ThankYouSecondaryText))).listEntry (HELPER_JobOutlineButtonText.getForSQL(dummyJobOutlineButtonText, tl_work_flow_templatePSet.getAttrib (WorkFlowTemplate.FIELD_JobOutlineButtonText))).listEntry (HELPER_IsGlobalTemplate.getForSQL(dummyIsGlobalTemplate, tl_work_flow_templatePSet.getAttrib (WorkFlowTemplate.FIELD_IsGlobalTemplate))).listEntry (SQLManager.CheckNull((Long)(tl_work_flow_templatePSet.getAttrib (WorkFlowTemplate.SINGLEREFERENCE_WithdrawalMessage)))).listEntry (SQLManager.CheckNull((Long)(tl_work_flow_templatePSet.getAttrib (WorkFlowTemplate.SINGLEREFERENCE_HiringTeam)))).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_work_flow_template 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_work_flow_template", objectID.longID (), obj.getObjectLastModified (), d },
sqlMgr.getPortabilityServices ());
LogMgr.log (WorkFlowTemplatePersistence, LogLevel.BUSINESS1, errorMsg);
throw new ConcurrentUpdateConflictException (obj, "tl_work_flow_template");
}
else
{
String errorMsg = "Attempt to update nonexistent row in table:tl_work_flow_template for row:" + objectID + " objDate:" + obj.getObjectLastModified ();
LogMgr.log (WorkFlowTemplatePersistence, LogLevel.BUSINESS1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
tl_work_flow_templatePSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
else
{
LogMgr.log (WorkFlowTemplatePersistence, 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_work_flow_templatePSet = allPSets.getPersistentSet(objectID, "tl_work_flow_template");
LogMgr.log (WorkFlowTemplatePersistence, LogLevel.DEBUG2, "Deleting:", objectID);
if (tl_work_flow_templatePSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_work_flow_templatePSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsDeleted = executeStatement (sqlMgr,
"DELETE " +
"FROM {PREFIX}tl_work_flow_template " +
"WHERE tl_work_flow_template.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_work_flow_template WHERE object_id = ?",
new Object[] { objectID.longID() });
if (r.next ())
{
throw new ConcurrentUpdateConflictException (obj, "tl_work_flow_template");
}
else
{
String errorMsg = "Attempt to delete nonexistent row in table:tl_work_flow_template for row:" + objectID;
LogMgr.log (WorkFlowTemplatePersistence, LogLevel.SYSTEMERROR1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
tl_work_flow_templatePSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
public ResultSet executeSearchQueryAll (SQLManager sqlMgr) throws SQLException
{
throw new RuntimeException ("NOT implemented: executeSearchQueryAll");
}
public BaseBusinessClass[] loadQuery (PersistentSetCollection allPSets, SQLManager sqlMgr, RDBMSPersistenceContext context, String query, Object[] params, Integer maxRows, boolean truncateExtra) throws SQLException, StorageException
{
LinkedHashMap<ObjectID, WorkFlowTemplate> results = new LinkedHashMap ();
ResultSet r = executeQuery (sqlMgr, query, params);
while (r.next())
{
ThreadUtils.checkInterrupted ();
ObjectID objectID = new ObjectID (WorkFlowTemplate.REFERENCE_WorkFlowTemplate.getObjectIDSpace (), r.getLong ("id"));
WorkFlowTemplate 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, WorkFlowTemplate.REFERENCE_WorkFlowTemplate);
if (cachedElement instanceof WorkFlowTemplate)
{
LogMgr.log (WorkFlowTemplatePersistence, LogLevel.TRACE, "Cache hit for id:", objectID);
resultElement = (WorkFlowTemplate)cachedElement;
}
else
{
throw new StorageException ("Cache collision for id:" + objectID + " with object " + cachedElement + "while fetching a WorkFlowTemplate");
}
}
else
{
PersistentSet tl_work_flow_templatePSet = allPSets.getPersistentSet(objectID, "tl_work_flow_template", PersistentSetStatus.FETCHED);
createPersistentSetFromRS(allPSets, r, objectID);
resultElement = new WorkFlowTemplate ();
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 (WorkFlowTemplatePersistence, 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_work_flow_template " + tables +
"WHERE " + SELECT_JOINS + " " + customParamFilter + customOrderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, null, false);
return results;
}
else if (searchType.equals (WorkFlowTemplate.SEARCH_All))
{
// Local scope for transformed variables
{
}
String orderBy = " ORDER BY tl_work_flow_template.object_id";
String tables = " ";
Set<String> joinTableSet = new HashSet<String>();
String filter;
Object[] searchParams; // paramFilter: tl_work_flow_template.object_id is not null
String preFilter = "(tl_work_flow_template.object_id is not null)"
+ " ";
preFilter += context.getLoadingAttributes ().getCustomSQL() ;
SearchParamTransform tx = new SearchParamTransform (criteria);
filter = StringUtils.replaceParams (preFilter, tx);
searchParams = tx.getParamsArray();
Integer maxRows = context.getLoadingAttributes ().getMaxRows ();
boolean truncateExtra = !context.getLoadingAttributes ().isFailIfMaxExceeded();
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_work_flow_template " + tables + tableSetToSQL(joinTableSet) +
"WHERE " + SELECT_JOINS + " " + filter + orderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, maxRows, truncateExtra);
return results;
}
else
{
throw new IllegalArgumentException ("Illegal search type:" + searchType);
}
}
private void createPersistentSetFromRS(PersistentSetCollection allPSets, ResultSet r, ObjectID objectID) throws SQLException
{
PersistentSet tl_work_flow_templatePSet = allPSets.getPersistentSet(objectID, "tl_work_flow_template", PersistentSetStatus.FETCHED);
// Object Modified
tl_work_flow_templatePSet.setAttrib(BaseBusinessClass.FIELD_ObjectLastModified, r.getTimestamp ("LAST_UPDATED_DATE"));
// Object Created
tl_work_flow_templatePSet.setAttrib(BaseBusinessClass.FIELD_ObjectCreated, r.getTimestamp ("CREATED_DATE"));
tl_work_flow_templatePSet.setAttrib(WorkFlowTemplate.FIELD_TemplateName, HELPER_TemplateName.getFromRS(dummyTemplateName, r, "template_name"));
tl_work_flow_templatePSet.setAttrib(WorkFlowTemplate.FIELD_LandingButtonText, HELPER_LandingButtonText.getFromRS(dummyLandingButtonText, r, "landing_button_text"));
tl_work_flow_templatePSet.setAttrib(WorkFlowTemplate.FIELD_VerificationHeaderText, HELPER_VerificationHeaderText.getFromRS(dummyVerificationHeaderText, r, "verification_header_text"));
tl_work_flow_templatePSet.setAttrib(WorkFlowTemplate.FIELD_CaptureCV, HELPER_CaptureCV.getFromRS(dummyCaptureCV, r, "capture_cv"));
tl_work_flow_templatePSet.setAttrib(WorkFlowTemplate.FIELD_IsCVMandatory, HELPER_IsCVMandatory.getFromRS(dummyIsCVMandatory, r, "is_cv_mandatory"));
tl_work_flow_templatePSet.setAttrib(WorkFlowTemplate.FIELD_CaptureCL, HELPER_CaptureCL.getFromRS(dummyCaptureCL, r, "capture_cl"));
tl_work_flow_templatePSet.setAttrib(WorkFlowTemplate.FIELD_IsCLMandatory, HELPER_IsCLMandatory.getFromRS(dummyIsCLMandatory, r, "is_cl_mandatory"));
tl_work_flow_templatePSet.setAttrib(WorkFlowTemplate.FIELD_ApplicationButtonText, HELPER_ApplicationButtonText.getFromRS(dummyApplicationButtonText, r, "application_button_text"));
tl_work_flow_templatePSet.setAttrib(WorkFlowTemplate.FIELD_ApplicationResponseAction, HELPER_ApplicationResponseAction.getFromRS(dummyApplicationResponseAction, r, "application_response_action"));
tl_work_flow_templatePSet.setAttrib(WorkFlowTemplate.FIELD_ThankYouHeaderText, HELPER_ThankYouHeaderText.getFromRS(dummyThankYouHeaderText, r, "thank_you_header_text"));
tl_work_flow_templatePSet.setAttrib(WorkFlowTemplate.FIELD_ThankYouSecondaryText, HELPER_ThankYouSecondaryText.getFromRS(dummyThankYouSecondaryText, r, "thank_you_secondary_text"));
tl_work_flow_templatePSet.setAttrib(WorkFlowTemplate.FIELD_JobOutlineButtonText, HELPER_JobOutlineButtonText.getFromRS(dummyJobOutlineButtonText, r, "job_outline_button_text"));
tl_work_flow_templatePSet.setAttrib(WorkFlowTemplate.FIELD_IsGlobalTemplate, HELPER_IsGlobalTemplate.getFromRS(dummyIsGlobalTemplate, r, "is_global_template"));
tl_work_flow_templatePSet.setAttrib(WorkFlowTemplate.SINGLEREFERENCE_WithdrawalMessage, r.getObject ("withdrawal_message_id"));
tl_work_flow_templatePSet.setAttrib(WorkFlowTemplate.SINGLEREFERENCE_HiringTeam, r.getObject ("hiring_team_id"));
}
public void create(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet tl_work_flow_templatePSet = allPSets.getPersistentSet(objectID, "tl_work_flow_template");
if (tl_work_flow_templatePSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_work_flow_templatePSet.getStatus () != PersistentSetStatus.DEFERRED)
{
executeStatement (sqlMgr,
"INSERT INTO {PREFIX}tl_work_flow_template " +
" (template_name, landing_button_text, verification_header_text, capture_cv, is_cv_mandatory, capture_cl, is_cl_mandatory, application_button_text, application_response_action, thank_you_header_text, thank_you_secondary_text, job_outline_button_text, is_global_template, withdrawal_message_id, hiring_team_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " +
" (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_TemplateName.getForSQL(dummyTemplateName, tl_work_flow_templatePSet.getAttrib (WorkFlowTemplate.FIELD_TemplateName))).listEntry (HELPER_LandingButtonText.getForSQL(dummyLandingButtonText, tl_work_flow_templatePSet.getAttrib (WorkFlowTemplate.FIELD_LandingButtonText))).listEntry (HELPER_VerificationHeaderText.getForSQL(dummyVerificationHeaderText, tl_work_flow_templatePSet.getAttrib (WorkFlowTemplate.FIELD_VerificationHeaderText))).listEntry (HELPER_CaptureCV.getForSQL(dummyCaptureCV, tl_work_flow_templatePSet.getAttrib (WorkFlowTemplate.FIELD_CaptureCV))).listEntry (HELPER_IsCVMandatory.getForSQL(dummyIsCVMandatory, tl_work_flow_templatePSet.getAttrib (WorkFlowTemplate.FIELD_IsCVMandatory))).listEntry (HELPER_CaptureCL.getForSQL(dummyCaptureCL, tl_work_flow_templatePSet.getAttrib (WorkFlowTemplate.FIELD_CaptureCL))).listEntry (HELPER_IsCLMandatory.getForSQL(dummyIsCLMandatory, tl_work_flow_templatePSet.getAttrib (WorkFlowTemplate.FIELD_IsCLMandatory))).listEntry (HELPER_ApplicationButtonText.getForSQL(dummyApplicationButtonText, tl_work_flow_templatePSet.getAttrib (WorkFlowTemplate.FIELD_ApplicationButtonText))).listEntry (HELPER_ApplicationResponseAction.getForSQL(dummyApplicationResponseAction, tl_work_flow_templatePSet.getAttrib (WorkFlowTemplate.FIELD_ApplicationResponseAction))).listEntry (HELPER_ThankYouHeaderText.getForSQL(dummyThankYouHeaderText, tl_work_flow_templatePSet.getAttrib (WorkFlowTemplate.FIELD_ThankYouHeaderText))).listEntry (HELPER_ThankYouSecondaryText.getForSQL(dummyThankYouSecondaryText, tl_work_flow_templatePSet.getAttrib (WorkFlowTemplate.FIELD_ThankYouSecondaryText))).listEntry (HELPER_JobOutlineButtonText.getForSQL(dummyJobOutlineButtonText, tl_work_flow_templatePSet.getAttrib (WorkFlowTemplate.FIELD_JobOutlineButtonText))).listEntry (HELPER_IsGlobalTemplate.getForSQL(dummyIsGlobalTemplate, tl_work_flow_templatePSet.getAttrib (WorkFlowTemplate.FIELD_IsGlobalTemplate))) .listEntry (SQLManager.CheckNull((Long)(tl_work_flow_templatePSet.getAttrib (WorkFlowTemplate.SINGLEREFERENCE_WithdrawalMessage)))).listEntry (SQLManager.CheckNull((Long)(tl_work_flow_templatePSet.getAttrib (WorkFlowTemplate.SINGLEREFERENCE_HiringTeam)))) .listEntry (objectID.longID ()).toList().toArray());
tl_work_flow_templatePSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
}
......@@ -37,8 +37,14 @@ public class PlaceholderOptions extends AbstractEnumerated
public static final PlaceholderOptions JOB_LINK = new PlaceholderOptions ("JOB_LINK", "JOB_LINK", "Job Link", false);
public static final PlaceholderOptions WITHDRAW_LINK = new PlaceholderOptions ("WITHDRAW_LINK", "WITHDRAW_LINK", "Withdraw Link", false);
public static final PlaceholderOptions JOB_OWNER_FIRST_NAME = new PlaceholderOptions ("JOB_OWNER_FIRST_NAME", "JOB_OWNER_FIRST_NAME", "Job Owner - First Name", false);
public static final PlaceholderOptions JOB_OWNER_LAST_NAME = new PlaceholderOptions ("JOB_OWNER_LAST_NAME", "JOB_OWNER_LAST_NAME", "Job Owner - Last Name", false);
private static final PlaceholderOptions[] allPlaceholderOptionss =
new PlaceholderOptions[] { FIRST_NAME,SURNAME,EMAIL_ADDRESS,LOCATION,HIRING_TEAM,JOB_TITLE,JOB_REFERENCE,JOB_LINK};
new PlaceholderOptions[] { FIRST_NAME,SURNAME,EMAIL_ADDRESS,LOCATION,HIRING_TEAM,JOB_TITLE,JOB_REFERENCE,JOB_LINK,WITHDRAW_LINK,JOB_OWNER_FIRST_NAME,JOB_OWNER_LAST_NAME};
private static PlaceholderOptions[] getAllPlaceholderOptionss ()
......@@ -48,6 +54,10 @@ public class PlaceholderOptions extends AbstractEnumerated
private transient String Placeholder;
private transient Boolean ShowForSubject;
private transient Boolean ShowForContent;
private PlaceholderOptions (String name, String value, String description, boolean disabled)
{
super (name, value, description, disabled);
......@@ -58,6 +68,16 @@ public class PlaceholderOptions extends AbstractEnumerated
return Placeholder;
}
public Boolean getShowForSubject()
{
return ShowForSubject;
}
public Boolean getShowForContent()
{
return ShowForContent;
}
public static final Comparator COMPARE_BY_POSITION = new CompareEnumByPosition (allPlaceholderOptionss);
......@@ -126,13 +146,38 @@ public class PlaceholderOptions extends AbstractEnumerated
public static void defineAdditionalData ()
{
FIRST_NAME.Placeholder = "$firstName";
FIRST_NAME.ShowForSubject = Boolean.TRUE;
FIRST_NAME.ShowForContent = Boolean.TRUE;
SURNAME.Placeholder = "$surname";
SURNAME.ShowForSubject = Boolean.TRUE;
SURNAME.ShowForContent = Boolean.TRUE;
EMAIL_ADDRESS.Placeholder = "$emailAddress";
EMAIL_ADDRESS.ShowForSubject = Boolean.TRUE;
EMAIL_ADDRESS.ShowForContent = Boolean.TRUE;
LOCATION.Placeholder = "$location";
LOCATION.ShowForSubject = Boolean.TRUE;
LOCATION.ShowForContent = Boolean.TRUE;
HIRING_TEAM.Placeholder = "$hiringTeam";
HIRING_TEAM.ShowForSubject = Boolean.TRUE;
HIRING_TEAM.ShowForContent = Boolean.TRUE;
JOB_TITLE.Placeholder = "$jobTitle";
JOB_TITLE.ShowForSubject = Boolean.TRUE;
JOB_TITLE.ShowForContent = Boolean.TRUE;
JOB_REFERENCE.Placeholder = "$jobReference";
JOB_REFERENCE.ShowForSubject = Boolean.TRUE;
JOB_REFERENCE.ShowForContent = Boolean.TRUE;
JOB_LINK.Placeholder = "$jobLink";
JOB_LINK.ShowForSubject = Boolean.FALSE;
JOB_LINK.ShowForContent = Boolean.TRUE;
WITHDRAW_LINK.Placeholder = "$withdrawLink";
WITHDRAW_LINK.ShowForSubject = Boolean.FALSE;
WITHDRAW_LINK.ShowForContent = Boolean.TRUE;
JOB_OWNER_FIRST_NAME.Placeholder = "$jobOwnerFirstName";
JOB_OWNER_FIRST_NAME.ShowForSubject = Boolean.TRUE;
JOB_OWNER_FIRST_NAME.ShowForContent = Boolean.TRUE;
JOB_OWNER_LAST_NAME.Placeholder = "$jobOwnerLastName";
JOB_OWNER_LAST_NAME.ShowForSubject = Boolean.TRUE;
JOB_OWNER_LAST_NAME.ShowForContent = Boolean.TRUE;
}
......@@ -161,6 +206,8 @@ public class PlaceholderOptions extends AbstractEnumerated
Map attribs = new HashMap ();
attribs.put ("Placeholder", ArrayFormatter.toObject(getPlaceholder()));
attribs.put ("ShowForSubject", ArrayFormatter.toObject(getShowForSubject()));
attribs.put ("ShowForContent", ArrayFormatter.toObject(getShowForContent()));
return attribs;
}
......@@ -188,12 +235,24 @@ public class PlaceholderOptions extends AbstractEnumerated
{
return toPlaceholder ();
}
if (name.equals ("ShowForSubject"))
{
return toShowForSubject ();
}
if (name.equals ("ShowForContent"))
{
return toShowForContent ();
}
return super.to(name);
}
public PipeLine<From, String> toPlaceholder () { return pipe(new EnumAttributePipe<Me, String>("Placeholder")); }
public PipeLine<From, Boolean> toShowForSubject () { return pipe(new EnumAttributePipe<Me, Boolean>("ShowForSubject")); }
public PipeLine<From, Boolean> toShowForContent () { return pipe(new EnumAttributePipe<Me, Boolean>("ShowForContent")); }
}
}
......@@ -4,15 +4,31 @@
<CONSTANT package="performa.orm.types" name="PlaceholderOptions">
<DATA name="Placeholder" type="String"/>
<DATA name="ShowForSubject" type="Boolean"/>
<DATA name="ShowForContent" type="Boolean"/>
<VALUE name="FIRST_NAME" value="FIRST_NAME" description="First Name" Placeholder='"$firstName"' />
<VALUE name="SURNAME" value="SURNAME" description="Surname" Placeholder='"$surname"' />
<VALUE name="EMAIL_ADDRESS" value="EMAIL_ADDRESS" description="Email Address" Placeholder='"$emailAddress"' />
<VALUE name="LOCATION" value="LOCATION" description="Location" Placeholder='"$location"' />
<VALUE name="HIRING_TEAM" value="HIRING_TEAM" description="Hiring Team" Placeholder='"$hiringTeam"' />
<VALUE name="JOB_TITLE" value="JOB_TITLE" description="Job Title" Placeholder='"$jobTitle"' />
<VALUE name="JOB_REFERENCE" value="JOB_REFERENCE" description="Job Reference" Placeholder='"$jobReference"' />
<VALUE name="JOB_LINK" value="JOB_LINK" description="Job Link" Placeholder='"$jobLink"' />
<VALUE name="FIRST_NAME" value="FIRST_NAME" description="First Name" Placeholder='"$firstName"'
ShowForSubject="Boolean.TRUE" ShowForContent="Boolean.TRUE"/>
<VALUE name="SURNAME" value="SURNAME" description="Surname" Placeholder='"$surname"'
ShowForSubject="Boolean.TRUE" ShowForContent="Boolean.TRUE"/>
<VALUE name="EMAIL_ADDRESS" value="EMAIL_ADDRESS" description="Email Address" Placeholder='"$emailAddress"'
ShowForSubject="Boolean.TRUE" ShowForContent="Boolean.TRUE"/>
<VALUE name="LOCATION" value="LOCATION" description="Location" Placeholder='"$location"'
ShowForSubject="Boolean.TRUE" ShowForContent="Boolean.TRUE"/>
<VALUE name="HIRING_TEAM" value="HIRING_TEAM" description="Hiring Team" Placeholder='"$hiringTeam"'
ShowForSubject="Boolean.TRUE" ShowForContent="Boolean.TRUE"/>
<VALUE name="JOB_TITLE" value="JOB_TITLE" description="Job Title" Placeholder='"$jobTitle"'
ShowForSubject="Boolean.TRUE" ShowForContent="Boolean.TRUE"/>
<VALUE name="JOB_REFERENCE" value="JOB_REFERENCE" description="Job Reference" Placeholder='"$jobReference"'
ShowForSubject="Boolean.TRUE" ShowForContent="Boolean.TRUE"/>
<VALUE name="JOB_LINK" value="JOB_LINK" description="Job Link" Placeholder='"$jobLink"'
ShowForSubject="Boolean.FALSE" ShowForContent="Boolean.TRUE"/>
<VALUE name="WITHDRAW_LINK" value="WITHDRAW_LINK" description="Withdraw Link" Placeholder='"$withdrawLink"'
ShowForSubject="Boolean.FALSE" ShowForContent="Boolean.TRUE"/>
<VALUE name="JOB_OWNER_FIRST_NAME" value="JOB_OWNER_FIRST_NAME" description="Job Owner - First Name" Placeholder='"$jobOwnerFirstName"'
ShowForSubject="Boolean.TRUE" ShowForContent="Boolean.TRUE"/>
<VALUE name="JOB_OWNER_LAST_NAME" value="JOB_OWNER_LAST_NAME" description="Job Owner - Last Name" Placeholder='"$jobOwnerLastName"'
ShowForSubject="Boolean.TRUE" ShowForContent="Boolean.TRUE"/>
</CONSTANT>
</ROOT>
\ No newline at end of file
package performa.orm.types;
import java.util.*;
import oneit.utils.*;
import oneit.utils.transform.*;
/**
* This class was generated using constGen.bat.
* DO NOT MODIFY THIS CODE.
* Edit the associated .xml file, and regenerate this file
* constGen (directory) (file minus extension)
* e.g. constGen C:\...\sql FieldType
*/
public class ResponseAction extends AbstractEnumerated
{
public static final EnumeratedFactory FACTORY_ResponseAction = new ResponseActionFactory();
public static final ResponseAction EMAIL_RESPONSE = new ResponseAction ("EMAIL_RESPONSE", "EMAIL_RESPONSE", "Email Response", false);
public static final ResponseAction CONTINUE = new ResponseAction ("CONTINUE", "CONTINUE", "Continue", false);
private static final ResponseAction[] allResponseActions =
new ResponseAction[] { EMAIL_RESPONSE,CONTINUE};
private static ResponseAction[] getAllResponseActions ()
{
return allResponseActions;
}
private ResponseAction (String name, String value, String description, boolean disabled)
{
super (name, value, description, disabled);
}
public static final Comparator COMPARE_BY_POSITION = new CompareEnumByPosition (allResponseActions);
static
{
defineAdditionalData ();
}
public boolean isEqual (ResponseAction other)
{
return this.name.equals (other.name);
}
public Enumeration getAllInstances ()
{
return ResponseAction.getAll ();
}
private Object readResolve() throws java.io.ObjectStreamException
{
return ResponseAction.forName (this.name);
}
public EnumeratedFactory getFactory ()
{
return FACTORY_ResponseAction;
}
public static ResponseAction forName (String name)
{
if (name == null) { return null; }
ResponseAction[] all = getAllResponseActions();
int enumIndex = AbstractEnumerated.getIndexForName (all, name);
return all[enumIndex];
}
public static ResponseAction forValue (String value)
{
if (value == null) { return null; }
ResponseAction[] all = getAllResponseActions();
int enumIndex = AbstractEnumerated.getIndexForValue (getAllResponseActions (), value);
return all[enumIndex];
}
public static java.util.Enumeration getAll ()
{
return AbstractEnumerated.getAll (getAllResponseActions());
}
public static ResponseAction[] getResponseActionArray ()
{
return (ResponseAction[])getAllResponseActions().clone ();
}
public static void defineAdditionalData ()
{
}
static class ResponseActionFactory implements EnumeratedFactory
{
public AbstractEnumerated getForName (String name)
{
return ResponseAction.forName (name);
}
public AbstractEnumerated getForValue (String name)
{
return ResponseAction.forValue (name);
}
public Enumeration getAll ()
{
return ResponseAction.getAll ();
}
}
public Map getAdditionalAttributes ()
{
Map attribs = new HashMap ();
return attribs;
}
public static class ResponseActionPipeLineFactory<From, Me extends ResponseAction> extends AbstractEnumerated.EnumPipeLine<From, Me>
{
public <Prev> ResponseActionPipeLineFactory (PipeLine<From, Prev> pipeLine, Pipe<Prev, Me> nextPipe)
{
super (pipeLine, nextPipe);
}
public ResponseActionPipeLineFactory (From seed)
{
super(seed);
}
public ResponseActionPipeLineFactory (Collection<From> seed)
{
super(seed);
}
public PipeLine<From, ? extends Object> to(String name)
{
return super.to(name);
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<ROOT>
<CONSTANT package="performa.orm.types" name="ResponseAction">
<VALUE name="EMAIL_RESPONSE" description="Email Response"/>
<VALUE name="CONTINUE" description="Continue"/>
</CONSTANT>
</ROOT>
\ No newline at end of file
package performa.orm.types;
import java.util.*;
import oneit.utils.*;
import oneit.utils.transform.*;
/**
* This class was generated using constGen.bat.
* DO NOT MODIFY THIS CODE.
* Edit the associated .xml file, and regenerate this file
* constGen (directory) (file minus extension)
* e.g. constGen C:\...\sql FieldType
*/
public class SentVia extends AbstractEnumerated
{
public static final EnumeratedFactory FACTORY_SentVia = new SentViaFactory();
public static final SentVia EMAIL = new SentVia ("EMAIL", "EMAIL", "Email", false);
public static final SentVia SMS = new SentVia ("SMS", "SMS", "SMS", false);
public static final SentVia ON_APP = new SentVia ("ON_APP", "ON_APP", "On App", false);
private static final SentVia[] allSentVias =
new SentVia[] { EMAIL,SMS,ON_APP};
private static SentVia[] getAllSentVias ()
{
return allSentVias;
}
private SentVia (String name, String value, String description, boolean disabled)
{
super (name, value, description, disabled);
}
public static final Comparator COMPARE_BY_POSITION = new CompareEnumByPosition (allSentVias);
static
{
defineAdditionalData ();
}
public boolean isEqual (SentVia other)
{
return this.name.equals (other.name);
}
public Enumeration getAllInstances ()
{
return SentVia.getAll ();
}
private Object readResolve() throws java.io.ObjectStreamException
{
return SentVia.forName (this.name);
}
public EnumeratedFactory getFactory ()
{
return FACTORY_SentVia;
}
public static SentVia forName (String name)
{
if (name == null) { return null; }
SentVia[] all = getAllSentVias();
int enumIndex = AbstractEnumerated.getIndexForName (all, name);
return all[enumIndex];
}
public static SentVia forValue (String value)
{
if (value == null) { return null; }
SentVia[] all = getAllSentVias();
int enumIndex = AbstractEnumerated.getIndexForValue (getAllSentVias (), value);
return all[enumIndex];
}
public static java.util.Enumeration getAll ()
{
return AbstractEnumerated.getAll (getAllSentVias());
}
public static SentVia[] getSentViaArray ()
{
return (SentVia[])getAllSentVias().clone ();
}
public static void defineAdditionalData ()
{
}
static class SentViaFactory implements EnumeratedFactory
{
public AbstractEnumerated getForName (String name)
{
return SentVia.forName (name);
}
public AbstractEnumerated getForValue (String name)
{
return SentVia.forValue (name);
}
public Enumeration getAll ()
{
return SentVia.getAll ();
}
}
public Map getAdditionalAttributes ()
{
Map attribs = new HashMap ();
return attribs;
}
public static class SentViaPipeLineFactory<From, Me extends SentVia> extends AbstractEnumerated.EnumPipeLine<From, Me>
{
public <Prev> SentViaPipeLineFactory (PipeLine<From, Prev> pipeLine, Pipe<Prev, Me> nextPipe)
{
super (pipeLine, nextPipe);
}
public SentViaPipeLineFactory (From seed)
{
super(seed);
}
public SentViaPipeLineFactory (Collection<From> seed)
{
super(seed);
}
public PipeLine<From, ? extends Object> to(String name)
{
return super.to(name);
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<ROOT>
<CONSTANT package="performa.orm.types" name="SentVia">
<VALUE name="EMAIL" description="Email"/>
<VALUE name="SMS" description="SMS"/>
<VALUE name="ON_APP" description="On App"/>
</CONSTANT>
</ROOT>
\ No newline at end of file
package performa.orm.types;
import java.util.*;
import oneit.utils.*;
import oneit.utils.transform.*;
/**
* This class was generated using constGen.bat.
* DO NOT MODIFY THIS CODE.
* Edit the associated .xml file, and regenerate this file
* constGen (directory) (file minus extension)
* e.g. constGen C:\...\sql FieldType
*/
public class StageType extends AbstractEnumerated
{
public static final EnumeratedFactory FACTORY_StageType = new StageTypeFactory();
public static final StageType POST_INGEST = new StageType ("POST_INGEST", "POST_INGEST", "Post Ingest", false);
public static final StageType INCOMPLETE = new StageType ("INCOMPLETE", "INCOMPLETE", "Incomplete", false);
public static final StageType REFERENCE_CHECK = new StageType ("REFERENCE_CHECK", "REFERENCE_CHECK", "Reference Check", false);
public static final StageType SCREENING_CHECK = new StageType ("SCREENING_CHECK", "SCREENING_CHECK", "Screening Check", false);
public static final StageType VIDEO_INTERVIEW = new StageType ("VIDEO_INTERVIEW", "VIDEO_INTERVIEW", "Video Interview", false);
public static final StageType INTERVIEW = new StageType ("INTERVIEW", "INTERVIEW", "Interview", false);
public static final StageType REQUIREMENT_FIT = new StageType ("REQUIREMENT_FIT", "REQUIREMENT_FIT", "Requirement Fit", false);
public static final StageType CULTURE_FIT = new StageType ("CULTURE_FIT", "CULTURE_FIT", "Culture Fit", false);
public static final StageType ROLE_FIT = new StageType ("ROLE_FIT", "ROLE_FIT", "Role Fit", false);
public static final StageType DIVERSITY = new StageType ("DIVERSITY", "DIVERSITY", "Diversity", false);
public static final StageType SUCCESSFULL = new StageType ("SUCCESSFULL", "SUCCESSFULL", "Successfull", false);
public static final StageType UNSUITABLE = new StageType ("UNSUITABLE", "UNSUITABLE", "Unsuitable", false);
public static final StageType WITHDREW = new StageType ("WITHDREW", "WITHDREW", "Withdrew", false);
private static final StageType[] allStageTypes =
new StageType[] { POST_INGEST,INCOMPLETE,REFERENCE_CHECK,SCREENING_CHECK,VIDEO_INTERVIEW,INTERVIEW,REQUIREMENT_FIT,CULTURE_FIT,ROLE_FIT,DIVERSITY,SUCCESSFULL,UNSUITABLE,WITHDREW};
private static StageType[] getAllStageTypes ()
{
return allStageTypes;
}
private transient Boolean IsPreStage;
private transient Boolean IsPostStage;
private StageType (String name, String value, String description, boolean disabled)
{
super (name, value, description, disabled);
}
public Boolean getIsPreStage()
{
return IsPreStage;
}
public Boolean getIsPostStage()
{
return IsPostStage;
}
public static final Comparator COMPARE_BY_POSITION = new CompareEnumByPosition (allStageTypes);
static
{
defineAdditionalData ();
}
public boolean isEqual (StageType other)
{
return this.name.equals (other.name);
}
public Enumeration getAllInstances ()
{
return StageType.getAll ();
}
private Object readResolve() throws java.io.ObjectStreamException
{
return StageType.forName (this.name);
}
public EnumeratedFactory getFactory ()
{
return FACTORY_StageType;
}
public static StageType forName (String name)
{
if (name == null) { return null; }
StageType[] all = getAllStageTypes();
int enumIndex = AbstractEnumerated.getIndexForName (all, name);
return all[enumIndex];
}
public static StageType forValue (String value)
{
if (value == null) { return null; }
StageType[] all = getAllStageTypes();
int enumIndex = AbstractEnumerated.getIndexForValue (getAllStageTypes (), value);
return all[enumIndex];
}
public static java.util.Enumeration getAll ()
{
return AbstractEnumerated.getAll (getAllStageTypes());
}
public static StageType[] getStageTypeArray ()
{
return (StageType[])getAllStageTypes().clone ();
}
public static void defineAdditionalData ()
{
POST_INGEST.IsPreStage = Boolean.TRUE;
POST_INGEST.IsPostStage = Boolean.FALSE;
INCOMPLETE.IsPreStage = Boolean.TRUE;
INCOMPLETE.IsPostStage = Boolean.FALSE;
REFERENCE_CHECK.IsPreStage = Boolean.FALSE;
REFERENCE_CHECK.IsPostStage = Boolean.FALSE;
SCREENING_CHECK.IsPreStage = Boolean.FALSE;
SCREENING_CHECK.IsPostStage = Boolean.FALSE;
VIDEO_INTERVIEW.IsPreStage = Boolean.FALSE;
VIDEO_INTERVIEW.IsPostStage = Boolean.FALSE;
INTERVIEW.IsPreStage = Boolean.FALSE;
INTERVIEW.IsPostStage = Boolean.FALSE;
REQUIREMENT_FIT.IsPreStage = Boolean.FALSE;
REQUIREMENT_FIT.IsPostStage = Boolean.FALSE;
CULTURE_FIT.IsPreStage = Boolean.FALSE;
CULTURE_FIT.IsPostStage = Boolean.FALSE;
ROLE_FIT.IsPreStage = Boolean.FALSE;
ROLE_FIT.IsPostStage = Boolean.FALSE;
DIVERSITY.IsPreStage = Boolean.FALSE;
DIVERSITY.IsPostStage = Boolean.FALSE;
SUCCESSFULL.IsPreStage = Boolean.FALSE;
SUCCESSFULL.IsPostStage = Boolean.TRUE;
UNSUITABLE.IsPreStage = Boolean.FALSE;
UNSUITABLE.IsPostStage = Boolean.TRUE;
WITHDREW.IsPreStage = Boolean.FALSE;
WITHDREW.IsPostStage = Boolean.TRUE;
}
static class StageTypeFactory implements EnumeratedFactory
{
public AbstractEnumerated getForName (String name)
{
return StageType.forName (name);
}
public AbstractEnumerated getForValue (String name)
{
return StageType.forValue (name);
}
public Enumeration getAll ()
{
return StageType.getAll ();
}
}
public Map getAdditionalAttributes ()
{
Map attribs = new HashMap ();
attribs.put ("IsPreStage", ArrayFormatter.toObject(getIsPreStage()));
attribs.put ("IsPostStage", ArrayFormatter.toObject(getIsPostStage()));
return attribs;
}
public static class StageTypePipeLineFactory<From, Me extends StageType> extends AbstractEnumerated.EnumPipeLine<From, Me>
{
public <Prev> StageTypePipeLineFactory (PipeLine<From, Prev> pipeLine, Pipe<Prev, Me> nextPipe)
{
super (pipeLine, nextPipe);
}
public StageTypePipeLineFactory (From seed)
{
super(seed);
}
public StageTypePipeLineFactory (Collection<From> seed)
{
super(seed);
}
public PipeLine<From, ? extends Object> to(String name)
{
if (name.equals ("IsPreStage"))
{
return toIsPreStage ();
}
if (name.equals ("IsPostStage"))
{
return toIsPostStage ();
}
return super.to(name);
}
public PipeLine<From, Boolean> toIsPreStage () { return pipe(new EnumAttributePipe<Me, Boolean>("IsPreStage")); }
public PipeLine<From, Boolean> toIsPostStage () { return pipe(new EnumAttributePipe<Me, Boolean>("IsPostStage")); }
}
}
<?xml version="1.0" encoding="UTF-8"?>
<ROOT>
<CONSTANT package="performa.orm.types" name="StageType">
<DATA name="IsPreStage" type="Boolean"/>
<DATA name="IsPostStage" type="Boolean"/>
<VALUE name="POST_INGEST" description="Post Ingest" IsPreStage="Boolean.TRUE" IsPostStage="Boolean.FALSE"/>
<VALUE name="INCOMPLETE" description="Incomplete" IsPreStage="Boolean.TRUE" IsPostStage="Boolean.FALSE"/>
<VALUE name="REFERENCE_CHECK" description="Reference Check" IsPreStage="Boolean.FALSE" IsPostStage="Boolean.FALSE"/>
<VALUE name="SCREENING_CHECK" description="Screening Check" IsPreStage="Boolean.FALSE" IsPostStage="Boolean.FALSE"/>
<VALUE name="VIDEO_INTERVIEW" description="Video Interview" IsPreStage="Boolean.FALSE" IsPostStage="Boolean.FALSE"/>
<VALUE name="INTERVIEW" description="Interview" IsPreStage="Boolean.FALSE" IsPostStage="Boolean.FALSE"/>
<VALUE name="REQUIREMENT_FIT" description="Requirement Fit" IsPreStage="Boolean.FALSE" IsPostStage="Boolean.FALSE"/>
<VALUE name="CULTURE_FIT" description="Culture Fit" IsPreStage="Boolean.FALSE" IsPostStage="Boolean.FALSE"/>
<VALUE name="ROLE_FIT" description="Role Fit" IsPreStage="Boolean.FALSE" IsPostStage="Boolean.FALSE"/>
<VALUE name="DIVERSITY" description="Diversity" IsPreStage="Boolean.FALSE" IsPostStage="Boolean.FALSE"/>
<VALUE name="SUCCESSFULL" description="Successfull" IsPreStage="Boolean.FALSE" IsPostStage="Boolean.TRUE"/>
<VALUE name="UNSUITABLE" description="Unsuitable" IsPreStage="Boolean.FALSE" IsPostStage="Boolean.TRUE"/>
<VALUE name="WITHDREW" description="Withdrew" IsPreStage="Boolean.FALSE" IsPostStage="Boolean.TRUE"/>
</CONSTANT>
</ROOT>
\ No newline at end of file
package performa.orm.types;
import java.util.*;
import oneit.utils.*;
import oneit.utils.transform.*;
/**
* This class was generated using constGen.bat.
* DO NOT MODIFY THIS CODE.
* Edit the associated .xml file, and regenerate this file
* constGen (directory) (file minus extension)
* e.g. constGen C:\...\sql FieldType
*/
public class TemplateType extends AbstractEnumerated
{
public static final EnumeratedFactory FACTORY_TemplateType = new TemplateTypeFactory();
public static final TemplateType EMAIL = new TemplateType ("EMAIL", "EMAIL", "Email", false);
public static final TemplateType SMS = new TemplateType ("SMS", "SMS", "SMS", false);
private static final TemplateType[] allTemplateTypes =
new TemplateType[] { EMAIL,SMS};
private static TemplateType[] getAllTemplateTypes ()
{
return allTemplateTypes;
}
private TemplateType (String name, String value, String description, boolean disabled)
{
super (name, value, description, disabled);
}
public static final Comparator COMPARE_BY_POSITION = new CompareEnumByPosition (allTemplateTypes);
static
{
defineAdditionalData ();
}
public boolean isEqual (TemplateType other)
{
return this.name.equals (other.name);
}
public Enumeration getAllInstances ()
{
return TemplateType.getAll ();
}
private Object readResolve() throws java.io.ObjectStreamException
{
return TemplateType.forName (this.name);
}
public EnumeratedFactory getFactory ()
{
return FACTORY_TemplateType;
}
public static TemplateType forName (String name)
{
if (name == null) { return null; }
TemplateType[] all = getAllTemplateTypes();
int enumIndex = AbstractEnumerated.getIndexForName (all, name);
return all[enumIndex];
}
public static TemplateType forValue (String value)
{
if (value == null) { return null; }
TemplateType[] all = getAllTemplateTypes();
int enumIndex = AbstractEnumerated.getIndexForValue (getAllTemplateTypes (), value);
return all[enumIndex];
}
public static java.util.Enumeration getAll ()
{
return AbstractEnumerated.getAll (getAllTemplateTypes());
}
public static TemplateType[] getTemplateTypeArray ()
{
return (TemplateType[])getAllTemplateTypes().clone ();
}
public static void defineAdditionalData ()
{
}
static class TemplateTypeFactory implements EnumeratedFactory
{
public AbstractEnumerated getForName (String name)
{
return TemplateType.forName (name);
}
public AbstractEnumerated getForValue (String name)
{
return TemplateType.forValue (name);
}
public Enumeration getAll ()
{
return TemplateType.getAll ();
}
}
public Map getAdditionalAttributes ()
{
Map attribs = new HashMap ();
return attribs;
}
public static class TemplateTypePipeLineFactory<From, Me extends TemplateType> extends AbstractEnumerated.EnumPipeLine<From, Me>
{
public <Prev> TemplateTypePipeLineFactory (PipeLine<From, Prev> pipeLine, Pipe<Prev, Me> nextPipe)
{
super (pipeLine, nextPipe);
}
public TemplateTypePipeLineFactory (From seed)
{
super(seed);
}
public TemplateTypePipeLineFactory (Collection<From> seed)
{
super(seed);
}
public PipeLine<From, ? extends Object> to(String name)
{
return super.to(name);
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<ROOT>
<CONSTANT package="performa.orm.types" name="TemplateType">
<VALUE name="EMAIL" description="Email"/>
<VALUE name="SMS" description="SMS"/>
</CONSTANT>
</ROOT>
\ No newline at end of file
......@@ -191,7 +191,7 @@ public class PerformaEmailFetcher implements Runnable, InitialisationParticipant
return;
}
Message[] messages;
javax.mail.Message[] messages;
SearchTerm searchTerm = getSearchTerm();
if(searchTerm == null)
......@@ -205,7 +205,7 @@ public class PerformaEmailFetcher implements Runnable, InitialisationParticipant
LogMgr.log(LOG, LogLevel.PROCESSING1, "Number of messages to be processed in ", folder.getName(), ": ", messages.length);
for(Message message : messages)
for(javax.mail.Message message : messages)
{
processMessage(message, uidFolder, messageIDs);
}
......@@ -224,7 +224,7 @@ public class PerformaEmailFetcher implements Runnable, InitialisationParticipant
return null;
}
public static void processMessage(Message message, UIDFolder uidFolder, final Set<String> messageIDs)
public static void processMessage(javax.mail.Message message, UIDFolder uidFolder, final Set<String> messageIDs)
{
LogMgr.log(LOG, LogLevel.PROCESSING2 , "processMessage called");
......@@ -570,7 +570,7 @@ public class PerformaEmailFetcher implements Runnable, InitialisationParticipant
return strPerson.replace("via SEEK", "").trim();
}
private static List<FileBinaryContent> getAttachments(Message message) throws IOException, MessagingException
private static List<FileBinaryContent> getAttachments(javax.mail.Message message) throws IOException, MessagingException
{
List<FileBinaryContent> contents = new ArrayList<>();
......
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