Following pictures show invocation and the results:
Groovy Code:
class SimpleGroovyClass {
public String execute(Map inParameters) {
return "HelloFromGroovyClass";
}
}
Request:
<groovy class-location="file" class-directory="c:/temp" class-name="SimpleGroovyClass">
<parameters>
<parameter id="greeting" value="hello"/>
</parameters>
</groovy>
Groovy Code:
/*
* Copyright (c) 2010 Zebra Technologies Corp. All Rights Reserved.
* $Id: $
*/
/**
* Created by IntelliJ IDEA.
* User: spabbala
* Date: Dec 8, 2010
* Time: 11:39:41 AM
* @author <a href="mailto:[email protected]">Siva Pabbala</a>
*/
import com.Navis.apex.business.model.GroovyInjectionBase
class GvyStuffUnit extends GroovyInjectionBase {
public String execute(Map inMap) {
def ctrId = inMap.get("unitId")
def emptyUfv = findActiveUfv(ctrId);
def stuffedUfv = stuffUfv(emptyUfv,null);
return stuffedUfv;
}
}
Request:
<groovy class-location="database" class-name="GvyStuffUnit">
<parameters>
<parameter id="unitId" value="TJBU4253846"/>
</parameters>
</groovy>
/*
* Copyright (c) 2010 Zebra Technologies Corp. All Rights Reserved.
* $Id: $
*/
import com.Navis.apex.business.model.GroovyInjectionBase
/**
* Created by IntelliJ IDEA.
* User: spabbala
* Date: Dec 8, 2010
* Time: 11:45:36 AM
* @author <a href="mailto:[email protected]">Siva Pabbala</a>
*/
class GvyStripUnit extends GroovyInjectionBase {
public String execute(Map inMap) {
def ctrId = inMap.get("unitId")
def emptyUfv = findActiveUfv(ctrId);
def strippedUfv = stripUfvAndRecordEvent( emptyUfv, null, "Strip Groovy Code");
return strippedUfv;
}
}
Request:
<groovy class-location="database" class-name="GvyStripUnit">
<parameters>
<parameter id="unitId" value="TJBU4253846"/>
</parameters>
</groovy>