public void addTemplateResources(
      JournalTemplate template, String[] groupPermissions, String[] guestPermissions)
      throws PortalException, SystemException {

    resourceLocalService.addModelResources(
        template.getCompanyId(),
        template.getGroupId(),
        template.getUserId(),
        JournalTemplate.class.getName(),
        template.getId(),
        groupPermissions,
        guestPermissions);
  }
  public void addTemplateResources(
      JournalTemplate template, boolean addGroupPermissions, boolean addGuestPermissions)
      throws PortalException, SystemException {

    resourceLocalService.addResources(
        template.getCompanyId(),
        template.getGroupId(),
        template.getUserId(),
        JournalTemplate.class.getName(),
        template.getId(),
        false,
        addGroupPermissions,
        addGuestPermissions);
  }
  public void deleteTemplate(JournalTemplate template) throws PortalException, SystemException {

    if (journalArticlePersistence.countByG_C_T(template.getGroupId(), 0, template.getTemplateId())
        > 0) {

      throw new RequiredTemplateException();
    }

    // WebDAVProps

    webDAVPropsLocalService.deleteWebDAVProps(JournalTemplate.class.getName(), template.getId());

    // Small image

    imageLocalService.deleteImage(template.getSmallImageId());

    // Expando

    expandoValueLocalService.deleteValues(JournalTemplate.class.getName(), template.getId());

    // Resources

    resourceLocalService.deleteResource(
        template.getCompanyId(),
        JournalTemplate.class.getName(),
        ResourceConstants.SCOPE_INDIVIDUAL,
        template.getId());

    // Article

    journalArticleLocalService.updateTemplateId(
        template.getGroupId(),
        PortalUtil.getClassNameId(JournalStructure.class.getName()),
        template.getTemplateId(),
        StringPool.BLANK);

    // Template

    journalTemplatePersistence.remove(template);
  }