private void addRelationallyMappedMultiProperty(
     ParsedPropertyReplacement replacement,
     Mapping mapping,
     FeatureTypeMapping ftMapping,
     List<ResourceId> list)
     throws FilterEvaluationException, FeatureStoreException, SQLException {
   UpdateAction action = replacement.getUpdateAction();
   if (action == null) {
     action = UpdateAction.INSERT_AFTER;
   }
   switch (action) {
     case INSERT_BEFORE:
     case REMOVE:
     case REPLACE:
       LOG.warn(
           "Updating of multi properties is currently only supported for 'insertAfter' update action. Omitting.");
       break;
     case INSERT_AFTER:
       break;
     default:
       break;
   }
   InsertRowManager mgr = new InsertRowManager(fs, conn, null);
   List<Property> props = Collections.singletonList(replacement.getNewValue());
   for (ResourceId id : list) {
     IdAnalysis analysis = schema.analyzeId(id.getRid());
     FeatureType featureType = schema.getFeatureType(ftMapping.getFeatureType());
     Feature f = featureType.newFeature(id.getRid(), props, null);
     mgr.updateFeature(f, ftMapping, analysis.getIdKernels(), mapping, replacement);
   }
 }
  private void setRelationalUpdateValues(
      List<ParsedPropertyReplacement> replacementProps,
      FeatureTypeMapping ftMapping,
      PreparedStatement stmt,
      IdFilter filter,
      FIDMapping fidMapping)
      throws SQLException {
    int i = 1;

    for (ParsedPropertyReplacement replacement : replacementProps) {
      Property replacementProp = replacement.getNewValue();
      QName propName = replacementProp.getType().getName();
      Mapping mapping = ftMapping.getMapping(propName);
      if (mapping != null) {
        if (mapping.getJoinedTable() != null && !mapping.getJoinedTable().isEmpty()) {
          continue;
        }

        Object value = replacementProp.getValue();
        if (value != null) {
          ParticleConverter<TypedObjectNode> converter =
              (ParticleConverter<TypedObjectNode>) fs.getConverter(mapping);
          if (mapping instanceof PrimitiveMapping) {
            MappingExpression me = ((PrimitiveMapping) mapping).getMapping();
            if (!(me instanceof DBField)) {
              continue;
            }
            converter.setParticle(stmt, (PrimitiveValue) value, i++);
          } else if (mapping instanceof GeometryMapping) {
            MappingExpression me = ((GeometryMapping) mapping).getMapping();
            if (!(me instanceof DBField)) {
              continue;
            }
            converter.setParticle(stmt, (Geometry) value, i++);
          }
        } else {
          stmt.setObject(i++, null);
        }
      }
    }

    for (String id : filter.getMatchingIds()) {
      IdAnalysis analysis = schema.analyzeId(id);
      int j = i;
      for (String fidKernel : analysis.getIdKernels()) {
        PrimitiveValue value =
            new PrimitiveValue(fidKernel, new PrimitiveType(fidMapping.getColumnType()));
        Object sqlValue = SQLValueMangler.internalToSQL(value);
        stmt.setObject(j++, sqlValue);
      }
      stmt.addBatch();
    }
  }
  private String createRelationalUpdateStatement(
      FeatureTypeMapping ftMapping,
      FIDMapping fidMapping,
      List<ParsedPropertyReplacement> replacementProps,
      List<ResourceId> list)
      throws FilterEvaluationException, FeatureStoreException, SQLException {
    StringBuffer sql = new StringBuffer("UPDATE ");
    sql.append(ftMapping.getFtTable());
    sql.append(" SET ");
    boolean first = true;
    for (ParsedPropertyReplacement replacement : replacementProps) {
      Property replacementProp = replacement.getNewValue();
      QName propName = replacementProp.getType().getName();
      Mapping mapping = ftMapping.getMapping(propName);
      if (mapping != null) {
        if (mapping.getJoinedTable() != null && !mapping.getJoinedTable().isEmpty()) {
          addRelationallyMappedMultiProperty(replacement, mapping, ftMapping, list);
          continue;
        }
        String column = null;
        ParticleConverter<TypedObjectNode> converter =
            (ParticleConverter<TypedObjectNode>) fs.getConverter(mapping);
        if (mapping instanceof PrimitiveMapping) {
          MappingExpression me = ((PrimitiveMapping) mapping).getMapping();
          if (!(me instanceof DBField)) {
            continue;
          }
          column = ((DBField) me).getColumn();
          if (!first) {
            sql.append(",");
          } else {
            first = false;
          }
          sql.append(column);
          sql.append("=");

          // TODO communicate value for non-prepared statement converters
          sql.append(converter.getSetSnippet(null));
        } else if (mapping instanceof GeometryMapping) {
          MappingExpression me = ((GeometryMapping) mapping).getMapping();
          if (!(me instanceof DBField)) {
            continue;
          }
          column = ((DBField) me).getColumn();
          if (!first) {
            sql.append(",");
          } else {
            first = false;
          }
          sql.append(column);
          sql.append("=");
          // TODO communicate value for non-prepared statement converters
          sql.append(converter.getSetSnippet(null));
        } else {
          LOG.warn(
              "Updating of " + mapping.getClass() + " is currently not implemented. Omitting.");
          continue;
        }
      } else {
        LOG.warn("No mapping for update property '" + propName + "'. Omitting.");
      }
    }

    // only property changes in multi properties?
    if (first) {
      return null;
    }

    sql.append(" WHERE ");
    sql.append(fidMapping.getColumns().get(0).first);
    sql.append("=?");
    for (int i = 1; i < fidMapping.getColumns().size(); i++) {
      sql.append(" AND ");
      sql.append(fidMapping.getColumns().get(i));
      sql.append("=?");
    }
    return sql.toString();
  }