Package org.exoplatform.services.command.action

Examples of org.exoplatform.services.command.action.Condition


      //
      SessionEventMatcher matcher =
         new SessionEventMatcher(Event.NODE_ADDED, null, true, new String[]{"production"}, null, ntHolder);
      catalog.addAction(matcher, new DummyAction());
      Condition cond = new Condition();
      cond.put(SessionEventMatcher.EVENTTYPE_KEY, Event.NODE_ADDED);

      // test for this ws
      cond.put(SessionEventMatcher.WORKSPACE_KEY, "production");
      assertEquals(1, catalog.getActions(cond).size());

      cond.put(SessionEventMatcher.WORKSPACE_KEY, "draft");
      assertEquals(0, catalog.getActions(cond).size());

   }
View Full Code Here


      assertEquals(1, catalog.getAllActions().size());
      ActionConfiguration ac1 = aap.getActions().get(0);
      assertEquals("org.exoplatform.services.jcr.usecases.action.DummyAction", ac1.getActionClassName());
      assertEquals("/test,/exo:test1", ac1.getPath());

      Condition cond = new Condition();
      cond.put(SessionEventMatcher.EVENTTYPE_KEY, Event.NODE_ADDED);

      assertEquals(1, catalog.getActions(cond).size());

      Iterator<ActionMatcher> matchers = catalog.getAllEntries().keySet().iterator();
View Full Code Here

      // test by path
      SessionEventMatcher matcher =
         new SessionEventMatcher(Event.NODE_ADDED, new QPath[]{node.getInternalPath()}, true, null, null, ntHolder);
      catalog.addAction(matcher, new DummyAction());
      Condition cond = new Condition();

      cond = new Condition();
      cond.put(SessionEventMatcher.EVENTTYPE_KEY, Event.NODE_ADDED);
      cond.put(SessionEventMatcher.PATH_KEY, node.getInternalPath());

      // test for this path
      assertEquals(1, catalog.getActions(cond).size());

      cond.put(SessionEventMatcher.PATH_KEY, Constants.ROOT_PATH);
      assertEquals(0, catalog.getActions(cond).size());

      // test for child path
      QPath child = QPath.makeChildPath(node.getInternalPath(), Constants.EXO_PREFIX);
      cond.put(SessionEventMatcher.PATH_KEY, child);
      assertEquals(1, catalog.getActions(cond).size());

      // test for grandchild path - found as deep = true
      QPath grandchild = QPath.makeChildPath(child, Constants.EXO_PREFIX);
      cond.put(SessionEventMatcher.PATH_KEY, grandchild);
      assertEquals(1, catalog.getActions(cond).size());

   }
View Full Code Here

      // ((NodeTypeImpl)node.getPrimaryNodeType()).getQName());

      // test by event type
      SessionEventMatcher matcher = new SessionEventMatcher(Event.NODE_ADDED, null, true, null, null, ntHolder);
      catalog.addAction(matcher, new DummyAction());
      Condition cond = new Condition();
      cond.put(SessionEventMatcher.EVENTTYPE_KEY, Event.NODE_ADDED);
      assertEquals(1, catalog.getActions(cond).size());
      cond.put(SessionEventMatcher.EVENTTYPE_KEY, ExtendedEvent.ADD_MIXIN);
      assertEquals(0, catalog.getActions(cond).size());

   }
View Full Code Here

      // test by path
      SessionEventMatcher matcher =
         new SessionEventMatcher(ExtendedEvent.ADD_MIXIN, null, true, null,
            new InternalQName[]{Constants.MIX_LOCKABLE}, ntHolder);
      catalog.addAction(matcher, new DummyAction());
      Condition cond = new Condition();
      cond.put(SessionEventMatcher.EVENTTYPE_KEY, ExtendedEvent.ADD_MIXIN);

      // test for this nodetype
      cond.put(SessionEventMatcher.NODETYPES_KEY, new InternalQName[]{Constants.NT_UNSTRUCTURED});
      assertEquals(0, catalog.getActions(cond).size());

      cond.put(SessionEventMatcher.NODETYPES_KEY, new InternalQName[]{Constants.MIX_LOCKABLE});
      assertEquals(1, catalog.getActions(cond).size());
   }
