I use this for making Import Classes that do CRUD using services.
It works on windows. Have to figure out how to do this on linux.
got a service page like
https://localhost:8443/webtools/control/availableServices
select a service
https://localhost:8443/webtools/control/availableServices?sel_service_name=createProduct
highlight the In parameters area
so you can copy all the parameters
then using a editor that does not change the copy data, like PFE (old free editor)paste parameters as is
then open a blank Excel workbook
copy from the editor into excel
if everything went well you should see the columns from the service parameters in separate columns in excel
Now you can move them around and add columns to put in the strings you want
as an example
amountUomTypeId True String IN False Product amountUomTypeId fixedAmount True Double IN False Product fixedAmount
become
private String amountUomTypeId String ; <--note the semicolon private Double fixedAmount Double ;
you an use the CTRL-D to propogate the columns down for say
private
now you copy the whole list back to you editor
and do a replace of
String ;<--note the semicolon to distinquish between the other "String" in the line
with
=null;
so you end with
private String amountUomTypeId =null; private Double fixedAmount =0.0;
Now copy this into the editor(mine is eclipse) that has your class in it.
if your using eclipse or some such IDE
then you can do a format and it will adjust the code
Next, in eclipse, create the setters and getters
I do this so I am put default return for the get if the the parameter is null.
for instance here is a mapping routine I use made this way for create and update product
public static Map<String, Object> makeproductmap() { Debug.logInfo("makemap", module); productinfo.clear(); // productinfo.put("quantityincluded",getquantityincluded())); // productinfo.put("fixedamount",getfixedamount())); //productinfo.put("weight", getweight()); // productinfo.put("productheight",getproductheight())); // productinfo.put("shippingheight",getshippingheight())); // productinfo.put("productwidth",getproductwidth())); // productinfo.put("shippingwidth",getshippingwidth())); // productinfo.put("productdepth",getproductdepth())); // productinfo.put("shippingdepth",getshippingdepth())); // productinfo.put("productrating",getproductrating())); // productinfo.put("reservmaxpersons",getreservmaxpersons())); // productinfo.put("reserv2ndppperc",getreserv2ndppperc())); // productinfo.put("reservnthppperc",getreservnthppperc())); // productinfo.put("introductiondate",getintroductiondate())); // productinfo.put("supportdiscontinuationdate",getsupportdiscontinuationdate())); // productinfo.put("salesdiscontinuationdate",getsalesdiscontinuationdate())); // productinfo.put("locale",getlocale())); // productinfo.put("piecesincluded",getpiecesincluded())); // UtilMisc.addToBigDecimalInMap(productinfo,billofmateriallevel,getbillofmateriallevel()); productinfo.putAll(UtilMisc.toMap("userLogin", getuserlogin())); productinfo.putAll(UtilMisc.toMap("productId", getproductid())); productinfo.putAll(UtilMisc.toMap("primaryProductCategoryId", getprimaryproductcategoryid())); // productinfo.put("manufacturerpartyid",getmanufacturerpartyid())); // productinfo.put("facilityid",getfacilityid())); // productinfo.put("salesdiscwhennotavail",getsalesdiscwhennotavail())); // productinfo.put("brandname",getbrandname())); productinfo.putAll(UtilMisc.toMap("comments", getcomments())); // productinfo.putAll(UtilMisc.toMap("productname", getproductname())); productinfo.putAll(UtilMisc.toMap("description", getdescription())); productinfo.putAll(UtilMisc.toMap("longDescription", getlongdescription())); // productinfo.putAll(UtilMisc.toMap("pricedetailtext", // getpricedetailtext())); // productinfo.putAll(UtilMisc.toMap("smallimageurl", // getsmallimageurl())); // productinfo.putAll(UtilMisc.toMap("mediumimageurl", // getmediumimageurl())); // productinfo.putAll(UtilMisc.toMap("largeimageurl", // getlargeimageurl())); // productinfo.putAll(UtilMisc.toMap("detailimageurl", // getdetailimageurl())); // productinfo.putAll(UtilMisc.toMap("detailscreen", // getdetailscreen())); // productinfo.putAll(UtilMisc.toMap("inventorymessage", // getinventorymessage())); productinfo.putAll(UtilMisc.toMap("requireInventory", getrequireinventory())); // productinfo.putAll(UtilMisc.toMap("quantityuomid", // getquantityuomid())); // productinfo.putAll(UtilMisc.toMap("requireamount",getrequireamount())); // productinfo.putAll(UtilMisc.toMap("amountuomtypeid",getamountuomtypeid())); // productinfo.putAll(UtilMisc.toMap("weightuomid",getweightuomid())); // productinfo.putAll(UtilMisc.toMap("heightuomid",getheightuomid())); // productinfo.putAll(UtilMisc.toMap("widthuomid",getwidthuomid())); // productinfo.putAll(UtilMisc.toMap("depthuomid",getdepthuomid())); // productinfo.putAll(UtilMisc.toMap("ratingtypeenum",getratingtypeenum())); // productinfo.putAll(UtilMisc.toMap("returnable", getreturnable())); productinfo.putAll(UtilMisc.toMap("taxable", gettaxable())); // productinfo.putAll(UtilMisc.toMap("taxcategory", gettaxcategory())); // productinfo.putAll(UtilMisc.toMap("taxvatcode",gettaxvatcode())); // productinfo.putAll(UtilMisc.toMap("taxdutycode",gettaxdutycode())); productinfo.putAll(UtilMisc .toMap("chargeShipping", getchargeshipping())); productinfo.putAll(UtilMisc.toMap("autoCreateKeywords", getautocreatekeywords())); // productinfo.putAll(UtilMisc.toMap("includeinpromotions",getincludeinpromotions())); // productinfo.putAll(UtilMisc.toMap("isvirtual",getisvirtual())); // productinfo.putAll(UtilMisc.toMap("isvariant",getisvariant())); // productinfo.putAll(UtilMisc.toMap("origingeoid", getorigingeoid())); // productinfo.putAll(UtilMisc.toMap("requirementmethodenumid",getrequirementmethodenumid())); productinfo.putAll(UtilMisc.toMap("productTypeId", getproducttypeid())); productinfo.putAll(UtilMisc.toMap("internalName", getinternalname())); Debug.logInfo("makemap done", module); return productinfo; }
Note: this is a lot of extra work for inline code used in ofbiz
these classes are for importing scripts, so the major work is done you just have to write how to read the file and let the worker classes carry the load.