当前位置: 首页>>代码示例>>Java>>正文


Java KRADConstants.SENSITIVE_DATA_QUESTION_SESSION_TICKET属性代码示例

本文整理汇总了Java中org.kuali.rice.krad.util.KRADConstants.SENSITIVE_DATA_QUESTION_SESSION_TICKET属性的典型用法代码示例。如果您正苦于以下问题:Java KRADConstants.SENSITIVE_DATA_QUESTION_SESSION_TICKET属性的具体用法?Java KRADConstants.SENSITIVE_DATA_QUESTION_SESSION_TICKET怎么用?Java KRADConstants.SENSITIVE_DATA_QUESTION_SESSION_TICKET使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.kuali.rice.krad.util.KRADConstants的用法示例。


在下文中一共展示了KRADConstants.SENSITIVE_DATA_QUESTION_SESSION_TICKET属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkAndWarnAboutSensitiveData

/**
 * Checks if the given value matches patterns that indicate sensitive data and if configured to give a warning for sensitive data will
 * prompt the user to continue
 *
 * @param mapping
 * @param form
 * @param request
 * @param response
 * @param fieldName  - name of field with value being checked
 * @param fieldValue - value to check for sensitive data
 * @param caller     - method that should be called back from question
 * @param context    - additional context that needs to be passed back with the question response
 * @return ActionForward which contains the question forward, or basic forward if user select no to prompt, otherwise will return null
 *         to indicate processing should continue
 * @throws Exception
 */
protected ActionForward checkAndWarnAboutSensitiveData(ActionMapping mapping, ActionForm form,
                                                       HttpServletRequest request, HttpServletResponse response, String fieldName, String fieldValue, String caller, String context)
        throws Exception {
    KualiDocumentFormBase kualiDocumentFormBase = (KualiDocumentFormBase) form;
    Document document = kualiDocumentFormBase.getDocument();

    boolean containsSensitiveData = KRADUtils.containsSensitiveDataPatternMatch(fieldValue);

    // check if warning is configured in which case we will prompt, or if not business rules will thrown an error
    boolean warnForSensitiveData = CoreFrameworkServiceLocator.getParameterService().getParameterValueAsBoolean(
            KRADConstants.KNS_NAMESPACE, ParameterConstants.ALL_COMPONENT,
            KRADConstants.SystemGroupParameterNames.SENSITIVE_DATA_PATTERNS_WARNING_IND);

    // determine if the question has been asked yet
    Map<String, String> ticketContext = new HashMap<String, String>();
    ticketContext.put(KRADPropertyConstants.DOCUMENT_NUMBER, document.getDocumentNumber());
    ticketContext.put(KRADConstants.CALLING_METHOD, caller);
    ticketContext.put(KRADPropertyConstants.NAME, fieldName);

    boolean questionAsked = GlobalVariables.getUserSession().hasMatchingSessionTicket(
            KRADConstants.SENSITIVE_DATA_QUESTION_SESSION_TICKET, ticketContext);

    // start in logic for confirming the sensitive data
    if (containsSensitiveData && warnForSensitiveData && !questionAsked) {
        Object question = request.getParameter(KRADConstants.QUESTION_INST_ATTRIBUTE_NAME);
        if (question == null || !KRADConstants.DOCUMENT_SENSITIVE_DATA_QUESTION.equals(question)) {

            // question hasn't been asked, prompt to continue
            return this.performQuestionWithoutInput(mapping, form, request, response,
                    KRADConstants.DOCUMENT_SENSITIVE_DATA_QUESTION, getKualiConfigurationService()
                    .getPropertyValueAsString(RiceKeyConstants.QUESTION_SENSITIVE_DATA_DOCUMENT),
                    KRADConstants.CONFIRMATION_QUESTION, caller, context);
        }

        Object buttonClicked = request.getParameter(KRADConstants.QUESTION_CLICKED_BUTTON);
        if (question != null && KRADConstants.DOCUMENT_SENSITIVE_DATA_QUESTION.equals(question)) {
            // if no button clicked just reload the doc
            if (ConfirmationQuestion.NO.equals(buttonClicked)) {

                return mapping.findForward(RiceConstants.MAPPING_BASIC);
            }

            // answered yes, create session ticket so we not to ask question again if there are further question requests
            SessionTicket ticket = new SessionTicket(KRADConstants.SENSITIVE_DATA_QUESTION_SESSION_TICKET);
            ticket.setTicketContext(ticketContext);
            GlobalVariables.getUserSession().putSessionTicket(ticket);
        }
    }

    // return null to indicate processing should continue (no redirect)
    return null;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:68,代码来源:KualiDocumentActionBase.java


注:本文中的org.kuali.rice.krad.util.KRADConstants.SENSITIVE_DATA_QUESTION_SESSION_TICKET属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。