com.jfaker.app.modules.web.LeaveController.java Source code

Java tutorial

Introduction

Here is the source code for com.jfaker.app.modules.web.LeaveController.java

Source

/*
 *  Copyright 2014-2015 snakerflow.com
 *  *
 *  * 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 com.jfaker.app.modules.web;

import org.apache.commons.lang.StringUtils;

import com.jfaker.framework.flow.web.SnakerController;
import com.jfaker.framework.security.shiro.ShiroUtils;

/**
 * ??Controller
 * ?:??decision?->${day > 2 ? 'transition5' : 'transition4'}
 * ?:
 *     ??json??order?taskvariable
 *     ??orderId??
 * @author yuqs
 * @since 0.1
 */
public class LeaveController extends SnakerController {
    /**
     * ?
     */
    public void apply() {
        //??
        keepPara();
        //???????????
        //??????????
        setAttr("operator", ShiroUtils.getUsername());
        String orderId = getPara(PARA_ORDERID);
        String taskId = getPara(PARA_TASKID);
        //?taskId??????
        if (StringUtils.isEmpty(orderId) || StringUtils.isNotEmpty(taskId)) {
            //idapply.jsp
            render("apply.jsp");
        } else {
            //orderId??taskId?????
            //????variableflowData?
            //???orderId????orderId?
            flowData(orderId, getPara(PARA_TASKNAME));
            //?
            render("applyView.jsp");
        }
    }

    /**
     * ??
     */
    public void approveDept() {
        keepPara();
        String orderId = getPara(PARA_ORDERID);
        String taskId = getPara(PARA_TASKID);
        if (StringUtils.isNotEmpty(taskId)) {
            render("approveDept.jsp");
        } else {
            flowData(orderId, getPara(PARA_TASKNAME));
            render("approveDeptView.jsp");
        }
    }

    /**
     * ??
     */
    public void approveBoss() {
        keepPara();
        String orderId = getPara(PARA_ORDERID);
        String taskId = getPara(PARA_TASKID);
        if (StringUtils.isNotEmpty(taskId)) {
            render("approveBoss.jsp");
        } else {
            flowData(orderId, getPara(PARA_TASKNAME));
            render("approveBossView.jsp");
        }
    }
}