From f36be04168d019b2e377fd206c3e2787ce7656be Mon Sep 17 00:00:00 2001 From: jamesagnew Date: Wed, 6 Aug 2014 09:05:01 -0400 Subject: [PATCH 1/2] Typo edits --- .../fhir/model/primitive/BaseDateTimeDt.java | 2 +- .../server/security/ISecurityOutcome.java | 20 +++++++++++++++++++ ...enIdConnectBearerTokenSecurityManager.java | 20 +++++++++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/BaseDateTimeDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/BaseDateTimeDt.java index 3be99fc3451..52879b03b1d 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/BaseDateTimeDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/BaseDateTimeDt.java @@ -115,7 +115,7 @@ public abstract class BaseDateTimeDt extends BasePrimitive { return ourYearMonthDayTimeMilliFormat.format(myValue); } } - throw new IllegalStateException("Invalid precition (this is a HAPI bug, shouldn't happen): " + myPrecision); + throw new IllegalStateException("Invalid precision (this is a HAPI bug, shouldn't happen): " + myPrecision); } } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/security/ISecurityOutcome.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/security/ISecurityOutcome.java index 64e223cf15c..14fd15f32b8 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/security/ISecurityOutcome.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/security/ISecurityOutcome.java @@ -1,5 +1,25 @@ package ca.uhn.fhir.rest.server.security; +/* + * #%L + * HAPI FHIR - Core Library + * %% + * Copyright (C) 2014 University Health Network + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + public interface ISecurityOutcome { } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/security/OpenIdConnectBearerTokenSecurityManager.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/security/OpenIdConnectBearerTokenSecurityManager.java index 9c1c971e56f..110fefe1700 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/security/OpenIdConnectBearerTokenSecurityManager.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/security/OpenIdConnectBearerTokenSecurityManager.java @@ -1,5 +1,25 @@ package ca.uhn.fhir.rest.server.security; +/* + * #%L + * HAPI FHIR - Core Library + * %% + * Copyright (C) 2014 University Health Network + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + import java.text.ParseException; import java.util.Date; From deef33317da043ea1b7e1f6c22ba50e7855030c5 Mon Sep 17 00:00:00 2001 From: jamesagnew Date: Thu, 7 Aug 2014 08:27:52 -0400 Subject: [PATCH 2/2] Annotation documentation updates --- hapi-fhir-base/pom.xml | 2 - .../ca/uhn/fhir/context/ModelScanner.java | 21 ++-------- .../uhn/fhir/model/api/annotation/Block.java | 8 ++++ .../uhn/fhir/model/api/annotation/Child.java | 27 +++++++++++++ .../uhn/fhir/model/api/annotation/Choice.java | 36 ----------------- .../model/api/annotation/CodeTableDef.java | 40 ------------------- .../fhir/model/api/annotation/Constraint.java | 37 ----------------- .../model/api/annotation/DatatypeDef.java | 3 ++ .../model/api/annotation/Description.java | 4 ++ .../api/annotation/EnumeratedCodeValue.java | 35 ---------------- .../fhir/model/api/annotation/Extension.java | 31 ++++++++------ .../model/api/annotation/IsIdentifier.java | 34 ---------------- .../model/api/annotation/ResourceDef.java | 9 +++++ .../api/annotation/SearchParamDefinition.java | 12 ++++++ .../model/api/annotation/SimpleSetter.java | 5 ++- .../api => rest}/annotation/TagListParam.java | 5 +-- .../BaseAddOrDeleteTagsMethodBinding.java | 2 +- .../ca/uhn/fhir/rest/method/MethodUtil.java | 2 +- .../ca/uhn/fhir/parser/XmlParserTest.java | 9 +++++ .../uhn/fhir/rest/client/TagsClientTest.java | 2 +- .../uhn/fhir/rest/server/TagsServerTest.java | 2 +- .../org.eclipse.wst.common.component | 2 +- 22 files changed, 103 insertions(+), 225 deletions(-) delete mode 100644 hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Choice.java delete mode 100644 hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/CodeTableDef.java delete mode 100644 hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Constraint.java delete mode 100644 hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/EnumeratedCodeValue.java delete mode 100644 hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/IsIdentifier.java rename hapi-fhir-base/src/main/java/ca/uhn/fhir/{model/api => rest}/annotation/TagListParam.java (87%) diff --git a/hapi-fhir-base/pom.xml b/hapi-fhir-base/pom.xml index 75a0bdf7afa..1752cec613b 100644 --- a/hapi-fhir-base/pom.xml +++ b/hapi-fhir-base/pom.xml @@ -277,7 +277,6 @@ false - org.apache.maven.plugins maven-project-info-reports-plugin diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/ModelScanner.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/ModelScanner.java index a78dd07fe9e..9541129537c 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/ModelScanner.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/ModelScanner.java @@ -20,7 +20,7 @@ package ca.uhn.fhir.context; * #L% */ -import static org.apache.commons.lang3.StringUtils.isBlank; +import static org.apache.commons.lang3.StringUtils.*; import java.io.IOException; import java.io.InputStream; @@ -55,7 +55,6 @@ import ca.uhn.fhir.model.api.IResourceBlock; import ca.uhn.fhir.model.api.IValueSetEnumBinder; import ca.uhn.fhir.model.api.annotation.Block; import ca.uhn.fhir.model.api.annotation.Child; -import ca.uhn.fhir.model.api.annotation.CodeTableDef; import ca.uhn.fhir.model.api.annotation.DatatypeDef; import ca.uhn.fhir.model.api.annotation.Description; import ca.uhn.fhir.model.api.annotation.Extension; @@ -257,16 +256,6 @@ class ModelScanner { } } - CodeTableDef codeTableDefinition = theClass.getAnnotation(CodeTableDef.class); - if (codeTableDefinition != null) { - if (ICodeEnum.class.isAssignableFrom(theClass)) { - @SuppressWarnings("unchecked") - Class resClass = (Class) theClass; - scanCodeTable(resClass, codeTableDefinition); - } else { - throw new ConfigurationException("Type contains a @" + CodeTableDef.class.getSimpleName() + " annotation but does not implement " + ICodeEnum.class.getCanonicalName() + ": " + theClass.getCanonicalName()); - } - } Block blockDefinition = theClass.getAnnotation(Block.class); if (blockDefinition != null) { @@ -279,7 +268,7 @@ class ModelScanner { } } - if (blockDefinition == null && codeTableDefinition == null && datatypeDefinition == null && resourceDefinition == null) { + if (blockDefinition == null && datatypeDefinition == null && resourceDefinition == null) { throw new ConfigurationException("Resource type does not contain any valid HAPI-FHIR annotations: " + theClass.getCanonicalName()); } } @@ -287,8 +276,7 @@ class ModelScanner { private void scanBlock(Class theClass, Block theBlockDefinition) { ourLog.debug("Scanning resource block class: {}", theClass.getName()); - String resourceName = theBlockDefinition.name(); // TODO: remove name - resourceName = theClass.getCanonicalName(); + String resourceName = theClass.getCanonicalName(); if (isBlank(resourceName)) { throw new ConfigurationException("Block type @" + Block.class.getSimpleName() + " annotation contains no name: " + theClass.getCanonicalName()); } @@ -299,9 +287,6 @@ class ModelScanner { scanCompositeElementForChildren(theClass, resourceDef); } - private String scanCodeTable(Class theCodeType, CodeTableDef theCodeTableDefinition) { - return null; // TODO: implement - } private void scanCompositeDatatype(Class theClass, DatatypeDef theDatatypeDefinition) { ourLog.debug("Scanning resource class: {}", theClass.getName()); diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Block.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Block.java index c36fe57efa6..76dcbc7714d 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Block.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Block.java @@ -25,6 +25,14 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +/** + * Class annotation used to indicate a class which is a "block"/"component" type. A block + * is a nested group of fields within a resource definition and can contain other blocks as + * well as data types. + *

+ * An example of a block would be Patient.contact + *

+ */ @Retention(RetentionPolicy.RUNTIME) @Target(value= {ElementType.TYPE}) public @interface Block { diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Child.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Child.java index 4bfbeda865e..ed283831550 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Child.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Child.java @@ -27,6 +27,10 @@ import java.lang.annotation.Target; import ca.uhn.fhir.model.api.IElement; +/** + * Field annotation for fields within resource and datatype definitions, indicating + * a child of that type. + */ @Retention(RetentionPolicy.RUNTIME) @Target(value= {ElementType.FIELD}) public @interface Child { @@ -42,14 +46,37 @@ public @interface Child { */ int MAX_UNLIMITED = -1; + /** + * The name of this field, as it will appear in serialized versions of the message + */ String name(); + /** + * The order in which this field comes within its parent. The first field should have a + * value of 0, the second a value of 1, etc. + */ int order() default ORDER_UNKNOWN; + /** + * The minimum number of repetitions allowed for this child + */ int min() default 0; + /** + * The maximum number of repetitions allowed for this child. Should be + * set to {@link #MAX_UNLIMITED} if there is no limit to the number of + * repetitions. + */ int max() default 1; + /** + * Lists the allowable types for this field, if the field supports multiple + * types (otherwise does not need to be populated). + *

+ * For example, if this field supports either DateTimeDt or BooleanDt types, + * those two classes should be supplied here. + *

+ */ Class[] type() default {}; // Not implemented diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Choice.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Choice.java deleted file mode 100644 index 6784472453a..00000000000 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Choice.java +++ /dev/null @@ -1,36 +0,0 @@ -package ca.uhn.fhir.model.api.annotation; - -/* - * #%L - * HAPI FHIR - Core Library - * %% - * Copyright (C) 2014 University Health Network - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import ca.uhn.fhir.model.api.IElement; - -@Retention(RetentionPolicy.RUNTIME) -@Target(value= {ElementType.FIELD}) -public @interface Choice { - - Class[] types() default {}; - -} diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/CodeTableDef.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/CodeTableDef.java deleted file mode 100644 index dbbb930ccbb..00000000000 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/CodeTableDef.java +++ /dev/null @@ -1,40 +0,0 @@ -package ca.uhn.fhir.model.api.annotation; - -/* - * #%L - * HAPI FHIR - Core Library - * %% - * Copyright (C) 2014 University Health Network - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(value= {ElementType.TYPE}) -public @interface CodeTableDef { - - int tableId(); - - String name(); - - int[] restrictedToSnomedIsA() default {}; - - - -} diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Constraint.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Constraint.java deleted file mode 100644 index b5868d2c1c6..00000000000 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Constraint.java +++ /dev/null @@ -1,37 +0,0 @@ -package ca.uhn.fhir.model.api.annotation; - -/* - * #%L - * HAPI FHIR - Core Library - * %% - * Copyright (C) 2014 University Health Network - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(value= {ElementType.FIELD}) -public @interface Constraint { - - String[] coRequirements() default {}; - - String[] lessThan() default {}; - - String[] greaterThan() default {}; -} diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/DatatypeDef.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/DatatypeDef.java index 31ee559f416..e119e90988a 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/DatatypeDef.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/DatatypeDef.java @@ -28,6 +28,9 @@ import java.lang.annotation.Target; import ca.uhn.fhir.model.primitive.BoundCodeDt; import ca.uhn.fhir.model.primitive.CodeDt; +/** + * Class annotation to note a class which defines a datatype + */ @Retention(RetentionPolicy.RUNTIME) @Target(value= {ElementType.TYPE}) public @interface DatatypeDef { diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Description.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Description.java index 766dc8c9ac9..b173a39b4ae 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Description.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Description.java @@ -25,6 +25,10 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +/** + * Annotation which may be placed on a resource/datatype definition, or a field, or + * a search parameter definition in order to provide documentation for that item. + */ @Retention(RetentionPolicy.RUNTIME) @Target(value= {ElementType.FIELD, ElementType.TYPE, ElementType.PARAMETER, ElementType.METHOD}) public @interface Description { diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/EnumeratedCodeValue.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/EnumeratedCodeValue.java deleted file mode 100644 index 7752f91df32..00000000000 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/EnumeratedCodeValue.java +++ /dev/null @@ -1,35 +0,0 @@ -package ca.uhn.fhir.model.api.annotation; - -/* - * #%L - * HAPI FHIR - Core Library - * %% - * Copyright (C) 2014 University Health Network - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(value= {ElementType.FIELD}) -public @interface EnumeratedCodeValue { - - String value(); - - String system() default ""; -} diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Extension.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Extension.java index de22a20331d..062abf5c97d 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Extension.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Extension.java @@ -25,36 +25,41 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +/** + * Field modifier to be placed on a child field (a field also annotated with the {@link Child} annotation) which + * indicates that this field is an extension. + */ @Target(value = { ElementType.FIELD }) @Retention(RetentionPolicy.RUNTIME) public @interface Extension { /** - * This parameter affects how the extension is treated when the element - * definition containing this resource is exported to a profile. + * This parameter affects how the extension is treated when the element definition containing this resource is + * exported to a profile. * *

- * If set to true, the resource is taken to be a local - * resource and its definition is exported along with the reference. Use - * this option for extension defintions that you have added locally (i.e. - * within your own organization) + * If set to true, the resource is taken to be a local resource and its definition is exported + * along with the reference. Use this option for extension defintions that you have added locally (i.e. within your + * own organization) *

* *

- * If set to false, the resource is taken to be a remote - * resource and its definition is not exported to the profile. Use - * this option for extensions that are defined by other organizations (i.e. + * If set to false, the resource is taken to be a remote resource and its definition is + * not exported to the profile. Use this option for extensions that are defined by other organizations (i.e. * by regional authorities or jurisdictional governments) *

*/ boolean definedLocally(); - + /** - * Returns true if this extension is a - * modifier extension + * Returns true if this extension is a modifier extension */ boolean isModifier(); - + + /** + * The URL associated with this extension + */ String url(); } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/IsIdentifier.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/IsIdentifier.java deleted file mode 100644 index 42634b9a70c..00000000000 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/IsIdentifier.java +++ /dev/null @@ -1,34 +0,0 @@ -package ca.uhn.fhir.model.api.annotation; - -/* - * #%L - * HAPI FHIR - Core Library - * %% - * Copyright (C) 2014 University Health Network - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(value= {ElementType.FIELD}) -public @interface IsIdentifier { - - // nothing - -} diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/ResourceDef.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/ResourceDef.java index c08d7be3101..6d9668de911 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/ResourceDef.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/ResourceDef.java @@ -25,6 +25,9 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +/** + * Class annotation which indicates a resource definition class + */ @Retention(RetentionPolicy.RUNTIME) @Target(value= {ElementType.TYPE}) public @interface ResourceDef { @@ -34,8 +37,14 @@ public @interface ResourceDef { */ String name(); + /** + * Not currently used + */ String id() default ""; + /** + * The URL indicating the profile for this resource definition, if known + */ String profile() default ""; } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/SearchParamDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/SearchParamDefinition.java index 0b06da340fd..1407b4391fc 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/SearchParamDefinition.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/SearchParamDefinition.java @@ -29,12 +29,24 @@ import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) public @interface SearchParamDefinition { + /** + * The name for this parameter + */ String name(); + /** + * The path for this parameter + */ String path(); + /** + * A description of this parameter + */ String description() default ""; + /** + * The type for this parameter, e.g. "string", or "token" + */ String type() default "string"; /** diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/SimpleSetter.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/SimpleSetter.java index 1355e90dd5d..732d98e5eb8 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/SimpleSetter.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/SimpleSetter.java @@ -27,7 +27,10 @@ import java.lang.annotation.Target; /** * Marker annotation for a primitive setter method that can be used to - * indicate a "simple setter" method on a resource or composite type + * indicate a "simple setter" method on a resource or composite type. + * + * This annotation is used by HAPI's code generator and can be ignored by + * client code */ @Retention(RetentionPolicy.RUNTIME) @Target(value= {ElementType.CONSTRUCTOR}) diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/TagListParam.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/annotation/TagListParam.java similarity index 87% rename from hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/TagListParam.java rename to hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/annotation/TagListParam.java index a691bb6ea8f..26122fa3421 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/TagListParam.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/annotation/TagListParam.java @@ -1,4 +1,4 @@ -package ca.uhn.fhir.model.api.annotation; +package ca.uhn.fhir.rest.annotation; /* * #%L @@ -26,9 +26,6 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import ca.uhn.fhir.model.api.TagList; -import ca.uhn.fhir.rest.annotation.AddTags; -import ca.uhn.fhir.rest.annotation.DeleteTags; -import ca.uhn.fhir.rest.annotation.GetTags; /** * Parameter annotation for the {@link TagList} parameter in a {@link GetTags}, diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/BaseAddOrDeleteTagsMethodBinding.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/BaseAddOrDeleteTagsMethodBinding.java index 45c11ee4619..88b07adba5b 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/BaseAddOrDeleteTagsMethodBinding.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/BaseAddOrDeleteTagsMethodBinding.java @@ -33,12 +33,12 @@ import ca.uhn.fhir.context.ConfigurationException; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.TagList; -import ca.uhn.fhir.model.api.annotation.TagListParam; import ca.uhn.fhir.model.dstu.valueset.RestfulOperationSystemEnum; import ca.uhn.fhir.model.dstu.valueset.RestfulOperationTypeEnum; import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.parser.IParser; import ca.uhn.fhir.rest.annotation.IdParam; +import ca.uhn.fhir.rest.annotation.TagListParam; import ca.uhn.fhir.rest.client.BaseHttpClientInvocation; import ca.uhn.fhir.rest.method.SearchMethodBinding.RequestType; import ca.uhn.fhir.rest.server.Constants; diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/MethodUtil.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/MethodUtil.java index d9b8078ac35..aa2b0ca5ddc 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/MethodUtil.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/MethodUtil.java @@ -34,7 +34,6 @@ import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum; import ca.uhn.fhir.model.api.Tag; import ca.uhn.fhir.model.api.TagList; import ca.uhn.fhir.model.api.annotation.Description; -import ca.uhn.fhir.model.api.annotation.TagListParam; import ca.uhn.fhir.model.dstu.resource.OperationOutcome; import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.model.primitive.InstantDt; @@ -48,6 +47,7 @@ import ca.uhn.fhir.rest.annotation.ResourceParam; import ca.uhn.fhir.rest.annotation.ServerBase; import ca.uhn.fhir.rest.annotation.Since; import ca.uhn.fhir.rest.annotation.Sort; +import ca.uhn.fhir.rest.annotation.TagListParam; import ca.uhn.fhir.rest.annotation.TransactionParam; import ca.uhn.fhir.rest.annotation.VersionIdParam; import ca.uhn.fhir.rest.api.MethodOutcome; diff --git a/hapi-fhir-base/src/test/java/ca/uhn/fhir/parser/XmlParserTest.java b/hapi-fhir-base/src/test/java/ca/uhn/fhir/parser/XmlParserTest.java index 4be2dd6fe4c..23de7ea272f 100644 --- a/hapi-fhir-base/src/test/java/ca/uhn/fhir/parser/XmlParserTest.java +++ b/hapi-fhir-base/src/test/java/ca/uhn/fhir/parser/XmlParserTest.java @@ -66,6 +66,15 @@ public class XmlParserTest { private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(XmlParserTest.class); private static FhirContext ourCtx; + + @Test + public void testParseLanguage() { + String input = "
海生
IdentifierURNo
Address99 Houston Road
BENTLEIGH Victoria
Date of birth01 January 1997
"; + Patient pt = ourCtx.newXmlParser().parseResource(Patient.class, input); + + assertEquals("zh-CN", pt.getLanguage().getValue()); + } + @Test public void testEncodeBoundCode() { diff --git a/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/client/TagsClientTest.java b/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/client/TagsClientTest.java index 5a7dde45ff2..a7c322cd567 100644 --- a/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/client/TagsClientTest.java +++ b/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/client/TagsClientTest.java @@ -25,7 +25,6 @@ import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.model.api.Tag; import ca.uhn.fhir.model.api.TagList; -import ca.uhn.fhir.model.api.annotation.TagListParam; import ca.uhn.fhir.model.dstu.resource.Conformance; import ca.uhn.fhir.model.dstu.resource.Patient; import ca.uhn.fhir.model.primitive.IdDt; @@ -33,6 +32,7 @@ import ca.uhn.fhir.rest.annotation.AddTags; import ca.uhn.fhir.rest.annotation.DeleteTags; import ca.uhn.fhir.rest.annotation.GetTags; import ca.uhn.fhir.rest.annotation.IdParam; +import ca.uhn.fhir.rest.annotation.TagListParam; import ca.uhn.fhir.rest.annotation.VersionIdParam; import ca.uhn.fhir.rest.client.api.IBasicClient; import ca.uhn.fhir.rest.server.Constants; diff --git a/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/server/TagsServerTest.java b/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/server/TagsServerTest.java index 08f9fe3854f..d2c9278ad03 100644 --- a/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/server/TagsServerTest.java +++ b/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/server/TagsServerTest.java @@ -25,7 +25,6 @@ import org.junit.Test; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.model.api.Tag; import ca.uhn.fhir.model.api.TagList; -import ca.uhn.fhir.model.api.annotation.TagListParam; import ca.uhn.fhir.model.dstu.resource.Observation; import ca.uhn.fhir.model.dstu.resource.Patient; import ca.uhn.fhir.model.primitive.IdDt; @@ -33,6 +32,7 @@ import ca.uhn.fhir.rest.annotation.AddTags; import ca.uhn.fhir.rest.annotation.DeleteTags; import ca.uhn.fhir.rest.annotation.GetTags; import ca.uhn.fhir.rest.annotation.IdParam; +import ca.uhn.fhir.rest.annotation.TagListParam; import ca.uhn.fhir.rest.annotation.VersionIdParam; import ca.uhn.fhir.testutil.RandomServerPortProvider; diff --git a/restful-server-example/.settings/org.eclipse.wst.common.component b/restful-server-example/.settings/org.eclipse.wst.common.component index 263e87f0f0d..704fec3041b 100644 --- a/restful-server-example/.settings/org.eclipse.wst.common.component +++ b/restful-server-example/.settings/org.eclipse.wst.common.component @@ -6,7 +6,7 @@ uses - + consumes