當前位置: 首頁>>代碼示例>>Java>>正文


Java ADMValidator.LENGTH_DESCRIPTION屬性代碼示例

本文整理匯總了Java中org.oscm.validator.ADMValidator.LENGTH_DESCRIPTION屬性的典型用法代碼示例。如果您正苦於以下問題:Java ADMValidator.LENGTH_DESCRIPTION屬性的具體用法?Java ADMValidator.LENGTH_DESCRIPTION怎麽用?Java ADMValidator.LENGTH_DESCRIPTION使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.oscm.validator.ADMValidator的用法示例。


在下文中一共展示了ADMValidator.LENGTH_DESCRIPTION屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: parameterIsValid_String_tooLong

@Test
public void parameterIsValid_String_tooLong() throws Exception {
    // given
    VOParameterDefinition parDefinition = createParDefinition("MyString",
            ParameterValueType.STRING, false, null, null);
    StringBuffer stringParameter = new StringBuffer();
    for (int i = 0; i < ADMValidator.LENGTH_DESCRIPTION + 4; i++) {
        stringParameter.append("C");
    }

    // when
    boolean parIsValid = ExternalParameterValidation.parameterIsValid(
            parDefinition, stringParameter.toString(), context);

    // then
    assertFalse("Parameter value was too long", parIsValid);
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:17,代碼來源:ValidateExternalParameterTest.java

示例2: parameterIsValid

public static boolean parameterIsValid(VOParameterDefinition parDefinition,
        String parValue, FacesContext context) {
    if (parDefinition == null) {
        return false;
    }
    ParameterValueType parValueType = parDefinition.getValueType();
    if (parValueType == null) {
        return false;
    }

    if (parValue == null
            || parValue.length() > ADMValidator.LENGTH_DESCRIPTION) {
        return false;
    } else if (parValue.length() == 0) {
        if (parDefinition.isMandatory()) {
            return false;
        } else {
            if (parValueType != ParameterValueType.ENUMERATION) {
                return true;
            } else {
                // A configured ENUM parameter must always have a value,
                // even if it's optional...
                return false;
            }
        }
    }

    switch (parValueType) {
    case BOOLEAN:
        return ADMValidator.isBoolean(parValue);
    case STRING:
        return true;
    case DURATION:
        return (DurationValidation.getDurationInMs(context, parValue) != null);
    case INTEGER:
        return integerIsValid(parDefinition, parValue);
    case LONG:
        return longIsValid(parDefinition, parValue);
    case ENUMERATION:
        return enumIsValid(parDefinition, parValue);
    default:
        return false;
    }
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:44,代碼來源:ExternalParameterValidation.java

示例3: isTooLong

private boolean isTooLong(String paramValue) {
    return paramValue != null
            && paramValue.length() > ADMValidator.LENGTH_DESCRIPTION;
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:4,代碼來源:DefaultParameterValidator.java

示例4: onMessage

public void onMessage(Message message) {

        if (!(message instanceof ObjectMessage)) {
            logger.logError(
                    LogMessageIdentifier.ERROR_RECEIVE_MESSAGE_INTERPRETED_FAILED,
                    String.valueOf(message));
            return;
        }

        logger.logDebug("Received object message from queue",
                Log4jLogger.SYSTEM_LOG);
        TriggerProcess process = null;
        try {
            // obtain the trigger process object
            ObjectMessage om = (ObjectMessage) message;
            Serializable messageObject = om.getObject();
            if (!(messageObject instanceof Long)) {
                throw new IllegalArgumentException(
                        "JMS message did not contain a valid key for the trigger process");
            }
            process = dm.getReference(TriggerProcess.class,
                    ((Long) messageObject).longValue());

            if (process.getTriggerDefinition().isSuspendProcess()
                    && process.getStatus() == TriggerProcessStatus.CANCELLED) {
                // do not send notification if the process was canceled in
                // the meantime and the trigger type operation was not completed
                if (isPreviousVersionInitial(process)) {
                    logger.logWarn(
                            Log4jLogger.SYSTEM_LOG,
                            LogMessageIdentifier.WARN_TRIGGER_PROCESS_ALREADY_CANCELED,
                            String.valueOf(process.getKey()));
                } else {
                    // otherwise notify external system.
                    handleCancelAction(process);
                }
                return;
            }

            if (process.getUser() != null) {
                dm.setCurrentUserKey(Long.valueOf(process.getUser().getKey()));
            }

            // Handle message according to specified notification type
            handleTriggerProcess(process);
        } catch (Throwable e) {
            // we cannot abort here, no exception can be thrown either. So just
            // log the exception and put the process to error state.
            logger.logError(Log4jLogger.SYSTEM_LOG, e,
                    LogMessageIdentifier.ERROR_EVALUATE_MESSAGE_FAILED);

            if (process != null) {
                process.setState(TriggerProcessStatus.ERROR);
                String reason = e.getMessage() == null ? e.toString() : e
                        .getMessage();
                if (reason != null
                        && reason.length() > ADMValidator.LENGTH_DESCRIPTION) {
                    reason = reason.substring(0,
                            ADMValidator.LENGTH_DESCRIPTION);
                }
                localizer.storeLocalizedResource("en", process.getKey(),
                        LocalizedObjectTypes.TRIGGER_PROCESS_REASON, reason);
            }
        } finally {
            dm.setCurrentUserKey(null);
        }
    }
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:67,代碼來源:TriggerProcessListener.java

示例5: getDescriptionLen

/**
 * Get the length for a field which contains a description.
 * 
 * @return the length for a field which contains a description.
 */
public int getDescriptionLen() {
    return ADMValidator.LENGTH_DESCRIPTION;
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:8,代碼來源:ApplicationBean.java


注:本文中的org.oscm.validator.ADMValidator.LENGTH_DESCRIPTION屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。