use of org.apache.isis.applib.services.bookmark.Bookmark 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();
}
}
use of org.apache.isis.applib.services.bookmark.Bookmark in project estatio by estatio.
the class PropertyOrderingViewModel method viewModelMemento.
@Override
public String viewModelMemento() {
final Property property = getProperty();
final Bookmark bookmark = bookmarkService.bookmarkFor(property);
return bookmark.getIdentifier();
}
use of org.apache.isis.applib.services.bookmark.Bookmark in project estatio by estatio.
the class NumeratorRepository method createNumerator.
private Numerator createNumerator(final String numeratorName, final Object scopedToIfAny, final String format, final BigInteger lastIncrement, final ApplicationTenancy applicationTenancy) {
final Numerator numerator = newTransientInstance();
numerator.setName(numeratorName);
numerator.setApplicationTenancyPath(applicationTenancy.getPath());
if (scopedToIfAny != null) {
final Bookmark bookmark = getBookmarkService().bookmarkFor(scopedToIfAny);
numerator.setObjectType(bookmark.getObjectType());
numerator.setObjectIdentifier(bookmark.getIdentifier());
}
numerator.setFormat(format);
numerator.setLastIncrement(lastIncrement);
persist(numerator);
return numerator;
}
use of org.apache.isis.applib.services.bookmark.Bookmark in project estatio by estatio.
the class PaperclipRepository method findByAttachedToAndRoleName.
// endregion
// region > findByAttachedToAndRoleName (programmatic)
@Programmatic
public List<Paperclip> findByAttachedToAndRoleName(final Object attachedTo, final String roleName) {
if (attachedTo == null) {
return null;
}
if (roleName == null) {
return null;
}
final Bookmark bookmark = bookmarkService.bookmarkFor(attachedTo);
if (bookmark == null) {
return null;
}
final String attachedToStr = bookmark.toString();
return repositoryService.allMatches(new QueryDefault<>(Paperclip.class, "findByAttachedToAndRoleName", "attachedToStr", attachedToStr, "roleName", roleName));
}
use of org.apache.isis.applib.services.bookmark.Bookmark in project estatio by estatio.
the class PaperclipRepository method findByDocumentAndAttachedToAndRoleName.
// endregion
// region > findByDocumentAndAttachedToAndRoleName (programmatic)
@Programmatic
public Paperclip findByDocumentAndAttachedToAndRoleName(final DocumentAbstract<?> document, final Object attachedTo, final String roleName) {
if (document == null) {
return null;
}
if (attachedTo == null) {
return null;
}
if (roleName == null) {
return null;
}
final Bookmark bookmark = bookmarkService.bookmarkFor(attachedTo);
if (bookmark == null) {
return null;
}
final String attachedToStr = bookmark.toString();
return repositoryService.firstMatch(new QueryDefault<>(Paperclip.class, "findByDocumentAndAttachedToAndRoleName", "document", document, "attachedToStr", attachedToStr, "roleName", roleName));
}
Aggregations