@Override public MarkLogicNode getContentAsMarkLogicNode() { return new MarkLogicNode(doc); }
public MarkLogicNode getContentAsMarkLogicNode() { if (contentType == ContentType.XML || contentType == ContentType.TEXT) { return new MarkLogicNode(getContentAsText().toString(), contentType); } throw new UnsupportedOperationException( "Cannot convert JSON or binary data to MarkLogicNode."); }
@SuppressWarnings("unchecked") @Override public void readFields(DataInput in) throws IOException { byte valueType = in.readByte(); switch (valueType) { case 0: value = (T) new Text(); ((Text) value).readFields(in); break; case 1: value = (T) new MarkLogicNode(); ((MarkLogicNode) value).readFields(in); break; case 2: value = (T) new BytesWritable(); ((BytesWritable) value).readFields(in); break; default: throw new IOException("incorrect type"); } type = valueType; }
@SuppressWarnings("unchecked") @Override public void readFields(DataInput in) throws IOException { String fn = Text.readString(in); fileName = fn; byte valueType = in.readByte(); switch (valueType) { case 0: value = (VALUE) new Text(); ((Text) value).readFields(in); break; case 1: value = (VALUE) new MarkLogicNode(); ((MarkLogicNode) value).readFields(in); break; case 2: value = (VALUE) new BytesWritable(); ((BytesWritable) value).readFields(in); break; default: throw new IOException("incorrect type"); } type = valueType; }
break; case 1: value = (VALUE) new MarkLogicNode(); ((MarkLogicNode) value).readFields(in); break;
@Override protected boolean nextResult(ResultItem result) { String uri = result.getDocumentURI(); String path = result.getNodePath(); if (currentKey != null) { currentKey.set(uri, path); } else { currentKey = new NodePath(uri, path); } if (currentValue != null) { currentValue.set(result); } else { currentValue = new MarkLogicNode(result); } return true; }