You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by varun bhansaly <vb...@gmail.com> on 2010/10/11 13:10:29 UTC

Entity engine compare columns

Hi,
Is it possible to compare two columns using the entity engine,
For eg, write a query like this -
SELECT * FROM USER_LOGIN WHERE USER_LOGIN_ID <> PARTY_ID

-- 
Regards,
Varun Bhansaly

Re: Entity engine compare columns

Posted by pankaj savita <pa...@gmail.com>.
In entitymodel.xml partyId will be defined as:
   <field name="partyId" type="id-ne"></field>
&
 In java service you can get & compare using:
   String partyId = getPartyId(context);
   if (UtilValidate.isEmpty(partyId)) { //your code...}

-- 
Thanks & Regards,
Pankaj Savita
Mob: +91 9890262476
Mail to: pankajsavita@gmail.com

On Mon, Oct 11, 2010 at 6:47 PM, varun bhansaly <vb...@gmail.com> wrote:

> Thanks, but I wish to compare two columns.
> BTW, if I write this in java service, what should be the type for partyId ?
>
> On Mon, Oct 11, 2010 at 6:43 PM, Chirag Manocha <cmanocha@emforium.com
> >wrote:
>
> > Hi Varun,
> > Following will work for you :-
> > EntityCondition.makeCondition("USER_LOGIN_ID",
> > EntityJoinOperator.NOT_EQUAL, partyId)
> >
> > Regards
> > --
> > Chirag Manocha
> > Emforium Software Pvt. Ltd. | ALL-IN Software
> > +91-98735-47457 | +91-98263-19099
> > Please don't print this Email unless you really need to - this will
> > preserve trees on planet earth.
> >
> >
> >
> >
> > From: "pankaj savita" <pa...@gmail.com>
> > To: user@ofbiz.apache.org
> > Sent: Monday, October 11, 2010 6:12:44 PM
> > Subject: Re: Entity engine compare columns
> >
> > Hi Varun,
> >
> > You can make EntityCondition using:
> >
> > EntityCondition.makeCondition("USER_LOGIN_ID",
> > EntityOperator.GREATER_THAN_EQUAL_TO, PARTY_ID)
> >
> > or
> >
> > EntityCondition.makeCondition("USER_LOGIN_ID",
> > EntityOperator.LESS_THAN_EQUAL_TO, PARTY_ID)
> >
> >
> > --
> > Thanks & Regards,
> > Pankaj Savita
> > Mob: +91 9890262476
> > Mail to: pankajsavita@gmail.com
> >
> >
> > On Mon, Oct 11, 2010 at 4:40 PM, varun bhansaly <vb...@gmail.com>
> > wrote:
> >
> > > Hi,
> > > Is it possible to compare two columns using the entity engine,
> > > For eg, write a query like this -
> > > SELECT * FROM USER_LOGIN WHERE USER_LOGIN_ID <> PARTY_ID
> > >
> > > --
> > > Regards,
> > > Varun Bhansaly
> > >
> >
> >
>
>
> --
> Regards,
> Varun Bhansaly
>

Re: Entity engine compare columns

Posted by varun bhansaly <vb...@gmail.com>.
Thanks, but I wish to compare two columns.
BTW, if I write this in java service, what should be the type for partyId ?

On Mon, Oct 11, 2010 at 6:43 PM, Chirag Manocha <cm...@emforium.com>wrote:

> Hi Varun,
> Following will work for you :-
> EntityCondition.makeCondition("USER_LOGIN_ID",
> EntityJoinOperator.NOT_EQUAL, partyId)
>
> Regards
> --
> Chirag Manocha
> Emforium Software Pvt. Ltd. | ALL-IN Software
> +91-98735-47457 | +91-98263-19099
> Please don't print this Email unless you really need to - this will
> preserve trees on planet earth.
>
>
>
>
> From: "pankaj savita" <pa...@gmail.com>
> To: user@ofbiz.apache.org
> Sent: Monday, October 11, 2010 6:12:44 PM
> Subject: Re: Entity engine compare columns
>
> Hi Varun,
>
> You can make EntityCondition using:
>
> EntityCondition.makeCondition("USER_LOGIN_ID",
> EntityOperator.GREATER_THAN_EQUAL_TO, PARTY_ID)
>
> or
>
> EntityCondition.makeCondition("USER_LOGIN_ID",
> EntityOperator.LESS_THAN_EQUAL_TO, PARTY_ID)
>
>
> --
> Thanks & Regards,
> Pankaj Savita
> Mob: +91 9890262476
> Mail to: pankajsavita@gmail.com
>
>
> On Mon, Oct 11, 2010 at 4:40 PM, varun bhansaly <vb...@gmail.com>
> wrote:
>
> > Hi,
> > Is it possible to compare two columns using the entity engine,
> > For eg, write a query like this -
> > SELECT * FROM USER_LOGIN WHERE USER_LOGIN_ID <> PARTY_ID
> >
> > --
> > Regards,
> > Varun Bhansaly
> >
>
>


-- 
Regards,
Varun Bhansaly

Re: Entity engine compare columns

Posted by Chirag Manocha <cm...@emforium.com>.
Hi Varun, 
Following will work for you :- 
EntityCondition.makeCondition("USER_LOGIN_ID", EntityJoinOperator.NOT_EQUAL, partyId) 

Regards 
-- 
Chirag Manocha 
Emforium Software Pvt. Ltd. | ALL-IN Software 
+91-98735-47457 | +91-98263-19099 
Please don't print this Email unless you really need to - this will preserve trees on planet earth. 




From: "pankaj savita" <pa...@gmail.com> 
To: user@ofbiz.apache.org 
Sent: Monday, October 11, 2010 6:12:44 PM 
Subject: Re: Entity engine compare columns 

Hi Varun, 

You can make EntityCondition using: 

EntityCondition.makeCondition("USER_LOGIN_ID", 
EntityOperator.GREATER_THAN_EQUAL_TO, PARTY_ID) 

or 

EntityCondition.makeCondition("USER_LOGIN_ID", 
EntityOperator.LESS_THAN_EQUAL_TO, PARTY_ID) 


-- 
Thanks & Regards, 
Pankaj Savita 
Mob: +91 9890262476 
Mail to: pankajsavita@gmail.com 


On Mon, Oct 11, 2010 at 4:40 PM, varun bhansaly <vb...@gmail.com> wrote: 

> Hi, 
> Is it possible to compare two columns using the entity engine, 
> For eg, write a query like this - 
> SELECT * FROM USER_LOGIN WHERE USER_LOGIN_ID <> PARTY_ID 
> 
> -- 
> Regards, 
> Varun Bhansaly 
> 


Re: Entity engine compare columns

Posted by pankaj savita <pa...@gmail.com>.
Hi Varun,

You can make EntityCondition using:

EntityCondition.makeCondition("USER_LOGIN_ID",
EntityOperator.GREATER_THAN_EQUAL_TO, PARTY_ID)

or

EntityCondition.makeCondition("USER_LOGIN_ID",
EntityOperator.LESS_THAN_EQUAL_TO, PARTY_ID)


-- 
Thanks & Regards,
Pankaj Savita
Mob: +91 9890262476
Mail to: pankajsavita@gmail.com


On Mon, Oct 11, 2010 at 4:40 PM, varun bhansaly <vb...@gmail.com> wrote:

> Hi,
> Is it possible to compare two columns using the entity engine,
> For eg, write a query like this -
> SELECT * FROM USER_LOGIN WHERE USER_LOGIN_ID <> PARTY_ID
>
> --
> Regards,
> Varun Bhansaly
>

Re: Screen Question

Posted by Jacques Le Roux <ja...@les7arts.com>.
Yes, you should look at https://cwiki.apache.org/confluence/display/OFBTECH/OFBiz+security

Jacques

From: "Deepa Priolkar" <de...@TechMahindra.com>
I have a basic requirement to show certain sections of a web page only to users of specific role types.  What is the best way of 
doing that using ofbiz.  Can we include-screen on basis of some role type checks?

Thanks & Regards,
Deepa



Re: Screen Question

Posted by Rene Scheibe <re...@tngtech.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 10/11/2010 08:24 PM, Deepa Priolkar wrote:
> I have a basic requirement to show certain sections of a web page only to users of specific role types.  What is the best way of doing that using ofbiz.  Can we include-screen on basis of some role type checks? 
>  
> Thanks & Regards,
> Deepa
First have a look at:

http://www.opensourcestrategies.com/ofbiz/security.php
https://cwiki.apache.org/OFBTECH/ofbiz-security.html

For restricting sections of a page see some examples below.

In Freemarker (.ftl files):
(set a "hasPermission" variable in an action script before)

<#if security.hasEntityPermission("SOME_PERMISSION", "_VIEW", session)>
    <form>...</form>
<#else>
   <h3>${uiLabelMap.PagePermissionError}</h3>
</#if>


In Screens:

<screen name="...">
    <section>
        <condition>
            <if-has-permission permission="SOME_PERMISSION" action="_VIEW"/>
        </condition>
        <widgets>
           <include-screen name="SomethingYouWantToShow" location="..."/>
        </widgets>
        <fail-widgets>
            <include-screen name="NoPermission" location="..."/>
        </fail-widgets>
    </section>
</screen>

Cheers,
René
- -- 
René Scheibe * rene.scheibe@tngtech.com
TNG Technology Consulting GmbH, Betastr. 13a, 85774 Unterföhring
Geschäftsführer: Henrik Klagges, Gerhard Müller, Christoph Stock
Sitz: Unterföhring * Amtsgericht München * HRB 135082
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkyzY8gACgkQUXs9EHvIuCrOUwCeP7BnUeQ+wKzFew4jShaSyHDg
xe8An0K9Ja55uVxtUrtN7rd/UkBZDhsW
=jDlG
-----END PGP SIGNATURE-----

Screen Question

Posted by Deepa Priolkar <de...@TechMahindra.com>.
I have a basic requirement to show certain sections of a web page only to users of specific role types.  What is the best way of doing that using ofbiz.  Can we include-screen on basis of some role type checks? 
 
Thanks & Regards,
Deepa

Re: Entity engine compare columns

Posted by varun bhansaly <vb...@gmail.com>.
This is what works -
EntityCondition.makeCondition("oldValueText", EntityOperator.NOT_EQUAL,
EntityFieldValue.makeFieldValue("newValueText"));

and the generated query is -
SELECT AUDIT_HISTORY_SEQ_ID, CHANGED_ENTITY_NAME, CHANGED_FIELD_NAME,
PK_COMBINED_VALUE_TEXT, OLD_VALUE_TEXT, NEW_VALUE_TEXT, CHANGED_DATE,
CHANGED_BY_INFO, CHANGED_SESSION_INFO, LAST_UPDATED_STAMP,
LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP FROM ENTITY_AUDIT_LOG
WHERE (OLD_VALUE_TEXT <> NEW_VALUE_TEXT)  ORDER BY CHANGED_DATE DESC

Thanks All.

On Mon, Oct 11, 2010 at 7:29 PM, Bilgin Ibryam <bi...@gmail.com> wrote:

> The condtion should be something like this:
>
> (EntityFieldValue.makeFieldValue("userLoginId"),  EntityOperator.EQUALS,
> partyId)
>
>
> Bilgin
>
> On Mon, Oct 11, 2010 at 12:10 PM, varun bhansaly <vbhansaly@gmail.com
> >wrote:
>
> > Hi,
> > Is it possible to compare two columns using the entity engine,
> > For eg, write a query like this -
> > SELECT * FROM USER_LOGIN WHERE USER_LOGIN_ID <> PARTY_ID
> >
> > --
> > Regards,
> > Varun Bhansaly
> >
>



-- 
Regards,
Varun Bhansaly

Re: Entity engine compare columns

Posted by Bilgin Ibryam <bi...@gmail.com>.
The condtion should be something like this:

(EntityFieldValue.makeFieldValue("userLoginId"),  EntityOperator.EQUALS,
partyId)


Bilgin

On Mon, Oct 11, 2010 at 12:10 PM, varun bhansaly <vb...@gmail.com>wrote:

> Hi,
> Is it possible to compare two columns using the entity engine,
> For eg, write a query like this -
> SELECT * FROM USER_LOGIN WHERE USER_LOGIN_ID <> PARTY_ID
>
> --
> Regards,
> Varun Bhansaly
>