use of com.helger.phive.engine.vom.v10.VOMOptionType in project phive by phax.
the class VOM1Converter method _createExecutorEdifact.
@Nonnull
private IValidationExecutor<IValidationSourceXML> _createExecutorEdifact(@Nonnull final VOMEdifactType aEdifact) {
final IEdifactValidationExecutorProviderXML aProvider = m_aComplianceSettings.getEdifactValidationExecutorProviderXML();
final StringMap aOptions = new StringMap();
for (final VOMOptionType aOption : aEdifact.getOption()) aOptions.put(aOption.getName(), aOption.getValue());
LOGGER.info("Trying to resolve Edifact artifact '" + aEdifact.getDirectory() + '/' + aEdifact.getMessage() + "'");
final IValidationExecutor<IValidationSourceXML> aVES = aProvider.createValidationExecutor(aEdifact.getDirectory(), aEdifact.getMessage(), aOptions);
if (aVES == null)
throw new IllegalStateException("Failed to resolve Edifact artifact '" + aEdifact.getDirectory() + '/' + aEdifact.getMessage() + "'");
return aVES;
}
use of com.helger.phive.engine.vom.v10.VOMOptionType in project phive by phax.
the class VOM1Validator method validateOptions.
public static void validateOptions(@Nonnull final String sXPath, @Nonnull final String sLocalXPath, @Nullable final List<VOMOptionType> aOptions, @Nonnull final ErrorList aErrorList) {
if (aOptions != null) {
int nIndex = 1;
final ICommonsSet<String> aNames = new CommonsHashSet<>();
for (final VOMOptionType aOption : aOptions) {
// Name must be neither null nor empty
final String sName = aOption.getName();
if (StringHelper.hasNoText(sName))
aErrorList.add(_createError(EVOMErrorCode.REQUIRED_NOT_EMPTY, sXPath + sLocalXPath + '[' + nIndex + "]/name"));
else if (!aNames.add(sName))
aErrorList.add(_createError(EVOMErrorCode.OPTION_NAME_NOT_UNIQUE.getErrorMessage(sName, sXPath), sXPath + '[' + nIndex + "]/name"));
// Value may be empty
final String sValue = aOption.getValue();
if (sValue == null)
aErrorList.add(_createError(EVOMErrorCode.REQUIRED, sXPath + sLocalXPath + '[' + nIndex + "]/value"));
nIndex++;
}
}
}
Aggregations