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
c3fe171a
Commit
c3fe171a
authored
May 14, 2024
by
Sonawane Amol Madhjuar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace DocumentViewerServiceUtility.java
parent
71e46dd1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
16 deletions
+28
-16
Amol/Proteus_Lib_Jar/Framework6M/DocumentViewerServiceUtility.java
...eus_Lib_Jar/Framework6M/DocumentViewerServiceUtility.java
+28
-16
No files found.
Amol/Proteus_Lib_Jar/Framework6M/DocumentViewerServiceUtility.java
View file @
c3fe171a
...
@@ -8,6 +8,7 @@ import java.sql.Connection;
...
@@ -8,6 +8,7 @@ import java.sql.Connection;
import
java.sql.ResultSet
;
import
java.sql.ResultSet
;
import
java.sql.Statement
;
import
java.sql.Statement
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Base64
;
import
java.util.List
;
import
java.util.List
;
import
javax.xml.parsers.DocumentBuilderFactory
;
import
javax.xml.parsers.DocumentBuilderFactory
;
...
@@ -40,8 +41,9 @@ public class DocumentViewerServiceUtility extends RestAPIServiceUtility {
...
@@ -40,8 +41,9 @@ public class DocumentViewerServiceUtility extends RestAPIServiceUtility {
* the objName and refID via getDocumentData's method
* the objName and refID via getDocumentData's method
*
*
*/
*/
public
byte
[]
getPreviewImage
(
String
objName
,
String
refId
,
String
tokenIDfromHeader
)
{
public
JSONObject
getPreviewImage
(
String
objName
,
String
refId
,
String
tokenIDfromHeader
)
{
BaseLogger
.
log
(
"3"
,
null
,
null
,
" getPreviewImage method call: "
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
" getPreviewImage method call: "
);
JSONObject
jsonObject
=
new
JSONObject
();
UserInfoBean
userInfo
=
null
;
UserInfoBean
userInfo
=
null
;
...
@@ -59,7 +61,7 @@ public class DocumentViewerServiceUtility extends RestAPIServiceUtility {
...
@@ -59,7 +61,7 @@ public class DocumentViewerServiceUtility extends RestAPIServiceUtility {
byte
[]
byteArray
=
null
;
byte
[]
byteArray
=
null
;
try
{
try
{
responseData
=
new
String
(
documentHandlerServiceUtility
.
getDocumentData
(
objName
,
refId
,
refCol
,
dataFormat
,
tokenIDfromHeader
));
responseData
=
new
String
(
documentHandlerServiceUtility
.
getDocumentData
(
objName
,
refId
,
tokenIDfromHeader
,
refCol
,
dataFormat
));
BaseLogger
.
log
(
"3"
,
null
,
null
,
"responseData ==> "
+
responseData
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
"responseData ==> "
+
responseData
);
List
<
String
>
docIds
=
new
ArrayList
<>();
List
<
String
>
docIds
=
new
ArrayList
<>();
...
@@ -69,29 +71,36 @@ public class DocumentViewerServiceUtility extends RestAPIServiceUtility {
...
@@ -69,29 +71,36 @@ public class DocumentViewerServiceUtility extends RestAPIServiceUtility {
DocumentBuilder
builder
=
factory
.
newDocumentBuilder
();
DocumentBuilder
builder
=
factory
.
newDocumentBuilder
();
InputSource
is
=
new
InputSource
(
new
StringReader
(
responseData
));
InputSource
is
=
new
InputSource
(
new
StringReader
(
responseData
));
Document
doc
=
builder
.
parse
(
is
);
Document
doc
=
builder
.
parse
(
is
);
NodeList
docIdNodes
=
doc
.
getElementsByTagName
(
"Document_Id"
);
NodeList
idNodes
=
doc
.
getElementsByTagName
(
"ID"
);
// Extract Document_Id values
for
(
int
i
=
0
;
i
<
docIdNodes
.
getLength
();
i
++)
// Extract Document_Id attribute values
{
for
(
int
i
=
0
;
i
<
idNodes
.
getLength
();
i
++)
{
Node
docIdNode
=
docIdNodes
.
item
(
i
);
Node
idNode
=
idNodes
.
item
(
i
);
if
(
docIdNode
.
getNodeType
()
==
Node
.
ELEMENT_NODE
)
{
if
(
idNode
.
getNodeType
()
==
Node
.
ELEMENT_NODE
)
{
Element
docIdElement
=
(
Element
)
docIdNode
;
Element
idElement
=
(
Element
)
idNode
;
String
docId
=
docIdElement
.
getTextContent
();
String
docId
=
idElement
.
getAttribute
(
"Document_Id"
).
trim
();
docIds
.
add
(
docId
);
if
(!
docId
.
isEmpty
())
{
BaseLogger
.
log
(
"3"
,
null
,
null
,
"DocumentViewerServlet docIDs : ["
+
docIds
+
"]"
);
docIds
.
add
(
docId
);
}
}
}
}
}
BaseLogger
.
log
(
"3"
,
null
,
null
,
" docID's List : "
+
docIds
);
}
}
catch
(
ParserConfigurationException
|
SAXException
|
IOException
e
)
catch
(
ParserConfigurationException
|
SAXException
|
IOException
e
)
{
{
BaseLogger
.
log
(
"3"
,
null
,
null
,
"Error parsing XML response: "
+
e
.
getMessage
());
BaseLogger
.
log
(
"3"
,
null
,
null
,
"Error parsing XML response: "
+
e
.
getMessage
());
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
for
(
String
docId
:
docIds
)
{
for
(
String
docId
:
docIds
)
{
try
{
try
{
BaseLogger
.
log
(
"3"
,
null
,
null
,
"DocumentViewerServlet :: docID ["
+
docId
+
"]"
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
"DocumentViewerServlet :: docID ["
+
docId
+
"]"
);
byteArray
=
getPreviewImageAgainstDocId
(
docId
,
userInfo
);
byteArray
=
getPreviewImageAgainstDocId
(
docId
,
userInfo
);
String
encodedByteArray
=
Base64
.
getEncoder
().
encodeToString
(
byteArray
);
jsonObject
.
put
(
docId
,
encodedByteArray
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
BaseLogger
.
log
(
"3"
,
null
,
null
,
"Exception in DocumentViewerServlet :: handleDocument() : "
+
ex
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
"Exception in DocumentViewerServlet :: handleDocument() : "
+
ex
);
ex
.
printStackTrace
();
ex
.
printStackTrace
();
...
@@ -102,8 +111,10 @@ public class DocumentViewerServiceUtility extends RestAPIServiceUtility {
...
@@ -102,8 +111,10 @@ public class DocumentViewerServiceUtility extends RestAPIServiceUtility {
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
BaseLogger
.
log
(
"3"
,
null
,
null
,
"jsonObject with docID and encoded byte array0:: ["
+
jsonObject
+
"]"
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
"byteArray of:: ["
+
byteArray
.
toString
()
+
"]"
);
return
byteArray
;
return
jsonObject
;
}
}
private
byte
[]
getPreviewImageAgainstDocId
(
String
docId
,
UserInfoBean
userInfo
)
{
private
byte
[]
getPreviewImageAgainstDocId
(
String
docId
,
UserInfoBean
userInfo
)
{
...
@@ -125,7 +136,7 @@ public class DocumentViewerServiceUtility extends RestAPIServiceUtility {
...
@@ -125,7 +136,7 @@ public class DocumentViewerServiceUtility extends RestAPIServiceUtility {
BaseLogger
.
log
(
"3"
,
null
,
null
,
"Exception in DocumentViewerServlet :: handleDocument() : "
+
ex
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
"Exception in DocumentViewerServlet :: handleDocument() : "
+
ex
);
ex
.
printStackTrace
();
ex
.
printStackTrace
();
}
}
BaseLogger
.
log
(
"3"
,
null
,
null
,
"byteArray:: "
+
byteArray
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
"
getPreviewImageAgainstDocId
byteArray:: "
+
byteArray
);
return
byteArray
;
return
byteArray
;
}
}
...
@@ -176,6 +187,7 @@ public class DocumentViewerServiceUtility extends RestAPIServiceUtility {
...
@@ -176,6 +187,7 @@ public class DocumentViewerServiceUtility extends RestAPIServiceUtility {
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
}
}
}
}
BaseLogger
.
log
(
"3"
,
userInfo
,
null
,
"getVideoFrame iconByteArray : "
+
iconByteArray
);
return
iconByteArray
;
return
iconByteArray
;
}
}
...
...
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