Activation Record for VM removed
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/admin/resource-management@70617 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
60709a8393
commit
91aa01848f
13
.classpath
13
.classpath
|
@ -7,12 +7,22 @@
|
|||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry including="**/*.java" kind="src" output="src/main/webapp/WEB-INF/classes" path="src/main/resources"/>
|
||||
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
|
@ -24,5 +34,6 @@
|
|||
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/rmp-common-library"/>
|
||||
<classpathentry kind="output" path="target/resource-management-4.0.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
</classpath>
|
||||
|
|
|
@ -4,6 +4,12 @@
|
|||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
<dependent-module archiveName="rmp-common-library-1.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/rmp-common-library/rmp-common-library">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module archiveName="activation-record-widgets-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/activation-record-widgets/activation-record-widgets">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
|
||||
<property name="context-root" value="resource-management"/>
|
||||
</wb-module>
|
||||
|
|
5
pom.xml
5
pom.xml
|
@ -145,6 +145,11 @@
|
|||
<artifactId>software-upload-wizard</artifactId>
|
||||
<version>[1.1.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.admin</groupId>
|
||||
<artifactId>activation-record-widgets</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.allen-sauer.gwt.log</groupId>
|
||||
<artifactId>gwt-log</artifactId>
|
||||
|
|
|
@ -17,11 +17,11 @@
|
|||
package org.gcube.portlets.admin.resourcemanagement.client;
|
||||
|
||||
|
||||
import org.gcube.portlets.admin.client.forms.ActivationRecordVMForm;
|
||||
import org.gcube.portlets.admin.client.forms.GenericResourceCMForm;
|
||||
import org.gcube.portlets.admin.client.forms.GenericResourceTreeManagerForm;
|
||||
import org.gcube.portlets.admin.ishealthmonitor.client.dialog.ISMonitor;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.forms.genericresources.ActivationRecordVMForm;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.forms.genericresources.DeployVirtualCollection;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.forms.genericresources.GenericResourceCMForm;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.forms.genericresources.GenericResourceTreeManagerForm;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.remote.ProxyRegistry;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.utils.Commands;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.utils.Messages;
|
||||
|
@ -35,8 +35,6 @@ import org.gcube.portlets.admin.resourcemanagement.client.widgets.panels.MainPan
|
|||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.registry.UIIdentifiers;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.registry.WidgetsRegistry;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.viewport.MainContainer;
|
||||
import org.gcube.portlets.admin.resourcemanagement.shared.Configuration;
|
||||
import org.gcube.portlets.admin.resourcemanagement.shared.utils.DelayedOperation;
|
||||
import org.gcube.portlets.admin.resourcesweeper.client.dialog.SweeperDialog;
|
||||
import org.gcube.resourcemanagement.support.client.Resource_support;
|
||||
import org.gcube.resourcemanagement.support.client.events.SetScopeEvent;
|
||||
|
@ -47,6 +45,7 @@ import org.gcube.resourcemanagement.support.shared.exceptions.InvalidParameterEx
|
|||
import org.gcube.resourcemanagement.support.shared.operations.SupportedOperations;
|
||||
import org.gcube.resourcemanagement.support.shared.types.RunningMode;
|
||||
import org.gcube.resourcemanagement.support.shared.types.UserGroup;
|
||||
import org.gcube.resourcemanagement.support.shared.util.Configuration;
|
||||
|
||||
import com.extjs.gxt.ui.client.Style.LayoutRegion;
|
||||
import com.extjs.gxt.ui.client.Style.Scroll;
|
||||
|
@ -502,7 +501,17 @@ public class ResourceManagementPortlet implements EntryPoint {
|
|||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
if (SupportedOperations.GENERIC_RESOURCE_CREATE.isAllowed(StatusHandler.getStatus().getCredentials())) {
|
||||
new GenericResourceTreeManagerForm().show();
|
||||
GWT.runAsync(GenericResourceTreeManagerForm.class, new RunAsyncCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
String currentScope = StatusHandler.getStatus().getCurrentScope();
|
||||
new GenericResourceTreeManagerForm(currentScope).show();
|
||||
}
|
||||
|
||||
public void onFailure(Throwable reason) {
|
||||
Window.alert("There are networks problem, please check your connection.");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
MessageBox.alert("Activation Record for TM", "You are not allowed to execute this operation", null);
|
||||
}
|
||||
|
@ -516,7 +525,18 @@ public class ResourceManagementPortlet implements EntryPoint {
|
|||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
if (SupportedOperations.GENERIC_RESOURCE_CREATE.isAllowed(StatusHandler.getStatus().getCredentials())) {
|
||||
new GenericResourceCMForm().show();
|
||||
GWT.runAsync(GenericResourceCMForm.class, new RunAsyncCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
String currentScope = StatusHandler.getStatus().getCurrentScope();
|
||||
new GenericResourceCMForm(currentScope).show();
|
||||
}
|
||||
|
||||
public void onFailure(Throwable reason) {
|
||||
Window.alert("There are networks problem, please check your connection.");
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
MessageBox.alert("Activation Record for CM", "You are not allowed to execute this operation", null);
|
||||
}
|
||||
|
@ -531,7 +551,18 @@ public class ResourceManagementPortlet implements EntryPoint {
|
|||
super.onClick(be);
|
||||
if (SupportedOperations.GENERIC_RESOURCE_CREATE.isAllowed(StatusHandler.getStatus().getCredentials())) {
|
||||
//MessageBox.alert("Activation Record for VM", "Operation not implemented yet.", null);
|
||||
new ActivationRecordVMForm().show();
|
||||
|
||||
GWT.runAsync(ActivationRecordVMForm.class, new RunAsyncCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
String currentScope = StatusHandler.getStatus().getCurrentScope();
|
||||
new ActivationRecordVMForm(currentScope).show();
|
||||
}
|
||||
|
||||
public void onFailure(Throwable reason) {
|
||||
Window.alert("There are networks problem, please check your connection.");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
MessageBox.alert("Activation Record for VM", "You are not allowed to execute this operation", null);
|
||||
}
|
||||
|
|
|
@ -1,420 +0,0 @@
|
|||
/****************************************************************************
|
||||
= * This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: ActivationRecordVMForm.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.client.forms.genericresources;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.remote.ProxyRegistry;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.utils.Commands;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.utils.OpCommands;
|
||||
|
||||
|
||||
import org.gcube.resourcemanagement.support.client.utils.StatusHandler;
|
||||
import org.gcube.resourcemanagement.support.client.views.ResourceTypeDecorator;
|
||||
import org.gcube.resourcemanagement.support.client.views.validators.SelectValidator;
|
||||
import org.gcube.resourcemanagement.support.shared.exceptions.InvalidParameterException;
|
||||
import org.gcube.resourcemanagement.support.shared.types.Tuple;
|
||||
import org.gcube.resourcemanagement.support.shared.types.datamodel.AtomicTreeNode;
|
||||
import org.gcube.resourcemanagement.support.shared.types.datamodel.ResourceDescriptor;
|
||||
|
||||
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
|
||||
import com.extjs.gxt.ui.client.Style.Scroll;
|
||||
import com.extjs.gxt.ui.client.data.ModelData;
|
||||
import com.extjs.gxt.ui.client.event.ComponentEvent;
|
||||
import com.extjs.gxt.ui.client.store.ListStore;
|
||||
import com.extjs.gxt.ui.client.widget.Dialog;
|
||||
import com.extjs.gxt.ui.client.widget.HorizontalPanel;
|
||||
import com.extjs.gxt.ui.client.widget.MessageBox;
|
||||
import com.extjs.gxt.ui.client.widget.button.Button;
|
||||
import com.extjs.gxt.ui.client.widget.form.ComboBox;
|
||||
import com.extjs.gxt.ui.client.widget.form.Field;
|
||||
import com.extjs.gxt.ui.client.widget.form.FieldSet;
|
||||
import com.extjs.gxt.ui.client.widget.form.FormButtonBinding;
|
||||
import com.extjs.gxt.ui.client.widget.form.FormPanel;
|
||||
import com.extjs.gxt.ui.client.widget.form.TextArea;
|
||||
import com.extjs.gxt.ui.client.widget.form.TextField;
|
||||
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
|
||||
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
||||
import com.extjs.gxt.ui.client.widget.layout.FormData;
|
||||
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
|
||||
import com.google.gwt.user.client.Element;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
|
||||
enum StaticFields {
|
||||
VIEW_NAME("name", "e.g.: the name of the property", "e.g.: put here the name"),
|
||||
METADATA_NAME("schemaName", "e.g.: metadata prefix", "e.g.: FARM_dc"),
|
||||
METADATA_LANG("language", "e.g.: metadata language", "e.g.: en"),
|
||||
METADATA_SCHEMA("schemaURI", "e.g.: metadata schema", "e.g.: http://193.43.36.238:8282/fi/figis/devcon/schema/dc/qualifieddc.xsd"),
|
||||
IS_EDITABLE("isEditable", "e.g.: editable", "e.g.: true"),
|
||||
IS_INDEXABLE("isIndexable", "e.g.: indexable", "e.g.: true"),
|
||||
IS_USER_COLLECTION("isUserCollection", "e.g.: user collection", "e.g.: true");
|
||||
|
||||
private String name = null;
|
||||
private String description = null;
|
||||
private String value = null;
|
||||
|
||||
|
||||
private StaticFields(final String name, final String description, final String value) {
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
public class ActivationRecordVMForm extends Dialog {
|
||||
private FormData formData = null;
|
||||
private FormPanel form = null;
|
||||
|
||||
public ActivationRecordVMForm() {
|
||||
this.setLayout(new FitLayout());
|
||||
this.setHeading("Activation Record for VM");
|
||||
this.setModal(true);
|
||||
this.setWidth(700);
|
||||
this.setHeight(500);
|
||||
this.setResizable(false);
|
||||
this.getButtonBar().removeAll();
|
||||
this.setHideOnButtonClick(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void onRender(final Element parent, final int index) {
|
||||
super.onRender(parent, index);
|
||||
formData = new FormData("-20");
|
||||
createForm();
|
||||
}
|
||||
|
||||
public final void closeDialog() {
|
||||
this.hide();
|
||||
}
|
||||
|
||||
private void addStaticProperty(final String pfield, final String pdescription, final String pvalue) {
|
||||
final FieldSet fieldSet = new FieldSet();
|
||||
fieldSet.setLayout(new FormLayout());
|
||||
|
||||
fieldSet.setHeading("Property");
|
||||
fieldSet.setCollapsible(false);
|
||||
|
||||
TextField<String> name = new TextField<String>();
|
||||
name.setFieldLabel("Name");
|
||||
name.setValue(pfield);
|
||||
name.setEnabled(false);
|
||||
name.setAllowBlank(false);
|
||||
fieldSet.add(name, formData);
|
||||
|
||||
TextField<String> description = new TextField<String>();
|
||||
description.setFieldLabel("Description");
|
||||
description.setEmptyText(pdescription);
|
||||
description.setAllowBlank(true);
|
||||
fieldSet.add(description, formData);
|
||||
|
||||
TextField<String> value = new TextField<String>();
|
||||
value.setFieldLabel("Value");
|
||||
value.setEmptyText(pvalue);
|
||||
value.setAllowBlank(false);
|
||||
fieldSet.add(value, formData);
|
||||
|
||||
form.add(fieldSet, formData);
|
||||
fieldSet.recalculate();
|
||||
this.doLayout(true);
|
||||
}
|
||||
|
||||
private void addProperty() {
|
||||
final FieldSet fieldSet = new FieldSet();
|
||||
fieldSet.setLayout(new FormLayout());
|
||||
|
||||
fieldSet.setHeading("Property");
|
||||
fieldSet.setCollapsible(false);
|
||||
|
||||
TextField<String> name = new TextField<String>();
|
||||
name.setFieldLabel("Name");
|
||||
name.setAllowBlank(false);
|
||||
fieldSet.add(name, formData);
|
||||
|
||||
TextField<String> description = new TextField<String>();
|
||||
description.setFieldLabel("Description");
|
||||
description.setAllowBlank(true);
|
||||
fieldSet.add(description, formData);
|
||||
|
||||
TextField<String> value = new TextField<String>();
|
||||
value.setFieldLabel("Value");
|
||||
value.setAllowBlank(false);
|
||||
fieldSet.add(value, formData);
|
||||
|
||||
final HorizontalPanel buttonPanel = new HorizontalPanel();
|
||||
Button addButton = new Button("Add New Property") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent ce) {
|
||||
addProperty();
|
||||
}
|
||||
};
|
||||
addButton.setIconStyle("new-icon");
|
||||
buttonPanel.add(addButton);
|
||||
|
||||
Button delButton = new Button("Remove This Property") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent ce) {
|
||||
form.remove(fieldSet);
|
||||
}
|
||||
};
|
||||
delButton.setIconStyle("delete-icon");
|
||||
buttonPanel.add(delButton);
|
||||
fieldSet.add(buttonPanel, formData);
|
||||
|
||||
form.add(fieldSet, formData);
|
||||
fieldSet.recalculate();
|
||||
this.doLayout(true);
|
||||
}
|
||||
|
||||
private void createForm() {
|
||||
form = new FormPanel();
|
||||
form.setFrame(true);
|
||||
form.setAutoWidth(true);
|
||||
|
||||
//form.setLayout(new FlowLayout());
|
||||
form.setScrollMode(Scroll.AUTO);
|
||||
|
||||
form.setHeaderVisible(false);
|
||||
form.getHeader().setStyleName("x-hide-panel-header");
|
||||
|
||||
TextField<String> resID = new TextField<String>();
|
||||
resID.setFieldLabel("Resource ID");
|
||||
resID.setEnabled(false);
|
||||
resID.setAllowBlank(true); // is required
|
||||
|
||||
resID.setEmptyText("<generated by Resource Manager>");
|
||||
|
||||
form.add(resID, formData);
|
||||
|
||||
TextField<String> resName = new TextField<String>();
|
||||
resName.setFieldLabel("Resource Name");
|
||||
resName.setValue("VMRecord");
|
||||
resName.setEnabled(false);
|
||||
//resName.setValidator(new StringValidator(20, false));
|
||||
resName.setAllowBlank(false); // is required
|
||||
form.add(resName, formData);
|
||||
|
||||
TextField<String> resType = new TextField<String>();
|
||||
resType.setFieldLabel("Secondary type");
|
||||
resType.setValue("ActivationRecord");
|
||||
resType.setEnabled(false);
|
||||
// resType.setValidator(new StringValidator(20, false));
|
||||
resType.setAllowBlank(false); // is required
|
||||
form.add(resType, formData);
|
||||
|
||||
TextArea description = new TextArea();
|
||||
description.setFieldLabel("Description");
|
||||
form.add(description, formData);
|
||||
|
||||
ComboBox<ModelData> pluginSelect = new ComboBox<ModelData>();
|
||||
ListStore<ModelData> storePlugin = new ListStore<ModelData>();
|
||||
storePlugin.add(new AtomicTreeNode("Metadata"));
|
||||
storePlugin.add(new AtomicTreeNode("Annotation"));
|
||||
pluginSelect.setStore(storePlugin);
|
||||
pluginSelect.setFieldLabel("Plugin Kind:");
|
||||
pluginSelect.setEmptyText("Select a plugin...");
|
||||
pluginSelect.setTypeAhead(true);
|
||||
pluginSelect.setTriggerAction(TriggerAction.ALL);
|
||||
pluginSelect.setDisplayField("name");
|
||||
pluginSelect.setForceSelection(true);
|
||||
form.add(pluginSelect, formData);
|
||||
|
||||
// The select for collections
|
||||
ComboBox<ResourceDescriptor> collectionSelect = new ComboBox<ResourceDescriptor>();
|
||||
ListStore<ResourceDescriptor> store = new ListStore<ResourceDescriptor>();
|
||||
try {
|
||||
store.add(new ResourceDescriptor("type", "subtype", "ID", "the name"));
|
||||
} catch (InvalidParameterException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
collectionSelect.setStore(store);
|
||||
collectionSelect.setFieldLabel("Collection");
|
||||
collectionSelect.setEmptyText("Select a collection...");
|
||||
collectionSelect.setDisplayField("name");
|
||||
collectionSelect.setTypeAhead(true);
|
||||
collectionSelect.setTriggerAction(TriggerAction.ALL);
|
||||
collectionSelect.setForceSelection(true);
|
||||
collectionSelect.setData("text", "Select a collection");
|
||||
|
||||
form.add(collectionSelect, formData);
|
||||
|
||||
loadCollections(StatusHandler.getStatus().getCurrentScope(), collectionSelect);
|
||||
// -- ENDOF The select for collections
|
||||
|
||||
// Inserts the static fields
|
||||
for (StaticFields entry : StaticFields.values()) {
|
||||
this.addStaticProperty(entry.getName(), entry.getDescription(), entry.getValue());
|
||||
}
|
||||
|
||||
HorizontalPanel buttonPanel = new HorizontalPanel();
|
||||
Button addButton = new Button("Add New Property") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent ce) {
|
||||
addProperty();
|
||||
}
|
||||
};
|
||||
addButton.setIconStyle("new-icon");
|
||||
buttonPanel.add(addButton);
|
||||
|
||||
form.add(buttonPanel, formData);
|
||||
|
||||
Button submitBtn = new Button("Submit") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent ce) {
|
||||
super.onClick(ce);
|
||||
if (!form.isValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<Field<?>> fields = form.getFields();
|
||||
|
||||
// Creation mode
|
||||
// the parameter in position 0 is the
|
||||
// auto-generated ID.
|
||||
String resName = fields.get(1).getRawValue();
|
||||
String resType = fields.get(2).getRawValue();
|
||||
String description = fields.get(3).getRawValue();
|
||||
String plugin = fields.get(4).getRawValue() + "Plugin";
|
||||
String viewType = fields.get(4).getRawValue() + "View";
|
||||
String viewID = generateID();
|
||||
|
||||
String collectionID = ((ResourceDescriptor) fields.get(5).getValue()).getID();
|
||||
|
||||
// builds a list of tuples each one representing a single property
|
||||
// properties are supposed to be represented by three fields each one.
|
||||
List<Tuple<String>> properties = new Vector<Tuple<String>>();
|
||||
if (fields.size() > StaticFields.values().length - 1) {
|
||||
for (int i = StaticFields.values().length - 1; i < fields.size(); i = i + 3) {
|
||||
properties.add(new Tuple<String>(
|
||||
fields.get(i).getRawValue().trim(),
|
||||
(fields.get(i + 1).getRawValue() != null) ? fields.get(i + 1).getRawValue().trim() : "", // description can be null
|
||||
fields.get(i + 2).getRawValue().trim()));
|
||||
}
|
||||
} else {
|
||||
MessageBox.alert("Create Activation Form for VM", "No properties defined", null);
|
||||
return;
|
||||
}
|
||||
|
||||
StringBuilder body = new StringBuilder();
|
||||
|
||||
body.append("<ns4:Record xmlns:ns4=\"http://gcube-system.org/namespaces/common\" xmlns:ns3=\"http://gcube-system.org/namespaces/contentmanagement/contentmanager\" xmlns:ns2=\"http://gcube-system.org/namespaces/contentmanagement/viewmanager\">");
|
||||
body.append("<createdBy xmlns:ns4=\"http://gcube-system.org/namespaces/common\" xmlns:ns3=\"http://gcube-system.org/namespaces/contentmanagement/contentmanager\" xmlns:ns2=\"http://gcube-system.org/namespaces/contentmanagement/viewmanager\">ResourceManagementPortlet</createdBy>");
|
||||
body.append("<plugin xmlns:ns4=\"http://gcube-system.org/namespaces/common\" xmlns:ns3=\"http://gcube-system.org/namespaces/contentmanagement/contentmanager\" xmlns:ns2=\"http://gcube-system.org/namespaces/contentmanagement/viewmanager\">" + plugin + "</plugin>");
|
||||
|
||||
body.append("<view xmlns:ns4=\"http://gcube-system.org/namespaces/common\" xmlns:ns3=\"http://gcube-system.org/namespaces/contentmanagement/contentmanager\" xmlns:ns2=\"http://gcube-system.org/namespaces/contentmanagement/viewmanager\">");
|
||||
|
||||
body.append("<ns2:id xmlns:ns4=\"http://gcube-system.org/namespaces/common\" xmlns:ns3=\"http://gcube-system.org/namespaces/contentmanagement/contentmanager\" xmlns:ns2=\"http://gcube-system.org/namespaces/contentmanagement/viewmanager\">" + viewID + "</ns2:id>");
|
||||
body.append("<ns2:collectionID xmlns:ns4=\"http://gcube-system.org/namespaces/common\" xmlns:ns3=\"http://gcube-system.org/namespaces/contentmanagement/contentmanager\" xmlns:ns2=\"http://gcube-system.org/namespaces/contentmanagement/viewmanager\">" + collectionID + "</ns2:collectionID>");
|
||||
body.append("<ns2:type xmlns:ns4=\"http://gcube-system.org/namespaces/common\" xmlns:ns3=\"http://gcube-system.org/namespaces/contentmanagement/contentmanager\" xmlns:ns2=\"http://gcube-system.org/namespaces/contentmanagement/viewmanager\">" + viewType + "</ns2:type>");
|
||||
body.append("<ns2:predicate xmlns:ns4=\"http://gcube-system.org/namespaces/common\" xmlns:ns3=\"http://gcube-system.org/namespaces/contentmanagement/contentmanager\" xmlns:ns2=\"http://gcube-system.org/namespaces/contentmanagement/viewmanager\" />");
|
||||
body.append("<ns2:description xmlns:ns4=\"http://gcube-system.org/namespaces/common\" xmlns:ns3=\"http://gcube-system.org/namespaces/contentmanagement/contentmanager\" xmlns:ns2=\"http://gcube-system.org/namespaces/contentmanagement/viewmanager\">" + fields.get(4).getRawValue() + " view for collection " + collectionID + "</ns2:description>");
|
||||
body.append("<ns2:cardinality xmlns:ns4=\"http://gcube-system.org/namespaces/common\" xmlns:ns3=\"http://gcube-system.org/namespaces/contentmanagement/contentmanager\" xmlns:ns2=\"http://gcube-system.org/namespaces/contentmanagement/viewmanager\">0</ns2:cardinality>");
|
||||
body.append("<ns2:lastUpdate xmlns:ns4=\"http://gcube-system.org/namespaces/common\" xmlns:ns3=\"http://gcube-system.org/namespaces/contentmanagement/contentmanager\" xmlns:ns2=\"http://gcube-system.org/namespaces/contentmanagement/viewmanager\">" + "2010-10-25T14:01:55.948+00:00" + "</ns2:lastUpdate>");
|
||||
|
||||
for (Tuple<String> prop : properties) {
|
||||
body.append("<ns2:property xmlns:ns4=\"http://gcube-system.org/namespaces/common\" xmlns:ns3=\"http://gcube-system.org/namespaces/contentmanagement/contentmanager\" xmlns:ns2=\"http://gcube-system.org/namespaces/contentmanagement/viewmanager\">");
|
||||
|
||||
body.append("<ns2:name xmlns:ns4=\"http://gcube-system.org/namespaces/common\" xmlns:ns3=\"http://gcube-system.org/namespaces/contentmanagement/contentmanager\" xmlns:ns2=\"http://gcube-system.org/namespaces/contentmanagement/viewmanager\">" + prop.get(0) + "</ns2:name>");
|
||||
body.append("<ns2:description xmlns:ns4=\"http://gcube-system.org/namespaces/common\" xmlns:ns3=\"http://gcube-system.org/namespaces/contentmanagement/contentmanager\" xmlns:ns2=\"http://gcube-system.org/namespaces/contentmanagement/viewmanager\">" + prop.get(1) + "</ns2:description>");
|
||||
body.append("<ns2:value xmlns:ns4=\"http://gcube-system.org/namespaces/common\" xmlns:ns3=\"http://gcube-system.org/namespaces/contentmanagement/contentmanager\" xmlns:ns2=\"http://gcube-system.org/namespaces/contentmanagement/viewmanager\">" + prop.get(2) + "</ns2:value>");
|
||||
|
||||
body.append("</ns2:property>");
|
||||
}
|
||||
|
||||
body.append("</view>");
|
||||
body.append("</ns4:Record>");
|
||||
|
||||
OpCommands.doCreateGenericResource(viewID, resName, description, body.toString(), resType);
|
||||
closeDialog();
|
||||
}
|
||||
};
|
||||
form.addButton(submitBtn);
|
||||
form.addButton(new Button("Cancel") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent ce) {
|
||||
super.onClick(ce);
|
||||
closeDialog();
|
||||
}
|
||||
});
|
||||
|
||||
form.setButtonAlign(HorizontalAlignment.CENTER);
|
||||
|
||||
FormButtonBinding binding = new FormButtonBinding(form);
|
||||
binding.addButton(submitBtn);
|
||||
|
||||
this.add(form);
|
||||
}
|
||||
|
||||
private String generateID() {
|
||||
char[] s = new char[36];
|
||||
String itoh = "0123456789abcdef";
|
||||
|
||||
// Make array of random hex digits. The UUID only has 32 digits in it, but we
|
||||
// allocate an extra items to make room for the '-'s we'll be inserting.
|
||||
for (int i = 0; i < 36; i++) {
|
||||
s[i] = (char) Math.floor(Math.random() * 0x10);
|
||||
}
|
||||
|
||||
// Conform to RFC-4122, section 4.4
|
||||
s[14] = 4; // Set 4 high bits of time_high field to version
|
||||
s[19] = (char) ((s[19] & 0x3) | 0x8); // Specify 2 high bits of clock sequence
|
||||
|
||||
// Convert to hex chars
|
||||
for (int i = 0; i < 36; i++) {
|
||||
s[i] = itoh.charAt((int) s[i]);
|
||||
}
|
||||
|
||||
// Insert '-'s
|
||||
s[8] = s[13] = s[18] = s[23] = '-';
|
||||
return new String(s);
|
||||
}
|
||||
|
||||
private void loadCollections(final String scope, final ComboBox<ResourceDescriptor> combo) {
|
||||
ProxyRegistry.getProxyInstance().getResourcesModel(scope,
|
||||
ResourceTypeDecorator.GenericResource.name(),
|
||||
"GCUBECollection",
|
||||
null,
|
||||
new AsyncCallback<List<ResourceDescriptor>>() {
|
||||
|
||||
public void onSuccess(final List<ResourceDescriptor> result) {
|
||||
combo.getStore().removeAll();
|
||||
combo.getStore().add(result);
|
||||
|
||||
combo.setValidator(new SelectValidator(false));
|
||||
combo.setAllowBlank(false);
|
||||
combo.setTriggerAction(TriggerAction.ALL);
|
||||
combo.recalculate();
|
||||
Commands.showPopup("Collection load", "Loaded (" + result.size() + ") Collections");
|
||||
}
|
||||
public void onFailure(final Throwable e) {
|
||||
MessageBox.alert("Error getting collections", e.getMessage(), null);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,329 +0,0 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: GenericResourcePluginForm.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.client.forms.genericresources;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.remote.ProxyRegistry;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.utils.OpCommands;
|
||||
import org.gcube.resourcemanagement.support.client.views.validators.SelectValidator;
|
||||
import org.gcube.resourcemanagement.support.shared.plugins.GenericResourcePlugin;
|
||||
import org.gcube.resourcemanagement.support.shared.types.Tuple;
|
||||
import org.gcube.resourcemanagement.support.shared.types.datamodel.AtomicTreeNode;
|
||||
|
||||
import com.extjs.gxt.ui.client.Style.Scroll;
|
||||
import com.extjs.gxt.ui.client.data.ModelData;
|
||||
import com.extjs.gxt.ui.client.event.ComponentEvent;
|
||||
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
|
||||
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
|
||||
import com.extjs.gxt.ui.client.store.ListStore;
|
||||
import com.extjs.gxt.ui.client.widget.Component;
|
||||
import com.extjs.gxt.ui.client.widget.Dialog;
|
||||
import com.extjs.gxt.ui.client.widget.MessageBox;
|
||||
import com.extjs.gxt.ui.client.widget.button.Button;
|
||||
import com.extjs.gxt.ui.client.widget.form.ComboBox;
|
||||
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
|
||||
import com.extjs.gxt.ui.client.widget.form.Field;
|
||||
import com.extjs.gxt.ui.client.widget.form.FieldSet;
|
||||
import com.extjs.gxt.ui.client.widget.form.FormButtonBinding;
|
||||
import com.extjs.gxt.ui.client.widget.form.FormPanel;
|
||||
import com.extjs.gxt.ui.client.widget.form.TextArea;
|
||||
import com.extjs.gxt.ui.client.widget.form.TextField;
|
||||
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
||||
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
|
||||
import com.extjs.gxt.ui.client.widget.layout.FormData;
|
||||
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
|
||||
import com.google.gwt.user.client.Element;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
|
||||
public class GenericResourceCMForm extends Dialog {
|
||||
private FormData formData = null;
|
||||
private FormPanel form = null;
|
||||
private FieldSet pluginFieldSet = null;
|
||||
private String selectedPlugin = null;
|
||||
private Map<String, GenericResourcePlugin> loadedPlugins = null;
|
||||
private TextField<String> resName = null;
|
||||
|
||||
public GenericResourceCMForm() {
|
||||
this.setLayout(new FitLayout());
|
||||
this.setHeading("Generic Resource Creation (Plugin)");
|
||||
this.setModal(true);
|
||||
this.setWidth(700);
|
||||
this.setHeight(500);
|
||||
this.setResizable(false);
|
||||
this.getButtonBar().removeAll();
|
||||
this.setHideOnButtonClick(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void onRender(final Element parent, final int index) {
|
||||
super.onRender(parent, index);
|
||||
formData = new FormData("-20");
|
||||
createForm();
|
||||
createPluginForm();
|
||||
this.add(form);
|
||||
|
||||
this.initButtons();
|
||||
|
||||
this.recalculate();
|
||||
this.doLayout(true);
|
||||
|
||||
this.form.mask("Loading plugins...");
|
||||
// Gets the plugins
|
||||
ProxyRegistry.getProxyInstance().getGenericResourcePlugins(new AsyncCallback<Map<String, GenericResourcePlugin>>() {
|
||||
public void onSuccess(final Map<String, GenericResourcePlugin> result) {
|
||||
addPluginSelect(result);
|
||||
form.unmask();
|
||||
}
|
||||
|
||||
public void onFailure(final Throwable caught) {
|
||||
MessageBox.alert("Create Generic Resource (Plugin)",
|
||||
"Received an exception: " + caught.getMessage(), null);
|
||||
form.unmask();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public final void closeDialog() {
|
||||
this.hide();
|
||||
}
|
||||
|
||||
private void setPluginFields(final GenericResourcePlugin plugin) {
|
||||
if (plugin.getParams().size() == 0) {
|
||||
return;
|
||||
}
|
||||
Component select = pluginFieldSet.getItem(0);
|
||||
pluginFieldSet.removeAll();
|
||||
pluginFieldSet.add(select);
|
||||
|
||||
for (GenericResourcePlugin.Field field : plugin.getParams()) {
|
||||
if (field.getType() == GenericResourcePlugin.FieldType.string) {
|
||||
TextField<String> toAdd = new TextField<String>();
|
||||
toAdd.setFieldLabel(field.getLabel() + (field.isRequired() ? "*" : ""));
|
||||
toAdd.setName(field.getName());
|
||||
//toAdd.setValidator(new StringValidator(128, !field.isRequired()));
|
||||
toAdd.setAllowBlank(!field.isRequired()); // is required
|
||||
toAdd.setValue(field.getDefaultValue());
|
||||
pluginFieldSet.add(toAdd, formData);
|
||||
pluginFieldSet.recalculate();
|
||||
this.doLayout(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addPluginSelect(final Map<String, GenericResourcePlugin> plugins) {
|
||||
ListStore<ModelData> store = new ListStore<ModelData>();
|
||||
for (String pluginName : plugins.keySet()) {
|
||||
store.add(new AtomicTreeNode(pluginName));
|
||||
}
|
||||
|
||||
ComboBox<ModelData> combo = new ComboBox<ModelData>();
|
||||
combo.setFieldLabel("Plugin");
|
||||
combo.addSelectionChangedListener(new SelectionChangedListener<ModelData>() {
|
||||
@Override
|
||||
public void selectionChanged(final SelectionChangedEvent<ModelData> se) {
|
||||
if (se != null &&
|
||||
se.getSelection() != null
|
||||
&& se.getSelection() instanceof ArrayList) {
|
||||
@SuppressWarnings("rawtypes")
|
||||
String selection = ((ArrayList) se.getSelection()).get(0).toString();
|
||||
selectedPlugin = selection;
|
||||
setPluginFields(loadedPlugins.get(selection));
|
||||
}
|
||||
}
|
||||
});
|
||||
combo.setEmptyText("Select a plugin...");
|
||||
combo.setDisplayField("name");
|
||||
combo.setStore(store);
|
||||
combo.setTypeAhead(true);
|
||||
combo.setValidator(new SelectValidator(false));
|
||||
combo.setAllowBlank(false);
|
||||
combo.setForceSelection(true);
|
||||
combo.setTriggerAction(TriggerAction.ALL);
|
||||
combo.recalculate();
|
||||
|
||||
|
||||
pluginFieldSet.recalculate();
|
||||
pluginFieldSet.add(combo, formData);
|
||||
this.doLayout(true);
|
||||
this.loadedPlugins = plugins;
|
||||
}
|
||||
|
||||
private void createForm() {
|
||||
form = new FormPanel();
|
||||
form.setFrame(true);
|
||||
form.setAutoWidth(true);
|
||||
|
||||
form.setHeaderVisible(false);
|
||||
form.getHeader().setStyleName("x-hide-panel-header");
|
||||
form.setLayout(new FlowLayout());
|
||||
|
||||
form.setScrollMode(Scroll.AUTO);
|
||||
|
||||
FieldSet formHead = new FieldSet();
|
||||
formHead.setHeading("Basic parameters");
|
||||
formHead.setCollapsible(true);
|
||||
|
||||
FormLayout layout = new FormLayout();
|
||||
layout.setLabelWidth(90);
|
||||
formHead.setLayout(layout);
|
||||
|
||||
TextField<String> resID = new TextField<String>();
|
||||
resID.setFieldLabel("Resource ID");
|
||||
// resID.setValidator(new StringValidator(64, false));
|
||||
resID.setAllowBlank(false); // is required
|
||||
// If in editing mode
|
||||
|
||||
resID.setEmptyText("<generated by Resource Manager>");
|
||||
resID.setEnabled(false);
|
||||
formHead.add(resID, formData);
|
||||
|
||||
this.resName = new TextField<String>();
|
||||
resName.setFieldLabel("Resource Name");
|
||||
// resName.setValidator(new StringValidator(64, false));
|
||||
resName.setAllowBlank(false); // is required
|
||||
resName.setValue("CMSRecord");
|
||||
resName.setEnabled(false);
|
||||
formHead.add(resName, formData);
|
||||
|
||||
ComboBox<AtomicTreeNode> resType = new ComboBox<AtomicTreeNode>();
|
||||
ListStore<AtomicTreeNode> storePlugin = new ListStore<AtomicTreeNode>();
|
||||
storePlugin.add(new AtomicTreeNode("ActivationRecord"));
|
||||
storePlugin.add(new AtomicTreeNode("VirtualCollection"));
|
||||
resType.setStore(storePlugin);
|
||||
resType.setFieldLabel("Secondary Type");
|
||||
//resType.setEmptyText("Select a subtype...");
|
||||
resType.setValue(storePlugin.getAt(0));
|
||||
resType.setDisplayField("name");
|
||||
resType.setAllowBlank(false);
|
||||
resType.setTypeAhead(true);
|
||||
resType.setTriggerAction(TriggerAction.ALL);
|
||||
resType.setForceSelection(true);
|
||||
resType.addSelectionChangedListener(new SelectionChangedListener<AtomicTreeNode>() {
|
||||
@Override
|
||||
public void selectionChanged(final SelectionChangedEvent<AtomicTreeNode> se) {
|
||||
// The usual casting trick for fixing invalid class specification
|
||||
// of generic return in models.
|
||||
if (se.getSelection().get(0).getName().equals("VirtualCollection")) {
|
||||
resName.setFieldLabel("Collection Name");
|
||||
resName.setValue(null);
|
||||
resName.setEnabled(true);
|
||||
} else {
|
||||
resName.setFieldLabel("Resource Name");
|
||||
resName.setValue("CMSRecord");
|
||||
resName.setEnabled(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
formHead.add(resType, formData);
|
||||
|
||||
TextArea description = new TextArea();
|
||||
description.setFieldLabel("Description");
|
||||
description.setPreventScrollbars(false);
|
||||
//description.setHeight(50);
|
||||
formHead.add(description, formData);
|
||||
|
||||
form.add(formHead);
|
||||
}
|
||||
|
||||
private void createPluginForm() {
|
||||
this.pluginFieldSet = new FieldSet();
|
||||
pluginFieldSet.setHeading("Plugin parameters");
|
||||
pluginFieldSet.setCollapsible(true);
|
||||
|
||||
FormLayout layout = new FormLayout();
|
||||
layout.setLabelWidth(110);
|
||||
pluginFieldSet.setLayout(layout);
|
||||
form.add(pluginFieldSet);
|
||||
}
|
||||
|
||||
public final void initButtons() {
|
||||
Button submitBtn = new Button("Submit") {
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent ce) {
|
||||
super.onClick(ce);
|
||||
if (!form.isValid()) {
|
||||
return;
|
||||
}
|
||||
Tuple<String> values = new Tuple<String>();
|
||||
for (Field<?> field : form.getFields()) {
|
||||
values.append(field.getRawValue());
|
||||
}
|
||||
|
||||
String resName = values.get(1);
|
||||
String resType = values.get(2);
|
||||
String description = values.get(3);
|
||||
|
||||
StringBuilder body = new StringBuilder();
|
||||
body.append("<ns3:Record xmlns:ns3=\"http://gcube-system.org/namespaces/common\" xmlns:ns2=\"http://gcube-system.org/namespaces/contentmanagement/contentmanager\">");
|
||||
body.append("<createdBy xmlns:ns3=\"http://gcube-system.org/namespaces/common\" xmlns:ns2=\"http://gcube-system.org/namespaces/contentmanagement/contentmanager\">ResourceManagementPortlet</createdBy>");
|
||||
body.append("<parameters xmlns:ns3=\"http://gcube-system.org/namespaces/common\" xmlns:ns2=\"http://gcube-system.org/namespaces/contentmanagement/contentmanager\">");
|
||||
body.append("<broadcast xmlns:ns3=\"http://gcube-system.org/namespaces/common\" xmlns:ns2=\"http://gcube-system.org/namespaces/contentmanagement/contentmanager\">true</broadcast>");
|
||||
|
||||
if (selectedPlugin == null) {
|
||||
return;
|
||||
}
|
||||
GenericResourcePlugin plugin = loadedPlugins.get(selectedPlugin);
|
||||
body.append("<ns4:" + plugin.getType() + " xmlns:ns3=\"http://gcube-system.org/namespaces/common\" xmlns:ns2=\"http://gcube-system.org/namespaces/contentmanagement/contentmanager\"" + plugin.getNamespace() + ">");
|
||||
Map<String, Object> submitted = new HashMap<String, Object>();
|
||||
for (Field<?> field : form.getFields()) {
|
||||
submitted.put(field.getName(), field.getRawValue());
|
||||
}
|
||||
if (plugin.getParams() != null && plugin.getParams().size() > 0) {
|
||||
for (GenericResourcePlugin.Field field : plugin.getParams()) {
|
||||
try {
|
||||
String tag = field.getName();
|
||||
String value = submitted.get(tag).toString();
|
||||
if (value != null && value.trim().length() > 0) {
|
||||
body.append("<" + tag + ">" + value + "</" + tag + ">");
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
// parsing errors will be skipped
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
body.append("</ns4:" + plugin.getType() + ">");
|
||||
body.append("<plugin xmlns:ns3=\"http://gcube-system.org/namespaces/common\" xmlns:ns2=\"http://gcube-system.org/namespaces/contentmanagement/contentmanager\">" + plugin.getName() + "</plugin>");
|
||||
body.append("</parameters>");
|
||||
body.append("</ns3:Record>");
|
||||
|
||||
OpCommands.doCreateGenericResource(null, resName, description, body.toString(), resType);
|
||||
|
||||
|
||||
closeDialog();
|
||||
}
|
||||
};
|
||||
this.form.addButton(submitBtn);
|
||||
|
||||
this.form.addButton(new Button("Cancel") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent ce) {
|
||||
super.onClick(ce);
|
||||
closeDialog();
|
||||
}
|
||||
});
|
||||
|
||||
///form.setButtonAlign(HorizontalAlignment.CENTER);
|
||||
|
||||
FormButtonBinding binding = new FormButtonBinding(form);
|
||||
binding.addButton(submitBtn);
|
||||
}
|
||||
}
|
|
@ -1,343 +0,0 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: GenericResourceTreeManagerForm.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:assante@isti.cnr.it">Massimiliano Assante</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.client.forms.genericresources;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.remote.ProxyRegistry;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.utils.OpCommands;
|
||||
import org.gcube.resourcemanagement.support.client.views.validators.SelectValidator;
|
||||
import org.gcube.resourcemanagement.support.shared.plugins.TMPluginFormField;
|
||||
import org.gcube.resourcemanagement.support.shared.types.Tuple;
|
||||
import org.gcube.resourcemanagement.support.shared.types.datamodel.AtomicTreeNode;
|
||||
|
||||
import com.extjs.gxt.ui.client.Style.Scroll;
|
||||
import com.extjs.gxt.ui.client.data.ModelData;
|
||||
import com.extjs.gxt.ui.client.event.ComponentEvent;
|
||||
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
|
||||
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
|
||||
import com.extjs.gxt.ui.client.store.ListStore;
|
||||
import com.extjs.gxt.ui.client.widget.Component;
|
||||
import com.extjs.gxt.ui.client.widget.Dialog;
|
||||
import com.extjs.gxt.ui.client.widget.MessageBox;
|
||||
import com.extjs.gxt.ui.client.widget.button.Button;
|
||||
import com.extjs.gxt.ui.client.widget.form.ComboBox;
|
||||
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
|
||||
import com.extjs.gxt.ui.client.widget.form.Field;
|
||||
import com.extjs.gxt.ui.client.widget.form.FieldSet;
|
||||
import com.extjs.gxt.ui.client.widget.form.FormButtonBinding;
|
||||
import com.extjs.gxt.ui.client.widget.form.FormPanel;
|
||||
import com.extjs.gxt.ui.client.widget.form.TextArea;
|
||||
import com.extjs.gxt.ui.client.widget.form.TextField;
|
||||
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
||||
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
|
||||
import com.extjs.gxt.ui.client.widget.layout.FormData;
|
||||
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
|
||||
import com.google.gwt.user.client.Element;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
/**
|
||||
*
|
||||
* @author Massimiliano Assante, ISTI-CNR
|
||||
* @version 1.0 Oct 2012
|
||||
*
|
||||
*/
|
||||
public class GenericResourceTreeManagerForm extends Dialog {
|
||||
private FormData formData = null;
|
||||
private FormPanel form = null;
|
||||
private FieldSet pluginFieldSet = null;
|
||||
private String selectedPlugin = null;
|
||||
private HashMap<String, ArrayList<TMPluginFormField>> loadedPlugins = null;
|
||||
private TextField<String> resName = null;
|
||||
|
||||
public GenericResourceTreeManagerForm() {
|
||||
this.setLayout(new FitLayout());
|
||||
this.setHeading("Generic Resource Creation (TM Plugin)");
|
||||
this.setModal(true);
|
||||
this.setWidth(700);
|
||||
this.setHeight(500);
|
||||
this.setResizable(false);
|
||||
this.getButtonBar().removeAll();
|
||||
this.setHideOnButtonClick(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void onRender(final Element parent, final int index) {
|
||||
super.onRender(parent, index);
|
||||
formData = new FormData("-20");
|
||||
createForm();
|
||||
createPluginForm();
|
||||
this.add(form);
|
||||
|
||||
this.initButtons();
|
||||
|
||||
this.recalculate();
|
||||
this.doLayout(true);
|
||||
|
||||
this.form.mask("Loading plugins...");
|
||||
// Gets the plugins
|
||||
ProxyRegistry.getProxyInstance().getGenericResourceTreeMagnagerPlugins(new AsyncCallback<HashMap<String, ArrayList<TMPluginFormField>>>() {
|
||||
@Override
|
||||
public void onSuccess(HashMap<String, ArrayList<TMPluginFormField>> result) {
|
||||
addPluginSelect(result);
|
||||
form.unmask();
|
||||
}
|
||||
@Override
|
||||
public void onFailure(final Throwable caught) {
|
||||
MessageBox.alert("Create Generic Resource (Tree Manager Plugin)",
|
||||
"Received an exception: " + caught.getMessage(), null);
|
||||
form.unmask();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public final void closeDialog() {
|
||||
this.hide();
|
||||
}
|
||||
|
||||
private void setPluginFields(final ArrayList<TMPluginFormField> fields) {
|
||||
if (fields.size() == 0) {
|
||||
return;
|
||||
}
|
||||
Component select = pluginFieldSet.getItem(0);
|
||||
pluginFieldSet.removeAll();
|
||||
pluginFieldSet.add(select);
|
||||
|
||||
for (TMPluginFormField field : fields) {
|
||||
|
||||
TextField<String> toAdd = new TextField<String>();
|
||||
toAdd.setFieldLabel(field.getLabel() + (field.isRequired() ? "*" : ""));
|
||||
toAdd.setName(field.getLabel());
|
||||
//toAdd.setValidator(new StringValidator(128, !field.isRequired()));
|
||||
toAdd.setAllowBlank(!field.isRequired()); // is required
|
||||
toAdd.setValue(field.getDefaultValue() + (field.isRepeatable() ? "," + field.getDefaultValue() + "2 (Repeatable, use comma to separate " + field.getLabel() + ")" : ""));
|
||||
pluginFieldSet.add(toAdd, formData);
|
||||
pluginFieldSet.recalculate();
|
||||
this.doLayout(true);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void addPluginSelect(final HashMap<String, ArrayList<TMPluginFormField>> plugins) {
|
||||
ListStore<ModelData> store = new ListStore<ModelData>();
|
||||
for (String pluginName : plugins.keySet()) {
|
||||
store.add(new AtomicTreeNode(pluginName));
|
||||
}
|
||||
|
||||
ComboBox<ModelData> combo = new ComboBox<ModelData>();
|
||||
combo.setFieldLabel("Plugin");
|
||||
combo.addSelectionChangedListener(new SelectionChangedListener<ModelData>() {
|
||||
@Override
|
||||
public void selectionChanged(final SelectionChangedEvent<ModelData> se) {
|
||||
if (se != null &&
|
||||
se.getSelection() != null
|
||||
&& se.getSelection() instanceof ArrayList) {
|
||||
@SuppressWarnings("rawtypes")
|
||||
String selection = ((ArrayList) se.getSelection()).get(0).toString();
|
||||
selectedPlugin = selection;
|
||||
setPluginFields(loadedPlugins.get(selection));
|
||||
}
|
||||
}
|
||||
});
|
||||
combo.setEmptyText("Select a plugin...");
|
||||
combo.setDisplayField("name");
|
||||
combo.setStore(store);
|
||||
combo.setTypeAhead(true);
|
||||
combo.setValidator(new SelectValidator(false));
|
||||
combo.setAllowBlank(false);
|
||||
combo.setForceSelection(true);
|
||||
combo.setTriggerAction(TriggerAction.ALL);
|
||||
combo.recalculate();
|
||||
|
||||
|
||||
pluginFieldSet.recalculate();
|
||||
pluginFieldSet.add(combo, formData);
|
||||
this.doLayout(true);
|
||||
this.loadedPlugins = plugins;
|
||||
}
|
||||
|
||||
private void createForm() {
|
||||
form = new FormPanel();
|
||||
form.setFrame(true);
|
||||
form.setAutoWidth(true);
|
||||
|
||||
form.setHeaderVisible(false);
|
||||
form.getHeader().setStyleName("x-hide-panel-header");
|
||||
form.setLayout(new FlowLayout());
|
||||
|
||||
form.setScrollMode(Scroll.AUTO);
|
||||
|
||||
FieldSet formHead = new FieldSet();
|
||||
formHead.setHeading("Basic parameters");
|
||||
formHead.setCollapsible(true);
|
||||
|
||||
FormLayout layout = new FormLayout();
|
||||
layout.setLabelWidth(90);
|
||||
formHead.setLayout(layout);
|
||||
|
||||
TextField<String> resID = new TextField<String>();
|
||||
resID.setFieldLabel("Resource ID");
|
||||
// resID.setValidator(new StringValidator(64, false));
|
||||
resID.setAllowBlank(false); // is required
|
||||
// If in editing mode
|
||||
|
||||
resID.setEmptyText("<generated by Resource Manager>");
|
||||
resID.setEnabled(false);
|
||||
formHead.add(resID, formData);
|
||||
|
||||
this.resName = new TextField<String>();
|
||||
resName.setFieldLabel("Resource Name");
|
||||
// resName.setValidator(new StringValidator(64, false));
|
||||
resName.setAllowBlank(false); // is required
|
||||
resName.setValue("TMRecord");
|
||||
resName.setEnabled(false);
|
||||
formHead.add(resName, formData);
|
||||
|
||||
ComboBox<AtomicTreeNode> resType = new ComboBox<AtomicTreeNode>();
|
||||
ListStore<AtomicTreeNode> storePlugin = new ListStore<AtomicTreeNode>();
|
||||
storePlugin.add(new AtomicTreeNode("ActivationRecord"));
|
||||
resType.setStore(storePlugin);
|
||||
resType.setFieldLabel("Secondary Type");
|
||||
//resType.setEmptyText("Select a subtype...");
|
||||
resType.setValue(storePlugin.getAt(0));
|
||||
resType.setDisplayField("name");
|
||||
resType.setAllowBlank(false);
|
||||
resType.setEditable(false);
|
||||
resType.setTypeAhead(false);
|
||||
resType.setTriggerAction(TriggerAction.ALL);
|
||||
resType.setForceSelection(true);
|
||||
resType.addSelectionChangedListener(new SelectionChangedListener<AtomicTreeNode>() {
|
||||
@Override
|
||||
public void selectionChanged(final SelectionChangedEvent<AtomicTreeNode> se) {
|
||||
// The usual casting trick for fixing invalid class specification
|
||||
// of generic return in models.
|
||||
if (se.getSelection().get(0).getName().equals("VirtualCollection")) {
|
||||
resName.setFieldLabel("Collection Name");
|
||||
resName.setValue(null);
|
||||
resName.setEnabled(true);
|
||||
} else {
|
||||
resName.setFieldLabel("Resource Name");
|
||||
resName.setValue("TMRecord");
|
||||
resName.setEnabled(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
formHead.add(resType, formData);
|
||||
|
||||
TextArea description = new TextArea();
|
||||
description.setFieldLabel("Description");
|
||||
description.setPreventScrollbars(false);
|
||||
//description.setHeight(50);
|
||||
formHead.add(description, formData);
|
||||
|
||||
form.add(formHead);
|
||||
}
|
||||
|
||||
private void createPluginForm() {
|
||||
this.pluginFieldSet = new FieldSet();
|
||||
pluginFieldSet.setHeading("Plugin parameters");
|
||||
pluginFieldSet.setCollapsible(true);
|
||||
|
||||
FormLayout layout = new FormLayout();
|
||||
layout.setLabelWidth(110);
|
||||
pluginFieldSet.setLayout(layout);
|
||||
form.add(pluginFieldSet);
|
||||
}
|
||||
|
||||
public final void initButtons() {
|
||||
Button submitBtn = new Button("Submit") {
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent ce) {
|
||||
super.onClick(ce);
|
||||
if (!form.isValid()) {
|
||||
return;
|
||||
}
|
||||
Tuple<String> values = new Tuple<String>();
|
||||
for (Field<?> field : form.getFields()) {
|
||||
values.append(field.getRawValue());
|
||||
}
|
||||
|
||||
String resName = values.get(1);
|
||||
String resType = values.get(2);
|
||||
String description = values.get(3);
|
||||
|
||||
StringBuilder body = new StringBuilder();
|
||||
body.append("<ns3:Record xmlns:ns3=\"http://gcube-system.org/namespaces/common\" xmlns:ns2=\"http://gcube-system.org/namespaces/data/tm\">");
|
||||
body.append("<createdBy xmlns:ns3=\"http://gcube-system.org/namespaces/common\" xmlns:ns2=\"http://gcube-system.org/namespaces/data/tm\">ResourceManagementPortlet</createdBy>");
|
||||
body.append("<parameters xmlns:ns3=\"http://gcube-system.org/namespaces/common\" xmlns:ns2=\"http://gcube-system.org/namespaces/data/tm\">");
|
||||
body.append("<broadcast xmlns:ns3=\"http://gcube-system.org/namespaces/common\" xmlns:ns2=\"http://gcube-system.org/namespaces/data/tm\">true</broadcast>");
|
||||
|
||||
if (selectedPlugin == null) {
|
||||
return;
|
||||
}
|
||||
ArrayList<TMPluginFormField> fields = loadedPlugins.get(selectedPlugin);
|
||||
body.append("<speciesRequest>");
|
||||
Map<String, Object> submitted = new HashMap<String, Object>();
|
||||
for (Field<?> field : form.getFields()) {
|
||||
submitted.put(field.getName(), field.getRawValue());
|
||||
}
|
||||
if (fields != null && fields.size() > 0) {
|
||||
for (TMPluginFormField field : fields) {
|
||||
try {
|
||||
String tag = field.getLabel();
|
||||
String value = submitted.get(tag).toString();
|
||||
if (value != null && value.trim().length() > 0) {
|
||||
if (value.split(",").length > 0) {
|
||||
String[] toAdd = value.split(",");
|
||||
for (int i = 0; i < toAdd.length; i++) {
|
||||
body.append("<" + tag + ">" + toAdd[i] + "</" + tag + ">");
|
||||
}
|
||||
}
|
||||
else
|
||||
body.append("<" + tag + ">" + value + "</" + tag + ">");
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
// parsing errors will be skipped
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
body.append("</speciesRequest>");
|
||||
body.append("<plugin xmlns:ns3=\"http://gcube-system.org/namespaces/common\" xmlns:ns2=\"http://gcube-system.org/namespaces/data/tm\">" + selectedPlugin + "</plugin>");
|
||||
body.append("</parameters>");
|
||||
body.append("</ns3:Record>");
|
||||
|
||||
|
||||
OpCommands.doCreateGenericResource(null, resName, description, body.toString(), resType);
|
||||
|
||||
|
||||
closeDialog();
|
||||
}
|
||||
};
|
||||
this.form.addButton(submitBtn);
|
||||
|
||||
this.form.addButton(new Button("Cancel") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent ce) {
|
||||
super.onClick(ce);
|
||||
closeDialog();
|
||||
}
|
||||
});
|
||||
|
||||
///form.setButtonAlign(HorizontalAlignment.CENTER);
|
||||
|
||||
FormButtonBinding binding = new FormButtonBinding(form);
|
||||
binding.addButton(submitBtn);
|
||||
}
|
||||
}
|
|
@ -24,7 +24,6 @@ import java.util.Map;
|
|||
import org.gcube.resourcemanagement.support.client.utils.CurrentStatus;
|
||||
import org.gcube.resourcemanagement.support.shared.operations.SupportedOperations;
|
||||
import org.gcube.resourcemanagement.support.shared.plugins.GenericResourcePlugin;
|
||||
import org.gcube.resourcemanagement.support.shared.plugins.TMPluginFormField;
|
||||
import org.gcube.resourcemanagement.support.shared.types.Tuple;
|
||||
import org.gcube.resourcemanagement.support.shared.types.datamodel.CompleteResourceProfile;
|
||||
import org.gcube.resourcemanagement.support.shared.types.datamodel.ResourceDescriptor;
|
||||
|
@ -168,8 +167,6 @@ public interface ServiceProxy extends RemoteService {
|
|||
|
||||
Map<String, GenericResourcePlugin> getGenericResourcePlugins() throws Exception;
|
||||
|
||||
HashMap<String, ArrayList<TMPluginFormField>> getGenericResourceTreeMagnagerPlugins() throws Exception;
|
||||
|
||||
/***********************************************************
|
||||
* RESOURCE OPERATIONS
|
||||
**********************************************************/
|
||||
|
|
|
@ -21,16 +21,13 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
import org.gcube.resourcemanagement.support.client.utils.CurrentStatus;
|
||||
import org.gcube.resourcemanagement.support.shared.operations.SupportedOperations;
|
||||
import org.gcube.resourcemanagement.support.shared.plugins.GenericResourcePlugin;
|
||||
import org.gcube.resourcemanagement.support.shared.plugins.TMPluginFormField;
|
||||
import org.gcube.resourcemanagement.support.shared.types.Tuple;
|
||||
import org.gcube.resourcemanagement.support.shared.types.datamodel.CompleteResourceProfile;
|
||||
import org.gcube.resourcemanagement.support.shared.types.datamodel.ResourceDescriptor;
|
||||
|
||||
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
|
||||
/**
|
||||
|
@ -120,6 +117,5 @@ public interface ServiceProxyAsync {
|
|||
* RESOURCE OPERATIONS
|
||||
**********************************************************/
|
||||
void doOperation(SupportedOperations opCode, String scope, List<ResourceDescriptor> resources, AsyncCallback<Void> callback) throws Exception;
|
||||
void getGenericResourceTreeMagnagerPlugins(
|
||||
AsyncCallback<HashMap<String, ArrayList<TMPluginFormField>>> callback);
|
||||
|
||||
}
|
||||
|
|
|
@ -30,14 +30,14 @@ import org.gcube.portlets.admin.resourcemanagement.client.widgets.registry.Widge
|
|||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.taskbar.TaskbarItem;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.taskbar.TaskbarRegister;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.viewport.MainContainer;
|
||||
import org.gcube.portlets.admin.resourcemanagement.shared.Configuration;
|
||||
import org.gcube.portlets.admin.resourcemanagement.shared.exceptions.WidgetNotRegistered;
|
||||
|
||||
import org.gcube.portlets.admin.resourcemanagement.shared.utils.DelayedOperation;
|
||||
import org.gcube.resourcemanagement.support.client.utils.StatusHandler;
|
||||
import org.gcube.resourcemanagement.support.client.views.ResourceTypeDecorator;
|
||||
import org.gcube.resourcemanagement.support.shared.types.Tuple;
|
||||
import org.gcube.resourcemanagement.support.shared.types.UserGroup;
|
||||
import org.gcube.resourcemanagement.support.shared.util.Configuration;
|
||||
import org.gcube.resourcemanagement.support.shared.util.DelayedOperation;
|
||||
|
||||
import com.extjs.gxt.ui.client.data.ModelData;
|
||||
import com.extjs.gxt.ui.client.widget.Component;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: OpCommands.java
|
||||
* Filename: CommonOperations.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
@ -23,12 +23,12 @@ import org.gcube.portlets.admin.resourcemanagement.client.forms.genericresources
|
|||
import org.gcube.portlets.admin.resourcemanagement.client.remote.ProxyRegistry;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.console.ConsoleMessageBroker;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.registry.UIIdentifiers;
|
||||
import org.gcube.portlets.admin.resourcemanagement.shared.utils.DelayedOperation;
|
||||
import org.gcube.resourcemanagement.support.client.utils.StatusHandler;
|
||||
import org.gcube.resourcemanagement.support.client.views.ResourceTypeDecorator;
|
||||
import org.gcube.resourcemanagement.support.shared.exceptions.InvalidParameterException;
|
||||
import org.gcube.resourcemanagement.support.shared.operations.SupportedOperations;
|
||||
import org.gcube.resourcemanagement.support.shared.types.datamodel.ResourceDescriptor;
|
||||
import org.gcube.resourcemanagement.support.shared.util.DelayedOperation;
|
||||
|
||||
import com.extjs.gxt.ui.client.data.ModelData;
|
||||
import com.extjs.gxt.ui.client.event.Listener;
|
||||
|
|
|
@ -270,7 +270,7 @@ public class ResourceDetailsPanel {
|
|||
// @Override
|
||||
// protected void onClick(final ComponentEvent ce) {
|
||||
// super.onClick(ce);
|
||||
// OpCommands.doOpenServiceForm();
|
||||
// CommonOperations.doOpenServiceForm();
|
||||
// }
|
||||
// };
|
||||
// createNew.setToolTip("Create new Software");
|
||||
|
|
|
@ -20,8 +20,8 @@ import org.gcube.portlets.admin.resourcemanagement.client.remote.ProxyRegistry;
|
|||
import org.gcube.portlets.admin.resourcemanagement.client.utils.Callbacks;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.utils.Commands;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.panels.MainPanel;
|
||||
import org.gcube.portlets.admin.resourcemanagement.shared.Configuration;
|
||||
import org.gcube.resourcemanagement.support.client.views.ResourceTypeDecorator;
|
||||
import org.gcube.resourcemanagement.support.shared.util.Configuration;
|
||||
|
||||
import com.extjs.gxt.ui.client.event.ComponentEvent;
|
||||
import com.extjs.gxt.ui.client.widget.menu.Menu;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
package org.gcube.portlets.admin.resourcemanagement.client.widgets.taskbar;
|
||||
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.console.ConsoleMessageBroker;
|
||||
import org.gcube.portlets.admin.resourcemanagement.shared.Configuration;
|
||||
import org.gcube.resourcemanagement.support.shared.util.Configuration;
|
||||
|
||||
import com.extjs.gxt.ui.client.event.IconButtonEvent;
|
||||
import com.extjs.gxt.ui.client.event.SelectionListener;
|
||||
|
|
|
@ -35,7 +35,6 @@ import org.gcube.common.core.scope.GCUBEScope;
|
|||
import org.gcube.portlets.admin.resourcemanagement.client.remote.ServiceProxy;
|
||||
import org.gcube.portlets.admin.resourcemanagement.server.gcube.services.StatusHandler;
|
||||
import org.gcube.portlets.admin.resourcemanagement.server.gcube.services.configuration.ConfigurationLoader;
|
||||
import org.gcube.portlets.admin.resourcemanagement.shared.exceptions.InvalidPermissionsException;
|
||||
import org.gcube.resourcemanagement.support.client.utils.CurrentStatus;
|
||||
import org.gcube.resourcemanagement.support.client.views.ResourceTypeDecorator;
|
||||
import org.gcube.resourcemanagement.support.server.gcube.CacheManager;
|
||||
|
@ -48,9 +47,9 @@ import org.gcube.resourcemanagement.support.server.managers.resources.ResourceFa
|
|||
import org.gcube.resourcemanagement.support.server.managers.scope.ScopeManager;
|
||||
import org.gcube.resourcemanagement.support.server.types.AllowedResourceTypes;
|
||||
import org.gcube.resourcemanagement.support.server.utils.ServerConsole;
|
||||
import org.gcube.resourcemanagement.support.shared.exceptions.InvalidPermissionsException;
|
||||
import org.gcube.resourcemanagement.support.shared.operations.SupportedOperations;
|
||||
import org.gcube.resourcemanagement.support.shared.plugins.GenericResourcePlugin;
|
||||
import org.gcube.resourcemanagement.support.shared.plugins.TMPluginFormField;
|
||||
import org.gcube.resourcemanagement.support.shared.types.Tuple;
|
||||
import org.gcube.resourcemanagement.support.shared.types.UserGroup;
|
||||
import org.gcube.resourcemanagement.support.shared.types.datamodel.CompleteResourceProfile;
|
||||
|
@ -137,11 +136,6 @@ public class ServiceProxyImpl extends RemoteServiceServlet implements ServicePro
|
|||
"scopedata.xml");
|
||||
}
|
||||
|
||||
private String getRepositoryUpdgradeDirPath() {
|
||||
String startDirectory = getServletFSPath();
|
||||
return startDirectory + File.separator + "reports";
|
||||
}
|
||||
|
||||
private String getXML2HTMLMapping() {
|
||||
String startDirectory = getServletFSPath();
|
||||
return startDirectory + File.separator + "xml" + File.separator + "xmlverbatim.xsl";
|
||||
|
@ -471,11 +465,6 @@ public class ServiceProxyImpl extends RemoteServiceServlet implements ServicePro
|
|||
public final Map<String, GenericResourcePlugin> getGenericResourcePlugins() throws Exception {
|
||||
return ISClientRequester.getGenericResourcePlugins(ScopeManager.getScope(this.getCurrentStatus().getCurrentScope()));
|
||||
}
|
||||
|
||||
|
||||
public final HashMap<String, ArrayList<TMPluginFormField>> getGenericResourceTreeMagnagerPlugins() throws Exception {
|
||||
return ISClientRequester.getGenericResourceTreeManagerPlugins(ScopeManager.getScope(this.getCurrentStatus().getCurrentScope()));
|
||||
}
|
||||
|
||||
private CurrentStatus getCurrentStatus() {
|
||||
return StatusHandler.getStatus(this.getHttpSession());
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: Configuration.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.shared;
|
||||
|
||||
/**
|
||||
* The client side UI configuration.
|
||||
* @author Daniele Strollo (ISTI-CNR)
|
||||
*/
|
||||
public class Configuration {
|
||||
// Delay of popups in mills
|
||||
public static final int popupDelay = 4000;
|
||||
// Configuration parameters that can be changed through options
|
||||
// menu.
|
||||
public static boolean openProfileOnLoad = false;
|
||||
public static boolean allowMultipleProfiles = false;
|
||||
//public static String scopeFile = null;
|
||||
|
||||
public static final String SUPER_USER_CODE = "gcube2010";
|
||||
/*
|
||||
* Forces to use flash based charts also in portal mode.
|
||||
* Due to conflicts in the portal with the flash based
|
||||
* charts this functionality usually is avoided.
|
||||
*/
|
||||
public static final boolean DISABLE_FLASH = false;
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: InvalidPermissionsException.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.shared.exceptions;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
/**
|
||||
* @author Daniele Strollo (ISTI-CNR)
|
||||
*
|
||||
*/
|
||||
public class InvalidPermissionsException extends Exception implements IsSerializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public InvalidPermissionsException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public InvalidPermissionsException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public InvalidPermissionsException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public InvalidPermissionsException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: DelayedOperation.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.shared.utils;
|
||||
|
||||
import com.google.gwt.user.client.Timer;
|
||||
|
||||
/**
|
||||
* Performs a delayed action on client side.
|
||||
* Usage:
|
||||
* <pre>
|
||||
* new DelayedOperation() {
|
||||
* // @Override
|
||||
* public void doJob() {
|
||||
* // Here the code...
|
||||
* }
|
||||
* }.start(5000); // the operation will start after 5 secs.
|
||||
* </pre>
|
||||
* @author Daniele Strollo (ISTI-CNR)
|
||||
*/
|
||||
public abstract class DelayedOperation {
|
||||
public final void start(final int delayMills) {
|
||||
Timer t = new Timer() {
|
||||
@Override
|
||||
public void run() {
|
||||
doJob();
|
||||
}
|
||||
};
|
||||
t.schedule(delayMills);
|
||||
}
|
||||
|
||||
public final void loop(final int delayMills) {
|
||||
Timer t = new Timer() {
|
||||
@Override
|
||||
public void run() {
|
||||
doJob();
|
||||
this.schedule(delayMills);
|
||||
}
|
||||
};
|
||||
t.schedule(delayMills);
|
||||
}
|
||||
|
||||
public abstract void doJob();
|
||||
}
|
|
@ -2,10 +2,10 @@
|
|||
<module rename-to='resourcemanagementportlet'>
|
||||
<!-- Inherit the core Web Toolkit stuff. -->
|
||||
<inherits name='com.google.gwt.user.User' />
|
||||
|
||||
<!-- <set-property name="user.agent" value="gecko1_8" /> -->
|
||||
|
||||
<inherits name='org.gcube.resourcemanagement.support.Resource_support' />
|
||||
<!-- <set-property name="user.agent" value="gecko1_8" /> -->
|
||||
|
||||
|
||||
|
||||
<!-- Other module inherits -->
|
||||
<inherits name='com.extjs.gxt.ui.GXT' />
|
||||
|
@ -15,9 +15,13 @@
|
|||
name='org.gcube.portlets.admin.software_upload_wizard.SoftwareUploadWizard' />
|
||||
<!-- inherits Resource Sweeper Widget -->
|
||||
<inherits name='org.gcube.portlets.admin.resourcesweeper.Resource_sweeper' />
|
||||
<!-- inherits IS Health Monitor Widget -->
|
||||
|
||||
<inherits name='org.gcube.portlets.admin.Activation_record_widgets' />
|
||||
<!-- inherits IS Health Monitor Widget -->
|
||||
<inherits
|
||||
name='org.gcube.portlets.admin.ishealthmonitor.Resource_ishealth_monitor' />
|
||||
|
||||
<inherits name='org.gcube.resourcemanagement.support.Resource_support' />
|
||||
<entry-point
|
||||
class='org.gcube.portlets.admin.resourcemanagement.client.ResourceManagementPortlet' />
|
||||
<!-- Specify the paths for translatable code -->
|
||||
|
|
|
@ -51,6 +51,18 @@
|
|||
<url-pattern>/resourcemanagementportlet/ishealth</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<!-- Activation Record Widgets -->
|
||||
<servlet>
|
||||
<servlet-name>arServlet</servlet-name>
|
||||
<servlet-class>org.gcube.portlets.admin.server.ARServiceImpl</servlet-class>
|
||||
</servlet>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>arServlet</servlet-name>
|
||||
<url-pattern>/resourcemanagementportlet/activeservice</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
|
||||
<servlet>
|
||||
<servlet-name>jUnitHostImpl</servlet-name>
|
||||
<servlet-class>com.google.gwt.junit.server.JUnitHostImpl</servlet-class>
|
||||
|
|
Loading…
Reference in New Issue