Commit 7a0eb8e3 by Nilu

fix issue with search applicant

parent 82dc9710
......@@ -9,7 +9,6 @@
<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="xxxx" type="CLOB" nullable="true"/>
<column name="xxxx" type="Long" length="11" nullable="true"/>
</NODE>
</NODE></OBJECTS>
\ No newline at end of file
......@@ -8,8 +8,7 @@ CREATE TABLE it_does_not_matter (
object_last_updated_date datetime DEFAULT getdate() NOT NULL ,
object_created_date datetime DEFAULT getdate() NOT NULL
,
xxxx text NULL,
xxxx numeric(12) NULL
xxxx text NULL
);
......
......@@ -9,8 +9,7 @@ CREATE TABLE it_does_not_matter (
object_last_updated_date date DEFAULT SYSDATE NOT NULL ,
object_created_date date DEFAULT SYSDATE NOT NULL
,
xxxx clob NULL,
xxxx number(12) NULL
xxxx clob NULL
);
......
......@@ -9,8 +9,7 @@ CREATE TABLE it_does_not_matter (
object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
object_created_date timestamp DEFAULT NOW() NOT NULL
,
xxxx text NULL,
xxxx numeric(12) NULL
xxxx text NULL
);
......
......@@ -28,8 +28,6 @@ import oneit.utils.parsers.FieldException;
import oneit.servlets.orm.*;
import performa.orm.*;
public abstract class BaseSearchApplicant extends SearchExecutor
......@@ -43,7 +41,6 @@ public abstract class BaseSearchApplicant extends SearchExecutor
// Static constants corresponding to field names
public static final String FIELD_Details = "Details";
public static final String SINGLEREFERENCE_Job = "Job";
// Static constants corresponding to searches
......@@ -57,7 +54,6 @@ public abstract class BaseSearchApplicant extends SearchExecutor
// Private attributes corresponding to single references
private SingleAssociation<SearchApplicant, Job> _Job;
// Private attributes corresponding to multiple references
......@@ -81,7 +77,6 @@ public abstract class BaseSearchApplicant extends SearchExecutor
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
setupAssocMetaData_Job();
FIELD_Details_Validators = (AttributeValidator[])setupAttribMetaData_Details(validatorMapping).toArray (new AttributeValidator[0]);
......@@ -98,20 +93,6 @@ public abstract class BaseSearchApplicant extends SearchExecutor
// Meta Info setup
private static void setupAssocMetaData_Job()
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "xxxx");
metaInfo.put ("name", "Job");
metaInfo.put ("type", "Job");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for SearchApplicant.Job:", metaInfo);
ATTRIBUTES_METADATA_SearchApplicant.put (SINGLEREFERENCE_Job, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static List setupAttribMetaData_Details(Map validatorMapping)
{
Map metaInfo = new HashMap ();
......@@ -165,7 +146,6 @@ public abstract class BaseSearchApplicant extends SearchExecutor
{
super._initialiseAssociations ();
_Job = new SingleAssociation<SearchApplicant, Job> (this, SINGLEREFERENCE_Job, null, Job.REFERENCE_Job, "it_does_not_matter");
}
......@@ -175,7 +155,6 @@ public abstract class BaseSearchApplicant extends SearchExecutor
{
super.initialiseReference ();
_Job = new SingleAssociation<SearchApplicant, Job> (this, SINGLEREFERENCE_Job, null, Job.REFERENCE_Job, "it_does_not_matter");
return this;
......@@ -291,8 +270,6 @@ public abstract class BaseSearchApplicant extends SearchExecutor
List result = super.getSingleAssocs ();
result.add("Job");
return result;
}
......@@ -304,10 +281,7 @@ public abstract class BaseSearchApplicant extends SearchExecutor
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Job))
{
return _Job.getReferencedType ();
}
else
{
return super.getSingleAssocReferenceInstance (assocName);
......@@ -321,10 +295,7 @@ public abstract class BaseSearchApplicant extends SearchExecutor
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Job))
{
return null ;
}
else
{
return super.getSingleAssocBackReference (assocName);
......@@ -338,10 +309,7 @@ public abstract class BaseSearchApplicant extends SearchExecutor
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Job))
{
return getJob ();
}
else
{
return super.getSingleAssoc (assocName);
......@@ -355,10 +323,7 @@ public abstract class BaseSearchApplicant extends SearchExecutor
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Job))
{
return getJob (getType);
}
else
{
return super.getSingleAssoc (assocName, getType);
......@@ -372,10 +337,7 @@ public abstract class BaseSearchApplicant extends SearchExecutor
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Job))
{
return getJobID ();
}
else
{
return super.getSingleAssocID (assocName);
......@@ -389,111 +351,14 @@ public abstract class BaseSearchApplicant extends SearchExecutor
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_Job))
{
setJob ((Job)(newValue));
}
else
{
super.setSingleAssoc (assocName, newValue);
}
}
/**
* Get the reference Job
*/
public Job getJob () throws StorageException
{
assertValid();
try
{
return (Job)(_Job.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in SearchApplicant:", this.getObjectID (), ", was trying to get Job:", getJobID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _Job.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Job getJob (Get getType) throws StorageException
{
assertValid();
return _Job.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getJobID ()
{
assertValid();
if (_Job == null)
{
return null;
}
else
{
return _Job.getID ();
super.setSingleAssoc (assocName, newValue);
}
}
/**
* Called prior to the assoc changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preJobChange (Job newJob) throws FieldException
{
}
/**
* Called after the assoc changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postJobChange () throws FieldException
{
}
public FieldWriteability getWriteability_Job ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference Job. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setJob (Job newJob) throws StorageException, FieldException
{
if (_Job.wouldReferencedChange (newJob))
{
assertValid();
Debug.assertion (getWriteability_Job () != FieldWriteability.FALSE, "Assoc Job is not writeable");
preJobChange (newJob);
_Job.set (newJob);
postJobChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
......@@ -654,7 +519,6 @@ public abstract class BaseSearchApplicant extends SearchExecutor
it_does_not_matterPSet.setAttrib (FIELD_ObjectID, myID);
it_does_not_matterPSet.setAttrib (FIELD_Details, HELPER_Details.toObject (_Details)); //
_Job.getPersistentSets (allSets);
}
......@@ -670,7 +534,6 @@ public abstract class BaseSearchApplicant extends SearchExecutor
PersistentSet it_does_not_matterPSet = allSets.getPersistentSet (objectID, "it_does_not_matter");
_Details = (String)(HELPER_Details.fromObject (_Details, it_does_not_matterPSet.getAttrib (FIELD_Details))); //
_Job.setFromPersistentSets (objectID, allSets);
}
......@@ -727,7 +590,6 @@ public abstract class BaseSearchApplicant extends SearchExecutor
{
BaseSearchApplicant sourceSearchApplicant = (BaseSearchApplicant)(source);
_Job.copyFrom (sourceSearchApplicant._Job, linkToGhosts);
}
}
......@@ -765,7 +627,6 @@ public abstract class BaseSearchApplicant extends SearchExecutor
super.readExternalData(vals);
_Details = (String)(HELPER_Details.readExternal (_Details, vals.get(FIELD_Details))); //
_Job.readExternalData(vals.get(SINGLEREFERENCE_Job));
}
......@@ -778,7 +639,6 @@ public abstract class BaseSearchApplicant extends SearchExecutor
super.writeExternalData(vals);
vals.put (FIELD_Details, HELPER_Details.writeExternal (_Details));
vals.put (SINGLEREFERENCE_Job, _Job.writeExternalData());
}
......@@ -798,7 +658,6 @@ public abstract class BaseSearchApplicant extends SearchExecutor
}
// Compare single assocs
_Job.compare (otherSearchApplicant._Job, listener);
// Compare multiple assocs
......@@ -820,7 +679,6 @@ public abstract class BaseSearchApplicant extends SearchExecutor
super.visitAttributes (visitor);
visitor.visitField(this, FIELD_Details, HELPER_Details.toObject(getDetails()));
visitor.visitAssociation (_Job);
}
......@@ -829,10 +687,6 @@ public abstract class BaseSearchApplicant extends SearchExecutor
{
super.visitAssociations (visitor, scope);
if (scope.includes (_Job))
{
visitor.visit (_Job);
}
}
......@@ -862,10 +716,6 @@ public abstract class BaseSearchApplicant extends SearchExecutor
{
return filter.matches (getDetails ());
}
else if (attribName.equals (SINGLEREFERENCE_Job))
{
return filter.matches (getJob ());
}
else
{
return super.testFilter (attribName, filter);
......@@ -943,10 +793,6 @@ public abstract class BaseSearchApplicant extends SearchExecutor
{
return getWriteability_Details ();
}
else if (fieldName.equals (SINGLEREFERENCE_Job))
{
return getWriteability_Job ();
}
else
{
return super.getWriteable (fieldName);
......@@ -1096,10 +942,6 @@ public abstract class BaseSearchApplicant extends SearchExecutor
{
return toDetails ();
}
if (name.equals ("Job"))
{
return toJob ();
}
return super.to(name);
......@@ -1107,12 +949,6 @@ public abstract class BaseSearchApplicant extends SearchExecutor
public PipeLine<From, String> toDetails () { return pipe(new ORMAttributePipe<Me, String>(FIELD_Details)); }
public Job.JobPipeLineFactory<From, Job> toJob () { return toJob (Filter.ALL); }
public Job.JobPipeLineFactory<From, Job> toJob (Filter<Job> filter)
{
return Job.REFERENCE_Job.new JobPipeLineFactory<From, Job> (this, new ORMSingleAssocPipe<Me, Job>(SINGLEREFERENCE_Job, filter));
}
}
......@@ -1144,20 +980,6 @@ class DummySearchApplicant extends SearchApplicant
}
public Job getJob () throws StorageException
{
return (Job)(Job.DUMMY_Job);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getJobID ()
{
return Job.DUMMY_Job.getObjectID();
}
}
package performa.search;
import oneit.objstore.BaseBusinessClass;
import oneit.objstore.rdbms.filters.EqualsFilter;
import performa.orm.JobApplication;
public class SearchApplicant extends BaseSearchApplicant
{
......@@ -14,13 +10,4 @@ public class SearchApplicant extends BaseSearchApplicant
{
// Do not add any code to this, always put it in initialiseNewObject
}
@Override
public BaseBusinessClass[] doSearch()
{
return JobApplication.SearchByDetails()
.byName(getDetails())
.andJob(new EqualsFilter<>(getJob()))
.search(getTransaction());
}
}
\ No newline at end of file
......@@ -2,7 +2,7 @@
<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='http://www.oneit.com.au/schemas/5.2/BusinessObject.xsd'>
<BUSINESSCLASS name="SearchJob" package="performa.search" superclass="SearchExecutor" >
<BUSINESSCLASS name="SearchApplicant" package="performa.search" superclass="SearchExecutor" >
<IMPORT value="oneit.servlets.orm.*" />
......
......@@ -15,7 +15,6 @@ import oneit.utils.resource.*;
import oneit.utils.*;
import oneit.utils.threading.*;
import oneit.servlets.orm.*;
import performa.orm.*;
......@@ -43,7 +42,7 @@ public class SearchApplicantPersistenceMgr extends SearchExecutorPersistenceMgr
}
private String SELECT_COLUMNS = "{PREFIX}it_does_not_matter.object_id as id, {PREFIX}it_does_not_matter.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}it_does_not_matter.object_CREATED_DATE as CREATED_DATE, {PREFIX}it_does_not_matter.xxxx, {PREFIX}it_does_not_matter.xxxx, 1 AS commasafe ";
private String SELECT_COLUMNS = "{PREFIX}it_does_not_matter.object_id as id, {PREFIX}it_does_not_matter.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}it_does_not_matter.object_CREATED_DATE as CREATED_DATE, {PREFIX}it_does_not_matter.xxxx, 1 AS commasafe ";
private String SELECT_JOINS = "";
public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
......@@ -94,8 +93,7 @@ public class SearchApplicantPersistenceMgr extends SearchExecutorPersistenceMgr
// Check for persistent sets already prefetched
if (false || !it_does_not_matterPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!it_does_not_matterPSet.containsAttrib(SearchApplicant.FIELD_Details)||
!it_does_not_matterPSet.containsAttrib(SearchApplicant.SINGLEREFERENCE_Job))
!it_does_not_matterPSet.containsAttrib(SearchApplicant.FIELD_Details))
{
// We will need to retrieve it
idsToFetch.add (id.longValue());
......@@ -165,10 +163,10 @@ public class SearchApplicantPersistenceMgr extends SearchExecutorPersistenceMgr
{
int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}it_does_not_matter " +
"SET xxxx = ?, xxxx = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"SET xxxx = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE it_does_not_matter.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_Details.getForSQL(dummyDetails, it_does_not_matterPSet.getAttrib (SearchApplicant.FIELD_Details))).listEntry (SQLManager.CheckNull((Long)(it_does_not_matterPSet.getAttrib (SearchApplicant.SINGLEREFERENCE_Job)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
CollectionUtils.listEntry (HELPER_Details.getForSQL(dummyDetails, it_does_not_matterPSet.getAttrib (SearchApplicant.FIELD_Details))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
if (rowsUpdated != 1)
{
......@@ -404,7 +402,6 @@ public class SearchApplicantPersistenceMgr extends SearchExecutorPersistenceMgr
it_does_not_matterPSet.setAttrib(SearchApplicant.FIELD_Details, HELPER_Details.getFromRS(dummyDetails, r, "xxxx"));
it_does_not_matterPSet.setAttrib(SearchApplicant.SINGLEREFERENCE_Job, r.getObject ("xxxx"));
}
......@@ -421,10 +418,10 @@ public class SearchApplicantPersistenceMgr extends SearchExecutorPersistenceMgr
{
executeStatement (sqlMgr,
"INSERT INTO {PREFIX}it_does_not_matter " +
" (xxxx, xxxx, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
" (xxxx, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " +
" (?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_Details.getForSQL(dummyDetails, it_does_not_matterPSet.getAttrib (SearchApplicant.FIELD_Details))) .listEntry (SQLManager.CheckNull((Long)(it_does_not_matterPSet.getAttrib (SearchApplicant.SINGLEREFERENCE_Job)))) .listEntry (objectID.longID ()).toList().toArray());
" (?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_Details.getForSQL(dummyDetails, it_does_not_matterPSet.getAttrib (SearchApplicant.FIELD_Details))) .listEntry (objectID.longID ()).toList().toArray());
it_does_not_matterPSet.setStatus (PersistentSetStatus.PROCESSED);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment