diff --git a/roda-common/roda-common-data/src/main/java/org/roda/core/data/v2/jobs/PluginParameter.java b/roda-common/roda-common-data/src/main/java/org/roda/core/data/v2/jobs/PluginParameter.java index 89e5720258..1f99441f9e 100644 --- a/roda-common/roda-common-data/src/main/java/org/roda/core/data/v2/jobs/PluginParameter.java +++ b/roda-common/roda-common-data/src/main/java/org/roda/core/data/v2/jobs/PluginParameter.java @@ -63,6 +63,13 @@ public PluginParameter(PluginParameterBuilder builder) { * @param readonly * @param description */ + + /** + * @deprecated It will be removed in the next major version. Due to + * maintainability, a constructor shouldn't have to many arguments. + * Use instead the builder + * {@link #PluginParameter(PluginParameterBuilder)} + */ public PluginParameter(String id, String name, PluginParameterType type, String defaultValue, boolean mandatory, boolean readonly, String description) { setId(id); @@ -87,6 +94,12 @@ public PluginParameter(String id, String name, PluginParameterType type, String * @param readonly * @param description */ + /** + * @deprecated It will be removed in the next major version. Due to + * maintainability, a constructor shouldn't have to many arguments. + * Use instead the builder + * {@link #PluginParameter(PluginParameterBuilder)} + */ public PluginParameter(String id, String name, PluginParameterType type, String value, List possibleValues, boolean mandatory, boolean readonly, String description) { setId(id); @@ -107,9 +120,10 @@ public PluginParameter(String id, String name, PluginParameterType type, String * the {@link PluginParameter} to clone. */ public PluginParameter(PluginParameter parameter) { - this(parameter.getId(), parameter.getName(), parameter.getType(), parameter.getDefaultValue(), - new ArrayList<>(parameter.getPossibleValues()), parameter.isMandatory(), parameter.isReadonly(), - parameter.getDescription()); + this(new PluginParameterBuilder(parameter.getId(), parameter.getName(), parameter.getType()) + .withDescription(parameter.getDescription()).withDefaultValue(parameter.getDefaultValue()) + .withPossibleValues(parameter.getPossibleValues()).isReadOnly(parameter.isReadonly()) + .isMandatory(parameter.isMandatory())); } /** @@ -402,7 +416,7 @@ public enum PluginParameterType { /** * Interface to users profiles */ - USER_PROFILE, + CONVERSION_PROFILE, /** * Interface to conversion plugins @@ -423,7 +437,6 @@ public static class PluginParameterBuilder { private boolean mandatory = true; private boolean readOnly = false; private String description = null; - private RenderingHints renderingHints = null; public PluginParameterBuilder(String id, String name, PluginParameter.PluginParameterType type) { this.id = id; @@ -459,11 +472,6 @@ public PluginParameterBuilder withDescription(String description) { this.description = description; return this; } - - public PluginParameterBuilder withRenderingHints(RenderingHints renderingHints) { - this.renderingHints = renderingHints; - return this; - } } } diff --git a/roda-core/roda-core/src/main/java/org/roda/core/plugins/base/conversion/AbstractConvertPlugin.java b/roda-core/roda-core/src/main/java/org/roda/core/plugins/base/conversion/AbstractConvertPlugin.java index f25983f52a..adc2c4da6e 100644 --- a/roda-core/roda-core/src/main/java/org/roda/core/plugins/base/conversion/AbstractConvertPlugin.java +++ b/roda-core/roda-core/src/main/java/org/roda/core/plugins/base/conversion/AbstractConvertPlugin.java @@ -92,8 +92,11 @@ public abstract class AbstractConvertPlugin extends Abst "Do not process files that have a different format from the indicated.")); pluginParameters.put(RodaConstants.PLUGIN_PARAMS_REPRESENTATION_OR_DIP, - new PluginParameter.PluginParameterBuilder(RodaConstants.PLUGIN_PARAMS_REPRESENTATION_OR_DIP, "", - PluginParameterType.CONVERSION).build()); + new PluginParameter.PluginParameterBuilder(RodaConstants.PLUGIN_PARAMS_REPRESENTATION_OR_DIP, + "Outcome", PluginParameterType.CONVERSION) + .withDescription( + "A conversion can create a representation or a dissemination. Please choose which option to output") + .build()); } private String inputFormat; @@ -113,7 +116,7 @@ protected AbstractConvertPlugin() { protected Map getDefaultParameters() { return pluginParameters.entrySet().stream() - .collect(Collectors.toMap(e -> e.getKey(), e -> new PluginParameter(e.getValue()))); + .collect(Collectors.toMap(Map.Entry::getKey, e -> new PluginParameter(e.getValue()))); } protected List orderParameters(Map params) { @@ -194,19 +197,25 @@ public void setParameterValues(Map parameters) throws InvalidPar } if (parameters.containsKey(RodaConstants.PLUGIN_PARAMS_REPRESENTATION_OR_DIP)) { - createDIP = Boolean.parseBoolean(parameters.get(RodaConstants.PLUGIN_PARAMS_REPRESENTATION_OR_DIP)); - } - - if (parameters.containsKey(RodaConstants.PLUGIN_PARAMS_DISSEMINATION_TITLE)) { - dipTitle = parameters.get(RodaConstants.PLUGIN_PARAMS_DISSEMINATION_TITLE); - } - - if (parameters.containsKey(RodaConstants.PLUGIN_PARAMS_DISSEMINATION_DESCRIPTION)) { - dipDescription = parameters.get(RodaConstants.PLUGIN_PARAMS_DISSEMINATION_DESCRIPTION); - } + String value = parameters.get(RodaConstants.PLUGIN_PARAMS_REPRESENTATION_OR_DIP); + + Map map = new HashMap<>(); + String[] keyValuePairs = value.split(";"); + for (String pair : keyValuePairs) { + String[] parts = pair.split("="); + if (parts.length == 2) { + map.put(parts[0].trim(), parts[1].trim()); + } + } - if (parameters.containsKey(RodaConstants.PLUGIN_PARAMS_REPRESENTATION_TYPE)) { - representationType = parameters.get(RodaConstants.PLUGIN_PARAMS_REPRESENTATION_TYPE); + if (map.get("type").equals(RodaConstants.PLUGIN_PARAMS_CONVERSION_REPRESENTATION)) { + createDIP = false; + representationType = map.get("value"); + } else { + createDIP = true; + dipTitle = map.get("title"); + dipDescription = map.get("description"); + } } hasPartialSuccessOnOutcome = Boolean.parseBoolean(RodaCoreFactory.getRodaConfigurationAsString("core", "tools", diff --git a/roda-core/roda-core/src/main/java/org/roda/core/plugins/base/maintenance/ActionLogCleanerPlugin.java b/roda-core/roda-core/src/main/java/org/roda/core/plugins/base/maintenance/ActionLogCleanerPlugin.java index 1cd27da860..45442bd613 100644 --- a/roda-core/roda-core/src/main/java/org/roda/core/plugins/base/maintenance/ActionLogCleanerPlugin.java +++ b/roda-core/roda-core/src/main/java/org/roda/core/plugins/base/maintenance/ActionLogCleanerPlugin.java @@ -83,7 +83,6 @@ public String getDescription() { public List getParameters() { ArrayList parameters = new ArrayList<>(); parameters.add(pluginParameters.get(RodaConstants.PLUGIN_PARAMS_DELETE_OLDER_THAN_X_DAYS)); - parameters.add(pluginParameters.get("test")); return parameters; } diff --git a/roda-ui/roda-wui/pom.xml b/roda-ui/roda-wui/pom.xml index 73fe5bb788..ba1d9b1672 100644 --- a/roda-ui/roda-wui/pom.xml +++ b/roda-ui/roda-wui/pom.xml @@ -261,6 +261,7 @@ server http://localhost:5138 + --add-opens java.base/java.util=ALL-UNNAMED false @@ -273,7 +274,6 @@ -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=*:5005 -Droda.environment.collect.version=false - --add-opens java.base/java.util=ALL-UNNAMED @@ -289,9 +289,11 @@ false true - - --add-opens java.base/java.util=ALL-UNNAMED - + + + --add-opens java.base/java.util=ALL-UNNAMED + + diff --git a/roda-ui/roda-wui/src/main/java/org/roda/wui/client/common/resources/main.gss b/roda-ui/roda-wui/src/main/java/org/roda/wui/client/common/resources/main.gss index c494a03843..a24b54f397 100644 --- a/roda-ui/roda-wui/src/main/java/org/roda/wui/client/common/resources/main.gss +++ b/roda-ui/roda-wui/src/main/java/org/roda/wui/client/common/resources/main.gss @@ -7866,3 +7866,15 @@ span.code { .ingest-tab-panel a { font-weight: bold; } + +.conversion-profile { + display: flex; + align-items: center; + margin-bottom: 5px; +} + +.conversion-profile select { + margin-right: 10px +} + + diff --git a/roda-ui/roda-wui/src/main/java/org/roda/wui/client/ingest/process/PluginParameterPanel.java b/roda-ui/roda-wui/src/main/java/org/roda/wui/client/ingest/process/PluginParameterPanel.java index 15a82dffa1..0d29e8dc67 100644 --- a/roda-ui/roda-wui/src/main/java/org/roda/wui/client/ingest/process/PluginParameterPanel.java +++ b/roda-ui/roda-wui/src/main/java/org/roda/wui/client/ingest/process/PluginParameterPanel.java @@ -14,8 +14,6 @@ import java.util.Set; import java.util.TreeSet; -import com.google.gwt.dom.client.Document; -import com.google.gwt.event.dom.client.DomEvent; import org.roda.core.data.common.RodaConstants; import org.roda.core.data.utils.RepresentationInformationUtils; import org.roda.core.data.v2.common.Pair; @@ -44,9 +42,11 @@ import org.roda.wui.common.client.tools.StringUtils; import com.google.gwt.core.client.GWT; +import com.google.gwt.dom.client.Document; import com.google.gwt.event.dom.client.ChangeEvent; import com.google.gwt.event.dom.client.ChangeHandler; import com.google.gwt.event.dom.client.ClickHandler; +import com.google.gwt.event.dom.client.DomEvent; import com.google.gwt.event.logical.shared.ValueChangeHandler; import com.google.gwt.i18n.client.LocaleInfo; import com.google.gwt.safehtml.shared.SafeHtmlUtils; @@ -91,6 +91,7 @@ public PluginParameterPanel(PluginParameter parameter) { this.parameter = parameter; layout = new FlowPanel(); + initWidget(layout); updateLayout(); @@ -127,8 +128,8 @@ private void updateLayout() { createPermissionTypesLayout(); } else if (PluginParameterType.DROPDOWN.equals(parameter.getType())) { createDropdownLayout(); - } else if (PluginParameterType.USER_PROFILE.equals(parameter.getType())) { - createUserProfileLayout(); + } else if (PluginParameterType.CONVERSION_PROFILE.equals(parameter.getType())) { + createConversionProfileLayout(); } else if (PluginParameterType.CONVERSION.equals(parameter.getType())) { createConversionLayout(); } else { @@ -186,8 +187,8 @@ private void createConversionLayout() { dropdown.setTitle(OBJECT_BOX); layout.add(parameterName); layout.add(dropdown); - layout.add(innerPanel); addHelp(); + layout.add(innerPanel); } private void setSelectedIndexAndFireEvent(final ListBox listBox, final int index) { @@ -469,7 +470,7 @@ public void onSuccess(Set> result) { addHelp(); } - private void createUserProfileLayout() { + private void createConversionProfileLayout() { Set treeSet = new HashSet<>(); Label parameterName = new Label(parameter.getName()); final Label description = new Label(); @@ -477,6 +478,8 @@ private void createUserProfileLayout() { dropdown.addStyleName(FORM_SELECTBOX); dropdown.addStyleName(FORM_TEXTBOX_SMALL); + FlowPanel panel = new FlowPanel(); + BrowserService.Util.getInstance().retrieveUserProfilePluginItems(parameter.getId(), LocaleInfo.getCurrentLocale().getLocaleName(), new AsyncCallback>() { @@ -514,12 +517,14 @@ public void onSuccess(Set result) { } }); + panel.add(dropdown); + panel.add(description); + panel.addStyleName("conversion-profile"); + dropdown.setTitle(OBJECT_BOX); layout.add(parameterName); - layout.add(description); - layout.add(dropdown); - addHelp(); + layout.add(panel); } private void createPluginObjectFieldsLayout(final String className) { diff --git a/roda-ui/roda-wui/src/main/java/org/roda/wui/client/ingest/process/ShowJob.java b/roda-ui/roda-wui/src/main/java/org/roda/wui/client/ingest/process/ShowJob.java index f110a1de87..3bce6d11b7 100644 --- a/roda-ui/roda-wui/src/main/java/org/roda/wui/client/ingest/process/ShowJob.java +++ b/roda-ui/roda-wui/src/main/java/org/roda/wui/client/ingest/process/ShowJob.java @@ -14,14 +14,11 @@ import java.util.Arrays; import java.util.Date; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Set; import org.roda.core.data.common.RodaConstants; import org.roda.core.data.exceptions.NotFoundException; -import org.roda.core.data.v2.common.UserProfile; import org.roda.core.data.v2.index.facet.Facets; import org.roda.core.data.v2.index.filter.Filter; import org.roda.core.data.v2.index.filter.FilterParameter; @@ -46,7 +43,6 @@ import org.roda.core.data.v2.jobs.PluginType; import org.roda.core.data.v2.synchronization.central.DistributedInstance; import org.roda.core.data.v2.synchronization.local.LocalInstance; -import org.roda.core.data.v2.user.User; import org.roda.wui.client.browse.BrowserService; import org.roda.wui.client.common.NoAsyncCallback; import org.roda.wui.client.common.UserLogin; @@ -65,7 +61,6 @@ import org.roda.wui.client.common.utils.HtmlSnippetUtils; import org.roda.wui.client.common.utils.JavascriptUtils; import org.roda.wui.client.common.utils.SidebarUtils; -import org.roda.wui.client.management.Statistics; import org.roda.wui.client.management.distributed.ShowDistributedInstance; import org.roda.wui.client.process.Process; import org.roda.wui.common.client.HistoryResolver; @@ -353,8 +348,8 @@ public void onSuccess(DistributedInstance distributedInstance) { createPluginSipToAipLayout(parameter); } else if (PluginParameterType.AIP_ID.equals(parameter.getType())) { createSelectAipLayout(parameter); - } else if (PluginParameterType.USER_PROFILE.equals(parameter.getType())) { - createUserProfileLayout(parameter); + } else if (PluginParameterType.CONVERSION_PROFILE.equals(parameter.getType())) { + createConvertProfileLayout(parameter); } else if (PluginParameterType.CONVERSION.equals(parameter.getType())) { createConversionLayout(parameter); } else { @@ -858,7 +853,7 @@ private void createPluginSipToAipLayout(PluginParameter parameter) { } } - private void createUserProfileLayout(PluginParameter parameter) { + private void createConvertProfileLayout(PluginParameter parameter) { String value = job.getPluginParameters().get(parameter.getId()); if (value == null) { value = parameter.getDefaultValue(); diff --git a/roda-ui/roda-wui/src/main/java/org/roda/wui/client/ingest/process/model/DisseminationParameter.java b/roda-ui/roda-wui/src/main/java/org/roda/wui/client/ingest/process/model/DisseminationParameter.java index 19b76676f9..3eaf02198d 100644 --- a/roda-ui/roda-wui/src/main/java/org/roda/wui/client/ingest/process/model/DisseminationParameter.java +++ b/roda-ui/roda-wui/src/main/java/org/roda/wui/client/ingest/process/model/DisseminationParameter.java @@ -1,6 +1,6 @@ package org.roda.wui.client.ingest.process.model; -public class DisseminationParameter implements PrintableParameter{ +public class DisseminationParameter implements PrintableParameter { private String title = "Dissemination title"; private String description = "Dissemination description";