Skip to content

Commit

Permalink
Gestione delle Contabili BNL
Browse files Browse the repository at this point in the history
  • Loading branch information
mspasiano committed Mar 9, 2013
1 parent b3afa83 commit 4de28a2
Showing 1 changed file with 9 additions and 4 deletions.
Expand Up @@ -7,6 +7,7 @@
import java.util.ArrayList;
import java.util.List;

import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
import org.apache.pdfbox.exceptions.COSVisitorException;
import org.apache.pdfbox.util.PDFMergerUtility;

Expand Down Expand Up @@ -43,20 +44,24 @@ public InputStream getStreamContabile(Integer esercizio, String cds, Long pgMand
List<String> ids = getNodeRefContabile(esercizio, cds, pgMandato);
if (ids != null){
if (ids.size() == 1){
return getResource(getNodeByNodeRef(ids.get(0)));
try{
return getResource(getNodeByNodeRef(ids.get(0)));
}catch (CmisObjectNotFoundException _ex){
}
}else{
PDFMergerUtility ut = new PDFMergerUtility();
ut.setDestinationStream(new ByteArrayOutputStream());
for (String id : ids) {
ut.addSource(getResource(getNodeByNodeRef(id)));
}
try {
for (String id : ids) {
ut.addSource(getResource(getNodeByNodeRef(id)));
}
ut.mergeDocuments();
return new ByteArrayInputStream(((ByteArrayOutputStream)ut.getDestinationStream()).toByteArray());
} catch (COSVisitorException e) {
throw e;
} catch (IOException e) {
throw e;
}catch (CmisObjectNotFoundException _ex){
}
}
}
Expand Down

0 comments on commit 4de28a2

Please sign in to comment.