use of org.apache.rya.mongodb.document.util.DocumentVisibilityConversionException in project incubator-rya by apache.
the class DocumentVisibilityAdapter method toDBObject.
/**
* Serializes a {@link DocumentVisibility} to a MongoDB {@link DBObject}.
* @param documentVisibility the {@link DocumentVisibility} to be
* serialized.
* @return The MongoDB {@link DBObject}.
*/
public static BasicDBObject toDBObject(final DocumentVisibility documentVisibility) {
DocumentVisibility dv;
if (documentVisibility == null) {
dv = MongoDbRdfConstants.EMPTY_DV;
} else {
dv = documentVisibility;
}
Object[] dvArray = null;
try {
dvArray = DocumentVisibilityUtil.toMultidimensionalArray(dv);
} catch (final DocumentVisibilityConversionException e) {
log.error("Unable to convert document visibility");
}
final BasicDBObjectBuilder builder = BasicDBObjectBuilder.start();
builder.add(DOCUMENT_VISIBILITY_KEY, dvArray);
return (BasicDBObject) builder.get();
}
Aggregations