@Override public OidDto marshal(final Object domainObject) throws Exception { if(domainObject == null) { return null; } final Bookmark bookmark = getBookmarkService().bookmarkFor(domainObject); return bookmark.toOidDto(); }
@Programmatic public OidDto oidDtoFor(final Object object) { final Bookmark bookmark = bookmarkService.bookmarkFor(object); return asOidDto(bookmark); }
@Override public OidsDto marshal(final List<Object> domainObjects) throws Exception { if(domainObjects == null) { return null; } OidsDto oidsDto = new OidsDto(); for (final Object domainObject : domainObjects) { final Bookmark bookmark = getBookmarkService().bookmarkFor(domainObject); oidsDto.getOid().add(bookmark.toOidDto()); } return oidsDto; }
final String actionIdentifier = CommandUtil.memberIdentifierFor(action); final Bookmark domainObjectBookmark = bookmarkService.bookmarkFor(domainObject);
@Override public ActionInvocationMemento asActionInvocationMemento(Method method, Object domainObject, Object[] args) { final ObjectSpecificationDefault targetObjSpec = getJavaSpecificationOfOwningClass(method); final ObjectMember member = targetObjSpec.getMember(method); if(member == null) { return null; } if(!(member instanceof ObjectAction)) { return null; } final ObjectAction action = (ObjectAction) member; final String actionIdentifier = CommandUtil.actionIdentifierFor(action); final Bookmark domainObjectBookmark = bookmarkService.bookmarkFor(domainObject); final List<Class<?>> argTypes = Lists.newArrayList(); final List<Object> argObjs = Lists.newArrayList(); CommandUtil.buildMementoArgLists(mementoService, bookmarkService, method, args, argTypes, argObjs); final ActionInvocationMemento aim = new ActionInvocationMemento(mementoService, actionIdentifier, domainObjectBookmark, argTypes, argObjs); return aim; }
@Programmatic public List<Paperclip> findByAttachedTo(final Object attachedTo) { if(attachedTo == 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, "findByAttachedTo", "attachedToStr", attachedToStr)); } //endregion
@Programmatic public List<Paperclip> findByAttachedTo(final Object attachedTo) { if(attachedTo == 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, "findByAttachedTo", "attachedToStr", attachedToStr)); } //endregion
@Parameter(optionality= Optionality.OPTIONAL) final LocalDate to) { final Bookmark targetBookmark = bookmarkService.bookmarkFor(targetDomainObject); final List<DomainChangeJdoAbstract> changes = Lists.newArrayList(); if(commandServiceRepository != null) {
@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)); } //endregion
@Programmatic public List<Paperclip> findByDocumentAndAttachedTo( final DocumentAbstract<?> document, final Object attachedTo) { if(document == null) { return null; } if(attachedTo == 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, "findByDocumentAndAttachedTo", "document", document, "attachedToStr", attachedToStr)); } //endregion
@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)); } //endregion
@Programmatic public List<Paperclip> findByDocumentAndAttachedTo( final DocumentAbstract<?> document, final Object attachedTo) { if(document == null) { return null; } if(attachedTo == 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, "findByDocumentAndAttachedTo", "document", document, "attachedToStr", attachedToStr)); } //endregion
@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)); } //endregion
@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)); } //endregion
final String targetArgs = CommandUtil.argDescriptionFor(action, adaptersFor(args)); final Bookmark domainObjectBookmark = bookmarkService.bookmarkFor(domainObject);
@Action( domainEvent = ClearHintsDomainEvent.class, semantics = SemanticsOf.IDEMPOTENT ) @ActionLayout( cssClassFa = "fa-trash", position = ActionLayout.Position.PANEL_DROPDOWN ) @MemberOrder(name = "datanucleusIdLong", sequence = "400.1") public Object $$() { if (getHintStoreUsingWicketSession() != null) { final Bookmark bookmark = bookmarkService.bookmarkFor(object); getHintStoreUsingWicketSession().removeAll(bookmark); } return object; }
@Override @Programmatic public ActionInvocationDto asActionInvocationDto( final ObjectAction objectAction, final ObjectAdapter targetAdapter, final List<ObjectAdapter> argumentAdapters) { final Interaction interaction = interactionContext.getInteraction(); final UUID transactionId = interaction.getTransactionId(); final int nextEventSequence = interaction.next(Interaction.Sequence.INTERACTION.id()); final Object targetPojo = targetAdapter.getObject(); final Bookmark targetBookmark = bookmarkService.bookmarkFor(targetPojo); final String actionIdentifier = objectAction.getIdentifier().toClassAndNameIdentityString(); final String actionId = actionIdentifier.substring(actionIdentifier.indexOf('#')+1); final String targetTitle = targetBookmark.toString() + ": " + actionId; final String currentUser = userService.getUser().getName(); final ActionDto actionDto = new ActionDto(); commandDtoServiceInternal.addActionArgs( objectAction, actionDto, argumentAdapters.toArray(new ObjectAdapter[]{})); final List<ParamDto> parameterDtos = CommandDtoUtils.parametersFor(actionDto).getParameter(); final String transactionIdStr = transactionId.toString(); return InteractionDtoUtils.newActionInvocation( nextEventSequence, targetBookmark, targetTitle, actionDto.getMemberIdentifier(), parameterDtos, currentUser ); }
@Override @Programmatic public PropertyEditDto asPropertyEditDto( final OneToOneAssociation property, final ObjectAdapter targetAdapter, final ObjectAdapter newValueAdapterIfAny) { final Interaction interaction = interactionContext.getInteraction(); final int nextEventSequence = interaction.next(Interaction.Sequence.INTERACTION.id()); final Object targetPojo = targetAdapter.getObject(); final Bookmark targetBookmark = bookmarkService.bookmarkFor(targetPojo); final String propertyIdentifier = property.getIdentifier().toClassAndNameIdentityString(); final String propertyId = propertyIdentifier.substring(propertyIdentifier.indexOf('#')+1); final String targetTitle = targetBookmark.toString() + ": " + propertyId; final String currentUser = userService.getUser().getName(); final PropertyDto propertyDto = new PropertyDto(); commandDtoServiceInternal.addPropertyValue(property, propertyDto, newValueAdapterIfAny); final ValueWithTypeDto newValue = propertyDto.getNewValue(); return InteractionDtoUtils.newPropertyEdit( nextEventSequence, targetBookmark, targetTitle, propertyDto.getMemberIdentifier(), newValue, currentUser ); }
/** * This is an idempotent operation. */ @Programmatic public Paperclip attach( final DocumentAbstract documentAbstract, final String roleName, final Object attachTo) { Paperclip paperclip = findByDocumentAndAttachedToAndRoleName( documentAbstract, attachTo, roleName); if(paperclip != null) { return paperclip; } final Class<? extends Paperclip> subtype = subtypeClassFor(attachTo); paperclip = repositoryService.instantiate(subtype); paperclip.setDocument(documentAbstract); paperclip.setRoleName(roleName); if(documentAbstract instanceof Document) { final Document document = (Document) documentAbstract; paperclip.setDocumentCreatedAt(document.getCreatedAt()); } if(!repositoryService.isPersistent(attachTo)) { transactionService.flushTransaction(); } final Bookmark bookmark = bookmarkService.bookmarkFor(attachTo); paperclip.setAttachedTo(attachTo); paperclip.setAttachedToStr(bookmark.toString()); repositoryService.persistAndFlush(paperclip); return paperclip; }
/** * This is an idempotent operation. */ @Programmatic public Paperclip attach( final DocumentAbstract documentAbstract, final String roleName, final Object attachTo) { Paperclip paperclip = findByDocumentAndAttachedToAndRoleName( documentAbstract, attachTo, roleName); if(paperclip != null) { return paperclip; } final Class<? extends Paperclip> subtype = subtypeClassFor(attachTo); paperclip = repositoryService.instantiate(subtype); paperclip.setDocument(documentAbstract); paperclip.setRoleName(roleName); if(documentAbstract instanceof Document) { final Document document = (Document) documentAbstract; paperclip.setDocumentCreatedAt(document.getCreatedAt()); } if(!repositoryService.isPersistent(attachTo)) { transactionService.flushTransaction(); } final Bookmark bookmark = bookmarkService.bookmarkFor(attachTo); paperclip.setAttachedTo(attachTo); paperclip.setAttachedToStr(bookmark.toString()); repositoryService.persistAndFlush(paperclip); return paperclip; }