private boolean canChangePrimaryKey(final SetClauseList update) { if (rowId == null) { Set<ElementSymbol> affectedColumns = new HashSet<ElementSymbol>(update.getClauseMap().keySet()); affectedColumns.retainAll(columns.subList(0, tree.getKeyLength())); if (!affectedColumns.isEmpty()) { return true; } } return false; }
private boolean canChangePrimaryKey(final SetClauseList update) { if (rowId == null) { Set<ElementSymbol> affectedColumns = new HashSet<ElementSymbol>(update.getClauseMap().keySet()); affectedColumns.retainAll(columns.subList(0, tree.getKeyLength())); if (!affectedColumns.isEmpty()) { return true; } } return false; }
private boolean canChangePrimaryKey(final SetClauseList update) { if (rowId == null) { Set<ElementSymbol> affectedColumns = new HashSet<ElementSymbol>(update.getClauseMap().keySet()); affectedColumns.retainAll(columns.subList(0, tree.getKeyLength())); if (!affectedColumns.isEmpty()) { return true; } } return false; }
@Override protected void tuplePassed(List tuple) throws BlockedException, TeiidComponentException, TeiidProcessingException { List<Object> newTuple = new ArrayList<Object>(tuple); for (Map.Entry<ElementSymbol, Expression> entry : update.getClauseMap().entrySet()) { newTuple.set(columnMap.get(entry.getKey()), eval.evaluate(entry.getValue(), tuple)); } validateNotNull(newTuple); if (primaryKeyChangePossible) { browser.removed(); deleteTuple(tuple); if (changeSet == null) { changeSet = bm.createTupleBuffer(columns, sessionID, TupleSourceType.PROCESSOR); } changeSet.addTuple(newTuple); } else { browser.update(newTuple); } }
@Override protected void tuplePassed(List tuple) throws BlockedException, TeiidComponentException, TeiidProcessingException { List<Object> newTuple = new ArrayList<Object>(tuple); for (Map.Entry<ElementSymbol, Expression> entry : update.getClauseMap().entrySet()) { newTuple.set(columnMap.get(entry.getKey()), eval.evaluate(entry.getValue(), tuple)); } validateNotNull(newTuple); if (primaryKeyChangePossible) { browser.removed(); deleteTuple(tuple); if (changeSet == null) { changeSet = bm.createTupleBuffer(columns, sessionID, TupleSourceType.PROCESSOR); } changeSet.addTuple(newTuple); } else { browser.update(newTuple); } }
@Override protected void tuplePassed(List tuple) throws BlockedException, TeiidComponentException, TeiidProcessingException { List<Object> newTuple = new ArrayList<Object>(tuple); for (Map.Entry<ElementSymbol, Expression> entry : update.getClauseMap().entrySet()) { newTuple.set(columnMap.get(entry.getKey()), eval.evaluate(entry.getValue(), tuple)); } validateNotNull(newTuple); if (primaryKeyChangePossible) { browser.removed(); deleteTuple(tuple); if (changeSet == null) { changeSet = bm.createTupleBuffer(columns, sessionID, TupleSourceType.PROCESSOR); } changeSet.addTuple(newTuple); } else { browser.update(newTuple); } }
/** * Validate update entitlements */ protected void validateEntitlements(Update obj) { // Check that all elements used in criteria have read permission HashSet<ElementSymbol> elements = new HashSet<ElementSymbol>(); ElementCollectorVisitor.getElements(obj.getChangeList().getClauseMap().values(), elements); if (obj.getCriteria() != null) { ElementCollectorVisitor.getElements(obj.getCriteria(), elements); } validateEntitlements( elements, DataPolicy.PermissionType.READ, Context.UPDATE); // The variables from the changes must be checked for UPDATE entitlement // validateEntitlements on all the variables used in the update. List<LanguageObject> updated = new LinkedList<LanguageObject>(); updated.add(obj.getGroup()); updated.addAll(obj.getChangeList().getClauseMap().keySet()); validateEntitlements(updated, DataPolicy.PermissionType.UPDATE, Context.UPDATE); }
/** * Validate update entitlements */ protected void validateEntitlements(Update obj) { // Check that all elements used in criteria have read permission HashSet<ElementSymbol> elements = new HashSet<ElementSymbol>(); ElementCollectorVisitor.getElements(obj.getChangeList().getClauseMap().values(), elements); if (obj.getCriteria() != null) { ElementCollectorVisitor.getElements(obj.getCriteria(), elements); } validateEntitlements( elements, DataPolicy.PermissionType.READ, Context.UPDATE); // The variables from the changes must be checked for UPDATE entitlement // validateEntitlements on all the variables used in the update. List<LanguageObject> updated = new LinkedList<LanguageObject>(); updated.add(obj.getGroup()); updated.addAll(obj.getChangeList().getClauseMap().keySet()); validateEntitlements(updated, DataPolicy.PermissionType.UPDATE, Context.UPDATE); }
/** * Validate update entitlements */ protected void validateEntitlements(Update obj) { // Check that all elements used in criteria have read permission HashSet<ElementSymbol> elements = new HashSet<ElementSymbol>(); ElementCollectorVisitor.getElements(obj.getChangeList().getClauseMap().values(), elements); if (obj.getCriteria() != null) { ElementCollectorVisitor.getElements(obj.getCriteria(), elements); } validateEntitlements( elements, DataPolicy.PermissionType.READ, Context.UPDATE); // The variables from the changes must be checked for UPDATE entitlement // validateEntitlements on all the variables used in the update. List<LanguageObject> updated = new LinkedList<LanguageObject>(); updated.add(obj.getGroup()); updated.addAll(obj.getChangeList().getClauseMap().keySet()); validateEntitlements(updated, DataPolicy.PermissionType.UPDATE, Context.UPDATE); }
Map<ElementSymbol, Expression> changing = update.getChangeList().getClauseMap();
Map<ElementSymbol, Expression> changing = update.getChangeList().getClauseMap();
Map<ElementSymbol, Expression> changing = update.getChangeList().getClauseMap();
@Override public Boolean requiresTransaction(boolean transactionalReads) { Boolean expressionRequires = SubqueryAwareRelationalNode.requiresTransaction(transactionalReads, ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(dynamicCommand.getSql())); if (expressionRequires != null && expressionRequires) { return true; } if (this.dynamicCommand.getUsing() != null) { Boolean setRequires = SubqueryAwareRelationalNode.requiresTransaction(transactionalReads, ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(this.dynamicCommand.getUsing().getClauseMap().values())); if (setRequires == null) { if (expressionRequires == null) { return true; } expressionRequires = null; } else if (setRequires) { return true; } } if ((dynamicCommand.getUpdatingModelCount() < 2 && transactionalReads) || dynamicCommand.getUpdatingModelCount() == 1) { return expressionRequires==null?true:null; } if (dynamicCommand.getUpdatingModelCount() > 1) { return true; } return expressionRequires; }
Map<ElementSymbol, Expression> map = null; Collection<ElementSymbol> elems = ElementCollectorVisitor.getElements(update.getConstraint(), true); Set<ElementSymbol> existing = setClauseList.getClauseMap().keySet(); for (ElementSymbol es : elems) { if (existing.contains(es)) {
Map<ElementSymbol, Expression> map = null; Collection<ElementSymbol> elems = ElementCollectorVisitor.getElements(update.getConstraint(), true); Set<ElementSymbol> existing = setClauseList.getClauseMap().keySet(); for (ElementSymbol es : elems) { if (existing.contains(es)) {
Boolean setRequires = SubqueryAwareRelationalNode.requiresTransaction(transactionalReads, ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(this.dynamicCommand.getUsing().getClauseMap().values())); if (setRequires == null) { if (expressionRequires == null) {
Boolean setRequires = SubqueryAwareRelationalNode.requiresTransaction(transactionalReads, ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(this.dynamicCommand.getUsing().getClauseMap().values())); if (setRequires == null) { if (expressionRequires == null) {
Map<ElementSymbol, Expression> map = null; Collection<ElementSymbol> elems = ElementCollectorVisitor.getElements(update.getConstraint(), true); Set<ElementSymbol> existing = setClauseList.getClauseMap().keySet(); for (ElementSymbol es : elems) { if (existing.contains(es)) {
Set<ElementSymbol> updateCols = update.getChangeList().getClauseMap().keySet(); if (!info.hasValidUpdateMapping(updateCols)) { handleValidationError(QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30376, updateCols), update);
Set<ElementSymbol> updateCols = update.getChangeList().getClauseMap().keySet(); if (!info.hasValidUpdateMapping(updateCols)) { handleValidationError(QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30376, updateCols), update);