Example usage for org.dom4j.tree DefaultElement content

List of usage examples for org.dom4j.tree DefaultElement content

Introduction

In this page you can find the example usage for org.dom4j.tree DefaultElement content.

Prototype

Object content

To view the source code for org.dom4j.tree DefaultElement content.

Click Source Link

Document

Stores null for no content, a Node for a single content node or a List for multiple content nodes.

Usage

From source file:org.olat.ims.cp.objects.CPFile.java

License:Apache License

/**
 * Constructor, used when building up the cp (parsing XML-manifest)
 * // w  ww  .j a v  a  2s.  co m
 * @param me
 * @param xmlBase xmlBase-attribute of the parental resource-element
 * @param packageFolder TODO
 */
public CPFile(final DefaultElement me, final String xmlBase, final VFSContainer rootDir) {
    super(me.getName());
    setContent(me.content());
    this.href = me.attributeValue(CPCore.HREF);
    if (xmlBase.equals("")) {
        file = (VFSLeaf) rootDir.resolve(href);
    } else {
        file = (VFSLeaf) rootDir.resolve(xmlBase + "/" + href);
    }
}

From source file:org.olat.ims.cp.objects.CPItem.java

License:Apache License

/**
 * constructor is needed while building the datamodel-tree (parsing XML)
 * //from  w  w w .  j  a v a  2  s. c  o m
 * @param me
 */
public CPItem(final DefaultElement me, final DefaultElement parent) {
    super(me.getName());
    items = new Vector<CPItem>();
    errors = new Vector<String>();
    log = Logger.getLogger(this.getClass());
    // setAttributes(me.attributes());
    setContent(me.content());
    this.parent = parent;
    this.identifier = me.attributeValue(CPCore.IDENTIFIER);
    this.identifierRef = me.attributeValue(CPCore.IDENTIFIERREF, "");

    final String val = me.attributeValue(CPCore.ISVISIBLE, "true");
    this.visible = (val != null && val.equals("true"));
}

From source file:org.olat.ims.cp.objects.CPManifest.java

License:Apache License

/**
 * this constructor is used when building up the cp (parsing XML)
 * /*from   ww  w  .jav a  2  s. c o m*/
 * @param me
 */
public CPManifest(final CPCore cp, final DefaultElement me) {
    super(me.getName());
    log = Logger.getLogger(CPManifest.class);
    errors = new Vector<String>();
    this.identifier = me.attributeValue(CPCore.IDENTIFIER);
    this.schemaLocation = me.attributeValue(CPCore.SCHEMALOCATION);
    this.setNamespace(me.getNamespace());
    this.cp = cp;
    // FIXME: namespaces ! xmlns
    setContent(me.content());
}

From source file:org.olat.ims.cp.objects.CPMetadata.java

License:Apache License

public CPMetadata(final DefaultElement me) {
    super(me.getName());
    setContent(me.content());
    // TODO: parse xml to LOM-Object!
}

From source file:org.olat.ims.cp.objects.CPOrganization.java

License:Apache License

/**
 * this constructor is used when the cp is built (parsing XML manifest file)
 * //from w w w .ja va 2 s.c  o  m
 * @param me
 */
CPOrganization(final DefaultElement me) {
    super(me.getName());
    items = new Vector<CPItem>();
    errors = new Vector<String>();
    setAttributes(me.attributes());
    setContent(me.content());

    this.identifier = me.attributeValue(CPCore.IDENTIFIER);
    this.structure = me.attributeValue(CPCore.STRUCTURE, "hierarchical");
    // this.title = me.

}

From source file:org.olat.ims.cp.objects.CPOrganizations.java

License:Apache License

/**
 * this constructor is used when building up the CP (parsing XML)
 * //from w ww.  j av a 2 s.com
 * @param me
 */
public CPOrganizations(final DefaultElement me) {
    super(me.getName());
    orgas = new Vector<CPOrganization>();
    errors = new Vector<String>();
    // setAttributes(me.attributes());
    setContent(me.content());
}

From source file:org.olat.ims.cp.objects.CPResource.java

License:Apache License

/**
 * this constructor is needed when building up the datamodel (parsing XML-manifest)
 * //from  www. j  a  v  a 2s.  c  om
 * @param me
 */
public CPResource(final DefaultElement me) {
    super(me.getName());
    files = new Vector<CPFile>();
    dependencies = new Vector<CPDependency>();

    // setAttributes(me.attributes());
    setContent(me.content());

    this.identifier = me.attributeValue(CPCore.IDENTIFIER);
    this.type = me.attributeValue(CPCore.TYPE);
    this.href = me.attributeValue(CPCore.HREF);
    this.xmlbase = me.attributeValue(CPCore.BASE, "");

}

From source file:org.olat.ims.cp.objects.CPResources.java

License:Apache License

/**
 * this constructor i used when building up the cp (parsing XML manifest)
 * //from   w ww . j  av a 2s . c  o m
 * @param me
 */
public CPResources(final DefaultElement me) {
    super(me.getName());
    log = Logger.getLogger(this.getClass());
    resources = new Vector<CPResource>();
    errors = new Vector<String>();

    setAttributes(me.attributes());
    setContent(me.content());
}

From source file:se.sll.rtjp.puadapter.lookupresident.fetcher.ThreadedSNODFetcher.java

License:Apache License

/**
 * Fetches information for all the personId in the incoming wsRequest.
 * /*from  ww  w  . j  a v a2 s  .co m*/
 * @param wsRequest a {@link DefaultElement} object corresponding to the
 * LookupResidentForFullProfile tag from the request.
 * @return a list of transformed {@link ResidentType} objects.
 */
public List<ResidentType> fetchAllFromRequest(DefaultElement wsRequest) {
    ExecutorService executor = Executors.newFixedThreadPool(15);
    List<Future<ResidentType>> list = new ArrayList<Future<ResidentType>>();
    for (Object currObj : wsRequest.content()) {
        if (currObj instanceof DefaultElement) {
            DefaultElement currentElement = (DefaultElement) currObj;
            if (!currentElement.getTextTrim().equals("")) {
                Callable<ResidentType> worker = new SNODFetcherWorker(currentElement.getText(), baseURL,
                        httpClient);
                Future<ResidentType> submit = executor.submit(worker);
                list.add(submit);
            }
        }
    }

    // now retrieve the result
    List<ResidentType> response = new ArrayList<ResidentType>();
    for (Future<ResidentType> future : list) {
        try {
            response.add(future.get());
        } catch (InterruptedException e) {
            e.printStackTrace();
        } catch (ExecutionException e) {
            e.printStackTrace();
        }
    }
    return response;
}