Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
Component Sharing
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Gagandeep Singh Bhatia
Component Sharing
Commits
ec6e5e70
Commit
ec6e5e70
authored
Jan 12, 2024
by
Sonawane Amol Madhjuar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
af401c76
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
187 additions
and
0 deletions
+187
-0
Amol/API_SRD/APICallDisplayData.jsp
Amol/API_SRD/APICallDisplayData.jsp
+187
-0
No files found.
Amol/API_SRD/APICallDisplayData.jsp
0 → 100644
View file @
ec6e5e70
<!doctype html>
<%@page
import=
"java.util.Base64"
%>
<%@page
import=
"ibase.webitm.utility.ITMException"
%>
<%@page
import=
"java.rmi.RemoteException"
%>
<%@page
import=
"java.sql.PreparedStatement"
%>
<%@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/bootstrap/scss/_root.scss"
/>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"show-file-content/assets/styles.css"
/>
</head>
<%
String
dataFileName
=
""
;
String
ediFileDataPathEncodedString
=
""
;
try
{
String
userCode
=
request
.
getParameter
(
"chg_user.String"
);
CommonDBAccessEJB
commonDBAccessEJB
=
new
CommonDBAccessEJB
();
//4 param conn obj par
UserInfoBean
userInfo
=
commonDBAccessEJB
.
createUserInfo
(
userCode
);
String
transDB
=
userInfo
.
getTransDB
();
String
tranId
=
request
.
getParameter
(
"tran_id.String"
);
DBAccessEJB
dbacessEjb
=
new
DBAccessEJB
();
String
response_info
=
dbacessEjb
.
getDBColumnValue
(
"api_call_log"
,
"to_char(response_info)"
,
"tran_id='"
+
tranId
+
"'"
,
transDB
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
"Response info "
+
response_info
);
String
objName
=
request
.
getParameter
(
"OBJ_NAME"
);
String
appId
=
request
.
getParameter
(
"app_id.String"
);
String
responseInfo
=
request
.
getParameter
(
"response_info"
);
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
);
// Check if dataFilePath already contains the encoded "/wildfly/"
if
(!
dataFilePath
.
contains
(
"/wildfly/"
))
{
// Add "/wildfly/" to the beginning of dataFilePath
dataFilePath
=
dataFilePath
.
trim
();
dataFilePath
=
"/wildfly/"
+
dataFilePath
;
}
dataFilePath
=
dataFilePath
.
trim
();
int
indexDataFileNameStart
=
response_info
.
lastIndexOf
(
"--"
);
int
indexDataFileNameEnd
=
response_info
.
lastIndexOf
(
"4)"
);
dataFileName
=
response_info
.
substring
(
indexDataFileNameStart
,
indexDataFileNameEnd
);
int
indexDataFileName
=
dataFileName
.
indexOf
(
":"
);
dataFileName
=
dataFileName
.
substring
(
indexDataFileName
+
1
);
dataFileName
=
dataFilePath
+
File
.
separator
+
dataFileName
.
trim
();
BaseLogger
.
log
(
"3"
,
null
,
null
,
"DataFileName "
+
dataFileName
);
if
(!
dataFileName
.
equalsIgnoreCase
(
""
))
{
byte
[]
ediFileDataPathEncoded
=
Base64
.
getEncoder
().
encode
(
dataFileName
.
getBytes
());
ediFileDataPathEncodedString
=
new
String
(
ediFileDataPathEncoded
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
/*
out
.
println
(
"
<
script
>
");
out.println("
var
errorMessage
=
'
" + e.getMessage() + "
'
;
");
out.println("
</
script
>
");
// Display an alert with the error message
out.println("
<
script
>
");
out.println("
alert
(
'
Internal
Server
Error
'
+
errorMessage
);
");
out.println("
</
script
>"
);
*/
}
%>
<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
(
"
<%=
dataFileName
%>
"
);
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
'
);
// Use encodeURIComponent to properly encode the filepath
var
encodedFilepath
=
encodeURIComponent
(
filepath
);
var
url
=
window
.
location
.
origin
+
"
/ibase/rest/EDIService/edifiles/
"
+
encodedFilepath
;
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
"
);
alert
(
"
File not found!
"
);
}
else
if
(
typeof
resp
===
'
string
'
)
{
console
.
log
(
"
Response:::::
"
+
resp
);
}
if
(
resp
==
null
||
resp
.
trim
()
===
''
||
resp
.
length
===
0
)
{
alert
(
"
Unexpected response format
"
);
console
.
error
(
"
Unexpected response format:
"
,
resp
);
window
.
close
();
}
});
request
.
fail
(
function
(
jqXHR
,
textStatus
,
errorThrown
)
{
console
.
error
(
"
AJAX Error:
"
,
textStatus
,
errorThrown
);
if
(
jqXHR
.
status
===
500
)
{
alert
(
"
Error retrieving file content! Please check the URL.
"
);
}
else
{
// Display a generic error message for other errors
alert
(
"
Show data not available for this particular Endpoint.
"
);
}
// Optionally, close the window or take other actions
window
.
close
();
});
}
</script>
<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=
"
<%=
ediFileDataPathEncodedString
%>
"
style=
"display: none"
>
Search Scope
</button>
<!-- Gagan -->
</div>
<div>
<input
type=
"hidden"
name=
"myhiddenvalue"
id=
"filePath"
value=
"
<%=
dataFileName
%>
"
/>
</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>
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