El nexo entre tecnología y negocios
 
[ ABR00047 ] Obtener documentos por API Java
Summary
The method 'getDocument()' of the class 'Attribute' of the Java API returns an object 'DocumentVo', internal to Apia, with which the internal changes in Apia can affect classes which use this method.

It is applied to
  • Apia 2.3.0.31


Solution

This problem is solved by creating a new method which returns an object 'Document', which is not affected by internal changes in Apia as it occurred with "DocumentVo".

 

The correct way of using the API is described next:

In order to obtain the object 'Document':

Document doc = this.getCurrentEntity().getAttribute("S1").getDocumentValue();

 

In order to download it to Apia's temporal folder respecting its name and the extension:

String path = doc.download(true);

 

In order to download it to the temporal folder just as it is stored in the system of files:

String path = d.download();


This last example is useful if the user desires to open, read or modify the file and it is not necessary to maintain the name. The document is saved in the temporal directory using only numbers and won't generate problems of codification of special characters in the server.

When using this code it is guaranteed that the internal changes in Apia won't affect the operation of the business classes.



Related elements
[ AFC00171 ] Associate documents by API
[ AFC00185 ] Attach documents by API
Related from
[ AFC00216 ] Disablement of fields of type File
Suggested items
[ AFC00422 ] Documents associated to an attribute
[ AFC01741 ] Set timers through API
[ AFC00577 ] Unblock document by API
[ AFC01754 ] Process title by Java API
[ ANF00213 ] Parameter to implement database by API
[ AFC00308 ] Creation of attributes in the java API
[ AFC00341 ] Active users
[ AFC00425 ] Tasks cancelling
[ AFC01773 ] Obtain through API the loading attribute of entity comboboxes
[ AFC00161 ] The Attribute.removeValue(int index) method has been added