@Test public void testTypeCorrection() throws Exception { MetadataFactory mf = new MetadataFactory(null, 1, "x", SystemMetadata.getInstance().getRuntimeTypeMap(), new Properties(), null); Table t = mf.addTable("y"); mf.addColumn("test", "string", t); mf.addColumn("array", "string[]", t); Datatype unknown = new Datatype(); unknown.setName("unknown"); Column col = mf.addColumn("arg", "string", t); col.setDatatype(unknown, false, 0); MetadataFactory mf1 = UnitTestUtil.helpSerialize(mf); Column column = mf1.getSchema().getTable("y").getColumns().get(0); Datatype dt = column.getDatatype(); assertNotSame(mf.getDataTypes().get(dt.getName()), column.getDatatype()); assertEquals(1, mf1.getSchema().getTable("y").getColumns().get(1).getArrayDimensions()); mf1.correctDatatypes(mf.getDataTypes()); assertSame(mf.getDataTypes().get(dt.getName()), column.getDatatype()); assertEquals(1, mf1.getSchema().getTable("y").getColumns().get(1).getArrayDimensions()); }
@Override public String getName(Object metadataID) throws TeiidComponentException, QueryMetadataException { AbstractMetadataRecord metadataRecord = (AbstractMetadataRecord) metadataID; return metadataRecord.getName(); }
TransformationMetadata extends BasicQueryMetadata implements Serializable { @Override public String getName(Object metadataID) throws TeiidComponentException, QueryMetadataException { AbstractMetadataRecord metadataRecord = (AbstractMetadataRecord) metadataID; return metadataRecord.getName(); } }
TransformationMetadata extends BasicQueryMetadata implements Serializable { @Override public String getName(Object metadataID) throws TeiidComponentException, QueryMetadataException { AbstractMetadataRecord metadataRecord = (AbstractMetadataRecord) metadataID; return metadataRecord.getName(); } TransformationMetadata(VDBMetaData vdbMetadata, final CompositeMetadataStore store, Map<String, VDBResources.Resource> vdbEntries, FunctionTree systemFunctions, Collection<FunctionTree> functionTrees); private  TransformationMetadata(final CompositeMetadataStore store, FunctionLibrary functionLibrary); }
TransformationMetadata extends BasicQueryMetadata implements Serializable { @Override public String getName(Object metadataID) throws TeiidComponentException, QueryMetadataException { AbstractMetadataRecord metadataRecord = (AbstractMetadataRecord) metadataID; return metadataRecord.getName(); } TransformationMetadata(VDBMetaData vdbMetadata, final CompositeMetadataStore store, Map<String, VDBResources.Resource> vdbEntries, FunctionTree systemFunctions, Collection<FunctionTree> functionTrees); private  TransformationMetadata(final CompositeMetadataStore store, FunctionLibrary functionLibrary); Column getElementID(final String elementName); static Column getColumn(final String elementName, Table table,
            String shortElementName); Table getGroupID(final String groupName); Collection<String> getGroupsForPartialName(final String partialGroupName); Object getModelID(final Object groupOrElementID); String getFullName(final Object metadataID); @Override String getName(Object metadataID); List<Column> getElementIDsInGroupID(final Object groupID); Object getGroupIDForElementID(final Object elementID); boolean hasProcedure(String name); StoredProcedureInfo getStoredProcedureInfoForProcedure(final String name); String getElementRuntimeTypeName(final Object elementID); String getDefaultValue(final Object elementID); Object getMinimumValue(final Object elementID); Object getMaximumValue(final Object elementID); boolean isVirtualGroup(final Object groupID); boolean isProcedure(final Object groupID); boolean isVirtualModel(final Object modelID); QueryNode getVirtualPlan(final Object groupID); String getInsertPlan(final Object groupID); String getUpdatePlan(final Object groupID); String getDeletePlan(final Object groupID); boolean modelSupports(final Object modelID, final int modelConstant); boolean groupSupports(final Object groupID, final int groupConstant); boolean elementSupports(final Object elementID, final int elementConstant); int getMaxSetSize(final Object modelID); Collection<KeyRecord> getIndexesInGroup(final Object groupID); Collection<KeyRecord> getUniqueKeysInGroup(final Object groupID); Collection<ForeignKey> getForeignKeysInGroup(final Object groupID); Object getPrimaryKeyIDForForeignKeyID(final Object foreignKeyID); Collection<KeyRecord> getAccessPatternsInGroup(final Object groupID); List<Column> getElementIDsInIndex(final Object index); List<Column> getElementIDsInKey(final Object key); List<Column> getElementIDsInAccessPattern(final Object accessPattern); boolean hasMaterialization(final Object groupID); Object getMaterialization(final Object groupID); Object getMaterializationStage(final Object groupID); String getVirtualDatabaseName(); VDBMetaData getVdbMetaData(); @Override float getCardinality(final Object groupID); String getNameInSource(final Object metadataID); int getElementLength(final Object elementID); int getPosition(final Object elementID); int getPrecision(final Object elementID); int getRadix(final Object elementID); String getFormat(Object elementID); int getScale(final Object elementID); @Override float getDistinctValues(final Object elementID); @Override float getNullValues(final Object elementID); String getNativeType(final Object elementID); Properties getExtensionProperties(final Object metadataID); @Override String getExtensionProperty(Object metadataID, String key, boolean checkUnqualified); byte[] getBinaryVDBResource(String resourcePath); ClobImpl getVDBResourceAsClob(String resourcePath); SQLXMLImpl getVDBResourceAsSQLXML(String resourcePath); BlobImpl getVDBResourceAsBlob(String resourcePath); String getCharacterVDBResource(String resourcePath); CompositeMetadataStore getMetadataStore(); String[] getVDBResourcePaths(); @Override Object addToMetadataCache(Object metadataID, String key, Object value); @Override Object getFromMetadataCache(Object metadataID, String key); @Override FunctionLibrary getFunctionLibrary(); @Override Object getPrimaryKey(Object metadataID); @Override TransformationMetadata getDesignTimeMetadata(); @Override Set<String> getImportedModels(); @Override ScriptEngine getScriptEngineDirect(String language); @Override boolean isVariadic(Object metadataID); @Override Schema getModelID(String modelName); @Override List<Schema> getModelIDs(); void setPolicies(Map<String, DataPolicyMetadata> policies); Map<String, DataPolicyMetadata> getPolicies(); @Override boolean useOutputName(); void setUseOutputNames(boolean useOutputNames); @Override boolean widenComparisonToString(); void setWidenComparisonToString(boolean widenComparisonToString); void setHiddenResolvable(boolean hiddenResolvable); @Override Class<?> getDataTypeClass(String typeOrDomainName); @Override boolean isEnvAllowed(); void setAllowENV(boolean b); @Override boolean isLongRanks(); void setLongRanks(boolean longRanks); @Override FunctionMethod getPushdownFunction(Object modelID, String fullName); }
