29 lines
1.2 KiB
Java
29 lines
1.2 KiB
Java
package org.gcube.application.cms.plugins;
|
|
|
|
import org.gcube.application.cms.plugins.faults.InvalidProfileException;
|
|
import org.gcube.application.cms.plugins.model.PluginDescriptor;
|
|
import org.gcube.application.cms.plugins.reports.DocumentHandlingReport;
|
|
import org.gcube.application.cms.plugins.requests.BaseExecutionRequest;
|
|
import org.gcube.application.geoportal.common.model.profile.HandlerDeclaration;
|
|
import org.gcube.application.geoportal.common.model.profile.Profile;
|
|
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
public abstract class AbstractPlugin implements Plugin{
|
|
|
|
|
|
|
|
|
|
|
|
protected HandlerDeclaration getConfigurationFromProfile(Profile profile) throws InvalidProfileException{
|
|
return getMultipleDeclarationsFromProfile(profile).get(0);
|
|
}
|
|
protected List<HandlerDeclaration> getMultipleDeclarationsFromProfile(Profile p)throws InvalidProfileException {
|
|
Map<String,List<HandlerDeclaration>> map = p.getHandlersMapByID();
|
|
if(map.containsKey(getDescriptor().getId()))
|
|
return map.get(getDescriptor().getId());
|
|
else throw new InvalidProfileException("No Configuration found for "+getDescriptor().getId()+" in "+p.getId());
|
|
}
|
|
}
|