use of nikita.model.noark5.v4.interfaces.entities.IMetadataEntity in project nikita-noark5-core by HiOA-ABI.
the class MetadataHateoasSerializer method serializeNoarkEntity.
@Override
public void serializeNoarkEntity(INikitaEntity noarkSystemIdEntity, HateoasNoarkObject metadataHateoas, JsonGenerator jgen) throws IOException {
if (!(noarkSystemIdEntity instanceof nikita.model.noark5.v4.interfaces.entities.IMetadataEntity)) {
throw new NikitaException("Internal error when serialising " + noarkSystemIdEntity + " Not castable to nikita.model.noark5.v4.interfaces.entities.IMetadataEntity");
}
IMetadataEntity metadataEntity = (IMetadataEntity) noarkSystemIdEntity;
jgen.writeStartObject();
CommonUtils.Hateoas.Serialize.printSystemIdEntity(jgen, metadataEntity);
if (metadataEntity.getCode() != null) {
jgen.writeStringField(CODE, metadataEntity.getCode());
}
if (metadataEntity.getDescription() != null) {
jgen.writeStringField(DESCRIPTION, metadataEntity.getDescription());
}
CommonUtils.Hateoas.Serialize.printHateoasLinks(jgen, metadataHateoas.getLinks(metadataEntity));
jgen.writeEndObject();
}
Aggregations