@Test public void testToDocumentVisibility() throws MalformedDocumentVisibilityException { final Document document = Document.parse( "{" + "documentVisibility : [\"A\"]" + "}" ); final DocumentVisibility dv = DocumentVisibilityAdapter.toDocumentVisibility(document); final DocumentVisibility expected = new DocumentVisibility("A"); assertEquals(expected, dv); }
public static DocumentVisibility toDocumentVisibility(final Document doc) throws MalformedDocumentVisibilityException { try { final Object documentVisibilityObject = doc.get(DOCUMENT_VISIBILITY_KEY); Object[] documentVisibilityArray = null; if (documentVisibilityObject instanceof Object[]) { documentVisibilityArray = (Object[]) documentVisibilityObject; } else if (documentVisibilityObject instanceof List) { documentVisibilityArray = ((List<?>) documentVisibilityObject).toArray(); } final String documentVisibilityString = DocumentVisibilityUtil.multidimensionalArrayToBooleanString(documentVisibilityArray); final DocumentVisibility dv = documentVisibilityString == null ? MongoDbRdfConstants.EMPTY_DV : new DocumentVisibility(documentVisibilityString); return dv; } catch(final Exception e) { throw new MalformedDocumentVisibilityException("Failed to make Document Visibility from Mongo Object, it is malformed.", e); } }
DocumentVisibilityAdapter { public static DocumentVisibility toDocumentVisibility(final Document doc) throws MalformedDocumentVisibilityException { try { final Object documentVisibilityObject = doc.get(DOCUMENT_VISIBILITY_KEY); Object[] documentVisibilityArray = null; if (documentVisibilityObject instanceof Object[]) { documentVisibilityArray = (Object[]) documentVisibilityObject; } else if (documentVisibilityObject instanceof List) { documentVisibilityArray = ((List<?>) documentVisibilityObject).toArray(); } final String documentVisibilityString = DocumentVisibilityUtil.multidimensionalArrayToBooleanString(documentVisibilityArray); final DocumentVisibility dv = documentVisibilityString == null ? MongoDbRdfConstants.EMPTY_DV : new DocumentVisibility(documentVisibilityString); return dv; } catch(final Exception e) { throw new MalformedDocumentVisibilityException("Failed to make Document Visibility from Mongo Object, it is malformed.", e); } } }
DocumentVisibilityAdapter { public static DocumentVisibility toDocumentVisibility(final Document doc) throws MalformedDocumentVisibilityException { try { final Object documentVisibilityObject = doc.get(DOCUMENT_VISIBILITY_KEY); Object[] documentVisibilityArray = null; if (documentVisibilityObject instanceof Object[]) { documentVisibilityArray = (Object[]) documentVisibilityObject; } else if (documentVisibilityObject instanceof List) { documentVisibilityArray = ((List<?>) documentVisibilityObject).toArray(); } final String documentVisibilityString = DocumentVisibilityUtil.multidimensionalArrayToBooleanString(documentVisibilityArray); final DocumentVisibility dv = documentVisibilityString == null ? MongoDbRdfConstants.EMPTY_DV : new DocumentVisibility(documentVisibilityString); return dv; } catch(final Exception e) { throw new MalformedDocumentVisibilityException("Failed to make Document Visibility from Mongo Object, it is malformed.", e); } } private  DocumentVisibilityAdapter(); }
DocumentVisibilityAdapter { public static DocumentVisibility toDocumentVisibility(final Document doc) throws MalformedDocumentVisibilityException { try { final Object documentVisibilityObject = doc.get(DOCUMENT_VISIBILITY_KEY); Object[] documentVisibilityArray = null; if (documentVisibilityObject instanceof Object[]) { documentVisibilityArray = (Object[]) documentVisibilityObject; } else if (documentVisibilityObject instanceof List) { documentVisibilityArray = ((List<?>) documentVisibilityObject).toArray(); } final String documentVisibilityString = DocumentVisibilityUtil.multidimensionalArrayToBooleanString(documentVisibilityArray); final DocumentVisibility dv = documentVisibilityString == null ? MongoDbRdfConstants.EMPTY_DV : new DocumentVisibility(documentVisibilityString); return dv; } catch(final Exception e) { throw new MalformedDocumentVisibilityException("Failed to make Document Visibility from Mongo Object, it is malformed.", e); } } private  DocumentVisibilityAdapter(); static Document toDocument(final byte[] expression); static Document toDocument(final DocumentVisibility documentVisibility); static DocumentVisibility toDocumentVisibility(final Document doc); }
DocumentVisibilityAdapter { public static DocumentVisibility toDocumentVisibility(final Document doc) throws MalformedDocumentVisibilityException { try { final Object documentVisibilityObject = doc.get(DOCUMENT_VISIBILITY_KEY); Object[] documentVisibilityArray = null; if (documentVisibilityObject instanceof Object[]) { documentVisibilityArray = (Object[]) documentVisibilityObject; } else if (documentVisibilityObject instanceof List) { documentVisibilityArray = ((List<?>) documentVisibilityObject).toArray(); } final String documentVisibilityString = DocumentVisibilityUtil.multidimensionalArrayToBooleanString(documentVisibilityArray); final DocumentVisibility dv = documentVisibilityString == null ? MongoDbRdfConstants.EMPTY_DV : new DocumentVisibility(documentVisibilityString); return dv; } catch(final Exception e) { throw new MalformedDocumentVisibilityException("Failed to make Document Visibility from Mongo Object, it is malformed.", e); } } private  DocumentVisibilityAdapter(); static Document toDocument(final byte[] expression); static Document toDocument(final DocumentVisibility documentVisibility); static DocumentVisibility toDocumentVisibility(final Document doc); static final String DOCUMENT_VISIBILITY_KEY; }