Package com.google.gwt.xml.client

Examples of com.google.gwt.xml.client.NodeList


  /**
   * @param recipient
   * @param permission
   */
  private void addPermission( String recipient, String recipientType, int permission, Document fileInfo ) {
    NodeList aces = fileInfo.getElementsByTagName( ACES_ELEMENT_NAME );
    for ( int i = 0; i < aces.getLength(); i++ ) {
      Element ace = (Element) aces.item( i );
      if ( ace.getElementsByTagName( RECIPIENT_ELEMENT_NAME ).item( 0 ).getFirstChild().getNodeValue().equals(
          recipient ) && ace.getElementsByTagName( RECIPIENT_TYPE_ELEMENT_NAME ).item( 0 ).getFirstChild().getNodeValue().equals(
          recipientType ) ) {
        Element newPerm = fileInfo.createElement( PERMISSIONS_ELEMENT_NAME );
        Text textNode = fileInfo.createTextNode( Integer.toString( permission ) );
View Full Code Here


   * @param type
   * @return list of names of given "type"
   */
  protected List<String> getNames( final Document fileInfo, int type ) {
    List<String> names = new ArrayList<String>();
    NodeList aces = fileInfo.getElementsByTagName( ACES_ELEMENT_NAME );
    for ( int i = 0; i < aces.getLength(); i++ ) {
      Element ace = (Element) aces.item( i );
      NodeList recipientTypeList = ace.getElementsByTagName( RECIPIENT_TYPE_ELEMENT_NAME );
      Node recipientNode = recipientTypeList.item( 0 );
      String nodeValue = recipientNode.getFirstChild().getNodeValue();
      int recipientType = Integer.parseInt( nodeValue );
      if ( recipientType == type ) {
        names.add( ace.getElementsByTagName( RECIPIENT_ELEMENT_NAME ).item( 0 ).getFirstChild().getNodeValue() );
      }
View Full Code Here

   * @param recipient
   * @return
   */
  private List<Integer> getPermissionsForUserOrRole( Document fileInfo, String recipient, String recipientType ) {
    List<Integer> values = new ArrayList<Integer>();
    NodeList aces = fileInfo.getElementsByTagName( ACES_ELEMENT_NAME );
    for ( int i = 0; i < aces.getLength(); i++ ) {
      Element ace = (Element) aces.item( i );
      if ( ace.getElementsByTagName( RECIPIENT_ELEMENT_NAME ).item( 0 ).getFirstChild().getNodeValue().equals(
          recipient ) && ace.getElementsByTagName( RECIPIENT_TYPE_ELEMENT_NAME ).item( 0 ).getFirstChild().getNodeValue().equals(
          recipientType ) ) {
        NodeList permissions = ace.getElementsByTagName( PERMISSIONS_ELEMENT_NAME );
        for ( int j = 0; j < permissions.getLength(); j++ ) {
          if ( permissions.item( j ).getFirstChild() != null ) {
            values.add( new Integer( permissions.item( j ).getFirstChild().getNodeValue() ) );           
          }
        }
        break;
      }
    }
View Full Code Here

    }
    return values;
  }

  private Boolean isModifiableUserOrRole( Document fileInfo, String recipient, String recipientType ) {
    NodeList aces = fileInfo.getElementsByTagName( ACES_ELEMENT_NAME );
    for ( int i = 0; i < aces.getLength(); i++ ) {
      Element ace = (Element) aces.item( i );
      if ( ace.getElementsByTagName( RECIPIENT_ELEMENT_NAME ).item( 0 ).getFirstChild().getNodeValue().equals(
          recipient ) && ace.getElementsByTagName( RECIPIENT_TYPE_ELEMENT_NAME ).item( 0 ).getFirstChild().getNodeValue().equals(
          recipientType ) ) {
        NodeList modifiable = ace.getElementsByTagName( MODIFIABLE_ELEMENT_NAME );
        return modifiable.getLength() > 0 && modifiable.item( 0 ).getFirstChild().getNodeValue().equals( "true" );
      }
    }
    return false;
  }
View Full Code Here

   * @param perm      The integer value of the Permission as defined in <code>RepositoryFilePermissions</code>
   */
  private void updatePermissionForUserOrRole( Document fileInfo, String recipient, String recipientType, boolean grant, int perm ) {
    // first let's see if this node exists
    Node foundPermission = null;
    NodeList aces = fileInfo.getElementsByTagName( ACES_ELEMENT_NAME );
    for ( int i = 0; i < aces.getLength(); i++ ) {
      Element ace = (Element) aces.item( i );
      if ( ace.getElementsByTagName( RECIPIENT_ELEMENT_NAME ).item( 0 ).getFirstChild().getNodeValue().equals(
          recipient ) && ace.getElementsByTagName( RECIPIENT_TYPE_ELEMENT_NAME ).item( 0 ).getFirstChild().getNodeValue().equals(
          recipientType ) ) {
        NodeList permissions = ace.getElementsByTagName( PERMISSIONS_ELEMENT_NAME );
        for ( int j = 0; j < permissions.getLength(); j++ ) {
          Node testNode = permissions.item( j );
          if ( testNode.getFirstChild() != null && Integer.parseInt( testNode.getFirstChild()
              .getNodeValue() ) == perm ) {
            foundPermission = testNode;
            break;
          }
View Full Code Here

  /**
   *
   */
  private void removeAllAces( Document fileInfo ) {
    // Window.alert("removeAllAces() called with: \n" + fileInfo.toString());
    NodeList aces = fileInfo.getElementsByTagName( ACES_ELEMENT_NAME );
    while ( aces != null && aces.getLength() > 0 ) {
      for ( int i = 0; i < aces.getLength(); i++ ) {
        Node ace = aces.item( i );
        ace.getParentNode().removeChild( ace );
      }
      aces = fileInfo.getElementsByTagName( ACES_ELEMENT_NAME );
    }
  }
View Full Code Here

      aces = fileInfo.getElementsByTagName( ACES_ELEMENT_NAME );
    }
  }

  private void replacePermissionsWithAll( Element ace, Document fileInfo ) {
    NodeList perms = ace.getElementsByTagName( PERMISSIONS_ELEMENT_NAME );
    int childCount = perms.getLength();
    for ( int i = 0; i < childCount; i++ ) {
      Node perm = perms.item( i );
      if ( perm != null ) {
        ace.removeChild( perm );
      }
    }
    Element newPerm = fileInfo.createElement( PERMISSIONS_ELEMENT_NAME );
View Full Code Here

  @SuppressWarnings({"unchecked", "rawtypes"})
  public D read(Object loadConfig, Object data) {
    Document doc = XMLParser.parse((String) data);

    NodeList list = doc.getElementsByTagName(modelType.getRecordName());
    ArrayList<ModelData> records = new ArrayList<ModelData>();
    for (int i = 0; i < list.getLength(); i++) {
      Node node = list.item(i);
      Element elem = (Element) node;
      ModelData model = newModelInstance();
      for (int j = 0; j < modelType.getFieldCount(); j++) {
        DataField field = modelType.getField(j);
        Class type = field.getType();
View Full Code Here

  public ArrayList<String> getVariables() {
    return this.variables;
  }
 
  private void storeVariables(Document xmlDoc) throws SparqlParseException, SparqlEmptyException {
    NodeList variables = xmlDoc.getElementsByTagName("variable");
    if (variables.getLength() == 0) {
      throw new SparqlEmptyException("Variables missing from xml");
    }
    for (int i = 0; i < variables.getLength(); i++) {
      Node variable = variables.item(i);
      if (variable == null) {
        throw new SparqlParseException("Variable in head parsed as null");
      }
      String varName = ((Element)variable).getAttribute("name");
      if (varName == null) {
View Full Code Here

  public ArrayList<HashMap<String, HashMap<String, String>>> getBindings() {
    return this.bindings;
  }
 
  private void storeBindings(Document xmlDoc) throws SparqlParseException, SparqlEmptyException {
    NodeList xmlSolutions = xmlDoc.getElementsByTagName("result");
    if (xmlSolutions.getLength() == 0) {
      throw new SparqlEmptyException("No results");
    }
    //Loop through results
    for (int i = 0; i < xmlSolutions.getLength(); i++) {
      bindings.add(getSolutionFromNode(xmlSolutions.item(i)));
    }
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.xml.client.NodeList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.