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
028f1b0d
Commit
028f1b0d
authored
May 25, 2017
by
Nilu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Input analysis completed
parent
595c3bd1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
159 additions
and
13 deletions
+159
-13
TestAnalysisFP.java
cmsWebApp/src/performa/form/TestAnalysisFP.java
+95
-5
BaseTestInput.java
cmsWebApp/src/performa/orm/BaseTestInput.java
+0
-0
Level.java
cmsWebApp/src/performa/orm/Level.java
+7
-0
TestInput.xml
cmsWebApp/src/performa/orm/TestInput.xml
+2
-0
AnalysisEngine.java
cmsWebApp/src/performa/utils/AnalysisEngine.java
+6
-5
LevelSearcher.java
cmsWebApp/src/performa/utils/LevelSearcher.java
+27
-0
CustomServlets_performa.xml
...p/webroot/extensions/performa/CustomServlets_performa.xml
+2
-1
GeneralConfig_performa.xml
...pp/webroot/extensions/performa/GeneralConfig_performa.xml
+5
-0
testAnalysis.jsp
cmsWebApp/webroot/extensions/performa/testAnalysis.jsp
+15
-2
No files found.
cmsWebApp/src/performa/form/TestAnalysisFP.java
View file @
028f1b0d
...
@@ -11,8 +11,13 @@ import oneit.servlets.jsp.TableTag;
...
@@ -11,8 +11,13 @@ import oneit.servlets.jsp.TableTag;
import
oneit.servlets.portability.FileDownloader
;
import
oneit.servlets.portability.FileDownloader
;
import
oneit.servlets.process.*
;
import
oneit.servlets.process.*
;
import
oneit.utils.*
;
import
oneit.utils.*
;
import
oneit.utils.parsers.FieldException
;
import
oneit.utils.table.*
;
import
oneit.utils.table.*
;
import
performa.orm.Answer
;
import
performa.orm.Candidate
;
import
performa.orm.Question
;
import
performa.orm.TestInput
;
import
performa.orm.TestInput
;
import
performa.utils.AnalysisEngine
;
/**
/**
*
*
...
@@ -28,10 +33,11 @@ public class TestAnalysisFP extends ORMProcessFormProcessor
...
@@ -28,10 +33,11 @@ public class TestAnalysisFP extends ORMProcessFormProcessor
TestInput
testInput
=
(
TestInput
)
process
.
getAttribute
(
"TestAnalysis"
);
TestInput
testInput
=
(
TestInput
)
process
.
getAttribute
(
"TestAnalysis"
);
ByteArrayOutputStream
bos
=
new
ByteArrayOutputStream
();
ByteArrayOutputStream
bos
=
new
ByteArrayOutputStream
();
byte
[]
bytes
;
byte
[]
bytes
;
//TO-DO -> "filecontent" processing
try
try
{
{
loadData
(
testInput
,
process
.
getTransaction
());
ExcelExporter
.
ExportAppender
excelRenderer
=
getExportAppender
(
testInput
.
getCSV
());
ExcelExporter
.
ExportAppender
excelRenderer
=
getExportAppender
(
testInput
.
getCSV
());
excelRenderer
.
export
(
bos
);
excelRenderer
.
export
(
bos
);
bytes
=
bos
.
toByteArray
();
bytes
=
bos
.
toByteArray
();
...
@@ -73,19 +79,103 @@ public class TestAnalysisFP extends ORMProcessFormProcessor
...
@@ -73,19 +79,103 @@ public class TestAnalysisFP extends ORMProcessFormProcessor
return
model
;
return
model
;
}
}
public
void
loadData
(
TestInput
testInput
,
ObjectTransaction
objTran
)
{
BufferedReader
bReader
=
null
;
String
line
=
""
;
String
csvSeparator
=
","
;
boolean
first
=
true
;
List
<
Candidate
>
candidates
=
new
ArrayList
<>();
List
<
Answer
>
answers
=
new
ArrayList
<>();
try
{
bReader
=
new
BufferedReader
(
new
InputStreamReader
(
testInput
.
getCSV
().
getInputStream
()));
while
((
line
=
bReader
.
readLine
())
!=
null
)
{
String
[]
values
=
line
.
trim
().
split
(
csvSeparator
);
if
(
first
)
{
for
(
int
i
=
1
;
i
<
values
.
length
;
i
++)
{
Candidate
candidate
=
Candidate
.
createCandidate
(
objTran
);
candidate
.
setFirstName
(
values
[
i
]);
candidate
.
setTestInput
(
testInput
);
candidates
.
add
(
candidate
);
}
first
=
false
;
}
else
{
Question
question
=
Question
.
getQuestionByID
(
objTran
,
Long
.
valueOf
(
values
[
0
]));
for
(
int
i
=
1
;
i
<
values
.
length
;
i
++)
{
Answer
answer
=
Answer
.
createAnswer
(
objTran
);
answer
.
setAnswerNo
(
Integer
.
parseInt
(
values
[
i
]));
answer
.
setCandidate
(
candidates
.
get
(
i
-
1
));
answer
.
setQuestion
(
question
);
answers
.
add
(
answer
);
}
}
}
AnalysisEngine
.
analyseAnswers
(
answers
.
toArray
(
new
Answer
[
0
]),
testInput
.
getLevel
());
}
catch
(
FileNotFoundException
ex
)
{
LogMgr
.
log
(
LoggingArea
.
ALL
,
LogLevel
.
PROCESSING2
,
"UploadCSVFP loadData : FileNotFoundException :"
+
ex
);
throw
new
NestedException
(
ex
);
}
catch
(
IOException
ex
)
{
LogMgr
.
log
(
LoggingArea
.
ALL
,
LogLevel
.
PROCESSING2
,
"UploadCSVFP loadData : IOException :"
+
ex
);
throw
new
NestedException
(
ex
);
}
catch
(
FieldException
ex
)
{
LogMgr
.
log
(
LoggingArea
.
ALL
,
LogLevel
.
PROCESSING2
,
"UploadCSVFP loadData : FieldException :"
+
ex
);
throw
new
NestedException
(
ex
);
}
finally
{
try
{
if
(
bReader
!=
null
)
{
bReader
.
close
();
}
}
catch
(
IOException
ex
)
{
LogMgr
.
log
(
LoggingArea
.
ALL
,
LogLevel
.
PROCESSING2
,
"UploadCSVFP loadData : IOException :"
+
ex
);
throw
new
NestedException
(
ex
);
}
}
}
@Override
@Override
public
void
validate
(
ORMProcessState
process
,
SubmissionDetails
submission
,
MultiException
exceptions
,
Map
params
)
throws
StorageException
public
void
validate
(
ORMProcessState
process
,
SubmissionDetails
submission
,
MultiException
exceptions
,
Map
params
)
throws
StorageException
{
{
super
.
validate
(
process
,
submission
,
exceptions
,
params
);
super
.
validate
(
process
,
submission
,
exceptions
,
params
);
TestInput
testAnalysis
=
(
TestInput
)
process
.
getAttribute
(
"TestAnalysis"
);
TestInput
testInput
=
(
TestInput
)
process
.
getAttribute
(
"TestAnalysis"
);
Debug
.
assertion
(
test
Analysis
!=
null
,
"Test Analysis
is null while Processing CSV File."
);
Debug
.
assertion
(
test
Input
!=
null
,
"Test Input
is null while Processing CSV File."
);
if
(
test
Analysis
.
getCSV
()
!=
null
)
if
(
test
Input
.
getCSV
()
!=
null
)
{
{
BusinessObjectParser
.
assertFieldCondition
(
SUPPORTED_TYPES
.
contains
(
test
Analysis
.
getCSV
().
getContentType
()),
testAnalysis
,
TestInput
.
FIELD_CSV
,
"invalid"
,
exceptions
,
true
,
submission
.
getRequest
());
BusinessObjectParser
.
assertFieldCondition
(
SUPPORTED_TYPES
.
contains
(
test
Input
.
getCSV
().
getContentType
()),
testInput
,
TestInput
.
FIELD_CSV
,
"invalid"
,
exceptions
,
true
,
submission
.
getRequest
());
}
}
}
}
}
}
cmsWebApp/src/performa/orm/BaseTestInput.java
View file @
028f1b0d
This diff is collapsed.
Click to expand it.
cmsWebApp/src/performa/orm/Level.java
View file @
028f1b0d
...
@@ -16,4 +16,10 @@ public class Level extends BaseLevel
...
@@ -16,4 +16,10 @@ public class Level extends BaseLevel
{
{
return
"Level"
;
return
"Level"
;
}
}
@Override
public
String
getToString
()
{
return
getLevelDescription
();
}
}
}
\ No newline at end of file
cmsWebApp/src/performa/orm/TestInput.xml
View file @
028f1b0d
...
@@ -11,6 +11,8 @@
...
@@ -11,6 +11,8 @@
<ATTRIB
name=
"CSV"
type=
"BinaryContent"
mandatory=
"true"
attribHelper=
"BLOBAttributeHelper"
attribHelperInstance=
"BLOBAttributeHelper.INSTANCE"
binaryHandler=
"loggedin"
/>
<ATTRIB
name=
"CSV"
type=
"BinaryContent"
mandatory=
"true"
attribHelper=
"BLOBAttributeHelper"
attribHelperInstance=
"BLOBAttributeHelper.INSTANCE"
binaryHandler=
"loggedin"
/>
<SINGLEREFERENCE
name=
"Level"
type=
"Level"
/>
</TABLE>
</TABLE>
</BUSINESSCLASS>
</BUSINESSCLASS>
...
...
cmsWebApp/src/performa/utils/AnalysisEngine.java
View file @
028f1b0d
...
@@ -24,7 +24,7 @@ import performa.orm.Level;
...
@@ -24,7 +24,7 @@ import performa.orm.Level;
public
class
AnalysisEngine
public
class
AnalysisEngine
{
{
public
void
analyseAnswers
(
Answer
[]
answers
,
Level
level
)
public
static
void
analyseAnswers
(
Answer
[]
answers
,
Level
level
)
{
{
ObjectTransaction
objTran
=
level
.
getTransaction
();
ObjectTransaction
objTran
=
level
.
getTransaction
();
...
@@ -70,12 +70,13 @@ public class AnalysisEngine
...
@@ -70,12 +70,13 @@ public class AnalysisEngine
FactorScoreResult
result
=
FactorScoreResult
.
SearchByFactorScore
()
FactorScoreResult
result
=
FactorScoreResult
.
SearchByFactorScore
()
.
andFactor
(
new
EqualsFilter
<>(
factor
))
.
andFactor
(
new
EqualsFilter
<>(
factor
))
.
andLevel
(
new
EqualsFilter
<>(
level
))
.
andLevel
(
new
EqualsFilter
<>(
level
))
.
andFromScore
(
new
Greater
ThanEqualFilter
<>(
factorScore
))
.
andFromScore
(
new
Less
ThanEqualFilter
<>(
factorScore
))
.
andToScore
(
new
Less
ThanEqualFilter
<>(
factorScore
))
.
andToScore
(
new
Greater
ThanEqualFilter
<>(
factorScore
))
.
search
(
objTran
);
.
search
(
objTran
);
int
score
=
result
.
getColorCode
().
getWeightage
();
int
score
=
result
!=
null
?
result
.
getColorCode
().
getWeightage
()
:
0
;
System
.
out
.
println
(
"score :: "
+
score
);
// TODO: calculate normalised score based on importance
// TODO: calculate normalised score based on importance
}
}
...
...
cmsWebApp/src/performa/utils/LevelSearcher.java
0 → 100644
View file @
028f1b0d
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package
performa
.
utils
;
import
oneit.objstore.BaseBusinessClass
;
import
oneit.objstore.ObjectTransaction
;
import
oneit.objstore.rdbms.filters.ILikeFilter
;
import
oneit.servlets.jsp.ORMTextSearcher
;
import
performa.orm.Level
;
/**
*
* @author nilu
*/
public
class
LevelSearcher
implements
ORMTextSearcher
{
@Override
public
BaseBusinessClass
[]
search
(
ObjectTransaction
tx
,
String
searchTerm
)
{
return
Level
.
SearchByAll
().
andLevelDescription
(
new
ILikeFilter
(
searchTerm
,
"%"
,
"%"
)).
search
(
tx
);
}
}
\ No newline at end of file
cmsWebApp/webroot/extensions/performa/CustomServlets_performa.xml
View file @
028f1b0d
...
@@ -6,5 +6,5 @@
...
@@ -6,5 +6,5 @@
<INHERITS
factory=
"Named"
nodename=
"CoreORMAdmin"
/>
<INHERITS
factory=
"Named"
nodename=
"CoreORMAdmin"
/>
<FORM
name=
"*.testAnalysis"
factory=
"Participant"
class=
"performa.form.TestAnalysisFP"
/>
<FORM
name=
"*.testAnalysis"
factory=
"Participant"
class=
"performa.form.TestAnalysisFP"
/>
</NODE>
</NODE>
</OBJECTS>
</OBJECTS>
\ No newline at end of file
cmsWebApp/webroot/extensions/performa/GeneralConfig_performa.xml
View file @
028f1b0d
...
@@ -13,4 +13,8 @@
...
@@ -13,4 +13,8 @@
</NODE>
</NODE>
<NODE
name=
"StorageMappings::Performa"
>
<MAP
code=
"TestInput"
class=
"performa.orm.TestInput"
/>
</NODE>
</OBJECTS>
</OBJECTS>
\ No newline at end of file
cmsWebApp/webroot/extensions/performa/testAnalysis.jsp
View file @
028f1b0d
...
@@ -25,7 +25,14 @@
...
@@ -25,7 +25,14 @@
<%@include file="/editor/header.jsp"%>
<%@include file="/editor/header.jsp"%>
<oneit:layout_total widths="<%= new double[] {1, 4, 7} %>" skin="bootstrap">
<style>
.ui-autocomplete-input
{
width: 80%;
}
</style>
<oneit:layout_total widths="<%= new double[] {1, 4, 1, 4, 2} %>" skin="bootstrap">
<oneit:skin tagName="layout_row">
<oneit:skin tagName="layout_row">
<oneit:layout_label width="1">
<oneit:layout_label width="1">
<strong style="line-height: 30px">CSV : </strong>
<strong style="line-height: 30px">CSV : </strong>
...
@@ -33,8 +40,14 @@
...
@@ -33,8 +40,14 @@
<oneit:layout_field width="1">
<oneit:layout_field width="1">
<oneit:ormInput obj="<%= testInput %>" attributeName="CSV" type="file" class="form-control" required="required" style="padding:4px;" accept=".csv"/>
<oneit:ormInput obj="<%= testInput %>" attributeName="CSV" type="file" class="form-control" required="required" style="padding:4px;" accept=".csv"/>
</oneit:layout_field>
</oneit:layout_field>
<oneit:layout_label width="1">
<strong style="line-height: 30px">Level : </strong>
</oneit:layout_label>
<oneit:layout_field width="1">
<tagfile:ormsingleasso_autocomplete obj="<%= testInput %>" assocName="Level" searcher="<%= new LevelSearcher() %>"/>
</oneit:layout_field>
<oneit:layout_field width="1">
<oneit:layout_field width="1">
<oneit:button value="Import CSV" name="
importCSV"
cssClass="btn btn-primary" requestAttribs='<%= CollectionUtils.EMPTY_MAP %>'/>
<oneit:button value="Import CSV" name="
testAnalysis"
cssClass="btn btn-primary" requestAttribs='<%= CollectionUtils.EMPTY_MAP %>'/>
</oneit:layout_field>
</oneit:layout_field>
</oneit:skin>
</oneit:skin>
</oneit:layout_total>
</oneit:layout_total>
...
...
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