TransformationMetadata extends BasicQueryMetadata implements Serializable { @Override public String getName(Object metadataID) throws TeiidComponentException, QueryMetadataException { AbstractMetadataRecord metadataRecord = (AbstractMetadataRecord) metadataID; return metadataRecord.getName(); } TransformationMetadata(VDBMetaData vdbMetadata, final CompositeMetadataStore store, Map<String, VDBResources.Resource> vdbEntries, FunctionTree systemFunctions, Collection<FunctionTree> functionTrees); private  TransformationMetadata(final CompositeMetadataStore store, FunctionLibrary functionLibrary); Column getElementID(final String elementName); static Column getColumn(final String elementName, Table table,
            String shortElementName); Table getGroupID(final String groupName); Collection<String> getGroupsForPartialName(final String partialGroupName); Object getModelID(final Object groupOrElementID); String getFullName(final Object metadataID); @Override String getName(Object metadataID); List<Column> getElementIDsInGroupID(final Object groupID); Object getGroupIDForElementID(final Object elementID); boolean hasProcedure(String name); StoredProcedureInfo getStoredProcedureInfoForProcedure(final String name); String getElementRuntimeTypeName(final Object elementID); String getDefaultValue(final Object elementID); Object getMinimumValue(final Object elementID); Object getMaximumValue(final Object elementID); boolean isVirtualGroup(final Object groupID); boolean isProcedure(final Object groupID); boolean isVirtualModel(final Object modelID); QueryNode getVirtualPlan(final Object groupID); String getInsertPlan(final Object groupID); String getUpdatePlan(final Object groupID); String getDeletePlan(final Object groupID); boolean modelSupports(final Object modelID, final int modelConstant); boolean groupSupports(final Object groupID, final int groupConstant); boolean elementSupports(final Object elementID, final int elementConstant); int getMaxSetSize(final Object modelID); Collection<KeyRecord> getIndexesInGroup(final Object groupID); Collection<KeyRecord> getUniqueKeysInGroup(final Object groupID); Collection<ForeignKey> getForeignKeysInGroup(final Object groupID); Object getPrimaryKeyIDForForeignKeyID(final Object foreignKeyID); Collection<KeyRecord> getAccessPatternsInGroup(final Object groupID); List<Column> getElementIDsInIndex(final Object index); List<Column> getElementIDsInKey(final Object key); List<Column> getElementIDsInAccessPattern(final Object accessPattern); boolean hasMaterialization(final Object groupID); Object getMaterialization(final Object groupID); Object getMaterializationStage(final Object groupID); String getVirtualDatabaseName(); VDBMetaData getVdbMetaData(); @Override float getCardinality(final Object groupID); String getNameInSource(final Object metadataID); int getElementLength(final Object elementID); int getPosition(final Object elementID); int getPrecision(final Object elementID); int getRadix(final Object elementID); String getFormat(Object elementID); int getScale(final Object elementID); @Override float getDistinctValues(final Object elementID); @Override float getNullValues(final Object elementID); String getNativeType(final Object elementID); Properties getExtensionProperties(final Object metadataID); @Override String getExtensionProperty(Object metadataID, String key, boolean checkUnqualified); byte[] getBinaryVDBResource(String resourcePath); ClobImpl getVDBResourceAsClob(String resourcePath); SQLXMLImpl getVDBResourceAsSQLXML(String resourcePath); BlobImpl getVDBResourceAsBlob(String resourcePath); String getCharacterVDBResource(String resourcePath); CompositeMetadataStore getMetadataStore(); String[] getVDBResourcePaths(); @Override Object addToMetadataCache(Object metadataID, String key, Object value); @Override Object getFromMetadataCache(Object metadataID, String key); @Override FunctionLibrary getFunctionLibrary(); @Override Object getPrimaryKey(Object metadataID); @Override TransformationMetadata getDesignTimeMetadata(); @Override Set<String> getImportedModels(); @Override ScriptEngine getScriptEngineDirect(String language); @Override boolean isVariadic(Object metadataID); @Override Schema getModelID(String modelName); @Override List<Schema> getModelIDs(); void setPolicies(Map<String, DataPolicyMetadata> policies); Map<String, DataPolicyMetadata> getPolicies(); @Override boolean useOutputName(); void setUseOutputNames(boolean useOutputNames); @Override boolean widenComparisonToString(); void setWidenComparisonToString(boolean widenComparisonToString); void setHiddenResolvable(boolean hiddenResolvable); @Override Class<?> getDataTypeClass(String typeOrDomainName); @Override boolean isEnvAllowed(); void setAllowENV(boolean b); @Override boolean isLongRanks(); void setLongRanks(boolean longRanks); @Override FunctionMethod getPushdownFunction(Object modelID, String fullName); static final String ALLOWED_LANGUAGES; static final char DELIMITER_CHAR; static final String DELIMITER_STRING; static String NOT_EXISTS_MESSAGE; static Properties EMPTY_PROPS; }