void restore() throws QueryResolverException, QueryValidatorException, TeiidComponentException {
if (this.objectsAccessed != null) {
return;
}
VDBMetaData vdb = DQPWorkContext.getWorkContext().getVDB();
TransformationMetadata tm = vdb.getAttachment(TransformationMetadata.class);
TempTableStore globalStore = vdb.getAttachment(TempTableStore.class);
if (!externalNames.isEmpty()) {
this.objectsAccessed = new HashSet<Object>(externalNames.size());
for (List<String> key : this.externalNames) {
if (key.size() == 1) {
String matTableName = key.get(0);
TempMetadataID id = globalStore.getMetadataStore().getTempGroupID(matTableName);
if (id == null) {
//if the id is null, then create a local instance
String viewFullName = matTableName.substring(RelationalPlanner.MAT_PREFIX.length());
id = globalStore.getGlobalTempTableMetadataId(tm.getGroupID(viewFullName), tm);
}
this.objectsAccessed.add(id);
} else {
Schema s = tm.getMetadataStore().getSchema(key.get(0).toUpperCase());
Modifiable m = s.getTables().get(key.get(1).toUpperCase());
if (m == null) {
m = s.getProcedures().get(key.get(1).toUpperCase());
}
if (m != null) {