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.ChangeShareeViewAction.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 ww .  j  av a 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 ChangeShareeViewAction(owner, handle, choices);

}

From source file:net.unicon.academus.apps.briefcase.engine.ChangeUserPrefPageAction.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.  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();
        }
    }

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

    return new ChangeUserPrefPageAction(owner, handle, choices, change, toScreen);

}

From source file:net.unicon.academus.apps.briefcase.engine.CheckPermissionAction.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  va2 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());

    // 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 CheckPermissionAction(owner, handle, choices, toScreen);

}

From source file:net.unicon.academus.apps.briefcase.engine.ConfirmDeleteAction.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  av  a 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 ConfirmDeleteAction(owner, handle, choices);

}

From source file:net.unicon.academus.apps.briefcase.engine.CopyResourcesAction.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   www.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 CopyResourcesAction(owner, handle, choices);

}

From source file:net.unicon.academus.apps.briefcase.engine.CreateUpdateFolderAction.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.  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();
        }
    }

    return new CreateUpdateFolderAction(owner, handle, choices);

}

From source file:net.unicon.academus.apps.briefcase.engine.DeleteResourcesAction.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  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 DeleteResourcesAction(owner, handle, choices);

}

From source file:net.unicon.academus.apps.briefcase.engine.EditPermissionAction.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.ja  v a2  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 EditPermissionAction(owner, handle, choices);

}

From source file:net.unicon.academus.apps.briefcase.engine.EditResourceAction.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 .  ja 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 EditResourceAction(owner, handle, choices);

}

From source file:net.unicon.academus.apps.briefcase.engine.GoBackFolderAction.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 GoBackFolderAction(owner, handle, choices);

}