/** * Static utility method to convert an <code>EventType</code> as present in * the Xml body into the corresponding JCR event constant defined by * {@link javax.jcr.observation.Event}. * * @param eventType * @return Any of the event types defined by {@link Event}.<br> * Possible values are * <ul> * <li>{@link Event#NODE_ADDED}</li> * <li>{@link Event#NODE_REMOVED}</li> * <li>{@link Event#PROPERTY_ADDED}</li> * <li>{@link Event#PROPERTY_REMOVED}</li> * <li>{@link Event#PROPERTY_CHANGED}</li> * <li>{@link Event#NODE_MOVED}</li> * <li>{@link Event#PERSIST}</li> * </ul> * @throws DavException if the given event type does not define a valid * JCR event type, such as returned by {@link #getEventType(int)}. */ public static int getJcrEventType(EventType eventType) throws DavException { if (eventType == null || !NAMESPACE.equals(eventType.getNamespace())) { throw new DavException(DavServletResponse.SC_UNPROCESSABLE_ENTITY, "Invalid JCR event type: "+ eventType + ": Namespace mismatch."); } String eventName = eventType.getName(); if (!EventUtil.isValidEventName(eventName)) { throw new DavException(DavServletResponse.SC_UNPROCESSABLE_ENTITY, "Invalid event type: "+eventName); } return EventUtil.getJcrEventType(eventName); }