当前位置: 首页>>代码示例>>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;未经允许,请勿转载。