public boolean isMerged() { return this.table.getProperty(MongoDBMetadataProcessor.MERGE, false) != null; }
public static boolean isEmbeddable(Table tbl) { return Boolean.parseBoolean(tbl.getProperty(MongoDBMetadataProcessor.EMBEDDABLE, false)); }
private static String getEntityTypeName(Table t, boolean preserveEntityTypeName) { String entityTypeName = t.getName(); if (preserveEntityTypeName && t.getProperty(ODataMetadataProcessor.ENTITY_TYPE, false) != null) { entityTypeName = t.getProperty(ODataMetadataProcessor.ENTITY_TYPE, false); } return entityTypeName; }
@Override public void visit(NamedTable obj) { this.table = obj.getMetadataObject(); this.xlsPath = this.table.getProperty(ExcelMetadataProcessor.FILE, false); this.sheetName = this.table.getSourceName(); String firstRow = this.table.getProperty(ExcelMetadataProcessor.FIRST_DATA_ROW_NUMBER, false); if (firstRow != null) { // -1 make it zero based index this.firstDataRowNumber = Integer.parseInt(firstRow)-1; } }
static boolean isNavigationType(Table table) { ODataType type = ODataType.valueOf(table.getProperty(ODataMetadataProcessor.ODATA_TYPE, false)); return type == ODataType.NAVIGATION || type == ODataType.NAVIGATION_COLLECTION; }
Table getTableWithEntityType(Schema schema, String entityType) { for (Table t:schema.getTables().values()) { if (entityType.equals(t.getProperty(ODataMetadataProcessor.ENTITY_TYPE, false))) { return t; } } return null; }
static boolean isCollection(Table table) { ODataType type = ODataType.valueOf(table.getProperty(ODataMetadataProcessor.ODATA_TYPE, false)); return type == ODataType.ENTITY_COLLECTION || type == ODataType.COMPLEX_COLLECTION || type == ODataType.NAVIGATION_COLLECTION; }
static boolean isEntitySet(Table table) { ODataType type = ODataType.valueOf(table.getProperty(ODataMetadataProcessor.ODATA_TYPE, false)); return type == ODataType.ENTITY_COLLECTION; }
static boolean isComplexType(Table table) { ODataType type = ODataType.valueOf(table.getProperty(ODataMetadataProcessor.ODATA_TYPE, false)); return type == ODataType.COMPLEX || type == ODataType.COMPLEX_COLLECTION; }
public int resetPendingJob(final VDBMetaData vdb, final Table table, String nodeName){ try { String statusTable = table.getProperty(MaterializationMetadataRepository.MATVIEW_STATUS_TABLE, false); String updateStatusTable = "UPDATE "+statusTable+" SET LOADSTATE='NEEDS_LOADING' " + "WHERE LOADSTATE = 'LOADING' AND NODENAME = '"+nodeName+"' " + "AND NAME = '"+table.getName()+"'"; List<Map<String, String>> results = executeQuery(vdb, updateStatusTable); String count = results.get(0).get("update-count"); return Integer.parseInt(count); } catch (SQLException e) { LogManager.logWarning(LogConstants.CTX_MATVIEWS, e, e.getMessage()); } return 0; }
@Override public void visit(NamedTable obj) { try { table = obj.getMetadataObject(); String supportsQuery = table.getProperty(Constants.SUPPORTS_QUERY, true); objectSupportsRetrieve = Boolean.valueOf(table.getProperty(Constants.SUPPORTS_RETRIEVE, true)); if (supportsQuery != null && !Boolean.valueOf(supportsQuery)) { throw new TranslatorException(table.getSourceName() + " " + SalesForcePlugin.Util.getString("CriteriaVisitor.query.not.supported")); //$NON-NLS-1$ //$NON-NLS-2$ } loadColumnMetadata(obj); } catch (TranslatorException ce) { exceptions.add(ce); } }
@Override public void visit(NamedTable obj) { //since this is hint driven we'll assume that it is used selectively if (!allowed.contains(obj.getMetadataObject().getSourceName()) && !Boolean.valueOf(obj.getMetadataObject().getProperty(SalesForceMetadataProcessor.TABLE_CUSTOM, false))) { usePkChunking = false; } }
private boolean isTVF(TableReference table) { if (table instanceof NamedTable) { String value = ((NamedTable)table).getMetadataObject().getProperty(PIMetadataProcessor.TVF, false); return Boolean.parseBoolean(value); } else if (table instanceof NamedProcedureCall) { String value = ((NamedProcedureCall)table).getCall().getMetadataObject().getProperty(PIMetadataProcessor.TVF, false); return Boolean.parseBoolean(value); } return false; }
@Override public void process(Table table) { if (table.getMaterializedTable() == null) { return; } String remove = table.getProperty(MaterializationMetadataRepository.ON_VDB_DROP_SCRIPT, false); if (remove != null) { try { executeQuery(vdb, remove); } catch (SQLException e) { LogManager.logWarning(LogConstants.CTX_MATVIEWS, e, e.getMessage()); } } } });
public Table getMergeTable() throws TranslatorException { String tblName = this.table.getProperty(MongoDBMetadataProcessor.MERGE, false); if (tblName == null) { return null; } Table mergeTable = this.metadata.getTable(this.table.getParent().getName(), tblName); return mergeTable; }
private static void removeTableOption(String key, Table table) { if (table.getProperty(key, false) != null) { table.setProperty(key, null); } removeCommonProperty(key, table); if (key.equals(DDLConstants.MATERIALIZED)) { table.setMaterialized(false); } if (key.equals(DDLConstants.MATERIALIZED_TABLE)) { table.setMaterializedTable(null); } if (key.equals(DDLConstants.UPDATABLE)) { table.setSupportsUpdate(false); } if (key.equals(DDLConstants.CARDINALITY)) { table.setCardinality(-1); } }
private Table getEntityTable(MetadataFactory mf, EdmEntityType toEntity) throws TranslatorException { for (Table t:mf.getSchema().getTables().values()) { if (t.getProperty(ENTITY_TYPE, false).equals(toEntity.getFullyQualifiedTypeName())){ return t; } } throw new TranslatorException(ODataPlugin.Util.gs(ODataPlugin.Event.TEIID17004, toEntity.getFullyQualifiedTypeName())); }
@Test public void testAlterTableModifyOptions() throws Exception { String ddl = "CREATE FOREIGN TABLE G1( e1 integer, e2 varchar, e3 date) OPTIONS(CARDINALITY 12, FOO 'BAR');" + "ALTER FOREIGN TABLE G1 OPTIONS(SET CARDINALITY 24);" + "ALTER FOREIGN TABLE G1 OPTIONS(SET FOO 'BARBAR');"; Schema s = helpParse(ddl, "model").getSchema(); Map<String, Table> tableMap = s.getTables(); assertTrue("Table not found", tableMap.containsKey("G1")); Table table = tableMap.get("G1"); assertEquals(24, table.getCardinality()); assertEquals("BARBAR", table.getProperty("FOO", false)); }
@Test public void testAlterTableDropOptions() throws Exception { String ddl = "CREATE FOREIGN TABLE G1( e1 integer, e2 varchar, e3 date) OPTIONS(CARDINALITY 12, FOO 'BAR');" + "ALTER FOREIGN TABLE G1 OPTIONS(DROP CARDINALITY);" + "ALTER FOREIGN TABLE G1 OPTIONS(DROP FOO);"; Schema s = helpParse(ddl, "model").getSchema(); Map<String, Table> tableMap = s.getTables(); assertTrue("Table not found", tableMap.containsKey("G1")); Table table = tableMap.get("G1"); assertEquals(-1, table.getCardinality()); assertNull(table.getProperty("FOO", false)); }
@Test public void testAlterTableAddOptions() throws Exception { String ddl = "CREATE FOREIGN TABLE G1( e1 integer, e2 varchar, e3 date);" + "ALTER FOREIGN TABLE G1 OPTIONS(ADD CARDINALITY 12);" + "ALTER FOREIGN TABLE G1 OPTIONS(ADD FOO 'BAR');"; Schema s = helpParse(ddl, "model").getSchema(); Map<String, Table> tableMap = s.getTables(); assertTrue("Table not found", tableMap.containsKey("G1")); Table table = tableMap.get("G1"); assertEquals(12, table.getCardinality()); assertEquals("BAR", table.getProperty("FOO", false)); }