/** * Get all lifecycle events from the given record. * @return A {@link List} of {@link LifecycleEvent} enumerations representing all lifecycles stored in the given notification. */ public static List getLifecycleEvents(Record notification) { return notification.get(LIFE_CYLCLE); }
@Override protected boolean doProcess(Record record) { for (Object value : record.get(inputFieldName)) { Iterable<String> columns = splitter.split(value.toString()); if (outputFieldNames == null) { record.getFields().putAll(outputFieldName, columns); } else { extractColumns(record, columns); } } // pass record to next command in chain: return super.doProcess(record); }
private void testGenerateUUID(String suffix) throws Exception { morphline = createMorphline("test-morphlines/generateUUID" + suffix); Record record = new Record(); collector.reset(); startSession(); assertEquals(1, collector.getNumStartEvents()); assertTrue(morphline.process(record)); Record actual = collector.getFirstRecord(); assertEquals(1, actual.get("id").size()); String uuid = (String) actual.getFirstValue("id"); assertEquals(36, uuid.length()); }
/** * Get all lifecycle events from the given record. * @return A {@link List} of {@link LifecycleEvent} enumerations representing all lifecycles stored in the given notification. */ public static List getLifecycleEvents(Record notification) { return notification.get(LIFE_CYLCLE); }
protected Charset detectCharset(Record record, Charset charset) { if (charset != null) { return charset; } List charsets = record.get(Fields.ATTACHMENT_CHARSET); if (charsets.size() == 0) { // TODO try autodetection (AutoDetectReader) throw new MorphlineRuntimeException("Missing charset for record: " + record); } String charsetName = (String) charsets.get(0); return Charset.forName(charsetName); }
protected Charset detectCharset(Record record, Charset charset) { if (charset != null) { return charset; } List charsets = record.get(Fields.ATTACHMENT_CHARSET); if (charsets.size() == 0) { // TODO try autodetection (AutoDetectReader) throw new MorphlineRuntimeException("Missing charset for record: " + record); } String charsetName = (String) charsets.get(0); return Charset.forName(charsetName); }
private URI getUri(Record record) { URI uri = null; try { uri = new URI((String) record.get(uriInputField).get(0)); } catch (URISyntaxException e) { throw new RefererParserException("You must provide a valid referer URI.", e); } return uri; } }
@Override @SuppressWarnings("unchecked") protected final boolean doProcess(Record record) { ListIterator iter = record.get(fieldName).listIterator(); while (iter.hasNext()) { iter.set(transformFieldValue(iter.next())); } return super.doProcess(record); }
private void doProcessFast(Record record) { for (String name : nameMatcher.getLiteralsOnly()) { List values = record.get(name); for (int i = values.size(); --i >= 0; ) { if (valueMatcher.matches(values.get(i).toString())) { if (replacement != null) { values.set(i, replacement); } else { values.remove(i); } } } } }
@Override @SuppressWarnings("unchecked") protected final boolean doProcess(Record record) { ListIterator iter = record.get(fieldName).listIterator(); while (iter.hasNext()) { iter.set(transformFieldValue(iter.next())); } return super.doProcess(record); }
@Override protected boolean doProcess(Record record) { ListIterator iter = record.get(fieldName).listIterator(); while (iter.hasNext()) { iter.set(transformFieldValue(iter.next())); } return super.doProcess(record); }
@Override protected boolean doProcess(Record record) { ListIterator iter = record.get(fieldName).listIterator(); while (iter.hasNext()) { iter.set(transformFieldValue(iter.next())); } return super.doProcess(record); }
@Override protected boolean doProcess(Record record) { ListIterator iter = record.get(fieldName).listIterator(); while (iter.hasNext()) { iter.set(transformFieldValue(iter.next())); } return super.doProcess(record); }
@Override protected boolean doProcess(Record record) { ListIterator iter = record.get(fieldName).listIterator(); while (iter.hasNext()) { iter.set(transformFieldValue(iter.next())); } return super.doProcess(record); }
@Override protected boolean doProcess(Record record) { for (Object value : record.get(inputFieldName)) { Preconditions.checkNotNull(value); String stringValue = value.toString().trim(); for (Mapping mapping : mappings) { mapping.apply(record, stringValue); } } // pass record to next command in chain: return super.doProcess(record); }
@Override protected boolean doProcess(Record record) { for (Object value : record.get(inputFieldName)) { Preconditions.checkNotNull(value); String stringValue = value.toString().trim(); for (Mapping mapping : mappings) { mapping.apply(record, stringValue); } } // pass record to next command in chain: return super.doProcess(record); }
@Override protected boolean doProcess(Record record) { Record outputRecord = record.copy(); for (Entry<String, ConfigValue> entry : entries) { outputRecord.put(entry.getValue().render().replace("\"", ""), outputRecord.get(entry.getKey()).get(0)); if (remove) { outputRecord.removeAll(entry.getKey()); } } return super.doProcess(outputRecord); } }
@Override protected boolean doProcess(Record record) { Object value = record.get(inputFieldName).get(0); LanguageIdentifier li = new LanguageIdentifier((String) value); record.put(outputFieldName, li.getLanguage()); // pass record to next command in chain: return super.doProcess(record); }