Search in sources :

Example 26 with InternalTask

use of org.kie.internal.task.api.model.InternalTask in project jbpm by kiegroup.

the class LifeCycleBaseTest method testLongDescription.

@Test
public void testLongDescription() {
    // BZ-1107473
    String str = "(with (new Task()) { priority = 55, taskData = (with( new TaskData()) { } ), ";
    str += "peopleAssignments = (with ( new PeopleAssignments() ) { potentialOwners = [new User('Bobba Fet'), new User('Darth Vader') ],businessAdministrators = [ new User('Administrator') ], }),";
    str += "name = 'This is my task name' })";
    Task task = TaskFactory.evalTask(new StringReader(str));
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < 1000; i++) {
        sb.append("a");
    }
    String comment = sb.toString();
    // NOTE: AbstractHTWorkItemHandler stores "Comment" parameter as 'Description'
    List<I18NText> descriptions = new ArrayList<I18NText>();
    I18NText descText = TaskModelProvider.getFactory().newI18NText();
    ((InternalI18NText) descText).setLanguage("en-UK");
    ((InternalI18NText) descText).setText(comment);
    descriptions.add(descText);
    ((InternalTask) task).setDescriptions(descriptions);
    // Fails if shortText is longer than 255
    taskService.addTask(task, new HashMap<String, Object>());
    long taskId = task.getId();
    Task resultTask = taskService.getTaskById(taskId);
    List<I18NText> resultDescriptions = resultTask.getDescriptions();
    InternalI18NText resultDescription = (InternalI18NText) resultDescriptions.get(0);
    // This is text
    assertEquals(1000, resultDescription.getText().length());
// 6.1.x no longer uses shortText in API and Taskorm.xml so no assert.
}
Also used : Task(org.kie.api.task.model.Task) InternalTask(org.kie.internal.task.api.model.InternalTask) I18NText(org.kie.api.task.model.I18NText) InternalI18NText(org.kie.internal.task.api.model.InternalI18NText) InternalI18NText(org.kie.internal.task.api.model.InternalI18NText) InternalTask(org.kie.internal.task.api.model.InternalTask) ArrayList(java.util.ArrayList) StringReader(java.io.StringReader) Test(org.junit.Test)

Example 27 with InternalTask

use of org.kie.internal.task.api.model.InternalTask in project jbpm by kiegroup.

the class TaskInstanceServiceImpl method setPriority.

public void setPriority(long taskId, int priority) {
    Task task = persistenceContext.findTask(taskId);
    taskEventSupport.fireBeforeTaskUpdated(task, context);
    ((InternalTask) task).setPriority(priority);
    taskEventSupport.fireAfterTaskUpdated(task, context);
}
Also used : Task(org.kie.api.task.model.Task) InternalTask(org.kie.internal.task.api.model.InternalTask) InternalTask(org.kie.internal.task.api.model.InternalTask)

Example 28 with InternalTask

use of org.kie.internal.task.api.model.InternalTask in project jbpm by kiegroup.

the class TaskInstanceServiceImpl method setName.

@Override
public void setName(long taskId, String name) {
    Task task = persistenceContext.findTask(taskId);
    ((InternalTask) task).setName(name);
}
Also used : Task(org.kie.api.task.model.Task) InternalTask(org.kie.internal.task.api.model.InternalTask) InternalTask(org.kie.internal.task.api.model.InternalTask)

Example 29 with InternalTask

use of org.kie.internal.task.api.model.InternalTask in project jbpm by kiegroup.

the class TaskInstanceServiceImpl method setSubTaskStrategy.

public void setSubTaskStrategy(long taskId, SubTasksStrategy strategy) {
    Task task = persistenceContext.findTask(taskId);
    ((InternalTask) task).setSubTaskStrategy(strategy);
}
Also used : Task(org.kie.api.task.model.Task) InternalTask(org.kie.internal.task.api.model.InternalTask) InternalTask(org.kie.internal.task.api.model.InternalTask)

Example 30 with InternalTask

use of org.kie.internal.task.api.model.InternalTask in project jbpm by kiegroup.

the class TaskInstanceServiceImpl method setDescription.

@Override
public void setDescription(long taskId, String description) {
    Task task = persistenceContext.findTask(taskId);
    ((InternalTask) task).setDescription(description);
}
Also used : Task(org.kie.api.task.model.Task) InternalTask(org.kie.internal.task.api.model.InternalTask) InternalTask(org.kie.internal.task.api.model.InternalTask)

Aggregations

InternalTask (org.kie.internal.task.api.model.InternalTask)50 Task (org.kie.api.task.model.Task)29 Test (org.junit.Test)27 ArrayList (java.util.ArrayList)21 InternalTaskData (org.kie.internal.task.api.model.InternalTaskData)18 OrganizationalEntity (org.kie.api.task.model.OrganizationalEntity)17 InputStreamReader (java.io.InputStreamReader)16 Reader (java.io.Reader)16 User (org.kie.api.task.model.User)16 CountDownTaskEventListener (org.jbpm.services.task.util.CountDownTaskEventListener)15 InternalPeopleAssignments (org.kie.internal.task.api.model.InternalPeopleAssignments)15 InternalOrganizationalEntity (org.kie.internal.task.api.model.InternalOrganizationalEntity)14 Date (java.util.Date)12 HashMap (java.util.HashMap)11 ContentData (org.kie.internal.task.api.model.ContentData)11 InternalContent (org.kie.internal.task.api.model.InternalContent)11 I18NText (org.kie.api.task.model.I18NText)10 InternalI18NText (org.kie.internal.task.api.model.InternalI18NText)8 TaskSummary (org.kie.api.task.model.TaskSummary)6 StringReader (java.io.StringReader)5