}
private static Visibility getVisibility(ModelObject nodeModel, Visibility original) {
Visibility.Status status = getStatus(nodeModel);
if (status == Visibility.Status.PUBLICATION) {
ModelObject pubDateModel = get(nodeModel, ModelObject.class, "visibility", "publication-date");
// If status was set to PUBLICATION however no publication date was specified then throw exception
if (!pubDateModel.isDefined()) {
throw requiredFieldWhen("visibility status is " + status, "visibility", "publication-date");
}
PublicationDate publicationDate = getPublicationDate(nodeModel, original.getPublicationDate());
return new Visibility(publicationDate);
} else {