class HortonworksAttributeSchemaReferenceWriter implements SchemaAccessWriter {

    @Override
    public Map<String, String> getAttributes(final RecordSchema schema) {
        final Map<String, String> attributes = new HashMap<>(4);
        final SchemaIdentifier id = schema.getIdentifier();

        final Long schemaId = id.getIdentifier().getAsLong();
        final Integer schemaVersion = id.getVersion().getAsInt();

        attributes.put(HortonworksAttributeSchemaReferenceStrategy.SCHEMA_ID_ATTRIBUTE, String.valueOf(schemaId));
        attributes.put(HortonworksAttributeSchemaReferenceStrategy.SCHEMA_VERSION_ATTRIBUTE, String.valueOf(schemaVersion));
        attributes.put(HortonworksAttributeSchemaReferenceStrategy.SCHEMA_PROTOCOL_VERSION_ATTRIBUTE, String.valueOf(LATEST_PROTOCOL_VERSION));

        if (id.getBranch().isPresent()) {
            attributes.put(SCHEMA_BRANCH_ATTRIBUTE, id.getBranch().get());
        }

        return attributes;
    }

}