View Full Code Here

      // test by path
      SessionEventMatcher matcher =
         new SessionEventMatcher(ExtendedEvent.NODE_ADDED, null, true, null,
            new InternalQName[]{Constants.NT_HIERARCHYNODE}, ntHolder);
      catalog.addAction(matcher, new DummyAction());
      Condition cond = new Condition();
      cond.put(SessionEventMatcher.EVENTTYPE_KEY, ExtendedEvent.NODE_ADDED);

      // test for this nodetype
      cond.put(SessionEventMatcher.NODETYPES_KEY, new InternalQName[]{Constants.NT_UNSTRUCTURED});
      assertEquals(0, catalog.getActions(cond).size());

      cond.put(SessionEventMatcher.NODETYPES_KEY, new InternalQName[]{Constants.NT_HIERARCHYNODE});
      assertEquals(1, catalog.getActions(cond).size());

      cond.put(SessionEventMatcher.NODETYPES_KEY, new InternalQName[]{Constants.NT_FILE});
      assertEquals(1, catalog.getActions(cond).size());

      cond.put(SessionEventMatcher.NODETYPES_KEY, new InternalQName[]{Constants.NT_FOLDER});
      assertEquals(1, catalog.getActions(cond).size());

   }
View Full Code Here

      // test by path
      SessionEventMatcher matcher =
         new SessionEventMatcher(Event.NODE_ADDED, new QPath[]{((NodeImpl)root).getInternalPath()}, false, null, null,
            ntHolder);
      catalog.addAction(matcher, new DummyAction());
      Condition cond = new Condition();

      cond = new Condition();
      cond.put(SessionEventMatcher.EVENTTYPE_KEY, Event.NODE_ADDED);

      // test for this path
      cond.put(SessionEventMatcher.PATH_KEY, Constants.ROOT_PATH);
      assertEquals(1, catalog.getActions(cond).size());

      // test for child path
      cond.put(SessionEventMatcher.PATH_KEY, node.getInternalPath());
      assertEquals(1, catalog.getActions(cond).size());

      // test for grandchild path - not found as deep = false
      QPath child = QPath.makeChildPath(node.getInternalPath(), Constants.EXO_PREFIX);
      cond.put(SessionEventMatcher.PATH_KEY, child);
      assertEquals(0, catalog.getActions(cond).size());

   }
View Full Code Here

      else
         return;

      try
      {
         Condition conditions = new Condition();
         conditions.put(SessionEventMatcher.EVENTTYPE_KEY, ExtendedEvent.ADD_MIXIN);
         conditions.put(SessionEventMatcher.PATH_KEY, node.getInternalPath());
         conditions.put(SessionEventMatcher.NODETYPES_KEY, new InternalQName[]{mixinType});

         InvocationContext ctx = new InvocationContext();
         ctx.put(InvocationContext.CURRENT_ITEM, node);
         ctx.put(InvocationContext.EVENT, ExtendedEvent.ADD_MIXIN);
         ctx.put(InvocationContext.EXO_CONTAINER, container);
View Full Code Here

      else
         return;

      try
      {
         Condition conditions = new Condition();
         conditions.put(SessionEventMatcher.EVENTTYPE_KEY, ExtendedEvent.NODE_ADDED);
         conditions.put(SessionEventMatcher.PATH_KEY, node.getInternalPath());
         conditions.put(SessionEventMatcher.NODETYPES_KEY, readNodeTypeNames((NodeData)node.getData()));

         InvocationContext ctx = new InvocationContext();
         ctx.put(InvocationContext.CURRENT_ITEM, node);
         ctx.put(InvocationContext.EXO_CONTAINER, container);
         ctx.put(InvocationContext.EVENT, ExtendedEvent.NODE_ADDED);
View Full Code Here

      else
         return;

      try
      {
         Condition conditions = new Condition();
         conditions.put(SessionEventMatcher.EVENTTYPE_KEY, ExtendedEvent.CHECKIN);
         conditions.put(SessionEventMatcher.PATH_KEY, node.getInternalPath());
         conditions.put(SessionEventMatcher.NODETYPES_KEY, readNodeTypeNames((NodeData)node.getData()));

         InvocationContext ctx = new InvocationContext();
         ctx.put(InvocationContext.CURRENT_ITEM, node);
         ctx.put(InvocationContext.EVENT, ExtendedEvent.CHECKIN);
         ctx.put(InvocationContext.EXO_CONTAINER, container);
View Full Code Here

TOP

Related Classes of org.exoplatform.services.command.action.Condition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.