i created a new service in hello3 example here is code for that

package org.ofbiz.hello3;

import java.util.HashMap;
import java.util.Map;

import org.ofbiz.base.util.Debug;        // uses Log4J
import org.ofbiz.base.util.UtilMisc;     // helpful utility for working with
Maps, Lists, etc.
import org.ofbiz.entity.GenericDelegator;
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
import org.ofbiz.service.DispatchContext;
import org.ofbiz.service.ServiceUtil;

public class Hello3Services {
    
    public static final String module = Hello3Services.class.getName(); //
used for debugging
   
    public static Map createHelloPerson(DispatchContext dctx, Map context) {
        GenericDelegator delegator = dctx.getDelegator();  // always passed
in with DispatchContext        
        
        try {
            String helloPersonId = delegator.getNextSeqId("HelloPerson"); //
gets next available key for HelloPerson
            Debug.logInfo("helloPersonId = " + helloPersonId, module); //
prints to the console or console.log
            GenericValue helloPerson = delegator.makeValue("HelloPerson", 
                    UtilMisc.toMap("helloPersonId", helloPersonId)); //
create a GenericValue from ID we just got
            helloPerson.setNonPKFields(context); // move non-primary key
fields from input parameters to GenericValue
            delegator.create(helloPerson); // store the generic value, ie
persists it
            
            Map result = ServiceUtil.returnSuccess(); // gets standard Map
for successful service operations
            result.put("helloPersonId", helloPersonId); // puts output
parameter into Map to return
            return result; // return Map
        } catch (GenericEntityException ex) { // required if you use
delegator in Java
            return ServiceUtil.returnError(ex.getMessage());
        }
    }
    
    public static Map findHelloPerson(DispatchContext dctx, Map Context)
    {
        return context;
    }
    
}


i get following compilation error



 [javac]
/home/vinod/Desktop/amit/ofbiz/hot-deploy/hello3/src/org/ofbiz/hello3/Hello3Services.java:30:
package org.ofbiz.base.util does not exist
    [javac] import org.ofbiz.base.util.Debug;        // uses Log4J
    [javac]                            ^
    [javac]
/home/vinod/Desktop/amit/ofbiz/hot-deploy/hello3/src/org/ofbiz/hello3/Hello3Services.java:31:
package org.ofbiz.base.util does not exist
    [javac] import org.ofbiz.base.util.UtilMisc;     // helpful utility for
working with Maps, Lists, etc.
    [javac]                            ^
    [javac]
/home/vinod/Desktop/amit/ofbiz/hot-deploy/hello3/src/org/ofbiz/hello3/Hello3Services.java:47:
cannot find symbol
    [javac] symbol  : variable Debug
    [javac] location: class org.ofbiz.hello3.Hello3Services
    [javac]             Debug.logInfo("helloPersonId = " + helloPersonId,
module); // prints to the console or console.log
    [javac]             ^
    [javac]
/home/vinod/Desktop/amit/ofbiz/hot-deploy/hello3/src/org/ofbiz/hello3/Hello3Services.java:49:
cannot find symbol
    [javac] symbol  : variable UtilMisc
    [javac] location: class org.ofbiz.hello3.Hello3Services
    [javac]                     UtilMisc.toMap("helloPersonId",
helloPersonId)); // create a GenericValue from ID we just got
    [javac]                     ^
    [javac]
/home/vinod/Desktop/amit/ofbiz/hot-deploy/hello3/src/org/ofbiz/hello3/Hello3Services.java:45:
cannot access org.ofbiz.base.util.GeneralException
    [javac] file org/ofbiz/base/util/GeneralException.class not found
    [javac]         try {
    [javac]         ^

-- 
View this message in context: 
http://www.nabble.com/compilation-error-tf3815449.html#a10800864
Sent from the OFBiz - User mailing list archive at Nabble.com.

Reply via email to