001 //$HeadURL: svn+ssh://rbezema@svn.wald.intevation.org/deegree/base/tags/2.1/src/org/deegree/ogcwebservices/sos/XMLFactory.java $
002 /*---------------- FILE HEADER ------------------------------------------
003
004 This file is part of deegree.
005 Copyright (C) 2001-2006 by:
006 EXSE, Department of Geography, University of Bonn
007 http://www.giub.uni-bonn.de/deegree/
008 lat/lon GmbH
009 http://www.lat-lon.de
010
011 This library is free software; you can redistribute it and/or
012 modify it under the terms of the GNU Lesser General Public
013 License as published by the Free Software Foundation; either
014 version 2.1 of the License, or (at your option) any later version.
015
016 This library is distributed in the hope that it will be useful,
017 but WITHOUT ANY WARRANTY; without even the implied warranty of
018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
019 Lesser General Public License for more details.
020
021 You should have received a copy of the GNU Lesser General Public
022 License along with this library; if not, write to the Free Software
023 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
024
025 Contact:
026
027 Andreas Poth
028 lat/lon GmbH
029 Aennchenstraße 19
030 53177 Bonn
031 Germany
032 E-Mail: poth@lat-lon.de
033
034 Prof. Dr. Klaus Greve
035 lat/lon GmbH
036 Aennchenstraße 19
037 53177 Bonn
038 Germany
039 E-Mail: fitzke@lat-lon.de
040
041 ---------------------------------------------------------------------------*/
042 package org.deegree.ogcwebservices.sos;
043
044 import java.net.URI;
045 import java.util.ArrayList;
046
047 import org.deegree.framework.log.ILogger;
048 import org.deegree.framework.log.LoggerFactory;
049 import org.deegree.framework.xml.XMLFragment;
050 import org.deegree.framework.xml.XMLTools;
051 import org.deegree.model.metadata.iso19115.Address;
052 import org.deegree.model.metadata.iso19115.CitedResponsibleParty;
053 import org.deegree.model.metadata.iso19115.ContactInfo;
054 import org.deegree.model.metadata.iso19115.OnlineResource;
055 import org.deegree.model.metadata.iso19115.Phone;
056 import org.deegree.model.metadata.iso19115.RoleCode;
057 import org.deegree.ogcbase.CommonNamespaces;
058 import org.deegree.ogcwebservices.OGCWebServiceException;
059 import org.deegree.ogcwebservices.getcapabilities.OperationsMetadata;
060 import org.deegree.ogcwebservices.getcapabilities.ServiceIdentification;
061 import org.deegree.ogcwebservices.getcapabilities.ServiceProvider;
062 import org.deegree.ogcwebservices.sos.capabilities.CapabilitiesDocument;
063 import org.deegree.ogcwebservices.sos.capabilities.Platform;
064 import org.deegree.ogcwebservices.sos.capabilities.SOSCapabilities;
065 import org.deegree.ogcwebservices.sos.capabilities.Sensor;
066 import org.deegree.ogcwebservices.sos.describeplatform.DescribePlatformResult;
067 import org.deegree.ogcwebservices.sos.describeplatform.PlatformDescriptionDocument;
068 import org.deegree.ogcwebservices.sos.describeplatform.PlatformMetadata;
069 import org.deegree.ogcwebservices.sos.describesensor.DescribeSensorResult;
070 import org.deegree.ogcwebservices.sos.describesensor.SensorDescriptionDocument;
071 import org.deegree.ogcwebservices.sos.describesensor.SensorMetadata;
072 import org.deegree.ogcwebservices.sos.getobservation.GetObservationDocument;
073 import org.deegree.ogcwebservices.sos.getobservation.GetObservationResult;
074 import org.deegree.ogcwebservices.sos.om.Observation;
075 import org.deegree.ogcwebservices.sos.om.ObservationArray;
076 import org.deegree.ogcwebservices.sos.sensorml.BasicResponse;
077 import org.deegree.ogcwebservices.sos.sensorml.Classifier;
078 import org.deegree.ogcwebservices.sos.sensorml.CoordinateReferenceSystem;
079 import org.deegree.ogcwebservices.sos.sensorml.Discussion;
080 import org.deegree.ogcwebservices.sos.sensorml.EngineeringCRS;
081 import org.deegree.ogcwebservices.sos.sensorml.GeoLocation;
082 import org.deegree.ogcwebservices.sos.sensorml.GeoPositionModel;
083 import org.deegree.ogcwebservices.sos.sensorml.GeographicCRS;
084 import org.deegree.ogcwebservices.sos.sensorml.Identifier;
085 import org.deegree.ogcwebservices.sos.sensorml.LocationModel;
086 import org.deegree.ogcwebservices.sos.sensorml.Product;
087 import org.deegree.ogcwebservices.sos.sensorml.ProjectedCRS;
088 import org.deegree.ogcwebservices.sos.sensorml.Quantity;
089 import org.deegree.ogcwebservices.sos.sensorml.Reference;
090 import org.deegree.ogcwebservices.sos.sensorml.ResponseModel;
091 import org.w3c.dom.Document;
092 import org.w3c.dom.Element;
093
094 /**
095 * export data to XML Files
096 *
097 * @author <a href="mailto:mkulbe@lat-lon.de">Matthias Kulbe </a>
098 * @author last edited by: $Author: bezema $
099 *
100 * @version $Revision: 6259 $, $Date: 2007-03-20 10:15:15 +0100 (Di, 20 Mär 2007) $
101 */
102 public class XMLFactory extends org.deegree.owscommon.XMLFactory {
103
104 private static final ILogger LOG = LoggerFactory.getLogger( XMLFactory.class );
105
106 protected static final URI SOSNS = CommonNamespaces.SOSNS;
107
108 protected static final URI DEEGREESOS = CommonNamespaces.DEEGREESOS;
109
110 /**
111 * exports the SCS Capabilities
112 *
113 * @param scsCapabilities
114 * @return
115 * @throws OGCWebServiceException
116 */
117 public static XMLFragment export( SOSCapabilities scsCapabilities )
118 throws OGCWebServiceException {
119
120 try {
121
122 CapabilitiesDocument doc = new CapabilitiesDocument();
123
124 doc.createEmptyDocument();
125
126 Element root = doc.getRootElement();
127 XMLTools.appendNSBinding( root, CommonNamespaces.SOS_PREFIX.toLowerCase(),
128 CommonNamespaces.SOSNS );
129
130 // sets the version
131 root.setAttribute( "version", scsCapabilities.getVersion() );
132
133 // sets the updateSsequence
134 root.setAttribute( "updateSequence", scsCapabilities.getUpdateSequence() );
135
136 // appends the ServiceIdentification
137 ServiceIdentification serviceIdentification = scsCapabilities.getServiceIdentification();
138 if ( serviceIdentification != null ) {
139 appendServiceIdentification( root, serviceIdentification );
140 }
141
142 // appends the ServiceProvider
143 ServiceProvider serviceProvider = scsCapabilities.getServiceProvider();
144 if ( serviceProvider != null ) {
145 appendServiceProvider( root, serviceProvider );
146 }
147
148 // appends the OpertionsMetadata
149 OperationsMetadata operationsMetadata = scsCapabilities.getOperationsMetadata();
150 if ( operationsMetadata != null ) {
151 appendOperationsMetadata( root, operationsMetadata );
152 }
153
154 // appends the PlatformList
155 ArrayList platformList = scsCapabilities.getPlatformList();
156 if ( platformList != null ) {
157 appendPlatformList( root, platformList );
158 }
159
160 // appends the SensorList
161 ArrayList sensorList = scsCapabilities.getSensorList();
162 if ( sensorList != null ) {
163 appendSensorList( root, sensorList );
164 }
165
166 return doc;
167
168 } catch ( Exception e ) {
169 LOG.logError( e.getMessage(), e );
170 throw new OGCWebServiceException( "scs webservice failure" );
171 }
172
173 }
174
175 /**
176 *
177 * @param describePlatformResult
178 * @return
179 * @throws OGCWebServiceException
180 */
181 public static XMLFragment export( DescribePlatformResult describePlatformResult )
182 throws OGCWebServiceException {
183
184 PlatformDescriptionDocument scsDocument = new PlatformDescriptionDocument();
185
186 // erstellt ein leeres Dokument wie in dem Template angegeben
187 try {
188 scsDocument.createEmptyDocument();
189
190 Element root = scsDocument.getRootElement();
191 XMLTools.appendNSBinding( root, CommonNamespaces.GML_PREFIX.toLowerCase(),
192 CommonNamespaces.GMLNS );
193 Document doc = root.getOwnerDocument();
194
195 PlatformMetadata[] platformMetadata = describePlatformResult.getPlatforms();
196
197 for ( int i = 0; i < platformMetadata.length; i++ ) {
198
199 root.appendChild( appendPlatform( platformMetadata[i], doc ) );
200 }
201
202 return scsDocument;
203
204 } catch ( Exception e ) {
205 LOG.logError( e.getMessage(), e );
206 throw new OGCWebServiceException( "sos webservice failure" );
207 }
208 }
209
210 /**
211 *
212 * @param describeSensorResult
213 * @return
214 * @throws OGCWebServiceException
215 */
216 public static XMLFragment export( DescribeSensorResult describeSensorResult )
217 throws OGCWebServiceException {
218
219 try {
220
221 SensorDescriptionDocument scsDocument = new SensorDescriptionDocument();
222
223 scsDocument.createEmptyDocument();
224
225 Element root = scsDocument.getRootElement();
226 XMLTools.appendNSBinding( root, CommonNamespaces.GML_PREFIX.toLowerCase(),
227 CommonNamespaces.GMLNS );
228
229 Document doc = root.getOwnerDocument();
230
231 SensorMetadata[] sensorMetadata = describeSensorResult.getSensors();
232
233 for ( int i = 0; i < sensorMetadata.length; i++ ) {
234 root.appendChild( appendSensor( sensorMetadata[i], doc ) );
235 }
236
237 return scsDocument;
238
239 } catch ( Exception e ) {
240 e.printStackTrace();
241 throw new OGCWebServiceException( "sos webservice failure" );
242 }
243 }
244
245 /**
246 *
247 * @param getObservationResult
248 * @return
249 * @throws OGCWebServiceException
250 */
251 public static XMLFragment export( GetObservationResult getObservationResult )
252 throws OGCWebServiceException {
253
254 GetObservationDocument scsDocument = new GetObservationDocument();
255
256 try {
257 scsDocument.createEmptyDocument();
258
259 Element root = scsDocument.getRootElement();
260 Document doc = root.getOwnerDocument();
261
262 // TODO add boundedBy
263 Element boundedBy = doc.createElement( "gml:boundedBy" );
264 root.appendChild( boundedBy );
265
266 Element leer = doc.createElement( "gml:Null" );
267 boundedBy.appendChild( leer );
268
269 leer.appendChild( doc.createTextNode( "unknown" ) );
270
271 Element observationMembers = doc.createElement( "om:observationMembers" );
272 root.appendChild( observationMembers );
273
274 // add observation
275 appendObservationArrays( getObservationResult.getObservations(), observationMembers,
276 doc );
277
278 return scsDocument;
279
280 } catch ( Exception e ) {
281 LOG.logError( e.getMessage(), e );
282 throw new OGCWebServiceException( "sos webservice failure" );
283 }
284 }
285
286 /**
287 * appends ObservationArrays
288 *
289 * @param observationArrays
290 * @param element
291 * @param doc
292 */
293 private static void appendObservationArrays( ObservationArray[] observationArrays,
294 Element element, Document doc ) {
295 if ( observationArrays == null ) {
296 return;
297 }
298 if ( element == null ) {
299 return;
300 }
301 if ( doc == null ) {
302 return;
303 }
304
305 for ( int i = 0; i < observationArrays.length; i++ ) {
306
307 Element observationArray = doc.createElement( "om:ObservationArray" );
308 element.appendChild( observationArray );
309
310 // TODO add boundedBy
311 Element boundedBy = doc.createElement( "gml:boundedBy" );
312 observationArray.appendChild( boundedBy );
313
314 Element boundingBox = doc.createElement( "gml:boundingBox" );
315 boundedBy.appendChild( boundingBox );
316
317 Element coordMin = doc.createElement( "gml:coord" );
318 boundingBox.appendChild( coordMin );
319
320 Element minX = doc.createElement( "gml:X" );
321 coordMin.appendChild( minX );
322
323 minX.appendChild( doc.createTextNode( ""
324 + observationArrays[i].getBoundedBy().getMin().getX() ) );
325
326 Element minY = doc.createElement( "gml:Y" );
327 coordMin.appendChild( minY );
328
329 minY.appendChild( doc.createTextNode( ""
330 + observationArrays[i].getBoundedBy().getMin().getY() ) );
331
332 Element coordMax = doc.createElement( "gml:coord" );
333 boundingBox.appendChild( coordMax );
334
335 Element maxX = doc.createElement( "gml:X" );
336 coordMax.appendChild( maxX );
337
338 maxX.appendChild( doc.createTextNode( ""
339 + observationArrays[i].getBoundedBy().getMax().getX() ) );
340
341 Element maxY = doc.createElement( "gml:Y" );
342 coordMax.appendChild( maxY );
343
344 maxY.appendChild( doc.createTextNode( ""
345 + observationArrays[i].getBoundedBy().getMax().getY() ) );
346
347 // TODO add using
348 Element using = doc.createElement( "om:using" );
349 observationArray.appendChild( using );
350
351 Element observationMembers = doc.createElement( "om:observationMembers" );
352 observationArray.appendChild( observationMembers );
353
354 appendObservations( observationArrays[i].getObservations(), observationMembers, doc );
355
356 }
357
358 }
359
360 /**
361 * appends Observations
362 *
363 * @param observations
364 * @param element
365 * @param doc
366 */
367 private static void appendObservations( Observation[] observations, Element element,
368 Document doc ) {
369 if ( observations == null ) {
370 return;
371 }
372 if ( element == null ) {
373 return;
374 }
375 if ( doc == null ) {
376 return;
377 }
378
379 for ( int i = 0; i < observations.length; i++ ) {
380
381 Element observation = doc.createElement( "gml:Observation" );
382 element.appendChild( observation );
383
384 // add timeStamp
385 Element timeStamp = doc.createElement( "gml:timeStamp" );
386 observation.appendChild( timeStamp );
387
388 Element timeInstant = doc.createElement( "gml:TimeInstant" );
389 timeStamp.appendChild( timeInstant );
390
391 Element timePosition = doc.createElement( "gml:timePosition" );
392 timeInstant.appendChild( timePosition );
393
394 timePosition.appendChild( doc.createTextNode( observations[i].getTimeStamp() ) );
395
396 // add resultOf
397 Element resultOf = doc.createElement( "gml:resultOf" );
398 observation.appendChild( resultOf );
399
400 Element quantityList = doc.createElement( "gml:QuantityList" );
401 resultOf.appendChild( quantityList );
402
403 String ro = observations[i].getResultOf();
404 if ( ro != null ) {
405 quantityList.appendChild( doc.createTextNode( ro ) );
406 }
407
408 }
409
410 }
411
412 /**
413 * appends a PlatformList used by getCapabilities
414 *
415 * @param root
416 * @param platformList
417 *
418 */
419 private static void appendPlatformList( Element root, ArrayList pl ) {
420
421 if ( pl == null ) {
422 return;
423 }
424
425 // XmlNode nn = new XmlNode(root);
426 // nn.appendDomChild(XmlNode.Element, SCSNS, "sos:PlatformList", null);
427
428 Element element = XMLTools.appendElement( root, SOSNS, "sos:PlatformList" );
429
430 // XmlNode platformListNode = new XmlNode( nn );
431
432 for ( int i = 0; i < pl.size(); i++ ) {
433
434 // XmlNode n = new XmlNode(platformListNode);
435 // n.appendDomChild(XmlNode.Element, SCSNS, "sos:Platform",null);
436 // XmlNode platformNode =new XmlNode( n );
437
438 Element elem = XMLTools.appendElement( element, SOSNS, "sos:Platform" );
439 elem.setAttribute( "Id", ( (Platform) pl.get( i ) ).getId() );
440
441 // platformNode.appendDomChild( XmlNode.Attribute, null, "Id", ""
442 // + ((Platform) pl.get(i)).getId());
443
444 // platformNode.appendDomChild( XmlNode.Attribute, null, "Description",
445 // "" + ((Platform) pl.get(i)).getDescription());
446
447 elem.setAttribute( "Description", ( (Platform) pl.get( i ) ).getDescription() );
448 }
449 }
450
451 /**
452 * appends a sensor list used by getCapabilities
453 *
454 * @param root
455 * @param sensorList
456 *
457 */
458 private static void appendSensorList( Element root, ArrayList sl ) {
459 if ( sl == null ) {
460 return;
461 }
462
463 Element element = XMLTools.appendElement( root, SOSNS, "sos:SensorList" );
464
465 for ( int i = 0; i < sl.size(); i++ ) {
466 Element elem = XMLTools.appendElement( element, SOSNS, "sos:Sensor" );
467 elem.setAttribute( "Id", ( (Sensor) sl.get( i ) ).getId() );
468 elem.setAttribute( "Description", ( (Sensor) sl.get( i ) ).getDescription() );
469
470 }
471 }
472
473 /**
474 * returns a platform element
475 *
476 * @param actPlatform
477 * @param doc
478 * @return a platform element
479 */
480 private static Element appendPlatform( PlatformMetadata actPlatform, Document doc ) {
481
482 if ( actPlatform == null ) {
483 return null;
484 }
485
486 Element platform = doc.createElement( "sml:Platform" );
487
488 appendIdentifiedAs( actPlatform.getIdentifiedAs(), platform, doc );
489
490 appendClassifiedAs( actPlatform.getClassifiedAs(), platform, doc );
491
492 appendAttachedTo( actPlatform, platform, doc );
493
494 appendHasCRS( actPlatform.getHasCRS(), platform, doc );
495
496 appendDescribedBy( actPlatform, platform, doc );
497
498 appendLocatedUsing( actPlatform.getLocatedUsing(), platform, doc );
499
500 appendCarries( actPlatform.getCarries(), platform, doc );
501
502 return platform;
503 }
504
505 /**
506 *
507 * @param actSensor
508 * @param doc
509 * @return
510 */
511 private static Element appendSensor( SensorMetadata actSensor, Document doc ) {
512 if ( actSensor == null ) {
513 return null;
514 }
515
516 Element sensor = doc.createElement( "sml:Sensor" );
517
518 appendIdentifiedAs( actSensor.getIdentifiedAs(), sensor, doc );
519
520 appendClassifiedAs( actSensor.getClassifiedAs(), sensor, doc );
521
522 appendAttachedTo( actSensor, sensor, doc );
523
524 appendHasCRS( actSensor.getHasCRS(), sensor, doc );
525
526 appendDescribedBy( actSensor, sensor, doc );
527
528 appendLocatedUsing( actSensor.getLocatedUsing(), sensor, doc );
529
530 appendMeasures( actSensor.getMeasures(), sensor, doc );
531
532 return sensor;
533 }
534
535 /**
536 * appends a IdentifiedAs Node
537 *
538 * @param actii
539 * blah blah. Cannot be null.
540 * @param element
541 * @param doc
542 */
543 private static void appendIdentifiedAs( Identifier[] actidentifier, Element element,
544 Document doc ) {
545 if ( actidentifier == null ) {
546 return;
547 }
548
549 for ( int i = 0; i < actidentifier.length; i++ ) {
550 int type = actidentifier[i].getIdentifierType();
551
552 Element identifiedAs = doc.createElement( "sml:identifiedAs" );
553 Element identifier = doc.createElement( "sml:Identifier" );
554
555 // is required; no check
556 identifier.appendChild( doc.createTextNode( actidentifier[i].getIdentifierValue() ) );
557
558 // is optional; but type must be checked
559 if ( type == 1 )
560 identifier.setAttribute( "type", "shortName" );
561 if ( type == 2 )
562 identifier.setAttribute( "type", "longName" );
563 if ( type == 3 )
564 identifier.setAttribute( "type", "serialNumber" );
565 if ( type == 4 )
566 identifier.setAttribute( "type", "modelNumber" );
567 if ( type == 5 )
568 identifier.setAttribute( "type", "missionNumber" );
569 if ( type == 6 )
570 identifier.setAttribute( "type", "partNumber" );
571
572 // is optional; check
573 if ( actidentifier[i].getIdentifierCodeSpace() != null )
574 identifier.setAttribute( "codeSpace", actidentifier[i].getIdentifierCodeSpace() );
575
576 identifiedAs.appendChild( identifier );
577 element.appendChild( identifiedAs );
578 }
579
580 }
581
582 /**
583 *
584 * @param object
585 * @param doc
586 * @return
587 */
588 private static void appendAttachedTo( Object object, Element element, Document doc ) {
589
590 // optional; check
591 if ( ( (ComponentMetadata) object ).getAttachedTo() != null ) {
592 Element attachedTo = doc.createElement( "sml:attachedTo" );
593
594 Element component = doc.createElement( "sml:Component" );
595 attachedTo.appendChild( component );
596
597 component.appendChild( doc.createTextNode( ( (ComponentMetadata) object ).getAttachedTo() ) );
598 element.appendChild( attachedTo );
599 }
600 }
601
602 /**
603 *
604 * @param object
605 * @param doc
606 * @return
607 */
608 private static void appendClassifiedAs( Classifier[] actClassifier, Element element,
609 Document doc ) {
610 if ( actClassifier == null ) {
611 return;
612 }
613
614 for ( int i = 0; i < actClassifier.length; i++ ) {
615
616 Element classifiedAs = doc.createElement( "sml:classifiedAs" );
617 Element classifier = doc.createElement( "sml:Classifier" );
618 classifiedAs.appendChild( classifier );
619
620 // required; no check
621 classifier.setAttribute( "type", actClassifier[i].getType() );
622
623 // required; no check
624 classifier.appendChild( doc.createTextNode( actClassifier[i].getValue() ) );
625 // optional; check
626 if ( actClassifier[i].getCodeSpace() != null ) {
627 classifier.setAttribute( "codeSpace", actClassifier[i].getCodeSpace() );
628 }
629
630 element.appendChild( classifiedAs );
631 }
632
633 }
634
635 private static void appendDerivedFrom( ResponseModel[] responseModels, Element element,
636 Document doc ) {
637 if ( responseModels == null ) {
638 return;
639 }
640
641 for ( int i = 0; i < responseModels.length; i++ ) {
642
643 Element derivedFrom = doc.createElement( "sml:derivedFrom" );
644 element.appendChild( derivedFrom );
645
646 Element responseModel = doc.createElement( "sml:ResponseModel" );
647 derivedFrom.appendChild( responseModel );
648
649 // appends identifiedAs
650 appendIdentifiedAs( responseModels[i].getIdentifiedAs(), responseModel, doc );
651
652 // appends classifiedAs
653 appendClassifiedAs( responseModels[i].getClassifiedAs(), responseModel, doc );
654
655 // appends description
656 appendDescription( responseModels[i].getDescription(), responseModel, doc );
657
658 appendUsesParametersFromDerivedFrom( responseModels[i].getUsesParameters(),
659 responseModel, doc );
660
661 }
662
663 }
664
665 /**
666 * appends a hasCRS node
667 *
668 * @param object
669 * @param element
670 * @param doc
671 */
672 private static void appendHasCRS( EngineeringCRS engineeringCRS, Element element, Document doc ) {
673 if ( engineeringCRS == null ) {
674 return;
675 }
676
677 Element hasCRS = doc.createElement( "sml:hasCRS" );
678 element.appendChild( hasCRS );
679 appendEngineeringCRS( engineeringCRS, hasCRS, doc );
680
681 }
682
683 private static void appendEngineeringCRS( EngineeringCRS engineeringCRS, Element element,
684 Document doc ) {
685
686 if ( engineeringCRS == null ) {
687 return;
688 }
689
690 Element engineeringCRSEle = doc.createElement( "gml:EngineeringCRS" );
691 element.appendChild( engineeringCRSEle );
692 Element srsName = doc.createElement( "gml:srsName" );
693
694 srsName.appendChild( doc.createTextNode( engineeringCRS.getSrsName() ) );
695
696 engineeringCRSEle.appendChild( srsName );
697
698 }
699
700 private static void appendCoordinateReferenceSystem( CoordinateReferenceSystem crs,
701 Element element, Document doc ) {
702
703 if ( crs == null ) {
704 return;
705 }
706
707 if ( crs instanceof GeographicCRS ) {
708 Element geographicCRS = doc.createElement( "gml:GeographicCRS" );
709 element.appendChild( geographicCRS );
710 Element srsName = doc.createElement( "gml:srsName" );
711
712 srsName.appendChild( doc.createTextNode( crs.getSrsName() ) );
713
714 geographicCRS.appendChild( srsName );
715 }
716 if ( crs instanceof ProjectedCRS ) {
717 Element projectedCRS = doc.createElement( "gml:ProjectedCRS" );
718 element.appendChild( projectedCRS );
719 Element srsName = doc.createElement( "gml:srsName" );
720
721 srsName.appendChild( doc.createTextNode( crs.getSrsName() ) );
722
723 projectedCRS.appendChild( srsName );
724 }
725
726 }
727
728 /**
729 *
730 * @param object
731 * @param doc
732 * @return
733 */
734 private static void appendDescribedBy( Object object, Element element, Document doc ) {
735
736 if ( ( (ComponentMetadata) object ).getDescribedBy() != null ) {
737 Element describedBy = doc.createElement( "sml:describedBy" );
738
739 Element componentDescription = doc.createElement( "sml:ComponentDescription" );
740 describedBy.appendChild( componentDescription );
741
742 if ( ( ( (ComponentMetadata) object ).getDescribedBy() ).getId() != null ) {
743 componentDescription.setAttribute(
744 "id",
745 ( ( (ComponentMetadata) object ).getDescribedBy() ).getId() );
746 }
747
748 // append description
749 appendDescription(
750 ( ( (ComponentMetadata) object ).getDescribedBy() ).getDescription(),
751 componentDescription, doc );
752
753 // append operatedBy
754 CitedResponsibleParty[] operatedBy = ( ( (ComponentMetadata) object ).getDescribedBy() ).getOperatedBy();
755 for ( int i = 0; i < operatedBy.length; i++ ) {
756 appendOperatedBy( operatedBy[i], componentDescription, doc );
757 }
758
759 // append operatedBy
760 CitedResponsibleParty[] manufactedBy = ( ( (ComponentMetadata) object ).getDescribedBy() ).getManufacturedBy();
761 for ( int i = 0; i < manufactedBy.length; i++ ) {
762 appendManufactedBy( manufactedBy[i], componentDescription, doc );
763 }
764
765 // append operatedBy
766 CitedResponsibleParty[] deployedBy = ( ( (ComponentMetadata) object ).getDescribedBy() ).getDeployedBy();
767 for ( int i = 0; i < deployedBy.length; i++ ) {
768 appendDeployedBy( deployedBy[i], componentDescription, doc );
769 }
770
771 // append reference
772 Reference[] reference = ( ( (ComponentMetadata) object ).getDescribedBy() ).getReference();
773 if ( ( reference != null ) && ( reference.length > 0 ) ) {
774 Element ref = doc.createElement( "sml:reference" );
775 componentDescription.appendChild( ref );
776
777 for ( int i = 0; i < reference.length; i++ ) {
778 if ( reference[i].isOnLineResource() ) {
779
780 appendOnlineResource( reference[i].getOnLineResource(), ref, doc );
781 }
782 if ( reference[i].isCitation() ) {
783
784 }
785 }
786 }
787 element.appendChild( describedBy );
788 }
789
790 }
791
792 private static void appendLocatedUsing( LocationModel[] locatedUsingList, Element element,
793 Document doc ) {
794
795 if ( locatedUsingList == null ) {
796 return;
797 }
798
799 Element locatedUsing = doc.createElement( "sml:locatedUsing" );
800 element.appendChild( locatedUsing );
801
802 // process all locatedUsing objects
803 for ( int i = 0; i < locatedUsingList.length; i++ ) {
804
805 // is GeoPositionModel
806 if ( locatedUsingList[i] instanceof GeoPositionModel ) {
807 Element geoPositionModel = doc.createElement( "sml:GeoPositionModel" );
808 locatedUsing.appendChild( geoPositionModel );
809
810 if ( ( (GeoPositionModel) locatedUsingList[i] ).getId() != null ) {
811 geoPositionModel.setAttribute(
812 "id",
813 ( (GeoPositionModel) locatedUsingList[i] ).getId() );
814 }
815
816 appendIdentifiedAs( ( (GeoPositionModel) locatedUsingList[i] ).getIdentifiedAs(),
817 geoPositionModel, doc );
818
819 appendClassifiedAs( ( (GeoPositionModel) locatedUsingList[i] ).getClassifiedAs(),
820 geoPositionModel, doc );
821
822 appendDescription( ( (GeoPositionModel) locatedUsingList[i] ).getDescription(),
823 geoPositionModel, doc );
824
825 // append sourceCRS
826 Element sourceCRS = doc.createElement( "sml:sourceCRS" );
827 geoPositionModel.appendChild( sourceCRS );
828 appendEngineeringCRS( ( (GeoPositionModel) locatedUsingList[i] ).getSourceCRS(),
829 sourceCRS, doc );
830
831 // append referenceCRS
832 Element referenceCRS = doc.createElement( "sml:referenceCRS" );
833 geoPositionModel.appendChild( referenceCRS );
834 appendCoordinateReferenceSystem(
835 ( (GeoPositionModel) locatedUsingList[i] ).getReferenceCRS(),
836 referenceCRS, doc );
837
838 // append usesParameters
839 appendUsesParametersFromGeoLocation(
840 ( (GeoPositionModel) locatedUsingList[i] ).getUsesParametersObjects(),
841 geoPositionModel, doc );
842
843 }
844 }
845
846 }
847
848 private static void appendUsesParametersFromGeoLocation( Object[] objects, Element element,
849 Document doc ) {
850
851 if ( objects == null ) {
852 return;
853 }
854
855 for ( int i = 0; i < objects.length; i++ ) {
856 // is GeoLocation
857 if ( objects[i] instanceof GeoLocation ) {
858 Element usesParameters = doc.createElement( "sml:usesParameters" );
859 element.appendChild( usesParameters );
860
861 Element geoLocation = doc.createElement( "sml:GeoLocation" );
862 usesParameters.appendChild( geoLocation );
863
864 geoLocation.setAttribute( "id", ( (GeoLocation) objects[i] ).getId() );
865
866 // appends latitude
867 Element latitude = doc.createElement( "sml:latitude" );
868 geoLocation.appendChild( latitude );
869 appendQuantity( ( (GeoLocation) objects[i] ).getLatitude(), latitude, doc );
870
871 // appends longitude
872 Element longitude = doc.createElement( "sml:longitude" );
873 geoLocation.appendChild( longitude );
874 appendQuantity( ( (GeoLocation) objects[i] ).getLongitude(), longitude, doc );
875
876 // appends altitude
877 if ( ( (GeoLocation) objects[i] ).getAltitude() != null ) {
878 Element altitude = doc.createElement( "sml:altitude" );
879 geoLocation.appendChild( altitude );
880 appendQuantity( ( (GeoLocation) objects[i] ).getAltitude(), altitude, doc );
881 }
882
883 // appends trueHeading
884 if ( ( (GeoLocation) objects[i] ).getTrueHeading() != null ) {
885 Element trueHeading = doc.createElement( "sml:trueHeading" );
886 geoLocation.appendChild( trueHeading );
887 appendQuantity( ( (GeoLocation) objects[i] ).getTrueHeading(), trueHeading, doc );
888 }
889
890 // appends speed
891 if ( ( (GeoLocation) objects[i] ).getSpeed() != null ) {
892 Element speed = doc.createElement( "sml:speed" );
893 geoLocation.appendChild( speed );
894 appendQuantity( ( (GeoLocation) objects[i] ).getSpeed(), speed, doc );
895 }
896
897 }
898
899 }
900 }
901
902 private static void appendUsesParametersFromDerivedFrom( Object[] objects, Element element,
903 Document doc ) {
904 if ( objects != null ) {
905 for ( int i = 0; i < objects.length; i++ ) {
906 // is GeoLocation
907 if ( objects[i] instanceof BasicResponse ) {
908 Element usesParameters = doc.createElement( "sml:usesParameters" );
909 element.appendChild( usesParameters );
910
911 Element basicResponse = doc.createElement( "sml:BasicResponse" );
912 usesParameters.appendChild( basicResponse );
913
914 Element resolution = doc.createElement( "sml:resolution" );
915 basicResponse.appendChild( resolution );
916
917 Element typedQuantity = doc.createElement( "sml:TypedQuantity" );
918 resolution.appendChild( typedQuantity );
919
920 typedQuantity.appendChild( doc.createTextNode( ""
921 + ( (BasicResponse) objects[i] ).getResolution().getValue() ) );
922
923 // sets required attrib type
924 typedQuantity.setAttribute(
925 "type",
926 ( (BasicResponse) objects[i] ).getResolution().getType().toString() );
927
928 // sets optional attrib codeSpace
929 if ( ( (BasicResponse) objects[i] ).getResolution().getCodeSpace() != null ) {
930 typedQuantity.setAttribute(
931 "codeSpace",
932 ( (BasicResponse) objects[i] ).getResolution().getCodeSpace().toString() );
933 }
934
935 // sets optional attrib fixed
936 if ( !( (BasicResponse) objects[i] ).getResolution().isFixed() ) {
937 typedQuantity.setAttribute( "fixed", "false" );
938 }
939
940 // sets optional attrib uom
941 if ( ( (BasicResponse) objects[i] ).getResolution().getUom() != null ) {
942 typedQuantity.setAttribute(
943 "uom",
944 ( (BasicResponse) objects[i] ).getResolution().getUom().toString() );
945 }
946
947 // sets optional attrib min
948 if ( !Double.isNaN( ( (BasicResponse) objects[i] ).getResolution().getMin() ) ) {
949 typedQuantity.setAttribute(
950 "min",
951 ""
952 + ( (BasicResponse) objects[i] ).getResolution().getMin() );
953 }
954
955 // sets optional attrib max
956 if ( !Double.isNaN( ( (BasicResponse) objects[i] ).getResolution().getMax() ) ) {
957 typedQuantity.setAttribute(
958 "max",
959 ""
960 + ( (BasicResponse) objects[i] ).getResolution().getMax() );
961 }
962
963 // sets optional attrib id
964 if ( ( (BasicResponse) objects[i] ).getResolution().getId() != null ) {
965 typedQuantity.setAttribute(
966 "id",
967 ( (BasicResponse) objects[i] ).getResolution().getId() );
968 }
969
970 }
971
972 }
973
974 }
975 }
976
977 private static void appendQuantity( Quantity quantity, Element element, Document doc ) {
978
979 if ( quantity == null ) {
980 return;
981 }
982
983 Element quantityEle = doc.createElement( "sml:Quantity" );
984 element.appendChild( quantityEle );
985 quantityEle.appendChild( doc.createTextNode( "" + quantity.getValue() ) );
986
987 // appends uom
988 if ( quantity.getUom() != null ) {
989 quantityEle.setAttribute( "uom", quantity.getUom().toString() );
990 }
991
992 // appends fixed
993 if ( quantity.isFixed() ) {
994 quantityEle.setAttribute( "fixed", "true" );
995 }
996 if ( !quantity.isFixed() ) {
997 quantityEle.setAttribute( "fixed", "false" );
998 }
999
1000 // appends min
1001 if ( !Double.isNaN( quantity.getMin() ) ) {
1002 quantityEle.setAttribute( "min", "" + quantity.getMin() );
1003 }
1004
1005 // appends max
1006 if ( !Double.isNaN( quantity.getMax() ) ) {
1007 quantityEle.setAttribute( "max", "" + quantity.getMax() );
1008 }
1009
1010 }
1011
1012 /**
1013 *
1014 * @param description
1015 * @param element
1016 * @param doc
1017 */
1018 private static void appendDescription( Discussion[] description, Element element, Document doc ) {
1019
1020 if ( description == null ) {
1021 return;
1022 }
1023
1024 for ( int i = 0; i < description.length; i++ ) {
1025
1026 Element desc = doc.createElement( "sml:description" );
1027
1028 desc.appendChild( doc.createTextNode( description[i].getValue() ) );
1029
1030 if ( description[i].getId() != null ) {
1031 desc.setAttribute( "id", description[i].getId() );
1032 }
1033 if ( description[i].getTopic() != null ) {
1034 desc.setAttribute( "topic", description[i].getTopic().toString() );
1035 }
1036 if ( description[i].getCodeSpace() != null ) {
1037 desc.setAttribute( "codeSpace", description[i].getCodeSpace().toString() );
1038
1039 }
1040
1041 element.appendChild( desc );
1042 }
1043
1044 }
1045
1046 /**
1047 *
1048 * @param onlineResource
1049 * @param element
1050 * @param doc
1051 */
1052 private static void appendOnlineResource( OnlineResource onlineResource, Element element,
1053 Document doc ) {
1054
1055 if ( onlineResource == null ) {
1056 return;
1057 }
1058
1059 Element onlineRes = doc.createElement( "iso19115:CI_OnlineResource" );
1060
1061 // append linkage
1062 Element linkage = doc.createElement( "iso19115:linkage" );
1063 linkage.appendChild( doc.createTextNode( onlineResource.getLinkage().getHref().toString() ) );
1064 onlineRes.appendChild( linkage );
1065
1066 // append function
1067 if ( onlineResource.getFunctionCode().getValue() != null ) {
1068 Element function = doc.createElement( "iso19115:function" );
1069 function.appendChild( doc.createTextNode( onlineResource.getFunctionCode().getValue() ) );
1070 onlineRes.appendChild( function );
1071 }
1072
1073 // append protocol
1074 if ( onlineResource.getProtocol() != null ) {
1075 Element protocol = doc.createElement( "iso19115:protocol" );
1076 protocol.appendChild( doc.createTextNode( onlineResource.getProtocol() ) );
1077 onlineRes.appendChild( protocol );
1078 }
1079
1080 // append applicationProfile
1081 if ( onlineResource.getApplicationProfile() != null ) {
1082 Element applicationProfile = doc.createElement( "iso19115:applicationProfile" );
1083 applicationProfile.appendChild( doc.createTextNode( onlineResource.getApplicationProfile() ) );
1084 onlineRes.appendChild( applicationProfile );
1085 }
1086
1087 // append name
1088 if ( onlineResource.getOnlineResourceName() != null ) {
1089 Element name = doc.createElement( "iso19115:name" );
1090 name.appendChild( doc.createTextNode( onlineResource.getOnlineResourceName() ) );
1091 onlineRes.appendChild( name );
1092 }
1093
1094 // append description
1095 if ( onlineResource.getOnlineResourceDescription() != null ) {
1096 Element description = doc.createElement( "iso19115:description" );
1097 description.appendChild( doc.createTextNode( onlineResource.getOnlineResourceDescription() ) );
1098 onlineRes.appendChild( description );
1099 }
1100
1101 element.appendChild( onlineRes );
1102
1103 }
1104
1105 private static void appendOperatedBy( CitedResponsibleParty responsibleParty, Element element,
1106 Document doc ) {
1107
1108 if ( responsibleParty == null ) {
1109 return;
1110 }
1111
1112 Element operatedBy = doc.createElement( "sml:operatedBy" );
1113 element.appendChild( operatedBy );
1114 appendResponsibleParty( responsibleParty, operatedBy, doc );
1115
1116 }
1117
1118 private static void appendManufactedBy( CitedResponsibleParty responsibleParty,
1119 Element element, Document doc ) {
1120
1121 if ( responsibleParty == null ) {
1122 return;
1123 }
1124
1125 Element manufactedBy = doc.createElement( "sml:manufactedBy" );
1126 element.appendChild( manufactedBy );
1127 appendResponsibleParty( responsibleParty, manufactedBy, doc );
1128
1129 }
1130
1131 private static void appendDeployedBy( CitedResponsibleParty responsibleParty, Element element,
1132 Document doc ) {
1133
1134 if ( responsibleParty == null ) {
1135 return;
1136 }
1137
1138 Element deployedBy = doc.createElement( "sml:deployedBy" );
1139 element.appendChild( deployedBy );
1140 appendResponsibleParty( responsibleParty, deployedBy, doc );
1141
1142 }
1143
1144 private static void appendContactInfo( ContactInfo contact, Element element, Document doc ) {
1145
1146 if ( contact == null ) {
1147 return;
1148 }
1149
1150 Element cont = doc.createElement( "iso19115:contactInfo" );
1151 element.appendChild( cont );
1152
1153 if ( contact.getPhone() != null ) {
1154 appendPhone( contact.getPhone(), cont, doc );
1155 }
1156
1157 if ( contact.getAddress() != null ) {
1158 appendAddress( contact.getAddress(), cont, doc );
1159 }
1160
1161 if ( contact.getOnLineResource() != null ) {
1162 appendOnlineResource( contact.getOnLineResource(), cont, doc );
1163 }
1164
1165 if ( contact.getHoursOfService() != null ) {
1166 Element hours = doc.createElement( "iso19115:hoursOfService" );
1167 cont.appendChild( hours );
1168 hours.appendChild( doc.createTextNode( contact.getHoursOfService() ) );
1169 }
1170
1171 if ( contact.getContactInstructions() != null ) {
1172 Element instr = doc.createElement( "iso19115:contactInstructions" );
1173 cont.appendChild( instr );
1174 instr.appendChild( doc.createTextNode( contact.getContactInstructions() ) );
1175 }
1176
1177 }
1178
1179 private static void appendPhone( Phone phone, Element element, Document doc ) {
1180
1181 if ( phone == null ) {
1182 return;
1183 }
1184
1185 Element phoneEle = doc.createElement( "iso19115:phone" );
1186 element.appendChild( phoneEle );
1187
1188 String[] voice = phone.getVoice();
1189 if ( ( voice != null ) && ( voice.length > 0 ) ) {
1190 for ( int i = 0; i < voice.length; i++ ) {
1191 Element actVoice = doc.createElement( "iso19115:voice" );
1192 phoneEle.appendChild( actVoice );
1193 actVoice.appendChild( doc.createTextNode( voice[i] ) );
1194 }
1195 }
1196
1197 String[] fac = phone.getFacsimile();
1198 if ( ( fac != null ) && ( fac.length > 0 ) ) {
1199 for ( int i = 0; i < fac.length; i++ ) {
1200 Element actFac = doc.createElement( "iso19115:facsimile" );
1201 phoneEle.appendChild( actFac );
1202 actFac.appendChild( doc.createTextNode( fac[i] ) );
1203 }
1204 }
1205
1206 }
1207
1208 private static void appendAddress( Address address, Element element, Document doc ) {
1209
1210 if ( address == null ) {
1211 return;
1212 }
1213
1214 Element addr = doc.createElement( "iso19115:address" );
1215 element.appendChild( addr );
1216
1217 if ( address.getCity() != null ) {
1218 Element city = doc.createElement( "iso19115:city" );
1219 addr.appendChild( city );
1220 city.appendChild( doc.createTextNode( address.getCity() ) );
1221 }
1222
1223 if ( address.getAdministrativeArea() != null ) {
1224 Element administrativeArea = doc.createElement( "iso19115:administrativeArea" );
1225 addr.appendChild( administrativeArea );
1226 administrativeArea.appendChild( doc.createTextNode( address.getAdministrativeArea() ) );
1227 }
1228
1229 if ( address.getPostalCode() != null ) {
1230 Element postalCode = doc.createElement( "iso19115:postalCode" );
1231 addr.appendChild( postalCode );
1232 postalCode.appendChild( doc.createTextNode( address.getPostalCode() ) );
1233 }
1234
1235 if ( address.getCountry() != null ) {
1236 Element country = doc.createElement( "iso19115:country" );
1237 addr.appendChild( country );
1238 country.appendChild( doc.createTextNode( address.getCountry() ) );
1239 }
1240
1241 String[] deliveryPoints = address.getDeliveryPoint();
1242 for ( int i = 0; i < deliveryPoints.length; i++ ) {
1243 Element deliveryPoint = doc.createElement( "iso19115:deliveryPoint" );
1244 addr.appendChild( deliveryPoint );
1245 deliveryPoint.appendChild( doc.createTextNode( deliveryPoints[i] ) );
1246 }
1247
1248 String[] electronicMailAddresses = address.getElectronicMailAddress();
1249 for ( int i = 0; i < electronicMailAddresses.length; i++ ) {
1250 Element electronicMailAddress = doc.createElement( "iso19115:electronicMailAddress" );
1251 addr.appendChild( electronicMailAddress );
1252 electronicMailAddress.appendChild( doc.createTextNode( electronicMailAddresses[i] ) );
1253 }
1254
1255 }
1256
1257 private static void appendResponsibleParty( CitedResponsibleParty responsibleParty,
1258 Element element, Document doc ) {
1259
1260 if ( responsibleParty == null ) {
1261 return;
1262 }
1263
1264 Element respParty = doc.createElement( "iso19115:CI_ResponsibleParty" );
1265 element.appendChild( respParty );
1266
1267 // append IndividualName
1268 if ( responsibleParty.getIndividualName() != null ) {
1269 String[] individualNameList = responsibleParty.getIndividualName();
1270 for ( int i = 0; i < individualNameList.length; i++ ) {
1271 Element individualName = doc.createElement( "iso19115:individualName" );
1272 individualName.appendChild( doc.createTextNode( individualNameList[i] ) );
1273 respParty.appendChild( individualName );
1274 }
1275 }
1276
1277 // append OrganisationName
1278 if ( responsibleParty.getOrganisationName() != null ) {
1279 String[] organisationNameList = responsibleParty.getOrganisationName();
1280 for ( int i = 0; i < organisationNameList.length; i++ ) {
1281 Element organisationName = doc.createElement( "iso19115:organisationName" );
1282 organisationName.appendChild( doc.createTextNode( organisationNameList[i] ) );
1283 respParty.appendChild( organisationName );
1284 }
1285 }
1286
1287 // append PositionName
1288 if ( responsibleParty.getPositionName() != null ) {
1289 String[] positionNameList = responsibleParty.getPositionName();
1290 for ( int i = 0; i < positionNameList.length; i++ ) {
1291 Element positionName = doc.createElement( "iso19115:positionName" );
1292 positionName.appendChild( doc.createTextNode( positionNameList[i] ) );
1293 respParty.appendChild( positionName );
1294 }
1295 }
1296
1297 // append Role as codelist
1298
1299 RoleCode[] roleList = responsibleParty.getRoleCode();
1300
1301 for ( int i = 0; i < roleList.length; i++ ) {
1302 if ( roleList[i].getValue() != null ) {
1303 Element role = doc.createElement( "iso19115:role" );
1304 respParty.appendChild( role );
1305 Element codeList = doc.createElement( "iso19115:CI_RoleCode_CodeList" );
1306 role.appendChild( codeList );
1307 codeList.appendChild( doc.createTextNode( roleList[i].getValue() ) );
1308 }
1309 }
1310
1311 // append contact
1312 if ( responsibleParty.getContactInfo() != null ) {
1313 ContactInfo[] contactInfoList = responsibleParty.getContactInfo();
1314 for ( int i = 0; i < contactInfoList.length; i++ ) {
1315 appendContactInfo( contactInfoList[i], respParty, doc );
1316 }
1317
1318 }
1319
1320 }
1321
1322 private static void appendMeasures( Product[] products, Element element, Document doc ) {
1323
1324 if ( products == null ) {
1325 return;
1326 }
1327
1328 for ( int i = 0; i < products.length; i++ ) {
1329
1330 Element measures = doc.createElement( "sml:measures" );
1331 Element product = doc.createElement( "sml:Product" );
1332 if ( products[i].getId() != null ) {
1333 product.setAttribute( "id", products[i].getId() );
1334 }
1335 measures.appendChild( product );
1336
1337 // appends identifiedAs
1338 appendIdentifiedAs( products[i].getIdentifiedAs(), product, doc );
1339
1340 // appends classifiedAs
1341 appendClassifiedAs( products[i].getClassifiedAs(), product, doc );
1342
1343 // appends description
1344 appendDescription( products[i].getDescription(), product, doc );
1345
1346 // appends observable
1347 if ( products[i].getObservable() != null ) {
1348 Element observable = doc.createElement( "sml:observable" );
1349 product.appendChild( observable );
1350 Element phenomenon = doc.createElement( "sml:Phenomenon" );
1351 observable.appendChild( phenomenon );
1352
1353 if ( products[i].getObservable().getId() != null ) {
1354 phenomenon.setAttribute( "id", products[i].getObservable().getId() );
1355 }
1356
1357 if ( products[i].getObservable().getName() != null ) {
1358 Element name = doc.createElement( "sml:name" );
1359 phenomenon.appendChild( name );
1360 name.appendChild( doc.createTextNode( products[i].getObservable().getName() ) );
1361 }
1362
1363 if ( products[i].getObservable().getDefinition() != null ) {
1364 Element description = doc.createElement( "sml:description" );
1365 phenomenon.appendChild( description );
1366 description.appendChild( doc.createTextNode( products[i].getObservable().getDefinition() ) );
1367 }
1368 }
1369
1370 // appends hasCRS
1371 if ( products[i].getHasCRS() != null ) {
1372 appendHasCRS( products[i].getHasCRS(), product, doc );
1373 }
1374
1375 // appends locatedUsing
1376 if ( products[i].getLocatedUsing() != null ) {
1377 appendLocatedUsing( products[i].getLocatedUsing(), product, doc );
1378 }
1379
1380 appendDerivedFrom( products[i].getDerivedFrom(), product, doc );
1381
1382 element.appendChild( measures );
1383 }
1384
1385 }
1386
1387 private static void appendCarries( String[] asset, Element element, Document doc ) {
1388 if ( asset == null ) {
1389 return;
1390 }
1391
1392 for ( int i = 0; i < asset.length; i++ ) {
1393 Element carries = doc.createElement( "sml:carries" );
1394 element.appendChild( carries );
1395 Element assetEle = doc.createElement( "sml:Asset" );
1396 carries.appendChild( assetEle );
1397 assetEle.appendChild( doc.createTextNode( asset[i] ) );
1398
1399 }
1400
1401 }
1402 }
1403
1404 /***************************************************************************************************
1405 * <code>
1406 Changes to this class. What the people have been up to:
1407
1408 $Log$
1409 Revision 1.18 2007/02/12 11:54:43 wanhoff
1410 fixed Javadoc @return tag and footer
1411
1412 Revision 1.17 2006/08/24 06:42:16 poth
1413 File header corrected
1414
1415 Revision 1.16 2006/08/07 12:12:30 poth
1416 unneccessary type cast removed / Log statements added
1417
1418 Revision 1.15 2006/07/12 16:59:32 poth
1419 required adaptions according to renaming of OnLineResource to OnlineResource
1420
1421 Revision 1.14 2006/07/12 14:46:18 poth
1422 comment footer added
1423
1424 </code>
1425 **************************************************************************************************/