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
23ae6698
Commit
23ae6698
authored
Sep 11, 2019
by
nilu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
data migration changes
parent
07d83d34
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
26 deletions
+42
-26
WorkflowDataMigration.java
cmsWebApp/src/performa/utils/WorkflowDataMigration.java
+42
-26
No files found.
cmsWebApp/src/performa/utils/WorkflowDataMigration.java
View file @
23ae6698
...
@@ -5,11 +5,13 @@ import java.util.Collection;
...
@@ -5,11 +5,13 @@ import java.util.Collection;
import
oneit.objstore.ObjectTransaction
;
import
oneit.objstore.ObjectTransaction
;
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.IsNullFilter
;
import
oneit.objstore.services.TransactionServices
;
import
oneit.objstore.services.TransactionServices
;
import
oneit.objstore.services.TransactionTask
;
import
oneit.objstore.services.TransactionTask
;
import
oneit.utils.NestedException
;
import
oneit.utils.NestedException
;
import
oneit.utils.filter.CollectionFilter
;
import
oneit.utils.filter.CollectionFilter
;
import
oneit.utils.parsers.FieldException
;
import
oneit.utils.parsers.FieldException
;
import
performa.orm.ILOJobTitle
;
import
performa.orm.Job
;
import
performa.orm.Job
;
import
performa.orm.JobApplication
;
import
performa.orm.JobApplication
;
import
performa.orm.MessageTemplate
;
import
performa.orm.MessageTemplate
;
...
@@ -31,12 +33,27 @@ public class WorkflowDataMigration
...
@@ -31,12 +33,27 @@ public class WorkflowDataMigration
{
{
try
try
{
{
Job
[]
jobs
=
Job
.
searchAll
(
objTran
);
Job
[]
jobs
=
Job
.
SearchByAll
().
andWorkFlowTemplate
(
new
IsNullFilter
<>()).
search
(
objTran
);
MessageTemplate
[]
incomplete
=
MessageTemplate
.
SearchByAll
().
andApplicationStatus
(
new
EqualsFilter
<>(
ApplicationStatus
.
DRAFT
)).
andIsSystemGenerated
(
new
EqualsFilter
<>(
Boolean
.
TRUE
)).
search
(
objTran
);
MessageTemplate
[]
incomplete
=
MessageTemplate
.
SearchByAll
().
andApplicationStatus
(
new
EqualsFilter
<>(
ApplicationStatus
.
DRAFT
)).
andIsSystemGenerated
(
new
EqualsFilter
<>(
Boolean
.
TRUE
)).
search
(
objTran
);
MessageTemplate
[]
postIngest
=
MessageTemplate
.
SearchByAll
().
andApplicationStatus
(
new
EqualsFilter
<>(
ApplicationStatus
.
POST_INGEST
)).
andIsSystemGenerated
(
new
EqualsFilter
<>(
Boolean
.
TRUE
)).
search
(
objTran
);
MessageTemplate
[]
postIngest
=
MessageTemplate
.
SearchByAll
().
andApplicationStatus
(
new
EqualsFilter
<>(
ApplicationStatus
.
POST_INGEST
)).
andIsSystemGenerated
(
new
EqualsFilter
<>(
Boolean
.
TRUE
)).
search
(
objTran
);
for
(
Job
job
:
jobs
)
for
(
Job
job
:
jobs
)
{
{
if
(
job
.
getILOJobTitle
()
==
null
&&
job
.
getOccupation
()
!=
null
)
{
ILOJobTitle
[]
titles
=
ILOJobTitle
.
SearchByAll
().
andOccupation
(
new
EqualsFilter
<>(
job
.
getOccupation
())).
search
(
objTran
);
if
(
titles
.
length
>
0
)
{
job
.
setILOJobTitle
(
titles
[
0
]);
}
}
if
(
job
.
getHiringTeam
()
==
null
||
job
.
getILOJobTitle
()
==
null
)
{
continue
;
}
WorkFlowTemplate
wfTemplate
=
WorkFlowTemplate
.
createWorkFlowTemplate
(
objTran
);
WorkFlowTemplate
wfTemplate
=
WorkFlowTemplate
.
createWorkFlowTemplate
(
objTran
);
wfTemplate
.
setTemplateName
(
job
.
getJobTitle
());
wfTemplate
.
setTemplateName
(
job
.
getJobTitle
());
...
@@ -93,7 +110,6 @@ public class WorkflowDataMigration
...
@@ -93,7 +110,6 @@ public class WorkflowDataMigration
createWorkFlowStage
(
objTran
,
wfTemplate
,
"Unsuitable"
,
StageType
.
UNSUITABLE
,
sortOrder
++);
createWorkFlowStage
(
objTran
,
wfTemplate
,
"Unsuitable"
,
StageType
.
UNSUITABLE
,
sortOrder
++);
// TODO: might have to move to another transaction
for
(
JobApplication
jobApplication
:
job
.
getJobApplicationsSet
())
for
(
JobApplication
jobApplication
:
job
.
getJobApplicationsSet
())
{
{
jobApplication
.
setWorkFlowStage
(
getWFStageByStatus
(
wfTemplate
,
jobApplication
.
getApplicationStatus
()));
jobApplication
.
setWorkFlowStage
(
getWFStageByStatus
(
wfTemplate
,
jobApplication
.
getApplicationStatus
()));
...
@@ -105,31 +121,32 @@ public class WorkflowDataMigration
...
@@ -105,31 +121,32 @@ public class WorkflowDataMigration
throw
new
NestedException
(
e
);
throw
new
NestedException
(
e
);
}
}
}
}
});
}
private
void
createWorkFlowMessage
(
ObjectTransaction
objTran
,
WorkFlowStage
stage
,
MessageTemplate
mTemplate
)
throws
StorageException
,
FieldException
private
static
void
createWorkFlowMessage
(
ObjectTransaction
objTran
,
WorkFlowStage
stage
,
MessageTemplate
mTemplate
)
throws
StorageException
,
FieldException
{
{
WorkFlowMessage
wfMessage
=
WorkFlowMessage
.
createWorkFlowMessage
(
objTran
);
WorkFlowMessage
wfMessage
=
WorkFlowMessage
.
createWorkFlowMessage
(
objTran
);
wfMessage
.
setWorkFlowStage
(
stage
);
wfMessage
.
setBusinessHoursOnly
(
mTemplate
.
getBusinessHoursOnly
());
wfMessage
.
setMessageTemplate
(
mTemplate
);
wfMessage
.
setDelay
(
getDelay
(
mTemplate
));
wfMessage
.
setVariance
(
mTemplate
.
getVariance
().
toString
()
+
"m"
);
}
private
WorkFlowStage
createWorkFlowStage
(
ObjectTransaction
objTran
,
WorkFlowTemplate
wfTemplate
,
String
name
,
StageType
stageType
,
int
sortOrder
)
throws
FieldException
,
StorageException
wfMessage
.
setWorkFlowStage
(
stage
);
{
wfMessage
.
setBusinessHoursOnly
(
mTemplate
.
getBusinessHoursOnly
());
WorkFlowStage
wfStage
=
WorkFlowStage
.
createWorkFlowStage
(
objTran
);
wfMessage
.
setMessageTemplate
(
mTemplate
);
wfMessage
.
setDelay
(
getDelay
(
mTemplate
));
wfStage
.
setWorkFlowTemplate
(
wfTemplate
);
wfMessage
.
setVariance
(
mTemplate
.
getVariance
().
toString
()
+
"m"
);
wfStage
.
setName
(
name
);
wfStage
.
setStageType
(
stageType
);
return
wfStage
;
}
});
}
}
private
static
WorkFlowStage
createWorkFlowStage
(
ObjectTransaction
objTran
,
WorkFlowTemplate
wfTemplate
,
String
name
,
StageType
stageType
,
int
sortOrder
)
throws
FieldException
,
StorageException
{
WorkFlowStage
wfStage
=
WorkFlowStage
.
createWorkFlowStage
(
objTran
);
wfStage
.
setWorkFlowTemplate
(
wfTemplate
);
wfStage
.
setName
(
name
);
wfStage
.
setStageType
(
stageType
);
wfStage
.
setSortOrder
(
sortOrder
);
return
wfStage
;
}
private
static
String
getDelay
(
MessageTemplate
mTemplate
)
private
static
String
getDelay
(
MessageTemplate
mTemplate
)
{
{
StringBuilder
sb
=
new
StringBuilder
();
StringBuilder
sb
=
new
StringBuilder
();
...
@@ -155,9 +172,8 @@ public class WorkflowDataMigration
...
@@ -155,9 +172,8 @@ public class WorkflowDataMigration
{
{
return
StageType
.
UNSUITABLE
;
return
StageType
.
UNSUITABLE
;
}
}
// TODO: map other statuses
// TODO: map other statuses
return
null
;
return
StageType
.
INTERVIEW
;
}
}
public
static
WorkFlowStage
getWFStageByStatus
(
WorkFlowTemplate
template
,
ApplicationStatus
status
)
public
static
WorkFlowStage
getWFStageByStatus
(
WorkFlowTemplate
template
,
ApplicationStatus
status
)
...
@@ -176,7 +192,7 @@ public class WorkflowDataMigration
...
@@ -176,7 +192,7 @@ public class WorkflowDataMigration
}
}
// TODO: map other statuses
// TODO: map other statuses
return
null
;
return
getWFStage
(
template
,
StageType
.
INTERVIEW
)
;
}
}
private
static
WorkFlowStage
getWFStage
(
WorkFlowTemplate
template
,
StageType
stageType
)
private
static
WorkFlowStage
getWFStage
(
WorkFlowTemplate
template
,
StageType
stageType
)
...
...
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