本文整理汇总了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);
}
示例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;
}
}
示例3: isTooLong
private boolean isTooLong(String paramValue) {
return paramValue != null
&& paramValue.length() > ADMValidator.LENGTH_DESCRIPTION;
}
示例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);
}
}
示例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;
}