Hello Community
I want to upload a text file on our ARIS Document Storage (ADS) through ARIS Scripting. We have a requirement to reuse that particular text file and add more data inside it. I am facing difficulty in
- Getting the text document from ADS
- Can we actually update documents through ARIS Scripting in ADS ?
- How to use ADS in ARIS Scripting ?
- Does ADS requires API’s to get and upload documents.
If you have documentation for ADS and how to use it with ARIS Scripting, fell free to provide links for the same.
Thanks in advance.
1. Getting the text document from ADS
Load the ADS Report component with
Context.getComponent("ADS")
as it's described here http://myaris10now.softwareag.com/abs/help/en/script/ba/index.htm#report_OBJECTS_ADSReportComponent.htm.
With that component it's up to you to somehow get access to an ADSDocument (http://myaris10now.softwareag.com/abs/help/en/script/ba/index.htm#report_OBJECTS_ADSDocument.htm). You can do that either with a hyperlink or by navigating through the document repository groups. All that matters is that you get your ADSDocument.
Next comes turning the InputStream that you get from the ADSDocument.getDocumentContent() method into a Byte Array. You want a Byte Array so that you can turn the document content easily into an ArisScript OutputObject and append stuff to it. Turning the InputStream into a ByteArray can be quite complicated.
If your ARIS Server has the Google Guava library (with server access you can look into \server\bin\work\work_abs_*\tools\lib for a file called guava-*.jar) you can use Packages.com.google.common.io.ByteStreams.toByteArray(yourInputStreamHere) to use the library method for turning an InputStream into a Byte Array.
You can then give this byte array alongside a file name to the ARIS standard method Context.getOutputObject to create an OutputObject with it. Write stuff to that OutputObject (I'm assuming you're familiar with the standard ARIS Script methods) and then write the output document to the output location (with the .WriteReport() method).
Sending the updated document content back to the ADS is much easier. The ARIS method Context.getFile can be used to get a Byte Array from your freshly written output file. Use the Byte Array to construct a new Packages.java.io.ByteArrayInputStream which can be used as a third parameter of the the ADSRepository.updateDocumentContent method to update your document content. You can probably figure out what the other parmeters are supposed to be.
2. Can we actually update documents through ARIS Scripting in ADS ?
Yes
3. How to use ADS in ARIS Scripting ?
See 1.
4. Does ADS requires API’s to get and upload documents
Well, the standard ARIS report components are enough. If your question is whether you have to use the REST API then "No" is the answer. You only have to use the REST API when you have a non ARIS application that produces content that is supposed to be stored in the ADS.