Examples of UpdateInfo


Examples of org.apache.jackrabbit.webdav.version.UpdateInfo

        update(uri, vUris, UpdateInfo.UPDATE_BY_VERSION, removeExisting, sessionInfo);
    }

    private void update(String uri, String[] updateSource, int updateType, boolean removeExisting, SessionInfo sessionInfo) throws RepositoryException {
        try {
            UpdateInfo uInfo;
            if (removeExisting) {
                Element uElem = UpdateInfo.createUpdateElement(updateSource, updateType, domFactory);
                DomUtil.addChildElement(uElem, ItemResourceConstants.XML_REMOVEEXISTING, ItemResourceConstants.NAMESPACE);
                uInfo = new UpdateInfo(uElem);
            } else {
                uInfo = new UpdateInfo(updateSource, updateType, new DavPropertyNameSet());
            }

            UpdateMethod method = new UpdateMethod(uri, uInfo);
            execute(method, sessionInfo);
        } catch (IOException e) {
View Full Code Here

Examples of org.apache.jackrabbit.webdav.version.UpdateInfo

        update(uri, vUris, UpdateInfo.UPDATE_BY_VERSION, removeExisting, sessionInfo);
    }

    private void update(String uri, String[] updateSource, int updateType, boolean removeExisting, SessionInfo sessionInfo) throws RepositoryException {
        try {
            UpdateInfo uInfo;
            if (removeExisting) {
                Element uElem = UpdateInfo.createUpdateElement(updateSource, updateType, domFactory);
                DomUtil.addChildElement(uElem, ItemResourceConstants.XML_REMOVEEXISTING, ItemResourceConstants.NAMESPACE);
                uInfo = new UpdateInfo(uElem);
            } else {
                uInfo = new UpdateInfo(updateSource, updateType, new DavPropertyNameSet());
            }

            UpdateMethod method = new UpdateMethod(uri, uInfo);
            execute(method, sessionInfo);
        } catch (IOException e) {
View Full Code Here

Examples of org.apache.jackrabbit.webdav.version.UpdateInfo

        update(uri, null, vUris, UpdateInfo.UPDATE_BY_VERSION, removeExisting, sessionInfo);
    }

    private void update(String uri, Path relPath, String[] updateSource, int updateType, boolean removeExisting, SessionInfo sessionInfo) throws RepositoryException {
        try {
            UpdateInfo uInfo;
            if (removeExisting || relPath != null) {
                Element uElem = UpdateInfo.createUpdateElement(updateSource, updateType, DomUtil.createDocument());
                if (removeExisting) {
                    DomUtil.addChildElement(uElem, JcrRemotingConstants.XML_REMOVEEXISTING, ItemResourceConstants.NAMESPACE);
                }
                if (relPath != null) {
                    DomUtil.addChildElement(uElem, JcrRemotingConstants.XML_RELPATH, ItemResourceConstants.NAMESPACE, getNamePathResolver(sessionInfo).getJCRPath(relPath));
                }

                uInfo = new UpdateInfo(uElem);
            } else {
                uInfo = new UpdateInfo(updateSource, updateType, new DavPropertyNameSet());
            }

            UpdateMethod method = new UpdateMethod(uri, uInfo);
            execute(method, sessionInfo);
        } catch (IOException e) {
View Full Code Here

Examples of org.teiid.query.validator.UpdateValidator.UpdateInfo

            if (group.getModelMetadataId() != null) {
              node.setProperty(Info.MODEL_ID, group.getModelMetadataId());
            }
            node.addGroup(group);
            if (nestedCommand != null) {
              UpdateInfo info = ProcedureContainerResolver.getUpdateInfo(group, metadata);
              if (info != null && info.getPartitionInfo() != null && !info.getPartitionInfo().isEmpty()) {
                node.setProperty(NodeConstants.Info.PARTITION_INFO, info.getPartitionInfo());
              }
              addNestedCommand(node, group, nestedCommand, nestedCommand, true);
            }
            parent.addLastChild(node);
        } else if(clause instanceof JoinPredicate) {
View Full Code Here

Examples of org.teiid.query.validator.UpdateValidator.UpdateInfo

        }
    return null;
  }
 
  public static UpdateInfo getUpdateInfo(GroupSymbol group, QueryMetadataInterface metadata, int type) throws QueryMetadataException, TeiidComponentException, QueryResolverException {
    UpdateInfo info = getUpdateInfo(group, metadata);
   
    if (info == null) {
      return null;
    }
     
      if ((info.isDeleteValidationError() && type == Command.TYPE_DELETE)
        || (info.isUpdateValidationError() && type == Command.TYPE_UPDATE)
        || (info.isInsertValidationError() && type == Command.TYPE_INSERT)) {
        String name = "Delete"; //$NON-NLS-1$
        if (type == Command.TYPE_UPDATE) {
          name = "Update"; //$NON-NLS-1$
        } else if (type == Command.TYPE_INSERT) {
          name = "Insert"; //$NON-NLS-1$
View Full Code Here

Examples of org.teiid.query.validator.UpdateValidator.UpdateInfo

        }
        return storedProcedure;
    }

  private Insert rewriteInsert(Insert insert) throws TeiidComponentException, TeiidProcessingException{
    UpdateInfo info = insert.getUpdateInfo();
    if (info != null && info.isInherentInsert()) {
      //TODO: update error messages
      UpdateMapping mapping = info.findInsertUpdateMapping(insert, true);
      if (mapping == null) {
        throw new QueryValidatorException(QueryPlugin.Util.getString("ValidationVisitor.nonUpdatable", insert.getVariables())); //$NON-NLS-1$
      }
      Map<ElementSymbol, ElementSymbol> symbolMap = mapping.getUpdatableViewSymbols();
      List<ElementSymbol> mappedSymbols = new ArrayList<ElementSymbol>(insert.getVariables().size());
View Full Code Here

Examples of org.teiid.query.validator.UpdateValidator.UpdateInfo

            }
        }
    }

  private Command rewriteUpdate(Update update) throws TeiidComponentException, TeiidProcessingException{
    UpdateInfo info = update.getUpdateInfo();
    if (info != null && info.isInherentUpdate()) {
      if (!info.getUnionBranches().isEmpty()) {
        List<Command> batchedUpdates = new ArrayList<Command>(info.getUnionBranches().size() + 1);
        for (UpdateInfo branchInfo : info.getUnionBranches()) {
          batchedUpdates.add(rewriteInherentUpdate((Update)update.clone(), branchInfo));
        }
        batchedUpdates.add(0, rewriteInherentUpdate(update, info));
        return new BatchedUpdateCommand(batchedUpdates);
      }
View Full Code Here

Examples of org.teiid.query.validator.UpdateValidator.UpdateInfo

       
        return true;
    }

  private Command rewriteDelete(Delete delete) throws TeiidComponentException, TeiidProcessingException{
    UpdateInfo info = delete.getUpdateInfo();
    if (info != null && info.isInherentDelete()) {
      if (!info.getUnionBranches().isEmpty()) {
        List<Command> batchedUpdates = new ArrayList<Command>(info.getUnionBranches().size() + 1);
        for (UpdateInfo branchInfo : info.getUnionBranches()) {
          batchedUpdates.add(rewriteInherentDelete((Delete)delete.clone(), branchInfo));
        }
        batchedUpdates.add(0, rewriteInherentDelete(delete, info));
        return new BatchedUpdateCommand(batchedUpdates);
      }
View Full Code Here

Examples of org.teiid.query.validator.UpdateValidator.UpdateInfo

        String insertPlan = qmi.getInsertPlan(virtualGroup.getMetadataID());

              List<ElementSymbol> elements = ResolverUtil.resolveElementsInGroup(virtualGroup, qmi);
          UpdateValidator validator = new UpdateValidator(qmi, determineType(insertPlan), determineType(updatePlan), determineType(deletePlan));
        validator.validate(result, elements);
          UpdateInfo info = validator.getUpdateInfo();
          cachedNode.setUpdateInfo(info);
      }
          qmi.addToMetadataCache(virtualGroup.getMetadataID(), cacheString, cachedNode);
        }
    return cachedNode;
View Full Code Here

Examples of org.teiid.query.validator.UpdateValidator.UpdateInfo

      }
    }
   
    protected void validateUpdate(Update update) {
        try {
            UpdateInfo info = update.getUpdateInfo();

            // list of elements that are being updated
        for (SetClause entry : update.getChangeList().getClauses()) {
              ElementSymbol elementID = entry.getSymbol();

                // Check that left side element is updatable
                if(! getMetadata().elementSupports(elementID.getMetadataID(), SupportConstants.Element.UPDATE)) {
                    handleValidationError(QueryPlugin.Util.getString("ERR.015.012.0059", elementID), elementID); //$NON-NLS-1$
                }
               
                Object metadataID = elementID.getMetadataID();
                if (getMetadata().isMultiSourceElement(metadataID)){
                  handleValidationError(QueryPlugin.Util.getString("multi_source_update_not_allowed", elementID), elementID); //$NON-NLS-1$
                }

          // Check that right expression is a constant and is non-null
                Expression value = entry.getValue();
               
                if (EvaluatableVisitor.isFullyEvaluatable(value, true)) {
                    try {
                        value = new Constant(Evaluator.evaluate(value));
                    } catch (ExpressionEvaluationException err) {
                    }
                }
               
                if(value instanceof Constant) {
              // If value is null, check that element supports this as a nullable column
                    if(((Constant)value).isNull() && ! getMetadata().elementSupports(elementID.getMetadataID(), SupportConstants.Element.NULL)) {
                        handleValidationError(QueryPlugin.Util.getString("ERR.015.012.0060", SQLStringVisitor.getSQLString(elementID)), elementID); //$NON-NLS-1$
                    }// end of if
                } else if (info != null && info.getUpdateType() == UpdateType.UPDATE_PROCEDURE && getMetadata().isVirtualGroup(update.getGroup().getMetadataID()) && !EvaluatableVisitor.willBecomeConstant(value)) {
                    // If this is an update on a virtual group, verify that no elements are in the right side
                    Collection<ElementSymbol> elements = ElementCollectorVisitor.getElements(value, false);
                    for (ElementSymbol element : elements) {
                        if(! element.isExternalReference()) {
                            handleValidationError(QueryPlugin.Util.getString("ERR.015.012.0061", SQLStringVisitor.getSQLString(value)), value); //$NON-NLS-1$
                        }
                    }
                }
        }
            if (info != null && info.isInherentUpdate()) {
              Set<ElementSymbol> updateCols = update.getChangeList().getClauseMap().keySet();
              if (!info.hasValidUpdateMapping(updateCols)) {
                handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.nonUpdatable", updateCols), update); //$NON-NLS-1$
              }
            }
        } catch(TeiidException e) {
            handleException(e, update);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.