Java Code Examples for org.apache.atlas.AtlasErrorCode#ATTRIBUTE_NAME_INVALID
The following examples show how to use
org.apache.atlas.AtlasErrorCode#ATTRIBUTE_NAME_INVALID .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AtlasAbstractDefStoreV2.java From atlas with Apache License 2.0 | 6 votes |
public void validateType(AtlasBaseTypeDef typeDef) throws AtlasBaseException { if (!isValidName(typeDef.getName())) { throw new AtlasBaseException(AtlasErrorCode.TYPE_NAME_INVALID_FORMAT, typeDef.getName(), typeDef.getCategory().name()); } try { final boolean allowReservedKeywords = ApplicationProperties.get().getBoolean(ALLOW_RESERVED_KEYWORDS, true); if (!allowReservedKeywords && typeDef instanceof AtlasStructDef) { final List<AtlasStructDef.AtlasAttributeDef> attributeDefs = ((AtlasStructDef) typeDef).getAttributeDefs(); for (AtlasStructDef.AtlasAttributeDef attrDef : attributeDefs) { if (AtlasDSL.Parser.isKeyword(attrDef.getName())) { throw new AtlasBaseException(AtlasErrorCode.ATTRIBUTE_NAME_INVALID, attrDef.getName(), typeDef.getCategory().name()); } } } } catch (AtlasException e) { LOG.error("Exception while loading configuration ", e); throw new AtlasBaseException(AtlasErrorCode.INTERNAL_ERROR, "Could not load configuration"); } }
Example 2
Source File: AtlasAbstractDefStoreV1.java From incubator-atlas with Apache License 2.0 | 6 votes |
public void validateType(AtlasBaseTypeDef typeDef) throws AtlasBaseException { if (!isValidName(typeDef.getName())) { throw new AtlasBaseException(AtlasErrorCode.TYPE_NAME_INVALID_FORMAT, typeDef.getName(), typeDef.getCategory().name()); } try { final boolean allowReservedKeywords = ApplicationProperties.get().getBoolean(ALLOW_RESERVED_KEYWORDS, true); if (!allowReservedKeywords && typeDef instanceof AtlasStructDef) { final List<AtlasStructDef.AtlasAttributeDef> attributeDefs = ((AtlasStructDef) typeDef).getAttributeDefs(); for (AtlasStructDef.AtlasAttributeDef attrDef : attributeDefs) { if (QueryParser.isKeyword(attrDef.getName())) { throw new AtlasBaseException(AtlasErrorCode.ATTRIBUTE_NAME_INVALID, attrDef.getName(), typeDef.getCategory().name()); } } } } catch (AtlasException e) { LOG.error("Exception while loading configuration ", e); throw new AtlasBaseException(AtlasErrorCode.INTERNAL_ERROR, "Could not load configuration"); } }