private static TransformationMetadata buildTransformationMetaData(VDBMetaData vdb, LinkedHashMap<String, Resource> visibilityMap, MetadataStoreGroup stores, UDFMetaData udf, FunctionTree systemFunctions, MetadataStore[] additionalStores) {
Collection <FunctionTree> udfs = new ArrayList<FunctionTree>();
if (udf != null) {
for (Map.Entry<String, Collection<FunctionMethod>> entry : udf.getFunctions().entrySet()) {
udfs.add(new FunctionTree(entry.getKey(), new UDFSource(entry.getValue()), true));
}
}
CompositeMetadataStore compositeStore = new CompositeMetadataStore(stores.getStores());
for (MetadataStore s:additionalStores) {
compositeStore.addMetadataStore(s);
for (Schema schema:s.getSchemas().values()) {
if (!schema.getFunctions().isEmpty()) {
udfs.add(new FunctionTree(schema.getName(), new UDFSource(schema.getFunctions().values()), true));
}
}
}
TransformationMetadata metadata = new TransformationMetadata(vdb, compositeStore, visibilityMap, systemFunctions, udfs);