Commit aeefcf1f authored by Marc Dutoo's avatar Marc Dutoo

studio : patched #89 3. guard against empty binding (without name ; WS or other)

using new ErrorProcessor
parent 48c10ec3
......@@ -46,6 +46,8 @@ import org.ow2.frascati.metamodel.web.VelocityImplementation;
public interface HTMLProcessorItf {
String getErrorPanel();
String getComponentPanel(Component component);
String getComponentMenu();
......
......@@ -55,6 +55,9 @@ public class ComplexProcessor implements ComplexProcessorItf {
}
protected ComplexProcessorItf getProcessorById(EObject eObject) {
if (eObject == null) { // #FRASCATI-89 3. patch : guard against empty binding (without name ; WS or other)
return this.processorMap.get("error");
}
return this.processorMap.get(eObject.eClass().getEPackage().getNsURI() + "#" + eObject.eClass().getName());
}
......
/**
* EasySOA
*
* Copyright (C) 2011-2013 Inria, University of Lille 1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Contact: frascati@ow2.org
*
* Author: Marc Dutoo
*
* Contributor(s):
*
*/
package org.easysoa.processor;
import java.util.Map;
import org.easysoa.api.ComplexProcessorItf;
import org.easysoa.api.HTMLProcessorItf;
import org.eclipse.emf.ecore.EObject;
import org.json.simple.JSONObject;
import org.osoa.sca.annotations.Reference;
/**
* Used when normal processing can't be done, ex. model (eObject) is null.
* Helps solve #FRASCATI-89 3. guard against empty binding (without name ; WS or other).
*
* @author mdutoo
*
*/
public class ErrorProcessor implements ComplexProcessorItf {
@Reference
protected HTMLProcessorItf html;
@Override
public String getId() {
return "error";
}
@Override
public String getLabel(EObject eObject) {
return "Error";
}
@SuppressWarnings("unchecked")
@Override
public JSONObject getMenuItem(EObject eObject, String parentId) {
JSONObject bindingObject = new JSONObject();
bindingObject.put("id", "error");
bindingObject.put("text", "error");
bindingObject.put("im0", "blank.gif");
bindingObject.put("im1", "blank.gif");
bindingObject.put("im2", "blank.gif");
return bindingObject;
}
public String getPanel(String userId, EObject eObject) {
return html.getErrorPanel();
}
@Override
public String getActionMenu(EObject eObject) {
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("<div id=\"error\" img=\"blank.gif\" text=\"Error\"></div>");
return stringBuffer.toString();
}
@Override
public EObject saveElement(EObject eObject, Map<String, Object> params) {
return null;
}
@Override
public EObject getNewEObject(EObject eObject) {
return null;
}
}
......@@ -47,6 +47,13 @@
float: right;
}
.error-image{
background:url(../images/sca/blank.gif) no-repeat center center;
width: 21px;
height: 21px;
float: left;
}
.component-image{
background:url(../images/sca/Component.gif) no-repeat center center;
width: 21px;
......
......@@ -272,6 +272,16 @@
<wire source="Processor/processors" target="CompositeImplementationProcessor/composite-implementation" />
<wire source="ImplementationsProcessor/processors" target="CompositeImplementationProcessor/composite-implementation" />
<component name="ErrorProcessor">
<implementation.java
class="org.easysoa.processor.ErrorProcessor" />
<service name="error">
<interface.java interface="org.easysoa.api.ComplexProcessorItf" />
</service>
<reference name="html" target="HTMLProcessor/html"/>
</component>
<wire source="Processor/processors" target="ErrorProcessor/error" />
<component name="JavaImplementationProcessor">
<implementation.java
class="org.easysoa.processor.JavaImplementationProcessor" />
......
......@@ -293,6 +293,16 @@ TODO : Use an include tag with the easysoa.composite file instead of a raw copie
<wire source="Processor/processors" target="CompositeImplementationProcessor/composite-implementation" />
<wire source="ImplementationsProcessor/processors" target="CompositeImplementationProcessor/composite-implementation" />
<component name="ErrorProcessor">
<implementation.java
class="org.easysoa.processor.ErrorProcessor" />
<service name="error">
<interface.java interface="org.easysoa.api.ComplexProcessorItf" />
</service>
<reference name="html" target="HTMLProcessor/html"/>
</component>
<wire source="Processor/processors" target="ErrorProcessor/error" />
<component name="JavaImplementationProcessor">
<implementation.java
class="org.easysoa.processor.JavaImplementationProcessor" />
......
#macro ( getErrorPanel )
<div class="component_frame_line">
<table>
<tr>
<td>
<div class="error-image"></div>
Name :
</td>
<td colspan="2">
<input type="text" id="name" name="name" value="error: empty binding"/><br/>
</td>
</tr>
</table>
</div>
#end
#macro ( getComponentPanel )
<div class="component_frame_line">
<table>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment