Example usage for org.dom4j Attribute getValue

List of usage examples for org.dom4j Attribute getValue

Introduction

In this page you can find the example usage for org.dom4j Attribute getValue.

Prototype

String getValue();

Source Link

Document

Returns the value of the attribute.

Usage

From source file:net.unicon.academus.apps.briefcase.engine.GoToFolderAction.java

License:Open Source License

public static IAction parse(Element e, IWarlockFactory owner) throws WarlockException {

    // Assertions.
    if (e == null) {
        String msg = "Argument 'e [Element]' cannot be null.";
        throw new IllegalArgumentException(msg);
    }//  w  ww .j  a v  a  2s. c o m
    if (!e.getName().equals("action")) {
        String msg = "Argument 'e [Element]' must be an <action> element.";
        throw new IllegalArgumentException(msg);
    }
    if (owner == null) {
        String msg = "Argument 'owner+' cannot be null.";
        throw new IllegalArgumentException(msg);
    }

    // Handle.
    Attribute h = e.attribute("handle");
    if (h == null) {
        String msg = "Element <action> is missing required attribute " + "'handle'.";
        throw new XmlFormatException(msg);
    }
    Handle handle = Handle.create(h.getValue());

    // Choices.
    String[] choices = new String[0];
    Attribute p = e.attribute("inpt");
    if (p != null) {
        StringTokenizer tokens = new StringTokenizer(p.getValue(), ",");
        choices = new String[tokens.countTokens()];
        for (int i = 0; tokens.hasMoreTokens(); i++) {
            choices[i] = tokens.nextToken();
        }
    }

    return new GoToFolderAction(owner, handle, choices);

}

From source file:net.unicon.academus.apps.briefcase.engine.GoToSelectorAction.java

License:Open Source License

public static IAction parse(Element e, IWarlockFactory owner) throws WarlockException {

    // Assertions.
    if (e == null) {
        String msg = "Argument 'e [Element]' cannot be null.";
        throw new IllegalArgumentException(msg);
    }//from   w  w  w.  j a v a  2s .c  o m
    if (!e.getName().equals("action")) {
        String msg = "Argument 'e [Element]' must be an <action> element.";
        throw new IllegalArgumentException(msg);
    }
    if (owner == null) {
        String msg = "Argument 'owner' cannot be null.";
        throw new IllegalArgumentException(msg);
    }

    // Handle.
    Attribute h = e.attribute("handle");
    if (h == null) {
        String msg = "Element <action> is missing required attribute " + "'handle'.";
        throw new XmlFormatException(msg);
    }
    Handle handle = Handle.create(h.getValue());

    // Choices.
    String[] choices = new String[0];
    Attribute p = e.attribute("inpt");
    if (p != null) {
        choices = p.getValue().split(",");
    }

    return new GoToSelectorAction(owner, handle, choices);

}

From source file:net.unicon.academus.apps.briefcase.engine.MoveResourcesAction.java

License:Open Source License

public static IAction parse(Element e, IWarlockFactory owner) throws WarlockException {

    // Assertions.
    if (e == null) {
        String msg = "Argument 'e [Element]' cannot be null.";
        throw new IllegalArgumentException(msg);
    }/*from ww  w  . j  a  v a  2  s  . co m*/
    if (!e.getName().equals("action")) {
        String msg = "Argument 'e [Element]' must be an <action> element.";
        throw new IllegalArgumentException(msg);
    }
    if (owner == null) {
        String msg = "Argument 'owner' cannot be null.";
        throw new IllegalArgumentException(msg);
    }

    // Handle.
    Attribute h = e.attribute("handle");
    if (h == null) {
        String msg = "Element <action> is missing required attribute " + "'handle'.";
        throw new XmlFormatException(msg);
    }
    Handle handle = Handle.create(h.getValue());

    // Choices.
    String[] choices = new String[0];
    Attribute p = e.attribute("inpt");
    if (p != null) {
        StringTokenizer tokens = new StringTokenizer(p.getValue(), ",");
        choices = new String[tokens.countTokens()];
        for (int i = 0; tokens.hasMoreTokens(); i++) {
            choices[i] = tokens.nextToken();
        }
    }

    return new MoveResourcesAction(owner, handle, choices);

}

From source file:net.unicon.academus.apps.briefcase.engine.NavigateToDestinationAction.java

License:Open Source License

public static IAction parse(Element e, IWarlockFactory owner) throws WarlockException {

    // Assertions.
    if (e == null) {
        String msg = "Argument 'e [Element]' cannot be null.";
        throw new IllegalArgumentException(msg);
    }// w ww . j  a  v  a2 s  . co m
    if (!e.getName().equals("action")) {
        String msg = "Argument 'e [Element]' must be an <action> element.";
        throw new IllegalArgumentException(msg);
    }
    if (owner == null) {
        String msg = "Argument 'owner' cannot be null.";
        throw new IllegalArgumentException(msg);
    }

    // Handle.
    Attribute h = e.attribute("handle");
    if (h == null) {
        String msg = "Element <action> is missing required attribute " + "'handle'.";
        throw new XmlFormatException(msg);
    }
    Handle handle = Handle.create(h.getValue());

    // Choices.
    String[] choices = new String[0];
    Attribute p = e.attribute("inpt");
    if (p != null) {
        StringTokenizer tokens = new StringTokenizer(p.getValue(), ",");
        choices = new String[tokens.countTokens()];
        for (int i = 0; tokens.hasMoreTokens(); i++) {
            choices[i] = tokens.nextToken();
        }
    }

    return new NavigateToDestinationAction(owner, handle, choices);

}

From source file:net.unicon.academus.apps.briefcase.engine.RemoveFolderSharingAction.java

License:Open Source License

public static IAction parse(Element e, IWarlockFactory owner) throws WarlockException {

    // Assertions.
    if (e == null) {
        String msg = "Argument 'e [Element]' cannot be null.";
        throw new IllegalArgumentException(msg);
    }//from w w  w.j  a  va 2 s  .c  o m
    if (!e.getName().equals("action")) {
        String msg = "Argument 'e [Element]' must be an <action> element.";
        throw new IllegalArgumentException(msg);
    }
    if (owner == null) {
        String msg = "Argument 'owner+' cannot be null.";
        throw new IllegalArgumentException(msg);
    }

    // Handle.
    Attribute h = e.attribute("handle");
    if (h == null) {
        String msg = "Element <action> is missing required attribute " + "'handle'.";
        throw new XmlFormatException(msg);
    }
    Handle handle = Handle.create(h.getValue());

    // Choices.
    String[] choices = new String[0];
    Attribute p = e.attribute("inpt");
    if (p != null) {
        StringTokenizer tokens = new StringTokenizer(p.getValue(), ",");
        choices = new String[tokens.countTokens()];
        for (int i = 0; tokens.hasMoreTokens(); i++) {
            choices[i] = tokens.nextToken();
        }
    }

    return new RemoveFolderSharingAction(owner, handle, choices);

}

From source file:net.unicon.academus.apps.briefcase.engine.RemoveShareeAction.java

License:Open Source License

public static IAction parse(Element e, IWarlockFactory owner) throws WarlockException {

    // Assertions.
    if (e == null) {
        String msg = "Argument 'e [Element]' cannot be null.";
        throw new IllegalArgumentException(msg);
    }/* w ww. j  a va  2s .  co m*/
    if (!e.getName().equals("action")) {
        String msg = "Argument 'e [Element]' must be an <action> element.";
        throw new IllegalArgumentException(msg);
    }
    if (owner == null) {
        String msg = "Argument 'owner+' cannot be null.";
        throw new IllegalArgumentException(msg);
    }

    // Handle.
    Attribute h = e.attribute("handle");
    if (h == null) {
        String msg = "Element <action> is missing required attribute " + "'handle'.";
        throw new XmlFormatException(msg);
    }
    Handle handle = Handle.create(h.getValue());

    // Choices.
    String[] choices = new String[0];
    Attribute p = e.attribute("inpt");
    if (p != null) {
        StringTokenizer tokens = new StringTokenizer(p.getValue(), ",");
        choices = new String[tokens.countTokens()];
        for (int i = 0; tokens.hasMoreTokens(); i++) {
            choices[i] = tokens.nextToken();
        }
    }

    return new RemoveShareeAction(owner, handle, choices);

}

From source file:net.unicon.academus.apps.briefcase.engine.SelectDestinationAction.java

License:Open Source License

public static IAction parse(Element e, IWarlockFactory owner) throws WarlockException {

    // Assertions.
    if (e == null) {
        String msg = "Argument 'e [Element]' cannot be null.";
        throw new IllegalArgumentException(msg);
    }//from ww w  .j  a  v  a 2s  .c  om
    if (!e.getName().equals("action")) {
        String msg = "Argument 'e [Element]' must be an <action> element.";
        throw new IllegalArgumentException(msg);
    }
    if (owner == null) {
        String msg = "Argument 'owner' cannot be null.";
        throw new IllegalArgumentException(msg);
    }

    // Handle.
    Attribute h = e.attribute("handle");
    if (h == null) {
        String msg = "Element <action> is missing required attribute " + "'handle'.";
        throw new XmlFormatException(msg);
    }
    Handle handle = Handle.create(h.getValue());

    // Choices.
    String[] choices = new String[0];
    Attribute p = e.attribute("inpt");
    if (p != null) {
        StringTokenizer tokens = new StringTokenizer(p.getValue(), ",");
        choices = new String[tokens.countTokens()];
        for (int i = 0; tokens.hasMoreTokens(); i++) {
            choices[i] = tokens.nextToken();
        }
    }

    // Mode.
    Attribute m = e.attribute("mode");
    if (m == null) {
        String msg = "Element <action> is missing required attribute " + "'mode'.";
        throw new XmlFormatException(msg);
    }
    DestinationMode mode = DestinationMode.getInstance(m.getValue());

    return new SelectDestinationAction(owner, handle, choices, mode);

}

From source file:net.unicon.academus.apps.briefcase.engine.SetFolderItemsPerPageAction.java

License:Open Source License

public static IAction parse(Element e, IWarlockFactory owner) throws WarlockException {

    // Assertions.
    if (e == null) {
        String msg = "Argument 'e [Element]' cannot be null.";
        throw new IllegalArgumentException(msg);
    }// ww  w  .ja  v  a  2s  . c  o m
    if (!e.getName().equals("action")) {
        String msg = "Argument 'e [Element]' must be an <action> element.";
        throw new IllegalArgumentException(msg);
    }
    if (owner == null) {
        String msg = "Argument 'owner+' cannot be null.";
        throw new IllegalArgumentException(msg);
    }

    // Handle.
    Attribute h = e.attribute("handle");
    if (h == null) {
        String msg = "Element <action> is missing required attribute " + "'handle'.";
        throw new XmlFormatException(msg);
    }
    Handle handle = Handle.create(h.getValue());

    // Choices.
    String[] choices = new String[0];
    Attribute p = e.attribute("inpt");
    if (p != null) {
        StringTokenizer tokens = new StringTokenizer(p.getValue(), ",");
        choices = new String[tokens.countTokens()];
        for (int i = 0; tokens.hasMoreTokens(); i++) {
            choices[i] = tokens.nextToken();
        }
    }

    return new SetFolderItemsPerPageAction(owner, handle, choices);

}

From source file:net.unicon.academus.apps.briefcase.engine.SetItemsPerPageAction.java

License:Open Source License

public static IAction parse(Element e, IWarlockFactory owner) throws WarlockException {

    // Assertions.
    if (e == null) {
        String msg = "Argument 'e [Element]' cannot be null.";
        throw new IllegalArgumentException(msg);
    }/*w ww .j  av a2  s.c om*/
    if (!e.getName().equals("action")) {
        String msg = "Argument 'e [Element]' must be an <action> element.";
        throw new IllegalArgumentException(msg);
    }
    if (owner == null) {
        String msg = "Argument 'owner+' cannot be null.";
        throw new IllegalArgumentException(msg);
    }

    // Handle.
    Attribute h = e.attribute("handle");
    if (h == null) {
        String msg = "Element <action> is missing required attribute " + "'handle'.";
        throw new XmlFormatException(msg);
    }
    Handle handle = Handle.create(h.getValue());

    //      ToScreen.
    Attribute s = e.attribute("to-screen");
    if (s == null) {
        String msg = "Element <action> is missing required attribute " + "'to-screen'.";
        throw new XmlFormatException(msg);
    }
    String toScreen = s.getValue();

    // Choices.
    String[] choices = new String[0];
    Attribute p = e.attribute("inpt");
    if (p != null) {
        StringTokenizer tokens = new StringTokenizer(p.getValue(), ",");
        choices = new String[tokens.countTokens()];
        for (int i = 0; tokens.hasMoreTokens(); i++) {
            choices[i] = tokens.nextToken();
        }
    }

    return new SetItemsPerPageAction(owner, handle, choices, toScreen);

}

From source file:net.unicon.academus.apps.briefcase.engine.ShowFolderAction.java

License:Open Source License

public static IAction parse(Element e, IWarlockFactory owner) throws WarlockException {

    // Assertions.
    if (e == null) {
        String msg = "Argument 'e [Element]' cannot be null.";
        throw new IllegalArgumentException(msg);
    }/*from  w  w  w  .  j a  va2 s .co  m*/
    if (!e.getName().equals("action")) {
        String msg = "Argument 'e [Element]' must be an <action> element.";
        throw new IllegalArgumentException(msg);
    }
    if (owner == null) {
        String msg = "Argument 'owner+' cannot be null.";
        throw new IllegalArgumentException(msg);
    }

    // Handle.
    Attribute h = e.attribute("handle");
    if (h == null) {
        String msg = "Element <action> is missing required attribute " + "'handle'.";
        throw new XmlFormatException(msg);
    }
    Handle handle = Handle.create(h.getValue());

    // Choices.
    String[] choices = new String[0];
    Attribute p = e.attribute("inpt");
    if (p != null) {
        StringTokenizer tokens = new StringTokenizer(p.getValue(), ",");
        choices = new String[tokens.countTokens()];
        for (int i = 0; tokens.hasMoreTokens(); i++) {
            choices[i] = tokens.nextToken();
        }
    }

    return new ShowFolderAction(owner, handle, choices);

}