//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private static void node(InputEntityVisitor entity, String sourceDescription, long lineNumber, long position, Object id, Object[] properties, System.Nullable<long> propertyId, String[] labels, System.Nullable<long> labelField) throws java.io.IOException private static void Node(InputEntityVisitor entity, string sourceDescription, long lineNumber, long position, object id, object[] properties, long?propertyId, string[] labels, long?labelField) { ApplyProperties(entity, properties, propertyId); entity.Id(id, Group_Fields.Global); if (labelField != null) { entity.LabelField(labelField.Value); } else { entity.Labels(labels); } entity.EndOfEntity(); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public void replayOnto(InputEntityVisitor visitor) throws java.io.IOException public virtual void ReplayOnto(InputEntityVisitor visitor) { // properties if (HasPropertyId) { visitor.PropertyId(PropertyIdConflict); } else if (PropertiesConflict.Count > 0) { int propertyCount = propertyCount(); for (int i = 0; i < propertyCount; i++) { if (HasIntPropertyKeyIds) { visitor.property(( int? )PropertyKey(i), PropertyValue(i)); } else { visitor.Property(( string )PropertyKey(i), PropertyValue(i)); } } } // id if (HasLongId) { visitor.Id(LongId); } else if (ObjectId != null) { visitor.Id(ObjectId, IdGroup); } // labels if (HasLabelField) { visitor.LabelField(LabelFieldConflict); } else if (LabelsConflict.Count > 0) { visitor.Labels(LabelsConflict.ToArray()); } // start id if (HasLongStartId) { visitor.StartId(LongStartId); } else if (ObjectStartId != null) { visitor.StartId(ObjectStartId, StartIdGroup); } // end id if (HasLongEndId) { visitor.EndId(LongEndId); } else if (ObjectEndId != null) { visitor.EndId(ObjectEndId, EndIdGroup); } // type if (HasIntType) { visitor.Type(IntType); } else if (!string.ReferenceEquals(StringType, null)) { visitor.Type(StringType); } // all done visitor.EndOfEntity(); }
public override bool Labels(string[] labels) { CheckClear(); Collections.addAll(this.LabelsConflict, labels); return(@delegate.Labels(labels)); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: boolean next(org.neo4j.unsafe.impl.batchimport.input.InputEntityVisitor visitor) throws java.io.IOException internal virtual bool Next(InputEntityVisitor visitor) { _lineNumber++; int i = 0; Entry entry = null; Entry[] entries = _header.entries(); try { bool doContinue = true; for (i = 0; i < entries.Length && doContinue; i++) { entry = entries[i]; if (!_seeker.seek(_mark, _delimiter)) { if (i > 0) { throw new UnexpectedEndOfInputException("Near " + _mark); } // We're just at the end return(false); } switch (entry.Type()) { case ID: if (_seeker.tryExtract(_mark, entry.Extractor())) { switch (_idType.innerEnumValue) { case Org.Neo4j.@unsafe.Impl.Batchimport.input.csv.IdType.InnerEnum.STRING: case Org.Neo4j.@unsafe.Impl.Batchimport.input.csv.IdType.InnerEnum.INTEGER: object idValue = entry.Extractor().value(); doContinue = visitor.Id(idValue, entry.Group()); if (!string.ReferenceEquals(entry.Name(), null)) { doContinue = visitor.Property(entry.Name(), idValue); } break; case Org.Neo4j.@unsafe.Impl.Batchimport.input.csv.IdType.InnerEnum.ACTUAL: doContinue = visitor.Id(((Extractors.LongExtractor)entry.Extractor()).longValue()); break; default: throw new System.ArgumentException(_idType.name()); } } break; case START_ID: if (_seeker.tryExtract(_mark, entry.Extractor())) { switch (_idType.innerEnumValue) { case Org.Neo4j.@unsafe.Impl.Batchimport.input.csv.IdType.InnerEnum.STRING: doContinue = visitor.StartId(entry.Extractor().value(), entry.Group()); break; case Org.Neo4j.@unsafe.Impl.Batchimport.input.csv.IdType.InnerEnum.INTEGER: doContinue = visitor.StartId(entry.Extractor().value(), entry.Group()); break; case Org.Neo4j.@unsafe.Impl.Batchimport.input.csv.IdType.InnerEnum.ACTUAL: doContinue = visitor.StartId(((Extractors.LongExtractor)entry.Extractor()).longValue()); break; default: throw new System.ArgumentException(_idType.name()); } } break; case END_ID: if (_seeker.tryExtract(_mark, entry.Extractor())) { switch (_idType.innerEnumValue) { case Org.Neo4j.@unsafe.Impl.Batchimport.input.csv.IdType.InnerEnum.STRING: doContinue = visitor.EndId(entry.Extractor().value(), entry.Group()); break; case Org.Neo4j.@unsafe.Impl.Batchimport.input.csv.IdType.InnerEnum.INTEGER: doContinue = visitor.EndId(entry.Extractor().value(), entry.Group()); break; case Org.Neo4j.@unsafe.Impl.Batchimport.input.csv.IdType.InnerEnum.ACTUAL: doContinue = visitor.EndId(((Extractors.LongExtractor)entry.Extractor()).longValue()); break; default: throw new System.ArgumentException(_idType.name()); } } break; case TYPE: if (_seeker.tryExtract(_mark, entry.Extractor())) { doContinue = visitor.Type(( string )entry.Extractor().value()); } break; case PROPERTY: if (_seeker.tryExtract(_mark, entry.Extractor(), entry.OptionalParameter())) { // TODO since PropertyStore#encodeValue takes Object there's no point splitting up // into different primitive types object value = entry.Extractor().value(); if (!IsEmptyArray(value)) { doContinue = visitor.Property(entry.Name(), value); } } break; case LABEL: if (_seeker.tryExtract(_mark, entry.Extractor())) { object labelsValue = entry.Extractor().value(); if (labelsValue.GetType().IsArray) { doContinue = visitor.Labels(( string[] )labelsValue); } else { doContinue = visitor.Labels(new string[] { ( string )labelsValue }); } } break; case IGNORE: break; default: throw new System.ArgumentException(entry.Type().ToString()); } if (_mark.EndOfLine) { // We're at the end of the line, break and return an entity with what we have. break; } } while (!_mark.EndOfLine) { _seeker.seek(_mark, _delimiter); if (doContinue) { _seeker.tryExtract(_mark, _stringExtractor, entry.OptionalParameter()); _badCollector.collectExtraColumns(_seeker.sourceDescription(), _lineNumber, _stringExtractor.value()); } } visitor.EndOfEntity(); return(true); } //JAVA TO C# CONVERTER WARNING: 'final' catch parameters are not available in C#: //ORIGINAL LINE: catch (final RuntimeException e) catch (Exception e) { string stringValue = null; try { Extractors extractors = new Extractors('?'); if (_seeker.tryExtract(_mark, extractors.String(), entry.OptionalParameter())) { stringValue = extractors.String().value(); } } catch (Exception) { // OK } string message = format("ERROR in input" + "%n data source: %s" + "%n in field: %s" + "%n for header: %s" + "%n raw field value: %s" + "%n original error: %s", _seeker, entry + ":" + (i + 1), _header, !string.ReferenceEquals(stringValue, null) ? stringValue : "??", e.Message); if (e is InputException) { throw Exceptions.withMessage(e, message); } throw new InputException(message, e); } }