private String getMacroName(BaseObject macroDefinition, String macroId) { String macroName = macroDefinition.getStringValue(MACRO_NAME_PROPERTY); // Verify macro name. if (StringUtils.isEmpty(macroName)) { macroName = macroId; this.logger.debug("Incomplete macro definition in [{}], macro name is empty", macroDefinition.getReference()); } return macroName; }
private void checkMacroCode(BaseObject macroDefinition) throws WikiMacroException { String macroCode = macroDefinition.getStringValue(MACRO_CODE_PROPERTY); if (StringUtils.isEmpty(macroCode)) { throw new WikiMacroException(String.format("Incomplete macro definition in [%s], macro code is empty", macroDefinition.getReference())); } }
private String getMacroId(BaseObject macroDefinition) throws WikiMacroException { String macroId = macroDefinition.getStringValue(MACRO_ID_PROPERTY); // Verify macro id. if (StringUtils.isEmpty(macroId)) { throw new WikiMacroException(String.format("Incomplete macro definition in [%s], macro id is empty", macroDefinition.getReference())); } return macroId; }
/** * @param document the document * @param result the list to add reference to */ private void addObjectsReferences(XWikiDocument document, List<EntityReference> result) { for (Entry<DocumentReference, List<BaseObject>> entry : document.getXObjects().entrySet()) { List<BaseObject> objects = entry.getValue(); for (BaseObject object : objects) { if (object != null) { BaseObjectReference objectReference = object.getReference(); try { Iterables.addAll(result, this.objectResolverProvider.get().getReferences(objectReference)); } catch (Exception e) { this.logger.error("Failed to resolve references for object [" + objectReference + "]", e); } } } } }
private void registerObjectComponents(XWikiDocument document) { for (Map.Entry<DocumentReference, List<BaseObject>> entry : document.getXObjects().entrySet()) { WikiObjectComponentBuilder componentBuilder = getAssociatedComponentBuilder(entry.getKey()); if (componentBuilder != null) { for (BaseObject baseObject : entry.getValue()) { if (baseObject != null) { this.wikiObjectComponentManagerEventListenerProxy .registerObjectComponents(baseObject.getReference(), baseObject, componentBuilder); } } } } }
private void unRegisterObjectComponents(XWikiDocument document) { for (Map.Entry<DocumentReference, List<BaseObject>> entry : document.getXObjects().entrySet()) { WikiObjectComponentBuilder componentBuilder = getAssociatedComponentBuilder(entry.getKey()); if (componentBuilder != null) { for (BaseObject baseObject : entry.getValue()) { if (baseObject != null) { this.wikiObjectComponentManagerEventListenerProxy .unregisterObjectComponents(baseObject.getReference()); } } } } }
@Override public List<WikiComponent> buildComponents(BaseObject baseObject) throws WikiComponentException { try { String id = this.serializer.serialize(baseObject.getDocumentReference()); return Collections .<WikiComponent>singletonList(new PanelWikiUIExtension(baseObject, id, this.componentManager)); } catch (ComponentLookupException e) { throw new WikiComponentException( String.format("Failed to initialize Panel UI extension [%s]", baseObject.getReference()), e); } } }
/** * @param baseObject the object containing the component definition * @param roleType the role Type implemented * @param roleHint the role hint for this role implementation */ public AbstractBaseObjectWikiComponent(BaseObject baseObject, Type roleType, String roleHint) { this.objectReference = baseObject.getReference(); this.authorReference = baseObject.getOwnerDocument().getAuthorReference(); this.roleType = roleType; this.roleHint = roleHint; this.scope = WikiComponentScope.fromString(baseObject.getStringValue(XPROPERTY_SCOPE)); }
objectParameters.put(WikiObjectFilter.PARAMETER_NUMBER, xobject.getNumber()); objectFilter.beginWikiObject(xobject.getReference().getName(), objectParameters); objectFilter.endWikiObject(xobject.getReference().getName(), objectParameters);
String roleHint = this.serializer.serialize(baseObject.getReference()); } catch (ComponentLookupException e) { throw new WikiComponentException( String.format("Failed to initialize Panel UI extension [%s]", baseObject.getReference()), e);
throws NotificationException this.objectReference = baseObject.getReference(); this.componentManager = componentManager; this.authorReference = authorReference;
Utils.getComponent(LESSResourceReferenceFactory.class); ObjectPropertyReference objectPropertyReference = new ObjectPropertyReference(CONTENT_PROPERTY_NAME, sxObj.getReference()); LESSResourceReference lessResourceReference = lessResourceReferenceFactory.createReferenceForXObjectProperty(objectPropertyReference);
BaseObjectReference xObjectReference = xObject.getReference(); builderHelper = this.entityReferenceSerializer.serialize(xObjectReference.getXClassReference());
@Override public boolean setFieldsInternal(LengthSolrInputDocument solrDocument, EntityReference entityReference) throws Exception { BaseObjectReference objectReference = new BaseObjectReference(entityReference); DocumentReference classReference = objectReference.getXClassReference(); DocumentReference documentReference = new DocumentReference(objectReference.getParent()); XWikiDocument originalDocument = getDocument(documentReference); BaseObject object = originalDocument.getXObject(objectReference); if (object == null) { return false; } solrDocument.setField(FieldUtils.ID, resolver.getId(object.getReference())); setDocumentFields(documentReference, solrDocument); solrDocument.setField(FieldUtils.TYPE, objectReference.getType().name()); solrDocument.setField(FieldUtils.CLASS, localSerializer.serialize(classReference)); solrDocument.setField(FieldUtils.NUMBER, objectReference.getObjectNumber()); setLocaleAndContentFields(documentReference, solrDocument, object); return true; }