Commit 26f41df1 by chenith Committed by Harsh Shah

Update applicant job overview- search job with id and key.

parent 99117632
......@@ -61,6 +61,7 @@ public abstract class BaseJob extends BaseBusinessClass
// Static constants corresponding to searches
public static final String SEARCH_All = "All";
public static final String SEARCH_JobKey = "JobKey";
// Static constants corresponding to attribute helpers
......@@ -2597,6 +2598,123 @@ public abstract class BaseJob extends BaseBusinessClass
.search (transaction);
}
public static SearchJobKey SearchByJobKey () { return new SearchJobKey (); }
public static class SearchJobKey extends SearchObject<Job>
{
public SearchJobKey byID (Long ID)
{
by ("ID", ID);
return this;
}
public SearchJobKey byKey (String Key)
{
by ("Key", Key);
return this;
}
public SearchJobKey andObjectID (QueryFilter<Long> filter)
{
filter.addFilter (context, "tl_job.object_id", FIELD_ObjectID);
return this;
}
public SearchJobKey andObjectCreated (QueryFilter<Date> filter)
{
filter.addFilter (context, "tl_job.object_created_date", FIELD_ObjectCreated);
return this;
}
public SearchJobKey andObjectLastModified (QueryFilter<Date> filter)
{
filter.addFilter (context, "tl_job.object_last_updated_date", FIELD_ObjectLastModified);
return this;
}
public SearchJobKey andJobTitle (QueryFilter<String> filter)
{
filter.addFilter (context, "tl_job.job_title", "JobTitle");
return this;
}
public SearchJobKey andJobDescription (QueryFilter<String> filter)
{
filter.addFilter (context, "tl_job.job_description", "JobDescription");
return this;
}
public SearchJobKey andJobStatus (QueryFilter<JobStatus> filter)
{
filter.addFilter (context, "tl_job.job_status", "JobStatus");
return this;
}
public SearchJobKey andApplyBy (QueryFilter<Date> filter)
{
filter.addFilter (context, "tl_job.apply_by", "ApplyBy");
return this;
}
public SearchJobKey andIncludeAssessmentCriteria (QueryFilter<Boolean> filter)
{
filter.addFilter (context, "tl_job.include_assessment_criteria", "IncludeAssessmentCriteria");
return this;
}
public SearchJobKey andAssessmentType (QueryFilter<AssessmentType> filter)
{
filter.addFilter (context, "tl_job.assessment_type", "AssessmentType");
return this;
}
public SearchJobKey andRandomKey (QueryFilter<String> filter)
{
filter.addFilter (context, "tl_job.random_key", "RandomKey");
return this;
}
public SearchJobKey andLevel (QueryFilter<Level> filter)
{
filter.addFilter (context, "tl_job.level_id", "Level");
return this;
}
public SearchJobKey andSecUser (QueryFilter<SecUser> filter)
{
filter.addFilter (context, "tl_job.secuser_id", "SecUser");
return this;
}
public Job search (ObjectTransaction transaction) throws StorageException
{
BaseBusinessClass[] results = super.search (transaction, REFERENCE_Job, SEARCH_JobKey, criteria);
Set<Job> typedResults = new LinkedHashSet <Job> ();
for (BaseBusinessClass bbcResult : results)
{
Job aResult = (Job)bbcResult;
typedResults.add (aResult);
}
return (Job)singletonResult(ObjstoreUtils.removeDeleted(transaction, typedResults).toArray(new BaseBusinessClass[0]), "Job", "");
}
}
public static Job searchJobKey (ObjectTransaction transaction, Long ID, String Key) throws StorageException
{
return SearchByJobKey ()
.byID (ID)
.byKey (Key)
.search (transaction);
}
public Object getAttribute (String attribName)
......
......@@ -29,6 +29,11 @@
<SEARCH type="All" paramFilter="tl_job.object_id is not null" orderBy="tl_job.object_id" />
<SEARCH type="JobKey" paramFilter="tl_job.object_id is not null" singleton="TRUE">
<PARAM name="ID" type="Long" paramFilter="object_id = ${ID} " />
<PARAM name="Key" type="String" paramFilter="random_key = ${Key}" />
</SEARCH>
</BUSINESSCLASS>
</ROOT>
\ No newline at end of file
......@@ -281,6 +281,10 @@ public class JobPersistenceMgr extends ObjectPersistenceMgr
{
throw new RuntimeException ("NOT implemented: executeSearchQueryAll");
}
public ResultSet executeSearchQueryJobKey (SQLManager sqlMgr, Long ID, String Key) throws SQLException
{
throw new RuntimeException ("NOT implemented: executeSearchQueryJobKey");
}
......@@ -430,6 +434,58 @@ public class JobPersistenceMgr extends ObjectPersistenceMgr
return results;
}
else if (searchType.equals (Job.SEARCH_JobKey))
{
// Local scope for transformed variables
{
}
String orderBy = " ";
String tables = " ";
Set<String> joinTableSet = new HashSet<String>();
String filter;
Object[] searchParams; // paramFilter: tl_job.object_id is not null
String preFilter = "(tl_job.object_id is not null)"
+ " ";
if (criteria.containsKey("ID"))
{
preFilter += " AND (object_id = ${ID} ) ";
preFilter += "";
}
if (criteria.containsKey("Key"))
{
preFilter += " AND (random_key = ${Key}) ";
preFilter += "";
}
preFilter += context.getLoadingAttributes ().getCustomSQL() ;
SearchParamTransform tx = new SearchParamTransform (criteria);
filter = StringUtils.replaceParams (preFilter, tx);
searchParams = tx.getParamsArray();
Integer maxRows = context.getLoadingAttributes ().getMaxRows ();
boolean truncateExtra = !context.getLoadingAttributes ().isFailIfMaxExceeded();
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_job " + tables + tableSetToSQL(joinTableSet) +
"WHERE " + SELECT_JOINS + " " + filter + orderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, maxRows, truncateExtra);
return results;
}
else
{
......
......@@ -8,11 +8,12 @@
ObjectTransaction objTran = (process == null ? ObjectTransaction.getTransaction () : process.getTransaction ());
String nextPage = WebUtils.getSamePageInRenderMode(request, "SignIn");
Job job = (Job) process.getAttribute("Job");
String jobID = request.getParameter("jobID");
String id = request.getParameter("id");
String key = request.getParameter("key");
if(jobID!=null)
if(id!=null && key!=null)
{
job = Job.getJobByID(objTran, Long.parseLong(jobID));
job = Job.searchJobKey(objTran, Long.parseLong(id), key);
}
if(job!=null)
......
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