diff --git a/cms-plugin-framework/src/main/java/org/gcube/application/cms/plugins/implementations/SimpleLifeCycleManager.java b/cms-plugin-framework/src/main/java/org/gcube/application/cms/plugins/implementations/SimpleLifeCycleManager.java index dff7b64..0cba12d 100644 --- a/cms-plugin-framework/src/main/java/org/gcube/application/cms/plugins/implementations/SimpleLifeCycleManager.java +++ b/cms-plugin-framework/src/main/java/org/gcube/application/cms/plugins/implementations/SimpleLifeCycleManager.java @@ -175,7 +175,7 @@ public class SimpleLifeCycleManager extends AbstractLifeCycleManager implements log.trace("Looking for Indexers for {}",request); ArrayList toReturn=new ArrayList<>(); UseCaseDescriptor desc = request.getUseCaseDescriptor(); - List indexers = desc.getHandlersMapByType().get(IndexerPluginDescriptor.INDEXER); + List indexers = desc.getHandlersByType(IndexerPluginDescriptor.INDEXER); log.debug("Found UCD [{}] Indexers : {}",desc.getId(),indexers.size()); for (HandlerDeclaration handlerDeclaration : indexers) toReturn.add((IndexerPluginInterface) pluginManager.getById(handlerDeclaration.getId())); @@ -186,7 +186,7 @@ public class SimpleLifeCycleManager extends AbstractLifeCycleManager implements log.trace("Looking for materializers for {}",request); ArrayList toReturn=new ArrayList<>(); UseCaseDescriptor desc = request.getUseCaseDescriptor(); - List materializers = desc.getHandlersMapByType().get(MaterializerPluginDescriptor.MATERIALIZER); + List materializers = desc.getHandlersByType(MaterializerPluginDescriptor.MATERIALIZER); log.debug("Found UCD [{}] Materializers : {}",desc.getId(),materializers.size()); for (HandlerDeclaration handlerDeclaration : materializers) { toReturn.add((MaterializationPlugin) pluginManager.getById(handlerDeclaration.getId())); diff --git a/geoportal-common/src/main/java/org/gcube/application/geoportal/common/model/useCaseDescriptor/UseCaseDescriptor.java b/geoportal-common/src/main/java/org/gcube/application/geoportal/common/model/useCaseDescriptor/UseCaseDescriptor.java index 5e5a4bf..6859b01 100644 --- a/geoportal-common/src/main/java/org/gcube/application/geoportal/common/model/useCaseDescriptor/UseCaseDescriptor.java +++ b/geoportal-common/src/main/java/org/gcube/application/geoportal/common/model/useCaseDescriptor/UseCaseDescriptor.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; import javax.xml.bind.annotation.XmlRootElement; @@ -76,11 +77,29 @@ public class UseCaseDescriptor { }catch (Throwable t){ log.error("Invalid useCaseDescriptor : unable to get Handler Map by Type with {} in useCaseDescriptor [ID {}]",h,this.getId(),t);} }); + if(log.isTraceEnabled()) { + toReturn.forEach((s, handlerDeclarations) -> log.trace("UCD {} : Found N {} handlers of type {}",this.getId(),handlerDeclarations.size(),s)); + } return toReturn; } /** - * Returns map Type -> Handler Declaration + * Returns List of Handler Declaration by type + * + * @param type + * @return + */ + @JsonIgnore + public List getHandlersByType(String type){ + List toReturn= + handlers.stream().sequential(). + filter(handlerDeclaration -> handlerDeclaration.getType().equals(type)).collect(Collectors.toList()); + log.debug("UCD {} : Found {} Handlers for {}",getId(),toReturn.size(),type); + return toReturn; + } + + /** + * Returns map ID -> Handler Declaration * @return */ @JsonIgnore