Package org.apache.commons.betwixt

Examples of org.apache.commons.betwixt.TestCollectionMapping2$Element


    private Element handleUnderscore()
        throws IOException
    {
        int ch = nextToken();
        Element el = null;

        if( ch == '_' )
        {
            if( m_isbold )
            {
                el = popElement("b");
            }
            else
            {
                el = pushElement( new Element("b") );
            }
            m_isbold = !m_isbold;
        }
        else
        {
View Full Code Here


     */
    private Element handleApostrophe()
        throws IOException
    {
        int ch = nextToken();
        Element el = null;

        if( ch == '\'' )
        {
            if( m_isitalic )
            {
                el = popElement("i");
            }
            else
            {
                el = pushElement( new Element("i") );
            }
            m_isitalic = !m_isitalic;
        }
        else
        {
View Full Code Here

                m_isPreBlock = isBlock;

                if( isBlock )
                {
                    startBlockLevel();
                    return pushElement( new Element("pre") );
                }

                return pushElement( new Element("span").setAttribute("style","font-family:monospace; white-space:pre;") );
            }

            pushBack( ch2 );

            return pushElement( new Element("tt") );
        }

        pushBack( ch );

        return null;
View Full Code Here

     *         <code>false</code> otherwise
     * @throws JDOMException if elements cannot be parsed correctly
     */
    public boolean isConstrained( String url, Role role ) throws JDOMException
    {
        Element root = m_webxml.getRootElement();
        XPath xpath;
        String selector;

        // Get all constraints that have our URL pattern
        // (Note the crazy j: prefix to denote the 2.4 j2ee schema)
        selector = "//j:web-app/j:security-constraint[j:web-resource-collection/j:url-pattern=\"" + url + "\"]";
        xpath = XPath.newInstance( selector );
        xpath.addNamespace( "j", J2EE_SCHEMA_24_NAMESPACE );
        List<?> constraints = xpath.selectNodes( root );

        // Get all constraints that match our Role pattern
        selector = "//j:web-app/j:security-constraint[j:auth-constraint/j:role-name=\"" + role.getName() + "\"]";
        xpath = XPath.newInstance( selector );
        xpath.addNamespace( "j", J2EE_SCHEMA_24_NAMESPACE );
        List<?> roles = xpath.selectNodes( root );

        // If we can't find either one, we must not be constrained
        if ( constraints.size() == 0 )
        {
            return false;
        }

        // Shortcut: if the role is ALL, we are constrained
        if ( role.equals( Role.ALL ) )
        {
            return true;
        }

        // If no roles, we must not be constrained
        if ( roles.size() == 0 )
        {
            return false;
        }

        // If a constraint is contained in both lists, we must be constrained
        for ( Iterator<?> c = constraints.iterator(); c.hasNext(); )
        {
            Element constraint = (Element)c.next();
            for ( Iterator<?> r = roles.iterator(); r.hasNext(); )
            {
                Element roleConstraint = (Element)r.next();
                if ( constraint.equals( roleConstraint ) )
                {
                    return true;
                }
            }
View Full Code Here

     * @throws JDOMException if elements cannot be parsed correctly
     */
    protected Role[] getRoles( Document webxml ) throws JDOMException
    {
        Set<Role> roles = new HashSet<Role>();
        Element root = webxml.getRootElement();

        // Get roles referred to by constraints
        String selector = "//j:web-app/j:security-constraint/j:auth-constraint/j:role-name";
        XPath xpath = XPath.newInstance( selector );
        xpath.addNamespace( "j", J2EE_SCHEMA_24_NAMESPACE );
View Full Code Here

          String versionOverride = System.getProperty("version.override");
            if (versionOverride != null) {
                getLog().info("changing version of pom file and save it to target/pom.xml");
                SAXBuilder builder = new SAXBuilder();
                Document doc = builder.build(pomFile);
                Element versionElem = findElement(doc.getRootElement().getChildren(), "version");
                if (versionElem == null) {
                 
                  //version inherited from parent, so get it from there
                  Element parentElem = findElement(doc.getRootElement().getChildren(), "parent");
                  versionElem = findElement(parentElem.getChildren(), "version");
                }
               
                versionElem.setText(versionOverride);
                File targetDir = new File(pomFile.getParent() + "/target");
                if (!targetDir.exists()) {
View Full Code Here

        } catch (Exception e) {
         
              e.printStackTrace();

        }
        Element raiz = doc.getRootElement();
        return raiz;
       
  }
View Full Code Here

  public boolean importarArquivo(String path){
    if(path.substring(path.length()-5).equals(".cody")){
     
      Arquivo abrirArquivo = new Arquivo(path);
      this.setArquivoAberto(path);
      Element raiz = abrirArquivo.importarArquivoXML();
     
      List<Element> listaDeFilhosRaiz =  raiz.getChildren();
      String nomeInst, cnpjInst, tipoInst;
     
      Element nomeInstituicao = listaDeFilhosRaiz.get(0);
      nomeInst = nomeInstituicao.getText();
      listaDeFilhosRaiz.remove(0);
      Element cnpjInstituicao = listaDeFilhosRaiz.get(0);
      cnpjInst = cnpjInstituicao.getText();
      listaDeFilhosRaiz.remove(0);
 
      Element tipoInstituicao = listaDeFilhosRaiz.get(0);
      tipoInst = tipoInstituicao.getText();
      listaDeFilhosRaiz.remove(0);
     
      instituicao = new Instituicao(nomeInst, cnpjInst, tipoInst);
      instituicao.setTurmasXML(listaDeFilhosRaiz);
     
View Full Code Here

  }
 
  public Document getInstituicaoXML(){
    int i;
   
    Element instXML = new Element("instituicao");
    Document doc = new Document(instXML);
   
    Element instNome = new Element("nome");
    instNome.setText(nome);
   
    Element instCnpj = new Element("cnpj");
    instCnpj.setText(formataString(cnpj));
   
    Element instTipo = new Element("tipo");
    instTipo.setText(tipo);
   
    instXML.addContent(instNome);
    instXML.addContent(instCnpj);
    instXML.addContent(instTipo);
   
    if(getNumeroDeTurmas() > 0){
      for(i=0;i<getNumeroDeTurmas();i++){
        Element turmaXML;
        turmaXML = turmas.get(i).exportarTurmaXml();
        instXML.addContent(turmaXML);
      }
    }
   
    Element instHash = new Element("hash");
    instHash.setText(md5Java(this));
    instXML.addContent(instHash);
   
    Element programaVersao = new Element("versao");
    programaVersao.setText(Cody.getInstancia().getVersaoDoSistema());
    instXML.addContent(programaVersao);
   
    return doc;   
  }
View Full Code Here

      }
    }
  }
 
  public Element exportarTesteAptidaoSaudeXML(){
    Element testeXML = new Element("testeAptidaoSaude");

    if((getNumAbdominais() != null) && (!getNumAbdominais().isEmpty())
    && (getNumAbdominais().length() != 0)){
      Element numAbdominaisXML = new Element("numAbdominais");
      numAbdominaisXML.setText(getNumAbdominais());
      testeXML.addContent(numAbdominaisXML);     
    }

    if((getImc() != null) && (!getImc().isEmpty())
    && (getImc().length() != 0)){
      Element imcXML = new Element("imc");
      imcXML.setText(getImc());
      testeXML.addContent(imcXML);   
    }
   
    if( getNoveMinutos() ){
      Element noveMinutosXML = new Element("noveMinutos");
      noveMinutosXML.setText("true");
      testeXML.addContent(noveMinutosXML);
    }else{
      Element noveMinutosXML = new Element("noveMinutos");
      noveMinutosXML.setText("false");
      testeXML.addContent(noveMinutosXML);
    }
   
    if((getSeisMinutos() != null) && (!getSeisMinutos().isEmpty())
    && (getSeisMinutos().length() != 0)){
      Element seisMinutosXML = new Element("seisMinutos");
      seisMinutosXML.setText(getSeisMinutos());
      testeXML.addContent(seisMinutosXML);
    }
   
    return testeXML;
  }
View Full Code Here

TOP

Related Classes of org.apache.commons.betwixt.TestCollectionMapping2$Element

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.