javax.jcr.observation.Event.getType()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(157)

本文整理了Java中javax.jcr.observation.Event.getType()方法的一些代码示例,展示了Event.getType()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Event.getType()方法的具体详情如下:
包路径:javax.jcr.observation.Event
类名称:Event
方法名:getType

Event.getType介绍

[英]Returns the type of this event: a constant defined by this interface. One of:

  • NODE_ADDED
  • NODE_REMOVED
  • PROPERTY_ADDED
  • PROPERTY_REMOVED
  • PROPERTY_CHANGED
  • NODE_MOVED
  • PERSIST
    [中]返回此事件的类型:此接口定义的常量。什么之中的一个:
  • NODE_ADDED
  • NODE_REMOVED
  • PROPERTY_ADDED
  • PROPERTY_REMOVED
  • PROPERTY_CHANGED
  • NODE_MOVED
  • PERSIST

代码示例

代码示例来源:origin: org.onehippo.cms7.hst.components/hst-core

private boolean isPropertyEvent(final Event jcrEvent) {
  return jcrEvent.getType() == Event.PROPERTY_ADDED
      || jcrEvent.getType() == Event.PROPERTY_CHANGED
      || jcrEvent.getType() == Event.PROPERTY_REMOVED;
}

代码示例来源:origin: org.apache.jackrabbit/jackrabbit-jcr-commons

@Override
public int getType() {
  return event.getType();
}

代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

@Override
public int getType() {
  return event.getType();
}

代码示例来源:origin: org.fcrepo/fcrepo-kernel

/**
 * @return the event types of the underlying JCR {@link Event}s
 */
public Set<Integer> getTypes() {
  return eventTypes != null ? union(singleton(e.getType()), eventTypes) : singleton(e.getType());
}

代码示例来源:origin: org.apache.sling/org.apache.sling.distribution.core

String getNodePathFromEvent(Event event) throws RepositoryException {
  String eventPath = event.getPath();
  int type = event.getType();
  if (eventPath == null) {
    return null;
  }
  if (Event.PROPERTY_REMOVED == type || Event.PROPERTY_CHANGED == type || Event.PROPERTY_ADDED == type) {
    eventPath = eventPath.substring(0, eventPath.lastIndexOf('/'));
  }
  return eventPath;
}

代码示例来源:origin: apache/jackrabbit-oak

@Override
  public boolean onEvent(Event event) throws RepositoryException {
    return type == event.getType() && equal(path, event.getPath());
  }
});

代码示例来源:origin: apache/jackrabbit-oak

@Override
  public boolean onEvent(Event event) throws Exception {
    return event.getType() == PROPERTY_ADDED &&
        event.getPath().endsWith("n2/jcr:primaryType");
  }
});

代码示例来源:origin: apache/jackrabbit-oak

@Override
  public boolean onEvent(Event event) throws Exception {
    return event.getType() == PROPERTY_ADDED &&
        event.getPath().endsWith("n2/jcr:mixinTypes");
  }
});

代码示例来源:origin: apache/jackrabbit-oak

@Override
  public boolean onEvent(Event event) throws Exception {
    if (event.getPath().equals(TEST_PATH + "/a/b/c") && event.getType() == NODE_REMOVED) {
      return true;
    }
    return false;
  }
});

代码示例来源:origin: info.magnolia/magnolia-core

@Override
  public void onEvent(EventIterator events) {
    while (events.hasNext()) {
      Event event = events.nextEvent();
      String path = getPath(event);
      log.debug(String.format("0x%x\t%s", event.getType(), path));
      callback.processEvent(event.getType(), path);
    }
  }
};

代码示例来源:origin: apache/jackrabbit-oak

@Override
  public boolean onEvent(Event event) throws Exception {
    if (event.getType() == PROPERTY_CHANGED &&
        event.getPath().endsWith("n3/p1")) {
      Map<?, ?> info = event.getInfo();
      return info != null &&
          NT_UNSTRUCTURED.equals(info.get(JCR_PRIMARYTYPE));
    } else {
      return false;
    }
  }
});

代码示例来源:origin: apache/jackrabbit-oak

@Override
  public boolean onEvent(Event event) throws Exception {
    if (event.getType() == PROPERTY_ADDED &&
        event.getPath().endsWith("n1/jcr:primaryType")) {
      Map<?, ?> info = event.getInfo();
      return info != null &&
          "oak:Unstructured".equals(info.get(JCR_PRIMARYTYPE));
    } else {
      return false;
    }
  }
});

代码示例来源:origin: apache/jackrabbit-oak

@Override
  public boolean onEvent(Event event) throws Exception {
    if (event.getType() == PROPERTY_REMOVED &&
        event.getPath().endsWith("n3/p2")) {
      Map<?, ?> info = event.getInfo();
      return info != null &&
          NT_UNSTRUCTURED.equals(info.get(JCR_PRIMARYTYPE));
    } else {
      return false;
    }
  }
});

代码示例来源:origin: apache/jackrabbit-oak

@Override
  public boolean onEvent(Event event) throws Exception {
    if (event.getType() == NODE_ADDED && event.getPath().endsWith("n1")) {
      Map<?, ?> info = event.getInfo();
      return info != null &&
          "oak:Unstructured".equals(info.get(JCR_PRIMARYTYPE));
    } else {
      return false;
    }
  }
});

代码示例来源:origin: apache/jackrabbit-oak

@Override
  public void onEvent(EventIterator events) {
    blockObservation.acquireUninterruptibly();
    while (events.hasNext()) {
      Event event = events.nextEvent();
      if (event.getType() == Event.NODE_ADDED) {
        numObservedNodes.incrementAndGet();
      }
    }
    blockObservation.release();
  }
}

代码示例来源:origin: apache/jackrabbit-oak

@Override
  public boolean onEvent(Event event) throws RepositoryException {
    return type == event.getType() && equal(path, event.getPath()) && equal(identifier, event.getIdentifier());
  }
});

代码示例来源:origin: apache/jackrabbit-oak

@Override
  public boolean onEvent(Event event) throws Exception {
    return event.getType() == NODE_MOVED &&
        equal(dst, event.getPath()) &&
        equal(src, event.getInfo().get("srcAbsPath")) &&
        equal(dst, event.getInfo().get("destAbsPath"));
  }
});

代码示例来源:origin: apache/jackrabbit-oak

@Override
  public boolean onEvent(Event event) throws RepositoryException {
    return type == event.getType() && equal(path, event.getPath()) && event.getInfo().containsKey("beforeValue") && beforeValue.equals(((Value)event.getInfo().get("beforeValue")).getString());
  }
});

代码示例来源:origin: info.magnolia/magnolia-core

@Override
  public void onEvent(EventIterator events) {
    while (events.hasNext()) {
      Event event = events.nextEvent();
      String path = getPath(event);
      callback.processEvent(event.getType(), path);
    }
  }
};

代码示例来源:origin: apache/jackrabbit

public void testAddShareableMixin() throws RepositoryException {
  Node n1 = testRootNode.addNode(nodeName1);
  testRootNode.save();
  EventResult result = new EventResult(log);
  addEventListener(result);
  n1.addMixin(mixShareable);
  testRootNode.save();
  Event[] events = result.getEvents(DEFAULT_WAIT_TIMEOUT);
  for (int i = 0; i < events.length; i++) {
    assertFalse("must not contain node added event", events[i].getType() == Event.NODE_ADDED);
    assertFalse("must not contain node removed event", events[i].getType() == Event.NODE_REMOVED);
  }
}

相关文章