001package org.galaxyproject.gxformat2.v19_09; 002 003import org.galaxyproject.gxformat2.v19_09.utils.LoaderInstances; 004import org.galaxyproject.gxformat2.v19_09.utils.LoadingOptions; 005import org.galaxyproject.gxformat2.v19_09.utils.LoadingOptionsBuilder; 006import org.galaxyproject.gxformat2.v19_09.utils.SavableImpl; 007import org.galaxyproject.gxformat2.v19_09.utils.ValidationException; 008 009/** 010 * Auto-generated class implementation for 011 * <I>https://galaxyproject.org/gxformat2/v19_09#GalaxyWorkflow</I><br> 012 * 013 * <BLOCKQUOTE> 014 * 015 * A Galaxy workflow description. This record corresponds to the description of a workflow that 016 * should be executable on a Galaxy server that includes the contained tool definitions. 017 * 018 * <p>The workflows API or the user interface of Galaxy instances that are of version 19.09 or newer 019 * should be able to import a document defining this record. 020 * 021 * <p>## A note about `label` field. 022 * 023 * <p>This is the name of the workflow in the Galaxy user interface. This is the mechanism that 024 * users will primarily identify the workflow using. Legacy support - this may also be called 'name' 025 * and Galaxy will consume the workflow document fine and treat this attribute correctly - however 026 * in order to validate against this workflow definition schema the attribute should be called 027 * `label`. 028 * 029 * </BLOCKQUOTE> 030 */ 031public class GalaxyWorkflowImpl extends SavableImpl implements GalaxyWorkflow { 032 private LoadingOptions loadingOptions_ = new LoadingOptionsBuilder().build(); 033 private java.util.Map<String, Object> extensionFields_ = new java.util.HashMap<String, Object>(); 034 035 private java.util.Optional<String> id; 036 037 /** 038 * Getter for property <I>https://w3id.org/cwl/cwl#Identified/id</I><br> 039 * 040 * <BLOCKQUOTE> 041 * 042 * The unique identifier for this object. * 043 * 044 * </BLOCKQUOTE> 045 */ 046 public java.util.Optional<String> getId() { 047 return this.id; 048 } 049 050 private java.util.Optional<String> label; 051 052 /** 053 * Getter for property <I>https://w3id.org/cwl/cwl#Labeled/label</I><br> 054 * 055 * <BLOCKQUOTE> 056 * 057 * A short, human-readable label of this object. * 058 * 059 * </BLOCKQUOTE> 060 */ 061 public java.util.Optional<String> getLabel() { 062 return this.label; 063 } 064 065 private Object doc; 066 067 /** 068 * Getter for property <I>https://w3id.org/cwl/salad#Documented/doc</I><br> 069 * 070 * <BLOCKQUOTE> 071 * 072 * A documentation string for this object, or an array of strings which should be concatenated. * 073 * 074 * </BLOCKQUOTE> 075 */ 076 public Object getDoc() { 077 return this.doc; 078 } 079 080 private java.util.List<Object> inputs; 081 082 /** 083 * Getter for property <I>https://w3id.org/cwl/cwl#inputs</I><br> 084 * 085 * <BLOCKQUOTE> 086 * 087 * Defines the input parameters of the process. The process is ready to run when all required 088 * input parameters are associated with concrete values. Input parameters include a schema for 089 * each parameter which is used to validate the input object. It may also be used to build a user 090 * interface for constructing the input object. 091 * 092 * <p>When accepting an input object, all input parameters must have a value. If an input 093 * parameter is missing from the input object, it must be assigned a value of `null` (or the value 094 * of `default` for that parameter, if provided) for the purposes of validation and evaluation of 095 * expressions. * 096 * 097 * </BLOCKQUOTE> 098 */ 099 public java.util.List<Object> getInputs() { 100 return this.inputs; 101 } 102 103 private java.util.List<Object> outputs; 104 105 /** 106 * Getter for property <I>https://w3id.org/cwl/cwl#outputs</I><br> 107 * 108 * <BLOCKQUOTE> 109 * 110 * Defines the parameters representing the output of the process. May be used to generate and/or 111 * validate the output object. * 112 * 113 * </BLOCKQUOTE> 114 */ 115 public java.util.List<Object> getOutputs() { 116 return this.outputs; 117 } 118 119 private java.util.Optional<String> uuid; 120 121 /** 122 * Getter for property <I>https://galaxyproject.org/gxformat2/gxformat2common#HasUUID/uuid</I><br> 123 * 124 * <BLOCKQUOTE> 125 * 126 * UUID uniquely representing this element. * 127 * 128 * </BLOCKQUOTE> 129 */ 130 public java.util.Optional<String> getUuid() { 131 return this.uuid; 132 } 133 134 private String class_; 135 136 /** 137 * Getter for property <I>https://galaxyproject.org/gxformat2/v19_09#GalaxyWorkflow/class</I><br> 138 */ 139 public String getClass_() { 140 return this.class_; 141 } 142 143 private java.util.List<Object> steps; 144 145 /** 146 * Getter for property <I>https://galaxyproject.org/gxformat2/v19_09#GalaxyWorkflow/steps</I><br> 147 * 148 * <BLOCKQUOTE> 149 * 150 * The individual steps that make up the workflow. Each step is executed when all of its input 151 * data links are fulfilled. * 152 * 153 * </BLOCKQUOTE> 154 */ 155 public java.util.List<Object> getSteps() { 156 return this.steps; 157 } 158 159 private java.util.Optional<Report> report; 160 161 /** 162 * Getter for property <I>https://galaxyproject.org/gxformat2/v19_09#GalaxyWorkflow/report</I><br> 163 * 164 * <BLOCKQUOTE> 165 * 166 * Workflow invocation report template. * 167 * 168 * </BLOCKQUOTE> 169 */ 170 public java.util.Optional<Report> getReport() { 171 return this.report; 172 } 173 174 /** 175 * Used by {@link org.galaxyproject.gxformat2.v19_09.utils.RootLoader} to construct instances of 176 * GalaxyWorkflowImpl. 177 * 178 * @param __doc_ Document fragment to load this record object from (presumably a {@link 179 * java.util.Map}). 180 * @param __baseUri_ Base URI to generate child document IDs against. 181 * @param __loadingOptions Context for loading URIs and populating objects. 182 * @param __docRoot_ ID at this position in the document (if available) (maybe?) 183 * @throws ValidationException If the document fragment is not a {@link java.util.Map} or 184 * validation of fields fails. 185 */ 186 public GalaxyWorkflowImpl( 187 final Object __doc_, 188 final String __baseUri_, 189 LoadingOptions __loadingOptions, 190 final String __docRoot_) { 191 super(__doc_, __baseUri_, __loadingOptions, __docRoot_); 192 // Prefix plumbing variables with '__' to reduce likelihood of collision with 193 // generated names. 194 String __baseUri = __baseUri_; 195 String __docRoot = __docRoot_; 196 if (!(__doc_ instanceof java.util.Map)) { 197 throw new ValidationException("GalaxyWorkflowImpl called on non-map"); 198 } 199 final java.util.Map<String, Object> __doc = (java.util.Map<String, Object>) __doc_; 200 final java.util.List<ValidationException> __errors = 201 new java.util.ArrayList<ValidationException>(); 202 if (__loadingOptions != null) { 203 this.loadingOptions_ = __loadingOptions; 204 } 205 java.util.Optional<String> id; 206 207 if (__doc.containsKey("id")) { 208 try { 209 id = 210 LoaderInstances.uri_optional_StringInstance_True_False_None.loadField( 211 __doc.get("id"), __baseUri, __loadingOptions); 212 } catch (ValidationException e) { 213 id = null; // won't be used but prevents compiler from complaining. 214 final String __message = "the `id` field is not valid because:"; 215 __errors.add(new ValidationException(__message, e)); 216 } 217 218 } else { 219 id = null; 220 } 221 222 if (id == null) { 223 if (__docRoot != null) { 224 id = java.util.Optional.of(__docRoot); 225 } else { 226 id = java.util.Optional.of("_:" + java.util.UUID.randomUUID().toString()); 227 } 228 } 229 __baseUri = (String) id.orElse(null); 230 java.util.Optional<String> label; 231 232 if (__doc.containsKey("label")) { 233 try { 234 label = 235 LoaderInstances.optional_StringInstance.loadField( 236 __doc.get("label"), __baseUri, __loadingOptions); 237 } catch (ValidationException e) { 238 label = null; // won't be used but prevents compiler from complaining. 239 final String __message = "the `label` field is not valid because:"; 240 __errors.add(new ValidationException(__message, e)); 241 } 242 243 } else { 244 label = null; 245 } 246 Object doc; 247 248 if (__doc.containsKey("doc")) { 249 try { 250 doc = 251 LoaderInstances.union_of_NullInstance_or_StringInstance_or_array_of_StringInstance 252 .loadField(__doc.get("doc"), __baseUri, __loadingOptions); 253 } catch (ValidationException e) { 254 doc = null; // won't be used but prevents compiler from complaining. 255 final String __message = "the `doc` field is not valid because:"; 256 __errors.add(new ValidationException(__message, e)); 257 } 258 259 } else { 260 doc = null; 261 } 262 java.util.List<Object> inputs; 263 try { 264 inputs = 265 LoaderInstances.idmap_inputs_array_of_WorkflowInputParameter.loadField( 266 __doc.get("inputs"), __baseUri, __loadingOptions); 267 } catch (ValidationException e) { 268 inputs = null; // won't be used but prevents compiler from complaining. 269 final String __message = "the `inputs` field is not valid because:"; 270 __errors.add(new ValidationException(__message, e)); 271 } 272 java.util.List<Object> outputs; 273 try { 274 outputs = 275 LoaderInstances.idmap_outputs_array_of_WorkflowOutputParameter.loadField( 276 __doc.get("outputs"), __baseUri, __loadingOptions); 277 } catch (ValidationException e) { 278 outputs = null; // won't be used but prevents compiler from complaining. 279 final String __message = "the `outputs` field is not valid because:"; 280 __errors.add(new ValidationException(__message, e)); 281 } 282 java.util.Optional<String> uuid; 283 284 if (__doc.containsKey("uuid")) { 285 try { 286 uuid = 287 LoaderInstances.optional_StringInstance.loadField( 288 __doc.get("uuid"), __baseUri, __loadingOptions); 289 } catch (ValidationException e) { 290 uuid = null; // won't be used but prevents compiler from complaining. 291 final String __message = "the `uuid` field is not valid because:"; 292 __errors.add(new ValidationException(__message, e)); 293 } 294 295 } else { 296 uuid = null; 297 } 298 String class_; 299 try { 300 class_ = 301 LoaderInstances.uri_StringInstance_False_True_None.loadField( 302 __doc.get("class"), __baseUri, __loadingOptions); 303 } catch (ValidationException e) { 304 class_ = null; // won't be used but prevents compiler from complaining. 305 final String __message = "the `class` field is not valid because:"; 306 __errors.add(new ValidationException(__message, e)); 307 } 308 java.util.List<Object> steps; 309 try { 310 steps = 311 LoaderInstances.idmap_steps_array_of_WorkflowStep.loadField( 312 __doc.get("steps"), __baseUri, __loadingOptions); 313 } catch (ValidationException e) { 314 steps = null; // won't be used but prevents compiler from complaining. 315 final String __message = "the `steps` field is not valid because:"; 316 __errors.add(new ValidationException(__message, e)); 317 } 318 java.util.Optional<Report> report; 319 320 if (__doc.containsKey("report")) { 321 try { 322 report = 323 LoaderInstances.optional_Report.loadField( 324 __doc.get("report"), __baseUri, __loadingOptions); 325 } catch (ValidationException e) { 326 report = null; // won't be used but prevents compiler from complaining. 327 final String __message = "the `report` field is not valid because:"; 328 __errors.add(new ValidationException(__message, e)); 329 } 330 331 } else { 332 report = null; 333 } 334 if (!__errors.isEmpty()) { 335 throw new ValidationException("Trying 'RecordField'", __errors); 336 } 337 this.id = (java.util.Optional<String>) id; 338 this.label = (java.util.Optional<String>) label; 339 this.doc = (Object) doc; 340 this.inputs = (java.util.List<Object>) inputs; 341 this.outputs = (java.util.List<Object>) outputs; 342 this.uuid = (java.util.Optional<String>) uuid; 343 this.class_ = (String) class_; 344 this.steps = (java.util.List<Object>) steps; 345 this.report = (java.util.Optional<Report>) report; 346 } 347}