예제 #1
0
  @SuppressWarnings("deprecation")
  private void _loadForm(ActionForm form, ActionRequest req, ActionResponse res) {
    try {
      StructureForm structureForm = (StructureForm) form;
      Structure structure = (Structure) req.getAttribute(WebKeys.Structure.STRUCTURE);
      BeanUtils.copyProperties(structureForm, structure);
      structureForm.setFields(structure.getFields());

      if (structure.getReviewInterval() != null) {
        String interval = structure.getReviewInterval();
        Pattern p = Pattern.compile("(\\d+)([dmy])");
        Matcher m = p.matcher(interval);
        boolean b = m.matches();
        if (b) {
          structureForm.setReviewContent(true);
          String g1 = m.group(1);
          String g2 = m.group(2);
          structureForm.setReviewIntervalNum(g1);
          structureForm.setReviewIntervalSelect(g2);
        }
      }
      if (UtilMethods.isSet(structure.getDetailPage())) {
        Identifier ident = APILocator.getIdentifierAPI().find(structure.getDetailPage());
        HTMLPage page = HTMLPageFactory.getLiveHTMLPageByIdentifier(ident);
        if (InodeUtils.isSet(page.getInode())) {
          structureForm.setDetailPage(page.getIdentifier());
        }
      }

    } catch (Exception ex) {
      Logger.debug(EditStructureAction.class, ex.toString());
    }
  }
예제 #2
0
  private void _resetIntervals(ActionForm form, ActionRequest req, ActionResponse res) {
    try {
      Structure structure = (Structure) req.getAttribute(WebKeys.Structure.STRUCTURE);

      int limit = 200;
      int offset = 0;
      List<Contentlet> contents =
          conAPI.findByStructure(structure, _getUser(req), false, limit, offset);
      int size = contents.size();
      while (size > 0) {
        for (Contentlet cont : contents) {
          cont.setReviewInterval(structure.getReviewInterval());
        }
        offset += limit;
        contents = conAPI.findByStructure(structure, _getUser(req), false, limit, offset);
        size = contents.size();
      }
    } catch (Exception ex) {
      Logger.debug(EditStructureAction.class, ex.toString());
    }
  }