Esempio n. 1
0
  @Override
  public void delete(HelpPageContent helpPageContent) {
    EntityManager entityManager = getEntityManager();

    if (helpPageContent.getPage() != null) {
      HelpPage helpPage = helpPageContent.getPage();
      helpPage.removeContent(helpPageContent);
      entityManager.persist(helpPage);
    }

    super.delete(helpPageContent);
  }
Esempio n. 2
0
  public HelpPageContent create(HelpPage page, Locale locale, String content, User creatingUser) {
    EntityManager entityManager = getEntityManager();

    Date now = new Date(System.currentTimeMillis());

    HelpPageContent helpPageContent = new HelpPageContent();
    helpPageContent.setCreated(now);
    helpPageContent.setLastModified(now);
    helpPageContent.setCreator(creatingUser);
    helpPageContent.setLastModifier(creatingUser);
    helpPageContent.setLocale(locale);
    helpPageContent.setContent(content);

    entityManager.persist(helpPageContent);

    page.addContent(helpPageContent);

    entityManager.persist(page);

    return helpPageContent;
  }