ofbiz-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Santosh Malviya <santosh.of...@gmail.com>
Subject Re: problem while returning list object
Date Thu, 15 Jul 2010 11:24:44 GMT
Hi Prasanthi,

Service returns a map, so  your return type should be Map and in this map
you have to put the list which will be also your OUT parameter and then you
can use the map wherever by accessing its key/value field.  Have a look on
performFindList service.

Thanks and Regards
Santosh Malviya

On Thu, Jul 15, 2010 at 3:24 PM, prasanthi_ofbiz <
prasanthi.sreeramjammisetty@tcs.com> wrote:

>
> Hi
> I have created my own service which is created for returning a list. So I
> have added below code in the services_ledger.xml
> <service name="getFinAccountType" engine="java" export="true"
>        location="org.ofbiz.accounting.finaccount.FinAccountServices"
> invoke="getFinAccountType" auth="true">
>        <description>parameterizing Financial Account Type</description>
>        <log level="info" message="Entered into  getFinAccountType service
> of
> services_ledger....."/>
>        <attribute type="String" mode="IN" name="finAccountTypeId"
> optional="true" />
>        <attribute type="String" mode="IN" name="parentTypeId"
> optional="true"
> />
>        <attribute type="String" mode="IN" name="isRefundable"
> optional="true"
> />
>        <attribute type="String" mode="IN" name="replenishEnumId"
> optional="true" />
>        <attribute type="String" mode="IN" name="hasTable" optional="true"
> />
>        <attribute type="String" mode="IN" name="description"
> optional="true"
> />
>        <attribute name="FinAccountTypeList" type="List" mode="OUT"
> optional="true"/>
>    </service>
>
> and getFinAccountType functionis written in FinAccountServices.java file
>
> public static List getFinAccountType(DispatchContext dctx, Map context) {
>                LocalDispatcher dispatcher = dctx.getDispatcher();
>        GenericDelegator delegator = dctx.getDelegator();
>
>        GenericValue userLogin = (GenericValue) context.get("userLogin");
>        String finAccountTypeId = (String) context.get("finAccountTypeId");
>        String parentTypeId = (String) context.get("parentTypeId");
>        String replenishEnumId = (String) context.get("replenishEnumId");
>        String isRefundable = (String) context.get("isRefundable");
>        String hasTable = (String) context.get("hasTable");
>        String description = (String) context.get("description");
>        GenericValue finAccount=null;
>        Map finAcctg = UtilMisc.toMap("finAccountTypeId",
> finAccountTypeId,"description", description,"hasTable",
> hasTable,"isRefundable", isRefundable,"replenishEnumId",
> replenishEnumId,"parentTypeId", parentTypeId);
>
>        List exprs = FastList.newInstance();
>
>        if(finAccountTypeId!=null)
>        {
>                Debug.log("finAccountTypeId Added as a serach parameter");
>                 exprs.add(EntityCondition.makeCondition("finAccountTypeId",
> EntityOperator.EQUALS, finAccountTypeId));
>        }
>        if(parentTypeId!=null)
>        {
>                Debug.log("parentTypeId Added as a serach parameter");
>                  exprs.add(EntityCondition.makeCondition("parentTypeId",
> EntityOperator.EQUALS, parentTypeId));
>        }
>        if(replenishEnumId!=null)
>        {
>                Debug.log("replenishEnumId Added as a serach parameter");
>                exprs.add(EntityCondition.makeCondition("replenishEnumId",
> EntityOperator.EQUALS, replenishEnumId));
>        }
>        if(isRefundable!=null)
>        {
>                Debug.log("isRefundable Added as a serach parameter");
>                 exprs.add(EntityCondition.makeCondition("isRefundable",
> EntityOperator.EQUALS, isRefundable));
>        }
>        if(hasTable!=null)
>        {
>                Debug.log("hasTable Added as a serach parameter");
>                exprs.add(EntityCondition.makeCondition("hasTable",
> EntityOperator.EQUALS, hasTable));
>        }
>        if(description!=null)
>        {
>                Debug.log("description Added as a serach parameter");
>                 exprs.add(EntityCondition.makeCondition("description",
> EntityOperator.EQUALS, description));
>        }
>
>        List orderBy = UtilMisc.toList("-finAccountTypeId");
>        List FinAccountTypeList = null;
>        try {
>                FinAccountTypeList = delegator.findList("FinAccountType",
> EntityCondition.makeCondition(exprs, EntityOperator.AND), null, orderBy,
> null, false);
>            Debug.log("FinAccountTypeList SIZEE........
> "+FinAccountTypeList.size());
>
> Debug.log("FinAccountTypeList+++++++++++++++++"+FinAccountTypeList);
>        } catch (GenericEntityException e) {
>            Debug.logError(e, module);
>        }
>        return FinAccountTypeList;
>    }
>
>
> But its giving error as
>
>
> The Following Errors Occurred:
>
> Error calling event: org.ofbiz.webapp.event.EventHandlerException: Service
> invocation error (Service [getFinAccountType] did not return a Map object)
>
>
> Please let me know the am I missed anything.
>
> --
> View this message in context:
> http://ofbiz.135035.n4.nabble.com/problem-while-returning-list-object-tp2289908p2289908.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message