예제 #1
0
  public boolean execute(Context context) throws Exception {
    Session session = ((JCRAppContext) context).getSession();
    String relPath = (String) context.get(pathKey);
    Node parentNode = (Node) session.getItem((String) context.get(currentNodeKey));

    context.put(resultKey, parentNode.getProperty(relPath));
    return false;
  }
예제 #2
0
  /** @see org.apache.commons.chain.Command#execute(org.apache.commons.chain.Context) */
  @SuppressWarnings("unchecked")
  @Override
  public boolean execute(Context context) throws Exception {
    Object operaterTime = context.get("operaterTime");

    if (operaterTime == null) {
      context.put("code", CodeConstants.INVALID_PARAM);
      context.put(
          "message",
          MessageFormat.format(
              CodeResourcesUtil.getProperty(CodeConstants.INVALID_PARAM), "operaterTime为空"));
      return PROCESSING_COMPLETE;
    }
    try {
      DateUtils.parse(operaterTime.toString(), "yyyyMMddHHmmss");
    } catch (Exception e) {
      context.put("code", CodeConstants.INVALID_PARAM);
      context.put(
          "message",
          MessageFormat.format(
              CodeResourcesUtil.getProperty(CodeConstants.INVALID_PARAM), "operaterTime格式错误"));
      return PROCESSING_COMPLETE;
    }

    return CONTINUE_PROCESSING;
  }
예제 #3
0
 @Override
 public void execute(Context ctx) throws RepositoryException {
   Node node = (Node) ctx.get("node");
   if (node.canAddMixin("mix:lockable")) node.addMixin("mix:lockable");
   node.getSession().save();
   node.lock(true, true);
   // node.getSession().save();
 }
예제 #4
0
  /** {@inheritDoc} */
  public boolean execute(Context ctx) throws Exception {
    Node node = CommandHelper.getCurrentNode(ctx);
    String nodeType = (String) ctx.get(this.typeKey);
    String name = (String) ctx.get(this.relPathKey);

    if (log.isDebugEnabled()) {
      log.debug("adding node at " + node.getPath() + "/" + name);
    }

    // If the new node name starts with / add it to the root node
    if (name.startsWith("/")) {
      node = CommandHelper.getSession(ctx).getRootNode();
      name = name.substring(1);
    }

    if (nodeType == null) {
      node.addNode(name);
    } else {
      node.addNode(name, nodeType);
    }
    return false;
  }
예제 #5
0
 public void tearDown(Context ctx) throws RepositoryException {
   Node node = (Node) ctx.get("node");
   if (node.isLocked()) node.unlock();
 }