Is there any way to get the values from an entity without passing all the primary key values to the service which is implemented in minilang?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Is there any way to get the values from an entity without passing all the primary key values to the service which is implemented in minilang?

Kishore.M
Hi all,
Following is the entity model for the entity ProductAssoc

<entity entity-name="ProductAssoc"
            package-name="org.ofbiz.product.product"
            title="Product Association Entity">
      <field name="productId" type="id-ne"></field>
      <field name="productIdTo" type="id-ne"></field>
      <field name="productAssocTypeId" type="id-ne"></field>
      <field name="fromDate" type="date-time"></field>
      <field name="thruDate" type="date-time"></field>
      <field name="sequenceNum" type="numeric"></field>
      <field name="reason" type="long-varchar"></field>
      <field name="quantity" type="floating-point"></field>
      <field name="scrapFactor" type="floating-point"></field>
      <field name="instruction" type="long-varchar"></field>
      <field name="routingWorkEffortId" type="id"></field>
      <field name="estimateCalcMethod" type="id"></field>
      <field name="recurrenceInfoId" type="id"></field>
      <prim-key field="productId"/>
      <prim-key field="productIdTo"/>
      <prim-key field="productAssocTypeId"/>
      <prim-key field="fromDate"/>
      <relation type="one" fk-name="PROD_ASSOC_TYPE" rel-entity-name="ProductAssocType">
        <key-map field-name="productAssocTypeId"/>
      </relation>
      <relation type="one" fk-name="PROD_ASSOC_MPROD" title="Main" rel-entity-name="Product">
        <key-map field-name="productId"/>
      </relation>
      <relation type="one" fk-name="PROD_ASSOC_APROD" title="Assoc" rel-entity-name="Product">
        <key-map field-name="productIdTo" rel-field-name="productId"/>
      </relation>
      <relation type="one" fk-name="PROD_ASSOC_RTWE" title="Routing" rel-entity-name="WorkEffort">
        <key-map field-name="routingWorkEffortId" rel-field-name="workEffortId"/>
      </relation>
      <relation type="one" fk-name="PROD_ASSOC_CUSM" rel-entity-name="CustomMethod">
        <key-map field-name="estimateCalcMethod" rel-field-name="customMethodId"/>
      </relation>
        <relation type="one" fk-name="PROD_ASSOC_RECINFO" rel-entity-name="RecurrenceInfo">
            <key-map field-name="recurrenceInfoId"/>
        </relation>
    </entity>


I want to implement a service in minilang.In that service I want to get the corresponding values from the entity "ProductAssoc" by passing only "productId" without passing all the primary keys.
Is there any way to do that?

please help me out.

regards,
Kishore.M
Reply | Threaded
Open this post in threaded view
|

Re: Is there any way to get the values from an entity without passing all the primary key values to the service which is implemented in minilang?

Pankaj Lall
You can do by the help of bean shell script by calling the method called
findByPrimaryKey and inside this pass the primary key

On 12/21/07, Kishore.M <[hidden email]> wrote:

