1   /* Copyright 2002-2025 CS GROUP
2    * Licensed to CS GROUP (CS) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * CS licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *   http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.orekit.files.ccsds.ndm.adm;
18  
19  import org.orekit.bodies.CelestialBodies;
20  import org.orekit.bodies.CelestialBody;
21  import org.orekit.files.ccsds.definitions.BodyFacade;
22  import org.orekit.files.ccsds.section.Metadata;
23  
24  /** This class gathers the meta-data present in the Attitude Data Message (ADM).
25   * @author Bryan Cazabonne
26   * @since 10.2
27   */
28  public class AdmMetadata extends Metadata {
29  
30      /** Spacecraft name for which the attitude data are provided. */
31      private String objectName;
32  
33      /** Object identifier of the object for which the attitude data are provided. */
34      private String objectID;
35  
36      /** Body at origin of reference frame. */
37      private BodyFacade center;
38  
39      /** Simple constructor.
40       */
41      public AdmMetadata() {
42          super(null);
43      }
44  
45      /** {@inheritDoc} */
46      @Override
47      public void validate(final double version) {
48          super.validate(version);
49          checkNotNull(objectName, AdmMetadataKey.OBJECT_NAME.name());
50          checkNotNull(objectID,   AdmCommonMetadataKey.OBJECT_ID.name());
51      }
52  
53      /**
54       * Get the spacecraft name for which the attitude data are provided.
55       * @return the spacecraft name
56       */
57      public String getObjectName() {
58          return objectName;
59      }
60  
61      /**
62       * Set the spacecraft name for which the attitude data are provided.
63       * @param objectName the spacecraft name to be set
64       */
65      public void setObjectName(final String objectName) {
66          refuseFurtherComments();
67          this.objectName = objectName;
68      }
69  
70      /**
71       * Get the spacecraft ID for which the attitude data are provided.
72       * @return the spacecraft ID
73       */
74      public String getObjectID() {
75          return objectID;
76      }
77  
78      /**
79       * Set the spacecraft ID for which the attitude data are provided.
80       * @param objectID the spacecraft ID to be set
81       */
82      public void setObjectID(final String objectID) {
83          refuseFurtherComments();
84          this.objectID = objectID;
85      }
86  
87      /** Get the launch year.
88       * @return launch year
89       */
90      public int getLaunchYear() {
91          return getLaunchYear(objectID);
92      }
93  
94      /** Get the launch number.
95       * @return launch number
96       */
97      public int getLaunchNumber() {
98          return getLaunchNumber(objectID);
99      }
100 
101     /** Get the piece of launch.
102      * @return piece of launch
103      */
104     public String getLaunchPiece() {
105         return getLaunchPiece(objectID);
106     }
107 
108     /** Get the body at origin of reference frame.
109      * @return the body at origin of reference frame.
110      */
111     public BodyFacade getCenter() {
112         return center;
113     }
114 
115     /** Set the body at origin of reference frame.
116      * @param center body at origin of reference frame
117      */
118     public void setCenter(final BodyFacade center) {
119         refuseFurtherComments();
120         this.center = center;
121     }
122 
123     /**
124      * Get boolean testing whether the body corresponding to the centerName
125      * attribute can be created through the {@link CelestialBodies}.
126      * @return true if {@link CelestialBody} can be created from centerName
127      *         false otherwise
128      */
129     public boolean getHasCreatableBody() {
130         return center != null && center.getBody() != null;
131     }
132 
133 }