/* (non-Javadoc)
   * @see org.osaf.cosmo.dav.property.StandardDavProperty#toXml(org.w3c.dom.Document)
   */
  public Element toXml(Document document) {
    Element name = getName().toXml(document);

    Element e = DomUtil.createElement(document, XML_HREF, NAMESPACE);
    DomUtil.setText(e, getHref());
    name.appendChild(e);

    return name;
  }
Exemple #2
0
  private CmpUser createUserFromXml(Element root) throws Exception {
    if (root == null) {
      return null;
    }

    CmpUser u = new CmpUser();

    u.setUsername(DomUtil.getChildTextTrim(root, UserResource.EL_USERNAME, OutputsXml.NS_CMP));
    u.setFirstName(DomUtil.getChildTextTrim(root, UserResource.EL_FIRSTNAME, OutputsXml.NS_CMP));
    u.setLastName(DomUtil.getChildTextTrim(root, UserResource.EL_LASTNAME, OutputsXml.NS_CMP));
    u.setEmail(DomUtil.getChildTextTrim(root, UserResource.EL_EMAIL, OutputsXml.NS_CMP));
    u.setUrl(DomUtil.getChildTextTrim(root, UserResource.EL_URL, OutputsXml.NS_CMP));
    u.setHomedirUrl(DomUtil.getChildTextTrim(root, UserResource.EL_HOMEDIRURL, OutputsXml.NS_CMP));

    u.setCreationDate(
        DateUtil.parseRfc3339Date(
            DomUtil.getChildTextTrim(root, UserResource.EL_CREATED, OutputsXml.NS_CMP)));

    u.setModifiedDate(
        DateUtil.parseRfc3339Date(
            DomUtil.getChildTextTrim(root, UserResource.EL_MODIFIED, OutputsXml.NS_CMP)));

    u.setAdmin(
        Boolean.parseBoolean(
            DomUtil.getChildTextTrim(root, UserResource.EL_ADMINISTRATOR, OutputsXml.NS_CMP)));

    return u;
  }
  /**
   * Create a new <code>DavPropertyNameSet</code> from the given DAV:prop element.
   *
   * @param propElement
   * @throws IllegalArgumentException if the specified element is <code>null</code> or is not a
   *     DAV:prop element.
   */
  public DavPropertyNameSet(Element propElement) {
    if (!DomUtil.matches(propElement, XML_PROP, NAMESPACE)) {
      throw new IllegalArgumentException("'DAV:prop' element expected.");
    }

    // fill the set
    ElementIterator it = DomUtil.getChildren(propElement);
    while (it.hasNext()) {
      add(DavPropertyName.createFromXml(it.nextElement()));
    }
  }
/**
 * Provides constants for request headers, URL parameters, and XML namespaces, elements and values,
 * DAV properties and resource types defined by the WebDAV ticket spec.
 */
public interface TicketConstants extends DavConstants {

  /** The HTTP header name <code>Ticket</code> */
  public static final String HEADER_TICKET = "Ticket";

  /** The URL query string parameter name <code>ticket</code> */
  public static final String PARAM_TICKET = "ticket";

  /** The ticket XML namespace */
  public static final Namespace NAMESPACE_TICKET =
      Namespace.getNamespace("ticket", "http://www.xythos.com/namespaces/StorageServer");

  /** The ticket XML element name <ticket:ticketinfo */
  public static final String ELEMENT_TICKET_TICKETINFO = "ticketinfo";

  public static final String QN_TICKET_TICKETINFO =
      DomUtil.getQualifiedName(ELEMENT_TICKET_TICKETINFO, NAMESPACE_TICKET);
  /** The ticket XML element name <ticket:id */
  public static final String ELEMENT_TICKET_ID = "id";

  public static final String QN_TICKET_ID =
      DomUtil.getQualifiedName(ELEMENT_TICKET_ID, NAMESPACE_TICKET);
  /** The ticket XML element name <ticket:timeout */
  public static final String ELEMENT_TICKET_TIMEOUT = "timeout";

  public static final String QN_TICKET_TIMEOUT =
      DomUtil.getQualifiedName(ELEMENT_TICKET_TIMEOUT, NAMESPACE_TICKET);
  /** The ticket XML element name <ticket:visits */
  public static final String ELEMENT_TICKET_VISITS = "visits";
  /** The ticket XML element name <ticket:freebusy */
  public static final String ELEMENT_TICKET_FREEBUSY = "freebusy";

  /** The XML value <code>infinity</code> */
  public static final String VALUE_INFINITY = "infinity";

  /** The DAV property name <code>ticketdiscovery</code> */
  public static final String PROPERTY_TICKET_TICKETDISCOVERY = "ticketdiscovery";

  /** The ticket property <code>ticket:ticketdiscovery</code> */
  public static final DavPropertyName TICKETDISCOVERY =
      DavPropertyName.create(PROPERTY_TICKET_TICKETDISCOVERY, NAMESPACE_TICKET);
}
Exemple #5
0
  private Set createUsersFromXml(Document doc) throws Exception {
    HashSet users = new HashSet();
    if (doc == null) {
      return null;
    }

    ElementIterator i =
        DomUtil.getChildren(doc.getDocumentElement(), UserResource.EL_USER, OutputsXml.NS_CMP);
    while (i.hasNext()) {
      CmpUser u = createUserFromXml(i.nextElement());
      users.add(u);
    }

    return users;
  }
 /** @see XmlSerializable#toXml(org.w3c.dom.Document) */
 public Element toXml(Document document) {
   Element sqg = DomUtil.createElement(document, XML_QUERY_GRAMMAR, SearchConstants.NAMESPACE);
   Element grammer = DomUtil.addChildElement(sqg, XML_GRAMMER, SearchConstants.NAMESPACE);
   DomUtil.addChildElement(grammer, localName, namespace);
   return sqg;
 }
 Grammer(String localName, Namespace namespace) {
   this.localName = localName;
   this.namespace = namespace;
   hashCode = DomUtil.getExpandedName(localName, namespace).hashCode();
 }