Changeset 411 for tapas/service


Ignore:
Timestamp:
03/14/12 17:48:39 (12 years ago)
Author:
rboipsl
Message:

creation 1 form xml

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tapas/service/implementation/com/ether/TapasServiceImpl.java

    r409 r411  
    33import com.ether.dao.ParameterDAO; 
    44import com.ether.dao.PlateformDAO; 
     5import com.ether.tapas.Request; 
    56import com.ether.tapas.Tapas; 
    67import org.apache.commons.logging.Log; 
     
    2728{ 
    2829 
    29     public void createXMLRequest( @NotNull final Tapas tapas ) 
     30    public void createXMLRequest( @NotNull final Tapas fTapas ) 
    3031    { 
    31         String idF = "Ether_TAPAS_0000001"; 
    32         String idRF = "1"; 
    33         String validFF = "ASCII"; 
    34         String validRF = "YES"; 
    3532 
    36         String xvalidFF = "ASCII,FITS,NETCDF"; 
    37         String xvalidRF = "YES,NO"; 
    38         String fichier = "request1.xml"; 
     33        final String fichier = "/home_local/workspace/request1.xml"; 
    3934 
    40         final Element racine = new Element( "tapas" ); 
     35        final Element tapas = new Element( "tapas" ); 
    4136        final Element request = new Element( "request" ); 
    4237        final Element preferences = new Element( "preferences" ); 
     
    4540 
    4641        //On crée un nouveau Document JDOM basé sur la racine que l'on vient de créer 
    47         final Document document = new Document( racine ); 
     42        final Document document = new Document( tapas ); 
    4843 
    49         final Attribute id = new Attribute( "Id", idF ); 
    50         racine.setAttribute( id ); 
     44        final Attribute id = new Attribute( "Id", fTapas.getId() ); 
     45        tapas.setAttribute( id ); 
    5146 
    52         final Attribute idR = new Attribute( "Id", idRF ); 
    53         request.setAttribute( idR ); 
     47        //a terme devient une boucle 
     48        final List<Request> requests = fTapas.getRequests(); 
    5449 
    55         racine.addContent( request ); 
    56         request.addContent( preferences ); 
     50        for( final Request iRequest : requests ) 
     51        { 
     52            final Attribute idR = new Attribute( "Id", iRequest.getId().toString() ); 
     53            request.setAttribute( idR ); 
    5754 
    58         final Attribute validF = new Attribute( "valid", xvalidFF ); 
    59         format.setAttribute( validF ); 
    60         format.setText( validFF ); 
     55            tapas.addContent( request ); 
     56            request.addContent( preferences ); 
    6157 
    62         final Attribute validR = new Attribute( "valid", xvalidRF ); 
    63         rayleighExtinction.setAttribute( validR ); 
    64         rayleighExtinction.setText( validRF ); 
     58            final Attribute validF = new Attribute( "valid", iRequest.getPreference().getFormat().getFirstValue() ); 
     59            format.setAttribute( validF ); 
     60            format.setText( iRequest.getPreference().getFormat().getSecondValue() ); 
     61 
     62            final Attribute validR = new Attribute( "valid", iRequest.getPreference().getRayleighExtinction().getFirstValue() ); 
     63            rayleighExtinction.setAttribute( validR ); 
     64            rayleighExtinction.setText( iRequest.getPreference().getRayleighExtinction().getSecondValue() ); 
     65 
     66        } 
    6567 
    6668        createXMLFile( fichier, document ); 
Note: See TracChangeset for help on using the changeset viewer.