Commit 2451416b by Nilu

changes to accommodate workfflows in HT003

parent 683e0484
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
<column name="object_last_updated_date" type="Date" nullable="false" length="22"/> <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="object_created_date" type="Date" nullable="false" length="22"/>
<column name="xxxx" type="CLOB" nullable="true"/> <column name="xxxx" type="CLOB" nullable="true"/>
<column name="xxxx" type="Long" length="11" nullable="true"/>
</NODE> </NODE>
</NODE></OBJECTS> </NODE></OBJECTS>
\ No newline at end of file
...@@ -8,7 +8,8 @@ CREATE TABLE it_does_not_matter ( ...@@ -8,7 +8,8 @@ CREATE TABLE it_does_not_matter (
object_last_updated_date datetime DEFAULT getdate() NOT NULL , object_last_updated_date datetime DEFAULT getdate() NOT NULL ,
object_created_date datetime DEFAULT getdate() NOT NULL object_created_date datetime DEFAULT getdate() NOT NULL
, ,
xxxx text NULL xxxx text NULL,
xxxx numeric(12) NULL
); );
......
...@@ -9,7 +9,8 @@ CREATE TABLE it_does_not_matter ( ...@@ -9,7 +9,8 @@ CREATE TABLE it_does_not_matter (
object_last_updated_date date DEFAULT SYSDATE NOT NULL , object_last_updated_date date DEFAULT SYSDATE NOT NULL ,
object_created_date date DEFAULT SYSDATE NOT NULL object_created_date date DEFAULT SYSDATE NOT NULL
, ,
xxxx clob NULL xxxx clob NULL,
xxxx number(12) NULL
); );
......
...@@ -9,7 +9,8 @@ CREATE TABLE it_does_not_matter ( ...@@ -9,7 +9,8 @@ CREATE TABLE it_does_not_matter (
object_last_updated_date timestamp DEFAULT NOW() NOT NULL , object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
object_created_date timestamp DEFAULT NOW() NOT NULL object_created_date timestamp DEFAULT NOW() NOT NULL
, ,
xxxx text NULL xxxx text NULL,
xxxx numeric(12) NULL
); );
......
...@@ -595,20 +595,6 @@ public class Job extends BaseJob ...@@ -595,20 +595,6 @@ public class Job extends BaseJob
new Comparator[]{CollectionUtils.DEFAULT_COMPARATOR_NULLS_FIRST}); new Comparator[]{CollectionUtils.DEFAULT_COMPARATOR_NULLS_FIRST});
} }
public WorkFlow getFirstWorkFlow()
{
Filter<WorkFlow> filter = WorkFlow.SearchByAll().andSortOrder(new EqualsFilter<>(1));
return pipelineJob().toWorkFlows(filter).val();
}
public WorkFlow getLastWorkFlow()
{
Filter<WorkFlow> filter = WorkFlow.SearchByAll().andSortOrder(new EqualsFilter<>(9));
return pipelineJob().toWorkFlows(filter).val();
}
public List<WorkFlow> getSortedMiddleWorkFlows() public List<WorkFlow> getSortedMiddleWorkFlows()
{ {
Filter<WorkFlow> filter = WorkFlow.SearchByAll().andSortOrder(new LessThanFilter<>(9)).andSortOrder(new GreaterThanFilter<>(1)); Filter<WorkFlow> filter = WorkFlow.SearchByAll().andSortOrder(new LessThanFilter<>(9)).andSortOrder(new GreaterThanFilter<>(1));
...@@ -618,5 +604,11 @@ public class Job extends BaseJob ...@@ -618,5 +604,11 @@ public class Job extends BaseJob
new Comparator[]{CollectionUtils.DEFAULT_COMPARATOR_NULLS_FIRST}); new Comparator[]{CollectionUtils.DEFAULT_COMPARATOR_NULLS_FIRST});
} }
public WorkFlow getWorkFlowBySortOrder(int sortOrder)
{
Filter<WorkFlow> filter = WorkFlow.SearchByAll().andSortOrder(new EqualsFilter<>(sortOrder));
return pipelineJob().toWorkFlows(filter).val();
}
} }
\ No newline at end of file
package performa.search; package performa.search;
import oneit.objstore.BaseBusinessClass;
import oneit.objstore.rdbms.filters.EqualsFilter;
import performa.orm.JobApplication;
public class SearchApplicant extends BaseSearchApplicant public class SearchApplicant extends BaseSearchApplicant
{ {
...@@ -10,4 +14,13 @@ public class SearchApplicant extends BaseSearchApplicant ...@@ -10,4 +14,13 @@ public class SearchApplicant extends BaseSearchApplicant
{ {
// Do not add any code to this, always put it in initialiseNewObject // 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
...@@ -5,11 +5,14 @@ ...@@ -5,11 +5,14 @@
<BUSINESSCLASS name="SearchApplicant" package="performa.search" superclass="SearchExecutor" > <BUSINESSCLASS name="SearchApplicant" package="performa.search" superclass="SearchExecutor" >
<IMPORT value="oneit.servlets.orm.*" /> <IMPORT value="oneit.servlets.orm.*" />
<IMPORT value="performa.orm.*"/>
<TABLE name="it_does_not_matter" tablePrefix="object" polymorphic="FALSE" > <TABLE name="it_does_not_matter" tablePrefix="object" polymorphic="FALSE" >
<ATTRIB name="Details" type="String" dbcol="xxxx" /> <ATTRIB name="Details" type="String" dbcol="xxxx" />
<SINGLEREFERENCE name="Job" type="Job" dbcol="xxxx" />
</TABLE> </TABLE>
</BUSINESSCLASS> </BUSINESSCLASS>
......
...@@ -15,6 +15,7 @@ import oneit.utils.resource.*; ...@@ -15,6 +15,7 @@ import oneit.utils.resource.*;
import oneit.utils.*; import oneit.utils.*;
import oneit.utils.threading.*; import oneit.utils.threading.*;
import oneit.servlets.orm.*; import oneit.servlets.orm.*;
import performa.orm.*;
...@@ -42,7 +43,7 @@ public class SearchApplicantPersistenceMgr extends SearchExecutorPersistenceMgr ...@@ -42,7 +43,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, 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, {PREFIX}it_does_not_matter.xxxx, 1 AS commasafe ";
private String SELECT_JOINS = ""; private String SELECT_JOINS = "";
public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
...@@ -93,7 +94,8 @@ public class SearchApplicantPersistenceMgr extends SearchExecutorPersistenceMgr ...@@ -93,7 +94,8 @@ public class SearchApplicantPersistenceMgr extends SearchExecutorPersistenceMgr
// Check for persistent sets already prefetched // Check for persistent sets already prefetched
if (false || !it_does_not_matterPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) || if (false || !it_does_not_matterPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!it_does_not_matterPSet.containsAttrib(SearchApplicant.FIELD_Details)) !it_does_not_matterPSet.containsAttrib(SearchApplicant.FIELD_Details)||
!it_does_not_matterPSet.containsAttrib(SearchApplicant.SINGLEREFERENCE_Job))
{ {
// We will need to retrieve it // We will need to retrieve it
idsToFetch.add (id.longValue()); idsToFetch.add (id.longValue());
...@@ -163,10 +165,10 @@ public class SearchApplicantPersistenceMgr extends SearchExecutorPersistenceMgr ...@@ -163,10 +165,10 @@ public class SearchApplicantPersistenceMgr extends SearchExecutorPersistenceMgr
{ {
int rowsUpdated = executeStatement (sqlMgr, int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}it_does_not_matter " + "UPDATE {PREFIX}it_does_not_matter " +
"SET xxxx = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " + "SET xxxx = ?, xxxx = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE it_does_not_matter.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ", "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 (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray()); 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());
if (rowsUpdated != 1) if (rowsUpdated != 1)
{ {
...@@ -402,6 +404,7 @@ public class SearchApplicantPersistenceMgr extends SearchExecutorPersistenceMgr ...@@ -402,6 +404,7 @@ 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.FIELD_Details, HELPER_Details.getFromRS(dummyDetails, r, "xxxx"));
it_does_not_matterPSet.setAttrib(SearchApplicant.SINGLEREFERENCE_Job, r.getObject ("xxxx"));
} }
...@@ -418,10 +421,10 @@ public class SearchApplicantPersistenceMgr extends SearchExecutorPersistenceMgr ...@@ -418,10 +421,10 @@ public class SearchApplicantPersistenceMgr extends SearchExecutorPersistenceMgr
{ {
executeStatement (sqlMgr, executeStatement (sqlMgr,
"INSERT INTO {PREFIX}it_does_not_matter " + "INSERT INTO {PREFIX}it_does_not_matter " +
" (xxxx, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " + " (xxxx, xxxx, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " + "VALUES " +
" (?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")", " (?, ?, ?, " + 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()); 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());
it_does_not_matterPSet.setStatus (PersistentSetStatus.PROCESSED); it_does_not_matterPSet.setStatus (PersistentSetStatus.PROCESSED);
} }
......
...@@ -11,6 +11,7 @@ public class SearchJob extends BaseSearchJob ...@@ -11,6 +11,7 @@ public class SearchJob extends BaseSearchJob
// This constructor should not be called // This constructor should not be called
public SearchJob () public SearchJob ()
{ {
// Do not add any code to this, always put it in initialiseNewObject
} }
@Override @Override
......
...@@ -224,7 +224,7 @@ public class Utils ...@@ -224,7 +224,7 @@ public class Utils
} }
//to sort application list //to sort application list
public static List<JobApplication> getApplicationsSorted(JobApplication[] applications, AppSortOption appSortOption) public static List<JobApplication> getApplicationsSorted(List<JobApplication> applications, AppSortOption appSortOption)
{ {
ObjectTransform transform = JobApplication.pipesJobApplication().toObjectCreated(); ObjectTransform transform = JobApplication.pipesJobApplication().toObjectCreated();
Comparator comparator = CollectionUtils.DEFAULT_COMPARATOR_NULLS_FIRST; Comparator comparator = CollectionUtils.DEFAULT_COMPARATOR_NULLS_FIRST;
...@@ -255,7 +255,7 @@ public class Utils ...@@ -255,7 +255,7 @@ public class Utils
comparator = CollectionUtils.reverse(CollectionUtils.CASE_INSENSITIVE_COMPARATOR_NULLS_FIRST); comparator = CollectionUtils.reverse(CollectionUtils.CASE_INSENSITIVE_COMPARATOR_NULLS_FIRST);
} }
return ObjstoreUtils.sort( Arrays.asList(applications), return ObjstoreUtils.sort(applications,
new ObjectTransform[]{transform}, new ObjectTransform[]{transform},
new Comparator[]{comparator}); new Comparator[]{comparator});
} }
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
<span> <span>
<oneit:toString value="<%= noOfIncomplete %>" mode="Integer" /> <oneit:toString value="<%= noOfIncomplete %>" mode="Integer" />
</span> </span>
<%= job.getFirstWorkFlow().getName() %> <%= job.getWorkFlowBySortOrder(1).getName() %>
</oneit:button> </oneit:button>
</li> </li>
<ul> <ul>
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
<span> <span>
<oneit:toString value="<%= noOfUnsuitable %>" mode="Integer" /> <oneit:toString value="<%= noOfUnsuitable %>" mode="Integer" />
</span> </span>
<%= job.getFirstWorkFlow().getName() %> <%= job.getWorkFlowBySortOrder(9).getName() %>
</oneit:button> </oneit:button>
</div> </div>
</div> </div>
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
Job job = (Job) process.getAttribute("Job"); Job job = (Job) process.getAttribute("Job");
List<JobApplication> applications = (List<JobApplication>) getData(request, "applications"); List<JobApplication> applications = (List<JobApplication>) getData(request, "applications");
String currentPage = (String) getData(request, "currentPage"); String currentPage = (String) getData(request, "currentPage");
int tabNumber = (int) getData(request, "TabNumber");
String applicationPage = WebUtils.getSamePageInRenderMode(request, WebUtils.VIEW_APPLICATION); String applicationPage = WebUtils.getSamePageInRenderMode(request, WebUtils.VIEW_APPLICATION);
%> %>
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
<%@ include file="/inc/stdcms.jsp" %><%-- This is in cougar --%> <%@ include file="/inc/stdcms.jsp" %><%-- This is in cougar --%>
<%@ include file="/extensions/performa/inc/stdimports.jsp" %> <%@ include file="/extensions/performa/inc/stdimports.jsp" %>
<%@page import="oneit.utils.text.FormatUtils"%> <%@page import="oneit.utils.text.FormatUtils"%>
<%@ page import="oneit.utils.filter.*"%>
<oneit:dynIncluded> <oneit:dynIncluded>
<% <%
...@@ -21,7 +22,24 @@ ...@@ -21,7 +22,24 @@
String currentPage = WebUtils.getSamePageInRenderMode(request, WebUtils.VIEW_APPLICANTS); String currentPage = WebUtils.getSamePageInRenderMode(request, WebUtils.VIEW_APPLICANTS);
String applicationPage = WebUtils.getSamePageInRenderMode(request, WebUtils.VIEW_APPLICATION); String applicationPage = WebUtils.getSamePageInRenderMode(request, WebUtils.VIEW_APPLICATION);
AppSortOption appSortOpt = (AppSortOption) process.getAttribute("AppSortOption"); AppSortOption appSortOpt = (AppSortOption) process.getAttribute("AppSortOption");
int tabNumber = process.getAttribute("TabNumber") != null ? (int) process.getAttribute("TabNumber") : 1; int tabNumber = process.getAttribute("TabNumber") != null ? (int) process.getAttribute("TabNumber") : 2;
SearchApplicant searchApplicant = (SearchApplicant) RunSearchExecutorFP.setupExecutor(request, SearchApplicant.REFERENCE_SearchApplicant, true);
JobApplication[] applications = (JobApplication[]) process.getAttribute("JobApplications");
WorkFlow workflow = job.getWorkFlowBySortOrder(tabNumber);
searchApplicant.setJob(job);
if(applications == null)
{
applications = (JobApplication[]) searchApplicant.doSearch();
}
if (getData (request, GenericObjSearchDF.GENERIC_SEARCH_RESULTS) != null)
{
applications = (JobApplication[])getData (request, GenericObjSearchDF.GENERIC_SEARCH_RESULTS);
}
process.setAttribute("JobApplications", applications);
if(request.getParameter("AppSortOption") != null) if(request.getParameter("AppSortOption") != null)
{ {
...@@ -33,19 +51,14 @@ ...@@ -33,19 +51,14 @@
appSortOpt = AppSortOption.RANK; appSortOpt = AppSortOption.RANK;
} }
JobApplication[] applications = (JobApplication[]) process.getAttribute("JobApplications"); List<JobApplication> applicantList = Arrays.asList(applications);
if(applications == null) // filter applicants by workflow
{ oneit.utils.filter.Filter<JobApplication> filter = JobApplication.SearchByAll().andApplicationStatus(new EqualsFilter<>(workflow.getApplicationStatus()));
applications = JobApplication.SearchByAll()
.andJob(new EqualsFilter<>(job))
.andApplicationStatus(new NotEqualsFilter<>(ApplicationStatus.DRAFT))
.search(transaction);
process.setAttribute("JobApplications", applications); applicantList = new ArrayList<>(CollectionFilter.filter(applicantList, filter));
}
List<JobApplication> sortedApplications = applications!=null ? Utils.getApplicationsSorted(applications, appSortOpt) : new ArrayList<JobApplication>(); List<JobApplication> sortedApplications = Utils.getApplicationsSorted(applicantList, appSortOpt);
process.setAttribute("AppSortOption", appSortOpt); process.setAttribute("AppSortOption", appSortOpt);
process.setAttribute("TabNumber", tabNumber); process.setAttribute("TabNumber", tabNumber);
...@@ -70,6 +83,7 @@ ...@@ -70,6 +83,7 @@
<oneit:dynInclude page="/extensions/adminportal/inc/application_list_data.jsp" <oneit:dynInclude page="/extensions/adminportal/inc/application_list_data.jsp"
applications="<%= sortedApplications %>" applications="<%= sortedApplications %>"
currentPage="<%= currentPage %>" currentPage="<%= currentPage %>"
TabNumber="<%= tabNumber %>"
data="<%= CollectionUtils.EMPTY_MAP%>"/> data="<%= CollectionUtils.EMPTY_MAP%>"/>
</div> </div>
</div> </div>
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
//to navigation between applications //to navigation between applications
if(applications==null) if(applications==null)
{ {
applications = Utils.getApplicationsSorted(job.getJobApplicationsSet().toArray(new JobApplication[job.getJobApplicationsSet().size()]), AppSortOption.RANK); // applications = Utils.getApplicationsSorted(job.getJobApplicationsSet(), AppSortOption.RANK);
process.setAttribute("Applications", applications); process.setAttribute("Applications", applications);
} }
......
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