Add new file

parent f8c14f6a
<!doctype html>
<%@page import="java.util.Base64"%>
<%@page import="ibase.webitm.utility.ITMException"%>
<%@page import="java.rmi.RemoteException"%>
<%@page import="ibase.webitm.ejb.DBAccessEJB"%>
<%@page import="ibase.utility.BaseLogger"%>
<%@page import="ibase.edi.service.VisionEDIService"%>
<%@page import="java.io.File"%>
<%@page import="ibase.utility.CommonConstants"%>
<%@page import="ibase.utility.UserInfoBean"%>
<%@page import="ibase.ejb.CommonDBAccessEJB"%>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Show Data</title>
<base href="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico"/>
<link rel="stylesheet" type="text/css" href="ws/assets/css/indigo-pink.css" />
<!-- <link rel="stylesheet" type="text/css" href="ws/assets/css/styles.css" /> -->
<link rel="stylesheet" type="text/css" href="ws/assets/bootstrap/scss/_root.scss" />
<link rel="stylesheet" type="text/css" href="show-file-content/assets/styles.css" />
</head>
<%
String objName = request.getParameter( "OBJ_NAME" );
String userCode = request.getParameter("chg_user.String");
String appId = request.getParameter("app_id.String");
String responseInfo = request.getParameter("response_info.String");
String ediDataLogPathEncodedString = "";
CommonDBAccessEJB commonDBAccessEJB = new CommonDBAccessEJB();
DBAccessEJB dbAccess = new DBAccessEJB();
UserInfoBean userInfo = commonDBAccessEJB.createUserInfo(userCode);
String transDB = userInfo.getTransDB();
String tranId = request.getParameter("tran_id.String"); //here it is taking the "tran_id" from the front end
DBAccessEJB dbacessEjb = new DBAccessEJB();
String response_info = dbacessEjb.getDBColumnValue("api_call_log", "to_char(response_info)", "tran_id='"+tranId+"'",transDB);
//A String is declared as "response_info" to take the details of the column"response_info" and store it here
BaseLogger.log("3", null, null, "Response_info " + response_info);
int indexLogFileName = response_info.lastIndexOf(":");
//in the "response_info" column there is "Data File Name" where we have the (.json) file
BaseLogger.log("3", null, null, "indexLogFileName--- " + indexLogFileName);
String logFileName = response_info.substring(indexLogFileName + 1);
BaseLogger.log("3", null, null, "logFileName--- " + logFileName);
String ediDataLogPath = CommonConstants.EDI_LOG + File.separator + logFileName.trim();
//in the respose column we have taken "Data File Name" which consist of the combination of (batch_ID.json) file
BaseLogger.log("3", null, null, "ediDataLogPath1111 " + ediDataLogPath);
String batchID = "";
int indexDataFilePathStart = response_info.lastIndexOf("3)");
BaseLogger.log("3", null, null, "IndexDataFilePathStart " + indexDataFilePathStart);
int indexDataFilePathEnd = response_info.lastIndexOf("--");
BaseLogger.log("3", null, null, "IndexDataFilePathEnd " + indexDataFilePathEnd);
String dataFilePath = response_info.substring(indexDataFilePathStart, indexDataFilePathEnd);
int indexDataFilePath = dataFilePath.indexOf(":");
dataFilePath = dataFilePath.substring(indexDataFilePath + 1);
int indexDataFileNameStart = response_info.lastIndexOf("--");
int indexDataFileNameEnd = response_info.lastIndexOf("4)");
String dataFileName = response_info.substring(indexDataFileNameStart, indexDataFileNameEnd);
int indexDataFileName = dataFileName.indexOf(":");
dataFileName = dataFileName.substring(indexDataFileName + 1);
BaseLogger.log("3", null, null, "DataFileName gsbgsb" + dataFileName);
try {
batchID = dbAccess.getDBColumnValue("BATCHLOAD", "BATCH_ID", "DATA_FILE_NAME = '" + dataFileName.trim() + "'",
userInfo.getTransDB());
BaseLogger.log("3", null, null, "Value of batchID... [" + batchID + "]");
String errorLogFilePath = CommonConstants.JBOSSHOME + "upload_failed";
BaseLogger.log("3", null, null, "Value of errorLogFilePath... [" + errorLogFilePath + "]");
String errorLogFileName = batchID + "_server.log";
BaseLogger.log("3", null, null, "Value of errorLogFileName... [" + errorLogFileName + "]");
ediDataLogPath = errorLogFilePath + File.separator + errorLogFileName;
BaseLogger.log("3", null, null, "Value of ediDataLogPath... [" + ediDataLogPath + "]");
} catch(Exception ex) {
ex.printStackTrace();
}
if(!ediDataLogPath.equalsIgnoreCase(""))
{
byte[] ediDataLogPathEncoded = Base64.getEncoder().encode(ediDataLogPath.getBytes());
BaseLogger.log("3", null, null, "ediDataLogPath1223344" + ediDataLogPath);
BaseLogger.log("3", null, null, "Value of errorLogFileName... [" + ediDataLogPathEncoded + "]");
ediDataLogPathEncodedString = new String(ediDataLogPathEncoded);
BaseLogger.log("3", null, null, "Value of ediDataLogPathEncodedString... [" + ediDataLogPathEncodedString + "]");
}
%>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>
function loadComponent(targetId, componentName)
{
console.log('load Task window.ShowFileContentPlugin gsb',window.ShowFileContentPlugin);
console.log("<%=ediDataLogPath%>");
// setBBHostURL();
if( window.ShowFileContentPlugin )
{
var pluginEmitter = window.ShowFileContentPlugin.pluginEvtEmitter;
var pluginConfig = window.ShowFileContentPlugin.pluginConfig;
var evtEmit = new pluginEmitter();
evtEmit.subscribe((pluginEvent) => {
});
var objName = "showdata";
var data = {
"target-id" : targetId,
"compData" : {"objName" : objName},
"cacheComp" : false
};
var ShowFileContentPlugin = window.ShowFileContentPlugin.loadPlugin(componentName, data, window.ShowFileContentPlugin.pluginMI, evtEmit);
console.log( 'ShowFileContentPlugin >>', ShowFileContentPlugin );
}
var element = document.getElementById('display-file-content');
var filepath = element.getAttribute('filepath');
var url = window.location.origin + "/ibase/rest/EDIService/edifiles/" + filepath;
console.log("url:::::" + url);
var request = $.ajax({
url: url,
method: "GET"
});
request.done(function(resp) {
console.log("Type of response:::::" + typeof resp);
if(typeof resp==='object'){
console.log("Response:::::" + "No data found");
}
else if(typeof resp==='string'){
console.log("Response:::::" + resp);
}
else{
}
});
}
</script>
<!-- <body onload="document.getElementById('search_scope').click();"> -->
<body onload="document.getElementById('display-file-content').click();">
<div style="position: absolute; z-index: 1;" >
<!-- Gagan -->
<button class="square-button" onClick="loadComponent('appContainer', 'app-show-data')" id="display-file-content" filepath="<%=ediDataLogPathEncodedString%>" style="display: none" >Search Scope</button>
<!-- Gagan -->
</div>
<div>
<input type="hidden" name="myhiddenvalue" id="filePath" value=<%=ediDataLogPath%> />
</div>
<div>
<div id="appContainer"></div>
</div>
<app-root></app-root>
</body>
<!-- Added by Gagan -->
<script src="show-file-content/runtime.js" type="module"></script>
<script src="show-file-content/runtime.js" nomodule defer></script>
<script src="show-file-content/polyfills.js" type="module"></script>
<script src="show-file-content/polyfills.js" nomodule defer></script>
<script src="show-file-content/main.js" type="module"></script>
<script src="show-file-content/main.js" nomodule defer></script>
</html>
\ No newline at end of file
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