1 /* 2 * Copyright 2017 the original author or authors. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package org.openehealth.ipf.commons.ihe.hpd.stub.dsmlv2; 17 18 import java.util.ArrayList; 19 import java.util.List; 20 import javax.xml.bind.annotation.*; 21 22 23 /** 24 * <p>Java class for DsmlModification complex type. 25 * 26 * <p>The following schema fragment specifies the expected content contained within this class. 27 * 28 * <pre> 29 * <complexType name="DsmlModification"> 30 * <complexContent> 31 * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> 32 * <sequence> 33 * <element name="value" type="{urn:oasis:names:tc:DSML:2:0:core}DsmlValue" maxOccurs="unbounded" minOccurs="0"/> 34 * </sequence> 35 * <attribute name="name" use="required" type="{urn:oasis:names:tc:DSML:2:0:core}AttributeDescriptionValue" /> 36 * <attribute name="operation" use="required"> 37 * <simpleType> 38 * <restriction base="{http://www.w3.org/2001/XMLSchema}string"> 39 * <enumeration value="add"/> 40 * <enumeration value="delete"/> 41 * <enumeration value="replace"/> 42 * </restriction> 43 * </simpleType> 44 * </attribute> 45 * </restriction> 46 * </complexContent> 47 * </complexType> 48 * </pre> 49 * 50 * 51 */ 52 @XmlAccessorType(XmlAccessType.FIELD) 53 @XmlType(name = "DsmlModification", propOrder = { 54 "value" 55 }) 56 public class DsmlModification { 57 58 @XmlElement(type = String.class) 59 @XmlSchemaType(name = "anySimpleType") 60 protected List<Object> value; 61 @XmlAttribute(name = "name", required = true) 62 protected String name; 63 @XmlAttribute(name = "operation", required = true) 64 protected ModificationOperationType operation; 65 66 /** 67 * Gets the value of the value property. 68 * 69 * <p> 70 * This accessor method returns a reference to the live list, 71 * not a snapshot. Therefore any modification you make to the 72 * returned list will be present inside the JAXB object. 73 * This is why there is not a <CODE>set</CODE> method for the value property. 74 * 75 * <p> 76 * For example, to add a new item, do as follows: 77 * <pre> 78 * getValue().add(newItem); 79 * </pre> 80 * 81 * 82 * <p> 83 * Objects of the following type(s) are allowed in the list 84 * {@link String } 85 * 86 * 87 */ 88 public List<Object> getValue() { 89 if (value == null) { 90 value = new ArrayList<>(); 91 } 92 return this.value; 93 } 94 95 /** 96 * Gets the value of the name property. 97 * 98 * @return 99 * possible object is 100 * {@link String } 101 * 102 */ 103 public String getName() { 104 return name; 105 } 106 107 /** 108 * Sets the value of the name property. 109 * 110 * @param value 111 * allowed object is 112 * {@link String } 113 * 114 */ 115 public void setName(String value) { 116 this.name = value; 117 } 118 119 /** 120 * Gets the value of the operation property. 121 * 122 * @return 123 * possible object is 124 * {@link ModificationOperationType } 125 * 126 */ 127 public ModificationOperationType getOperation() { 128 return operation; 129 } 130 131 /** 132 * Sets the value of the operation property. 133 * 134 * @param value 135 * allowed object is 136 * {@link ModificationOperationType } 137 * 138 */ 139 public void setOperation(ModificationOperationType value) { 140 this.operation = value; 141 } 142 143 144 /** 145 * <p>Java class for null. 146 * 147 * <p>The following schema fragment specifies the expected content contained within this class. 148 * <p> 149 * <pre> 150 * <simpleType> 151 * <restriction base="{http://www.w3.org/2001/XMLSchema}string"> 152 * <enumeration value="add"/> 153 * <enumeration value="delete"/> 154 * <enumeration value="replace"/> 155 * </restriction> 156 * </simpleType> 157 * </pre> 158 * 159 */ 160 @XmlType(name = "") 161 @XmlEnum 162 public enum ModificationOperationType { 163 164 @XmlEnumValue("add") 165 ADD("add"), 166 @XmlEnumValue("delete") 167 DELETE("delete"), 168 @XmlEnumValue("replace") 169 REPLACE("replace"); 170 private final String value; 171 172 ModificationOperationType(String v) { 173 value = v; 174 } 175 176 public String value() { 177 return value; 178 } 179 180 public static ModificationOperationType fromValue(String v) { 181 for (ModificationOperationType c: ModificationOperationType.values()) { 182 if (c.value.equals(v)) { 183 return c; 184 } 185 } 186 throw new IllegalArgumentException(v); 187 } 188 189 } 190 191 }