public void validate() { CheckConditions.checkCondition( !RESERVED_FIELD_NAME.contains(getName()), new IllegalMetaClassException(String.format("Reserved meta field name %s!", getName()))); CheckConditions.checkCondition( !StringUtils.isNullOrEmpty(getName()), new IllegalMetaClassException("meta field name can not be empty")); CheckConditions.checkCondition( !StringUtils.isNullOrEmpty(getName().trim()), new IllegalMetaClassException("meta field name can not be empty")); CheckConditions.checkCondition( org.apache.commons.lang.StringUtils.containsNone( getName(), CMSConsts.INVALID_META_FIELD_NAME_CHARACTERS), new IllegalMetaClassException( "meta field " + name + " cannot contains invalid characters: " + Arrays.toString(CMSConsts.INVALID_META_FIELD_NAME_CHARACTERS))); if (!isInternal()) { CheckConditions.checkCondition( !INVALID_PATTERN.matcher(getName()).matches(), new IllegalMetaClassException( "meta field name can not start with regex _[A-Za-z0-9]: " + getName())); } }
protected void validateDbName() { if (!StringUtils.isNullOrEmpty(getDbName())) { throw new IllegalMetaClassException(getName() + ": dbName must NOT be provided"); } if (!StringUtils.isNullOrEmpty(getValueDbName())) { throw new IllegalMetaClassException(getName() + ": valueDbName must NOT be provided"); } if (!StringUtils.isNullOrEmpty(getFlattenValueDbName())) { throw new IllegalMetaClassException(getName() + ": flattenValueDbName must NOT be provided"); } }