}
}
public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
String configId = request.getParameter("configId");
PluginInstaller pluginInstaller = ManagementHelper.getManagementHelper(request).getPluginInstaller();
PluginType metadata = pluginInstaller.getPluginMetadata(Artifact.create(configId));
PluginArtifactType instance = metadata.getPluginArtifact().get(0);
String name = request.getParameter("name");
metadata.setName(name);
metadata.setCategory(request.getParameter("category"));
metadata.setUrl(request.getParameter("url"));
metadata.setAuthor(request.getParameter("author"));
metadata.setDescription(request.getParameter("description"));
String licenseString = request.getParameter("license");
String osi = request.getParameter("licenseOSI");
List<LicenseType> licenses = metadata.getLicense();
if (!licenses.isEmpty()) {
licenses.remove(0);
}
if (licenseString != null && !licenseString.trim().equals("")) {
LicenseType license = new LicenseType();
license.setValue(licenseString.trim());
license.setOsiApproved(osi != null && !osi.equals(""));
licenses.add(0, license);
}
String jvmsString = request.getParameter("jvmVersions");
split(jvmsString, instance.getJvmVersion());
String deps = request.getParameter("dependencies");
toDependencies(split(deps), instance.getDependency());
String obsoletes = request.getParameter("obsoletes");
toArtifacts(split(obsoletes), instance.getObsoletes());
String repo = request.getParameter("repository");
split(repo, instance.getSourceRepository());
//TODO this is wrong, we are only supplying one version to the UI
String version = request.getParameter("geronimoVersion");
split(version, instance.getGeronimoVersion());
List<PrerequisiteType> prereqs = instance.getPrerequisite();
//TODO this is probably wrong if # of prereqs is changed.
for (int i = 0; i < 3 && !prereqs.isEmpty(); i++) {
prereqs.remove(0);
}
int counter = 1;
while (true) {
String prefix = "prereq" + counter;
++counter;
String id = request.getParameter(prefix);
if (id == null || id.trim().equals("")) {
break;
}
String type = request.getParameter(prefix + "type");
String desc = request.getParameter(prefix + "desc");
if (type != null && type.trim().equals("")) {
type = null;
}
if (desc != null && desc.trim().equals("")) {
desc = null;
}
PrerequisiteType prereq = new PrerequisiteType();
prereq.setResourceType(type);
prereq.setDescription(desc);
prereq.setId(PluginInstallerGBean.toArtifactType(Artifact.create(id)));
prereqs.add(counter - 1, prereq);
}
// Save updated metadata
pluginInstaller.updatePluginMetadata(metadata);
response.setRenderParameter("configId", configId);
response.setRenderParameter("name", name);
return CONFIRM_EXPORT_MODE + BEFORE_ACTION;