Changeset 466 for tapas/service
- Timestamp:
- 04/04/12 17:17:40 (12 years ago)
- Location:
- tapas/service
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
tapas/service/implementation/com/ether/TapasServiceImpl.java
r451 r466 39 39 final Element request = new Element( "request" ); 40 40 41 42 41 //On crée un nouveau Document JDOM basé sur la racine que l'on vient de créer 43 42 final Document document = new Document( tapas ); 44 43 45 44 //a terme recuperer id tapas via la BDD 46 Long newNum = getNumRequest(); 45 //Long newNum = getNumRequest(); 46 fTapas.setId( "1414" ); 47 47 48 48 final Attribute id = new Attribute( "Id", fTapas.getId() ); … … 58 58 request.setAttribute( idR ); 59 59 60 //final Observatory obs = getObservatoryByName( iRequest.getObservation().getObservatory().getName() );61 60 62 61 // PREFERENCES 63 62 final Element preferences = new Element( "preferences" ); 64 63 65 // Elementformat64 //format 66 65 final Element format = new Element( "format" ); 67 66 //final Attribute validF = new Attribute( "valid", iRequest.getPreference().getFormat().getFirstValue() ); 68 67 final Attribute validF = new Attribute( "valid", "ACII,FITS,NETCDF" ); 69 68 format.setAttribute( validF ); 70 format.setText( iRequest.getPreference().getFormat().getSecondValue() ); 71 69 format.setText( iRequest.getPreference().getFormat().getSecondValue()); 72 70 preferences.addContent( format ); 73 71 74 // Element rayleighExtinction 75 /* final Element rayleighExtinction = new Element( "rayleigh_extinction" ); 76 final Attribute validR = new Attribute( "valid", iRequest.getPreference().getRayleighExtinction().getFirstValue() ); 77 rayleighExtinction.setAttribute( validR ); 78 rayleighExtinction.setText( iRequest.getPreference().getRayleighExtinction().getSecondValue() ); 79 preferences.addContent( rayleighExtinction );*/ 80 72 //rayleighExtinction 73 final Element rayleighExtinction = new Element( "rayleigh_extinction" ); 74 //final Attribute validR = new Attribute( "valid", iRequest.getPreference().getRayleighExtinction().getFirstValue() ); 75 Attribute validR = new Attribute( "valid", "YES,NO" ); 76 rayleighExtinction.setAttribute( validR ); 77 rayleighExtinction.setText( iRequest.getPreference().getRayleighExtinction().getSecondValue()); 78 preferences.addContent( rayleighExtinction ); 79 80 //h2o 81 final Element h2oe = new Element( "h2o_extinction" ); 82 validR = new Attribute( "valid", "YES,NO"); 83 h2oe.setAttribute( validR ); 84 h2oe.setText( iRequest.getPreference().getH2oExtinction().getSecondValue() ); 85 preferences.addContent( h2oe ); 86 87 //o2 88 final Element o2e = new Element( "o2_extinction" ); 89 validR = new Attribute( "valid", "YES,NO"); 90 o2e.setAttribute( validR ); 91 o2e.setText( iRequest.getPreference().getO2Extinction().getSecondValue() ); 92 preferences.addContent( o2e ); 93 94 //o3 95 final Element o3e = new Element( "o3_extinction" ); 96 validR = new Attribute( "valid", "YES,NO"); 97 o3e.setAttribute( validR ); 98 o3e.setText( iRequest.getPreference().getO3Extinction().getSecondValue()); 99 preferences.addContent( o3e ); 100 101 //co2 102 final Element co2e = new Element( "co2_extinction" ); 103 validR = new Attribute( "valid", "YES,NO"); 104 co2e.setAttribute( validR ); 105 co2e.setText( iRequest.getPreference().getCo2Extinction().getSecondValue() ); 106 preferences.addContent( co2e ); 81 107 82 108 request.addContent( preferences ); … … 85 111 //recuperer les coordonnees obervatoire avec requete sql : methode de tapas services -> appel methode couche persistence 86 112 // TapasService 87 88 89 //creer le nome des fichiers input ECMW F + ARLETTY à partir du nom court de l'observatoire 113 //iRequest.getObservation().getDate() 114 final Element observation = new Element( "observation" ); 115 116 // date mesure 117 final Element mdate = new Element( "date" ); 118 mdate.setText( iRequest.getObservation().getDate()); 119 120 observation.addContent( mdate ); 121 122 //observatoire 123 final Element observatory = new Element( "observatory" ); 124 observation.addContent( observatory ); 125 126 final Observatory obs; 127 try 128 { 129 obs = _observatoryDAO.selectByPrimaryKey( iRequest.getObservation().getObservatory().getId() ); 130 } 131 catch( PersistenceException e ) 132 { 133 throw new ServiceException(ServiceException.ServiceCode.OBSERVATORY_NOT_FOUND,e); 134 } 135 136 137 final Element name = new Element( "name" ); 138 name.setText(obs.getName()); 139 observatory.addContent( name ); 140 141 final Element longitude = new Element( "longitude" ); 142 longitude.setText( obs.getLongitude().toString() ); 143 observatory.addContent( longitude ); 144 145 final Element latitude = new Element( "latitude" ); 146 latitude.setText( obs.getLatitude().toString() ); 147 observatory.addContent( latitude ); 148 149 final Element altitude = new Element( "altitude" ); 150 altitude.setText( obs.getAltitude().toString()); 151 observatory.addContent( altitude ); 152 153 154 155 //los 156 final Element los = new Element( "los" ); 157 observation.addContent( los ); 158 159 final Element ra_j2000 = new Element( "ra_j2000" ); 160 ra_j2000.setText( iRequest.getObservation().getLos().getRaJ2000() ); 161 los.addContent( ra_j2000 ); 162 163 final Element dec_j2000 = new Element( "dec_j2000" ); 164 dec_j2000.setText( iRequest.getObservation().getLos().getDecJ2000() ); 165 los.addContent( dec_j2000 ); 166 167 final Element zenith_angle = new Element( "zenith_angle" ); 168 169 Attribute a1 = new Attribute( "min", "0" ); 170 Attribute a2 = new Attribute( "max", "90" ); 171 172 zenith_angle.setAttribute( a1 ); 173 zenith_angle.setAttribute( a2 ); 174 175 zenith_angle.setText( iRequest.getObservation().getLos().getZenithAngle()); 176 177 los.addContent( zenith_angle ); 178 179 180 //instrument 181 final Element instrument = new Element( "instrument" ); 182 observation.addContent( instrument ); 183 184 final Element spectral_choice = new Element( "spectral_choice" ); 185 Attribute a3 = new Attribute( "valid", iRequest.getObservation().getInstrument().getSpectralChoice().getFirstValue()); 186 spectral_choice.setAttribute( a3 ); 187 spectral_choice.setText( iRequest.getObservation().getInstrument().getSpectralChoice().getSecondValue()); 188 instrument.addContent( spectral_choice ); 189 190 191 192 request.addContent( observation ); 193 194 //creer le nom des fichiers input ECMW F + ARLETTY à partir du nom court de l'observatoire 90 195 // + calculer le bonne heure de mesure en fonction de la date demandée : 00 06 12 ou 18h 91 196 //TapasService 92 197 93 94 198 //créer le num de le requete en lisant dans bdd 95 96 199 97 200 tapas.addContent( request ); … … 152 255 @Nullable 153 256 @Transactional(readOnly = true) 154 public Observatory getObservatoryBy Name( @NotNull final String name)155 throws ServiceException 156 { 157 try 158 { 159 return _observatoryDAO.getObservatoryBy Name( name);257 public Observatory getObservatoryById( @NotNull final long id ) 258 throws ServiceException 259 { 260 try 261 { 262 return _observatoryDAO.getObservatoryById( id ); 160 263 } 161 264 catch( PersistenceException e ) -
tapas/service/implementation/service-context.xml
r447 r466 5 5 <bean id="tapasServiceTarget" class="com.ether.TapasServiceImpl" parent="backofficeServiceTarget"> 6 6 <property name="observatoryDAO" ref="refObservatoryDAO"/> 7 <property name="tapasNumRequestDAO" ref="refTapasNumRequestDAO"/>8 7 </bean> 9 8 -
tapas/service/interface/com/ether/TapasService.java
r447 r466 24 24 public List<Observatory> getAllObservatories() throws ServiceException; 25 25 26 public Observatory getObservatoryBy Name(@NotNull final String name) throws ServiceException;26 public Observatory getObservatoryById(@NotNull final long id) throws ServiceException; 27 27 28 28 public Long getNumRequest() throws ServiceException;
Note: See TracChangeset
for help on using the changeset viewer.