Java Code Examples for org.apache.jackrabbit.webdav.property.DavPropertyName#create()

The following examples show how to use org.apache.jackrabbit.webdav.property.DavPropertyName#create() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Field.java    From davmail with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Create field for namespace and name of type propertyType.
 *
 * @param alias         logical name in DavMail
 * @param namespace     Exchange namespace
 * @param name          Exchange name
 * @param propertyType  property type
 * @param responseAlias property name in SEARCH response (as responsealias in request)
 * @param cast          response cast type (e.g. bin.base64)
 * @param updateAlias   some properties use a different alias in PROPPATCH requests
 */
protected Field(String alias, Namespace namespace, String name, PropertyType propertyType, String responseAlias, String cast, String updateAlias) {
    this.alias = alias;

    // property name in PROPFIND requests
    davPropertyName = DavPropertyName.create(name, namespace);
    // property name in PROPPATCH requests
    updatePropertyName = DavPropertyName.create(updateAlias, namespace);

    // a few type based flags
    isMultivalued = propertyType != null && propertyType.toString().endsWith("Array");
    isIntValue = propertyType == PropertyType.Long || propertyType == PropertyType.Integer || propertyType == PropertyType.Short;
    isBooleanValue = propertyType == PropertyType.Boolean;
    isFloatValue = propertyType == PropertyType.Float || propertyType == PropertyType.Double;
    isDateValue = propertyType == PropertyType.SystemTime;

    this.uri = namespace.getURI() + name;
    if (responseAlias == null) {
        this.requestPropertyString = '"' + uri + '"';
        this.responsePropertyName = davPropertyName;
    } else {
        this.requestPropertyString = '"' + uri + "\" as " + responseAlias;
        this.responsePropertyName = DavPropertyName.create(responseAlias, EMPTY);
    }
    this.cast = cast;
}
 
Example 2
Source File: AppointmentManager.java    From openmeetings with Apache License 2.0 6 votes vote down vote up
/**
 * Returns true if the resourcetype Property has a Calendar Element under it.
 *
 * @param resourcetype ResourceType Property
 * @return True if, resource is Calendar, else false.
 */
private static boolean checkCalendarResourceType(DavProperty<?> resourcetype) {
	boolean isCalendar = false;

	if (resourcetype != null) {
		DavPropertyName calProp = DavPropertyName.create("calendar", CalDAVConstants.NAMESPACE_CALDAV);

		for (Object o : (Collection<?>) resourcetype.getValue()) {
			if (o instanceof Element) {
				Element e = (Element) o;
				if (e.getLocalName().equals(calProp.getName())) {
					isCalendar = true;
				}
			}
		}
	}
	return isCalendar;
}
 
Example 3
Source File: DavItemResourceBase.java    From cosmo with Apache License 2.0 5 votes vote down vote up
private DavPropertyName qNameToPropName(QName qname) {
    // no namespace at all
    if ("".equals(qname.getNamespace())) {
        return DavPropertyName.create(qname.getLocalName());
    }

    Namespace ns = Namespace.getNamespace(qname.getNamespace());

    return DavPropertyName.create(qname.getLocalName(), ns);
}