>
>
> Hi all,
> Following is the entity model for the entity ProductAssoc
>
> <entity entity-name="ProductAssoc"
>             package-name="org.ofbiz.product.product"
>             title="Product Association Entity">
>       <field name="productId" type="id-ne"></field>
>       <field name="productIdTo" type="id-ne"></field>
>       <field name="productAssocTypeId" type="id-ne"></field>
>       <field name="fromDate" type="date-time"></field>
>       <field name="thruDate" type="date-time"></field>
>       <field name="sequenceNum" type="numeric"></field>
>       <field name="reason" type="long-varchar"></field>
>       <field name="quantity" type="floating-point"></field>
>       <field name="scrapFactor" type="floating-point"></field>
>       <field name="instruction" type="long-varchar"></field>
>       <field name="routingWorkEffortId" type="id"></field>
>       <field name="estimateCalcMethod" type="id"></field>
>       <field name="recurrenceInfoId" type="id"></field>
>       <prim-key field="productId"/>
>       <prim-key field="productIdTo"/>
>       <prim-key field="productAssocTypeId"/>
>       <prim-key field="fromDate"/>
>       <relation type="one" fk-name="PROD_ASSOC_TYPE"
> rel-entity-name="ProductAssocType">
>         <key-map field-name="productAssocTypeId"/>
>       </relation>
>       <relation type="one" fk-name="PROD_ASSOC_MPROD" title="Main"
> rel-entity-name="Product">
>         <key-map field-name="productId"/>
>       </relation>
>       <relation type="one" fk-name="PROD_ASSOC_APROD" title="Assoc"
> rel-entity-name="Product">
>         <key-map field-name="productIdTo" rel-field-name="productId"/>
>       </relation>
>       <relation type="one" fk-name="PROD_ASSOC_RTWE" title="Routing"
> rel-entity-name="WorkEffort">
>         <key-map field-name="routingWorkEffortId"
> rel-field-name="workEffortId"/>
>       </relation>
>       <relation type="one" fk-name="PROD_ASSOC_CUSM"
> rel-entity-name="CustomMethod">
>         <key-map field-name="estimateCalcMethod"
> rel-field-name="customMethodId"/>
>       </relation>
>         <relation type="one" fk-name="PROD_ASSOC_RECINFO"
> rel-entity-name="RecurrenceInfo">
>             <key-map field-name="recurrenceInfoId"/>
>         </relation>
>     </entity>
>
>
> I want to implement a service in minilang.In that service I want to get
> the
> corresponding values from the entity "ProductAssoc" by passing only
> "productId" without passing all the primary keys.
> Is there any way to do that?
>
> please help me out.
>
> regards,
> Kishore.M
>
> --
> View this message in context:
> http://www.nabble.com/Is-there-any-way-to-get-the-values-from-an-entity-without-passing-all-the-primary-key-values-to-the-service-which-is-implemented-in-minilang--tp14455004p14455004.html
> Sent from the OFBiz - Dev mailing list archive at Nabble.com.
>
>


--
With Regards
Pankaj Lall
Jr. Software Architect
Palindrome Software Lab Ltd.
Reply | Threaded
Open this post in threaded view
|

Re: Is there any way to get the values from an entity without passing all the primary key values to the service which is implemented in minilang?

Jacques Le Roux
Administrator
Please use rather user ML for such question :
http://docs.ofbiz.org/display/OFBADMIN/Mailing+Lists#MailingLists-DeveloperList:dev@...

I guess the question was more about using find-by-and in minilang

Jacques


From: "Pankaj Lall" <[hidden email]>

> You can do by the help of bean shell script by calling the method called
> findByPrimaryKey and inside this pass the primary key
>
> On 12/21/07, Kishore.M <[hidden email]> wrote:
>>
>>
>> Hi all,
>> Following is the entity model for the entity ProductAssoc
>>
>> <entity entity-name="ProductAssoc"
>>             package-name="org.ofbiz.product.product"
>>             title="Product Association Entity">
>>       <field name="productId" type="id-ne"></field>
>>       <field name="productIdTo" type="id-ne"></field>
>>       <field name="productAssocTypeId" type="id-ne"></field>
>>       <field name="fromDate" type="date-time"></field>
>>       <field name="thruDate" type="date-time"></field>
>>       <field name="sequenceNum" type="numeric"></field>
>>       <field name="reason" type="long-varchar"></field>
>>       <field name="quantity" type="floating-point"></field>
>>       <field name="scrapFactor" type="floating-point"></field>
>>       <field name="instruction" type="long-varchar"></field>
>>       <field name="routingWorkEffortId" type="id"></field>
>>       <field name="estimateCalcMethod" type="id"></field>
>>       <field name="recurrenceInfoId" type="id"></field>
>>       <prim-key field="productId"/>
>>       <prim-key field="productIdTo"/>
>>       <prim-key field="productAssocTypeId"/>
>>       <prim-key field="fromDate"/>
>>       <relation type="one" fk-name="PROD_ASSOC_TYPE"
>> rel-entity-name="ProductAssocType">
>>         <key-map field-name="productAssocTypeId"/>
>>       </relation>
>>       <relation type="one" fk-name="PROD_ASSOC_MPROD" title="Main"
>> rel-entity-name="Product">
>>         <key-map field-name="productId"/>
>>       </relation>
>>       <relation type="one" fk-name="PROD_ASSOC_APROD" title="Assoc"
>> rel-entity-name="Product">
>>         <key-map field-name="productIdTo" rel-field-name="productId"/>
>>       </relation>
>>       <relation type="one" fk-name="PROD_ASSOC_RTWE" title="Routing"
>> rel-entity-name="WorkEffort">
>>         <key-map field-name="routingWorkEffortId"
>> rel-field-name="workEffortId"/>
>>       </relation>
>>       <relation type="one" fk-name="PROD_ASSOC_CUSM"
>> rel-entity-name="CustomMethod">
>>         <key-map field-name="estimateCalcMethod"
>> rel-field-name="customMethodId"/>
>>       </relation>
>>         <relation type="one" fk-name="PROD_ASSOC_RECINFO"
>> rel-entity-name="RecurrenceInfo">
>>             <key-map field-name="recurrenceInfoId"/>
>>         </relation>
>>     </entity>
>>
>>
>> I want to implement a service in minilang.In that service I want to get
>> the
>> corresponding values from the entity "ProductAssoc" by passing only
>> "productId" without passing all the primary keys.
>> Is there any way to do that?
>>
>> please help me out.
>>
>> regards,
>> Kishore.M
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Is-there-any-way-to-get-the-values-from-an-entity-without-passing-all-the-primary-key-values-to-the-service-which-is-implemented-in-minilang--tp14455004p14455004.html
>> Sent from the OFBiz - Dev mailing list archive at Nabble.com.
>>
>>
>
>
> --
> With Regards
> Pankaj Lall
> Jr. Software Architect
> Palindrome Software Lab Ltd.
>

