private ApplicationSettingJdo newSetting( final String key, final String description, final SettingType settingType, final String valueRaw) { final ApplicationSettingJdo setting = repositoryService.instantiate(ApplicationSettingJdo.class); setting.setKey(key); setting.setDescription(description); setting.setValueRaw(valueRaw); setting.setType(settingType); repositoryService.persist(setting); return setting; } //endregion
@Programmatic public void delete(final Paperclip paperclip) { repositoryService.remove(paperclip); }
/** * Returns all document templates for the specified {@link DocumentType} and exact application tenancy, ordered by date (desc). */ @Programmatic public List<DocumentTemplate> findByTypeAndAtPath(final DocumentType documentType, final String atPath) { return repositoryService.allMatches( new QueryDefault<>(DocumentTemplate.class, "findByTypeAndAtPath", "type", documentType, "atPath", atPath)); }
if(!repositoryService.isPersistent(polymorphicReference)) { if(!repositoryService.isPersistent(polymorphicReference)) { throw new NonRecoverableException("Link's polymorphic reference " + titleService.titleOf(polymorphicReference) + " is not persistent"); final L link = repositoryService.instantiate(subtype); link.setPolymorphicReference(polymorphicReference); repositoryService.persist(link);
/** * 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; }
protected UserSettingJdo doFind(final String user, final String key) { return repositoryService.firstMatch( new QueryDefault<>(UserSettingJdo.class, "findByUserAndKey", "user",user, "key", key)); } //endregion
@Programmatic public RenderingStrategy create( final String reference, final String name, final DocumentNature inputNature, final DocumentNature outputNature, final Class<? extends Renderer> rendererClass) { final RenderingStrategy renderingStrategy = new RenderingStrategy(reference, name, inputNature, outputNature, rendererClass); repositoryService.persist(renderingStrategy); return renderingStrategy; }
@Programmatic public Applicability create( final DocumentTemplate documentTemplate, final String domainClassName, final String rendererModelFactoryClassName, final String attachmentAdvisorClassName ) { Applicability applicability = new Applicability(documentTemplate, domainClassName, rendererModelFactoryClassName, attachmentAdvisorClassName); repositoryService.persistAndFlush(applicability); return applicability; } //endregion
@Programmatic public List<DocumentType> allTypes() { return repositoryService.allInstances(DocumentType.class); } //endregion
public void delete(final Applicability applicability) { repositoryService.removeAndFlush(applicability); } //endregion
/** * 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; }
protected ApplicationSettingJdo doFind(final String key) { return repositoryService.firstMatch( new QueryDefault<>(ApplicationSettingJdo.class, "findByKey", "key", key)); }
@Programmatic public RenderingStrategy create( final String reference, final String name, final DocumentNature inputNature, final DocumentNature outputNature, final Class<? extends Renderer> rendererClass) { final RenderingStrategy renderingStrategy = new RenderingStrategy(reference, name, inputNature, outputNature, rendererClass); repositoryService.persist(renderingStrategy); return renderingStrategy; }
@Programmatic public DocumentType create( final String reference, final String name) { final DocumentType documentType = new DocumentType(reference, name); repositoryService.persistAndFlush(documentType); return documentType; } //endregion
@Programmatic public List<DocumentAbstract> allDocuments() { return repositoryService.allInstances(DocumentAbstract.class); }
public void delete(final Applicability applicability) { repositoryService.removeAndFlush(applicability); } //endregion
/** * Returns all templates for a type, ordered by application tenancy and date desc. */ @Programmatic public List<DocumentTemplate> findByType(final DocumentType documentType) { return repositoryService.allMatches( new QueryDefault<>(DocumentTemplate.class, "findByType", "type", documentType)); }
private UserSettingJdo newSetting( final String user, final String key, final String description, final SettingType settingType, final String valueRaw) { final UserSettingJdo setting = repositoryService.instantiate(UserSettingJdo.class); setting.setUser(user); setting.setKey(key); setting.setType(settingType); setting.setDescription(description); setting.setValueRaw(valueRaw); repositoryService.persist(setting); return setting; } //endregion
@Programmatic public void delete(final Paperclip paperclip) { repositoryService.remove(paperclip); }
/** * Returns the document template, if any for the specified {@link DocumentType} and exact application tenancy, and exact date. */ @Programmatic public DocumentTemplate findByTypeAndAtPathAndDate(final DocumentType documentType, final String atPath, final LocalDate date) { return repositoryService.firstMatch( new QueryDefault<>(DocumentTemplate.class, "findByTypeAndAtPathAndDate", "type", documentType, "atPath", atPath, "date", date)); }