@Test public void testCheckXObjectPresenceWithEmptyList() throws Exception { Object object = new Object(); List<String> xObjectTypes = Collections.EMPTY_LIST; assertTrue(this.mocker.getComponentUnderTest().checkXObjectPresence(xObjectTypes, object)); }
@Override public boolean checkXObjectPresence(List<String> xObjectTypes, Object source) { if (xObjectTypes.isEmpty()) { return true; } else if (source instanceof XWikiDocument) { XWikiDocument document = (XWikiDocument) source; Map<DocumentReference, List<BaseObject>> documentXObjects = document.getXObjects(); for (String objectType : xObjectTypes) { LocalDocumentReference localXObjectReference = documentReferenceResolver.resolve(objectType).getLocalDocumentReference(); for (DocumentReference documentReference : documentXObjects.keySet()) { if (documentReference.getLocalDocumentReference().equals(localXObjectReference)) { return true; } } } } return false; }
DefaultModelBridge implements ModelBridge { @Override public boolean checkXObjectPresence(List<String> xObjectTypes, Object source) { if (xObjectTypes.isEmpty()) { return true; } else if (source instanceof XWikiDocument) { XWikiDocument document = (XWikiDocument) source; Map<DocumentReference, List<BaseObject>> documentXObjects = document.getXObjects(); for (String objectType : xObjectTypes) { LocalDocumentReference localXObjectReference = documentReferenceResolver.resolve(objectType).getLocalDocumentReference(); for (DocumentReference documentReference : documentXObjects.keySet()) { if (documentReference.getLocalDocumentReference().equals(localXObjectReference)) { return true; } } } } return false; } }
DefaultModelBridge implements ModelBridge { @Override public boolean checkXObjectPresence(List<String> xObjectTypes, Object source) { if (xObjectTypes.isEmpty()) { return true; } else if (source instanceof XWikiDocument) { XWikiDocument document = (XWikiDocument) source; Map<DocumentReference, List<BaseObject>> documentXObjects = document.getXObjects(); for (String objectType : xObjectTypes) { LocalDocumentReference localXObjectReference = documentReferenceResolver.resolve(objectType).getLocalDocumentReference(); for (DocumentReference documentReference : documentXObjects.keySet()) { if (documentReference.getLocalDocumentReference().equals(localXObjectReference)) { return true; } } } } return false; }  }
DefaultModelBridge implements ModelBridge { @Override public boolean checkXObjectPresence(List<String> xObjectTypes, Object source) { if (xObjectTypes.isEmpty()) { return true; } else if (source instanceof XWikiDocument) { XWikiDocument document = (XWikiDocument) source; Map<DocumentReference, List<BaseObject>> documentXObjects = document.getXObjects(); for (String objectType : xObjectTypes) { LocalDocumentReference localXObjectReference = documentReferenceResolver.resolve(objectType).getLocalDocumentReference(); for (DocumentReference documentReference : documentXObjects.keySet()) { if (documentReference.getLocalDocumentReference().equals(localXObjectReference)) { return true; } } } } return false; }  @Override DocumentReference getAuthorReference(EntityReference entityReference); @Override boolean checkXObjectPresence(List<String> xObjectTypes, Object source); }
DefaultModelBridge implements ModelBridge { @Override public boolean checkXObjectPresence(List<String> xObjectTypes, Object source) { if (xObjectTypes.isEmpty()) { return true; } else if (source instanceof XWikiDocument) { XWikiDocument document = (XWikiDocument) source; Map<DocumentReference, List<BaseObject>> documentXObjects = document.getXObjects(); for (String objectType : xObjectTypes) { LocalDocumentReference localXObjectReference = documentReferenceResolver.resolve(objectType).getLocalDocumentReference(); for (DocumentReference documentReference : documentXObjects.keySet()) { if (documentReference.getLocalDocumentReference().equals(localXObjectReference)) { return true; } } } } return false; }  @Override DocumentReference getAuthorReference(EntityReference entityReference); @Override boolean checkXObjectPresence(List<String> xObjectTypes, Object source);  }