Skip to content

Commit

Permalink
BZ-1056236 - Provide registering TaskLifeCycleEventListener in Regist…
Browse files Browse the repository at this point in the history
…erableItemsFactory

(cherry picked from commit 64f9f8d)
  • Loading branch information
mswiderski committed Jan 27, 2014
1 parent 527080f commit 7060101
Show file tree
Hide file tree
Showing 6 changed files with 131 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.kie.api.event.rule.WorkingMemoryEventListener;
import org.kie.api.runtime.manager.RuntimeEngine;
import org.kie.api.runtime.process.WorkItemHandler;
import org.kie.api.task.TaskLifeCycleEventListener;

/**
* Factory that is used by <code>RuntimeManager</code> to configure <code>RuntimeEngine</code>
Expand Down Expand Up @@ -71,4 +72,17 @@ public interface RegisterableItemsFactory {
* @return list of listeners to be registered - in case of no listeners empty list shall be returned.
*/
List<WorkingMemoryEventListener> getWorkingMemoryEventListeners(RuntimeEngine runtime);

/**
* Returns globals that shall be registered on <code>KieSession</code>.
* @param runtime provides <code>RuntimeEngine</code> in case globals need to make use of it internally
* @return map of globals to be registered - in case of no globals empty map shall be returned.
*/
Map<String, Object> getGlobals(RuntimeEngine runtime);

/**
* Return new instances of <code>TaskLifeCycleEventListener</code> that will be registered on <code>RuntimeEngine</code>.
* @return
*/
List<TaskLifeCycleEventListener> getTaskListeners();
}
23 changes: 23 additions & 0 deletions kie-api/src/main/java/org/kie/api/task/TaskContext.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright 2013 JBoss Inc
*
* Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.kie.api.task;


public interface TaskContext {

UserGroupCallback getUserGroupCallback();

}
25 changes: 25 additions & 0 deletions kie-api/src/main/java/org/kie/api/task/TaskEvent.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright 2013 JBoss Inc
*
* Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.kie.api.task;

import org.kie.api.task.model.Task;

public interface TaskEvent {

Task getTask();

TaskContext getTaskContext();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Copyright 2013 JBoss Inc
*
* Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.kie.api.task;

import java.util.EventListener;

public interface TaskLifeCycleEventListener extends EventListener {

public void beforeTaskActivatedEvent(TaskEvent event);
public void beforeTaskClaimedEvent(TaskEvent event);
public void beforeTaskSkippedEvent(TaskEvent event);
public void beforeTaskStartedEvent(TaskEvent event);
public void beforeTaskStoppedEvent(TaskEvent event);
public void beforeTaskCompletedEvent(TaskEvent event);
public void beforeTaskFailedEvent(TaskEvent event);
public void beforeTaskAddedEvent(TaskEvent event);
public void beforeTaskExitedEvent(TaskEvent event);
public void beforeTaskReleasedEvent(TaskEvent event);
public void beforeTaskResumedEvent(TaskEvent event);
public void beforeTaskSuspendedEvent(TaskEvent event);
public void beforeTaskForwardedEvent(TaskEvent event);
public void beforeTaskDelegatedEvent(TaskEvent event);

public void afterTaskActivatedEvent(TaskEvent event);
public void afterTaskClaimedEvent(TaskEvent event);
public void afterTaskSkippedEvent(TaskEvent event);
public void afterTaskStartedEvent(TaskEvent event);
public void afterTaskStoppedEvent(TaskEvent event);
public void afterTaskCompletedEvent(TaskEvent event);
public void afterTaskFailedEvent(TaskEvent event);
public void afterTaskAddedEvent(TaskEvent event);
public void afterTaskExitedEvent(TaskEvent event);
public void afterTaskReleasedEvent(TaskEvent event);
public void afterTaskResumedEvent(TaskEvent event);
public void afterTaskSuspendedEvent(TaskEvent event);
public void afterTaskForwardedEvent(TaskEvent event);
public void afterTaskDelegatedEvent(TaskEvent event);

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import org.kie.api.task.UserGroupCallback;
import org.kie.internal.command.Context;

public interface TaskContext extends Context {
public interface TaskContext extends Context, org.kie.api.task.TaskContext {

TaskPersistenceContext getPersistenceContext();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
/*
* Copyright 2013 JBoss Inc
*
* Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.kie.internal.task.api;

import org.kie.api.task.model.Task;

public interface TaskEvent {
public interface TaskEvent extends org.kie.api.task.TaskEvent {

Task getTask();

TaskContext getTaskContext();
}

0 comments on commit 7060101

Please sign in to comment.