* @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.");
}
int eType;
String eventName = eventType.getName();
if (EVENT_NODEADDED.equals(eventName)) {
eType = Event.NODE_ADDED;
} else if (EVENT_NODEREMOVED.equals(eventName)) {
eType = Event.NODE_REMOVED;
} else if (EVENT_PROPERTYADDED.equals(eventName)) {
eType = Event.PROPERTY_ADDED;
} else if (EVENT_PROPERTYCHANGED.equals(eventName)) {
eType = Event.PROPERTY_CHANGED;
} else if (EVENT_PROPERTYREMOVED.equals(eventName)) {
eType = Event.PROPERTY_REMOVED;
} else if (EVENT_NODEMOVED.equals(eventName)) {
eType = Event.NODE_MOVED;
} else if (EVENT_PERSIST.equals(eventName)) {
eType = Event.PERSIST;
} else {
throw new DavException(DavServletResponse.SC_UNPROCESSABLE_ENTITY, "Invalid event type: "+eventName);
}
return eType;
}