@Test public void testGetFieldWriter() { AtlasFieldWriter writer = new AtlasFieldWriter() { @Override public void write(AtlasInternalSession session) throws AtlasException { LOG.debug("write method"); } }; session.setFieldWriter(AtlasConstants.DEFAULT_TARGET_DOCUMENT_ID, writer); assertNotNull(session.getFieldWriter(null)); assertNotNull(session.getFieldWriter("")); assertNotNull(session.getFieldWriter(AtlasConstants.DEFAULT_TARGET_DOCUMENT_ID)); assertNotNull(session.getFieldWriter("", AtlasFieldWriter.class)); }
@Override public AtlasFieldWriter getFieldWriter(String docId) { if (docId == null || docId.isEmpty()) { return this.fieldWriterMap.get(AtlasConstants.DEFAULT_TARGET_DOCUMENT_ID); } return this.fieldWriterMap.get(docId); }
DefaultAtlasSession implements AtlasInternalSession { @Override public AtlasFieldWriter getFieldWriter(String docId) { if (docId == null || docId.isEmpty()) { return this.fieldWriterMap.get(AtlasConstants.DEFAULT_TARGET_DOCUMENT_ID); } return this.fieldWriterMap.get(docId); } }
DefaultAtlasSession implements AtlasInternalSession { @Override public AtlasFieldWriter getFieldWriter(String docId) { if (docId == null || docId.isEmpty()) { return this.fieldWriterMap.get(AtlasConstants.DEFAULT_TARGET_DOCUMENT_ID); } return this.fieldWriterMap.get(docId); } DefaultAtlasSession(DefaultAtlasContext context); }
DefaultAtlasSession implements AtlasInternalSession { @Override public AtlasFieldWriter getFieldWriter(String docId) { if (docId == null || docId.isEmpty()) { return this.fieldWriterMap.get(AtlasConstants.DEFAULT_TARGET_DOCUMENT_ID); } return this.fieldWriterMap.get(docId); } DefaultAtlasSession(DefaultAtlasContext context); @Override AtlasContext getAtlasContext(); @Override void setAtlasContext(AtlasContext atlasContext); @Override AtlasMapping getMapping(); @Override Validations getValidations(); @Override void setValidations(Validations validations); @Override Audits getAudits(); @Override void setAudits(Audits audits); @Override Object getDefaultSourceDocument(); @Override Object getSourceDocument(String docId); @Override boolean hasSourceDocument(String docId); @Override Map<String, Object> getSourceDocumentMap(); @Override Object getDefaultTargetDocument(); @Override Object getTargetDocument(String docId); @Override boolean hasTargetDocument(String docId); @Override Map<String, Object> getTargetDocumentMap(); @Override void setDefaultSourceDocument(Object sourceDoc); @Override void setSourceDocument(String docId, Object sourceDoc); @Override void setDefaultTargetDocument(Object targetDoc); @Override void setTargetDocument(String docId, Object targetDoc); @Override AtlasFieldReader getFieldReader(String docId); @Override T getFieldReader(String docId, Class<T> clazz); @Override void setFieldReader(String docId, AtlasFieldReader reader); @Override AtlasFieldReader removeFieldReader(String docId); @Override AtlasFieldWriter getFieldWriter(String docId); @Override T getFieldWriter(String docId, Class<T> clazz); @Override void setFieldWriter(String docId, AtlasFieldWriter writer); @Override AtlasFieldWriter removeFieldWriter(String docId); @Override Head head(); @Override @Deprecated Map<String, Object> getProperties(); @Override Map<String, Object> getSourceProperties(); @Override Map<String, Object> getTargetProperties(); @Override AtlasPropertyStrategy getAtlasPropertyStrategy(); @Override void setAtlasPropertyStrategy(AtlasPropertyStrategy strategy); @Override Integer errorCount(); @Override boolean hasErrors(); @Override boolean hasWarns(); @Override Integer warnCount(); }
DefaultAtlasSession implements AtlasInternalSession { @Override public AtlasFieldWriter getFieldWriter(String docId) { if (docId == null || docId.isEmpty()) { return this.fieldWriterMap.get(AtlasConstants.DEFAULT_TARGET_DOCUMENT_ID); } return this.fieldWriterMap.get(docId); } DefaultAtlasSession(DefaultAtlasContext context); @Override AtlasContext getAtlasContext(); @Override void setAtlasContext(AtlasContext atlasContext); @Override AtlasMapping getMapping(); @Override Validations getValidations(); @Override void setValidations(Validations validations); @Override Audits getAudits(); @Override void setAudits(Audits audits); @Override Object getDefaultSourceDocument(); @Override Object getSourceDocument(String docId); @Override boolean hasSourceDocument(String docId); @Override Map<String, Object> getSourceDocumentMap(); @Override Object getDefaultTargetDocument(); @Override Object getTargetDocument(String docId); @Override boolean hasTargetDocument(String docId); @Override Map<String, Object> getTargetDocumentMap(); @Override void setDefaultSourceDocument(Object sourceDoc); @Override void setSourceDocument(String docId, Object sourceDoc); @Override void setDefaultTargetDocument(Object targetDoc); @Override void setTargetDocument(String docId, Object targetDoc); @Override AtlasFieldReader getFieldReader(String docId); @Override T getFieldReader(String docId, Class<T> clazz); @Override void setFieldReader(String docId, AtlasFieldReader reader); @Override AtlasFieldReader removeFieldReader(String docId); @Override AtlasFieldWriter getFieldWriter(String docId); @Override T getFieldWriter(String docId, Class<T> clazz); @Override void setFieldWriter(String docId, AtlasFieldWriter writer); @Override AtlasFieldWriter removeFieldWriter(String docId); @Override Head head(); @Override @Deprecated Map<String, Object> getProperties(); @Override Map<String, Object> getSourceProperties(); @Override Map<String, Object> getTargetProperties(); @Override AtlasPropertyStrategy getAtlasPropertyStrategy(); @Override void setAtlasPropertyStrategy(AtlasPropertyStrategy strategy); @Override Integer errorCount(); @Override boolean hasErrors(); @Override boolean hasWarns(); @Override Integer warnCount();  }