Commit c88fb6a7 authored by thomas's avatar thomas
Browse files

[22205] add observation types boolean and date to findings and templates

parent dd26631c
......@@ -332,6 +332,24 @@ public class Observation
return Optional.empty();
}
@Override
public void setBooleanValue(Boolean value){
Optional<IBaseResource> resource = loadResource();
if (resource.isPresent()) {
accessor.setBooleanValue((DomainResource) resource.get(), value);
saveResource(resource.get());
}
}
@Override
public Optional<Boolean> getBooleanValue(){
Optional<IBaseResource> resource = loadResource();
if (resource.isPresent()) {
return accessor.getBooleanValue((DomainResource) resource.get());
}
return Optional.empty();
}
@Override
public Optional<String> getNumericValueUnit(){
Optional<IBaseResource> resource = loadResource();
......
......@@ -44,6 +44,8 @@ import ch.elexis.core.findings.templates.model.DataType;
import ch.elexis.core.findings.templates.model.FindingsTemplate;
import ch.elexis.core.findings.templates.model.FindingsTemplates;
import ch.elexis.core.findings.templates.model.InputData;
import ch.elexis.core.findings.templates.model.InputDataBoolean;
import ch.elexis.core.findings.templates.model.InputDataDate;
import ch.elexis.core.findings.templates.model.InputDataGroup;
import ch.elexis.core.findings.templates.model.InputDataGroupComponent;
import ch.elexis.core.findings.templates.model.InputDataNumeric;
......@@ -395,7 +397,12 @@ public class FindingsTemplateService implements IFindingsTemplateService {
}
} else if (inputData instanceof InputDataText) {
iObservation.setObservationType(ObservationType.TEXT);
} else if (inputData instanceof InputDataBoolean) {
iObservation.setObservationType(ObservationType.BOOLEAN);
} else if (inputData instanceof InputDataDate) {
iObservation.setObservationType(ObservationType.DATE);
}
return iObservation;
}
......@@ -507,6 +514,10 @@ public class FindingsTemplateService implements IFindingsTemplateService {
return "Numerisch";
case TEXT:
return "Text";
case BOOLEAN:
return "Checkbox";
case DATE:
return "Datum";
default:
return "";
......
......@@ -46,6 +46,8 @@ import ch.elexis.core.findings.templates.model.DataType;
import ch.elexis.core.findings.templates.model.FindingsTemplate;
import ch.elexis.core.findings.templates.model.FindingsTemplates;
import ch.elexis.core.findings.templates.model.InputData;
import ch.elexis.core.findings.templates.model.InputDataBoolean;
import ch.elexis.core.findings.templates.model.InputDataDate;
import ch.elexis.core.findings.templates.model.InputDataGroup;
import ch.elexis.core.findings.templates.model.InputDataGroupComponent;
import ch.elexis.core.findings.templates.model.InputDataNumeric;
......@@ -488,6 +490,18 @@ public class FindingsDetailComposite extends Composite {
: ModelFactory.eINSTANCE.createInputDataText();
selection.setInputData(inputDataText);
break;
case BOOLEAN:
InputDataBoolean inputDataBoolean = selection.getInputData() instanceof InputDataBoolean
? (InputDataBoolean) selection.getInputData()
: ModelFactory.eINSTANCE.createInputDataBoolean();
selection.setInputData(inputDataBoolean);
break;
case DATE:
InputDataDate inputDataDate = selection.getInputData() instanceof InputDataDate
? (InputDataDate) selection.getInputData()
: ModelFactory.eINSTANCE.createInputDataDate();
selection.setInputData(inputDataDate);
break;
default:
break;
}
......@@ -526,17 +540,19 @@ public class FindingsDetailComposite extends Composite {
comboType.setSelection(new StructuredSelection(selection.getType()));
if (selection.getInputData() instanceof InputDataNumeric) {
comboInputData.setSelection(new StructuredSelection(DataType.NUMERIC));
} else if (selection.getInputData() instanceof InputDataText) {
comboInputData.setSelection(new StructuredSelection(DataType.TEXT));
} else if (selection.getInputData() instanceof InputDataGroup) {
comboInputData.setSelection(new StructuredSelection(
((InputDataGroup) selection.getInputData()).getDataType()));
}
else if (selection.getInputData() instanceof InputDataGroupComponent) {
} else if (selection.getInputData() instanceof InputDataGroupComponent) {
comboInputData.setSelection(new StructuredSelection(
((InputDataGroupComponent) selection.getInputData()).getDataType()));
} else if (selection.getInputData() instanceof InputDataDate) {
comboInputData.setSelection(new StructuredSelection(DataType.DATE));
} else if (selection.getInputData() instanceof InputDataBoolean) {
comboInputData.setSelection(new StructuredSelection(DataType.BOOLEAN));
}
if (selection.getColor() != null && StringUtils.isNotBlank(selection.getColor())) {
......
......@@ -22,6 +22,8 @@
<eLiterals name="TEXT" value="100"/>
<eLiterals name="GROUP" value="200" literal="GROUP"/>
<eLiterals name="GROUP_COMPONENT" value="300" literal="GROUP_COMPONENT"/>
<eLiterals name="BOOLEAN" value="10"/>
<eLiterals name="DATE" value="20"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EEnum" name="Type">
<eLiterals name="OBSERVATION_VITAL" value="1" literal="OBSERVATION_VITAL"/>
......@@ -60,4 +62,12 @@
<eStructuralFeatures xsi:type="ecore:EAttribute" name="system" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="display" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="InputDataBoolean" eSuperTypes="#//InputData">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="dataType" eType="#//DataType"
changeable="false" defaultValueLiteral="BOOLEAN"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="InputDataDate" eSuperTypes="#//InputData">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="dataType" eType="#//DataType"
changeable="false" defaultValueLiteral="DATE"/>
</eClassifiers>
</ecore:EPackage>
......@@ -12,6 +12,8 @@
<genEnumLiterals ecoreEnumLiteral="model.ecore#//DataType/TEXT"/>
<genEnumLiterals ecoreEnumLiteral="model.ecore#//DataType/GROUP"/>
<genEnumLiterals ecoreEnumLiteral="model.ecore#//DataType/GROUP_COMPONENT"/>
<genEnumLiterals ecoreEnumLiteral="model.ecore#//DataType/BOOLEAN"/>
<genEnumLiterals ecoreEnumLiteral="model.ecore#//DataType/DATE"/>
</genEnums>
<genEnums typeSafeEnumCompatible="false" ecoreEnum="model.ecore#//Type">
<genEnumLiterals ecoreEnumLiteral="model.ecore#//Type/OBSERVATION_VITAL"/>
......@@ -55,5 +57,11 @@
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute model.ecore#//CodeElement/system"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute model.ecore#//CodeElement/display"/>
</genClasses>
<genClasses ecoreClass="model.ecore#//InputDataBoolean">
<genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute model.ecore#//InputDataBoolean/dataType"/>
</genClasses>
<genClasses ecoreClass="model.ecore#//InputDataDate">
<genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute model.ecore#//InputDataDate/dataType"/>
</genClasses>
</genPackages>
</genmodel:GenModel>
......@@ -54,7 +54,23 @@ public enum DataType implements Enumerator {
* @generated
* @ordered
*/
GROUP_COMPONENT(300, "GROUP_COMPONENT", "GROUP_COMPONENT");
GROUP_COMPONENT(300, "GROUP_COMPONENT", "GROUP_COMPONENT"), /**
* The '<em><b>BOOLEAN</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #BOOLEAN_VALUE
* @generated
* @ordered
*/
BOOLEAN(10, "BOOLEAN", "BOOLEAN"), /**
* The '<em><b>DATE</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #DATE_VALUE
* @generated
* @ordered
*/
DATE(20, "DATE", "DATE");
/**
* The '<em><b>NUMERIC</b></em>' literal value.
......@@ -116,6 +132,28 @@ public enum DataType implements Enumerator {
*/
public static final int GROUP_COMPONENT_VALUE = 300;
/**
* The '<em><b>BOOLEAN</b></em>' literal value.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #BOOLEAN
* @model
* @generated
* @ordered
*/
public static final int BOOLEAN_VALUE = 10;
/**
* The '<em><b>DATE</b></em>' literal value.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #DATE
* @model
* @generated
* @ordered
*/
public static final int DATE_VALUE = 20;
/**
* An array of all the '<em><b>Data Type</b></em>' enumerators.
* <!-- begin-user-doc -->
......@@ -128,6 +166,8 @@ public enum DataType implements Enumerator {
TEXT,
GROUP,
GROUP_COMPONENT,
BOOLEAN,
DATE,
};
/**
......@@ -188,6 +228,8 @@ public enum DataType implements Enumerator {
case TEXT_VALUE: return TEXT;
case GROUP_VALUE: return GROUP;
case GROUP_COMPONENT_VALUE: return GROUP_COMPONENT;
case BOOLEAN_VALUE: return BOOLEAN;
case DATE_VALUE: return DATE;
}
return null;
}
......
/**
*/
package ch.elexis.core.findings.templates.model;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Input Data Boolean</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* </p>
* <ul>
* <li>{@link ch.elexis.core.findings.templates.model.InputDataBoolean#getDataType <em>Data Type</em>}</li>
* </ul>
*
* @see ch.elexis.core.findings.templates.model.ModelPackage#getInputDataBoolean()
* @model
* @generated
*/
public interface InputDataBoolean extends InputData {
/**
* Returns the value of the '<em><b>Data Type</b></em>' attribute.
* The default value is <code>"BOOLEAN"</code>.
* The literals are from the enumeration {@link ch.elexis.core.findings.templates.model.DataType}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Data Type</em>' attribute.
* @see ch.elexis.core.findings.templates.model.DataType
* @see ch.elexis.core.findings.templates.model.ModelPackage#getInputDataBoolean_DataType()
* @model default="BOOLEAN" changeable="false"
* @generated
*/
DataType getDataType();
} // InputDataBoolean
/**
*/
package ch.elexis.core.findings.templates.model;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Input Data Date</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* </p>
* <ul>
* <li>{@link ch.elexis.core.findings.templates.model.InputDataDate#getDataType <em>Data Type</em>}</li>
* </ul>
*
* @see ch.elexis.core.findings.templates.model.ModelPackage#getInputDataDate()
* @model
* @generated
*/
public interface InputDataDate extends InputData {
/**
* Returns the value of the '<em><b>Data Type</b></em>' attribute.
* The default value is <code>"DATE"</code>.
* The literals are from the enumeration {@link ch.elexis.core.findings.templates.model.DataType}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Data Type</em>' attribute.
* @see ch.elexis.core.findings.templates.model.DataType
* @see ch.elexis.core.findings.templates.model.ModelPackage#getInputDataDate_DataType()
* @model default="DATE" changeable="false"
* @generated
*/
DataType getDataType();
} // InputDataDate
......@@ -84,6 +84,24 @@ public interface ModelFactory extends EFactory {
*/
CodeElement createCodeElement();
/**
* Returns a new object of class '<em>Input Data Boolean</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Input Data Boolean</em>'.
* @generated
*/
InputDataBoolean createInputDataBoolean();
/**
* Returns a new object of class '<em>Input Data Date</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Input Data Date</em>'.
* @generated
*/
InputDataDate createInputDataDate();
/**
* Returns the package supported by this factory.
* <!-- begin-user-doc -->
......
......@@ -470,6 +470,80 @@ public interface ModelPackage extends EPackage {
*/
int CODE_ELEMENT_OPERATION_COUNT = 0;
/**
* The meta object id for the '{@link ch.elexis.core.findings.templates.model.impl.InputDataBooleanImpl <em>Input Data Boolean</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see ch.elexis.core.findings.templates.model.impl.InputDataBooleanImpl
* @see ch.elexis.core.findings.templates.model.impl.ModelPackageImpl#getInputDataBoolean()
* @generated
*/
int INPUT_DATA_BOOLEAN = 8;
/**
* The feature id for the '<em><b>Data Type</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int INPUT_DATA_BOOLEAN__DATA_TYPE = INPUT_DATA_FEATURE_COUNT + 0;
/**
* The number of structural features of the '<em>Input Data Boolean</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int INPUT_DATA_BOOLEAN_FEATURE_COUNT = INPUT_DATA_FEATURE_COUNT + 1;
/**
* The number of operations of the '<em>Input Data Boolean</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int INPUT_DATA_BOOLEAN_OPERATION_COUNT = INPUT_DATA_OPERATION_COUNT + 0;
/**
* The meta object id for the '{@link ch.elexis.core.findings.templates.model.impl.InputDataDateImpl <em>Input Data Date</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see ch.elexis.core.findings.templates.model.impl.InputDataDateImpl
* @see ch.elexis.core.findings.templates.model.impl.ModelPackageImpl#getInputDataDate()
* @generated
*/
int INPUT_DATA_DATE = 9;
/**
* The feature id for the '<em><b>Data Type</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int INPUT_DATA_DATE__DATA_TYPE = INPUT_DATA_FEATURE_COUNT + 0;
/**
* The number of structural features of the '<em>Input Data Date</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int INPUT_DATA_DATE_FEATURE_COUNT = INPUT_DATA_FEATURE_COUNT + 1;
/**
* The number of operations of the '<em>Input Data Date</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int INPUT_DATA_DATE_OPERATION_COUNT = INPUT_DATA_OPERATION_COUNT + 0;
/**
* The meta object id for the '{@link ch.elexis.core.findings.templates.model.DataType <em>Data Type</em>}' enum.
* <!-- begin-user-doc -->
......@@ -478,7 +552,7 @@ public interface ModelPackage extends EPackage {
* @see ch.elexis.core.findings.templates.model.impl.ModelPackageImpl#getDataType()
* @generated
*/
int DATA_TYPE = 8;
int DATA_TYPE = 10;
/**
* The meta object id for the '{@link ch.elexis.core.findings.templates.model.Type <em>Type</em>}' enum.
......@@ -488,7 +562,7 @@ public interface ModelPackage extends EPackage {
* @see ch.elexis.core.findings.templates.model.impl.ModelPackageImpl#getType()
* @generated
*/
int TYPE = 9;
int TYPE = 11;
/**
* Returns the meta object for class '{@link ch.elexis.core.findings.templates.model.FindingsTemplates <em>Findings Templates</em>}'.
......@@ -791,6 +865,48 @@ public interface ModelPackage extends EPackage {
*/
EAttribute getCodeElement_Display();
/**
* Returns the meta object for class '{@link ch.elexis.core.findings.templates.model.InputDataBoolean <em>Input Data Boolean</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Input Data Boolean</em>'.
* @see ch.elexis.core.findings.templates.model.InputDataBoolean
* @generated
*/
EClass getInputDataBoolean();
/**
* Returns the meta object for the attribute '{@link ch.elexis.core.findings.templates.model.InputDataBoolean#getDataType <em>Data Type</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Data Type</em>'.
* @see ch.elexis.core.findings.templates.model.InputDataBoolean#getDataType()
* @see #getInputDataBoolean()
* @generated
*/
EAttribute getInputDataBoolean_DataType();
/**
* Returns the meta object for class '{@link ch.elexis.core.findings.templates.model.InputDataDate <em>Input Data Date</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Input Data Date</em>'.
* @see ch.elexis.core.findings.templates.model.InputDataDate
* @generated
*/
EClass getInputDataDate();
/**
* Returns the meta object for the attribute '{@link ch.elexis.core.findings.templates.model.InputDataDate#getDataType <em>Data Type</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Data Type</em>'.
* @see ch.elexis.core.findings.templates.model.InputDataDate#getDataType()
* @see #getInputDataDate()
* @generated
*/
EAttribute getInputDataDate_DataType();
/**
* Returns the meta object for class '{@link ch.elexis.core.findings.templates.model.InputData <em>Input Data</em>}'.
* <!-- begin-user-doc -->
......@@ -1082,6 +1198,42 @@ public interface ModelPackage extends EPackage {
*/
EAttribute CODE_ELEMENT__DISPLAY = eINSTANCE.getCodeElement_Display();
/**
* The meta object literal for the '{@link ch.elexis.core.findings.templates.model.impl.InputDataBooleanImpl <em>Input Data Boolean</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see ch.elexis.core.findings.templates.model.impl.InputDataBooleanImpl
* @see ch.elexis.core.findings.templates.model.impl.ModelPackageImpl#getInputDataBoolean()
* @generated
*/
EClass INPUT_DATA_BOOLEAN = eINSTANCE.getInputDataBoolean();
/**
* The meta object literal for the '<em><b>Data Type</b></em>' attribute feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EAttribute INPUT_DATA_BOOLEAN__DATA_TYPE = eINSTANCE.getInputDataBoolean_DataType();
/**
* The meta object literal for the '{@link ch.elexis.core.findings.templates.model.impl.InputDataDateImpl <em>Input Data Date</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see ch.elexis.core.findings.templates.model.impl.InputDataDateImpl
* @see ch.elexis.core.findings.templates.model.impl.ModelPackageImpl#getInputDataDate()
* @generated
*/
EClass INPUT_DATA_DATE = eINSTANCE.getInputDataDate();
/**
* The meta object literal for the '<em><b>Data Type</b></em>' attribute feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EAttribute INPUT_DATA_DATE__DATA_TYPE = eINSTANCE.getInputDataDate_DataType();
/**
* The meta object literal for the '{@link ch.elexis.core.findings.templates.model.InputData <em>Input Data</em>}' class.
* <!-- begin-user-doc -->
......
/**
*/
package ch.elexis.core.findings.templates.model.impl;
import ch.elexis.core.findings.templates.model.DataType;
import ch.elexis.core.findings.templates.model.InputDataBoolean;
import ch.elexis.core.findings.templates.model.ModelPackage;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Input Data Boolean</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link ch.elexis.core.findings.templates.model.impl.InputDataBooleanImpl#getDataType <em>Data Type</em>}</li>
* </ul>
*
* @generated
*/
public class InputDataBooleanImpl extends MinimalEObjectImpl.Container implements InputDataBoolean {
/**
* The default value of the '{@link #getDataType() <em>Data Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDataType()
* @generated
* @ordered
*/
protected static final DataType DATA_TYPE_EDEFAULT = DataType.BOOLEAN;
/**
* The cached value of the '{@link #getDataType() <em>Data Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDataType()
* @generated
* @ordered
*/
protected DataType dataType = DATA_TYPE_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/