costumetrade.common.scene.constant.Scene.java Source code

Java tutorial

Introduction

Here is the source code for costumetrade.common.scene.constant.Scene.java

Source

/*
 * Copyright (C) 2014-2016, Hrfax and/or its affiliates. All rights reserved.
 * Hrfax PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */

package costumetrade.common.scene.constant;

import org.apache.commons.lang3.StringUtils;

/**
 * 
 *
 * @author zhouyq
 * @since 20161215
 */
public enum Scene {

    CREDIT_MATERIALS_UPLOAD("creditMaterialsUpload", "???", ""),

    CREDIT_MATERIALS_APPROVAL("creditMaterialsApproval", "???", SceneCategory.APPROVAL),

    CREDIT_INPUT("creditInput", "?", ""),

    CREDIT_APPROVAL("creditApproval", "?", SceneCategory.APPROVAL),

    CARD_INFO_INPUT("cardInfoInput", "??", ""),

    CARD_INFO_APPROVAL("cardInfoApproval", "?", SceneCategory.APPROVAL),

    LOAN_INFO_INPUT("loanInfoInput", "?", ""),

    USEDCAR_INFO_INPUT("usedCarInfoInput", "?", ""),

    LOAN_MATERIALS_CHOOSE("loanMaterialsChoose", "??", ""),

    BUSI_MODE_CHOOSE("busiModeChoose", "?", ""),

    HOME_MATERIALS_UPLOAD("homeMaterialsUpload", "??", ""),

    SIGN_MATERIALS_UPLOAD("signMaterialsUpload", "??", ""),

    LOAN_MATERIALS_UPLOAD("loanMaterialsUpload", "??", ""),

    ADVANCE_MATERIALS_UPLOAD("advanceMaterialsUpload", "??", ""),

    LOAN_TEL_APPROVAL("loanTelApproval", "", SceneCategory.APPROVAL),

    LOAN_APPROVAL("loanApproval", "", SceneCategory.APPROVAL),

    MAKE_LOAN_APPROVAL("makeLoanApproval", "", SceneCategory.APPROVAL),

    PICK_MATERIALS_UPLOAD("pickMaterialsUpload", "????", ""),

    PICK_MATERIALS_APPROVAL("pickMaterialsApproval", "??", SceneCategory.APPROVAL),

    REGISTRATION_MATERIALS_UPLOAD("registrationMaterialsUpload", "???", ""),

    /**
     * ???
     */
    ORDERDETAILS("OrderDetails", "?", SceneCategory.BACKGROUNDCONFIG), APPLYMODIFY("ApplyModify",
            "?", SceneCategory.BACKGROUNDCONFIG), APPLYMODIFYAPPROVAL("ApplyModifyApproval",
                    "?", SceneCategory.BACKGROUNDCONFIG), TERMINATIONORDERAPPROVA(
                            "TerminationOrderApproval", "?", SceneCategory.BACKGROUNDCONFIG),

    /**
     * ?
     */

    ORDER_INIT("orderInit", "??", ""),

    ORDER_TERMINATE("orderTerminate", "??", ""),

    ORDER_COMPLETE("orderComplete", "?", ""),

    /**
     * ?
     */
    STAGE("stage", "?", ""),

    /**
     * ?
     */
    REGISTRATION("registration", "?", ""),

    REGISTRATION_APPROVAL("registrationApproval", "", ""),

    PLEDGE("pledge", "?", ""),

    PLEDGE_APPROVAL("pledgeApproval", "", "");

    public final String code;

    public final String name;

    public final String category;

    Scene(String code, String name, String category) {
        this.code = code;
        this.name = name;
        this.category = category;
    }

    /**
     *  ?code??
     *  @param code ?
     *  @return ??
     */
    public static String getName(String code) {
        Scene[] scenes = Scene.values();
        for (Scene scene : scenes) {
            if (scene.code.equals(code)) {
                return scene.name;
            }
        }
        return StringUtils.EMPTY;
    }

    public static Scene get(String code) {
        Scene[] scenes = Scene.values();
        for (Scene scene : scenes) {
            if (scene.code.equals(code)) {
                return scene;
            }
        }
        return null;
    }

    /**
     *  @param sceneCode
     */
    public static boolean isApproval(String sceneCode) {
        Scene scene = get(sceneCode);
        if (scene == null) {
            return false;
        }
        return SceneCategory.APPROVAL.equals(scene.category);

    }

    /**
     *  @param sceneCode
     */
    public static boolean isBackgroundConfig(String sceneCode) {
        Scene scene = get(sceneCode);
        if (scene == null) {
            return false;
        }
        return SceneCategory.BACKGROUNDCONFIG.equals(scene.category);

    }
}