@Override public String toString() { return getName(); } }
@Override public Presentation getPresentationByName(String name) { for (Presentation p : presentations.values()) { if (name.equalsIgnoreCase(p.getName())) { return p; } } return null; }
@Override public String getCaption(Object id) { Presentation p = getPresentation(id); if (p != null) { return p.getName(); } return null; }
protected Map<UUID, Presentation> copyPresentations(User fromUser, User toUser) { Map<UUID, Presentation> presentationMap = new HashMap<>(); try (Transaction tx = persistence.createTransaction()) { EntityManager em = persistence.getEntityManager(); // delete existing Query delete = em.createQuery("delete from sec$Presentation p where p.user.id = ?1"); delete.setParameter(1, toUser.getId()); delete.executeUpdate(); // copy settings TypedQuery<Presentation> selectQuery = em.createQuery( "select p from sec$Presentation p where p.user.id = ?1", Presentation.class); selectQuery.setParameter(1, fromUser.getId()); List<Presentation> presentations = selectQuery.getResultList(); for (Presentation presentation : presentations) { Presentation newPresentation = metadata.create(Presentation.class); newPresentation.setUser(toUser); newPresentation.setComponentId(presentation.getComponentId()); newPresentation.setAutoSave(presentation.getAutoSave()); newPresentation.setName(presentation.getName()); newPresentation.setXml(presentation.getXml()); presentationMap.put(presentation.getId(), newPresentation); em.persist(newPresentation); } tx.commit(); return presentationMap; } }
selectedPresentationField.setWidth("250px"); selectedPresentationField.setCaption(getMessage("folders.folderEditWindow.presentation")); selectedPresentationField.setValue(((SearchFolder) folder).getPresentation().getName()); selectedPresentationField.setEnabled(false); layout.addComponent(selectedPresentationField);