Package org.jdom2

Examples of org.jdom2.Element


     * @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

    return true;
  }
 
  public Element exportarTurmaXml(){
    int i;
    Element turmaXML = new Element("turma");
   
    Element turmaNome = new Element("nome");
    turmaNome.setText(nome);
   
    Element turmaAno = new Element("ano");
    turmaAno.setText(ano);
   
    turmaXML.addContent(turmaNome);
    turmaXML.addContent(turmaAno);
   
    if(getNumeroDeAlunos() > 0){
      for(i=0;i<getNumeroDeAlunos();i++){
        Element alunoXML;
        alunoXML = alunos.get(i).exportarAlunoXML();
        turmaXML.addContent(alunoXML);
      }
    }
    return turmaXML;
View Full Code Here

      }
    }
  }
 
  public Element exportarTesteAptidaoEsportivaXML(){
    Element testeXML = new Element("testeAptidaoEsportivo");

    if((getArremessoDeMedicineball() != null) && (!getArremessoDeMedicineball().isEmpty())
    && (getArremessoDeMedicineball().length() != 0)){   
      Element arremessoMedicineballXML = new Element("arremessoDeMedicineball");
      arremessoMedicineballXML.setText(getArremessoDeMedicineball());
      testeXML.addContent(arremessoMedicineballXML);
    }
 
    if((getCorridaVinteMetros() != null) && (!getCorridaVinteMetros().isEmpty())
    && (getCorridaVinteMetros().length() != 0)){ 
      Element corridaVinteMetrosXML = new Element("corridaVinteMetros");
      corridaVinteMetrosXML.setText(getCorridaVinteMetros());
      testeXML.addContent(corridaVinteMetrosXML);   
    }

    if((getQuadrado() != null) && (!getQuadrado().isEmpty())
    && (getQuadrado().length() != 0)){
      Element quadradoXML = new Element("quadrado");
      quadradoXML.setText(getQuadrado());
      testeXML.addContent(quadradoXML);   
    }

    if((getSaltoEmDistancia() != null) && (!getSaltoEmDistancia().isEmpty())
    && (getSaltoEmDistancia().length() != 0)){
      Element saltoEmDistanciaXML = new Element("saltoEmDistancia");
      saltoEmDistanciaXML.setText(getSaltoEmDistancia());
      testeXML.addContent(saltoEmDistanciaXML);   
    }

    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

   
     
    for(Element testeTag: listaTestesAlunos){
      nomeTeste = testeTag.getChildText("nome");
      data = testeTag.getChildText("data");
      Element TAS = testeTag.getChild("testeAptidaoSaude");
      Element TAE = testeTag.getChild("testeAptidaoEsportivo");
      Element MC = testeTag.getChild("medidaCrescimento");
     
     
      abdominal = TAS.getChildText("numAbdominais");
      imc = TAS.getChildText("imc");
       
      if("true".equals(TAS.getChildText("noveMinutos"))){
        noveMinutosTAS = true;
      }else{
        noveMinutosTAS = false;
      }
      seisMinutosTAS = TAS.getChildText("seisMinutos");
       
      instTAS = new TesteAptidaoSaude(data, nomeTeste, abdominal, imc, noveMinutosTAS, seisMinutosTAS );
      testAptSaude.add(instTAS);
       
   
      arremessoDeMedicineball = TAE.getChildText("arremessoDeMedicineball");
      corridaVinteMetros = TAE.getChildText("corridaVinteMetros");
      quadrado = TAE.getChildText("quadrado");
      saltoEmDistancia = TAE.getChildText("saltoEmDistancia");
      if("true".equals(TAE.getChildText("noveMinutos")) ){
        noveMinutosTAE = true;
      }else{
        noveMinutosTAE = false;
      }
     
      seisMinutosTAE = TAE.getChildText("seisMinutos");
         
      instTAE = new TesteAptidaoEsportivo(data, nomeTeste, arremessoDeMedicineball, corridaVinteMetros, quadrado, saltoEmDistancia, noveMinutosTAE, seisMinutosTAE);
      testAptEsp.add(instTAE);
       
     
      massaCorporal = MC.getChildText("massaCorporal");
      estatura = MC.getChildText("estatura");
      envergadura = MC.getChildText("envergadura");
         
      instMC = new MedidaCrescimento(data, nomeTeste, massaCorporal, estatura, envergadura);
      medida.add(instMC);
     
    }
View Full Code Here

   
   
 
  public Element exportarAlunoXML(){
    int i;
    Element alunoXML = new Element("aluno");
   
    Element alunoNome = new Element("nome");
    alunoNome.setText(nome);
    alunoXML.addContent(alunoNome);
   
    Element alunoDataNascimento = new Element("dataNascimento");
    alunoDataNascimento.setText(dataNascimento);
    alunoXML.addContent(alunoDataNascimento);
   
    if((nomeMae != null) && (!nomeMae.isEmpty())
    && (nomeMae.length() != 0)){
      Element alunoNomeMae = new Element("nomeMae");
      alunoNomeMae.setText(nomeMae);
      alunoXML.addContent(alunoNomeMae);
    }
   
    if((nomePai != null) && (!nomePai.isEmpty())
    && (nomePai.length() != 0)){
      Element alunoNomePai = new Element("nomePai");
      alunoNomePai.setText(nomePai)
      alunoXML.addContent(alunoNomePai);     
    }
   
    if((endereco != null) && (!endereco.isEmpty()) &&
    (endereco.length() != 0)){
      Element alunoEndereco = new Element("endereco");
      alunoEndereco.setText(endereco)
      alunoXML.addContent(alunoEndereco);
    }
   
    if((registroGeral != null) && (!registroGeral.isEmpty()) &&
    (registroGeral.length() != 0)){
      Element alunoRegistroGeral = new Element("registroGeral");
      alunoRegistroGeral.setText(registroGeral);
      alunoXML.addContent(alunoRegistroGeral);   
    }
   
    if((cadPessoaFisica != null) && (!cadPessoaFisica.isEmpty()) &&
    (nomeMae.length() != 0)){
      Element alunoCadPessoaFisica = new Element("cadPessoaFisica");
      alunoCadPessoaFisica.setText(cadPessoaFisica);
      alunoXML.addContent(alunoCadPessoaFisica);   
    }

    Element alunoGenero = new Element("genero");
    alunoGenero.setText(genero);
    alunoXML.addContent(alunoGenero);
   
    if((testAptSaude.size() == testAptEsp.size()) &&
    (testAptEsp.size() == medida.size())){     
      for(i=0;i<medida.size();i++){
        Element testeXML = new Element("teste");
       
        Element testeNome = new Element("nome");
        testeNome.setText(medida.get(i).getNome());
        testeXML.addContent(testeNome);
       
        Element testeData = new Element("data");
        testeData.setText(medida.get(i).getData());
        testeXML.addContent(testeData);
       
        Element testeAptSaudeXML;
        testeAptSaudeXML = testAptSaude.get(i).exportarTesteAptidaoSaudeXML();
        testeXML.addContent(testeAptSaudeXML);
       
        Element testeAptEsportivoXML;
        testeAptEsportivoXML = testAptEsp.get(i).exportarTesteAptidaoEsportivaXML();
        testeXML.addContent(testeAptEsportivoXML);
       
        Element testeMedidaCrescXML;
        testeMedidaCrescXML = medida.get(i).exportarMedidaCrescimentoXML();
        testeXML.addContent(testeMedidaCrescXML);

        alunoXML.addContent(testeXML);
      }
View Full Code Here

TOP

Related Classes of org.jdom2.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.