Commit 7b158927 by Nilu

Enable Notes facility as per original wireframe.

parent a353f770
<?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_note</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="comment" type="String" nullable="false" length="1000"/>
<column name="created_user_id" type="Long" length="11" nullable="false"/>
<column name="job_application_id" type="Long" length="11" nullable="false"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_note" indexName="idx_tl_note_job_application_id" isUnique="false"><column name="job_application_id"/></NODE>
</NODE></OBJECTS>
\ No newline at end of file
-- DROP TABLE tl_note;
CREATE TABLE tl_note (
object_id int NOT NULL ,
object_last_updated_date datetime DEFAULT getdate() NOT NULL ,
object_created_date datetime DEFAULT getdate() NOT NULL
,
comment varchar(1000) NOT NULL,
created_user_id numeric(12) NOT NULL,
job_application_id numeric(12) NOT NULL
);
ALTER TABLE tl_note ADD
CONSTRAINT PK_tl_note PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_note_job_application_id
ON tl_note (job_application_id);
-- DROP TABLE tl_note;
CREATE TABLE tl_note (
object_id number(12) NOT NULL ,
object_last_updated_date date DEFAULT SYSDATE NOT NULL ,
object_created_date date DEFAULT SYSDATE NOT NULL
,
comment varchar2(1000) NOT NULL,
created_user_id number(12) NOT NULL,
job_application_id number(12) NOT NULL
);
ALTER TABLE tl_note ADD
CONSTRAINT PK_tl_note PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_note_job_application_id
ON tl_note (job_application_id);
-- @AutoRun
-- drop table tl_note;
CREATE TABLE tl_note (
object_id numeric(12) NOT NULL ,
object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
object_created_date timestamp DEFAULT NOW() NOT NULL
,
comment varchar(1000) NOT NULL,
created_user_id numeric(12) NOT NULL,
job_application_id numeric(12) NOT NULL
);
ALTER TABLE tl_note ADD
CONSTRAINT pk_tl_note PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_note_job_application_id
ON tl_note (job_application_id);
package performa.form;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import oneit.logging.LogLevel;
import oneit.logging.LogMgr;
import oneit.logging.LoggingArea;
import oneit.objstore.ObjectTransaction;
import oneit.objstore.StorageException;
import oneit.objstore.parser.BusinessObjectParser;
import oneit.security.SecUser;
import oneit.servlets.forms.SubmissionDetails;
import oneit.servlets.forms.SuccessfulResult;
import oneit.servlets.process.ORMProcessState;
import oneit.servlets.process.SaveFP;
import oneit.utils.BusinessException;
import oneit.utils.MultiException;
import performa.orm.CompanyUser;
import performa.orm.JobApplication;
import performa.orm.Note;
public class AddNoteFP extends SaveFP
{
private static final LoggingArea LOG = LoggingArea.createLoggingArea("AddNoteFP");
@Override
public void validate(ORMProcessState process, SubmissionDetails submission, MultiException exceptions, Map params) throws StorageException
{
HttpServletRequest request = submission.getRequest();
JobApplication jobApplication = (JobApplication) request.getAttribute("JobApplication");
BusinessObjectParser.assertFieldCondition(jobApplication.getNote()!= null, jobApplication, JobApplication.FIELD_Note, "mandatory", exceptions, true, request);
super.validate(process, submission, exceptions, params);
}
@Override
public SuccessfulResult processForm(ORMProcessState process, SubmissionDetails submission, Map params) throws BusinessException, StorageException
{
ObjectTransaction objTran = process.getTransaction();
HttpServletRequest request = submission.getRequest();
JobApplication jobApplication = (JobApplication) request.getAttribute("JobApplication");
LogMgr.log(LOG, LogLevel.PROCESSING1, "Adding note to job application : ", jobApplication);
Note note = Note.createNote(objTran);
SecUser secUser = SecUser.getTXUser(process.getTransaction());
CompanyUser companyUser = secUser.getExtension(CompanyUser.REFERENCE_CompanyUser);
note.setComment(jobApplication.getNote());
note.setCreatedUser(companyUser);
note.setJobApplication(jobApplication);
LogMgr.log(LOG, LogLevel.PROCESSING1, "New note added : ", note);
return super.processForm(process, submission, params);
}
}
\ No newline at end of file
...@@ -53,6 +53,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -53,6 +53,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass
public static final String FIELD_RequirementFit = "RequirementFit"; public static final String FIELD_RequirementFit = "RequirementFit";
public static final String FIELD_CultureFit = "CultureFit"; public static final String FIELD_CultureFit = "CultureFit";
public static final String FIELD_FactorScoreDetails = "FactorScoreDetails"; public static final String FIELD_FactorScoreDetails = "FactorScoreDetails";
public static final String FIELD_Note = "Note";
public static final String SINGLEREFERENCE_WorkFlow = "WorkFlow"; public static final String SINGLEREFERENCE_WorkFlow = "WorkFlow";
public static final String SINGLEREFERENCE_Candidate = "Candidate"; public static final String SINGLEREFERENCE_Candidate = "Candidate";
public static final String BACKREF_Candidate = ""; public static final String BACKREF_Candidate = "";
...@@ -60,6 +61,8 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -60,6 +61,8 @@ public abstract class BaseJobApplication extends BaseBusinessClass
public static final String BACKREF_Job = ""; public static final String BACKREF_Job = "";
public static final String MULTIPLEREFERENCE_AssessmentCriteriaAnswers = "AssessmentCriteriaAnswers"; public static final String MULTIPLEREFERENCE_AssessmentCriteriaAnswers = "AssessmentCriteriaAnswers";
public static final String BACKREF_AssessmentCriteriaAnswers = ""; public static final String BACKREF_AssessmentCriteriaAnswers = "";
public static final String MULTIPLEREFERENCE_Notes = "Notes";
public static final String BACKREF_Notes = "";
// Static constants corresponding to searches // Static constants corresponding to searches
public static final String SEARCH_All = "All"; public static final String SEARCH_All = "All";
...@@ -81,6 +84,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -81,6 +84,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass
private static final BLOBAttributeHelper HELPER_RequirementFit = BLOBAttributeHelper.INSTANCE; private static final BLOBAttributeHelper HELPER_RequirementFit = BLOBAttributeHelper.INSTANCE;
private static final BLOBAttributeHelper HELPER_CultureFit = BLOBAttributeHelper.INSTANCE; private static final BLOBAttributeHelper HELPER_CultureFit = BLOBAttributeHelper.INSTANCE;
private static final BLOBAttributeHelper HELPER_FactorScoreDetails = BLOBAttributeHelper.INSTANCE; private static final BLOBAttributeHelper HELPER_FactorScoreDetails = BLOBAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<JobApplication> HELPER_Note = DefaultAttributeHelper.INSTANCE;
// Private attributes corresponding to business object data // Private attributes corresponding to business object data
...@@ -97,6 +101,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -97,6 +101,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass
private Map _RequirementFit; private Map _RequirementFit;
private Map _CultureFit; private Map _CultureFit;
private Map _FactorScoreDetails; private Map _FactorScoreDetails;
private String _Note;
// Private attributes corresponding to single references // Private attributes corresponding to single references
...@@ -107,6 +112,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -107,6 +112,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass
// Private attributes corresponding to multiple references // Private attributes corresponding to multiple references
private MultipleAssociation<JobApplication, AssessmentCriteriaAnswer> _AssessmentCriteriaAnswers; private MultipleAssociation<JobApplication, AssessmentCriteriaAnswer> _AssessmentCriteriaAnswers;
private MultipleAssociation<JobApplication, Note> _Notes;
// Map of maps of metadata // Map of maps of metadata
...@@ -119,6 +125,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -119,6 +125,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass
private static final AttributeValidator[] FIELD_RequirementFit_Validators; private static final AttributeValidator[] FIELD_RequirementFit_Validators;
private static final AttributeValidator[] FIELD_CultureFit_Validators; private static final AttributeValidator[] FIELD_CultureFit_Validators;
private static final AttributeValidator[] FIELD_FactorScoreDetails_Validators; private static final AttributeValidator[] FIELD_FactorScoreDetails_Validators;
private static final AttributeValidator[] FIELD_Note_Validators;
private static final AttributeValidator[] FIELD_CV_Validators; private static final AttributeValidator[] FIELD_CV_Validators;
private static final AttributeValidator[] FIELD_CoverLetter_Validators; private static final AttributeValidator[] FIELD_CoverLetter_Validators;
private static final AttributeValidator[] FIELD_ApplicationStatus_Validators; private static final AttributeValidator[] FIELD_ApplicationStatus_Validators;
...@@ -137,12 +144,14 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -137,12 +144,14 @@ public abstract class BaseJobApplication extends BaseBusinessClass
{ {
String tmp_AssessmentCriteriaAnswers = AssessmentCriteriaAnswer.BACKREF_JobApplication; String tmp_AssessmentCriteriaAnswers = AssessmentCriteriaAnswer.BACKREF_JobApplication;
String tmp_Notes = Note.BACKREF_JobApplication;
String tmp_Candidate = Candidate.BACKREF_JobApplications; String tmp_Candidate = Candidate.BACKREF_JobApplications;
String tmp_Job = Job.BACKREF_JobApplications; String tmp_Job = Job.BACKREF_JobApplications;
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping")); Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
setupAssocMetaData_AssessmentCriteriaAnswers(); setupAssocMetaData_AssessmentCriteriaAnswers();
setupAssocMetaData_Notes();
setupAssocMetaData_WorkFlow(); setupAssocMetaData_WorkFlow();
setupAssocMetaData_Candidate(); setupAssocMetaData_Candidate();
setupAssocMetaData_Job(); setupAssocMetaData_Job();
...@@ -152,6 +161,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -152,6 +161,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass
FIELD_RequirementFit_Validators = (AttributeValidator[])setupAttribMetaData_RequirementFit(validatorMapping).toArray (new AttributeValidator[0]); FIELD_RequirementFit_Validators = (AttributeValidator[])setupAttribMetaData_RequirementFit(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_CultureFit_Validators = (AttributeValidator[])setupAttribMetaData_CultureFit(validatorMapping).toArray (new AttributeValidator[0]); FIELD_CultureFit_Validators = (AttributeValidator[])setupAttribMetaData_CultureFit(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_FactorScoreDetails_Validators = (AttributeValidator[])setupAttribMetaData_FactorScoreDetails(validatorMapping).toArray (new AttributeValidator[0]); FIELD_FactorScoreDetails_Validators = (AttributeValidator[])setupAttribMetaData_FactorScoreDetails(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_Note_Validators = (AttributeValidator[])setupAttribMetaData_Note(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_CV_Validators = (AttributeValidator[])setupAttribMetaData_CV(validatorMapping).toArray (new AttributeValidator[0]); FIELD_CV_Validators = (AttributeValidator[])setupAttribMetaData_CV(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_CoverLetter_Validators = (AttributeValidator[])setupAttribMetaData_CoverLetter(validatorMapping).toArray (new AttributeValidator[0]); FIELD_CoverLetter_Validators = (AttributeValidator[])setupAttribMetaData_CoverLetter(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_ApplicationStatus_Validators = (AttributeValidator[])setupAttribMetaData_ApplicationStatus(validatorMapping).toArray (new AttributeValidator[0]); FIELD_ApplicationStatus_Validators = (AttributeValidator[])setupAttribMetaData_ApplicationStatus(validatorMapping).toArray (new AttributeValidator[0]);
...@@ -188,6 +198,20 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -188,6 +198,20 @@ public abstract class BaseJobApplication extends BaseBusinessClass
// Meta Info setup // Meta Info setup
private static void setupAssocMetaData_Notes()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "JobApplication");
metaInfo.put ("name", "Notes");
metaInfo.put ("type", "Note");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for JobApplication.Notes:", metaInfo);
ATTRIBUTES_METADATA_JobApplication.put (MULTIPLEREFERENCE_Notes, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static void setupAssocMetaData_WorkFlow() private static void setupAssocMetaData_WorkFlow()
{ {
Map metaInfo = new HashMap (); Map metaInfo = new HashMap ();
...@@ -344,6 +368,23 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -344,6 +368,23 @@ public abstract class BaseJobApplication extends BaseBusinessClass
} }
// Meta Info setup // Meta Info setup
private static List setupAttribMetaData_Note(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("name", "Note");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for JobApplication.Note:", metaInfo);
ATTRIBUTES_METADATA_JobApplication.put (FIELD_Note, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(JobApplication.class, "Note", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for JobApplication.Note:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_CV(Map validatorMapping) private static List setupAttribMetaData_CV(Map validatorMapping)
{ {
Map metaInfo = new HashMap (); Map metaInfo = new HashMap ();
...@@ -522,6 +563,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -522,6 +563,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass
_RequirementFit = (Map)(HELPER_RequirementFit.initialise (_RequirementFit)); _RequirementFit = (Map)(HELPER_RequirementFit.initialise (_RequirementFit));
_CultureFit = (Map)(HELPER_CultureFit.initialise (_CultureFit)); _CultureFit = (Map)(HELPER_CultureFit.initialise (_CultureFit));
_FactorScoreDetails = (Map)(HELPER_FactorScoreDetails.initialise (_FactorScoreDetails)); _FactorScoreDetails = (Map)(HELPER_FactorScoreDetails.initialise (_FactorScoreDetails));
_Note = (String)(HELPER_Note.initialise (_Note));
} }
...@@ -534,6 +576,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -534,6 +576,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass
_Candidate = new SingleAssociation<JobApplication, Candidate> (this, SINGLEREFERENCE_Candidate, Candidate.MULTIPLEREFERENCE_JobApplications, Candidate.REFERENCE_Candidate, "tl_job_application"); _Candidate = new SingleAssociation<JobApplication, Candidate> (this, SINGLEREFERENCE_Candidate, Candidate.MULTIPLEREFERENCE_JobApplications, Candidate.REFERENCE_Candidate, "tl_job_application");
_Job = new SingleAssociation<JobApplication, Job> (this, SINGLEREFERENCE_Job, Job.MULTIPLEREFERENCE_JobApplications, Job.REFERENCE_Job, "tl_job_application"); _Job = new SingleAssociation<JobApplication, Job> (this, SINGLEREFERENCE_Job, Job.MULTIPLEREFERENCE_JobApplications, Job.REFERENCE_Job, "tl_job_application");
_AssessmentCriteriaAnswers = new MultipleAssociation<JobApplication, AssessmentCriteriaAnswer> (this, MULTIPLEREFERENCE_AssessmentCriteriaAnswers, AssessmentCriteriaAnswer.SINGLEREFERENCE_JobApplication, AssessmentCriteriaAnswer.REFERENCE_AssessmentCriteriaAnswer); _AssessmentCriteriaAnswers = new MultipleAssociation<JobApplication, AssessmentCriteriaAnswer> (this, MULTIPLEREFERENCE_AssessmentCriteriaAnswers, AssessmentCriteriaAnswer.SINGLEREFERENCE_JobApplication, AssessmentCriteriaAnswer.REFERENCE_AssessmentCriteriaAnswer);
_Notes = new MultipleAssociation<JobApplication, Note> (this, MULTIPLEREFERENCE_Notes, Note.SINGLEREFERENCE_JobApplication, Note.REFERENCE_Note);
} }
...@@ -547,6 +590,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -547,6 +590,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass
_Candidate = new SingleAssociation<JobApplication, Candidate> (this, SINGLEREFERENCE_Candidate, Candidate.MULTIPLEREFERENCE_JobApplications, Candidate.REFERENCE_Candidate, "tl_job_application"); _Candidate = new SingleAssociation<JobApplication, Candidate> (this, SINGLEREFERENCE_Candidate, Candidate.MULTIPLEREFERENCE_JobApplications, Candidate.REFERENCE_Candidate, "tl_job_application");
_Job = new SingleAssociation<JobApplication, Job> (this, SINGLEREFERENCE_Job, Job.MULTIPLEREFERENCE_JobApplications, Job.REFERENCE_Job, "tl_job_application"); _Job = new SingleAssociation<JobApplication, Job> (this, SINGLEREFERENCE_Job, Job.MULTIPLEREFERENCE_JobApplications, Job.REFERENCE_Job, "tl_job_application");
_AssessmentCriteriaAnswers = new MultipleAssociation<JobApplication, AssessmentCriteriaAnswer> (this, MULTIPLEREFERENCE_AssessmentCriteriaAnswers, AssessmentCriteriaAnswer.SINGLEREFERENCE_JobApplication, AssessmentCriteriaAnswer.REFERENCE_AssessmentCriteriaAnswer); _AssessmentCriteriaAnswers = new MultipleAssociation<JobApplication, AssessmentCriteriaAnswer> (this, MULTIPLEREFERENCE_AssessmentCriteriaAnswers, AssessmentCriteriaAnswer.SINGLEREFERENCE_JobApplication, AssessmentCriteriaAnswer.REFERENCE_AssessmentCriteriaAnswer);
_Notes = new MultipleAssociation<JobApplication, Note> (this, MULTIPLEREFERENCE_Notes, Note.SINGLEREFERENCE_JobApplication, Note.REFERENCE_Note);
return this; return this;
...@@ -1829,6 +1873,104 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -1829,6 +1873,104 @@ public abstract class BaseJobApplication extends BaseBusinessClass
} }
} }
/**
* Get the attribute Note
*/
public String getNote ()
{
assertValid();
String valToReturn = _Note;
for (JobApplicationBehaviourDecorator bhd : JobApplication_BehaviourDecorators)
{
valToReturn = bhd.getNote ((JobApplication)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 preNoteChange (String newNote) 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 postNoteChange () throws FieldException
{
}
public FieldWriteability getWriteability_Note ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute Note. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setNote (String newNote) throws FieldException
{
boolean oldAndNewIdentical = HELPER_Note.compare (_Note, newNote);
try
{
for (JobApplicationBehaviourDecorator bhd : JobApplication_BehaviourDecorators)
{
newNote = bhd.setNote ((JobApplication)this, newNote);
oldAndNewIdentical = HELPER_Note.compare (_Note, newNote);
}
if (FIELD_Note_Validators.length > 0)
{
Object newNoteObj = HELPER_Note.toObject (newNote);
if (newNoteObj != null)
{
int loopMax = FIELD_Note_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_JobApplication.get (FIELD_Note);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_Note_Validators[v].checkAttribute (this, FIELD_Note, metadata, newNoteObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_Note () != FieldWriteability.FALSE, "Field Note is not writeable");
preNoteChange (newNote);
markFieldChange (FIELD_Note);
_Note = newNote;
postFieldChange (FIELD_Note);
postNoteChange ();
}
}
/** /**
...@@ -2306,6 +2448,8 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -2306,6 +2448,8 @@ public abstract class BaseJobApplication extends BaseBusinessClass
result.add("AssessmentCriteriaAnswers"); result.add("AssessmentCriteriaAnswers");
result.add("Notes");
return result; return result;
} }
...@@ -2322,6 +2466,11 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -2322,6 +2466,11 @@ public abstract class BaseJobApplication extends BaseBusinessClass
return AssessmentCriteriaAnswer.REFERENCE_AssessmentCriteriaAnswer ; return AssessmentCriteriaAnswer.REFERENCE_AssessmentCriteriaAnswer ;
} }
if (MULTIPLEREFERENCE_Notes.equals(attribName))
{
return Note.REFERENCE_Note ;
}
return super.getMultiAssocReferenceInstance(attribName); return super.getMultiAssocReferenceInstance(attribName);
} }
...@@ -2335,6 +2484,11 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -2335,6 +2484,11 @@ public abstract class BaseJobApplication extends BaseBusinessClass
return AssessmentCriteriaAnswer.SINGLEREFERENCE_JobApplication ; return AssessmentCriteriaAnswer.SINGLEREFERENCE_JobApplication ;
} }
if (MULTIPLEREFERENCE_Notes.equals(attribName))
{
return Note.SINGLEREFERENCE_JobApplication ;
}
return super.getMultiAssocBackReference(attribName); return super.getMultiAssocBackReference(attribName);
} }
...@@ -2351,6 +2505,11 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -2351,6 +2505,11 @@ public abstract class BaseJobApplication extends BaseBusinessClass
return this.getAssessmentCriteriaAnswersCount(); return this.getAssessmentCriteriaAnswersCount();
} }
if (MULTIPLEREFERENCE_Notes.equals(attribName))
{
return this.getNotesCount();
}
return super.getMultiAssocCount(attribName); return super.getMultiAssocCount(attribName);
} }
...@@ -2367,6 +2526,11 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -2367,6 +2526,11 @@ public abstract class BaseJobApplication extends BaseBusinessClass
return this.getAssessmentCriteriaAnswersAt(index); return this.getAssessmentCriteriaAnswersAt(index);
} }
if (MULTIPLEREFERENCE_Notes.equals(attribName))
{
return this.getNotesAt(index);
}
return super.getMultiAssocAt(attribName, index); return super.getMultiAssocAt(attribName, index);
} }
...@@ -2385,6 +2549,13 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -2385,6 +2549,13 @@ public abstract class BaseJobApplication extends BaseBusinessClass
return; return;
} }
if (MULTIPLEREFERENCE_Notes.equals(attribName))
{
addToNotes((Note)newElement);
return;
}
super.addToMultiAssoc(attribName, newElement); super.addToMultiAssoc(attribName, newElement);
} }
...@@ -2402,6 +2573,13 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -2402,6 +2573,13 @@ public abstract class BaseJobApplication extends BaseBusinessClass
return; return;
} }
if (MULTIPLEREFERENCE_Notes.equals(attribName))
{
removeFromNotes((Note)oldElement);
return;
}
super.removeFromMultiAssoc(attribName, oldElement); super.removeFromMultiAssoc(attribName, oldElement);
} }
...@@ -2416,6 +2594,12 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -2416,6 +2594,12 @@ public abstract class BaseJobApplication extends BaseBusinessClass
return; return;
} }
if (MULTIPLEREFERENCE_Notes.equals(attribName))
{
_Notes.__loadAssociation (elements);
return;
}
super.__loadMultiAssoc(attribName, elements); super.__loadMultiAssoc(attribName, elements);
} }
...@@ -2429,6 +2613,11 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -2429,6 +2613,11 @@ public abstract class BaseJobApplication extends BaseBusinessClass
return _AssessmentCriteriaAnswers.isLoaded (); return _AssessmentCriteriaAnswers.isLoaded ();
} }
if (MULTIPLEREFERENCE_Notes.equals(attribName))
{
return _Notes.isLoaded ();
}
return super.__isMultiAssocLoaded(attribName); return super.__isMultiAssocLoaded(attribName);
} }
...@@ -2504,6 +2693,75 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -2504,6 +2693,75 @@ public abstract class BaseJobApplication extends BaseBusinessClass
return _AssessmentCriteriaAnswers.getSet (); return _AssessmentCriteriaAnswers.getSet ();
} }
public FieldWriteability getWriteability_Notes ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
public int getNotesCount () throws StorageException
{
assertValid();
return _Notes.getReferencedObjectsCount ();
}
public void addToNotes (Note newElement) throws StorageException
{
if (_Notes.wouldAddChange (newElement))
{
assertValid();
Debug.assertion (getWriteability_Notes () != FieldWriteability.FALSE, "MultiAssoc Notes is not writeable (add)");
_Notes.appendElement (newElement);
try
{
if (newElement.getJobApplication () != this)
{
newElement.setJobApplication ((JobApplication)(this));
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
}
}
public void removeFromNotes (Note elementToRemove) throws StorageException
{
if (_Notes.wouldRemoveChange (elementToRemove))
{
assertValid();
Debug.assertion (getWriteability_Notes () != FieldWriteability.FALSE, "MultiAssoc Notes is not writeable (remove)");
_Notes.removeElement (elementToRemove);
try
{
if (elementToRemove.getJobApplication () != null)
{
elementToRemove.setJobApplication (null);
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
}
}
public Note getNotesAt (int index) throws StorageException
{
return (Note)(_Notes.getElementAt (index));
}
public SortedSet<Note> getNotesSet () throws StorageException
{
return _Notes.getSet ();
}
public void onDelete () public void onDelete ()
...@@ -2544,6 +2802,12 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -2544,6 +2802,12 @@ public abstract class BaseJobApplication extends BaseBusinessClass
referenced.setJobApplication(null); referenced.setJobApplication(null);
} }
for(Note referenced : CollectionUtils.reverse(getNotesSet()))
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null JobApplication from ", getObjectID (), " to ", referenced.getObjectID ());
referenced.setJobApplication(null);
}
} }
catch (Exception e) catch (Exception e)
{ {
...@@ -2742,6 +3006,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -2742,6 +3006,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass
_RequirementFit = sourceJobApplication._RequirementFit; _RequirementFit = sourceJobApplication._RequirementFit;
_CultureFit = sourceJobApplication._CultureFit; _CultureFit = sourceJobApplication._CultureFit;
_FactorScoreDetails = sourceJobApplication._FactorScoreDetails; _FactorScoreDetails = sourceJobApplication._FactorScoreDetails;
_Note = sourceJobApplication._Note;
} }
} }
...@@ -2778,6 +3043,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -2778,6 +3043,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass
BaseJobApplication sourceJobApplication = (BaseJobApplication)(source); BaseJobApplication sourceJobApplication = (BaseJobApplication)(source);
_AssessmentCriteriaAnswers.copyFrom (sourceJobApplication._AssessmentCriteriaAnswers, linkToGhosts); _AssessmentCriteriaAnswers.copyFrom (sourceJobApplication._AssessmentCriteriaAnswers, linkToGhosts);
_Notes.copyFrom (sourceJobApplication._Notes, linkToGhosts);
} }
} }
...@@ -2815,10 +3081,12 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -2815,10 +3081,12 @@ public abstract class BaseJobApplication extends BaseBusinessClass
_RequirementFit = (Map)(HELPER_RequirementFit.readExternal (_RequirementFit, vals.get(FIELD_RequirementFit))); // _RequirementFit = (Map)(HELPER_RequirementFit.readExternal (_RequirementFit, vals.get(FIELD_RequirementFit))); //
_CultureFit = (Map)(HELPER_CultureFit.readExternal (_CultureFit, vals.get(FIELD_CultureFit))); // _CultureFit = (Map)(HELPER_CultureFit.readExternal (_CultureFit, vals.get(FIELD_CultureFit))); //
_FactorScoreDetails = (Map)(HELPER_FactorScoreDetails.readExternal (_FactorScoreDetails, vals.get(FIELD_FactorScoreDetails))); // _FactorScoreDetails = (Map)(HELPER_FactorScoreDetails.readExternal (_FactorScoreDetails, vals.get(FIELD_FactorScoreDetails))); //
_Note = (String)(HELPER_Note.readExternal (_Note, vals.get(FIELD_Note))); //
_WorkFlow.readExternalData(vals.get(SINGLEREFERENCE_WorkFlow)); _WorkFlow.readExternalData(vals.get(SINGLEREFERENCE_WorkFlow));
_Candidate.readExternalData(vals.get(SINGLEREFERENCE_Candidate)); _Candidate.readExternalData(vals.get(SINGLEREFERENCE_Candidate));
_Job.readExternalData(vals.get(SINGLEREFERENCE_Job)); _Job.readExternalData(vals.get(SINGLEREFERENCE_Job));
_AssessmentCriteriaAnswers.readExternalData(vals.get(MULTIPLEREFERENCE_AssessmentCriteriaAnswers)); _AssessmentCriteriaAnswers.readExternalData(vals.get(MULTIPLEREFERENCE_AssessmentCriteriaAnswers));
_Notes.readExternalData(vals.get(MULTIPLEREFERENCE_Notes));
} }
...@@ -2843,10 +3111,12 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -2843,10 +3111,12 @@ public abstract class BaseJobApplication extends BaseBusinessClass
vals.put (FIELD_RequirementFit, HELPER_RequirementFit.writeExternal (_RequirementFit)); vals.put (FIELD_RequirementFit, HELPER_RequirementFit.writeExternal (_RequirementFit));
vals.put (FIELD_CultureFit, HELPER_CultureFit.writeExternal (_CultureFit)); vals.put (FIELD_CultureFit, HELPER_CultureFit.writeExternal (_CultureFit));
vals.put (FIELD_FactorScoreDetails, HELPER_FactorScoreDetails.writeExternal (_FactorScoreDetails)); vals.put (FIELD_FactorScoreDetails, HELPER_FactorScoreDetails.writeExternal (_FactorScoreDetails));
vals.put (FIELD_Note, HELPER_Note.writeExternal (_Note));
vals.put (SINGLEREFERENCE_WorkFlow, _WorkFlow.writeExternalData()); vals.put (SINGLEREFERENCE_WorkFlow, _WorkFlow.writeExternalData());
vals.put (SINGLEREFERENCE_Candidate, _Candidate.writeExternalData()); vals.put (SINGLEREFERENCE_Candidate, _Candidate.writeExternalData());
vals.put (SINGLEREFERENCE_Job, _Job.writeExternalData()); vals.put (SINGLEREFERENCE_Job, _Job.writeExternalData());
vals.put (MULTIPLEREFERENCE_AssessmentCriteriaAnswers, _AssessmentCriteriaAnswers.writeExternalData()); vals.put (MULTIPLEREFERENCE_AssessmentCriteriaAnswers, _AssessmentCriteriaAnswers.writeExternalData());
vals.put (MULTIPLEREFERENCE_Notes, _Notes.writeExternalData());
} }
...@@ -2897,6 +3167,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -2897,6 +3167,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass
// Compare multiple assocs // Compare multiple assocs
_AssessmentCriteriaAnswers.compare (otherJobApplication._AssessmentCriteriaAnswers, listener); _AssessmentCriteriaAnswers.compare (otherJobApplication._AssessmentCriteriaAnswers, listener);
_Notes.compare (otherJobApplication._Notes, listener);
} }
} }
...@@ -2912,6 +3183,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -2912,6 +3183,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass
visitor.visitField(this, FIELD_RequirementFit, HELPER_RequirementFit.toObject(getRequirementFit())); visitor.visitField(this, FIELD_RequirementFit, HELPER_RequirementFit.toObject(getRequirementFit()));
visitor.visitField(this, FIELD_CultureFit, HELPER_CultureFit.toObject(getCultureFit())); visitor.visitField(this, FIELD_CultureFit, HELPER_CultureFit.toObject(getCultureFit()));
visitor.visitField(this, FIELD_FactorScoreDetails, HELPER_FactorScoreDetails.toObject(getFactorScoreDetails())); visitor.visitField(this, FIELD_FactorScoreDetails, HELPER_FactorScoreDetails.toObject(getFactorScoreDetails()));
visitor.visitField(this, FIELD_Note, HELPER_Note.toObject(getNote()));
} }
...@@ -2931,6 +3203,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -2931,6 +3203,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass
visitor.visitAssociation (_Candidate); visitor.visitAssociation (_Candidate);
visitor.visitAssociation (_Job); visitor.visitAssociation (_Job);
visitor.visitAssociation (_AssessmentCriteriaAnswers); visitor.visitAssociation (_AssessmentCriteriaAnswers);
visitor.visitAssociation (_Notes);
} }
...@@ -2955,6 +3228,10 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -2955,6 +3228,10 @@ public abstract class BaseJobApplication extends BaseBusinessClass
{ {
visitor.visit (_AssessmentCriteriaAnswers); visitor.visit (_AssessmentCriteriaAnswers);
} }
if (scope.includes (_Notes))
{
visitor.visit (_Notes);
}
} }
...@@ -3443,6 +3720,10 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -3443,6 +3720,10 @@ public abstract class BaseJobApplication extends BaseBusinessClass
{ {
return HELPER_FactorScoreDetails.toObject (getFactorScoreDetails ()); return HELPER_FactorScoreDetails.toObject (getFactorScoreDetails ());
} }
else if (attribName.equals (FIELD_Note))
{
return HELPER_Note.toObject (getNote ());
}
else else
{ {
return super.getAttribute (attribName); return super.getAttribute (attribName);
...@@ -3508,6 +3789,10 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -3508,6 +3789,10 @@ public abstract class BaseJobApplication extends BaseBusinessClass
{ {
return HELPER_FactorScoreDetails; return HELPER_FactorScoreDetails;
} }
else if (attribName.equals (FIELD_Note))
{
return HELPER_Note;
}
else else
{ {
return super.getAttributeHelper (attribName); return super.getAttributeHelper (attribName);
...@@ -3573,6 +3858,10 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -3573,6 +3858,10 @@ public abstract class BaseJobApplication extends BaseBusinessClass
{ {
setFactorScoreDetails ((Map)(HELPER_FactorScoreDetails.fromObject (_FactorScoreDetails, attribValue))); setFactorScoreDetails ((Map)(HELPER_FactorScoreDetails.fromObject (_FactorScoreDetails, attribValue)));
} }
else if (attribName.equals (FIELD_Note))
{
setNote ((String)(HELPER_Note.fromObject (_Note, attribValue)));
}
else else
{ {
super.setAttribute (attribName, attribValue); super.setAttribute (attribName, attribValue);
...@@ -3625,6 +3914,10 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -3625,6 +3914,10 @@ public abstract class BaseJobApplication extends BaseBusinessClass
{ {
return getWriteability_AssessmentCriteriaAnswers (); return getWriteability_AssessmentCriteriaAnswers ();
} }
else if (fieldName.equals (MULTIPLEREFERENCE_Notes))
{
return getWriteability_Notes ();
}
else if (fieldName.equals (SINGLEREFERENCE_Candidate)) else if (fieldName.equals (SINGLEREFERENCE_Candidate))
{ {
return getWriteability_Candidate (); return getWriteability_Candidate ();
...@@ -3657,6 +3950,10 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -3657,6 +3950,10 @@ public abstract class BaseJobApplication extends BaseBusinessClass
{ {
return getWriteability_FactorScoreDetails (); return getWriteability_FactorScoreDetails ();
} }
else if (fieldName.equals (FIELD_Note))
{
return getWriteability_Note ();
}
else if (fieldName.equals (SINGLEREFERENCE_WorkFlow)) else if (fieldName.equals (SINGLEREFERENCE_WorkFlow))
{ {
return getWriteability_WorkFlow (); return getWriteability_WorkFlow ();
...@@ -3736,6 +4033,11 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -3736,6 +4033,11 @@ public abstract class BaseJobApplication extends BaseBusinessClass
fields.add (FIELD_FactorScoreDetails); fields.add (FIELD_FactorScoreDetails);
} }
if (getWriteability_Note () != FieldWriteability.TRUE)
{
fields.add (FIELD_Note);
}
super.putUnwriteable (fields); super.putUnwriteable (fields);
} }
...@@ -3758,6 +4060,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -3758,6 +4060,7 @@ public abstract class BaseJobApplication extends BaseBusinessClass
result.add(HELPER_RequirementFit.getAttribObject (getClass (), _RequirementFit, false, FIELD_RequirementFit)); result.add(HELPER_RequirementFit.getAttribObject (getClass (), _RequirementFit, false, FIELD_RequirementFit));
result.add(HELPER_CultureFit.getAttribObject (getClass (), _CultureFit, false, FIELD_CultureFit)); result.add(HELPER_CultureFit.getAttribObject (getClass (), _CultureFit, false, FIELD_CultureFit));
result.add(HELPER_FactorScoreDetails.getAttribObject (getClass (), _FactorScoreDetails, false, FIELD_FactorScoreDetails)); result.add(HELPER_FactorScoreDetails.getAttribObject (getClass (), _FactorScoreDetails, false, FIELD_FactorScoreDetails));
result.add(HELPER_Note.getAttribObject (getClass (), _Note, false, FIELD_Note));
return result; return result;
} }
...@@ -4078,6 +4381,24 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -4078,6 +4381,24 @@ public abstract class BaseJobApplication extends BaseBusinessClass
return newFactorScoreDetails; return newFactorScoreDetails;
} }
/**
* Get the attribute Note
*/
public String getNote (JobApplication obj, String original)
{
return original;
}
/**
* Change the value set for attribute Note.
* May modify the field beforehand
* Occurs before validation.
*/
public String setNote (JobApplication obj, String newNote) throws FieldException
{
return newNote;
}
} }
...@@ -4134,6 +4455,10 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -4134,6 +4455,10 @@ public abstract class BaseJobApplication extends BaseBusinessClass
{ {
return toAssessmentCriteriaAnswers (); return toAssessmentCriteriaAnswers ();
} }
if (name.equals ("Notes"))
{
return toNotes ();
}
if (name.equals ("AppProcessOption")) if (name.equals ("AppProcessOption"))
{ {
return toAppProcessOption (); return toAppProcessOption ();
...@@ -4158,6 +4483,10 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -4158,6 +4483,10 @@ public abstract class BaseJobApplication extends BaseBusinessClass
{ {
return toFactorScoreDetails (); return toFactorScoreDetails ();
} }
if (name.equals ("Note"))
{
return toNote ();
}
if (name.equals ("WorkFlow")) if (name.equals ("WorkFlow"))
{ {
return toWorkFlow (); return toWorkFlow ();
...@@ -4216,6 +4545,8 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -4216,6 +4545,8 @@ public abstract class BaseJobApplication extends BaseBusinessClass
public PipeLine<From, Map> toFactorScoreDetails () { return pipe(new ORMAttributePipe<Me, Map>(FIELD_FactorScoreDetails)); } public PipeLine<From, Map> toFactorScoreDetails () { return pipe(new ORMAttributePipe<Me, Map>(FIELD_FactorScoreDetails)); }
public PipeLine<From, String> toNote () { return pipe(new ORMAttributePipe<Me, String>(FIELD_Note)); }
public PipeLine<From, BinaryContent> toCV () { return pipe(new ORMAttributePipe<Me, BinaryContent>(FIELD_CV)); } public PipeLine<From, BinaryContent> toCV () { return pipe(new ORMAttributePipe<Me, BinaryContent>(FIELD_CV)); }
public PipeLine<From, BinaryContent> toCoverLetter () { return pipe(new ORMAttributePipe<Me, BinaryContent>(FIELD_CoverLetter)); } public PipeLine<From, BinaryContent> toCoverLetter () { return pipe(new ORMAttributePipe<Me, BinaryContent>(FIELD_CoverLetter)); }
...@@ -4253,6 +4584,12 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -4253,6 +4584,12 @@ public abstract class BaseJobApplication extends BaseBusinessClass
{ {
return AssessmentCriteriaAnswer.REFERENCE_AssessmentCriteriaAnswer.new AssessmentCriteriaAnswerPipeLineFactory<From, AssessmentCriteriaAnswer> (this, new ORMMultiAssocPipe<Me, AssessmentCriteriaAnswer>(MULTIPLEREFERENCE_AssessmentCriteriaAnswers, filter)); return AssessmentCriteriaAnswer.REFERENCE_AssessmentCriteriaAnswer.new AssessmentCriteriaAnswerPipeLineFactory<From, AssessmentCriteriaAnswer> (this, new ORMMultiAssocPipe<Me, AssessmentCriteriaAnswer>(MULTIPLEREFERENCE_AssessmentCriteriaAnswers, filter));
} }
public Note.NotePipeLineFactory<From, Note> toNotes () { return toNotes(Filter.ALL); }
public Note.NotePipeLineFactory<From, Note> toNotes (Filter<Note> filter)
{
return Note.REFERENCE_Note.new NotePipeLineFactory<From, Note> (this, new ORMMultiAssocPipe<Me, Note>(MULTIPLEREFERENCE_Notes, filter));
}
} }
...@@ -4289,6 +4626,11 @@ public abstract class BaseJobApplication extends BaseBusinessClass ...@@ -4289,6 +4626,11 @@ public abstract class BaseJobApplication extends BaseBusinessClass
return true; return true;
} }
if(CollectionUtils.equals(attribName, "Note"))
{
return true;
}
return super.isTransientAttrib(attribName); return super.isTransientAttrib(attribName);
} }
...@@ -4378,6 +4720,23 @@ class DummyJobApplication extends JobApplication ...@@ -4378,6 +4720,23 @@ class DummyJobApplication extends JobApplication
return new TreeSet(); return new TreeSet();
} }
public int getNotesCount () throws StorageException
{
return 0;
}
public Note getNotesAt (int index) throws StorageException
{
throw new RuntimeException ("No elements in a dummy object in association Notes");
}
public SortedSet getNotesSet () throws StorageException
{
return new TreeSet();
}
} }
/*
* 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 oneit.security.*;
public abstract class BaseNote extends BaseBusinessClass
{
// Reference instance for the object
public static final Note REFERENCE_Note = new Note ();
// Reference instance for the object
public static final Note DUMMY_Note = new DummyNote ();
// Static constants corresponding to field names
public static final String FIELD_Comment = "Comment";
public static final String SINGLEREFERENCE_CreatedUser = "CreatedUser";
public static final String SINGLEREFERENCE_JobApplication = "JobApplication";
public static final String BACKREF_JobApplication = "";
// Static constants corresponding to searches
public static final String SEARCH_All = "All";
// Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper<Note> HELPER_Comment = DefaultAttributeHelper.INSTANCE;
// Private attributes corresponding to business object data
private String _Comment;
// Private attributes corresponding to single references
private SingleAssociation<Note, CompanyUser> _CreatedUser;
private SingleAssociation<Note, JobApplication> _JobApplication;
// Private attributes corresponding to multiple references
// Map of maps of metadata
private static final Map ATTRIBUTES_METADATA_Note = new HashMap ();
// Arrays of validators for each attribute
private static final AttributeValidator[] FIELD_Comment_Validators;
// Arrays of behaviour decorators
private static final NoteBehaviourDecorator[] Note_BehaviourDecorators;
static
{
try
{
String tmp_JobApplication = JobApplication.BACKREF_Notes;
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
setupAssocMetaData_CreatedUser();
setupAssocMetaData_JobApplication();
FIELD_Comment_Validators = (AttributeValidator[])setupAttribMetaData_Comment(validatorMapping).toArray (new AttributeValidator[0]);
REFERENCE_Note.initialiseReference ();
DUMMY_Note.initialiseReference ();
Note_BehaviourDecorators = BaseBusinessClass.getBBCBehaviours(Note.class).toArray(new NoteBehaviourDecorator[0]);
}
catch (RuntimeException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR1, e, "Error initialising");
throw e;
}
}
// Meta Info setup
private static void setupAssocMetaData_CreatedUser()
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "created_user_id");
metaInfo.put ("mandatory", "true");
metaInfo.put ("name", "CreatedUser");
metaInfo.put ("type", "CompanyUser");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Note.CreatedUser:", metaInfo);
ATTRIBUTES_METADATA_Note.put (SINGLEREFERENCE_CreatedUser, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static void setupAssocMetaData_JobApplication()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "Notes");
metaInfo.put ("dbcol", "job_application_id");
metaInfo.put ("mandatory", "true");
metaInfo.put ("name", "JobApplication");
metaInfo.put ("type", "JobApplication");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Note.JobApplication:", metaInfo);
ATTRIBUTES_METADATA_Note.put (SINGLEREFERENCE_JobApplication, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static List setupAttribMetaData_Comment(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "comment");
metaInfo.put ("length", "1000");
metaInfo.put ("mandatory", "true");
metaInfo.put ("name", "Comment");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Note.Comment:", metaInfo);
ATTRIBUTES_METADATA_Note.put (FIELD_Comment, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(Note.class, "Comment", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for Note.Comment:", validators);
return validators;
}
// END OF STATIC METADATA DEFINITION
// This constructor should not be called
protected BaseNote ()
{
}
protected BBCBehaviourDecorator[] getBehaviours()
{
return Note_BehaviourDecorators;
}
// Initialise the attributes
protected void _initialiseNewObjAttributes (ObjectTransaction transaction) throws StorageException
{
super._initialiseNewObjAttributes (transaction);
_Comment = (String)(HELPER_Comment.initialise (_Comment));
}
// Initialise the associations
protected void _initialiseAssociations ()
{
super._initialiseAssociations ();
_CreatedUser = new SingleAssociation<Note, CompanyUser> (this, SINGLEREFERENCE_CreatedUser, null, CompanyUser.REFERENCE_CompanyUser, "tl_note");
_JobApplication = new SingleAssociation<Note, JobApplication> (this, SINGLEREFERENCE_JobApplication, JobApplication.MULTIPLEREFERENCE_Notes, JobApplication.REFERENCE_JobApplication, "tl_note");
}
// Initialise the associations
protected BaseBusinessClass initialiseReference ()
{
super.initialiseReference ();
_CreatedUser = new SingleAssociation<Note, CompanyUser> (this, SINGLEREFERENCE_CreatedUser, null, CompanyUser.REFERENCE_CompanyUser, "tl_note");
_JobApplication = new SingleAssociation<Note, JobApplication> (this, SINGLEREFERENCE_JobApplication, JobApplication.MULTIPLEREFERENCE_Notes, JobApplication.REFERENCE_JobApplication, "tl_note");
return this;
}
/**
* Get the attribute Comment
*/
public String getComment ()
{
assertValid();
String valToReturn = _Comment;
for (NoteBehaviourDecorator bhd : Note_BehaviourDecorators)
{
valToReturn = bhd.getComment ((Note)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 preCommentChange (String newComment) 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 postCommentChange () throws FieldException
{
}
public FieldWriteability getWriteability_Comment ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute Comment. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setComment (String newComment) throws FieldException
{
boolean oldAndNewIdentical = HELPER_Comment.compare (_Comment, newComment);
try
{
for (NoteBehaviourDecorator bhd : Note_BehaviourDecorators)
{
newComment = bhd.setComment ((Note)this, newComment);
oldAndNewIdentical = HELPER_Comment.compare (_Comment, newComment);
}
BusinessObjectParser.assertFieldCondition (newComment != null, this, FIELD_Comment, "mandatory");
if (FIELD_Comment_Validators.length > 0)
{
Object newCommentObj = HELPER_Comment.toObject (newComment);
if (newCommentObj != null)
{
int loopMax = FIELD_Comment_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_Note.get (FIELD_Comment);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_Comment_Validators[v].checkAttribute (this, FIELD_Comment, metadata, newCommentObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_Comment () != FieldWriteability.FALSE, "Field Comment is not writeable");
preCommentChange (newComment);
markFieldChange (FIELD_Comment);
_Comment = newComment;
postFieldChange (FIELD_Comment);
postCommentChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getSingleAssocs()
{
List result = super.getSingleAssocs ();
result.add("CreatedUser");
result.add("JobApplication");
return result;
}
public BaseBusinessClass getSingleAssocReferenceInstance (String assocName)
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_CreatedUser))
{
return _CreatedUser.getReferencedType ();
}else if (assocName.equals (SINGLEREFERENCE_JobApplication))
{
return _JobApplication.getReferencedType ();
}
else
{
return super.getSingleAssocReferenceInstance (assocName);
}
}
public String getSingleAssocBackReference(String assocName)
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_CreatedUser))
{
return null ;
}else if (assocName.equals (SINGLEREFERENCE_JobApplication))
{
return JobApplication.MULTIPLEREFERENCE_Notes ;
}
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_CreatedUser))
{
return getCreatedUser ();
}else if (assocName.equals (SINGLEREFERENCE_JobApplication))
{
return getJobApplication ();
}
else
{
return super.getSingleAssoc (assocName);
}
}
public BaseBusinessClass getSingleAssoc (String assocName, Get getType) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_CreatedUser))
{
return getCreatedUser (getType);
}else if (assocName.equals (SINGLEREFERENCE_JobApplication))
{
return getJobApplication (getType);
}
else
{
return super.getSingleAssoc (assocName, getType);
}
}
public Long getSingleAssocID (String assocName) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_CreatedUser))
{
return getCreatedUserID ();
}else if (assocName.equals (SINGLEREFERENCE_JobApplication))
{
return getJobApplicationID ();
}
else
{
return super.getSingleAssocID (assocName);
}
}
public void setSingleAssoc (String assocName, BaseBusinessClass newValue) throws StorageException, FieldException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_CreatedUser))
{
setCreatedUser ((CompanyUser)(newValue));
}else if (assocName.equals (SINGLEREFERENCE_JobApplication))
{
setJobApplication ((JobApplication)(newValue));
}
else
{
super.setSingleAssoc (assocName, newValue);
}
}
/**
* Get the reference CreatedUser
*/
public CompanyUser getCreatedUser () throws StorageException
{
assertValid();
try
{
return (CompanyUser)(_CreatedUser.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in Note:", this.getObjectID (), ", was trying to get CompanyUser:", getCreatedUserID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _CreatedUser.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public CompanyUser getCreatedUser (Get getType) throws StorageException
{
assertValid();
return _CreatedUser.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getCreatedUserID ()
{
assertValid();
if (_CreatedUser == null)
{
return null;
}
else
{
return _CreatedUser.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 preCreatedUserChange (CompanyUser newCreatedUser) 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 postCreatedUserChange () throws FieldException
{
}
public FieldWriteability getWriteability_CreatedUser ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference CreatedUser. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setCreatedUser (CompanyUser newCreatedUser) throws StorageException, FieldException
{
BusinessObjectParser.assertFieldCondition (newCreatedUser != null, this, SINGLEREFERENCE_CreatedUser, "mandatory");
if (_CreatedUser.wouldReferencedChange (newCreatedUser))
{
assertValid();
Debug.assertion (getWriteability_CreatedUser () != FieldWriteability.FALSE, "Assoc CreatedUser is not writeable");
preCreatedUserChange (newCreatedUser);
_CreatedUser.set (newCreatedUser);
postCreatedUserChange ();
}
}
/**
* Get the reference JobApplication
*/
public JobApplication getJobApplication () throws StorageException
{
assertValid();
try
{
return (JobApplication)(_JobApplication.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in Note:", this.getObjectID (), ", was trying to get JobApplication:", getJobApplicationID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _JobApplication.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public JobApplication getJobApplication (Get getType) throws StorageException
{
assertValid();
return _JobApplication.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getJobApplicationID ()
{
assertValid();
if (_JobApplication == null)
{
return null;
}
else
{
return _JobApplication.getID ();
}
}
/**
* Called prior to the assoc changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preJobApplicationChange (JobApplication newJobApplication) throws FieldException
{
}
/**
* Called after the assoc changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postJobApplicationChange () throws FieldException
{
}
public FieldWriteability getWriteability_JobApplication ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference JobApplication. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setJobApplication (JobApplication newJobApplication) throws StorageException, FieldException
{
BusinessObjectParser.assertFieldCondition (newJobApplication != null, this, SINGLEREFERENCE_JobApplication, "mandatory");
if (_JobApplication.wouldReferencedChange (newJobApplication))
{
assertValid();
Debug.assertion (getWriteability_JobApplication () != FieldWriteability.FALSE, "Assoc JobApplication is not writeable");
preJobApplicationChange (newJobApplication);
JobApplication oldJobApplication = getJobApplication ();
if (oldJobApplication != null)
{
// This is to stop validation from triggering when we are removed
_JobApplication.set (null);
oldJobApplication.removeFromNotes ((Note)(this));
}
_JobApplication.set (newJobApplication);
if (newJobApplication != null)
{
newJobApplication.addToNotes ((Note)(this));
}
postJobApplicationChange ();
}
}
/**
* 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 (_JobApplication.isLoaded () || getTransaction ().isObjectLoaded (_JobApplication.getReferencedType (), getJobApplicationID ()))
{
JobApplication referenced = getJobApplication ();
if (referenced != null)
{
// Stop the callback
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null Notes from ", getObjectID (), " to ", referenced.getObjectID ());
_JobApplication.set (null);
referenced.removeFromNotes ((Note)this);
}
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
super.onDelete ();
}
public Note newInstance ()
{
return new Note ();
}
public Note referenceInstance ()
{
return REFERENCE_Note;
}
public Note getInTransaction (ObjectTransaction t) throws StorageException
{
return getNoteByID (t, getObjectID());
}
public BaseBusinessClass dummyInstance ()
{
return DUMMY_Note;
}
public String getBaseSetName ()
{
return "tl_note";
}
/**
* 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_notePSet = allSets.getPersistentSet (myID, "tl_note", myPSetStatus);
tl_notePSet.setAttrib (FIELD_ObjectID, myID);
tl_notePSet.setAttrib (FIELD_Comment, HELPER_Comment.toObject (_Comment)); //
_CreatedUser.getPersistentSets (allSets);
_JobApplication.getPersistentSets (allSets);
}
/**
* Sets the objects state based on Persistent sets.
*/
public void setFromPersistentSets (ObjectID objectID, PersistentSetCollection allSets)
{
super.setFromPersistentSets (objectID, allSets);
PersistentSet tl_notePSet = allSets.getPersistentSet (objectID, "tl_note");
_Comment = (String)(HELPER_Comment.fromObject (_Comment, tl_notePSet.getAttrib (FIELD_Comment))); //
_CreatedUser.setFromPersistentSets (objectID, allSets);
_JobApplication.setFromPersistentSets (objectID, allSets);
}
public void setAttributesFrom (BaseBusinessClass other, MultiException e)
{
super.setAttributesFrom (other, e);
if (other instanceof Note)
{
Note otherNote = (Note)other;
try
{
setComment (otherNote.getComment ());
}
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 BaseNote)
{
BaseNote sourceNote = (BaseNote)(source);
_Comment = sourceNote._Comment;
}
}
/**
* 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 BaseNote)
{
BaseNote sourceNote = (BaseNote)(source);
_CreatedUser.copyFrom (sourceNote._CreatedUser, linkToGhosts);
_JobApplication.copyFrom (sourceNote._JobApplication, linkToGhosts);
}
}
/**
* Set the associations in this to copies of the attributes in source.
*/
public void copyAssociationsFrom (BaseBusinessClass source, boolean linkToGhosts)
{
super.copyAssociationsFrom (source, linkToGhosts);
if (source instanceof BaseNote)
{
BaseNote sourceNote = (BaseNote)(source);
}
}
public void validate (ValidationContext context)
{
super.validate (context);
context.check (getCreatedUserID() != null, this, SINGLEREFERENCE_CreatedUser, "mandatory");
context.check (getJobApplicationID() != null, this, SINGLEREFERENCE_JobApplication, "mandatory");
}
/**
* Subclasses must override this to read in their attributes
*/
protected void readExternalData(Map<String, Object> vals) throws IOException, ClassNotFoundException
{
super.readExternalData(vals);
_Comment = (String)(HELPER_Comment.readExternal (_Comment, vals.get(FIELD_Comment))); //
_CreatedUser.readExternalData(vals.get(SINGLEREFERENCE_CreatedUser));
_JobApplication.readExternalData(vals.get(SINGLEREFERENCE_JobApplication));
}
/**
* Subclasses must override this to write out their attributes
*/
protected void writeExternalData(Map<String, Object> vals) throws IOException
{
super.writeExternalData(vals);
vals.put (FIELD_Comment, HELPER_Comment.writeExternal (_Comment));
vals.put (SINGLEREFERENCE_CreatedUser, _CreatedUser.writeExternalData());
vals.put (SINGLEREFERENCE_JobApplication, _JobApplication.writeExternalData());
}
public void compare (BaseBusinessClass other, AttributeChangeListener listener) throws StorageException
{
super.compare (other, listener);
if (other instanceof BaseNote)
{
BaseNote otherNote = (BaseNote)(other);
if (!HELPER_Comment.compare(this._Comment, otherNote._Comment))
{
listener.notifyFieldChange(this, other, FIELD_Comment, HELPER_Comment.toObject(this._Comment), HELPER_Comment.toObject(otherNote._Comment));
}
// Compare single assocs
_CreatedUser.compare (otherNote._CreatedUser, listener);
_JobApplication.compare (otherNote._JobApplication, 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_Comment, HELPER_Comment.toObject(getComment()));
visitor.visitAssociation (_CreatedUser);
visitor.visitAssociation (_JobApplication);
}
public void visitAssociations (AssociationVisitor visitor, AssociatedScope scope) throws StorageException
{
super.visitAssociations (visitor, scope);
if (scope.includes (_CreatedUser))
{
visitor.visit (_CreatedUser);
}
if (scope.includes (_JobApplication))
{
visitor.visit (_JobApplication);
}
}
public static Note createNote (ObjectTransaction transaction) throws StorageException
{
Note result = new Note ();
result.initialiseNewObject (transaction);
return result;
}
public static Note getNoteByID (ObjectTransaction transaction, Long objectID) throws StorageException
{
return (Note)(transaction.getObjectByID (REFERENCE_Note, objectID));
}
public boolean testFilter (String attribName, QueryFilter filter) throws StorageException
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_Comment))
{
return filter.matches (getComment ());
}
else if (attribName.equals (SINGLEREFERENCE_CreatedUser))
{
return filter.matches (getCreatedUser ());
}
else if (attribName.equals (SINGLEREFERENCE_JobApplication))
{
return filter.matches (getJobApplication ());
}
else
{
return super.testFilter (attribName, filter);
}
}
public static SearchAll SearchByAll () { return new SearchAll (); }
public static class SearchAll extends SearchObject<Note>
{
public SearchAll andObjectID (QueryFilter<Long> filter)
{
filter.addFilter (context, "tl_note.object_id", FIELD_ObjectID);
return this;
}
public SearchAll andObjectCreated (QueryFilter<Date> filter)
{
filter.addFilter (context, "tl_note.object_created_date", FIELD_ObjectCreated);
return this;
}
public SearchAll andObjectLastModified (QueryFilter<Date> filter)
{
filter.addFilter (context, "tl_note.object_last_updated_date", FIELD_ObjectLastModified);
return this;
}
public SearchAll andComment (QueryFilter<String> filter)
{
filter.addFilter (context, "tl_note.comment", "Comment");
return this;
}
public SearchAll andCreatedUser (QueryFilter<CompanyUser> filter)
{
filter.addFilter (context, "tl_note.created_user_id", "CreatedUser");
return this;
}
public SearchAll andJobApplication (QueryFilter<JobApplication> filter)
{
filter.addFilter (context, "tl_note.job_application_id", "JobApplication");
return this;
}
public Note[]
search (ObjectTransaction transaction) throws StorageException
{
BaseBusinessClass[] results = super.search (transaction, REFERENCE_Note, SEARCH_All, criteria);
Set<Note> typedResults = new LinkedHashSet <Note> ();
for (BaseBusinessClass bbcResult : results)
{
Note aResult = (Note)bbcResult;
typedResults.add (aResult);
}
return ObjstoreUtils.removeDeleted(transaction, typedResults).toArray (new Note[0]);
}
}
public static Note[]
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_Comment))
{
return HELPER_Comment.toObject (getComment ());
}
else
{
return super.getAttribute (attribName);
}
}
public AttributeHelper getAttributeHelper (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_Comment))
{
return HELPER_Comment;
}
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_Comment))
{
setComment ((String)(HELPER_Comment.fromObject (_Comment, 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_Comment))
{
return getWriteability_Comment ();
}
else if (fieldName.equals (SINGLEREFERENCE_CreatedUser))
{
return getWriteability_CreatedUser ();
}
else if (fieldName.equals (SINGLEREFERENCE_JobApplication))
{
return getWriteability_JobApplication ();
}
else
{
return super.getWriteable (fieldName);
}
}
public void putUnwriteable (Set<String> fields)
{
if (getWriteability_Comment () != FieldWriteability.TRUE)
{
fields.add (FIELD_Comment);
}
super.putUnwriteable (fields);
}
public List<AbstractAttribute> getAttributes ()
{
List result = super.getAttributes ();
result.add(HELPER_Comment.getAttribObject (getClass (), _Comment, true, FIELD_Comment));
return result;
}
public Map getAttributeMetadata (String attribute)
{
if (ATTRIBUTES_METADATA_Note.containsKey (attribute))
{
return (Map)ATTRIBUTES_METADATA_Note.get (attribute);
}
else
{
return super.getAttributeMetadata (attribute);
}
}
public Object getAttributeMetadata (String attribute, String metadata)
{
if (ATTRIBUTES_METADATA_Note.containsKey (attribute))
{
return ((Map)ATTRIBUTES_METADATA_Note.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 NoteBehaviourDecorator extends BaseBusinessClass.BBCBehaviourDecorator<Note>
{
/**
* Get the attribute Comment
*/
public String getComment (Note obj, String original)
{
return original;
}
/**
* Change the value set for attribute Comment.
* May modify the field beforehand
* Occurs before validation.
*/
public String setComment (Note obj, String newComment) throws FieldException
{
return newComment;
}
}
public ORMPipeLine pipes()
{
return new NotePipeLineFactory<Note, Note> ((Note)this);
}
/**
* Use this instead of pipes() to get rid of type casting.
*/
public NotePipeLineFactory<Note, Note> pipelineNote()
{
return (NotePipeLineFactory<Note, Note>) pipes();
}
public static NotePipeLineFactory<Note, Note> pipesNote(Collection<Note> items)
{
return REFERENCE_Note.new NotePipeLineFactory<Note, Note> (items);
}
public static NotePipeLineFactory<Note, Note> pipesNote(Note[] _items)
{
return pipesNote(Arrays.asList (_items));
}
public static NotePipeLineFactory<Note, Note> pipesNote()
{
return pipesNote((Collection)null);
}
public class NotePipeLineFactory<From extends BaseBusinessClass, Me extends Note> extends BaseBusinessClass.ORMPipeLine<From, Me>
{
public <Prev> NotePipeLineFactory (PipeLine<From, Prev> pipeLine, Pipe<Prev, Me> nextPipe)
{
super (pipeLine, nextPipe);
}
public NotePipeLineFactory (From seed)
{
super(seed);
}
public NotePipeLineFactory (Collection<From> seed)
{
super(seed);
}
public PipeLine<From, ? extends Object> to(String name)
{
if (name.equals ("Comment"))
{
return toComment ();
}
if (name.equals ("CreatedUser"))
{
return toCreatedUser ();
}
if (name.equals ("JobApplication"))
{
return toJobApplication ();
}
return super.to(name);
}
public PipeLine<From, String> toComment () { return pipe(new ORMAttributePipe<Me, String>(FIELD_Comment)); }
public CompanyUser.CompanyUserPipeLineFactory<From, CompanyUser> toCreatedUser () { return toCreatedUser (Filter.ALL); }
public CompanyUser.CompanyUserPipeLineFactory<From, CompanyUser> toCreatedUser (Filter<CompanyUser> filter)
{
return CompanyUser.REFERENCE_CompanyUser.new CompanyUserPipeLineFactory<From, CompanyUser> (this, new ORMSingleAssocPipe<Me, CompanyUser>(SINGLEREFERENCE_CreatedUser, filter));
}
public JobApplication.JobApplicationPipeLineFactory<From, JobApplication> toJobApplication () { return toJobApplication (Filter.ALL); }
public JobApplication.JobApplicationPipeLineFactory<From, JobApplication> toJobApplication (Filter<JobApplication> filter)
{
return JobApplication.REFERENCE_JobApplication.new JobApplicationPipeLineFactory<From, JobApplication> (this, new ORMSingleAssocPipe<Me, JobApplication>(SINGLEREFERENCE_JobApplication, filter));
}
}
public boolean isTransientAttrib(String attribName)
{
return super.isTransientAttrib(attribName);
}
public boolean isTransientSingleReference(String assocName)
{
return super.isTransientSingleReference(assocName);
}
}
class DummyNote extends Note
{
// Default constructor primarily to support Externalisable
public DummyNote()
{
super();
}
public void assertValid ()
{
}
public CompanyUser getCreatedUser () throws StorageException
{
return (CompanyUser)(CompanyUser.DUMMY_CompanyUser);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getCreatedUserID ()
{
return CompanyUser.DUMMY_CompanyUser.getObjectID();
}
public JobApplication getJobApplication () throws StorageException
{
return (JobApplication)(JobApplication.DUMMY_JobApplication);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getJobApplicationID ()
{
return JobApplication.DUMMY_JobApplication.getObjectID();
}
}
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<IMPORT value="performa.orm.types.*"/> <IMPORT value="performa.orm.types.*"/>
<MULTIPLEREFERENCE name="AssessmentCriteriaAnswers" type="AssessmentCriteriaAnswer" backreferenceName="JobApplication" /> <MULTIPLEREFERENCE name="AssessmentCriteriaAnswers" type="AssessmentCriteriaAnswer" backreferenceName="JobApplication" />
<MULTIPLEREFERENCE name="Notes" type="Note" backreferenceName="JobApplication" />
<TRANSIENT name="AppProcessOption" type="AppProcessOption" attribHelper="EnumeratedAttributeHelper"/> <TRANSIENT name="AppProcessOption" type="AppProcessOption" attribHelper="EnumeratedAttributeHelper"/>
<TRANSIENT name="OverallRank" type="Integer" /> <TRANSIENT name="OverallRank" type="Integer" />
...@@ -13,6 +14,7 @@ ...@@ -13,6 +14,7 @@
<TRANSIENT name="RequirementFit" type="Map" attribHelper="BLOBAttributeHelper" attribHelperInstance="BLOBAttributeHelper.INSTANCE"/> <TRANSIENT name="RequirementFit" type="Map" attribHelper="BLOBAttributeHelper" attribHelperInstance="BLOBAttributeHelper.INSTANCE"/>
<TRANSIENT name="CultureFit" type="Map" attribHelper="BLOBAttributeHelper" attribHelperInstance="BLOBAttributeHelper.INSTANCE"/> <TRANSIENT name="CultureFit" type="Map" attribHelper="BLOBAttributeHelper" attribHelperInstance="BLOBAttributeHelper.INSTANCE"/>
<TRANSIENT name="FactorScoreDetails" type="Map" attribHelper="BLOBAttributeHelper" attribHelperInstance="BLOBAttributeHelper.INSTANCE"/> <TRANSIENT name="FactorScoreDetails" type="Map" attribHelper="BLOBAttributeHelper" attribHelperInstance="BLOBAttributeHelper.INSTANCE"/>
<TRANSIENT name="Note" type="String" />
<TRANSIENTSINGLE name="WorkFlow" type="WorkFlow" /> <TRANSIENTSINGLE name="WorkFlow" type="WorkFlow" />
......
package performa.orm;
public class Note extends BaseNote
{
private static final long serialVersionUID = 0L;
// This constructor should not be called
public Note ()
{
// Do not add any code to this, always put it in initialiseNewObject
}
}
\ No newline at end of file
<?xml version="1.0"?>
<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='http://www.oneit.com.au/schemas/5.2/BusinessObject.xsd'>
<BUSINESSCLASS name="Note" package="performa.orm">
<IMPORT value="oneit.security.*"/>
<TABLE name="tl_note" tablePrefix="object" polymorphic="FALSE">
<ATTRIB name="Comment" type="String" dbcol="comment" length="1000" mandatory="true"/>
<SINGLEREFERENCE name="CreatedUser" type="CompanyUser" dbcol="created_user_id" mandatory="true" />
<SINGLEREFERENCE name="JobApplication" type="JobApplication" dbcol="job_application_id" mandatory="true" backreferenceName="Notes"/>
</TABLE>
<SEARCH type="All" paramFilter="object_id is not null"/>
</BUSINESSCLASS>
</ROOT>
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 oneit.security.*;
/**
* IMPORTANT!!!! Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2[oneit.objstore.PersistenceMgrTemplate.xsl]
*/
public class NotePersistenceMgr extends ObjectPersistenceMgr
{
private static final LoggingArea NotePersistence = LoggingArea.createLoggingArea(ObjectPersistenceMgr.OBJECT_PERSISTENCE, "Note");
// Private attributes corresponding to business object data
private String dummyComment;
// Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper HELPER_Comment = DefaultAttributeHelper.INSTANCE;
public NotePersistenceMgr ()
{
dummyComment = (String)(HELPER_Comment.initialise (dummyComment));
}
private String SELECT_COLUMNS = "{PREFIX}tl_note.object_id as id, {PREFIX}tl_note.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_note.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_note.comment, {PREFIX}tl_note.created_user_id, {PREFIX}tl_note.job_application_id, 1 AS commasafe ";
private String SELECT_JOINS = "";
public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
Set<BaseBusinessClass> resultByIDs = fetchByIDs(Collections.singleton (id), allPSets, context, sqlMgr);
if (resultByIDs.isEmpty ())
{
return null;
}
else if (resultByIDs.size () > 1)
{
throw new StorageException ("Multiple results for id:" + id);
}
else
{
return resultByIDs.iterator ().next ();
}
}
public Set<BaseBusinessClass> fetchByIDs(Set<ObjectID> ids, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
Set<BaseBusinessClass> results = new HashSet ();
Set<Long> idsToFetch = new HashSet ();
for (ObjectID id : ids)
{
if (context.containsObject(id)) // Check for cached version
{
BaseBusinessClass objectToReturn = context.getObjectToReplace(id, Note.REFERENCE_Note);
if (objectToReturn instanceof Note)
{
LogMgr.log (NotePersistence, 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 Note");
}
}
PersistentSet tl_notePSet = allPSets.getPersistentSet(id, "tl_note", PersistentSetStatus.FETCHED);
// Check for persistent sets already prefetched
if (false || !tl_notePSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!tl_notePSet.containsAttrib(Note.FIELD_Comment)||
!tl_notePSet.containsAttrib(Note.SINGLEREFERENCE_CreatedUser)||
!tl_notePSet.containsAttrib(Note.SINGLEREFERENCE_JobApplication))
{
// We will need to retrieve it
idsToFetch.add (id.longValue());
}
else
{
LogMgr.log (NotePersistence, LogLevel.DEBUG2, "Persistent set preloaded id:", id);
/* Non Polymorphic */
Note result = new Note ();
result.setFromPersistentSets(id, allPSets);
context.addRetrievedObject(result);
results.add (result);
}
}
if (idsToFetch.size () > 0)
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_note " +
"WHERE " + SELECT_JOINS + "{PREFIX}tl_note.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 (Note.SINGLEREFERENCE_JobApplication))
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_note " +
"WHERE " + SELECT_JOINS + "job_application_id = ?";
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, new Object[] { _objectID.longID () }, null, false);
return results;
}
else
{
throw new IllegalArgumentException ("Illegal reference type:" + refName);
}
}
public void update(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, ConcurrentUpdateConflictException, StorageException
{
EqualityResult test = EqualityResult.compare (obj, obj.getBackup ());
ObjectID objectID = obj.getID ();
if (!test.areAttributesEqual () || !test.areSingleAssocsEqual () || obj.getForcedSave())
{
PersistentSet tl_notePSet = allPSets.getPersistentSet(objectID, "tl_note");
if (tl_notePSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_notePSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}tl_note " +
"SET comment = ?, created_user_id = ? , job_application_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE tl_note.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_Comment.getForSQL(dummyComment, tl_notePSet.getAttrib (Note.FIELD_Comment))).listEntry (SQLManager.CheckNull((Long)(tl_notePSet.getAttrib (Note.SINGLEREFERENCE_CreatedUser)))).listEntry (SQLManager.CheckNull((Long)(tl_notePSet.getAttrib (Note.SINGLEREFERENCE_JobApplication)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
if (rowsUpdated != 1)
{
// Error, either a concurrency error or a not-exists error
ResultSet r = executeQuery (sqlMgr,
"SELECT object_id, object_LAST_UPDATED_DATE FROM {PREFIX}tl_note 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_note", objectID.longID (), obj.getObjectLastModified (), d },
sqlMgr.getPortabilityServices ());
LogMgr.log (NotePersistence, LogLevel.BUSINESS1, errorMsg);
throw new ConcurrentUpdateConflictException (obj, "tl_note");
}
else
{
String errorMsg = "Attempt to update nonexistent row in table:tl_note for row:" + objectID + " objDate:" + obj.getObjectLastModified ();
LogMgr.log (NotePersistence, LogLevel.BUSINESS1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
tl_notePSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
else
{
LogMgr.log (NotePersistence, 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_notePSet = allPSets.getPersistentSet(objectID, "tl_note");
LogMgr.log (NotePersistence, LogLevel.DEBUG2, "Deleting:", objectID);
if (tl_notePSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_notePSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsDeleted = executeStatement (sqlMgr,
"DELETE " +
"FROM {PREFIX}tl_note " +
"WHERE tl_note.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_note WHERE object_id = ?",
new Object[] { objectID.longID() });
if (r.next ())
{
throw new ConcurrentUpdateConflictException (obj, "tl_note");
}
else
{
String errorMsg = "Attempt to delete nonexistent row in table:tl_note for row:" + objectID;
LogMgr.log (NotePersistence, LogLevel.SYSTEMERROR1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
tl_notePSet.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, Note> results = new LinkedHashMap ();
ResultSet r = executeQuery (sqlMgr, query, params);
while (r.next())
{
ThreadUtils.checkInterrupted ();
ObjectID objectID = new ObjectID (Note.REFERENCE_Note.getObjectIDSpace (), r.getLong ("id"));
Note 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, Note.REFERENCE_Note);
if (cachedElement instanceof Note)
{
LogMgr.log (NotePersistence, LogLevel.TRACE, "Cache hit for id:", objectID);
resultElement = (Note)cachedElement;
}
else
{
throw new StorageException ("Cache collision for id:" + objectID + " with object " + cachedElement + "while fetching a Note");
}
}
else
{
PersistentSet tl_notePSet = allPSets.getPersistentSet(objectID, "tl_note", PersistentSetStatus.FETCHED);
createPersistentSetFromRS(allPSets, r, objectID);
resultElement = new Note ();
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 (NotePersistence, 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_note " + tables +
"WHERE " + SELECT_JOINS + " " + customParamFilter + customOrderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, null, false);
return results;
}
else if (searchType.equals (Note.SEARCH_All))
{
// Local scope for transformed variables
{
}
String orderBy = " ";
String tables = " ";
Set<String> joinTableSet = new HashSet<String>();
String filter;
Object[] searchParams; // paramFilter: object_id is not null
String preFilter = "(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_note " + 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_notePSet = allPSets.getPersistentSet(objectID, "tl_note", PersistentSetStatus.FETCHED);
// Object Modified
tl_notePSet.setAttrib(BaseBusinessClass.FIELD_ObjectLastModified, r.getTimestamp ("LAST_UPDATED_DATE"));
// Object Created
tl_notePSet.setAttrib(BaseBusinessClass.FIELD_ObjectCreated, r.getTimestamp ("CREATED_DATE"));
tl_notePSet.setAttrib(Note.FIELD_Comment, HELPER_Comment.getFromRS(dummyComment, r, "comment"));
tl_notePSet.setAttrib(Note.SINGLEREFERENCE_CreatedUser, r.getObject ("created_user_id"));
tl_notePSet.setAttrib(Note.SINGLEREFERENCE_JobApplication, r.getObject ("job_application_id"));
}
public void create(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet tl_notePSet = allPSets.getPersistentSet(objectID, "tl_note");
if (tl_notePSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_notePSet.getStatus () != PersistentSetStatus.DEFERRED)
{
executeStatement (sqlMgr,
"INSERT INTO {PREFIX}tl_note " +
" (comment, created_user_id, job_application_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " +
" (?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_Comment.getForSQL(dummyComment, tl_notePSet.getAttrib (Note.FIELD_Comment))) .listEntry (SQLManager.CheckNull((Long)(tl_notePSet.getAttrib (Note.SINGLEREFERENCE_CreatedUser)))).listEntry (SQLManager.CheckNull((Long)(tl_notePSet.getAttrib (Note.SINGLEREFERENCE_JobApplication)))) .listEntry (objectID.longID ()).toList().toArray());
tl_notePSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
}
...@@ -3693,7 +3693,7 @@ span.appli-progress-bar { ...@@ -3693,7 +3693,7 @@ span.appli-progress-bar {
margin-bottom: 10px; margin-bottom: 10px;
text-align: left; text-align: left;
} }
input.add-note-btn { button.add-note-btn {
display: inline-block; display: inline-block;
height: 30px; height: 30px;
border-radius: 100px; border-radius: 100px;
...@@ -3708,7 +3708,7 @@ input.add-note-btn { ...@@ -3708,7 +3708,7 @@ input.add-note-btn {
padding: 0; padding: 0;
width: 100px; width: 100px;
} }
input.add-note-btn:hover{ button.add-note-btn:hover{
background-color: #434c58; background-color: #434c58;
} }
.note-txt-box { .note-txt-box {
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
<FORM name="*.loadRequirementsFromTemplate" factory="Participant" class="performa.form.LoadRequirementsFromTemplateFP"/> <FORM name="*.loadRequirementsFromTemplate" factory="Participant" class="performa.form.LoadRequirementsFromTemplateFP"/>
<FORM name="*.loadCultureFromTemplate" factory="Participant" class="performa.form.LoadCultureFromTemplateFP"/> <FORM name="*.loadCultureFromTemplate" factory="Participant" class="performa.form.LoadCultureFromTemplateFP"/>
<FORM name="*.changeApplicationStatus" factory="Participant" class="performa.form.ChangeApplicationStatusFP"/> <FORM name="*.changeApplicationStatus" factory="Participant" class="performa.form.ChangeApplicationStatusFP"/>
<FORM name="*.addNote" factory="Participant" class="performa.form.AddNoteFP"/>
<FORM name="*.bulkupdate" factory="Participant" class="performa.form.BulkUpdateFP"/> <FORM name="*.bulkupdate" factory="Participant" class="performa.form.BulkUpdateFP"/>
<FORM name="*.navigateBetweenStatus" factory="Participant" class="performa.form.NavigateBetweenStatusFP"/> <FORM name="*.navigateBetweenStatus" factory="Participant" class="performa.form.NavigateBetweenStatusFP"/>
<FORM name="*.sendCompanyUserInvites" factory="Participant" class="performa.form.SendCompanyUserInvitesFP"> <FORM name="*.sendCompanyUserInvites" factory="Participant" class="performa.form.SendCompanyUserInvitesFP">
......
...@@ -657,24 +657,32 @@ ...@@ -657,24 +657,32 @@
} }
%> %>
</div> </div>
<%--
<div class="applicant-note" > <div class="applicant-note" >
<div class="applicant-note-title">Notes</div> <div class="applicant-note-title">Notes</div>
<div class="note-txt-box"> <div class="note-txt-box">
<textarea class="form-control"></textarea> <oneit:ormtextarea obj="<%= jobApplication %>" attributeName="Note" cssClass="form-control"/>
<input type="button" class="add-note-btn" value="ADD NOTE" /> <oneit:button name="addNote" value="ADD NOTE" cssClass="add-note-btn"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", currentPage)
.mapEntry ("restartProcess", Boolean.TRUE)
.mapEntry("procParams", CollectionUtils.mapEntry("JobApplication", jobApplication).mapEntry("Applications", applications).mapEntry("Job", job).toMap())
.mapEntry ("attribNamesToRestore", new HashSet<String> (Arrays.asList(new String[] {"Job", "JobApplication", "Applications"})))
.mapEntry("JobApplication", jobApplication)
.toMap() %>" />
</div> </div>
</div> </div>
<div class="admin-notes"> <div class="admin-notes">
<div class="admin-name">Admin name</div> <%
<div class="date-value">TODAY</div> for (Note note : jobApplication.getNotesSet())
<div class="admin-text">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent accumsan interdum nisi, sed laoreet dui rhoncus.</div> {
%>
<div class="admin-name"><oneit:toString value="<%= note.getCreatedUser() %>" mode="EscapeHTML"/></div>
<div class="date-value"><oneit:toString value="<%= note.getObjectCreated() %>" mode="MidDate"/></div>
<div class="admin-text"><oneit:toString value="<%= note.getComment() %>" mode="EscapeHTML"/></div>
<div class="admin-br-line"></div> <div class="admin-br-line"></div>
<div class="admin-name">Admin name</div> <%
<div class="date-value">2 days ago</div> }
<div class="admin-text">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div> %>
</div> </div>
--%>
</div> </div>
</div> </div>
</div> </div>
......
<?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_note</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="comment" type="String" nullable="false" length="1000"/>
<column name="created_user_id" type="Long" length="11" nullable="false"/>
<column name="job_application_id" type="Long" length="11" nullable="false"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_note" indexName="idx_tl_note_job_application_id" isUnique="false">
<column name="job_application_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