@Override public MockFlowFile removeAttribute(FlowFile flowFile, final String attrName) { flowFile = validateState(flowFile); if (attrName == null || flowFile == null) { throw new IllegalArgumentException("argument cannot be null"); } if (!(flowFile instanceof MockFlowFile)) { throw new IllegalArgumentException("Cannot export a flow file that I did not create"); } final MockFlowFile mock = (MockFlowFile) flowFile; final MockFlowFile newFlowFile = new MockFlowFile(mock.getId(), flowFile); currentVersions.put(newFlowFile.getId(), newFlowFile); final Set<String> attrNames = new HashSet<>(); attrNames.add(attrName); newFlowFile.removeAttributes(attrNames); return newFlowFile; }
@Override public MockFlowFile removeAllAttributes(FlowFile flowFile, final Set<String> attrNames) { flowFile = validateState(flowFile); if (attrNames == null || flowFile == null) { throw new IllegalArgumentException("argument cannot be null"); } if (!(flowFile instanceof MockFlowFile)) { throw new IllegalArgumentException("Cannot export a flow file that I did not create"); } final MockFlowFile mock = (MockFlowFile) flowFile; final MockFlowFile newFlowFile = new MockFlowFile(mock.getId(), flowFile); currentVersions.put(newFlowFile.getId(), newFlowFile); newFlowFile.removeAttributes(attrNames); return newFlowFile; }
@Override public MockFlowFile removeAttribute(FlowFile flowFile, final String attrName) { flowFile = validateState(flowFile); if (attrName == null || flowFile == null) { throw new IllegalArgumentException("argument cannot be null"); } if (!(flowFile instanceof MockFlowFile)) { throw new IllegalArgumentException("Cannot export a flow file that I did not create"); } final MockFlowFile mock = (MockFlowFile) flowFile; final MockFlowFile newFlowFile = new MockFlowFile(mock.getId(), flowFile); currentVersions.put(newFlowFile.getId(), newFlowFile); final Set<String> attrNames = new HashSet<>(); attrNames.add(attrName); newFlowFile.removeAttributes(attrNames); return newFlowFile; }
@Override public MockFlowFile removeAllAttributes(FlowFile flowFile, final Set<String> attrNames) { flowFile = validateState(flowFile); if (attrNames == null || flowFile == null) { throw new IllegalArgumentException("argument cannot be null"); } if (!(flowFile instanceof MockFlowFile)) { throw new IllegalArgumentException("Cannot export a flow file that I did not create"); } final MockFlowFile mock = (MockFlowFile) flowFile; final MockFlowFile newFlowFile = new MockFlowFile(mock.getId(), flowFile); currentVersions.put(newFlowFile.getId(), newFlowFile); newFlowFile.removeAttributes(attrNames); return newFlowFile; }