Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
hmiguim committed Nov 20, 2023
1 parent f500d8e commit 37afb4e
Show file tree
Hide file tree
Showing 9 changed files with 332 additions and 314 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2075,6 +2075,10 @@ public enum RODA_TYPE {
public static final String SYNCHRONIZATION_ENTITY_SUMMARY_TYPE_UPDATED = "updated";
public static final String SYNCHRONIZATION_ENTITY_SUMMARY_TYPE_ISSUE = "issue";

public static final String PLUGIN_PARAMS_CONVERSION_REPRESENTATION = "rep";

public static final String PLUGIN_PARAMS_CONVERSION_DISSEMINATION = "dip";

/** Private empty constructor */
private RodaConstants() {
// do nothing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,25 +91,9 @@ public abstract class AbstractConvertPlugin<T extends IsRODAObject> extends Abst
PluginParameterType.BOOLEAN, "true", false, false,
"Do not process files that have a different format from the indicated."));

pluginParameters.put(RodaConstants.PLUGIN_PARAMS_REPRESENTATION_OR_DIP, new PluginParameter(
RodaConstants.PLUGIN_PARAMS_REPRESENTATION_OR_DIP, "Create dissemination", PluginParameterType.BOOLEAN, "true",
false, false,
"If this is selected then the plugin will convert the files and create a new dissemination. If not, a new representation will be created."));

pluginParameters.put(RodaConstants.PLUGIN_PARAMS_DISSEMINATION_TITLE,
new PluginParameter(RodaConstants.PLUGIN_PARAMS_DISSEMINATION_TITLE, "Dissemination title",
PluginParameterType.STRING, "Dissemination title", false, false,
"If the 'create dissemination' option is checked, then this will be the respective dissemination title."));

pluginParameters.put(RodaConstants.PLUGIN_PARAMS_DISSEMINATION_DESCRIPTION, new PluginParameter(
RodaConstants.PLUGIN_PARAMS_DISSEMINATION_DESCRIPTION, "Dissemination description", PluginParameterType.STRING,
"Dissemination description", false, false,
"If the 'create dissemination' option is checked, then this will be the respective dissemination description."));

pluginParameters.put(RodaConstants.PLUGIN_PARAMS_REPRESENTATION_TYPE,
new PluginParameter(RodaConstants.PLUGIN_PARAMS_REPRESENTATION_TYPE, "Representation type",
PluginParameterType.REPRESENTATION_TYPE, "", false, false,
"Attribute a type when creating a new representation"));
pluginParameters.put(RodaConstants.PLUGIN_PARAMS_REPRESENTATION_OR_DIP,
new PluginParameter.PluginParameterBuilder(RodaConstants.PLUGIN_PARAMS_REPRESENTATION_OR_DIP, "",
PluginParameterType.CONVERSION).build());
}

private String inputFormat;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,11 @@ public class ActionLogCleanerPlugin extends AbstractPlugin<Void> {
private static final Map<String, PluginParameter> pluginParameters = new HashMap<>();

static {
pluginParameters.put(RodaConstants.PLUGIN_PARAMS_DELETE_OLDER_THAN_X_DAYS, new PluginParameter.PluginParameterBuilder(
RodaConstants.PLUGIN_PARAMS_DELETE_OLDER_THAN_X_DAYS, "Delete older than X days", PluginParameterType.INTEGER)
.withDefaultValue("90").isMandatory(false).isReadOnly(false)
.withDescription("The plugin will delete all logs older than the specified number of days.").build());

pluginParameters.put("test", new PluginParameter.PluginParameterBuilder("test", "rep or diss test", PluginParameterType.CONVERSION).build());
pluginParameters.put(RodaConstants.PLUGIN_PARAMS_DELETE_OLDER_THAN_X_DAYS,
new PluginParameter.PluginParameterBuilder(RodaConstants.PLUGIN_PARAMS_DELETE_OLDER_THAN_X_DAYS,
"Delete older than X days", PluginParameterType.INTEGER).withDefaultValue("90").isMandatory(false)
.isReadOnly(false).withDescription("The plugin will delete all logs older than the specified number of days.")
.build());
}

private int deleteOlderThanXDays = 90;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import java.util.List;
import java.util.Map;

import org.roda.core.data.common.RodaConstants;
import org.roda.core.data.v2.jobs.PluginInfo;
import org.roda.core.data.v2.jobs.PluginParameter;

Expand Down Expand Up @@ -63,9 +64,18 @@ public Map<String, String> getValue() {

for (PluginParameterPanel panel : panels) {
String key = panel.getParameter().getId();
String value = panel.getValue();
if (value != null) {
ret.put(key, value);
if (panel.isConversionPanel()) {
if (panel.getValue().equals(RodaConstants.PLUGIN_PARAMS_CONVERSION_DISSEMINATION)) {
ret.put(key, panel.getDisseminationParameter().printAsParameter(panel.getValue()));
} else {
ret.put(key,
panel.getRepresentationParameter().printAsParameter(RodaConstants.PLUGIN_PARAMS_CONVERSION_REPRESENTATION));
}
} else {
String value = panel.getValue();
if (value != null) {
ret.put(key, value);
}
}
}

Expand Down
Loading

0 comments on commit 37afb4e

Please sign in to comment.