use of nikita.common.model.noark5.v4.metadata.SeriesStatus in project nikita-noark5-core by HiOA-ABI.
the class FondsDeserializer method deserialize.
@Override
public Fonds deserialize(JsonParser jsonParser, DeserializationContext dc) throws IOException {
Fonds fonds = new Fonds();
ObjectNode objectNode = mapper.readTree(jsonParser);
// TODO : Are we deserialising parent? No, it's not done here or is it????
// Deserialise general properties
CommonUtils.Hateoas.Deserialize.deserialiseNoarkEntity(fonds, objectNode);
CommonUtils.Hateoas.Deserialize.deserialiseDocumentMedium(fonds, objectNode);
CommonUtils.Hateoas.Deserialize.deserialiseStorageLocation(fonds, objectNode);
// Deserialize seriesStatus
JsonNode currentNode = objectNode.get(FONDS_STATUS);
if (currentNode != null) {
fonds.setFondsStatus(currentNode.textValue());
objectNode.remove(FONDS_STATUS);
}
// If there are additional throw a malformed input exception
if (objectNode.size() != 0) {
throw new NikitaMalformedInputDataException("The arkiv you tried to create is malformed. The " + "following fields are not recognised as arkiv fields [" + CommonUtils.Hateoas.Deserialize.checkNodeObjectEmpty(objectNode) + "]");
}
return fonds;
}
use of nikita.common.model.noark5.v4.metadata.SeriesStatus in project nikita-noark5-core by HiOA-ABI.
the class UserDeserializer method deserialize.
@Override
public Fonds deserialize(JsonParser jsonParser, DeserializationContext dc) throws IOException {
Fonds fonds = new Fonds();
ObjectNode objectNode = mapper.readTree(jsonParser);
// TODO : Are we deserialising parent? No, it's not done here or is it????
// Deserialise general properties
CommonUtils.Hateoas.Deserialize.deserialiseNoarkEntity(fonds, objectNode);
CommonUtils.Hateoas.Deserialize.deserialiseDocumentMedium(fonds, objectNode);
CommonUtils.Hateoas.Deserialize.deserialiseStorageLocation(fonds, objectNode);
// Deserialize seriesStatus
JsonNode currentNode = objectNode.get(FONDS_STATUS);
if (currentNode != null) {
fonds.setFondsStatus(currentNode.textValue());
objectNode.remove(FONDS_STATUS);
}
// If there are additional throw a malformed input exception
if (objectNode.size() != 0) {
throw new NikitaMalformedInputDataException("The arkiv you tried to create is malformed. The " + "following fields are not recognised as arkiv fields [" + CommonUtils.Hateoas.Deserialize.checkNodeObjectEmpty(objectNode) + "]");
}
return fonds;
}
use of nikita.common.model.noark5.v4.metadata.SeriesStatus in project nikita-noark5-core by HiOA-ABI.
the class SeriesDeserializer method deserialize.
@Override
public Series deserialize(JsonParser jsonParser, DeserializationContext dc) throws IOException {
StringBuilder errors = new StringBuilder();
Series series = new Series();
ObjectNode objectNode = mapper.readTree(jsonParser);
// Deserialise general properties
CommonUtils.Hateoas.Deserialize.deserialiseNoarkEntity(series, objectNode, errors);
CommonUtils.Hateoas.Deserialize.deserialiseDocumentMedium(series, objectNode, errors);
CommonUtils.Hateoas.Deserialize.deserialiseStorageLocation(series, objectNode, errors);
// Deserialize seriesStatus
JsonNode currentNode = objectNode.get(N5ResourceMappings.SERIES_STATUS);
if (null != currentNode) {
series.setSeriesStatus(currentNode.textValue());
objectNode.remove(N5ResourceMappings.SERIES_STATUS);
}
// Deserialize seriesStartDate
series.setSeriesStartDate(CommonUtils.Hateoas.Deserialize.deserializeDate(N5ResourceMappings.SERIES_START_DATE, objectNode, errors));
// Deserialize seriesEndDate
series.setSeriesEndDate(CommonUtils.Hateoas.Deserialize.deserializeDate(N5ResourceMappings.SERIES_END_DATE, objectNode, errors));
// Deserialize referencePrecursor
currentNode = objectNode.get(N5ResourceMappings.SERIES_PRECURSOR);
if (null != currentNode) {
Series seriesPrecursor = new Series();
seriesPrecursor.setSystemId(currentNode.textValue());
series.setReferencePrecursor(seriesPrecursor);
// TODO: Does this imply that the current arkivdel is the successor?
// I would not set it here, as the service class has to check that
// the seriesPrecursor object actually exists
objectNode.remove(N5ResourceMappings.SERIES_PRECURSOR);
}
// Deserialize referenceSuccessor
currentNode = objectNode.get(N5ResourceMappings.SERIES_SUCCESSOR);
if (null != currentNode) {
Series seriesSuccessor = new Series();
seriesSuccessor.setSystemId(currentNode.textValue());
series.setReferenceSuccessor(seriesSuccessor);
// TODO: Does this imply that the current arkivdel is the precursor?
// I would not set it here, as the service class should do this
objectNode.remove(N5ResourceMappings.SERIES_SUCCESSOR);
}
series.setReferenceDisposal(CommonUtils.Hateoas.Deserialize.deserialiseDisposal(objectNode, errors));
series.setReferenceDisposalUndertaken(CommonUtils.Hateoas.Deserialize.deserialiseDisposalUndertaken(objectNode, errors));
series.setReferenceDeletion(CommonUtils.Hateoas.Deserialize.deserialiseDeletion(objectNode, errors));
series.setReferenceScreening(CommonUtils.Hateoas.Deserialize.deserialiseScreening(objectNode, errors));
series.setReferenceClassified(CommonUtils.Hateoas.Deserialize.deserialiseClassified(objectNode, errors));
// If there are additional throw a malformed input exception
if (objectNode.size() != 0) {
errors.append("The arkivdel you tried to create is malformed. The " + "following fields are not recognised as arkivdel fields [" + CommonUtils.Hateoas.Deserialize.checkNodeObjectEmpty(objectNode) + "]. ");
}
if (0 < errors.length())
throw new NikitaMalformedInputDataException(errors.toString());
return series;
}
use of nikita.common.model.noark5.v4.metadata.SeriesStatus in project nikita-noark5-core by HiOA-ABI.
the class UserDeserializer method deserialize.
@Override
public Fonds deserialize(JsonParser jsonParser, DeserializationContext dc) throws IOException {
StringBuilder errors = new StringBuilder();
Fonds fonds = new Fonds();
ObjectNode objectNode = mapper.readTree(jsonParser);
// TODO : Are we deserialising parent? No, it's not done here or is it????
// Deserialise general properties
CommonUtils.Hateoas.Deserialize.deserialiseNoarkEntity(fonds, objectNode, errors);
CommonUtils.Hateoas.Deserialize.deserialiseDocumentMedium(fonds, objectNode, errors);
CommonUtils.Hateoas.Deserialize.deserialiseStorageLocation(fonds, objectNode, errors);
// Deserialize seriesStatus
JsonNode currentNode = objectNode.get(N5ResourceMappings.FONDS_STATUS);
if (currentNode != null) {
fonds.setFondsStatus(currentNode.textValue());
objectNode.remove(N5ResourceMappings.FONDS_STATUS);
}
// If there are additional throw a malformed input exception
if (objectNode.size() != 0) {
errors.append("The arkiv you tried to create is malformed. The " + "following fields are not recognised as arkiv fields [" + CommonUtils.Hateoas.Deserialize.checkNodeObjectEmpty(objectNode) + "]. ");
}
if (0 < errors.length())
throw new NikitaMalformedInputDataException(errors.toString());
return fonds;
}
use of nikita.common.model.noark5.v4.metadata.SeriesStatus in project nikita-noark5-core by HiOA-ABI.
the class SeriesDeserializer method deserialize.
@Override
public Series deserialize(JsonParser jsonParser, DeserializationContext dc) throws IOException {
Series series = new Series();
ObjectNode objectNode = mapper.readTree(jsonParser);
// Deserialise general properties
CommonUtils.Hateoas.Deserialize.deserialiseNoarkEntity(series, objectNode);
CommonUtils.Hateoas.Deserialize.deserialiseDocumentMedium(series, objectNode);
CommonUtils.Hateoas.Deserialize.deserialiseStorageLocation(series, objectNode);
// Deserialize seriesStatus
JsonNode currentNode = objectNode.get(SERIES_STATUS);
if (null != currentNode) {
series.setSeriesStatus(currentNode.textValue());
objectNode.remove(SERIES_STATUS);
}
// Deserialize seriesStartDate
currentNode = objectNode.get(SERIES_START_DATE);
if (null != currentNode) {
try {
Date parsedDate = Deserialize.parseDateFormat(currentNode.textValue());
series.setSeriesStartDate(parsedDate);
objectNode.remove(SERIES_START_DATE);
} catch (ParseException e) {
throw new NikitaMalformedInputDataException("The arkivdel you tried to create " + "has a malformed arkivperiodeStartDato. Make sure format is " + NOARK_DATE_FORMAT_PATTERN);
}
}
// Deserialize seriesEndDate
currentNode = objectNode.get(SERIES_END_DATE);
if (null != currentNode) {
try {
Date parsedDate = Deserialize.parseDateFormat(currentNode.textValue());
series.setSeriesEndDate(parsedDate);
objectNode.remove(SERIES_END_DATE);
} catch (ParseException e) {
throw new NikitaMalformedInputDataException("The arkivdel you tried to create " + "has a malformed arkivperiodeSluttDato. Make sure format is " + NOARK_DATE_FORMAT_PATTERN);
}
}
// Deserialize referencePrecursor
currentNode = objectNode.get(SERIES_PRECURSOR);
if (null != currentNode) {
Series seriesPrecursor = new Series();
seriesPrecursor.setSystemId(currentNode.textValue());
series.setReferencePrecursor(seriesPrecursor);
// TODO: Does this imply that the current arkivdel is the successor?
// I would not set it here, as the service class has to check that
// the seriesPrecursor object actually exists
objectNode.remove(SERIES_PRECURSOR);
}
// Deserialize referenceSuccessor
currentNode = objectNode.get(SERIES_SUCCESSOR);
if (null != currentNode) {
Series seriesSuccessor = new Series();
seriesSuccessor.setSystemId(currentNode.textValue());
series.setReferenceSuccessor(seriesSuccessor);
// TODO: Does this imply that the current arkivdel is the precursor?
// I would not set it here, as the service class should do this
objectNode.remove(SERIES_SUCCESSOR);
}
series.setReferenceDisposal(CommonUtils.Hateoas.Deserialize.deserialiseDisposal(objectNode));
series.setReferenceDisposalUndertaken(CommonUtils.Hateoas.Deserialize.deserialiseDisposalUndertaken(objectNode));
series.setReferenceDeletion(CommonUtils.Hateoas.Deserialize.deserialiseDeletion(objectNode));
series.setReferenceScreening(CommonUtils.Hateoas.Deserialize.deserialiseScreening(objectNode));
series.setReferenceClassified(CommonUtils.Hateoas.Deserialize.deserialiseClassified(objectNode));
// If there are additional throw a malformed input exception
if (objectNode.size() != 0) {
throw new NikitaMalformedInputDataException("The arkivdel you tried to create is malformed. The " + "following fields are not recognised as arkivdel fields [" + CommonUtils.Hateoas.Deserialize.checkNodeObjectEmpty(objectNode) + "]");
}
return series;
}
Aggregations