Commit 61a2542d by Owen Ryan Ang

Initial commit for mobile gde. Added upload API

parent 3cddc7a7
......@@ -11,13 +11,6 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
......@@ -29,5 +22,12 @@
<attribute name="owner.project.facets" value="jst.web"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="test" value="true"/>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
......
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="WebGde-0.0.1-SNAPSHOT">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/WebContent" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<property name="java-output-path" value="/WebGde/build/classes"/>
<property name="context-root" value="WebGde"/>
</wb-module>
</project-modules>
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="WebGde-0.0.1-SNAPSHOT">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/WebContent" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<property name="java-output-path" value="/WebGde/build/classes"/>
<property name="context-root" value="WebGde"/>
</wb-module>
</project-modules>
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
id="WebApp_ID" version="3.1">
<display-name>WebGde</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>WEBGDERest</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>com.svi.webgde.restservice.services</param-value>
</init-param>
<init-param>
<param-name>jersey.config.server.provider.classnames</param-name>
<param-value>org.glassfish.jersey.media.multipart.MultiPartFeature</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>WEBGDERest</servlet-name>
<url-pattern>/svc/*</url-pattern>
</servlet-mapping>
<context-param>
<param-name>CONFIG_INI_LOCATION</param-name>
<param-value>/WEB-INF/config/config.ini</param-value>
</context-param>
<context-param>
<param-name>AWS_CREDENTIALS_INI_LOCATION</param-name>
<param-value>/WEB-INF/config/credentials.properties</param-value>
</context-param>
<context-param>
<param-name>JWT_LOCATION</param-name>
<param-value>/WEB-INF/assets/secret.key</param-value>
</context-param>
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
id="WebApp_ID" version="3.1">
<display-name>WebGde</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>WEBGDERest</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>com.svi.webgde.restservice.services</param-value>
</init-param>
<init-param>
<param-name>jersey.config.server.provider.classnames</param-name>
<param-value>org.glassfish.jersey.media.multipart.MultiPartFeature</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>WEBGDERest</servlet-name>
<url-pattern>/svc/*</url-pattern>
</servlet-mapping>
<context-param>
<param-name>CONFIG_INI_LOCATION</param-name>
<param-value>/WEB-INF/config/config.ini</param-value>
</context-param>
<context-param>
<param-name>AWS_CREDENTIALS_INI_LOCATION</param-name>
<param-value>/WEB-INF/config/credentials.properties</param-value>
</context-param>
<context-param>
<param-name>JWT_LOCATION</param-name>
<param-value>/WEB-INF/assets/secret.key</param-value>
</context-param>
</web-app>
\ No newline at end of file
//Data Input Field Config
export var SCHEMA_FILE_PATH = "./WebGde-Widgets/sample_schema/HR Speed Test schema.json";
export var SCHEMA_FILE_PATH = "./WebGde-Widgets/sample_schema/newfields.json";
// export var SCHEMA_FILE_PATH = "./WebGde-Widgets/sample_schema/HR Speed Test schema.json";
//DBLookup Webservice URL
export var DB_URL = "http://localhost:8080/WebGde/svc/gfs-rest/db-lookup"
\ No newline at end of file
*{
-webkit-font-smoothing: auto;
font-size: 11px;
* {
-webkit-font-smoothing: auto;
font-size: 16px;
letter-spacing: 0.1em;
text-rendering: optimizeLegibility;
font-weight: normal;
font-family: OpenSans, sans-serif;
font-family: Inter;
font-style: normal;
box-sizing: border-box;
}
.text-style {
......@@ -13,28 +14,29 @@
text-align: center;
}
#input-field-container{
height : 600px;
width : 400px;
#input-field-container {
padding: 10px;
height: 100vh;
width: 100%;
display: flex;
flex-direction: column;
overflow: auto;
background-image: linear-gradient(to bottom, #23569f, #00a8c0);
resize: both;
/* resize: both; */
}
#input-field-container::-webkit-scrollbar {
width: 10px;
width: 20px;
}
#input-field-container::-webkit-scrollbar-track {
background-color: #f1f1f1;
}
#input-field-container::-webkit-scrollbar-thumb {
background-color: #888;
}
#input-field-container::-webkit-scrollbar-thumb:hover {
background-color: #555;
}
......@@ -43,21 +45,35 @@
display: flex;
flex-direction: column;
min-width: 500px;
}
input[type=text] {
width: 100%;
}
/* .field-header{
flex-grow: 0.1;
} */
/* .SECTION1.inputField {
width: 100%;
height: 100%;
}
} */
/*
.SECTION2.inputField {
border: none;
outline: none;
width: 100%;
height: 100%;
} */
} */
.field-header {
color: white;
align-self: center;
}
.Section {
width: 100%;
height: 25px !important;
}
.inputField {
width: 100%;
height: 100%;
......@@ -67,16 +83,17 @@ input[type=text] {
width: 100% !important;
}
option {
border: none;
outline: none;
}
.fieldContainer {
/* layout config */
display: flex;
flex-direction: row;
flex-direction: column;
/* border config */
border-style: solid;
border-width: thin;
border-color:#446397;
padding: 0px 0px 0px 4px;
padding: 0px 5px 10px 4px;
flex-wrap: nowrap;
}
......@@ -84,17 +101,35 @@ input[type=text] {
background-color: yellow;
}
.image-capture {
display: flex;
flex-direction: column;
width: 100%;
padding-bottom: 10px;
padding-top: 10px;
}
#fields {
padding: 18px;
border-radius: 25px;
width: auto;
display: flex;
flex: 1;
max-height: 100vh;
display: inline-block;
height: auto;
background-color: white;
overflow-y: auto;
display: flex;
flex-direction: column;
border-style: solid;
border-width: thin;
border-color: #446397;
box-shadow: 0px 0px 12px 0px rgba(0, 0, 0, 0.54);
-webkit-box-shadow: 0px 0px 12px 0px rgba(0, 0, 0, 0.54);
-moz-box-shadow: 0px 0px 12px 0px rgba(0, 0, 0, 0.54);
}
#fields>div {
background-color:white;
background-color: white;
}
.submitButtons {
......@@ -104,52 +139,159 @@ input[type=text] {
font-size: 13px;
width: 93px;
margin-top: 10px;
margin-bottom: 15px;
cursor: pointer;
background-color: white;
padding: 10px;
width: 100%;
border-radius: 5px;
outline: none;
border: none;
font-size: 16px;
box-shadow: 0px 0px 12px 0px rgba(0, 0, 0, 0.54);
-webkit-box-shadow: 0px 0px 12px 0px rgba(0, 0, 0, 0.54);
-moz-box-shadow: 0px 0px 12px 0px rgba(0, 0, 0, 0.54);
}
.labelContainer {
@media only screen and (max-width: 412px) {
.date-range {
display: flex;
flex-direction: column;
justify-content: space-between;
}
}
.dash {
align-self: center;
padding: 6px;
}
.date-range {
display: flex;
flex-direction: row;
width: 98px;
padding: 3px;
margin-top: 4px;
justify-content: space-between;
}
.dateContainer {
width: 100%;
}
label {
font-size: 14px;
font-weight: 700;
}
.captureButtons {
display: inline-block;
width: 100%;
overflow-x: clip;
flex-wrap: nowrap;
flex-grow: 1;
border-radius: 2px;
background-color: white;
border-style: solid;
border-width: 0.1cm;
border-color: #d4d2d2;
}
.labelContainer {
width: 100%;
padding: 2px;
margin-top: 5px;
}
.inputContainer {
display: inline-block;
width: 100%;
padding-left: 3px;
overflow-x: clip;
flex-wrap: nowrap;
flex-grow: 1;
border-radius: 2px
}
.input-invalid {
border-color: #ff3333 !important;
border-style: solid;
border-radius: inherit;
}
.input-valid {
/* border-color: #000000 !important; */
border-style: solid;
border-radius: inherit;
}
input:focus, textarea:focus{
/* background-color: yellow; */
input:focus,
textarea:focus {
background-color: yellow;
border: 0px;
border-radius: inherit;
}
input[type=text] {
input[type=text],
input[type=date],
input[type=time] {
width: 100%;
height: 25px;
padding: 20px;
}
input[type=checkbox],
input[type=radio] {
width: 16px;
height: 16px;
size: 16px;
}
.radio-like-checkbox {
display: flex;
padding: 5px;
}
.checkbox {
display: flex;
padding: 5px;
}
input[type=file],
input[type=button] {
width: 100%;
padding: 5px;
border-style: solid;
border-width: thin;
border-color: gray;
}
.dropdown-content {
padding: 10px;
border-style: solid;
border-width: thin;
border-color: gray;
}
select {
width: 100%;
height: 28px;
border-style: solid;
border-width: thin;
border-color: gray;
padding: 2px;
color: #444;
}
textarea{
textarea {
resize: none;
padding: 20px;
}
#text-area{width: 91%;font-size: 11px;padding: 9px 9px;margin-left: 15px;margin-top: 5px;margin-bottom: 5px;height: 103px;}
\ No newline at end of file
#text-area {
width: 91%;
font-size: 11px;
padding: 9px 9px;
margin-left: 15px;
margin-top: 5px;
margin-bottom: 5px;
height: 103px;
}
\ No newline at end of file
......@@ -32,7 +32,11 @@ export const validateInput = (fieldID, value) => {
return validateSpecific(validation, value)
case 'numeric':
return validateNumeric(validation, value)
case 'timepicker':
return validateTime(validation, value)
case 'date':
case 'daterange':
return validateDateRange(validation, value)
case 'datepicker':
// console.log('date')
return validateDate(validation, value)
......@@ -168,6 +172,29 @@ const validateNumeric = (validation, value) => {
* valid - true if no errors found after validation
* errors - list of errors found during validation
*/
const validateDateRange = (validation, value) => {
const { mandatory, regexformat } = validation
try{
if(mandatory && (value.length===0 || !value.match(/\S/g))) return { valid: false, errors: ['Field is empty'] }
return { valid: true }
} catch(err) {
throw err
}
}
/**
*
* @param {*} validation
* object containing rules for validating date inputs
* @param {*} value
* input to be checked
* @returns
* object containg:
* valid - true if no errors found after validation
* errors - list of errors found during validation
*/
const validateDate = (validation, value) => {
const { mandatory, regexformat } = validation
......@@ -180,6 +207,30 @@ const validateDate = (validation, value) => {
}
}
/**
*
* @param {*} validation
* object containing rules for validating date inputs
* @param {*} value
* input to be checked
* @returns
* object containg:
* valid - true if no errors found after validation
* errors - list of errors found during validation
*/
const validateTime = (validation, value) => {
const { mandatory, regexformat } = validation
try{
if(mandatory && (value.length===0 || !value.match(/\S/g))) return { valid: false, errors: ['Field is empty'] }
return { valid: true }
} catch(err) {
throw err
}
}
/**
*
......
......@@ -38,9 +38,9 @@ export const HIGH_LIGHT_SCHEMA = "./WebGde-Widgets/sample_schema/dbSchema_anno.
export const ROOT_FOLDER = "/WebGde-Widgets";
//this determines if the images will be retrieved from the gfs
export const DOMAIN = "http://54.146.187.173:8080"
export const DOMAIN = "http://3.86.35.226:8080"
export const CONTEXTROOT = "gfs-explorer-ws"
export const GFS_URL = "http://54.146.187.173:8080" + "/WebGde/svc/gfs-rest"
export const GFS_URL = "http://3.86.35.226:8080" + "/MobileGde/svc/gfs-rest"
export const FOLDER_URL = DOMAIN + "/" + CONTEXTROOT + "/svc/gfs-rest/get-folder?parentPath=/Users/"
export const DOWNLOAD_URL = DOMAIN + "/" + CONTEXTROOT + "/svc/gfs-rest/get-download-link"
export const IS_RETRIEVE_FROM_GFS = "N"
......@@ -51,8 +51,8 @@ export const INVALID_KEYS = "F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12,PrintScreen
export const IS_RETRIEVE_FROM_BPO = "Y"
// export const BPO_URL = "http://35.171.20.94:8080/bpo-sqa/"
// export const CURRENT_NODE = "Web GDE"
export const BPO_URL = "http://54.146.187.173:8080/bpo/"
export const CURRENT_NODE = "Web_GDE_DEV"
export const BPO_URL = "http://3.86.35.226:8080/bpo/"
export const CURRENT_NODE = "Mobile_GDE_DEV"
export const ENCODING_PASS = "PASS1"
export const NEXT_NODE = "Complete"
export const EXCEPTION_NODE = "Exception"
......
{
"ACCOUNTING DOCUMENTS": {
"SECTION1": {
"Checkbox_List": {
"fieldLabel": "Checkbox List",
"aka": "field28",
"source": "s",
"validation": {
"fieldLength": 30,
"collection": "checklist",
"items": [
"sample-item1",
"sample-item2",
"sample-item3",
"sample-item4",
"sample-item5"
],
"mandatory": true
}
},
"Radio_List": {
"fieldLabel": "Radio List",
"aka": "field28",
"source": "s",
"validation": {
"fieldLength": 30,
"collection": "radiolist",
"items": [
"sample-item1",
"sample-item2",
"sample-item3",
"sample-item4",
"sample-item5"
],
"mandatory": true
}
},
"Upload_Audio": {
"fieldLabel": "Upload or Record Audio",
"aka": "field7",
"validation": {
"collection": "audio-upload",
"mandatory": true
}
},
"Upload Video": {
"fieldLabel": "Upload or Record Video",
"aka": "field7",
"validation": {
"collection": "video-upload",
"mandatory": true
}
},
"Time": {
"fieldLabel": "Time",
"aka": "field5",
"validation": {
"fieldLength": 20,
"collection": "timepicker",
"mandatory": false
}
},
"Date_Range": {
"fieldLabel": "Date Range",
"aka": "field5",
"validation": {
"fieldLength": 20,
"collection": "daterange",
"mandatory": false
}
}
},
"SECTIONNEXT": {
"Name": {
"fieldLabel": "Name",
"aka": "field7",
"validation": {
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "`~!@#&$%^*_={}[]:;/\"|\\<>",
"mandatory": true
}
},
"Subject": {
"fieldLabel": "Subject",
"aka": "field8",
"validation": {
"fieldLength": 200,
"collection": "alphanumeric",
"mandatory": true
}
},
"Document_No": {
"fieldLabel": "Document No",
"aka": "field6",
"validation": {
"fieldLength": 30,
"collection": "alphanumeric",
"invalidchar": "`~!@#&$%^*={}[]:;/\"|\\<>",
"mandatory": true
}
},
"Date": {
"fieldLabel": "Date",
"aka": "field5",
"validation": {
"fieldLength": 20,
"collection": "datepicker",
"mandatory": false
}
}
}
},
"BANK APPLICATION FORMS": {
"SECTION2": {
"Checkbox_List": {
"fieldLabel": "Checkbox List",
"aka": "field28",
"source": "s",
"validation": {
"fieldLength": 30,
"collection": "checklist",
"items": [
"sample-item1",
"sample-item2",
"sample-item3",
"sample-item4",
"sample-item5"
],
"mandatory": true
}
},
"Radio List": {
"fieldLabel": "Radio List",
"aka": "field28",
"source": "s",
"validation": {
"fieldLength": 30,
"collection": "radiolist",
"items": [
"sample-item1",
"sample-item2",
"sample-item3",
"sample-item4",
"sample-item5"
],
"mandatory": true
}
},
"Upload_Audio": {
"fieldLabel": "Upload or Record Audio",
"aka": "field7",
"validation": {
"collection": "audio-upload",
"mandatory": true
}
},
"Upload_Video": {
"fieldLabel": "Upload or Record Video",
"aka": "field7",
"validation": {
"collection": "video-upload",
"mandatory": true
}
},
"Time": {
"fieldLabel": "Time",
"aka": "field5",
"validation": {
"fieldLength": 20,
"collection": "timepicker",
"mandatory": false
}
},
"Date_Range": {
"fieldLabel": "Date Range",
"aka": "field5",
"validation": {
"fieldLength": 20,
"collection": "daterange",
"mandatory": false
}
}
}
},
"HR FILES": {
"SECTION3": {
"Upload_Audio": {
"fieldLabel": "Upload Audio",
"aka": "field7",
"validation": {
"collection": "audio-upload",
"mandatory": true
}
},
"Upload_Video": {
"fieldLabel": "Upload Video",
"aka": "field7",
"validation": {
"collection": "video-upload",
"mandatory": true
}
},
"Name": {
"fieldLabel": "Name",
"aka": "field10",
"validation": {
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "`~!@#&$%^*_={}[]:;/\"|\\<>",
"mandatory": true
}
},
"Subject": {
"fieldLabel": "Subject",
"aka": "field12",
"validation": {
"fieldLength": 200,
"collection": "alphanumeric",
"mandatory": true
}
},
"Employee_No": {
"fieldLabel": "Employee No",
"aka": "field11",
"validation": {
"fieldLength": 30,
"collection": "alphanumeric",
"invalidchar": "`~!@#&$%^*={}[]:;/\"|\\<>",
"mandatory": false
}
},
"Date": {
"fieldLabel": "Date",
"aka": "field9",
"validation": {
"fieldLength": 20,
"collection": "datepicker",
"mandatory": false
}
}
}
}
}
\ No newline at end of file
......@@ -17,8 +17,8 @@
<script src="https://cdn.rawgit.com/seikichi/tiff.js/master/tiff.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.8.0/jszip.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.8.0/xlsx.js"></script>
<script src="https://auth.svi.cloud/auth/js/keycloak.js"></script>
<script type="text/javascript" src="./keycloak-login.js"></script>
<!-- <script src="https://auth.svi.cloud/auth/js/keycloak.js"></script>
<script type="text/javascript" src="./keycloak-login.js"></script> -->
</head>
<body>
......
......@@ -23,6 +23,7 @@ import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.ResponseBuilder;
import javax.ws.rs.core.StreamingOutput;
import org.glassfish.jersey.media.multipart.FormDataParam;
import org.json.simple.JSONObject;
import com.opencsv.CSVReader;
......@@ -36,7 +37,7 @@ import com.svi.webgde.restservice.utils.XMLUtil;
public class GDEWebServices {
@GET
@Path("/test")
@Path("/test-upload")
public Response testWebservice() {
return Response.ok("test webservice").build();
}
......@@ -289,4 +290,24 @@ public class GDEWebServices {
response.header("content-disposition", String.format("attachment; filename=\"%s\"", file.getName()));
return response.build();
}
@POST
@Path("/upload-file")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(MediaType.APPLICATION_JSON)
public Response uploadFile(@FormDataParam("file") InputStream fileInputStream,
@FormDataParam("fileName") String fileName,
@FormDataParam("directory") String directory) {
String filePath = directory + File.separator + fileName;
try {
Files.copy(fileInputStream, new File(filePath).toPath());
JSONObject responseJson = new JSONObject();
responseJson.put("status", 200);
return Response.ok(responseJson.toString()).build();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
}
}
}
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