preferenceRegistry.getPreferenceEntities(PreferenceVisibility.INSTANCE);
for (PreferenceEntity entity : entitiesWithInstanceProperties) {
if (entity.getMappedTo() != null && entity.getMappedTo().length() > 0) {
// All INSTANCE properties of this entity are for one macro, ignore whatever is configured on the properties
String macroPluginKey = entity.getMappedTo();
MacroPluginModule macroPluginModule = registry.getMacroPluginModulesByKey().get(macroPluginKey);
if (macroPluginModule != null) {
log.debug("binding all INSTANCE properties as parameters of macro '" + macroPluginModule.getName() +"': " + entity);
macroPluginModule.setPreferenceEntity(entity);
} else {
throw new InvalidWikiConfigurationException(
"Configured mapping to macro module '"+macroPluginKey+"' not found for " + entity
);
}
} else {
// Some INSTANCE properties are for one macro, others for other macros, so we need to mix and match
for (PreferenceEntity.Property property : entity.getPropertiesInstanceVisible()) {
if (property.getMappedTo() == null || property.getMappedTo().length() == 0) continue;
String macroPluginKey = property.getMappedTo();
MacroPluginModule macroPluginModule = registry.getMacroPluginModulesByKey().get(macroPluginKey);
if (macroPluginModule != null) {
log.debug("binding INSTANCE property as parameter of macro '" + macroPluginModule.getName() +"': " + property);
macroPluginModule.setPreferenceEntity(entity);
macroPluginModule.getParameters().add(property);
} else {
throw new InvalidWikiConfigurationException(
"Configured mapping to macro module '"+macroPluginKey+"' not found for " + property + " in " + entity
);
}