Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add SerializableComplexObsHandler interface for form processing methods
- TRUNK-3886(cherry picked from commit 7f2dca6)
- Loading branch information
Showing
5 changed files
with
162 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
api/src/main/java/org/openmrs/obs/SerializableComplexObsHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/** | ||
* The contents of this file are subject to the OpenMRS Public License | ||
* Version 1.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://license.openmrs.org | ||
* | ||
* Software distributed under the License is distributed on an "AS IS" | ||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing rights and limitations | ||
* under the License. | ||
* | ||
* Copyright (C) OpenMRS, LLC. All Rights Reserved. | ||
*/ | ||
package org.openmrs.obs; | ||
|
||
import java.util.Set; | ||
|
||
import org.openmrs.ConceptComplex; | ||
import org.openmrs.FormField; | ||
|
||
/** | ||
* Interface for handling complex obs. Implementing classes are responsible for generating | ||
* {@link FormField}s to embed inside a parent {@link FormField}. When a form is submitted and it | ||
* has a {@link ConceptComplex} associated to an implementing handler class, then the handler's | ||
* serializeFormData method is invoked to perform the serialization of the complex data. | ||
* | ||
* @since 1.10 | ||
*/ | ||
public interface SerializableComplexObsHandler extends ComplexObsHandler { | ||
|
||
/** | ||
* Gets the form fields that should be added to the forms using complex concepts that are | ||
* associated to this handler | ||
* | ||
* @return Set of form fields | ||
*/ | ||
public Set<FormField> getFormFields(); | ||
|
||
/** | ||
* Transforms the incoming data from one format to another. For example, this can be useful if | ||
* the data is to be sent as an hl7 message which doesn't support xml | ||
* | ||
* @param data the data to serialize | ||
* @return the serialized form data | ||
*/ | ||
public String serializeFormData(String data); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
api/src/test/resources/org/openmrs/api/include/ConceptComplex.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<dataset> | ||
<concept concept_id="6043" retired="false" datatype_id="13" class_id="7" is_set="false" creator="1" date_created="2004-08-12 00:00:00.0" uuid="8b68403d-8c7e-4961-8952-2da8f249a156"/> | ||
<concept_complex concept_id="6043" handler="NeigborHandler" /> | ||
<concept_name concept_id="6043" name="NEIGHBOR" locale="en" creator="1" date_created="2004-08-12 00:00:00.0" concept_name_id="2395" voided="0" uuid="9c067348-5bf2-4050-b824-0aa009436ed6" concept_name_type="FULLY_SPECIFIED" locale_preferred="0"/> | ||
</dataset> |