Commit 1d43bc59 authored by thomas's avatar thomas
Browse files

[23083] fix appointment service series delete

parent 005a3b91
Pipeline #22343 passed with stages
in 4 minutes and 45 seconds
......@@ -129,13 +129,16 @@ public class Appointment extends AbstractIdDeleteModelAdapter<Termin>
}
@Override
public IUser getCreatedBy(){
return null;
public String getCreatedBy(){
return getEntity().getErstelltVon();
}
@Override
public void setCreatedBy(IUser value){
// TODO Auto-generated method stub
public void setCreatedBy(String value){
if (value != null) {
value = StringUtils.abbreviate(value, 25);
}
getEntityMarkDirty().setErstelltVon(value);
}
@Override
......
......@@ -94,14 +94,12 @@ public class AppointmentService implements IAppointmentService {
@Override
public boolean delete(IAppointment appointment, boolean whole){
//@TODO checkLock is deprecated not needed ?
// check if appointment isLinked
if (!StringTool.isNothing(appointment.getLinkgroup())) {
List<IAppointment> linked = getLinkedAppoinments(appointment);
if (whole) {
// delete whole series
iModelService.delete(linked.get(0));
iModelService.delete(linked);
} else {
if (appointment.getId().equals(appointment.getLinkgroup())) {
if (linked.size() > 1) {
......@@ -112,8 +110,6 @@ public class AppointmentService implements IAppointmentService {
}
moveto.setSubjectOrPatient(appointment.getSubjectOrPatient());
moveto.setReason(appointment.getReason());
//TODO created by not working
//moveto.set(Termin.FLD_CREATOR, get(Termin.FLD_CREATOR));
moveto.setCreatedBy(appointment.getCreatedBy());
moveto.setExtension(appointment.getExtension());
iModelService.save(moveto);
......@@ -288,7 +284,9 @@ public class AppointmentService implements IAppointmentService {
IAppointment appointment = CoreModelServiceHolder.get().create(IAppointment.class);
// set some default values
appointment.setSchedule(getAreas().get(0).getName());
appointment.setCreatedBy(ContextServiceHolder.get().getActiveUser().orElse(null));
ContextServiceHolder.get().getActiveUser().ifPresent(au -> {
appointment.setCreatedBy(au.getLabel());
});
LocalDate monday = LocalDate.now().with(DayOfWeek.MONDAY);
appointment.setStartTime(LocalDateTime.of(monday, LocalTime.of(8, 0, 0)));
appointment.setEndTime(LocalDateTime.of(monday, LocalTime.of(8, 30, 0)));
......
......@@ -12,7 +12,6 @@ import org.slf4j.LoggerFactory;
import ch.elexis.core.model.IAppointment;
import ch.elexis.core.model.IAppointmentSeries;
import ch.elexis.core.model.IContact;
import ch.elexis.core.model.IUser;
import ch.elexis.core.model.IXid;
import ch.elexis.core.model.agenda.EndingType;
import ch.elexis.core.model.agenda.SeriesType;
......@@ -151,12 +150,12 @@ public class AppointmentSeries implements IAppointmentSeries {
}
@Override
public IUser getCreatedBy(){
public String getCreatedBy(){
return appointment.getCreatedBy();
}
@Override
public void setCreatedBy(IUser value){
public void setCreatedBy(String value){
appointment.setCreatedBy(value);
}
......
......@@ -1041,11 +1041,6 @@
<details key="attributeName" value="bereich"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EReference" name="createdBy" eType="#//IUser">
<eAnnotations source="http://elexis.info/jpa/entity/attribute/mapping">
<details key="attributeName" value="erstelltvon"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="subjectOrPatient" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
<eAnnotations source="http://elexis.info/jpa/entity/attribute/mapping">
<details key="attributeName" value="patid"/>
......@@ -1086,6 +1081,11 @@
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="recurring" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
changeable="false"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="createdBy" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
<eAnnotations source="http://elexis.info/jpa/entity/attribute/mapping">
<details key="attributeName" value="erstelltvon"/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="IAppointmentSeries" abstract="true"
interface="true" eSuperTypes="#//IAppointment">
......
......@@ -659,7 +659,6 @@
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute model.ecore#//IAppointment/type"/>
<genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute model.ecore#//IAppointment/durationMinutes"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute model.ecore#//IAppointment/schedule"/>
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference model.ecore#//IAppointment/createdBy"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute model.ecore#//IAppointment/subjectOrPatient"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute model.ecore#//IAppointment/priority"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute model.ecore#//IAppointment/treatmentReason"/>
......@@ -671,6 +670,7 @@
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute model.ecore#//IAppointment/lastEdit"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute model.ecore#//IAppointment/stateHistory"/>
<genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute model.ecore#//IAppointment/recurring"/>
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EAttribute model.ecore#//IAppointment/createdBy"/>
<genOperations ecoreOperation="model.ecore#//IAppointment/getContact"/>
<genOperations ecoreOperation="model.ecore#//IAppointment/getStateHistoryFormatted">
<genParameters ecoreParameter="model.ecore#//IAppointment/getStateHistoryFormatted/formatPattern"/>
......
......@@ -24,7 +24,6 @@ package ch.elexis.core.model;
* <li>{@link ch.elexis.core.model.IAppointment#getType <em>Type</em>}</li>
* <li>{@link ch.elexis.core.model.IAppointment#getDurationMinutes <em>Duration Minutes</em>}</li>
* <li>{@link ch.elexis.core.model.IAppointment#getSchedule <em>Schedule</em>}</li>
* <li>{@link ch.elexis.core.model.IAppointment#getCreatedBy <em>Created By</em>}</li>
* <li>{@link ch.elexis.core.model.IAppointment#getSubjectOrPatient <em>Subject Or Patient</em>}</li>
* <li>{@link ch.elexis.core.model.IAppointment#getPriority <em>Priority</em>}</li>
* <li>{@link ch.elexis.core.model.IAppointment#getTreatmentReason <em>Treatment Reason</em>}</li>
......@@ -36,6 +35,7 @@ package ch.elexis.core.model;
* <li>{@link ch.elexis.core.model.IAppointment#getLastEdit <em>Last Edit</em>}</li>
* <li>{@link ch.elexis.core.model.IAppointment#getStateHistory <em>State History</em>}</li>
* <li>{@link ch.elexis.core.model.IAppointment#isRecurring <em>Recurring</em>}</li>
* <li>{@link ch.elexis.core.model.IAppointment#getCreatedBy <em>Created By</em>}</li>
* </ul>
*
* @see ch.elexis.core.model.ModelPackage#getIAppointment()
......@@ -164,30 +164,30 @@ public interface IAppointment extends IPeriod {
void setSchedule(String value);
/**
* Returns the value of the '<em><b>Created By</b></em>' reference.
* Returns the value of the '<em><b>Created By</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Created By</em>' reference isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Created By</em>' reference.
* @see #setCreatedBy(IUser)
* @return the value of the '<em>Created By</em>' attribute.
* @see #setCreatedBy(String)
* @see ch.elexis.core.model.ModelPackage#getIAppointment_CreatedBy()
* @model annotation="http://elexis.info/jpa/entity/attribute/mapping attributeName='erstelltvon'"
* @generated
*/
IUser getCreatedBy();
String getCreatedBy();
/**
* Sets the value of the '{@link ch.elexis.core.model.IAppointment#getCreatedBy <em>Created By</em>}' reference.
* Sets the value of the '{@link ch.elexis.core.model.IAppointment#getCreatedBy <em>Created By</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Created By</em>' reference.
* @param value the new value of the '<em>Created By</em>' attribute.
* @see #getCreatedBy()
* @generated
*/
void setCreatedBy(IUser value);
void setCreatedBy(String value);
/**
* Returns the value of the '<em><b>Subject Or Patient</b></em>' attribute.
......
......@@ -6935,15 +6935,6 @@ public interface ModelPackage extends EPackage {
*/
int IAPPOINTMENT__SCHEDULE = IPERIOD_FEATURE_COUNT + 4;
/**
* The feature id for the '<em><b>Created By</b></em>' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int IAPPOINTMENT__CREATED_BY = IPERIOD_FEATURE_COUNT + 5;
/**
* The feature id for the '<em><b>Subject Or Patient</b></em>' attribute.
* <!-- begin-user-doc -->
......@@ -6951,7 +6942,7 @@ public interface ModelPackage extends EPackage {
* @generated
* @ordered
*/
int IAPPOINTMENT__SUBJECT_OR_PATIENT = IPERIOD_FEATURE_COUNT + 6;
int IAPPOINTMENT__SUBJECT_OR_PATIENT = IPERIOD_FEATURE_COUNT + 5;
/**
* The feature id for the '<em><b>Priority</b></em>' attribute.
......@@ -6960,7 +6951,7 @@ public interface ModelPackage extends EPackage {
* @generated
* @ordered
*/
int IAPPOINTMENT__PRIORITY = IPERIOD_FEATURE_COUNT + 7;
int IAPPOINTMENT__PRIORITY = IPERIOD_FEATURE_COUNT + 6;
/**
* The feature id for the '<em><b>Treatment Reason</b></em>' attribute.
......@@ -6969,7 +6960,7 @@ public interface ModelPackage extends EPackage {
* @generated
* @ordered
*/
int IAPPOINTMENT__TREATMENT_REASON = IPERIOD_FEATURE_COUNT + 8;
int IAPPOINTMENT__TREATMENT_REASON = IPERIOD_FEATURE_COUNT + 7;
/**
* The feature id for the '<em><b>Case Type</b></em>' attribute.
......@@ -6978,7 +6969,7 @@ public interface ModelPackage extends EPackage {
* @generated
* @ordered
*/
int IAPPOINTMENT__CASE_TYPE = IPERIOD_FEATURE_COUNT + 9;
int IAPPOINTMENT__CASE_TYPE = IPERIOD_FEATURE_COUNT + 8;
/**
* The feature id for the '<em><b>Insurance Type</b></em>' attribute.
......@@ -6987,7 +6978,7 @@ public interface ModelPackage extends EPackage {
* @generated
* @ordered
*/
int IAPPOINTMENT__INSURANCE_TYPE = IPERIOD_FEATURE_COUNT + 10;
int IAPPOINTMENT__INSURANCE_TYPE = IPERIOD_FEATURE_COUNT + 9;
/**
* The feature id for the '<em><b>Linkgroup</b></em>' attribute.
......@@ -6996,7 +6987,7 @@ public interface ModelPackage extends EPackage {
* @generated
* @ordered
*/
int IAPPOINTMENT__LINKGROUP = IPERIOD_FEATURE_COUNT + 11;
int IAPPOINTMENT__LINKGROUP = IPERIOD_FEATURE_COUNT + 10;
/**
* The feature id for the '<em><b>Extension</b></em>' attribute.
......@@ -7005,7 +6996,7 @@ public interface ModelPackage extends EPackage {
* @generated
* @ordered
*/
int IAPPOINTMENT__EXTENSION = IPERIOD_FEATURE_COUNT + 12;
int IAPPOINTMENT__EXTENSION = IPERIOD_FEATURE_COUNT + 11;
/**
* The feature id for the '<em><b>Created</b></em>' attribute.
......@@ -7014,7 +7005,7 @@ public interface ModelPackage extends EPackage {
* @generated
* @ordered
*/
int IAPPOINTMENT__CREATED = IPERIOD_FEATURE_COUNT + 13;
int IAPPOINTMENT__CREATED = IPERIOD_FEATURE_COUNT + 12;
/**
* The feature id for the '<em><b>Last Edit</b></em>' attribute.
......@@ -7023,7 +7014,7 @@ public interface ModelPackage extends EPackage {
* @generated
* @ordered
*/
int IAPPOINTMENT__LAST_EDIT = IPERIOD_FEATURE_COUNT + 14;
int IAPPOINTMENT__LAST_EDIT = IPERIOD_FEATURE_COUNT + 13;
/**
* The feature id for the '<em><b>State History</b></em>' attribute.
......@@ -7032,7 +7023,7 @@ public interface ModelPackage extends EPackage {
* @generated
* @ordered
*/
int IAPPOINTMENT__STATE_HISTORY = IPERIOD_FEATURE_COUNT + 15;
int IAPPOINTMENT__STATE_HISTORY = IPERIOD_FEATURE_COUNT + 14;
/**
* The feature id for the '<em><b>Recurring</b></em>' attribute.
......@@ -7041,7 +7032,16 @@ public interface ModelPackage extends EPackage {
* @generated
* @ordered
*/
int IAPPOINTMENT__RECURRING = IPERIOD_FEATURE_COUNT + 16;
int IAPPOINTMENT__RECURRING = IPERIOD_FEATURE_COUNT + 15;
/**
* The feature id for the '<em><b>Created By</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int IAPPOINTMENT__CREATED_BY = IPERIOD_FEATURE_COUNT + 16;
/**
* The number of structural features of the '<em>IAppointment</em>' class.
......@@ -7143,15 +7143,6 @@ public interface ModelPackage extends EPackage {
*/
int IAPPOINTMENT_SERIES__SCHEDULE = IAPPOINTMENT__SCHEDULE;
/**
* The feature id for the '<em><b>Created By</b></em>' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int IAPPOINTMENT_SERIES__CREATED_BY = IAPPOINTMENT__CREATED_BY;
/**
* The feature id for the '<em><b>Subject Or Patient</b></em>' attribute.
* <!-- begin-user-doc -->
......@@ -7251,6 +7242,15 @@ public interface ModelPackage extends EPackage {
*/
int IAPPOINTMENT_SERIES__RECURRING = IAPPOINTMENT__RECURRING;
/**
* The feature id for the '<em><b>Created By</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int IAPPOINTMENT_SERIES__CREATED_BY = IAPPOINTMENT__CREATED_BY;
/**
* The feature id for the '<em><b>Series Type</b></em>' attribute.
* <!-- begin-user-doc -->
......@@ -11913,15 +11913,15 @@ public interface ModelPackage extends EPackage {
EAttribute getIAppointment_Schedule();
/**
* Returns the meta object for the reference '{@link ch.elexis.core.model.IAppointment#getCreatedBy <em>Created By</em>}'.
* Returns the meta object for the attribute '{@link ch.elexis.core.model.IAppointment#getCreatedBy <em>Created By</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the reference '<em>Created By</em>'.
* @return the meta object for the attribute '<em>Created By</em>'.
* @see ch.elexis.core.model.IAppointment#getCreatedBy()
* @see #getIAppointment()
* @generated
*/
EReference getIAppointment_CreatedBy();
EAttribute getIAppointment_CreatedBy();
/**
* Returns the meta object for the attribute '{@link ch.elexis.core.model.IAppointment#getSubjectOrPatient <em>Subject Or Patient</em>}'.
......@@ -15479,12 +15479,12 @@ public interface ModelPackage extends EPackage {
EAttribute IAPPOINTMENT__SCHEDULE = eINSTANCE.getIAppointment_Schedule();
/**
* The meta object literal for the '<em><b>Created By</b></em>' reference feature.
* The meta object literal for the '<em><b>Created By</b></em>' attribute feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EReference IAPPOINTMENT__CREATED_BY = eINSTANCE.getIAppointment_CreatedBy();
EAttribute IAPPOINTMENT__CREATED_BY = eINSTANCE.getIAppointment_CreatedBy();
/**
* The meta object literal for the '<em><b>Subject Or Patient</b></em>' attribute feature.
......
......@@ -3798,8 +3798,8 @@ public class ModelPackageImpl extends EPackageImpl implements ModelPackage {
* @generated
*/
@Override
public EReference getIAppointment_CreatedBy() {
return (EReference)iAppointmentEClass.getEStructuralFeatures().get(5);
public EAttribute getIAppointment_CreatedBy() {
return (EAttribute)iAppointmentEClass.getEStructuralFeatures().get(16);
}
/**
......@@ -3809,7 +3809,7 @@ public class ModelPackageImpl extends EPackageImpl implements ModelPackage {
*/
@Override
public EAttribute getIAppointment_SubjectOrPatient() {
return (EAttribute)iAppointmentEClass.getEStructuralFeatures().get(6);
return (EAttribute)iAppointmentEClass.getEStructuralFeatures().get(5);
}
/**
......@@ -3819,7 +3819,7 @@ public class ModelPackageImpl extends EPackageImpl implements ModelPackage {
*/
@Override
public EAttribute getIAppointment_Priority() {
return (EAttribute)iAppointmentEClass.getEStructuralFeatures().get(7);
return (EAttribute)iAppointmentEClass.getEStructuralFeatures().get(6);
}
/**
......@@ -3829,7 +3829,7 @@ public class ModelPackageImpl extends EPackageImpl implements ModelPackage {
*/
@Override
public EAttribute getIAppointment_TreatmentReason() {
return (EAttribute)iAppointmentEClass.getEStructuralFeatures().get(8);
return (EAttribute)iAppointmentEClass.getEStructuralFeatures().get(7);
}
/**
......@@ -3839,7 +3839,7 @@ public class ModelPackageImpl extends EPackageImpl implements ModelPackage {
*/
@Override
public EAttribute getIAppointment_CaseType() {
return (EAttribute)iAppointmentEClass.getEStructuralFeatures().get(9);
return (EAttribute)iAppointmentEClass.getEStructuralFeatures().get(8);
}
/**
......@@ -3849,7 +3849,7 @@ public class ModelPackageImpl extends EPackageImpl implements ModelPackage {
*/
@Override
public EAttribute getIAppointment_InsuranceType() {
return (EAttribute)iAppointmentEClass.getEStructuralFeatures().get(10);
return (EAttribute)iAppointmentEClass.getEStructuralFeatures().get(9);
}
/**
......@@ -3859,7 +3859,7 @@ public class ModelPackageImpl extends EPackageImpl implements ModelPackage {
*/
@Override
public EAttribute getIAppointment_Linkgroup() {
return (EAttribute)iAppointmentEClass.getEStructuralFeatures().get(11);
return (EAttribute)iAppointmentEClass.getEStructuralFeatures().get(10);
}
/**
......@@ -3869,7 +3869,7 @@ public class ModelPackageImpl extends EPackageImpl implements ModelPackage {
*/
@Override
public EAttribute getIAppointment_Extension() {
return (EAttribute)iAppointmentEClass.getEStructuralFeatures().get(12);
return (EAttribute)iAppointmentEClass.getEStructuralFeatures().get(11);
}
/**
......@@ -3879,7 +3879,7 @@ public class ModelPackageImpl extends EPackageImpl implements ModelPackage {
*/
@Override
public EAttribute getIAppointment_Created() {
return (EAttribute)iAppointmentEClass.getEStructuralFeatures().get(13);
return (EAttribute)iAppointmentEClass.getEStructuralFeatures().get(12);
}
/**
......@@ -3889,7 +3889,7 @@ public class ModelPackageImpl extends EPackageImpl implements ModelPackage {
*/
@Override
public EAttribute getIAppointment_LastEdit() {
return (EAttribute)iAppointmentEClass.getEStructuralFeatures().get(14);
return (EAttribute)iAppointmentEClass.getEStructuralFeatures().get(13);
}
/**
......@@ -3899,7 +3899,7 @@ public class ModelPackageImpl extends EPackageImpl implements ModelPackage {
*/
@Override
public EAttribute getIAppointment_StateHistory() {
return (EAttribute)iAppointmentEClass.getEStructuralFeatures().get(15);
return (EAttribute)iAppointmentEClass.getEStructuralFeatures().get(14);
}
/**
......@@ -3909,7 +3909,7 @@ public class ModelPackageImpl extends EPackageImpl implements ModelPackage {
*/
@Override
public EAttribute getIAppointment_Recurring() {
return (EAttribute)iAppointmentEClass.getEStructuralFeatures().get(16);
return (EAttribute)iAppointmentEClass.getEStructuralFeatures().get(15);
}
/**
......@@ -5323,7 +5323,6 @@ public class ModelPackageImpl extends EPackageImpl implements ModelPackage {
createEAttribute(iAppointmentEClass, IAPPOINTMENT__TYPE);
createEAttribute(iAppointmentEClass, IAPPOINTMENT__DURATION_MINUTES);
createEAttribute(iAppointmentEClass, IAPPOINTMENT__SCHEDULE);
createEReference(iAppointmentEClass, IAPPOINTMENT__CREATED_BY);
createEAttribute(iAppointmentEClass, IAPPOINTMENT__SUBJECT_OR_PATIENT);
createEAttribute(iAppointmentEClass, IAPPOINTMENT__PRIORITY);
createEAttribute(iAppointmentEClass, IAPPOINTMENT__TREATMENT_REASON);
......@@ -5335,6 +5334,7 @@ public class ModelPackageImpl extends EPackageImpl implements ModelPackage {
createEAttribute(iAppointmentEClass, IAPPOINTMENT__LAST_EDIT);
createEAttribute(iAppointmentEClass, IAPPOINTMENT__STATE_HISTORY);
createEAttribute(iAppointmentEClass, IAPPOINTMENT__RECURRING);
createEAttribute(iAppointmentEClass, IAPPOINTMENT__CREATED_BY);
iAppointmentSeriesEClass = createEClass(IAPPOINTMENT_SERIES);
createEAttribute(iAppointmentSeriesEClass, IAPPOINTMENT_SERIES__SERIES_TYPE);
......@@ -6273,7 +6273,6 @@ public class ModelPackageImpl extends EPackageImpl implements ModelPackage {
initEAttribute(getIAppointment_Type(), ecorePackage.getEString(), "type", null, 0, 1, IAppointment.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getIAppointment_DurationMinutes(), ecorePackage.getEIntegerObject(), "durationMinutes", null, 0, 1, IAppointment.class, !IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getIAppointment_Schedule(), ecorePackage.getEString(), "schedule", null, 0, 1, IAppointment.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getIAppointment_CreatedBy(), this.getIUser(), null, "createdBy", null, 0, 1, IAppointment.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getIAppointment_SubjectOrPatient(), ecorePackage.getEString(), "subjectOrPatient", null, 0, 1, IAppointment.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getIAppointment_Priority(), ecorePackage.getEInt(), "priority", null, 0, 1, IAppointment.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getIAppointment_TreatmentReason(), ecorePackage.getEInt(), "treatmentReason", null, 0, 1, IAppointment.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
......@@ -6285,6 +6284,7 @@ public class ModelPackageImpl extends EPackageImpl implements ModelPackage {
initEAttribute(getIAppointment_LastEdit(), ecorePackage.getEString(), "lastEdit", null, 0, 1, IAppointment.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getIAppointment_StateHistory(), ecorePackage.getEString(), "stateHistory", null, 0, 1, IAppointment.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getIAppointment_Recurring(), ecorePackage.getEBoolean(), "recurring", null, 0, 1, IAppointment.class, !IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getIAppointment_CreatedBy(), ecorePackage.getEString(), "createdBy", null, 0, 1, IAppointment.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
addEOperation(iAppointmentEClass, this.getIContact(), "getContact", 0, 1, IS_UNIQUE, IS_ORDERED);
......@@ -6526,12 +6526,6 @@ public class ModelPackageImpl extends EPackageImpl implements ModelPackage {
new String[] {
"attributeName", "bereich"
});
addAnnotation
(getIAppointment_CreatedBy(),
source,
new String[] {
"attributeName", "erstelltvon"
});
addAnnotation
(getIAppointment_SubjectOrPatient(),
source,
......@@ -6556,6 +6550,12 @@ public class ModelPackageImpl extends EPackageImpl implements ModelPackage {
new String[] {
"attributeName", "statusHistory"
});
addAnnotation
(getIAppointment_CreatedBy(),
source,
new String[] {
"attributeName", "erstelltvon"
});
}
} //ModelPackageImpl
package ch.elexis.core.services;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.temporal.TemporalAdjusters;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
......@@ -17,8 +21,11 @@ import org.junit.BeforeClass;
import org.junit.Test;
import ch.elexis.core.model.IAppointment;
import ch.elexis.core.model.IAppointmentSeries;
import ch.elexis.core.model.agenda.Area;
import ch.elexis.core.model.agenda.AreaType;
import ch.elexis.core.model.agenda.EndingType;
import ch.elexis.core.model.agenda.SeriesType;
import ch.elexis.core.model.builder.IAppointmentBuilder;
import ch.elexis.core.services.IQuery.COMPARATOR;
import ch.elexis.core.types.AppointmentState;
......@@ -110,8 +117,42 @@ public class IAppointmentServiceTest extends AbstractServiceTest {
assertEquals(1, coreModelService.getQuery(IAppointment.class).execute().size());
appointmentService.delete(savedAppointment, false);
assertEquals(0, coreModelService.getQuery(IAppointment.class).execute().size());
}
@Test
public void series(){
// create series
LocalDate previousMonday =
LocalDate.now().with(TemporalAdjusters.previous(DayOfWeek.MONDAY));
LocalDateTime seriesStart = previousMonday.atTime(10, 30);
LocalTime seriesEnd = LocalTime.of(11, 00);
IAppointmentSeries series = appointmentService.createAppointmentSeries();
series.setStartTime(seriesStart);
series.setSeriesEndTime(seriesEnd);
series.setReason("test");
series.setSeriesType(SeriesType.WEEKLY);
series.setSeriesPatternString("1,246");
series.setEndingType(EndingType.AFTER_N_OCCURENCES);
series.setEndingPatternString("2");
List<IAppointment> appointments = appointmentService.saveAppointmentSeries(series);
assertNotNull(appointments);
assertEquals(6, appointments.size());
assertTrue(appointments.get(0).isRecurring() && appointments.get(3).isRecurring());
assertEquals("test", appointments.get(0).getReason());
assertEquals("test", appointments.get(3).getReason());
//@todo delete with linkgroup
// delete series, only first
appointmentService.delete(appointments.get(0), false);
assertTrue(appointments.get(0).isRecurring() && appointments.get(3).isRecurring());
assertTrue(appointments.get(0).isDeleted());
assertFalse(appointments.get(3).isDeleted());
// delete series, all