Commit 3e1bd44c authored by Marco Descher's avatar Marco Descher
Browse files

[11238] JPA Task#getTaskDescriptor use direct JPA resolvement

parent f5d31cc8
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -8,7 +8,9 @@ import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import ch.elexis.core.jpa.entities.converter.BooleanCharacterConverterSafe;
@@ -38,8 +40,9 @@ public class Task extends AbstractEntityWithId implements EntityWithId, EntityWi
	@Column
	protected int triggerEvent = 0;
	
	@Column(length = 32)
	protected String descriptorId;
	@JoinColumn(name="descriptor")
	@ManyToOne
	protected TaskDescriptor taskDescriptor;
	
	@Column
	@Lob
@@ -98,12 +101,12 @@ public class Task extends AbstractEntityWithId implements EntityWithId, EntityWi
		this.triggerEvent = triggerEvent;
	}
	
	public String getDescriptorId(){
		return descriptorId;
	public TaskDescriptor getTaskDescriptor(){
		return taskDescriptor;
	}
	
	public void setDescriptorId(String descriptorId){
		this.descriptorId = descriptorId;
	public void setTaskDescriptor(TaskDescriptor taskDescriptor){
		this.taskDescriptor = taskDescriptor;
	}
	
	public String getRunContext(){
+18 −0
Original line number Diff line number Diff line
@@ -1890,4 +1890,22 @@ DROP TABLE TEMP_ETIKETTEN_OBJCLASS_LINK;
		</addColumn>
	</changeSet>

	<changeSet author="marco" id="manual_TASK_FK_DESCRIPTOR">
		<preConditions onFail="MARK_RAN">
			<not>
				<foreignKeyConstraintExists
					foreignKeyName="TASKDESCRIPTOR_FK_ID" />
			</not>
		</preConditions>
		<renameColumn tableName="TASK"
			oldColumnName="DESCRIPTORID" newColumnName="DESCRIPTOR" />
		<modifyDataType tableName="TASK"
			columnName="DESCRIPTOR" newDataType="VARCHAR(25)" />
		<addNotNullConstraint tableName="TASK"
			columnName="DESCRIPTOR" />
		<addForeignKeyConstraint constraintName="TASKDESCRIPTOR_FK_ID"
			referencedTableName="TASKDESCRIPTOR" baseColumnNames="DESCRIPTOR" baseTableName="TASK"
			referencedColumnNames="ID" />
	</changeSet>
	
</databaseChangeLog>
+2 −2
Original line number Diff line number Diff line
@@ -132,8 +132,8 @@
        <details key="documentation" value="The task has finished its execution."/>
      </eAnnotations>
    </eStructuralFeatures>
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="descriptorId" lowerBound="1"
        eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" changeable="false"/>
    <eStructuralFeatures xsi:type="ecore:EReference" name="taskDescriptor" lowerBound="1"
        eType="#//ITaskDescriptor" changeable="false"/>
  </eClassifiers>
  <eClassifiers xsi:type="ecore:EClass" name="ITaskService" abstract="true" interface="true">
    <eOperations name="createTaskDescriptor" eType="#//ITaskDescriptor" eExceptions="#//TaskException">
+1 −1
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute model.ecore#//ITask/progressMonitor"/>
      <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute model.ecore#//ITask/runContext"/>
      <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute model.ecore#//ITask/finished"/>
      <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute model.ecore#//ITask/descriptorId"/>
      <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference model.ecore#//ITask/taskDescriptor"/>
      <genOperations ecoreOperation="model.ecore#//ITask/getResultEntryAsTypedList">
        <genParameters ecoreParameter="model.ecore#//ITask/getResultEntryAsTypedList/key"/>
        <genParameters ecoreParameter="model.ecore#//ITask/getResultEntryAsTypedList/clazz"/>
+5 −9
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
 *   <li>{@link ch.elexis.core.tasks.model.ITask#getProgressMonitor <em>Progress Monitor</em>}</li>
 *   <li>{@link ch.elexis.core.tasks.model.ITask#getRunContext <em>Run Context</em>}</li>
 *   <li>{@link ch.elexis.core.tasks.model.ITask#isFinished <em>Finished</em>}</li>
 *   <li>{@link ch.elexis.core.tasks.model.ITask#getDescriptorId <em>Descriptor Id</em>}</li>
 *   <li>{@link ch.elexis.core.tasks.model.ITask#getTaskDescriptor <em>Task Descriptor</em>}</li>
 * </ul>
 *
 * @see ch.elexis.core.tasks.model.ModelPackage#getITask()
@@ -185,19 +185,15 @@ public interface ITask extends Identifiable, Deleteable {
	boolean isFinished();

	/**
	 * Returns the value of the '<em><b>Descriptor Id</b></em>' attribute.
	 * Returns the value of the '<em><b>Task Descriptor</b></em>' reference.
	 * <!-- begin-user-doc -->
	 * <p>
	 * If the meaning of the '<em>Descriptor Id</em>' attribute isn't clear,
	 * there really should be more of a description here...
	 * </p>
	 * <!-- end-user-doc -->
	 * @return the value of the '<em>Descriptor Id</em>' attribute.
	 * @see ch.elexis.core.tasks.model.ModelPackage#getITask_DescriptorId()
	 * @return the value of the '<em>Task Descriptor</em>' reference.
	 * @see ch.elexis.core.tasks.model.ModelPackage#getITask_TaskDescriptor()
	 * @model required="true" changeable="false"
	 * @generated
	 */
	String getDescriptorId();
	ITaskDescriptor getTaskDescriptor();

	/**
	 * <!-- begin-user-doc -->
Loading