@Override public ConfigurationNode visitDbEntity(DbEntity entity) { return entity.getDataMap(); }
public void dbEntityAdded(final DbEntity ent) { ent.getDataMap().addDbEntity(ent); addedDbEntities.add(ent); }
protected Collection<ObjEntity> getObjEntities() { return objEntity == null ? dbEntity.getDataMap().getMappedEntities(dbEntity) : Collections.singleton(objEntity); }
public void dbEntityRemoved(final DbEntity ent) { ent.getDataMap().removeDbEntity(ent.getName()); removedDbEntities.add(ent); }
public Collection<ObjEntity> mappedObjEntities() { Collection<ObjEntity> objEntities = new HashSet<ObjEntity>(); MappingNamespace mns = getDataMap().getNamespace(); if (mns != null) { for (ObjEntity objEntity : mns.getObjEntities()) { if (equals(objEntity.getDbEntity())) { objEntities.add(objEntity); } } } return objEntities; }
@Override protected Entity getEntity() { DbEntity dbEntity = getProjectController().getCurrentDbEntity(); if (dbEntity == null) { return null; } Iterator<ObjEntity> it = dbEntity.getDataMap().getMappedEntities(dbEntity).iterator(); if (!it.hasNext()) { return null; } return it.next(); }
/** * @since 1.2 */ @Override public void route(QueryRouter router, EntityResolver resolver, Query substitutedQuery) { router.route(router.engineForDataMap(dbEntity.getDataMap()), this, substitutedQuery); }
/** * @since 1.2 */ public void route(QueryRouter router, EntityResolver resolver, Query substitutedQuery) { router.route( router.engineForDataMap(dbEntity.getDataMap()), this, substitutedQuery); }
public void currentDbEntityChanged(EntityDisplayEvent e) { DbEntity entity = (DbEntity) e.getEntity(); if(entity.getDataMap().getMappedEntities(entity).isEmpty()) { toolBar.getComponentAtIndex(4).setEnabled(false); toolBar.getComponentAtIndex(5).setEnabled(false); } else { toolBar.getComponentAtIndex(4).setEnabled(true); toolBar.getComponentAtIndex(5).setEnabled(true); } } }
void addFlattenedInsert(DbEntity flattenedEntity, FlattenedArcKey flattenedInsertInfo) { InsertBatchQuery relationInsertQuery = (InsertBatchQuery) flattenedInsertQueries .get(flattenedEntity); if (relationInsertQuery == null) { relationInsertQuery = new InsertBatchQuery(flattenedEntity, 50); flattenedInsertQueries.put(flattenedEntity, relationInsertQuery); } DataNode node = parent.getDomain().lookupDataNode(flattenedEntity.getDataMap()); Map flattenedSnapshot = flattenedInsertInfo.buildJoinSnapshotForInsert(node); relationInsertQuery.add(flattenedSnapshot); }
@Override public String quotedName(DbAttribute attribute) { return quotedIdentifier(attribute.getEntity().getDataMap(), attribute.getName()); }
void addFlattenedDelete(DbEntity flattenedEntity, FlattenedArcKey flattenedDeleteInfo) { DeleteBatchQuery relationDeleteQuery = flattenedDeleteQueries.get(flattenedEntity); if (relationDeleteQuery == null) { Collection<DbAttribute> pk = flattenedEntity.getPrimaryKeys(); List<DbAttribute> pkList = pk instanceof List ? (List<DbAttribute>) pk : new ArrayList<>(pk); relationDeleteQuery = new DeleteBatchQuery(flattenedEntity, pkList, Collections.<String> emptySet(), 50); relationDeleteQuery.setUsingOptimisticLocking(false); flattenedDeleteQueries.put(flattenedEntity, relationDeleteQuery); } DataNode node = parent.getDomain().lookupDataNode(flattenedEntity.getDataMap()); List<Map<String, Object>> flattenedSnapshots = flattenedDeleteInfo.buildJoinSnapshotsForDelete(node); if (!flattenedSnapshots.isEmpty()) { for (Map<String, Object> flattenedSnapshot : flattenedSnapshots) { relationDeleteQuery.add(flattenedSnapshot); } } }
private boolean changeObjEntity(String path){ Object currentNode = getCurrentNode(path); if (currentNode instanceof DbEntity){ return false; } DbEntity lastEntity = ((DbRelationship) currentNode).getTargetEntity(); if(lastEntity == null) { return false; } Collection<ObjEntity> objEntities = ((DbRelationship) currentNode).getTargetEntity(). getDataMap().getMappedEntities(lastEntity); ObjEntity objectTarget = objEntities.isEmpty() ? null : objEntities.iterator().next(); model.getRelationship(row).setTargetEntityName(objectTarget); table.repaint(); return true; }
@Override public String quotedSourceName(DbJoin join) { DataMap dataMap = join.getSource().getEntity().getDataMap(); return quotedIdentifier(dataMap, join.getSourceName()); }
@Override public String quotedTargetName(DbJoin join) { DataMap dataMap = join.getTarget().getEntity().getDataMap(); return quotedIdentifier(dataMap, join.getTargetName()); }
@Override public String quotedFullyQualifiedName(DbEntity entity) { return quotedIdentifier(entity.getDataMap(), entity.getCatalog(), entity.getSchema(), entity.getName()); }
public void actionPerformed(ActionEvent e) { // Jump to DbEntity of the current ObjEntity DbEntity entity = mediator.getCurrentObjEntity().getDbEntity(); if (entity != null) { DataChannelDescriptor dom = (DataChannelDescriptor) mediator .getProject() .getRootNode(); mediator.fireDbEntityDisplayEvent(new EntityDisplayEvent( this, entity, entity.getDataMap(), dom)); } } });
/** * To simplify overriding this implementation checks whether there is a non-null * entity or procedure, and uses its DataMap. */ public DataMap getDataMap() { if (getObjEntity() != null) { return getObjEntity().getDataMap(); } if (getDbEntity() != null) { return getDbEntity().getDataMap(); } if (getProcedure() != null) { return getProcedure().getDataMap(); } return null; }
/** * To simplify overriding this implementation checks whether there is a non-null * entity or procedure, and uses its DataMap. */ public DataMap getDataMap() { if (getObjEntity() != null) { return getObjEntity().getDataMap(); } if (getDbEntity() != null) { return getDbEntity().getDataMap(); } if (getProcedure() != null) { return getProcedure().getDataMap(); } return null; }
@Override public void execute(MergerContext mergerContext) { for (ObjEntity objEntity : getEntity().mappedObjEntities()) { objEntity.getDataMap().removeObjEntity(objEntity.getName(), true); mergerContext.getDelegate().objEntityRemoved(objEntity); } getEntity().getDataMap().removeDbEntity(getEntity().getName(), true); mergerContext.getDelegate().dbEntityRemoved(getEntity()); } }