Reply | Threaded
Open this post in threaded view
|

Re: Is there any way to get the values from an entity without passing all the primary key values to the service which is implemented in minilang?

Rashko Rejmer
In reply to this post by Kishore.M
You can do that as Jacques proposed:

<set field="lookupMap.productId" from-field="parameters.productId"/>
<find-by-and entity-name="ProductAssoc" map-name="lookupMap"
list-name="productAssocs"/>

you will get list(productAssocs) with all records from ProductAssoc
entity that corespond to this expression:
 - ProductAssoc.productId = parameters.productId

Regards,
Rashko Rejmer

On Fri, 2007-12-21 at 04:55 -0800, Kishore.M wrote:

> Hi all,
> Following is the entity model for the entity ProductAssoc
>
> <entity entity-name="ProductAssoc"
>             package-name="org.ofbiz.product.product"
>             title="Product Association Entity">
>       <field name="productId" type="id-ne"></field>
>       <field name="productIdTo" type="id-ne"></field>
>       <field name="productAssocTypeId" type="id-ne"></field>
>       <field name="fromDate" type="date-time"></field>
>       <field name="thruDate" type="date-time"></field>
>       <field name="sequenceNum" type="numeric"></field>
>       <field name="reason" type="long-varchar"></field>
>       <field name="quantity" type="floating-point"></field>
>       <field name="scrapFactor" type="floating-point"></field>
>       <field name="instruction" type="long-varchar"></field>
>       <field name="routingWorkEffortId" type="id"></field>
>       <field name="estimateCalcMethod" type="id"></field>
>       <field name="recurrenceInfoId" type="id"></field>
>       <prim-key field="productId"/>
>       <prim-key field="productIdTo"/>
>       <prim-key field="productAssocTypeId"/>
>       <prim-key field="fromDate"/>
>       <relation type="one" fk-name="PROD_ASSOC_TYPE"
> rel-entity-name="ProductAssocType">
>         <key-map field-name="productAssocTypeId"/>
>       </relation>
>       <relation type="one" fk-name="PROD_ASSOC_MPROD" title="Main"
> rel-entity-name="Product">
>         <key-map field-name="productId"/>
>       </relation>
>       <relation type="one" fk-name="PROD_ASSOC_APROD" title="Assoc"
> rel-entity-name="Product">
>         <key-map field-name="productIdTo" rel-field-name="productId"/>
>       </relation>
>       <relation type="one" fk-name="PROD_ASSOC_RTWE" title="Routing"
> rel-entity-name="WorkEffort">
>         <key-map field-name="routingWorkEffortId"
> rel-field-name="workEffortId"/>
>       </relation>
>       <relation type="one" fk-name="PROD_ASSOC_CUSM"
> rel-entity-name="CustomMethod">
>         <key-map field-name="estimateCalcMethod"
> rel-field-name="customMethodId"/>
>       </relation>
>         <relation type="one" fk-name="PROD_ASSOC_RECINFO"
> rel-entity-name="RecurrenceInfo">
>             <key-map field-name="recurrenceInfoId"/>
>         </relation>
>     </entity>
>
>
> I want to implement a service in minilang.In that service I want to get the
> corresponding values from the entity "ProductAssoc" by passing only
> "productId" without passing all the primary keys.
> Is there any way to do that?
>
> please help me out.
>
> regards,
> Kishore.M
>