Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
PERFORMA_REPLICA
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Muhammad Usman
PERFORMA_REPLICA
Commits
306aba4c
Commit
306aba4c
authored
Aug 01, 2017
by
chenith
Committed by
Harsh Shah
Sep 06, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Job Application sort options to HT003.
parent
92abda34
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
250 additions
and
10 deletions
+250
-10
AppSortOption.java
cmsWebApp/src/performa/orm/types/AppSortOption.java
+145
-0
AppSortOption.xml
cmsWebApp/src/performa/orm/types/AppSortOption.xml
+14
-0
Utils.java
cmsWebApp/src/performa/utils/Utils.java
+40
-1
view_applicants.jsp
cmsWebApp/webroot/extensions/adminportal/view_applicants.jsp
+51
-9
No files found.
cmsWebApp/src/performa/orm/types/AppSortOption.java
0 → 100644
View file @
306aba4c
package
performa
.
orm
.
types
;
import
java.util.*
;
import
oneit.utils.*
;
/**
* This class was generated using constGen.bat.
* DO NOT MODIFY THIS CODE.
* Edit the associated .xml file, and regenerate this file
* constGen (directory) (file minus extension)
* e.g. constGen C:\...\sql FieldType
*/
public
class
AppSortOption
extends
AbstractEnumerated
{
public
static
final
EnumeratedFactory
FACTORY_AppSortOption
=
new
AppSortOptionFactory
();
public
static
final
AppSortOption
RANK
=
new
AppSortOption
(
"RANK"
,
"RANK"
,
"Rank"
,
false
);
public
static
final
AppSortOption
NEWEST
=
new
AppSortOption
(
"NEWEST"
,
"NEWEST"
,
"Newest"
,
false
);
public
static
final
AppSortOption
OLDEST
=
new
AppSortOption
(
"OLDEST"
,
"OLDEST"
,
"Oldest"
,
false
);
public
static
final
AppSortOption
ALPHA_A_Z
=
new
AppSortOption
(
"ALPHA_A_Z"
,
"ALPHA_A_Z"
,
"A-Z"
,
false
);
public
static
final
AppSortOption
ALPHA_Z_A
=
new
AppSortOption
(
"ALPHA_Z_A"
,
"ALPHA_Z_A"
,
"Z-A"
,
false
);
private
static
final
AppSortOption
[]
allAppSortOptions
=
new
AppSortOption
[]
{
RANK
,
NEWEST
,
OLDEST
,
ALPHA_A_Z
,
ALPHA_Z_A
};
private
static
AppSortOption
[]
getAllAppSortOptions
()
{
return
allAppSortOptions
;
}
private
AppSortOption
(
String
name
,
String
value
,
String
description
,
boolean
disabled
)
{
super
(
name
,
value
,
description
,
disabled
);
}
public
static
final
Comparator
COMPARE_BY_POSITION
=
new
CompareEnumByPosition
(
allAppSortOptions
);
static
{
defineAdditionalData
();
}
public
boolean
isEqual
(
AppSortOption
other
)
{
return
this
.
name
.
equals
(
other
.
name
);
}
public
Enumeration
getAllInstances
()
{
return
AppSortOption
.
getAll
();
}
private
Object
readResolve
()
throws
java
.
io
.
ObjectStreamException
{
return
AppSortOption
.
forName
(
this
.
name
);
}
public
EnumeratedFactory
getFactory
()
{
return
FACTORY_AppSortOption
;
}
public
static
AppSortOption
forName
(
String
name
)
{
if
(
name
==
null
)
{
return
null
;
}
AppSortOption
[]
all
=
getAllAppSortOptions
();
int
enumIndex
=
AbstractEnumerated
.
getIndexForName
(
all
,
name
);
return
all
[
enumIndex
];
}
public
static
AppSortOption
forValue
(
String
value
)
{
if
(
value
==
null
)
{
return
null
;
}
AppSortOption
[]
all
=
getAllAppSortOptions
();
int
enumIndex
=
AbstractEnumerated
.
getIndexForValue
(
getAllAppSortOptions
(),
value
);
return
all
[
enumIndex
];
}
public
static
java
.
util
.
Enumeration
getAll
()
{
return
AbstractEnumerated
.
getAll
(
getAllAppSortOptions
());
}
public
static
AppSortOption
[]
getAppSortOptionArray
()
{
return
(
AppSortOption
[])
getAllAppSortOptions
().
clone
();
}
public
static
void
defineAdditionalData
()
{
}
static
class
AppSortOptionFactory
implements
EnumeratedFactory
{
public
AbstractEnumerated
getForName
(
String
name
)
{
return
AppSortOption
.
forName
(
name
);
}
public
AbstractEnumerated
getForValue
(
String
name
)
{
return
AppSortOption
.
forValue
(
name
);
}
public
Enumeration
getAll
()
{
return
AppSortOption
.
getAll
();
}
}
public
Map
getAdditionalAttributes
()
{
Map
attribs
=
new
HashMap
();
return
attribs
;
}
}
cmsWebApp/src/performa/orm/types/AppSortOption.xml
0 → 100644
View file @
306aba4c
<?xml version="1.0" encoding="UTF-8"?>
<ROOT>
<CONSTANT
package=
"performa.orm.types"
name=
"AppSortOption"
>
<VALUE
name=
"RANK"
value=
"RANK"
description=
"Rank"
/>
<VALUE
name=
"NEWEST"
value=
"NEWEST"
description=
"Newest"
/>
<VALUE
name=
"OLDEST"
value=
"OLDEST"
description=
"Oldest"
/>
<VALUE
name=
"ALPHA_A_Z"
value=
"ALPHA_A_Z"
description=
"A-Z"
/>
<VALUE
name=
"ALPHA_Z_A"
value=
"ALPHA_Z_A"
description=
"Z-A"
/>
</CONSTANT>
</ROOT>
\ No newline at end of file
cmsWebApp/src/performa/utils/Utils.java
View file @
306aba4c
...
...
@@ -3,7 +3,6 @@ package performa.utils;
import
java.util.*
;
import
oneit.objstore.ObjectTransaction
;
import
oneit.objstore.rdbms.filters.GreaterThanEqualFilter
;
import
oneit.objstore.rdbms.filters.LessThanEqualFilter
;
import
oneit.objstore.rdbms.filters.LessThanFilter
;
import
oneit.security.*
;
import
oneit.utils.Tuple
;
...
...
@@ -14,6 +13,7 @@ import oneit.objstore.utils.*;
import
oneit.utils.*
;
import
oneit.utils.filter.CollectionFilter
;
import
oneit.utils.filter.Filter
;
import
performa.orm.types.AppSortOption
;
/**
*
...
...
@@ -120,6 +120,7 @@ public class Utils
new
Comparator
[]{
comparator
});
}
public
static
int
getClosingSoonJobCount
(
Job
[]
jobs
)
{
Filter
<
Job
>
filter
=
Job
.
SearchByAll
()
...
...
@@ -130,4 +131,42 @@ public class Utils
return
closingSoonJobs
.
length
;
}
//to sort application list
public
static
List
<
JobApplication
>
getApplicationsSorted
(
JobApplication
[]
applications
,
AppSortOption
appSortOption
)
{
ObjectTransform
transform
=
JobApplication
.
pipesJobApplication
().
toObjectCreated
();
Comparator
comparator
=
CollectionUtils
.
DEFAULT_COMPARATOR
;
if
(
appSortOption
==
AppSortOption
.
OLDEST
)
{
transform
=
JobApplication
.
pipesJobApplication
().
toSubmittedDate
();
comparator
=
CollectionUtils
.
DEFAULT_COMPARATOR
;
}
else
if
(
appSortOption
==
AppSortOption
.
NEWEST
)
{
transform
=
JobApplication
.
pipesJobApplication
().
toSubmittedDate
();
comparator
=
CollectionUtils
.
reverse
(
CollectionUtils
.
DEFAULT_COMPARATOR
);
}
// TODO : sort by rank
// else if(appSortOption==AppSortOption.RANK)
// {
// transform = JobApplication.pipesJobApplication().toSubmittedDate();
// comparator = CollectionUtils.reverse(CollectionUtils.DEFAULT_COMPARATOR);
// }
else
if
(
appSortOption
==
AppSortOption
.
ALPHA_A_Z
)
{
transform
=
JobApplication
.
pipesJobApplication
().
toCandidate
().
toUser
().
toFirstName
();
comparator
=
CollectionUtils
.
CASE_INSENSITIVE_COMPARATOR
;
}
else
if
(
appSortOption
==
AppSortOption
.
ALPHA_Z_A
)
{
transform
=
JobApplication
.
pipesJobApplication
().
toCandidate
().
toUser
().
toFirstName
();
comparator
=
CollectionUtils
.
reverse
(
CollectionUtils
.
CASE_INSENSITIVE_COMPARATOR
);
}
return
ObjstoreUtils
.
sort
(
Arrays
.
asList
(
applications
),
new
ObjectTransform
[]{
transform
},
new
Comparator
[]{
comparator
});
}
}
cmsWebApp/webroot/extensions/adminportal/view_applicants.jsp
View file @
306aba4c
...
...
@@ -7,12 +7,46 @@
<oneit:dynIncluded>
<%
Job
job
= (Job) process.getAttribute("Job");
Job
job
= (Job) process.getAttribute("Job");
if(job==null && request.getParameter("JobID")!=null)
{
job = Job.getJobByID(transaction, Long.parseLong(request.getParameter("JobID")));
process.setAttribute("Job", job);
}
Debug.assertion(job != null, "Job is null in admin portal view applicants");
String applicationPage = WebUtils.getSamePageInRenderMode(request, WebUtils.VIEW_APPLICATION);
int closingInDays = DateDiff.getDateDiff(Calendar.DATE, DateDiff.getToday(), job.getApplyBy());
String applicationPage = WebUtils.getSamePageInRenderMode(request, WebUtils.VIEW_APPLICATION);
int closingInDays = DateDiff.getDateDiff(Calendar.DATE, DateDiff.getToday(), job.getApplyBy());
AppSortOption appSortOpt = (AppSortOption) process.getAttribute("AppSortOption");
if(request.getParameter("AppSortOption") != null)
{
appSortOpt = AppSortOption.forName((String) request.getParameter("AppSortOption"));
}
if(appSortOpt == null)
{
appSortOpt = AppSortOption.RANK;
}
JobApplication[] applications = (JobApplication[]) process.getAttribute("JobApplications");
if(application==null)
{
applications = JobApplication.SearchByAll()
.andJob(new EqualsFilter<>(job))
.andApplicationStatus(new NotEqualsFilter<>(ApplicationStatus.DRAFT))
.search(transaction);
process.setAttribute("JobApplications", applications);
}
List<JobApplication> sortedApplications = applications!=null ? Utils.getApplicationsSorted(applications, appSortOpt) : new ArrayList<JobApplication>();
process.setAttribute("AppSortOption", appSortOpt);
%>
<script type="text/javascript">
...
...
@@ -36,7 +70,7 @@
<%
int index = 0;
for(JobApplication jobApplication :
job.getSubmittedApplications()
)
for(JobApplication jobApplication :
sortedApplications
)
{
%>
<div class="appl-c-box application-row" onClick='gotoEditApplication("<%= jobApplication.getID() %>")'>
...
...
@@ -98,10 +132,18 @@
</div>
<div class="appli-shorting-dropdown">
<span class="appli-order-label">order by</span>
<select class="form-control">
<option>Rank</option>
<option>Alphabetical (A-Z)</option>
<option>Alphabetical (Z-A)</option>
<select class="form-control" onChange="location=this.value">
<%
for (AppSortOption sortOption : AppSortOption.getAppSortOptionArray())
{
String optionLink = applicationPage + "&JobID=" + job.getID() + "&AppSortOption=" + sortOption.getName() ;
%>
<option <%= (appSortOpt != null && appSortOpt == sortOption ? "selected" : "" )%> value="<%= optionLink %>">
<oneit:toString value="<%= sortOption.getDescription() %>" mode="EscapeHTML"/>
</option>
<%
}
%>
</select>
</div>
</div>
...
...
@@ -110,7 +152,7 @@
<%
int j = 0;
for(JobApplication jobApplication :
job.getSubmittedApplications()
)
for(JobApplication jobApplication :
sortedApplications
)
{
String jobMatch = FormatUtils.stringify(jobApplication.getJobMatchPercentage(), "PercentageWholeNumber", "0");
String culture = FormatUtils.stringify(jobApplication.getCulturePercentage(), "PercentageWholeNumber", "0");
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment