Commit fa829685 by Harsh Shah

Review changes, issue fixes

parent d1dd3428
...@@ -2,7 +2,7 @@ package performa.orm; ...@@ -2,7 +2,7 @@ package performa.orm;
import java.util.*; import java.util.*;
import oneit.logging.LoggingArea; import oneit.logging.LoggingArea;
import oneit.objstore.ValidationContext; import oneit.objstore.*;
import oneit.objstore.rdbms.filters.*; import oneit.objstore.rdbms.filters.*;
import oneit.objstore.utils.ObjstoreUtils; import oneit.objstore.utils.ObjstoreUtils;
import oneit.security.*; import oneit.security.*;
...@@ -46,6 +46,18 @@ public class Job extends BaseJob ...@@ -46,6 +46,18 @@ public class Job extends BaseJob
} }
@Override
public void validate(ValidationContext context)
{
super.validate(context);
if (getIncludeAssessmentCriteria())
{
context.check(getAssessmentCriteriasCount() > 0 , this, MULTIPLEREFERENCE_AssessmentCriterias, "atleastOneRequirement");
}
}
public Boolean jobDetailsCompleted() public Boolean jobDetailsCompleted()
{ {
return getJobTitle() != null && getJobDescription() != null; return getJobTitle() != null && getJobDescription() != null;
...@@ -114,53 +126,40 @@ public class Job extends BaseJob ...@@ -114,53 +126,40 @@ public class Job extends BaseJob
} }
public List<Level> getAllLevels() public Level[] getAllLevels()
{ {
List<Level> levels = new ArrayList<>(); List<Level> levels = new ArrayList<>();
Utils.getLevelsForComprehensive(getTransaction()).stream().forEach((tuple) -> { Utils.getLevelsForComprehensive(getTransaction()).stream().forEach((tuple) -> {
levels.add((Level)tuple.get0()); levels.add((Level)tuple.get0());
}); });
return levels.toArray(new Level[0]);
return levels;
} }
public int getNoOfCandidatesApplied()
@Override
public void validate(ValidationContext context)
{ {
super.validate(context); return getNoOfCandidatesFor(ApplicationStatus.SUBMITTED);
if (getIncludeAssessmentCriteria())
{
context.check(getAssessmentCriteriasCount() > 0 , this, MULTIPLEREFERENCE_AssessmentCriterias, "atleastOneRequirement");
}
} }
public int getNoOfCandidatesShortlisted()
public int getNoOfCandidatesApplied()
{ {
Filter<JobApplication> filter = JobApplication.SearchByAll().andApplicationStatus(new EqualsFilter<>(ApplicationStatus.SUBMITTED)); return getNoOfCandidatesFor(ApplicationStatus.SHORTLISTED);
return this.pipelineJob().toJobApplications(filter).toCandidate().vals().size();
} }
public int getNoOfCandidatesFor(ApplicationStatus status)
public int getNoOfCandidatesShortlisted()
{ {
Filter<JobApplication> filter = JobApplication.SearchByAll().andApplicationStatus(new EqualsFilter<>(ApplicationStatus.SHORTLISTED)); Filter<JobApplication> filter = JobApplication.SearchByAll().andApplicationStatus(new EqualsFilter<>(status));
return this.pipelineJob().toJobApplications(filter).toCandidate().vals().size(); return pipelineJob().toJobApplications(filter).toCandidate().vals().size();
} }
public String getDaysTillClose() public String getDaysTillClose()
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
if(this.getApplyBy()!=null) if(getApplyBy()!=null)
{ {
int dateDiff = DateDiff.getDateDiff(Calendar.DATE, DateDiff.getToday(), this.getApplyBy()); int dateDiff = DateDiff.getDateDiff(Calendar.DATE, DateDiff.getToday(), getApplyBy());
sb.append(dateDiff); sb.append(dateDiff);
......
package performa.orm; package performa.orm;
import java.util.Collection; import java.util.*;
import oneit.logging.LoggingArea; import oneit.logging.LoggingArea;
import oneit.objstore.StorageException; import oneit.objstore.StorageException;
import oneit.objstore.rdbms.filters.EqualsFilter; import oneit.objstore.rdbms.filters.EqualsFilter;
import oneit.objstore.rdbms.filters.IsNotNullFilter; import oneit.objstore.rdbms.filters.IsNotNullFilter;
import oneit.utils.CollectionUtils;
import oneit.utils.filter.CollectionFilter; import oneit.utils.filter.CollectionFilter;
import oneit.utils.filter.Filter; import oneit.utils.filter.Filter;
import oneit.utils.parsers.FieldException; import oneit.utils.parsers.FieldException;
...@@ -54,48 +53,55 @@ public class JobApplication extends BaseJobApplication ...@@ -54,48 +53,55 @@ public class JobApplication extends BaseJobApplication
} }
public Boolean initCCAnswers() public boolean initCCAnswers()
{ {
Boolean redirect = Boolean.FALSE; boolean redirect = false;
if(this.getCultureCriteriaAnswersCount()==0) if(getCultureCriteriaAnswersCount() == 0) //initCCAnswers not called yet
{ {
for(CultureCriteria cultureCriteria : getJob().getCultureCriteriasSet()) for(CultureCriteria cultureCriteria : getJob().getCultureCriteriasSet())
{ {
redirect = Boolean.TRUE; redirect = true;
CultureCriteriaAnswer answer = CultureCriteriaAnswer.createCultureCriteriaAnswer(getTransaction()); CultureCriteriaAnswer answer = CultureCriteriaAnswer.createCultureCriteriaAnswer(getTransaction());
addToCultureCriteriaAnswers(answer); addToCultureCriteriaAnswers(answer);
cultureCriteria.addToAnswers(answer); cultureCriteria.addToAnswers(answer);
} }
} }
return redirect; return redirect;
} }
public boolean initAssessmentAnswers(List<Question> allQuestions) throws StorageException, FieldException
public Answer getPAAnswerOrCreate(Question question, int index) throws FieldException
{ {
Filter filter = Answer.SearchByAll().andQuestion(new EqualsFilter<>(question)); boolean redirect = false;
Answer answer = CollectionFilter.getFirstMatch(getProfileAssessmentAnswersSet(), filter);
if(answer==null) if(getProfileAssessmentAnswersCount() == 0)
{ {
answer = Answer.createAnswer(getTransaction()); for(Question question : allQuestions)
answer.setJobApplication(this);
answer.setQuestion(question);
if(question.getRightQuestion()!=null)
{ {
Answer rightAnswer = Answer.createAnswer(getTransaction()); redirect = true;
Answer answer = Answer.createAnswer(getTransaction());
rightAnswer.setJobApplication(this); addToProfileAssessmentAnswers(answer);
rightAnswer.setQuestion(question); answer.setQuestion(question);
if(question.getRightQuestion() != null)
{
Answer rightAnswer = Answer.createAnswer(getTransaction());
addToProfileAssessmentAnswers(rightAnswer);
rightAnswer.setQuestion(question);
}
} }
} }
return redirect;
}
public Answer getAnswerForQuestion(Question question) throws FieldException
{
Filter filter = Answer.SearchByAll().andQuestion(new EqualsFilter<>(question));
return answer; return CollectionFilter.getFirstMatch(getProfileAssessmentAnswersSet(), filter);
} }
...@@ -107,66 +113,54 @@ public class JobApplication extends BaseJobApplication ...@@ -107,66 +113,54 @@ public class JobApplication extends BaseJobApplication
} }
public Boolean selectionCompleted() public boolean selectionCompleted()
{ {
int all = this.getAssessmentCriteriaAnswersCount(); int allAnswersCount = getAssessmentCriteriaAnswersCount();
if(all>0) if(allAnswersCount > 0)
{ {
Filter filter = AssessmentCriteriaAnswer.SearchByAll().andAnswer(new IsNotNullFilter<>()); Filter filter = AssessmentCriteriaAnswer.SearchByAll().andAnswer(new IsNotNullFilter<>());
Collection selected = this.pipelineJobApplication().toAssessmentCriteriaAnswers(filter).toAnswer().vals(); Collection selectedAnswers = pipelineJobApplication().toAssessmentCriteriaAnswers(filter).vals();
if(selected!=null && CollectionUtils.equals(selected.size(),all)) return (selectedAnswers.size() == allAnswersCount);
{
return Boolean.TRUE;
}
} }
return false;
return Boolean.FALSE;
} }
public Boolean cultureCompleted() public boolean cultureCompleted()
{ {
int all = this.getCultureCriteriaAnswersCount(); int allAnswersCount = getCultureCriteriaAnswersCount();
if(all>0) if(allAnswersCount > 0)
{ {
Filter filter = CultureCriteriaAnswer.SearchByAll().andSelectedQuestion(new IsNotNullFilter<>()); Filter filter = CultureCriteriaAnswer.SearchByAll().andSelectedQuestion(new IsNotNullFilter<>());
Collection selected = this.pipelineJobApplication().toCultureCriteriaAnswers(filter).toSelectedQuestion().vals(); Collection selectedAnswers = pipelineJobApplication().toCultureCriteriaAnswers(filter).vals();
if(selected!=null && CollectionUtils.equals(selected.size(),all)) return (selectedAnswers.size() == allAnswersCount);
{
return Boolean.TRUE;
}
} }
return false;
return Boolean.FALSE;
} }
public Boolean assessmentCompleted() public boolean assessmentCompleted()
{ {
int all = this.getJob().getAllProfileAssessmentQuestions().size(); int allAnswersCount = getJob().getAllProfileAssessmentQuestions().size();
if(all>0) if(allAnswersCount > 0)
{ {
Filter filter = Answer.SearchByAll().andAnswerNo(new IsNotNullFilter<>()); Filter filter = Answer.SearchByAll().andAnswerNo(new IsNotNullFilter<>());
Collection selected = this.pipelineJobApplication().toProfileAssessmentAnswers(filter).toAnswerNo().vals(); Collection selectedAnswers = pipelineJobApplication().toProfileAssessmentAnswers(filter).vals();
if(selected!=null && CollectionUtils.equals(selected.size(),all)) return (selectedAnswers.size() == allAnswersCount);
{
return Boolean.TRUE;
}
} }
return false;
return Boolean.FALSE;
} }
public Boolean isIncludeAssessmentCriteria() public boolean isIncludeAssessmentCriteria()
{ {
return this.getJob().getIncludeAssessmentCriteria(); return getJob() != null && isTrue(getJob().getIncludeAssessmentCriteria());
} }
// TODO: Fix these hard coded values // TODO: Fix these hard coded values
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
<div class="col-sm-6 col-xs-12 form-group"> <div class="col-sm-6 col-xs-12 form-group">
<label>Role Type</label> <label>Role Type</label>
<!--TODO: Levels are not named properly. apply styling form-control class--> <!--TODO: Levels are not named properly. apply styling form-control class-->
<tagfile:ormsingleasso_select obj="<%= job %>" assocName="Level" optionsScript="job.getAllLevels()" job="<%= job%>"/> <tagfile:ormsingleasso_select obj="<%= job %>" assocName="Level" options="<%= job.getAllLevels() %>"/>
</div> </div>
</div> </div>
<div class="optional-title">OPTIONAL</div> <div class="optional-title">OPTIONAL</div>
......
...@@ -7,9 +7,8 @@ ...@@ -7,9 +7,8 @@
<oneit:dynIncluded> <oneit:dynIncluded>
<% <%
//TODO: filter with Client; //TODO: filter with Client;
ObjectTransaction objTran = process.getTransaction ();
Job[] jobs = Job.SearchByAll().andJobStatus(new EqualsFilter<>(JobStatus.OPEN)).search(transaction); Job[] jobs = Job.SearchByAll().andJobStatus(new EqualsFilter<>(JobStatus.OPEN)).search(transaction);
Article jobsArticle = WebUtils.getArticleByShortCut(objTran, WebUtils.JOBS); Article jobsArticle = WebUtils.getArticleByShortCut(transaction, WebUtils.JOBS);
String nextPage = jobsArticle.getLink(request, CollectionUtils.mapEntry("cms.rm", WebUtils.VIEW_APPLICANTS).toMap()); String nextPage = jobsArticle.getLink(request, CollectionUtils.mapEntry("cms.rm", WebUtils.VIEW_APPLICANTS).toMap());
String homePage = WebUtils.getSamePageInRenderMode(request, "Page"); String homePage = WebUtils.getSamePageInRenderMode(request, "Page");
...@@ -18,8 +17,8 @@ ...@@ -18,8 +17,8 @@
<div class="dashboard-content-area first-part"> <div class="dashboard-content-area first-part">
<div class="welcome-box"> <div class="welcome-box">
<div class="dashboard-welcome"> <div class="dashboard-welcome">
<div class="welcome-text"> Welcome <br/> back Maria! </div> <div class="welcome-text"> Welcome <br/> back <%= oneit.security.jsp.SecUserToNameTransform.INSTANCE.transform(SecUser.getTXUser(transaction)) %>! </div>
<a class="d-create-job-btn" href="<%= WebUtils.getArticleLink(request, objTran, WebUtils.CREATE_JOB, "Page") %>">Create New Job</a> <a class="d-create-job-btn" href="<%= WebUtils.getArticleLink(request, transaction, WebUtils.CREATE_JOB, "Page") %>">Create New Job</a>
</div> </div>
<div class="col-sm-3 col-xs-12 d-three-box green-light"> <div class="col-sm-3 col-xs-12 d-three-box green-light">
<div class="d-fl-left eq-height"> <div class="d-fl-left eq-height">
......
...@@ -5,76 +5,53 @@ ...@@ -5,76 +5,53 @@
<%@ include file="/extensions/performa/inc/stdimports.jsp" %> <%@ include file="/extensions/performa/inc/stdimports.jsp" %>
<% <%
JobApplication jobApplication = (JobApplication) process.getAttribute("JobApplication"); JobApplication jobApplication = (JobApplication) process.getAttribute("JobApplication");
String pageNumber = (String) getData(request, "PageNumber"); String pageNumber = (String) getData(request, "PageNumber");
String firstPage = WebUtils.getSamePageInRenderMode(request, "SelectionCriteria"); String firstPage = WebUtils.getSamePageInRenderMode(request, "SelectionCriteria");
String secondPage = WebUtils.getSamePageInRenderMode(request, "WorkplaceCulture"); String secondPage = WebUtils.getSamePageInRenderMode(request, "WorkplaceCulture");
String thirdPage = WebUtils.getSamePageInRenderMode(request, "JobMatchAssessment"); String thirdPage = WebUtils.getSamePageInRenderMode(request, "JobMatchAssessment");
boolean includeAssessment = jobApplication.isIncludeAssessmentCriteria();
%> %>
<oneit:dynIncluded> <oneit:dynIncluded>
<div class="main-tab-form"> <div class="main-tab-form">
<ul class="nav nav-pills nav-justified"> <ul class="nav nav-pills nav-justified">
<% <%
if(jobApplication.isIncludeAssessmentCriteria()) if(includeAssessment)
{ {
%> %>
<li class="<%= pageNumber == "1" ? "active" : jobApplication.selectionCompleted() ? "complate" : ""%>"> <li class="<%= pageNumber == "1" ? "active" : jobApplication.selectionCompleted() ? "complate" : ""%>">
<oneit:button value=" " name="gotoPage" skin="link" <oneit:button value=" " name="gotoPage" skin="link"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", firstPage) requestAttribs="<%= CollectionUtils.mapEntry("nextPage", firstPage)
.mapEntry("procParams", CollectionUtils.mapEntry("JobApplication", jobApplication).toMap()) .mapEntry("procParams", CollectionUtils.mapEntry("JobApplication", jobApplication).toMap())
.toMap() %>"> .toMap() %>">
<span><%= jobApplication.selectionCompleted() ? "<img src=\"images/right-mark.png\" />" : "1"%></span> <span><%= jobApplication.selectionCompleted() ? "<img src=\"images/right-mark.png\" />" : "1"%></span>
<div class="mobile-hide">Selection Criteria</div> <div class="mobile-hide">Selection Criteria</div>
</oneit:button> </oneit:button>
</li> </li>
<li class="<%= pageNumber == "2" ? "active" : jobApplication.cultureCompleted() ? "complate" : ""%>"> <%
<oneit:button value=" " name="gotoPage" skin="link" }
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", secondPage) %>
.mapEntry("procParams", CollectionUtils.mapEntry("JobApplication", jobApplication).toMap()) <li class="<%= pageNumber == "2" ? "active" : jobApplication.cultureCompleted() ? "complate" : ""%>">
.toMap() %>"> <oneit:button value=" " name="gotoPage" skin="link"
<span><%= jobApplication.cultureCompleted() ? "<img src=\"images/right-mark.png\" />" : "2"%></span> requestAttribs="<%= CollectionUtils.mapEntry("nextPage", secondPage)
<div class="mobile-hide">Workplace Culture</div> .mapEntry("procParams", CollectionUtils.mapEntry("JobApplication", jobApplication).toMap())
</oneit:button> .toMap() %>">
</li> <span><%= jobApplication.cultureCompleted() ? "<img src=\"images/right-mark.png\" />" : (includeAssessment ? "2" : "1")%></span>
<li class="<%= pageNumber == "3" ? "active" : jobApplication.assessmentCompleted() ? "complate" : ""%>"> <div class="mobile-hide">Workplace Culture</div>
<oneit:button value=" " name="gotoPage" skin="link" </oneit:button>
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", thirdPage) </li>
.mapEntry("procParams", CollectionUtils.mapEntry("JobApplication", jobApplication).toMap()) <li class="<%= pageNumber == "3" ? "active" : jobApplication.assessmentCompleted() ? "complate" : ""%>">
.toMap() %>"> <oneit:button value=" " name="gotoPage" skin="link"
<span><%= jobApplication.assessmentCompleted() ? "<img src=\"images/right-mark.png\" />" : "3"%></span> requestAttribs="<%= CollectionUtils.mapEntry("nextPage", thirdPage)
<div class="mobile-hide">Job Match Assessment</div> .mapEntry("procParams", CollectionUtils.mapEntry("JobApplication", jobApplication).toMap())
</oneit:button> .toMap() %>">
</li> <span><%= jobApplication.assessmentCompleted() ? "<img src=\"images/right-mark.png\" />" : (includeAssessment ? "3" : "2")%></span>
<li><a href="#"><span>4</span><div class="mobile-hide">Submit Application</div></a></li> <div class="mobile-hide">Job Match Assessment</div>
<% </oneit:button>
} </li>
else <li><a href="#"><span><%= includeAssessment ? "4" : "3" %></span><div class="mobile-hide">Submit Application</div></a></li>
{
%>
<li class="<%= pageNumber == "2" ? "active" : jobApplication.cultureCompleted() ? "complate" : ""%>">
<oneit:button value=" " name="gotoPage" skin="link"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", secondPage)
.mapEntry("procParams", CollectionUtils.mapEntry("JobApplication", jobApplication).toMap())
.toMap() %>">
<span><%= jobApplication.cultureCompleted() ? "<img src=\"images/right-mark.png\" />" : "1"%></span>
<div class="mobile-hide">Workplace Culture</div>
</oneit:button>
</li>
<li class="<%= pageNumber == "3" ? "active" : jobApplication.assessmentCompleted() ? "complate" : ""%>">
<oneit:button value=" " name="gotoPage" skin="link"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", thirdPage)
.mapEntry("procParams", CollectionUtils.mapEntry("JobApplication", jobApplication).toMap())
.toMap() %>">
<span><%= jobApplication.assessmentCompleted() ? "<img src=\"images/right-mark.png\" />" : "2"%></span>
<div class="mobile-hide">Job Match Assessment</div>
</oneit:button>
</li>
<li><a href="#"><span>3</span><div class="mobile-hide">Submit Application</div></a></li>
<%
}
%>
</ul> </ul>
</div> </div>
</oneit:dynIncluded> </oneit:dynIncluded>
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