/*
* Copyright 2004 The Apache Software Foundation.
*
* 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.apache.agila.example;
import org.apache.agila.model.Connection;
import org.apache.agila.model.NodeContext;
import org.apache.agila.services.user.UserID;
import org.apache.agila.services.task.TaskService;
import org.apache.agila.services.task.TaskActivity;
import org.apache.agila.services.task.Renderer;
import org.apache.agila.services.task.ResponseHandler;
import org.apache.agila.services.notification.NotificationService;
import org.apache.agila.model.node.BaseNodeImpl;
import java.util.Date;
public class LeaveApprovalTask extends BaseNodeImpl implements TaskActivity {
public boolean doStart(NodeContext ctx) {
TaskService ts = ctx.getTaskService();
NotificationService ns = ctx.getNotificationService();
ts.assignTask(ctx.getNextExecutionToken().getTokenID(), "Leave Approval",
new UserID(1), new Date());
return false;
}
public Connection[] doEnd(NodeContext ctx) {
return getOutboundConnections();
}
public Renderer getRenderer(NodeContext ctx, Class type) {
return new LeaveApprovalHandler(ctx);
}
public ResponseHandler getResponseHandler(NodeContext ctx, Class type) {
return new LeaveApprovalHandler(ctx);
}
}