Commit e1456be0 by Nilu

workflow related changes

parent 16e8f2df
<?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</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="String" nullable="false" length="100"/>
<column name="sort_order" type="Long" nullable="false"/>
<column name="application_status" type="String" nullable="false" length="200"/>
<column name="job_id" type="Long" length="11" nullable="false"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_work_flow" indexName="idx_tl_work_flow_job_id" isUnique="false"><column name="job_id"/></NODE>
</NODE></OBJECTS>
\ No newline at end of file
-- DROP TABLE tl_work_flow;
CREATE TABLE tl_work_flow (
object_id int NOT NULL ,
object_last_updated_date datetime DEFAULT getdate() NOT NULL ,
object_created_date datetime DEFAULT getdate() NOT NULL
,
name varchar(100) NOT NULL,
sort_order numeric(12) NOT NULL,
application_status varchar(200) NOT NULL,
job_id numeric(12) NOT NULL
);
ALTER TABLE tl_work_flow ADD
CONSTRAINT PK_tl_work_flow PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_work_flow_job_id
ON tl_work_flow (job_id);
-- DROP TABLE tl_work_flow;
CREATE TABLE tl_work_flow (
object_id number(12) NOT NULL ,
object_last_updated_date date DEFAULT SYSDATE NOT NULL ,
object_created_date date DEFAULT SYSDATE NOT NULL
,
name varchar2(100) NOT NULL,
sort_order number(12) NOT NULL,
application_status varchar2(200) NOT NULL,
job_id number(12) NOT NULL
);
ALTER TABLE tl_work_flow ADD
CONSTRAINT PK_tl_work_flow PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_work_flow_job_id
ON tl_work_flow (job_id);
-- @AutoRun
-- drop table tl_work_flow;
CREATE TABLE tl_work_flow (
object_id numeric(12) NOT NULL ,
object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
object_created_date timestamp DEFAULT NOW() NOT NULL
,
name varchar(100) NOT NULL,
sort_order numeric(12) NOT NULL,
application_status varchar(200) NOT NULL,
job_id numeric(12) NOT NULL
);
ALTER TABLE tl_work_flow ADD
CONSTRAINT pk_tl_work_flow PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_work_flow_job_id
ON tl_work_flow (job_id);
...@@ -99,6 +99,8 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -99,6 +99,8 @@ public abstract class BaseJob extends BaseBusinessClass
public static final String BACKREF_AssessmentCriterias = ""; public static final String BACKREF_AssessmentCriterias = "";
public static final String MULTIPLEREFERENCE_CultureCriterias = "CultureCriterias"; public static final String MULTIPLEREFERENCE_CultureCriterias = "CultureCriterias";
public static final String BACKREF_CultureCriterias = ""; public static final String BACKREF_CultureCriterias = "";
public static final String MULTIPLEREFERENCE_WorkFlows = "WorkFlows";
public static final String BACKREF_WorkFlows = "";
// Static constants corresponding to searches // Static constants corresponding to searches
public static final String SEARCH_All = "All"; public static final String SEARCH_All = "All";
...@@ -206,6 +208,7 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -206,6 +208,7 @@ public abstract class BaseJob extends BaseBusinessClass
private MultipleAssociation<Job, JobApplication> _JobApplications; private MultipleAssociation<Job, JobApplication> _JobApplications;
private MultipleAssociation<Job, AssessmentCriteria> _AssessmentCriterias; private MultipleAssociation<Job, AssessmentCriteria> _AssessmentCriterias;
private MultipleAssociation<Job, CultureCriteria> _CultureCriterias; private MultipleAssociation<Job, CultureCriteria> _CultureCriterias;
private MultipleAssociation<Job, WorkFlow> _WorkFlows;
// Map of maps of metadata // Map of maps of metadata
...@@ -263,6 +266,7 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -263,6 +266,7 @@ public abstract class BaseJob extends BaseBusinessClass
String tmp_JobApplications = JobApplication.BACKREF_Job; String tmp_JobApplications = JobApplication.BACKREF_Job;
String tmp_AssessmentCriterias = AssessmentCriteria.BACKREF_Job; String tmp_AssessmentCriterias = AssessmentCriteria.BACKREF_Job;
String tmp_CultureCriterias = CultureCriteria.BACKREF_Job; String tmp_CultureCriterias = CultureCriteria.BACKREF_Job;
String tmp_WorkFlows = WorkFlow.BACKREF_Job;
String tmp_Client = Client.BACKREF_Jobs; String tmp_Client = Client.BACKREF_Jobs;
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping")); Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
...@@ -270,6 +274,7 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -270,6 +274,7 @@ public abstract class BaseJob extends BaseBusinessClass
setupAssocMetaData_JobApplications(); setupAssocMetaData_JobApplications();
setupAssocMetaData_AssessmentCriterias(); setupAssocMetaData_AssessmentCriterias();
setupAssocMetaData_CultureCriterias(); setupAssocMetaData_CultureCriterias();
setupAssocMetaData_WorkFlows();
setupAssocMetaData_AssessmentTemplate(); setupAssocMetaData_AssessmentTemplate();
setupAssocMetaData_CultureTemplate(); setupAssocMetaData_CultureTemplate();
setupAssocMetaData_JobTemplate(); setupAssocMetaData_JobTemplate();
...@@ -375,6 +380,20 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -375,6 +380,20 @@ public abstract class BaseJob extends BaseBusinessClass
// Meta Info setup // Meta Info setup
private static void setupAssocMetaData_WorkFlows()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "Job");
metaInfo.put ("name", "WorkFlows");
metaInfo.put ("type", "WorkFlow");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Job.WorkFlows:", metaInfo);
ATTRIBUTES_METADATA_Job.put (MULTIPLEREFERENCE_WorkFlows, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static void setupAssocMetaData_AssessmentTemplate() private static void setupAssocMetaData_AssessmentTemplate()
{ {
Map metaInfo = new HashMap (); Map metaInfo = new HashMap ();
...@@ -1307,6 +1326,7 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -1307,6 +1326,7 @@ public abstract class BaseJob extends BaseBusinessClass
_JobApplications = new MultipleAssociation<Job, JobApplication> (this, MULTIPLEREFERENCE_JobApplications, JobApplication.SINGLEREFERENCE_Job, JobApplication.REFERENCE_JobApplication); _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); _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); _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);
} }
...@@ -1329,6 +1349,7 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -1329,6 +1349,7 @@ public abstract class BaseJob extends BaseBusinessClass
_JobApplications = new MultipleAssociation<Job, JobApplication> (this, MULTIPLEREFERENCE_JobApplications, JobApplication.SINGLEREFERENCE_Job, JobApplication.REFERENCE_JobApplication); _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); _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); _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; return this;
...@@ -6324,6 +6345,8 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -6324,6 +6345,8 @@ public abstract class BaseJob extends BaseBusinessClass
result.add("CultureCriterias"); result.add("CultureCriterias");
result.add("WorkFlows");
return result; return result;
} }
...@@ -6350,6 +6373,11 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -6350,6 +6373,11 @@ public abstract class BaseJob extends BaseBusinessClass
return CultureCriteria.REFERENCE_CultureCriteria ; return CultureCriteria.REFERENCE_CultureCriteria ;
} }
if (MULTIPLEREFERENCE_WorkFlows.equals(attribName))
{
return WorkFlow.REFERENCE_WorkFlow ;
}
return super.getMultiAssocReferenceInstance(attribName); return super.getMultiAssocReferenceInstance(attribName);
} }
...@@ -6373,6 +6401,11 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -6373,6 +6401,11 @@ public abstract class BaseJob extends BaseBusinessClass
return CultureCriteria.SINGLEREFERENCE_Job ; return CultureCriteria.SINGLEREFERENCE_Job ;
} }
if (MULTIPLEREFERENCE_WorkFlows.equals(attribName))
{
return WorkFlow.SINGLEREFERENCE_Job ;
}
return super.getMultiAssocBackReference(attribName); return super.getMultiAssocBackReference(attribName);
} }
...@@ -6399,6 +6432,11 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -6399,6 +6432,11 @@ public abstract class BaseJob extends BaseBusinessClass
return this.getCultureCriteriasCount(); return this.getCultureCriteriasCount();
} }
if (MULTIPLEREFERENCE_WorkFlows.equals(attribName))
{
return this.getWorkFlowsCount();
}
return super.getMultiAssocCount(attribName); return super.getMultiAssocCount(attribName);
} }
...@@ -6425,6 +6463,11 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -6425,6 +6463,11 @@ public abstract class BaseJob extends BaseBusinessClass
return this.getCultureCriteriasAt(index); return this.getCultureCriteriasAt(index);
} }
if (MULTIPLEREFERENCE_WorkFlows.equals(attribName))
{
return this.getWorkFlowsAt(index);
}
return super.getMultiAssocAt(attribName, index); return super.getMultiAssocAt(attribName, index);
} }
...@@ -6457,6 +6500,13 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -6457,6 +6500,13 @@ public abstract class BaseJob extends BaseBusinessClass
return; return;
} }
if (MULTIPLEREFERENCE_WorkFlows.equals(attribName))
{
addToWorkFlows((WorkFlow)newElement);
return;
}
super.addToMultiAssoc(attribName, newElement); super.addToMultiAssoc(attribName, newElement);
} }
...@@ -6488,6 +6538,13 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -6488,6 +6538,13 @@ public abstract class BaseJob extends BaseBusinessClass
return; return;
} }
if (MULTIPLEREFERENCE_WorkFlows.equals(attribName))
{
removeFromWorkFlows((WorkFlow)oldElement);
return;
}
super.removeFromMultiAssoc(attribName, oldElement); super.removeFromMultiAssoc(attribName, oldElement);
} }
...@@ -6514,6 +6571,12 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -6514,6 +6571,12 @@ public abstract class BaseJob extends BaseBusinessClass
return; return;
} }
if (MULTIPLEREFERENCE_WorkFlows.equals(attribName))
{
_WorkFlows.__loadAssociation (elements);
return;
}
super.__loadMultiAssoc(attribName, elements); super.__loadMultiAssoc(attribName, elements);
} }
...@@ -6537,6 +6600,11 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -6537,6 +6600,11 @@ public abstract class BaseJob extends BaseBusinessClass
return _CultureCriterias.isLoaded (); return _CultureCriterias.isLoaded ();
} }
if (MULTIPLEREFERENCE_WorkFlows.equals(attribName))
{
return _WorkFlows.isLoaded ();
}
return super.__isMultiAssocLoaded(attribName); return super.__isMultiAssocLoaded(attribName);
} }
...@@ -6750,6 +6818,75 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -6750,6 +6818,75 @@ public abstract class BaseJob extends BaseBusinessClass
return _CultureCriterias.getSet (); return _CultureCriterias.getSet ();
} }
public FieldWriteability getWriteability_WorkFlows ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
public int getWorkFlowsCount () throws StorageException
{
assertValid();
return _WorkFlows.getReferencedObjectsCount ();
}
public void addToWorkFlows (WorkFlow newElement) throws StorageException
{
if (_WorkFlows.wouldAddChange (newElement))
{
assertValid();
Debug.assertion (getWriteability_WorkFlows () != FieldWriteability.FALSE, "MultiAssoc WorkFlows is not writeable (add)");
_WorkFlows.appendElement (newElement);
try
{
if (newElement.getJob () != this)
{
newElement.setJob ((Job)(this));
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
}
}
public void removeFromWorkFlows (WorkFlow elementToRemove) throws StorageException
{
if (_WorkFlows.wouldRemoveChange (elementToRemove))
{
assertValid();
Debug.assertion (getWriteability_WorkFlows () != FieldWriteability.FALSE, "MultiAssoc WorkFlows is not writeable (remove)");
_WorkFlows.removeElement (elementToRemove);
try
{
if (elementToRemove.getJob () != null)
{
elementToRemove.setJob (null);
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
}
}
public WorkFlow getWorkFlowsAt (int index) throws StorageException
{
return (WorkFlow)(_WorkFlows.getElementAt (index));
}
public SortedSet<WorkFlow> getWorkFlowsSet () throws StorageException
{
return _WorkFlows.getSet ();
}
public void onDelete () public void onDelete ()
...@@ -6788,6 +6925,12 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -6788,6 +6925,12 @@ public abstract class BaseJob extends BaseBusinessClass
referenced.setJob(null); referenced.setJob(null);
} }
for(WorkFlow referenced : CollectionUtils.reverse(getWorkFlowsSet()))
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null Job from ", getObjectID (), " to ", referenced.getObjectID ());
referenced.setJob(null);
}
} }
catch (Exception e) catch (Exception e)
{ {
...@@ -7253,6 +7396,7 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -7253,6 +7396,7 @@ public abstract class BaseJob extends BaseBusinessClass
_JobApplications.copyFrom (sourceJob._JobApplications, linkToGhosts); _JobApplications.copyFrom (sourceJob._JobApplications, linkToGhosts);
_AssessmentCriterias.copyFrom (sourceJob._AssessmentCriterias, linkToGhosts); _AssessmentCriterias.copyFrom (sourceJob._AssessmentCriterias, linkToGhosts);
_CultureCriterias.copyFrom (sourceJob._CultureCriterias, linkToGhosts); _CultureCriterias.copyFrom (sourceJob._CultureCriterias, linkToGhosts);
_WorkFlows.copyFrom (sourceJob._WorkFlows, linkToGhosts);
} }
} }
...@@ -7324,6 +7468,7 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -7324,6 +7468,7 @@ public abstract class BaseJob extends BaseBusinessClass
_JobApplications.readExternalData(vals.get(MULTIPLEREFERENCE_JobApplications)); _JobApplications.readExternalData(vals.get(MULTIPLEREFERENCE_JobApplications));
_AssessmentCriterias.readExternalData(vals.get(MULTIPLEREFERENCE_AssessmentCriterias)); _AssessmentCriterias.readExternalData(vals.get(MULTIPLEREFERENCE_AssessmentCriterias));
_CultureCriterias.readExternalData(vals.get(MULTIPLEREFERENCE_CultureCriterias)); _CultureCriterias.readExternalData(vals.get(MULTIPLEREFERENCE_CultureCriterias));
_WorkFlows.readExternalData(vals.get(MULTIPLEREFERENCE_WorkFlows));
} }
...@@ -7386,6 +7531,7 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -7386,6 +7531,7 @@ public abstract class BaseJob extends BaseBusinessClass
vals.put (MULTIPLEREFERENCE_JobApplications, _JobApplications.writeExternalData()); vals.put (MULTIPLEREFERENCE_JobApplications, _JobApplications.writeExternalData());
vals.put (MULTIPLEREFERENCE_AssessmentCriterias, _AssessmentCriterias.writeExternalData()); vals.put (MULTIPLEREFERENCE_AssessmentCriterias, _AssessmentCriterias.writeExternalData());
vals.put (MULTIPLEREFERENCE_CultureCriterias, _CultureCriterias.writeExternalData()); vals.put (MULTIPLEREFERENCE_CultureCriterias, _CultureCriterias.writeExternalData());
vals.put (MULTIPLEREFERENCE_WorkFlows, _WorkFlows.writeExternalData());
} }
...@@ -7513,6 +7659,7 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -7513,6 +7659,7 @@ public abstract class BaseJob extends BaseBusinessClass
_JobApplications.compare (otherJob._JobApplications, listener); _JobApplications.compare (otherJob._JobApplications, listener);
_AssessmentCriterias.compare (otherJob._AssessmentCriterias, listener); _AssessmentCriterias.compare (otherJob._AssessmentCriterias, listener);
_CultureCriterias.compare (otherJob._CultureCriterias, listener); _CultureCriterias.compare (otherJob._CultureCriterias, listener);
_WorkFlows.compare (otherJob._WorkFlows, listener);
} }
} }
...@@ -7581,6 +7728,7 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -7581,6 +7728,7 @@ public abstract class BaseJob extends BaseBusinessClass
visitor.visitAssociation (_JobApplications); visitor.visitAssociation (_JobApplications);
visitor.visitAssociation (_AssessmentCriterias); visitor.visitAssociation (_AssessmentCriterias);
visitor.visitAssociation (_CultureCriterias); visitor.visitAssociation (_CultureCriterias);
visitor.visitAssociation (_WorkFlows);
} }
...@@ -7641,6 +7789,10 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -7641,6 +7789,10 @@ public abstract class BaseJob extends BaseBusinessClass
{ {
visitor.visit (_CultureCriterias); visitor.visit (_CultureCriterias);
} }
if (scope.includes (_WorkFlows))
{
visitor.visit (_WorkFlows);
}
} }
...@@ -9389,6 +9541,10 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -9389,6 +9541,10 @@ public abstract class BaseJob extends BaseBusinessClass
{ {
return getWriteability_CultureCriterias (); return getWriteability_CultureCriterias ();
} }
else if (fieldName.equals (MULTIPLEREFERENCE_WorkFlows))
{
return getWriteability_WorkFlows ();
}
else if (fieldName.equals (SINGLEREFERENCE_Level)) else if (fieldName.equals (SINGLEREFERENCE_Level))
{ {
return getWriteability_Level (); return getWriteability_Level ();
...@@ -10530,6 +10686,10 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -10530,6 +10686,10 @@ public abstract class BaseJob extends BaseBusinessClass
{ {
return toCultureCriterias (); return toCultureCriterias ();
} }
if (name.equals ("WorkFlows"))
{
return toWorkFlows ();
}
if (name.equals ("Email")) if (name.equals ("Email"))
{ {
return toEmail (); return toEmail ();
...@@ -10881,6 +11041,12 @@ public abstract class BaseJob extends BaseBusinessClass ...@@ -10881,6 +11041,12 @@ public abstract class BaseJob extends BaseBusinessClass
{ {
return CultureCriteria.REFERENCE_CultureCriteria.new CultureCriteriaPipeLineFactory<From, CultureCriteria> (this, new ORMMultiAssocPipe<Me, CultureCriteria>(MULTIPLEREFERENCE_CultureCriterias, filter)); return CultureCriteria.REFERENCE_CultureCriteria.new CultureCriteriaPipeLineFactory<From, CultureCriteria> (this, new ORMMultiAssocPipe<Me, CultureCriteria>(MULTIPLEREFERENCE_CultureCriterias, filter));
} }
public WorkFlow.WorkFlowPipeLineFactory<From, WorkFlow> toWorkFlows () { return toWorkFlows(Filter.ALL); }
public WorkFlow.WorkFlowPipeLineFactory<From, WorkFlow> toWorkFlows (Filter<WorkFlow> filter)
{
return WorkFlow.REFERENCE_WorkFlow.new WorkFlowPipeLineFactory<From, WorkFlow> (this, new ORMMultiAssocPipe<Me, WorkFlow>(MULTIPLEREFERENCE_WorkFlows, filter));
}
} }
...@@ -11188,6 +11354,23 @@ class DummyJob extends Job ...@@ -11188,6 +11354,23 @@ class DummyJob extends Job
return new TreeSet(); return new TreeSet();
} }
public int getWorkFlowsCount () throws StorageException
{
return 0;
}
public WorkFlow getWorkFlowsAt (int index) throws StorageException
{
throw new RuntimeException ("No elements in a dummy object in association WorkFlows");
}
public SortedSet getWorkFlowsSet () throws StorageException
{
return new TreeSet();
}
} }
...@@ -59,6 +59,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -59,6 +59,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass
// Static constants corresponding to searches // Static constants corresponding to searches
public static final String SEARCH_All = "All"; public static final String SEARCH_All = "All";
public static final String SEARCH_CandidateJob = "CandidateJob"; public static final String SEARCH_CandidateJob = "CandidateJob";
public static final String SEARCH_Details = "Details";
// Static constants corresponding to attribute helpers // Static constants corresponding to attribute helpers
...@@ -2498,6 +2499,94 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -2498,6 +2499,94 @@ public abstract class BaseJobApplication extends BaseBusinessClass
.search (transaction); .search (transaction);
} }
public static SearchDetails SearchByDetails () { return new SearchDetails (); }
public static class SearchDetails extends SearchObject<JobApplication>
{
public SearchDetails byName (String Name)
{
by ("Name", Name);
return this;
}
public SearchDetails andObjectID (QueryFilter<Long> filter)
{
filter.addFilter (context, "tl_job_application.object_id", FIELD_ObjectID);
return this;
}
public SearchDetails andObjectCreated (QueryFilter<Date> filter)
{
filter.addFilter (context, "tl_job_application.object_created_date", FIELD_ObjectCreated);
return this;
}
public SearchDetails andObjectLastModified (QueryFilter<Date> filter)
{
filter.addFilter (context, "tl_job_application.object_last_updated_date", FIELD_ObjectLastModified);
return this;
}
public SearchDetails andCV (QueryFilter<BinaryContent> filter)
{
filter.addFilter (context, "tl_job_application.cv", "CV");
return this;
}
public SearchDetails andApplicationStatus (QueryFilter<ApplicationStatus> filter)
{
filter.addFilter (context, "tl_job_application.application_status", "ApplicationStatus");
return this;
}
public SearchDetails andSubmittedDate (QueryFilter<Date> filter)
{
filter.addFilter (context, "tl_job_application.submitted_date", "SubmittedDate");
return this;
}
public SearchDetails andCandidate (QueryFilter<Candidate> filter)
{
filter.addFilter (context, "tl_job_application.candidate_id", "Candidate");
return this;
}
public SearchDetails andJob (QueryFilter<Job> filter)
{
filter.addFilter (context, "tl_job_application.job_id", "Job");
return this;
}
public JobApplication[]
search (ObjectTransaction transaction) throws StorageException
{
BaseBusinessClass[] results = super.search (transaction, REFERENCE_JobApplication, SEARCH_Details, criteria);
Set<JobApplication> typedResults = new LinkedHashSet <JobApplication> ();
for (BaseBusinessClass bbcResult : results)
{
JobApplication aResult = (JobApplication)bbcResult;
typedResults.add (aResult);
}
return ObjstoreUtils.removeDeleted(transaction, typedResults).toArray (new JobApplication[0]);
}
}
public static JobApplication[]
searchDetails (ObjectTransaction transaction, String Name) throws StorageException
{
return SearchByDetails ()
.byName (Name)
.search (transaction);
}
public Object getAttribute (String attribName) public Object getAttribute (String attribName)
......
/*
* IMPORTANT!!!! XSL Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2 rev3 [oneit.objstore.BusinessObjectTemplate.xsl]
*
* Version: 1.0
* Vendor: Apache Software Foundation (Xalan XSLTC)
* Vendor URL: http://xml.apache.org/xalan-j
*/
package performa.orm;
import java.io.*;
import java.util.*;
import oneit.appservices.config.*;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.objstore.assocs.*;
import oneit.objstore.attributes.*;
import oneit.objstore.rdbms.filters.*;
import oneit.objstore.parser.*;
import oneit.objstore.validator.*;
import oneit.objstore.utils.*;
import oneit.utils.*;
import oneit.utils.filter.Filter;
import oneit.utils.transform.*;
import oneit.utils.parsers.FieldException;
import performa.orm.types.*;
public abstract class BaseWorkFlow extends BaseBusinessClass
{
// Reference instance for the object
public static final WorkFlow REFERENCE_WorkFlow = new WorkFlow ();
// Reference instance for the object
public static final WorkFlow DUMMY_WorkFlow = new DummyWorkFlow ();
// Static constants corresponding to field names
public static final String FIELD_Name = "Name";
public static final String FIELD_SortOrder = "SortOrder";
public static final String FIELD_ApplicationStatus = "ApplicationStatus";
public static final String SINGLEREFERENCE_Job = "Job";
public static final String BACKREF_Job = "";
// Static constants corresponding to searches
public static final String SEARCH_All = "All";
// Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper<WorkFlow> HELPER_Name = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<WorkFlow> HELPER_SortOrder = DefaultAttributeHelper.INSTANCE;
private static final EnumeratedAttributeHelper<WorkFlow, ApplicationStatus> HELPER_ApplicationStatus = new EnumeratedAttributeHelper<WorkFlow, ApplicationStatus> (ApplicationStatus.FACTORY_ApplicationStatus);
// Private attributes corresponding to business object data
private String _Name;
private Integer _SortOrder;
private ApplicationStatus _ApplicationStatus;
// Private attributes corresponding to single references
private SingleAssociation<WorkFlow, Job> _Job;
// Private attributes corresponding to multiple references
// Map of maps of metadata
private static final Map ATTRIBUTES_METADATA_WorkFlow = new HashMap ();
// Arrays of validators for each attribute
private static final AttributeValidator[] FIELD_Name_Validators;
private static final AttributeValidator[] FIELD_SortOrder_Validators;
private static final AttributeValidator[] FIELD_ApplicationStatus_Validators;
// Arrays of behaviour decorators
private static final WorkFlowBehaviourDecorator[] WorkFlow_BehaviourDecorators;
static
{
try
{
String tmp_Job = Job.BACKREF_WorkFlows;
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
setupAssocMetaData_Job();
FIELD_Name_Validators = (AttributeValidator[])setupAttribMetaData_Name(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_SortOrder_Validators = (AttributeValidator[])setupAttribMetaData_SortOrder(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_ApplicationStatus_Validators = (AttributeValidator[])setupAttribMetaData_ApplicationStatus(validatorMapping).toArray (new AttributeValidator[0]);
REFERENCE_WorkFlow.initialiseReference ();
DUMMY_WorkFlow.initialiseReference ();
WorkFlow_BehaviourDecorators = BaseBusinessClass.getBBCBehaviours(WorkFlow.class).toArray(new WorkFlowBehaviourDecorator[0]);
}
catch (RuntimeException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR1, e, "Error initialising");
throw e;
}
}
// Meta Info setup
private static void setupAssocMetaData_Job()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "WorkFlows");
metaInfo.put ("dbcol", "job_id");
metaInfo.put ("mandatory", "true");
metaInfo.put ("name", "Job");
metaInfo.put ("type", "Job");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for WorkFlow.Job:", metaInfo);
ATTRIBUTES_METADATA_WorkFlow.put (SINGLEREFERENCE_Job, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static List setupAttribMetaData_Name(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "name");
metaInfo.put ("length", "100");
metaInfo.put ("mandatory", "true");
metaInfo.put ("name", "Name");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for WorkFlow.Name:", metaInfo);
ATTRIBUTES_METADATA_WorkFlow.put (FIELD_Name, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(WorkFlow.class, "Name", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for WorkFlow.Name:", validators);
return validators;
}
// Meta Info setup
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");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for WorkFlow.SortOrder:", metaInfo);
ATTRIBUTES_METADATA_WorkFlow.put (FIELD_SortOrder, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(WorkFlow.class, "SortOrder", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for WorkFlow.SortOrder:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_ApplicationStatus(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("attribHelper", "EnumeratedAttributeHelper");
metaInfo.put ("dbcol", "application_status");
metaInfo.put ("mandatory", "true");
metaInfo.put ("name", "ApplicationStatus");
metaInfo.put ("type", "ApplicationStatus");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for WorkFlow.ApplicationStatus:", metaInfo);
ATTRIBUTES_METADATA_WorkFlow.put (FIELD_ApplicationStatus, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(WorkFlow.class, "ApplicationStatus", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for WorkFlow.ApplicationStatus:", validators);
return validators;
}
// END OF STATIC METADATA DEFINITION
// This constructor should not be called
protected BaseWorkFlow ()
{
}
protected BBCBehaviourDecorator[] getBehaviours()
{
return WorkFlow_BehaviourDecorators;
}
// Initialise the attributes
protected void _initialiseNewObjAttributes (ObjectTransaction transaction) throws StorageException
{
super._initialiseNewObjAttributes (transaction);
_Name = (String)(HELPER_Name.initialise (_Name));
_SortOrder = (Integer)(HELPER_SortOrder.initialise (_SortOrder));
_ApplicationStatus = (ApplicationStatus)(HELPER_ApplicationStatus.initialise (_ApplicationStatus));
}
// Initialise the associations
protected void _initialiseAssociations ()
{
super._initialiseAssociations ();
_Job = new SingleAssociation<WorkFlow, Job> (this, SINGLEREFERENCE_Job, Job.MULTIPLEREFERENCE_WorkFlows, Job.REFERENCE_Job, "tl_work_flow");
}
// Initialise the associations
protected BaseBusinessClass initialiseReference ()
{
super.initialiseReference ();
_Job = new SingleAssociation<WorkFlow, Job> (this, SINGLEREFERENCE_Job, Job.MULTIPLEREFERENCE_WorkFlows, Job.REFERENCE_Job, "tl_work_flow");
return this;
}
/**
* Get the attribute Name
*/
public String getName ()
{
assertValid();
String valToReturn = _Name;
for (WorkFlowBehaviourDecorator bhd : WorkFlow_BehaviourDecorators)
{
valToReturn = bhd.getName ((WorkFlow)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
{
boolean oldAndNewIdentical = HELPER_Name.compare (_Name, newName);
try
{
for (WorkFlowBehaviourDecorator bhd : WorkFlow_BehaviourDecorators)
{
newName = bhd.setName ((WorkFlow)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_WorkFlow.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 (getWriteability_Name () != FieldWriteability.FALSE, "Field Name is not writeable");
preNameChange (newName);
markFieldChange (FIELD_Name);
_Name = newName;
postFieldChange (FIELD_Name);
postNameChange ();
}
}
/**
* Get the attribute SortOrder
*/
public Integer getSortOrder ()
{
assertValid();
Integer valToReturn = _SortOrder;
for (WorkFlowBehaviourDecorator bhd : WorkFlow_BehaviourDecorators)
{
valToReturn = bhd.getSortOrder ((WorkFlow)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
{
boolean oldAndNewIdentical = HELPER_SortOrder.compare (_SortOrder, newSortOrder);
try
{
for (WorkFlowBehaviourDecorator bhd : WorkFlow_BehaviourDecorators)
{
newSortOrder = bhd.setSortOrder ((WorkFlow)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_WorkFlow.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 (getWriteability_SortOrder () != FieldWriteability.FALSE, "Field SortOrder is not writeable");
preSortOrderChange (newSortOrder);
markFieldChange (FIELD_SortOrder);
_SortOrder = newSortOrder;
postFieldChange (FIELD_SortOrder);
postSortOrderChange ();
}
}
/**
* Get the attribute ApplicationStatus
*/
public ApplicationStatus getApplicationStatus ()
{
assertValid();
ApplicationStatus valToReturn = _ApplicationStatus;
for (WorkFlowBehaviourDecorator bhd : WorkFlow_BehaviourDecorators)
{
valToReturn = bhd.getApplicationStatus ((WorkFlow)this, valToReturn);
}
return valToReturn;
}
/**
* Called prior to the attribute changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preApplicationStatusChange (ApplicationStatus newApplicationStatus) throws FieldException
{
}
/**
* Called after the attribute changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postApplicationStatusChange () throws FieldException
{
}
public FieldWriteability getWriteability_ApplicationStatus ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute ApplicationStatus. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setApplicationStatus (ApplicationStatus newApplicationStatus) throws FieldException
{
boolean oldAndNewIdentical = HELPER_ApplicationStatus.compare (_ApplicationStatus, newApplicationStatus);
try
{
for (WorkFlowBehaviourDecorator bhd : WorkFlow_BehaviourDecorators)
{
newApplicationStatus = bhd.setApplicationStatus ((WorkFlow)this, newApplicationStatus);
oldAndNewIdentical = HELPER_ApplicationStatus.compare (_ApplicationStatus, newApplicationStatus);
}
BusinessObjectParser.assertFieldCondition (newApplicationStatus != null, this, FIELD_ApplicationStatus, "mandatory");
if (FIELD_ApplicationStatus_Validators.length > 0)
{
Object newApplicationStatusObj = HELPER_ApplicationStatus.toObject (newApplicationStatus);
if (newApplicationStatusObj != null)
{
int loopMax = FIELD_ApplicationStatus_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_WorkFlow.get (FIELD_ApplicationStatus);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_ApplicationStatus_Validators[v].checkAttribute (this, FIELD_ApplicationStatus, metadata, newApplicationStatusObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_ApplicationStatus () != FieldWriteability.FALSE, "Field ApplicationStatus is not writeable");
preApplicationStatusChange (newApplicationStatus);
markFieldChange (FIELD_ApplicationStatus);
_ApplicationStatus = newApplicationStatus;
postFieldChange (FIELD_ApplicationStatus);
postApplicationStatusChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getSingleAssocs()
{
List result = super.getSingleAssocs ();
result.add("Job");
return result;
}
public BaseBusinessClass getSingleAssocReferenceInstance (String assocName)
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Job))
{
return _Job.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_Job))
{
return Job.MULTIPLEREFERENCE_WorkFlows ;
}
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_Job))
{
return getJob ();
}
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_Job))
{
return getJob (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_Job))
{
return getJobID ();
}
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_Job))
{
setJob ((Job)(newValue));
}
else
{
super.setSingleAssoc (assocName, newValue);
}
}
/**
* Get the reference Job
*/
public Job getJob () throws StorageException
{
assertValid();
try
{
return (Job)(_Job.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in WorkFlow:", this.getObjectID (), ", was trying to get Job:", getJobID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _Job.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Job getJob (Get getType) throws StorageException
{
assertValid();
return _Job.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getJobID ()
{
assertValid();
if (_Job == null)
{
return null;
}
else
{
return _Job.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 preJobChange (Job newJob) 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 postJobChange () throws FieldException
{
}
public FieldWriteability getWriteability_Job ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference Job. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setJob (Job newJob) throws StorageException, FieldException
{
BusinessObjectParser.assertFieldCondition (newJob != null, this, SINGLEREFERENCE_Job, "mandatory");
if (_Job.wouldReferencedChange (newJob))
{
assertValid();
Debug.assertion (getWriteability_Job () != FieldWriteability.FALSE, "Assoc Job is not writeable");
preJobChange (newJob);
Job oldJob = getJob ();
if (oldJob != null)
{
// This is to stop validation from triggering when we are removed
_Job.set (null);
oldJob.removeFromWorkFlows ((WorkFlow)(this));
}
_Job.set (newJob);
if (newJob != null)
{
newJob.addToWorkFlows ((WorkFlow)(this));
}
postJobChange ();
}
}
/**
* 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 (_Job.isLoaded () || getTransaction ().isObjectLoaded (_Job.getReferencedType (), getJobID ()))
{
Job referenced = getJob ();
if (referenced != null)
{
// Stop the callback
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null WorkFlows from ", getObjectID (), " to ", referenced.getObjectID ());
_Job.set (null);
referenced.removeFromWorkFlows ((WorkFlow)this);
}
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
super.onDelete ();
}
public WorkFlow newInstance ()
{
return new WorkFlow ();
}
public WorkFlow referenceInstance ()
{
return REFERENCE_WorkFlow;
}
public WorkFlow getInTransaction (ObjectTransaction t) throws StorageException
{
return getWorkFlowByID (t, getObjectID());
}
public BaseBusinessClass dummyInstance ()
{
return DUMMY_WorkFlow;
}
public String getBaseSetName ()
{
return "tl_work_flow";
}
/**
* 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_flowPSet = allSets.getPersistentSet (myID, "tl_work_flow", myPSetStatus);
tl_work_flowPSet.setAttrib (FIELD_ObjectID, myID);
tl_work_flowPSet.setAttrib (FIELD_Name, HELPER_Name.toObject (_Name)); //
tl_work_flowPSet.setAttrib (FIELD_SortOrder, HELPER_SortOrder.toObject (_SortOrder)); //
tl_work_flowPSet.setAttrib (FIELD_ApplicationStatus, HELPER_ApplicationStatus.toObject (_ApplicationStatus)); //
_Job.getPersistentSets (allSets);
}
/**
* Sets the objects state based on Persistent sets.
*/
public void setFromPersistentSets (ObjectID objectID, PersistentSetCollection allSets)
{
super.setFromPersistentSets (objectID, allSets);
PersistentSet tl_work_flowPSet = allSets.getPersistentSet (objectID, "tl_work_flow");
_Name = (String)(HELPER_Name.fromObject (_Name, tl_work_flowPSet.getAttrib (FIELD_Name))); //
_SortOrder = (Integer)(HELPER_SortOrder.fromObject (_SortOrder, tl_work_flowPSet.getAttrib (FIELD_SortOrder))); //
_ApplicationStatus = (ApplicationStatus)(HELPER_ApplicationStatus.fromObject (_ApplicationStatus, tl_work_flowPSet.getAttrib (FIELD_ApplicationStatus))); //
_Job.setFromPersistentSets (objectID, allSets);
}
public void setAttributesFrom (BaseBusinessClass other, MultiException e)
{
super.setAttributesFrom (other, e);
if (other instanceof WorkFlow)
{
WorkFlow otherWorkFlow = (WorkFlow)other;
try
{
setName (otherWorkFlow.getName ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setSortOrder (otherWorkFlow.getSortOrder ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setApplicationStatus (otherWorkFlow.getApplicationStatus ());
}
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 BaseWorkFlow)
{
BaseWorkFlow sourceWorkFlow = (BaseWorkFlow)(source);
_Name = sourceWorkFlow._Name;
_SortOrder = sourceWorkFlow._SortOrder;
_ApplicationStatus = sourceWorkFlow._ApplicationStatus;
}
}
/**
* 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 BaseWorkFlow)
{
BaseWorkFlow sourceWorkFlow = (BaseWorkFlow)(source);
_Job.copyFrom (sourceWorkFlow._Job, 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 BaseWorkFlow)
{
BaseWorkFlow sourceWorkFlow = (BaseWorkFlow)(source);
}
}
public void validate (ValidationContext context)
{
super.validate (context);
context.check (getJobID() != null, this, SINGLEREFERENCE_Job, "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))); //
_SortOrder = (Integer)(HELPER_SortOrder.readExternal (_SortOrder, vals.get(FIELD_SortOrder))); //
_ApplicationStatus = (ApplicationStatus)(HELPER_ApplicationStatus.readExternal (_ApplicationStatus, vals.get(FIELD_ApplicationStatus))); //
_Job.readExternalData(vals.get(SINGLEREFERENCE_Job));
}
/**
* 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_SortOrder, HELPER_SortOrder.writeExternal (_SortOrder));
vals.put (FIELD_ApplicationStatus, HELPER_ApplicationStatus.writeExternal (_ApplicationStatus));
vals.put (SINGLEREFERENCE_Job, _Job.writeExternalData());
}
public void compare (BaseBusinessClass other, AttributeChangeListener listener) throws StorageException
{
super.compare (other, listener);
if (other instanceof BaseWorkFlow)
{
BaseWorkFlow otherWorkFlow = (BaseWorkFlow)(other);
if (!HELPER_Name.compare(this._Name, otherWorkFlow._Name))
{
listener.notifyFieldChange(this, other, FIELD_Name, HELPER_Name.toObject(this._Name), HELPER_Name.toObject(otherWorkFlow._Name));
}
if (!HELPER_SortOrder.compare(this._SortOrder, otherWorkFlow._SortOrder))
{
listener.notifyFieldChange(this, other, FIELD_SortOrder, HELPER_SortOrder.toObject(this._SortOrder), HELPER_SortOrder.toObject(otherWorkFlow._SortOrder));
}
if (!HELPER_ApplicationStatus.compare(this._ApplicationStatus, otherWorkFlow._ApplicationStatus))
{
listener.notifyFieldChange(this, other, FIELD_ApplicationStatus, HELPER_ApplicationStatus.toObject(this._ApplicationStatus), HELPER_ApplicationStatus.toObject(otherWorkFlow._ApplicationStatus));
}
// Compare single assocs
_Job.compare (otherWorkFlow._Job, 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_Name, HELPER_Name.toObject(getName()));
visitor.visitField(this, FIELD_SortOrder, HELPER_SortOrder.toObject(getSortOrder()));
visitor.visitField(this, FIELD_ApplicationStatus, HELPER_ApplicationStatus.toObject(getApplicationStatus()));
visitor.visitAssociation (_Job);
}
public void visitAssociations (AssociationVisitor visitor, AssociatedScope scope) throws StorageException
{
super.visitAssociations (visitor, scope);
if (scope.includes (_Job))
{
visitor.visit (_Job);
}
}
public static WorkFlow createWorkFlow (ObjectTransaction transaction) throws StorageException
{
WorkFlow result = new WorkFlow ();
result.initialiseNewObject (transaction);
return result;
}
public static WorkFlow getWorkFlowByID (ObjectTransaction transaction, Long objectID) throws StorageException
{
return (WorkFlow)(transaction.getObjectByID (REFERENCE_WorkFlow, 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_SortOrder))
{
return filter.matches (getSortOrder ());
}
else if (attribName.equals (FIELD_ApplicationStatus))
{
return filter.matches (getApplicationStatus ());
}
else if (attribName.equals (SINGLEREFERENCE_Job))
{
return filter.matches (getJob ());
}
else
{
return super.testFilter (attribName, filter);
}
}
public static SearchAll SearchByAll () { return new SearchAll (); }
public static class SearchAll extends SearchObject<WorkFlow>
{
public SearchAll andObjectID (QueryFilter<Long> filter)
{
filter.addFilter (context, "tl_work_flow.object_id", FIELD_ObjectID);
return this;
}
public SearchAll andObjectCreated (QueryFilter<Date> filter)
{
filter.addFilter (context, "tl_work_flow.object_created_date", FIELD_ObjectCreated);
return this;
}
public SearchAll andObjectLastModified (QueryFilter<Date> filter)
{
filter.addFilter (context, "tl_work_flow.object_last_updated_date", FIELD_ObjectLastModified);
return this;
}
public SearchAll andName (QueryFilter<String> filter)
{
filter.addFilter (context, "tl_work_flow.name", "Name");
return this;
}
public SearchAll andSortOrder (QueryFilter<Integer> filter)
{
filter.addFilter (context, "tl_work_flow.sort_order", "SortOrder");
return this;
}
public SearchAll andApplicationStatus (QueryFilter<ApplicationStatus> filter)
{
filter.addFilter (context, "tl_work_flow.application_status", "ApplicationStatus");
return this;
}
public SearchAll andJob (QueryFilter<Job> filter)
{
filter.addFilter (context, "tl_work_flow.job_id", "Job");
return this;
}
public WorkFlow[]
search (ObjectTransaction transaction) throws StorageException
{
BaseBusinessClass[] results = super.search (transaction, REFERENCE_WorkFlow, SEARCH_All, criteria);
Set<WorkFlow> typedResults = new LinkedHashSet <WorkFlow> ();
for (BaseBusinessClass bbcResult : results)
{
WorkFlow aResult = (WorkFlow)bbcResult;
typedResults.add (aResult);
}
return ObjstoreUtils.removeDeleted(transaction, typedResults).toArray (new WorkFlow[0]);
}
}
public static WorkFlow[]
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_SortOrder))
{
return HELPER_SortOrder.toObject (getSortOrder ());
}
else if (attribName.equals (FIELD_ApplicationStatus))
{
return HELPER_ApplicationStatus.toObject (getApplicationStatus ());
}
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_SortOrder))
{
return HELPER_SortOrder;
}
else if (attribName.equals (FIELD_ApplicationStatus))
{
return HELPER_ApplicationStatus;
}
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_SortOrder))
{
setSortOrder ((Integer)(HELPER_SortOrder.fromObject (_SortOrder, attribValue)));
}
else if (attribName.equals (FIELD_ApplicationStatus))
{
setApplicationStatus ((ApplicationStatus)(HELPER_ApplicationStatus.fromObject (_ApplicationStatus, attribValue)));
}
else
{
super.setAttribute (attribName, attribValue);
}
}
public boolean isWriteable (String fieldName)
{
return getWriteable (fieldName) == FieldWriteability.TRUE;
}
public FieldWriteability getWriteable (String fieldName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (fieldName.equals (FIELD_Name))
{
return getWriteability_Name ();
}
else if (fieldName.equals (FIELD_SortOrder))
{
return getWriteability_SortOrder ();
}
else if (fieldName.equals (FIELD_ApplicationStatus))
{
return getWriteability_ApplicationStatus ();
}
else if (fieldName.equals (SINGLEREFERENCE_Job))
{
return getWriteability_Job ();
}
else
{
return super.getWriteable (fieldName);
}
}
public void putUnwriteable (Set<String> fields)
{
if (getWriteability_Name () != FieldWriteability.TRUE)
{
fields.add (FIELD_Name);
}
if (getWriteability_SortOrder () != FieldWriteability.TRUE)
{
fields.add (FIELD_SortOrder);
}
if (getWriteability_ApplicationStatus () != FieldWriteability.TRUE)
{
fields.add (FIELD_ApplicationStatus);
}
super.putUnwriteable (fields);
}
public List<AbstractAttribute> getAttributes ()
{
List result = super.getAttributes ();
result.add(HELPER_Name.getAttribObject (getClass (), _Name, true, FIELD_Name));
result.add(HELPER_SortOrder.getAttribObject (getClass (), _SortOrder, true, FIELD_SortOrder));
result.add(HELPER_ApplicationStatus.getAttribObject (getClass (), _ApplicationStatus, true, FIELD_ApplicationStatus));
return result;
}
public Map getAttributeMetadata (String attribute)
{
if (ATTRIBUTES_METADATA_WorkFlow.containsKey (attribute))
{
return (Map)ATTRIBUTES_METADATA_WorkFlow.get (attribute);
}
else
{
return super.getAttributeMetadata (attribute);
}
}
public Object getAttributeMetadata (String attribute, String metadata)
{
if (ATTRIBUTES_METADATA_WorkFlow.containsKey (attribute))
{
return ((Map)ATTRIBUTES_METADATA_WorkFlow.get (attribute)).get(metadata);
}
else
{
return super.getAttributeMetadata (attribute, metadata);
}
}
public void preCommit (boolean willBeStored) throws Exception
{
super.preCommit(willBeStored);
if(willBeStored)
{
}
}
public oneit.servlets.objstore.binary.BinaryContentHandler getBinaryContentHandler(String attribName)
{
return super.getBinaryContentHandler(attribName);
}
public static class WorkFlowBehaviourDecorator extends BaseBusinessClass.BBCBehaviourDecorator<WorkFlow>
{
/**
* Get the attribute Name
*/
public String getName (WorkFlow obj, String original)
{
return original;
}
/**
* Change the value set for attribute Name.
* May modify the field beforehand
* Occurs before validation.
*/
public String setName (WorkFlow obj, String newName) throws FieldException
{
return newName;
}
/**
* Get the attribute SortOrder
*/
public Integer getSortOrder (WorkFlow obj, Integer original)
{
return original;
}
/**
* Change the value set for attribute SortOrder.
* May modify the field beforehand
* Occurs before validation.
*/
public Integer setSortOrder (WorkFlow obj, Integer newSortOrder) throws FieldException
{
return newSortOrder;
}
/**
* Get the attribute ApplicationStatus
*/
public ApplicationStatus getApplicationStatus (WorkFlow obj, ApplicationStatus original)
{
return original;
}
/**
* Change the value set for attribute ApplicationStatus.
* May modify the field beforehand
* Occurs before validation.
*/
public ApplicationStatus setApplicationStatus (WorkFlow obj, ApplicationStatus newApplicationStatus) throws FieldException
{
return newApplicationStatus;
}
}
public ORMPipeLine pipes()
{
return new WorkFlowPipeLineFactory<WorkFlow, WorkFlow> ((WorkFlow)this);
}
/**
* Use this instead of pipes() to get rid of type casting.
*/
public WorkFlowPipeLineFactory<WorkFlow, WorkFlow> pipelineWorkFlow()
{
return (WorkFlowPipeLineFactory<WorkFlow, WorkFlow>) pipes();
}
public static WorkFlowPipeLineFactory<WorkFlow, WorkFlow> pipesWorkFlow(Collection<WorkFlow> items)
{
return REFERENCE_WorkFlow.new WorkFlowPipeLineFactory<WorkFlow, WorkFlow> (items);
}
public static WorkFlowPipeLineFactory<WorkFlow, WorkFlow> pipesWorkFlow(WorkFlow[] _items)
{
return pipesWorkFlow(Arrays.asList (_items));
}
public static WorkFlowPipeLineFactory<WorkFlow, WorkFlow> pipesWorkFlow()
{
return pipesWorkFlow((Collection)null);
}
public class WorkFlowPipeLineFactory<From extends BaseBusinessClass, Me extends WorkFlow> extends BaseBusinessClass.ORMPipeLine<From, Me>
{
public <Prev> WorkFlowPipeLineFactory (PipeLine<From, Prev> pipeLine, Pipe<Prev, Me> nextPipe)
{
super (pipeLine, nextPipe);
}
public WorkFlowPipeLineFactory (From seed)
{
super(seed);
}
public WorkFlowPipeLineFactory (Collection<From> seed)
{
super(seed);
}
public PipeLine<From, ? extends Object> to(String name)
{
if (name.equals ("Name"))
{
return toName ();
}
if (name.equals ("SortOrder"))
{
return toSortOrder ();
}
if (name.equals ("ApplicationStatus"))
{
return toApplicationStatus ();
}
if (name.equals ("Job"))
{
return toJob ();
}
return super.to(name);
}
public PipeLine<From, String> toName () { return pipe(new ORMAttributePipe<Me, String>(FIELD_Name)); }
public PipeLine<From, Integer> toSortOrder () { return pipe(new ORMAttributePipe<Me, Integer>(FIELD_SortOrder)); }
public PipeLine<From, ApplicationStatus> toApplicationStatus () { return pipe(new ORMAttributePipe<Me, ApplicationStatus>(FIELD_ApplicationStatus)); }
public Job.JobPipeLineFactory<From, Job> toJob () { return toJob (Filter.ALL); }
public Job.JobPipeLineFactory<From, Job> toJob (Filter<Job> filter)
{
return Job.REFERENCE_Job.new JobPipeLineFactory<From, Job> (this, new ORMSingleAssocPipe<Me, Job>(SINGLEREFERENCE_Job, filter));
}
}
public boolean isTransientAttrib(String attribName)
{
return super.isTransientAttrib(attribName);
}
public boolean isTransientSingleReference(String assocName)
{
return super.isTransientSingleReference(assocName);
}
}
class DummyWorkFlow extends WorkFlow
{
// Default constructor primarily to support Externalisable
public DummyWorkFlow()
{
super();
}
public void assertValid ()
{
}
public Job getJob () throws StorageException
{
return (Job)(Job.DUMMY_Job);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getJobID ()
{
return Job.DUMMY_Job.getObjectID();
}
}
...@@ -48,8 +48,24 @@ public class Job extends BaseJob ...@@ -48,8 +48,24 @@ public class Job extends BaseJob
cultureCriteria.setCultureElement(cultureElement); cultureCriteria.setCultureElement(cultureElement);
addToCultureCriterias(cultureCriteria); addToCultureCriterias(cultureCriteria);
} }
createWorkFlow(ApplicationStatus.DRAFT, 1);
createWorkFlow(ApplicationStatus.SUBMITTED, 2);
createWorkFlow(ApplicationStatus.SHORTLISTED, 3);
createWorkFlow(ApplicationStatus.UNSUITABLE, 4);
} }
public WorkFlow createWorkFlow(ApplicationStatus status, int sortOrder) throws FieldException
{
WorkFlow workFlow = WorkFlow.createWorkFlow(getTransaction());
workFlow.setName(status.getDescription());
workFlow.setApplicationStatus(status);
workFlow.setSortOrder(sortOrder);
addToWorkFlows(workFlow);
return workFlow;
}
public void initAttribs() throws BusinessException public void initAttribs() throws BusinessException
{ {
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
<MULTIPLEREFERENCE name="JobApplications" type="JobApplication" backreferenceName="Job" /> <MULTIPLEREFERENCE name="JobApplications" type="JobApplication" backreferenceName="Job" />
<MULTIPLEREFERENCE name="AssessmentCriterias" type="AssessmentCriteria" backreferenceName="Job" /> <MULTIPLEREFERENCE name="AssessmentCriterias" type="AssessmentCriteria" backreferenceName="Job" />
<MULTIPLEREFERENCE name="CultureCriterias" type="CultureCriteria" backreferenceName="Job" /> <MULTIPLEREFERENCE name="CultureCriterias" type="CultureCriteria" backreferenceName="Job" />
<MULTIPLEREFERENCE name="WorkFlows" type="WorkFlow" backreferenceName="Job" />
<TRANSIENT name="Email" type="String" validators="Email" /> <TRANSIENT name="Email" type="String" validators="Email" />
<TRANSIENT name="Password" type="String"/> <TRANSIENT name="Password" type="String"/>
......
...@@ -32,6 +32,21 @@ ...@@ -32,6 +32,21 @@
<PARAM name="Job" type="Job" transform="Job.getObjectID()" paramFilter="job_id = ${Job}" /> <PARAM name="Job" type="Job" transform="Job.getObjectID()" paramFilter="job_id = ${Job}" />
</SEARCH> </SEARCH>
<SEARCH type="Details" paramFilter="tl_job_application.object_id is not null" orderBy="tl_job_application.object_id">
<PARAM name="Name" type="String" transform=' "%" + Name + "%" '
paramFilter="tl_job_application.object_id IN (
SELECT tl_job_application.object_id
FROM tl_job_application
LEFT JOIN oneit_sec_user_extension ON oneit_sec_user_extension.object_id = tl_job_application.candidate_id
LEFT JOIN oneit_sec_user ON oneit_sec_user.object_id = oneit_sec_user_extension.user_id
WHERE
oneit_sec_user_extension.phone ILIKE ${Name} OR
oneit_sec_user.user_name ILIKE ${Name} OR
oneit_sec_user.first_name ILIKE ${Name} OR
oneit_sec_user.last_name ILIKE ${Name} OR
oneit_sec_user.email ILIKE ${Name})">
</PARAM>
</SEARCH>
</BUSINESSCLASS> </BUSINESSCLASS>
</ROOT> </ROOT>
\ No newline at end of file
...@@ -288,6 +288,10 @@ public class JobApplicationPersistenceMgr extends ObjectPersistenceMgr ...@@ -288,6 +288,10 @@ public class JobApplicationPersistenceMgr extends ObjectPersistenceMgr
{ {
throw new RuntimeException ("NOT implemented: executeSearchQueryCandidateJob"); throw new RuntimeException ("NOT implemented: executeSearchQueryCandidateJob");
} }
public ResultSet executeSearchQueryDetails (SQLManager sqlMgr, String Name) throws SQLException
{
throw new RuntimeException ("NOT implemented: executeSearchQueryDetails");
}
...@@ -499,6 +503,56 @@ public class JobApplicationPersistenceMgr extends ObjectPersistenceMgr ...@@ -499,6 +503,56 @@ public class JobApplicationPersistenceMgr extends ObjectPersistenceMgr
return results; return results;
} }
else if (searchType.equals (JobApplication.SEARCH_Details))
{
// Local scope for transformed variables
{
if (criteria.containsKey("Name"))
{
String Name = (String)(criteria.get("Name"));
criteria.put ("Name", "%" + Name + "%" );
}
}
String orderBy = " ORDER BY tl_job_application.object_id";
String tables = " ";
Set<String> joinTableSet = new HashSet<String>();
String filter;
Object[] searchParams; // paramFilter: tl_job_application.object_id is not null
String preFilter = "(tl_job_application.object_id is not null)"
+ " ";
if (criteria.containsKey("Name"))
{
preFilter += " AND (tl_job_application.object_id IN ( SELECT tl_job_application.object_id FROM tl_job_application LEFT JOIN oneit_sec_user_extension ON oneit_sec_user_extension.object_id = tl_job_application.candidate_id LEFT JOIN oneit_sec_user ON oneit_sec_user.object_id = oneit_sec_user_extension.user_id WHERE oneit_sec_user_extension.phone ILIKE ${Name} OR oneit_sec_user.user_name ILIKE ${Name} OR oneit_sec_user.first_name ILIKE ${Name} OR oneit_sec_user.last_name ILIKE ${Name} OR oneit_sec_user.email ILIKE ${Name})) ";
preFilter += "";
}
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_job_application " + tables + tableSetToSQL(joinTableSet) +
"WHERE " + SELECT_JOINS + " " + filter + orderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, maxRows, truncateExtra);
return results;
}
else else
{ {
......
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 WorkFlow extends BaseWorkFlow
{
private static final long serialVersionUID = 0L;
// This constructor should not be called
public WorkFlow ()
{
// 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="WorkFlow" package="performa.orm">
<IMPORT value="performa.orm.types.*"/>
<TABLE name="tl_work_flow" tablePrefix="object">
<ATTRIB name="Name" type="String" dbcol="name" mandatory="true" length="100"/>
<ATTRIB name="SortOrder" type="Integer" dbcol="sort_order" mandatory="true" />
<ATTRIB name="ApplicationStatus" type="ApplicationStatus" dbcol="application_status" mandatory="true" attribHelper="EnumeratedAttributeHelper"/>
<SINGLEREFERENCE name="Job" type="Job" dbcol="job_id" backreferenceName="WorkFlows" mandatory="true"/>
</TABLE>
<SEARCH type="All" paramFilter="tl_work_flow.object_id is not null" orderBy="tl_work_flow.sort_order">
</SEARCH>
</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 WorkFlowPersistenceMgr extends ObjectPersistenceMgr
{
private static final LoggingArea WorkFlowPersistence = LoggingArea.createLoggingArea(ObjectPersistenceMgr.OBJECT_PERSISTENCE, "WorkFlow");
// Private attributes corresponding to business object data
private String dummyName;
private Integer dummySortOrder;
private ApplicationStatus dummyApplicationStatus;
// Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper HELPER_Name = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_SortOrder = DefaultAttributeHelper.INSTANCE;
private static final EnumeratedAttributeHelper HELPER_ApplicationStatus = new EnumeratedAttributeHelper (ApplicationStatus.FACTORY_ApplicationStatus);
public WorkFlowPersistenceMgr ()
{
dummyName = (String)(HELPER_Name.initialise (dummyName));
dummySortOrder = (Integer)(HELPER_SortOrder.initialise (dummySortOrder));
dummyApplicationStatus = (ApplicationStatus)(HELPER_ApplicationStatus.initialise (dummyApplicationStatus));
}
private String SELECT_COLUMNS = "{PREFIX}tl_work_flow.object_id as id, {PREFIX}tl_work_flow.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_work_flow.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_work_flow.name, {PREFIX}tl_work_flow.sort_order, {PREFIX}tl_work_flow.application_status, {PREFIX}tl_work_flow.job_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, WorkFlow.REFERENCE_WorkFlow);
if (objectToReturn instanceof WorkFlow)
{
LogMgr.log (WorkFlowPersistence, 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 WorkFlow");
}
}
PersistentSet tl_work_flowPSet = allPSets.getPersistentSet(id, "tl_work_flow", PersistentSetStatus.FETCHED);
// Check for persistent sets already prefetched
if (false || !tl_work_flowPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!tl_work_flowPSet.containsAttrib(WorkFlow.FIELD_Name)||
!tl_work_flowPSet.containsAttrib(WorkFlow.FIELD_SortOrder)||
!tl_work_flowPSet.containsAttrib(WorkFlow.FIELD_ApplicationStatus)||
!tl_work_flowPSet.containsAttrib(WorkFlow.SINGLEREFERENCE_Job))
{
// We will need to retrieve it
idsToFetch.add (id.longValue());
}
else
{
LogMgr.log (WorkFlowPersistence, LogLevel.DEBUG2, "Persistent set preloaded id:", id);
/* Non Polymorphic */
WorkFlow result = new WorkFlow ();
result.setFromPersistentSets(id, allPSets);
context.addRetrievedObject(result);
results.add (result);
}
}
if (idsToFetch.size () > 0)
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_work_flow " +
"WHERE " + SELECT_JOINS + "{PREFIX}tl_work_flow.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 (WorkFlow.SINGLEREFERENCE_Job))
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_work_flow " +
"WHERE " + SELECT_JOINS + "job_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_flowPSet = allPSets.getPersistentSet(objectID, "tl_work_flow");
if (tl_work_flowPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_work_flowPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}tl_work_flow " +
"SET name = ?, sort_order = ?, application_status = ?, job_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE tl_work_flow.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_Name.getForSQL(dummyName, tl_work_flowPSet.getAttrib (WorkFlow.FIELD_Name))).listEntry (HELPER_SortOrder.getForSQL(dummySortOrder, tl_work_flowPSet.getAttrib (WorkFlow.FIELD_SortOrder))).listEntry (HELPER_ApplicationStatus.getForSQL(dummyApplicationStatus, tl_work_flowPSet.getAttrib (WorkFlow.FIELD_ApplicationStatus))).listEntry (SQLManager.CheckNull((Long)(tl_work_flowPSet.getAttrib (WorkFlow.SINGLEREFERENCE_Job)))).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 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", objectID.longID (), obj.getObjectLastModified (), d },
sqlMgr.getPortabilityServices ());
LogMgr.log (WorkFlowPersistence, LogLevel.BUSINESS1, errorMsg);
throw new ConcurrentUpdateConflictException (obj, "tl_work_flow");
}
else
{
String errorMsg = "Attempt to update nonexistent row in table:tl_work_flow for row:" + objectID + " objDate:" + obj.getObjectLastModified ();
LogMgr.log (WorkFlowPersistence, LogLevel.BUSINESS1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
tl_work_flowPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
else
{
LogMgr.log (WorkFlowPersistence, 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_flowPSet = allPSets.getPersistentSet(objectID, "tl_work_flow");
LogMgr.log (WorkFlowPersistence, LogLevel.DEBUG2, "Deleting:", objectID);
if (tl_work_flowPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_work_flowPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsDeleted = executeStatement (sqlMgr,
"DELETE " +
"FROM {PREFIX}tl_work_flow " +
"WHERE tl_work_flow.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 WHERE object_id = ?",
new Object[] { objectID.longID() });
if (r.next ())
{
throw new ConcurrentUpdateConflictException (obj, "tl_work_flow");
}
else
{
String errorMsg = "Attempt to delete nonexistent row in table:tl_work_flow for row:" + objectID;
LogMgr.log (WorkFlowPersistence, LogLevel.SYSTEMERROR1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
tl_work_flowPSet.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, WorkFlow> results = new LinkedHashMap ();
ResultSet r = executeQuery (sqlMgr, query, params);
while (r.next())
{
ThreadUtils.checkInterrupted ();
ObjectID objectID = new ObjectID (WorkFlow.REFERENCE_WorkFlow.getObjectIDSpace (), r.getLong ("id"));
WorkFlow 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, WorkFlow.REFERENCE_WorkFlow);
if (cachedElement instanceof WorkFlow)
{
LogMgr.log (WorkFlowPersistence, LogLevel.TRACE, "Cache hit for id:", objectID);
resultElement = (WorkFlow)cachedElement;
}
else
{
throw new StorageException ("Cache collision for id:" + objectID + " with object " + cachedElement + "while fetching a WorkFlow");
}
}
else
{
PersistentSet tl_work_flowPSet = allPSets.getPersistentSet(objectID, "tl_work_flow", PersistentSetStatus.FETCHED);
createPersistentSetFromRS(allPSets, r, objectID);
resultElement = new WorkFlow ();
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 (WorkFlowPersistence, 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 " + tables +
"WHERE " + SELECT_JOINS + " " + customParamFilter + customOrderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, null, false);
return results;
}
else if (searchType.equals (WorkFlow.SEARCH_All))
{
// Local scope for transformed variables
{
}
String orderBy = " ORDER BY tl_work_flow.sort_order";
String tables = " ";
Set<String> joinTableSet = new HashSet<String>();
String filter;
Object[] searchParams; // paramFilter: tl_work_flow.object_id is not null
String preFilter = "(tl_work_flow.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 " + 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_flowPSet = allPSets.getPersistentSet(objectID, "tl_work_flow", PersistentSetStatus.FETCHED);
// Object Modified
tl_work_flowPSet.setAttrib(BaseBusinessClass.FIELD_ObjectLastModified, r.getTimestamp ("LAST_UPDATED_DATE"));
// Object Created
tl_work_flowPSet.setAttrib(BaseBusinessClass.FIELD_ObjectCreated, r.getTimestamp ("CREATED_DATE"));
tl_work_flowPSet.setAttrib(WorkFlow.FIELD_Name, HELPER_Name.getFromRS(dummyName, r, "name"));
tl_work_flowPSet.setAttrib(WorkFlow.FIELD_SortOrder, HELPER_SortOrder.getFromRS(dummySortOrder, r, "sort_order"));
tl_work_flowPSet.setAttrib(WorkFlow.FIELD_ApplicationStatus, HELPER_ApplicationStatus.getFromRS(dummyApplicationStatus, r, "application_status"));
tl_work_flowPSet.setAttrib(WorkFlow.SINGLEREFERENCE_Job, r.getObject ("job_id"));
}
public void create(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet tl_work_flowPSet = allPSets.getPersistentSet(objectID, "tl_work_flow");
if (tl_work_flowPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_work_flowPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
executeStatement (sqlMgr,
"INSERT INTO {PREFIX}tl_work_flow " +
" (name, sort_order, application_status, job_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_flowPSet.getAttrib (WorkFlow.FIELD_Name))).listEntry (HELPER_SortOrder.getForSQL(dummySortOrder, tl_work_flowPSet.getAttrib (WorkFlow.FIELD_SortOrder))).listEntry (HELPER_ApplicationStatus.getForSQL(dummyApplicationStatus, tl_work_flowPSet.getAttrib (WorkFlow.FIELD_ApplicationStatus))) .listEntry (SQLManager.CheckNull((Long)(tl_work_flowPSet.getAttrib (WorkFlow.SINGLEREFERENCE_Job)))) .listEntry (objectID.longID ()).toList().toArray());
tl_work_flowPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
}
...@@ -20,16 +20,26 @@ public class ApplicationStatus extends AbstractEnumerated ...@@ -20,16 +20,26 @@ public class ApplicationStatus extends AbstractEnumerated
public static final EnumeratedFactory FACTORY_ApplicationStatus = new ApplicationStatusFactory(); public static final EnumeratedFactory FACTORY_ApplicationStatus = new ApplicationStatusFactory();
public static final ApplicationStatus DRAFT = new ApplicationStatus ("DRAFT", "DRAFT", "Draft", false); public static final ApplicationStatus DRAFT = new ApplicationStatus ("DRAFT", "DRAFT", "Incomplete", false);
public static final ApplicationStatus SUBMITTED = new ApplicationStatus ("SUBMITTED", "SUBMITTED", "Applicant", false); public static final ApplicationStatus SUBMITTED = new ApplicationStatus ("SUBMITTED", "SUBMITTED", "Applicant", false);
public static final ApplicationStatus SHORTLISTED = new ApplicationStatus ("SHORTLISTED", "SHORTLISTED", "Shortlisted", false); public static final ApplicationStatus SHORTLISTED = new ApplicationStatus ("SHORTLISTED", "SHORTLISTED", "Shortlisted", false);
public static final ApplicationStatus STATUS_4 = new ApplicationStatus ("STATUS_4", "STATUS_4", "", false);
public static final ApplicationStatus STATUS_5 = new ApplicationStatus ("STATUS_5", "STATUS_5", "", false);
public static final ApplicationStatus STATUS_6 = new ApplicationStatus ("STATUS_6", "STATUS_6", "", false);
public static final ApplicationStatus STATUS_7 = new ApplicationStatus ("STATUS_7", "STATUS_7", "", false);
public static final ApplicationStatus STATUS_8 = new ApplicationStatus ("STATUS_8", "STATUS_8", "", false);
public static final ApplicationStatus UNSUITABLE = new ApplicationStatus ("UNSUITABLE", "UNSUITABLE", "Unsuitable", false); public static final ApplicationStatus UNSUITABLE = new ApplicationStatus ("UNSUITABLE", "UNSUITABLE", "Unsuitable", false);
private static final ApplicationStatus[] allApplicationStatuss = private static final ApplicationStatus[] allApplicationStatuss =
new ApplicationStatus[] { DRAFT,SUBMITTED,SHORTLISTED,UNSUITABLE}; new ApplicationStatus[] { DRAFT,SUBMITTED,SHORTLISTED,STATUS_4,STATUS_5,STATUS_6,STATUS_7,STATUS_8,UNSUITABLE};
private static ApplicationStatus[] getAllApplicationStatuss () private static ApplicationStatus[] getAllApplicationStatuss ()
...@@ -37,11 +47,18 @@ public class ApplicationStatus extends AbstractEnumerated ...@@ -37,11 +47,18 @@ public class ApplicationStatus extends AbstractEnumerated
return allApplicationStatuss; return allApplicationStatuss;
} }
private transient Integer SortOrder;
private ApplicationStatus (String name, String value, String description, boolean disabled) private ApplicationStatus (String name, String value, String description, boolean disabled)
{ {
super (name, value, description, disabled); super (name, value, description, disabled);
} }
public Integer getSortOrder()
{
return SortOrder;
}
public static final Comparator COMPARE_BY_POSITION = new CompareEnumByPosition (allApplicationStatuss); public static final Comparator COMPARE_BY_POSITION = new CompareEnumByPosition (allApplicationStatuss);
...@@ -109,6 +126,15 @@ public class ApplicationStatus extends AbstractEnumerated ...@@ -109,6 +126,15 @@ public class ApplicationStatus extends AbstractEnumerated
public static void defineAdditionalData () public static void defineAdditionalData ()
{ {
DRAFT.SortOrder = 1;
SUBMITTED.SortOrder = 2;
SHORTLISTED.SortOrder = 3;
STATUS_4.SortOrder = 4;
STATUS_5.SortOrder = 5;
STATUS_6.SortOrder = 6;
STATUS_7.SortOrder = 7;
STATUS_8.SortOrder = 8;
UNSUITABLE.SortOrder = 9;
} }
...@@ -136,6 +162,7 @@ public class ApplicationStatus extends AbstractEnumerated ...@@ -136,6 +162,7 @@ public class ApplicationStatus extends AbstractEnumerated
{ {
Map attribs = new HashMap (); Map attribs = new HashMap ();
attribs.put ("SortOrder", ArrayFormatter.toObject(getSortOrder()));
return attribs; return attribs;
} }
......
...@@ -3,10 +3,17 @@ ...@@ -3,10 +3,17 @@
<ROOT> <ROOT>
<CONSTANT package="performa.orm.types" name="ApplicationStatus"> <CONSTANT package="performa.orm.types" name="ApplicationStatus">
<VALUE name="DRAFT" value="DRAFT" description="Draft"/> <DATA name="SortOrder" type="Integer"/>
<VALUE name="SUBMITTED" value="SUBMITTED" description="Applicant"/>
<VALUE name="SHORTLISTED" value="SHORTLISTED" description="Shortlisted"/> <VALUE name="DRAFT" value="DRAFT" description="Incomplete" SortOrder="1"/>
<VALUE name="UNSUITABLE" value="UNSUITABLE" description="Unsuitable"/> <VALUE name="SUBMITTED" value="SUBMITTED" description="Applicant" SortOrder="2"/>
<VALUE name="SHORTLISTED" value="SHORTLISTED" description="Shortlisted" SortOrder="3"/>
<VALUE name="STATUS_4" value="STATUS_4" description="" SortOrder="4"/>
<VALUE name="STATUS_5" value="STATUS_5" description="" SortOrder="5"/>
<VALUE name="STATUS_6" value="STATUS_6" description="" SortOrder="6"/>
<VALUE name="STATUS_7" value="STATUS_7" description="" SortOrder="7"/>
<VALUE name="STATUS_8" value="STATUS_8" description="" SortOrder="8"/>
<VALUE name="UNSUITABLE" value="UNSUITABLE" description="Unsuitable" SortOrder="9"/>
</CONSTANT> </CONSTANT>
</ROOT> </ROOT>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='http://www.oneit.com.au/schemas/5.2/BusinessObject.xsd'>
<BUSINESSCLASS name="SearchJob" package="performa.search" superclass="SearchExecutor" >
<IMPORT value="oneit.servlets.orm.*" />
<TABLE name="it_does_not_matter" tablePrefix="object" polymorphic="FALSE" >
<ATTRIB name="Details" type="String" dbcol="xxxx" />
</TABLE>
</BUSINESSCLASS>
</ROOT>
\ No newline at end of file
...@@ -614,4 +614,16 @@ public class Utils ...@@ -614,4 +614,16 @@ public class Utils
job.setShortenedURL(null); job.setShortenedURL(null);
job.setDraftLocation(null); job.setDraftLocation(null);
} }
public static ApplicationStatus getApplicationStatus(int sortOrder)
{
for(ApplicationStatus status : ApplicationStatus.getApplicationStatusArray())
{
if(status.getSortOrder() == sortOrder)
{
return status;
}
}
return null;
}
} }
\ No newline at end of file
...@@ -70,6 +70,10 @@ ...@@ -70,6 +70,10 @@
<INHERITS factory="Named" nodename="CoreORMAdminNoPriv"/> <INHERITS factory="Named" nodename="CoreORMAdminNoPriv"/>
</NODE> </NODE>
<NODE name="workflow_add_jsp" factory="Participant">
<INHERITS factory="Named" nodename="CoreORMAdminNoPriv"/>
</NODE>
<NODE name="signin_jsp" factory="Participant"> <NODE name="signin_jsp" factory="Participant">
<INHERITS factory="Named" nodename="CoreORMAdminNoPriv"/> <INHERITS factory="Named" nodename="CoreORMAdminNoPriv"/>
<FORM name="*.login" factory="Participant" class="performa.form.UserLoginFP"> <FORM name="*.login" factory="Participant" class="performa.form.UserLoginFP">
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
<% <%
Job job = (Job) process.getAttribute("Job"); Job job = (Job) process.getAttribute("Job");
SearchApplicant searchApplicant = (SearchApplicant) getData(request, "searchApplicant");
String currentPage = (String) getData(request, "currentPage"); String currentPage = (String) getData(request, "currentPage");
AppSortOption appSortOpt = (AppSortOption) getData(request, "sortOption"); AppSortOption appSortOpt = (AppSortOption) getData(request, "sortOption");
String tabNumber = (String) getData(request, "tabNumber"); String tabNumber = (String) getData(request, "tabNumber");
...@@ -38,6 +39,13 @@ ...@@ -38,6 +39,13 @@
function enableBulkEdit() { function enableBulkEdit() {
$(".bullk-app-process").prop("disabled",$('input[class=applicant]:checked').length===0); $(".bullk-app-process").prop("disabled",$('input[class=applicant]:checked').length===0);
} }
$('#searchText').keypress(function (e) {
if (e.which === 13) {
$('input[name = Search]').click();
return false;
}
});
</script> </script>
<div class="main-applicants-filter"> <div class="main-applicants-filter">
<div class="appli-list-shorting"> <div class="appli-list-shorting">
...@@ -93,7 +101,13 @@ ...@@ -93,7 +101,13 @@
--%> --%>
<% <%
} }
%>
<div class="shorting-dropdown">
<div class="order-label">Search Applicants</div>
<oneit:ormInput obj="<%= searchApplicant %>" type="text" attributeName="Details" cssClass="form-control search-input" id="searchText" />
</div>
<oneit:button value="Search" name="search" cssClass="btn btn-primary" style="display:none;"/>
<%
if(showOrderBy) if(showOrderBy)
{ {
%> %>
......
...@@ -37,6 +37,10 @@ ...@@ -37,6 +37,10 @@
<div class="officer-box"> <div class="officer-box">
<div class="officer-name"> <div class="officer-name">
<div class="chief-officer"> <div class="chief-officer">
<oneit:button name="gotoPage" value=" " skin="link"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", jobPage).toMap() %>" >
<img src="images/arrow-left-prev.svg" />
</oneit:button>
<% <%
BinaryContent logo = job.getLogo(); BinaryContent logo = job.getLogo();
...@@ -53,6 +57,14 @@ ...@@ -53,6 +57,14 @@
.mapEntry("procParams", CollectionUtils.mapEntry("Job", job).toMap()) .mapEntry("procParams", CollectionUtils.mapEntry("Job", job).toMap())
.toMap() %>"> .toMap() %>">
<oneit:toString value="<%= job.getJobTitle() %>" mode="EscapeHTML" /> <oneit:toString value="<%= job.getJobTitle() %>" mode="EscapeHTML" />
<%
if(job.getReferenceNumber() != null)
{
%>
&nbsp;(<oneit:toString value="<%= job.getReferenceNumber() %>" mode="EscapeHTML" />)
<%
}
%>
</oneit:button> </oneit:button>
</div> </div>
<div class="off-name"> <div class="off-name">
......
<%@ page extends="oneit.servlets.process.AJAXProcessJSP" %>
<%@ include file="/inc/stdimports50.jsp" %><%-- This is in cougar --%>
<%@ include file="/extensions/performa/inc/stdimports.jsp" %>
<%! protected String getName (ServletConfig config) { return "workflow_add_jsp"; } %>
<%
ORMProcessState process = (ORMProcessState)ProcessDecorator.getDefaultProcess(request);
ObjectTransaction objTran = process.getTransaction ();
Job job = (Job) process.getAttribute("Job");
int sortOrder = job.getWorkFlowsCount();
ApplicationStatus status = Utils.getApplicationStatus(sortOrder);
WorkFlow workflow = null;
if(job.getWorkFlowsCount() < 10 && status != null)
{
workflow = WorkFlow.createWorkFlow(objTran);
// workFlow.setName(status.getDescription());
workflow.setApplicationStatus(status);
workflow.setSortOrder(sortOrder);
job.addToWorkFlows(workflow);
}
%>
<oneit:form method="POST">
<oneit:evalBody buffer="<%= getBuffer(request) %>">
<div class="form-group row">
<div class="col-md-12">
<oneit:ormInput obj="<%= workflow %>" type="text" attributeName="Name" cssClass="form-control" />
</div>
</div>
</oneit:evalBody>
</oneit:form>
\ No newline at end of file
...@@ -32,9 +32,6 @@ ...@@ -32,9 +32,6 @@
$("button[name$='loadJobFromTemplate']").click(); $("button[name$='loadJobFromTemplate']").click();
}); });
// $(".occupation_content ul").css('width', $(".occupation_content").width()/4);
var popup_width = 1040; var popup_width = 1040;
new jBox('Modal', { new jBox('Modal', {
...@@ -47,10 +44,7 @@ ...@@ -47,10 +44,7 @@
onCreated : function(){ onCreated : function(){
$(".dyn-div").empty(); $(".dyn-div").empty();
$(".occupation_content_column").css("width", popup_width/4 ); $(".occupation_content_column").css("width", popup_width/4 );
} }
}); });
$(document).on("click",".occupation_content_column ul li",function(){ $(document).on("click",".occupation_content_column ul li",function(){
...@@ -78,8 +72,16 @@ ...@@ -78,8 +72,16 @@
}); });
});
function addWorkflow()
{
// var divID = "#" + criteria;
ajaxProcessAddJQ ("<%= request.getContextPath() %>/extensions/adminportal/inc/workflow_add.jsp", "#workflows", {}, function (theHTML_JQ) {
$("#workflows").append (theHTML_JQ);
}); });
}
</script> </script>
<oneit:form name="editJob" method="post" enctype="multipart/form-data"> <oneit:form name="editJob" method="post" enctype="multipart/form-data">
...@@ -304,7 +306,31 @@ ...@@ -304,7 +306,31 @@
Please define your applicant approval/refinement workflow and tabs below. We have nominated some defaults to help you get started. You are allowed up to 9 different steps, and can drag to re-order using the handle on the left. Please define your applicant approval/refinement workflow and tabs below. We have nominated some defaults to help you get started. You are allowed up to 9 different steps, and can drag to re-order using the handle on the left.
</div> </div>
</div> </div>
<div id="workflows">
<%
List<WorkFlow> sortedWorkflows = ObjstoreUtils.sort(job.getWorkFlowsSet(),
new ObjectTransform[]{WorkFlow.pipesWorkFlow().toSortOrder()},
new Comparator[]{CollectionUtils.DEFAULT_COMPARATOR_NULLS_FIRST});
for (WorkFlow workflow : sortedWorkflows)
{
%>
<%= workflow.getSortOrder() %>
<div class="form-group row">
<div class="col-md-12">
<oneit:ormInput obj="<%= workflow %>" type="text" attributeName="Name" cssClass="form-control" />
</div>
</div>
<%
}
%>
</div>
<div class="form-group row">
<oneit:button value="Add Workflow Step" name="gotoPage" cssClass="add-more-btn review-edit-btn" skin="link"
onClick="<%="addWorkflow(); return false;"%>"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", jobPage).toMap() %>"/>
</div>
<div class="form-brack-line"></div> <div class="form-brack-line"></div>
<div class="text-center"> <div class="text-center">
<div class="form-group row"> <div class="form-group row">
......
<?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</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="String" nullable="false" length="100"/>
<column name="sort_order" type="Long" nullable="false"/>
<column name="application_status" type="String" nullable="false" length="200"/>
<column name="job_id" type="Long" length="11" nullable="false"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_work_flow" indexName="idx_tl_work_flow_job_id" isUnique="false">
<column name="job_id"/>
</NODE>
</NODE>
</OBJECTS>
\ No newline at end of file
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