use of org.estatio.module.capex.app.invoice.IncomingDocAsInvoiceViewModel in project estatio by estatio.
the class PdfAdvisorForEstatio method bookmarkFor.
private String bookmarkFor(final InstanceKey instanceKey) {
Document document = determineDocument(instanceKey);
InstanceKey.TypeKey typeKey = instanceKey.getTypeKey();
String objectType = typeKey.getObjectType();
if (Objects.equals(objectType, IncomingDocAsInvoiceViewModel.class.getName())) {
String identifier = instanceKey.getIdentifier();
final String xmlStr = urlEncodingService.decode(identifier);
IncomingDocAsInvoiceViewModel viewModel = jaxbService.fromXml(IncomingDocAsInvoiceViewModel.class, xmlStr);
final Bookmark bookmark = bookmarkService2.bookmarkFor(viewModel.getDocument());
if (bookmark != null)
return "incomingInvoiceViewModel:" + bookmark.getIdentifier();
else {
// object presumably deleted
return null;
}
} else if (Objects.equals(objectType, IncomingDocAsOrderViewModel.class.getName())) {
String identifier = instanceKey.getIdentifier();
final String xmlStr = urlEncodingService.decode(identifier);
IncomingDocAsOrderViewModel viewModel = jaxbService.fromXml(IncomingDocAsOrderViewModel.class, xmlStr);
final Bookmark bookmark = bookmarkService2.bookmarkFor(viewModel.getDocument());
if (bookmark != null)
return "incomingOrderViewModel:" + bookmark.getIdentifier();
else {
// object presumably deleted
return null;
}
} else {
return instanceKey.asBookmark().toString();
}
}
Aggregations