Re: A question about Content

2013-02-22 Thread Hans Bakker
Hi Lee,

we are kind of re-activating the content component in growerp.com, so
please feel free , as Adrian said, to supply patches

we will be very happy to commit them

Regards,
Hans

Growerp: The ERP system which grows with your business

On 02/22/2013 03:12 PM, Adrian Crum wrote:
 The Content component is partially completed and it doesn't get much
 attention. You are welcome to submit patches to get it working.

 -Adrian

 On 2/22/2013 3:58 AM, Mogra wrote:
 Hello
 I created an Image content for a product. There is a record in table 
 'Content' whose field 'statusId' is 'IM_APPROVED'. I changed the value of 
 the field from IM_APPROVED to IM_REJECTED, but the image is still visible, 
 the status seems not to work. Meanwhile, I find the status about content, 
 for example, CTNT_AVAILABLE, CTNT_FINAL_DRAFT, CTNT_INITIAL_DRAFT and so on, 
 don't  work, I change the status of a warn to CTNT_DEACTIVATED, but it is 
 still visible. Is the function about status of contents incomplete ? 


 Thanks
 Lee



How to handle transaction?

2013-02-22 Thread Winster Jose
Hi,

I want to store entities into database using
delegator.create(genericValue). I want to wrap this operation in a
transaction so that if any of the entity insert operation fails, rollback
all previous insert operations. How can I do that in OFBiz?

Thanks in advance
Winster T Jose
Director - Technology and Architecture
Chathurangam Creative Solutions Private Ltd.
Cell: +91-98469 31020
Mail: wins...@chathurangam.net


Re: How to handle transaction?

2013-02-22 Thread Adrian Crum
If the operation is within a service, you don't need to worry about 
handling transactions - the service engine does that for you.


-Adrian

On 2/22/2013 12:40 PM, Winster Jose wrote:

Hi,

I want to store entities into database using
delegator.create(genericValue). I want to wrap this operation in a
transaction so that if any of the entity insert operation fails, rollback
all previous insert operations. How can I do that in OFBiz?

Thanks in advance
Winster T Jose
Director - Technology and Architecture
Chathurangam Creative Solutions Private Ltd.
Cell: +91-98469 31020
Mail: wins...@chathurangam.net





Re: How to handle transaction?

2013-02-22 Thread Winster Jose
Thanks Adrian. Currently I am invoking the method from groovy directly. So,
I need to change the way I did, right?

On Fri, Feb 22, 2013 at 7:13 PM, Adrian Crum 
adrian.c...@sandglass-software.com wrote:

 If the operation is within a service, you don't need to worry about
 handling transactions - the service engine does that for you.

 -Adrian


 On 2/22/2013 12:40 PM, Winster Jose wrote:

 Hi,

 I want to store entities into database using
 delegator.create(**genericValue). I want to wrap this operation in a
 transaction so that if any of the entity insert operation fails, rollback
 all previous insert operations. How can I do that in OFBiz?

 Thanks in advance
 Winster T Jose
 Director - Technology and Architecture
 Chathurangam Creative Solutions Private Ltd.
 Cell: +91-98469 31020
 Mail: wins...@chathurangam.net





-- 
Winster T Jose
Director - Technology and Architecture
Chathurangam Creative Solutions Private Ltd.
Cell: +91-98469 31020
Mail: wins...@chathurangam.net


Re: How to handle transaction?

2013-02-22 Thread Adrian Crum

How did you invoke Groovy?

-Adrian

On 2/22/2013 1:48 PM, Winster Jose wrote:

Thanks Adrian. Currently I am invoking the method from groovy directly. So,
I need to change the way I did, right?

On Fri, Feb 22, 2013 at 7:13 PM, Adrian Crum 
adrian.c...@sandglass-software.com wrote:


If the operation is within a service, you don't need to worry about
handling transactions - the service engine does that for you.

-Adrian


On 2/22/2013 12:40 PM, Winster Jose wrote:


Hi,

I want to store entities into database using
delegator.create(**genericValue). I want to wrap this operation in a
transaction so that if any of the entity insert operation fails, rollback
all previous insert operations. How can I do that in OFBiz?

Thanks in advance
Winster T Jose
Director - Technology and Architecture
Chathurangam Creative Solutions Private Ltd.
Cell: +91-98469 31020
Mail: wins...@chathurangam.net








Re: How to handle transaction?

2013-02-22 Thread Deepak Agarwal
Hello Winster,

You need to call the service as :

dispatcher.runSync(MyService, map);

This way a new transaction is automatically created if there is no current
transaction in place.  If there was a transaction (in case of service
chain, one service calling to another service) a new transaction is not
created (unless in service definition you have mentioned to create a new
transaction always).

On Fri, Feb 22, 2013 at 9:41 PM, Adrian Crum 
adrian.c...@sandglass-software.com wrote:

 How did you invoke Groovy?

 -Adrian


 On 2/22/2013 1:48 PM, Winster Jose wrote:

 Thanks Adrian. Currently I am invoking the method from groovy directly.
 So,
 I need to change the way I did, right?

 On Fri, Feb 22, 2013 at 7:13 PM, Adrian Crum 
 adrian.crum@sandglass-**software.com adrian.c...@sandglass-software.com
 wrote:

  If the operation is within a service, you don't need to worry about
 handling transactions - the service engine does that for you.

 -Adrian


 On 2/22/2013 12:40 PM, Winster Jose wrote:

  Hi,

 I want to store entities into database using
 delegator.create(genericValue). I want to wrap this operation in
 a
 transaction so that if any of the entity insert operation fails,
 rollback
 all previous insert operations. How can I do that in OFBiz?

 Thanks in advance
 Winster T Jose
 Director - Technology and Architecture
 Chathurangam Creative Solutions Private Ltd.
 Cell: +91-98469 31020
 Mail: wins...@chathurangam.net







-- 
Thanks,
Deepak Agarwal,

Mobile: +91 9501190044


Re: List of all people and the company they work for

2013-02-22 Thread James Piechota
Solved (I couldn't let it go). For anyone else looking to do something
similar, the following will create a view-entity with two columns (person
and group) and populated with all EMPLOYMENT relationships (you can adjust
the condition at the end to grab other relationships). Main reason I've
needed to do this is to simplify dependent code - without this much of my
code would need to be duplicated to handle both person - group and group
- person relationships. (FYI: if you're using mysql, like I am, you'll
have to set sql_mode=PIPES_AS_CONCAT so that the || operator is treated as
a concat).

view-entity entity-name=XXX package-name=org.ofbiz.xxx title=XXX
!-- SELECT
(coalesce(FROMPERS.PARTY_ID, ) ||
coalesce(TOPERS.PARTY_ID, )) as Person,
(coalesce(FROMGRP.PARTY_ID, ) || coalesce(TOGRP.PARTY_ID,
)) as PartyGroup
FROM PARTY_RELATIONSHIP REL
LEFT OUTER JOIN PERSON FROMPERS ON FROMPERS.PARTY_ID =
REL.PARTY_ID_FROM
LEFT OUTER JOIN PARTY_GROUP TOGRP ON TOGRP.PARTY_ID =
REL.PARTY_ID_TO
LEFT OUTER JOIN PARTY_GROUP FROMGRP ON FROMGRP.PARTY_ID =
REL.PARTY_ID_FROM
LEFT OUTER JOIN PERSON TOPERS ON TOPERS.PARTY_ID =
REL.PARTY_ID_TO
WHERE coalesce(FROMPERS.PARTY_ID, TOPERS.PARTY_ID) IS NOT
NULL
and coalesce(FROMGRP.PARTY_ID, TOGRP.PARTY_ID) IS NOT NULL
and REL.PARTY_RELATIONSHIP_TYPE_ID IS NOT NULL;
--

member-entity entity-alias=REL entity-name=PartyRelationship/
member-entity entity-alias=FROMPERS entity-name=Person/
member-entity entity-alias=TOPERS entity-name=Person/
member-entity entity-alias=FROMGRP entity-name=PartyGroup/
member-entity entity-alias=TOGRP entity-name=PartyGroup/

alias name=person
complex-alias operator=||
complex-alias-field entity-alias=FROMPERS
field=partyId default-value=''/
complex-alias-field entity-alias=TOPERS field=partyId
default-value=''/
/complex-alias
/alias
alias name=group
complex-alias operator=||
complex-alias-field entity-alias=FROMGRP field=partyId
default-value=''/
complex-alias-field entity-alias=TOGRP field=partyId
default-value=''/
/complex-alias
/alias

view-link entity-alias=REL rel-entity-alias=FROMPERS
rel-optional=true
key-map field-name=partyIdFrom rel-field-name=partyId/
/view-link
view-link entity-alias=REL rel-entity-alias=TOGRP
rel-optional=true
key-map field-name=partyIdTo rel-field-name=partyId/
/view-link
view-link entity-alias=REL rel-entity-alias=FROMGRP
rel-optional=true
key-map field-name=partyIdFrom rel-field-name=partyId/
/view-link
view-link entity-alias=REL rel-entity-alias=TOPERS
rel-optional=true
key-map field-name=partyIdTo rel-field-name=partyId/
/view-link
entity-condition
condition-list combine=and
condition-list combine=or
condition-expr entity-alias=FROMPERS
field-name=partyId operator=not-equals/
condition-expr entity-alias=TOPERS
field-name=partyId operator=not-equals/
/condition-list
condition-list combine=or
condition-expr entity-alias=FROMGRP
field-name=partyId operator=not-equals/
condition-expr entity-alias=TOGRP
field-name=partyId operator=not-equals/
/condition-list
condition-expr entity-alias=REL
field-name=partyRelationshipTypeId operator=equals value=EMPLOYMENT/
/condition-list
/entity-condition
/view-entity



On Thu, Feb 21, 2013 at 9:22 PM, James Piechota piech...@gmail.com wrote:

 I appreciate your help, Adrian, but I'm gonna have to move on. I haven't
 been able to find the magic code example you've alluded to, and honestly
 can't think of how to get what I need without using COALESCE, UNION, or an
 OR condition in a LEFT JOIN - none of which seem to be supported.

 No matter how I spin (even using 3 view-entities as you suggest) I can't
 get a single view-entity holding just a column of Person IDs and a column
 of PartyGroup IDs representing all EMPLOYEE - EMPLOYER and EMPLOYER -
 EMPLOYEE relationships.

 I'll either fall back on my 4 line code hack, or cobble something together
 in groovy.

 James


 On Thu, Feb 21, 2013 at 12:51 AM, Adrian Crum 
 adrian.c...@sandglass-software.com wrote:

 You will need three view entities: One for the from party, one for the
 to party, and one to combine the first two view entities. There are
 examples of that in code.

 -Adrian


 On 2/21/2013 1:19 AM, James Piechota wrote:

 FWIW: As near as I can tell, there's no way to do this. I'll see if I can
 cobble something together using two view-entities (one for each of the to
 

Re: List of all people and the company they work for

2013-02-22 Thread James Piechota
Yep, thanks.

James


On Fri, Feb 22, 2013 at 3:27 PM, Adrian Crum 
adrian.c...@sandglass-software.com wrote:

 It's good to know you got it sorted. I would recommend leaving the
 condition out of the view - so you can reuse it for other party
 relationships.

 -Adrian


 On 2/22/2013 10:49 PM, James Piechota wrote:

 Solved (I couldn't let it go). For anyone else looking to do something
 similar, the following will create a view-entity with two columns (person
 and group) and populated with all EMPLOYMENT relationships (you can adjust
 the condition at the end to grab other relationships). Main reason I've
 needed to do this is to simplify dependent code - without this much of my
 code would need to be duplicated to handle both person - group and group
 - person relationships. (FYI: if you're using mysql, like I am, you'll
 have to set sql_mode=PIPES_AS_CONCAT so that the || operator is treated as
 a concat).

 view-entity entity-name=XXX package-name=org.ofbiz.xxx title=XXX
  !-- SELECT
  (coalesce(FROMPERS.PARTY_ID, ) ||
 coalesce(TOPERS.PARTY_ID, )) as Person,
  (coalesce(FROMGRP.PARTY_ID, ) ||
 coalesce(TOGRP.PARTY_ID,
 )) as PartyGroup
  FROM PARTY_RELATIONSHIP REL
  LEFT OUTER JOIN PERSON FROMPERS ON FROMPERS.PARTY_ID =
 REL.PARTY_ID_FROM
  LEFT OUTER JOIN PARTY_GROUP TOGRP ON TOGRP.PARTY_ID =
 REL.PARTY_ID_TO
  LEFT OUTER JOIN PARTY_GROUP FROMGRP ON FROMGRP.PARTY_ID =
 REL.PARTY_ID_FROM
  LEFT OUTER JOIN PERSON TOPERS ON TOPERS.PARTY_ID =
 REL.PARTY_ID_TO
  WHERE coalesce(FROMPERS.PARTY_ID, TOPERS.PARTY_ID) IS NOT
 NULL
  and coalesce(FROMGRP.PARTY_ID, TOGRP.PARTY_ID) IS NOT
 NULL
  and REL.PARTY_RELATIONSHIP_TYPE_ID IS NOT NULL;
  --

  member-entity entity-alias=REL entity-name=**
 PartyRelationship/
  member-entity entity-alias=FROMPERS entity-name=Person/
  member-entity entity-alias=TOPERS entity-name=Person/
  member-entity entity-alias=FROMGRP entity-name=PartyGroup/
  member-entity entity-alias=TOGRP entity-name=PartyGroup/

  alias name=person
  complex-alias operator=||
  complex-alias-field entity-alias=FROMPERS
 field=partyId default-value=''/
  complex-alias-field entity-alias=TOPERS
 field=partyId
 default-value=''/
  /complex-alias
  /alias
  alias name=group
  complex-alias operator=||
  complex-alias-field entity-alias=FROMGRP
 field=partyId
 default-value=''/
  complex-alias-field entity-alias=TOGRP field=partyId
 default-value=''/
  /complex-alias
  /alias

  view-link entity-alias=REL rel-entity-alias=FROMPERS
 rel-optional=true
  key-map field-name=partyIdFrom rel-field-name=partyId/
  /view-link
  view-link entity-alias=REL rel-entity-alias=TOGRP
 rel-optional=true
  key-map field-name=partyIdTo rel-field-name=partyId/
  /view-link
  view-link entity-alias=REL rel-entity-alias=FROMGRP
 rel-optional=true
  key-map field-name=partyIdFrom rel-field-name=partyId/
  /view-link
  view-link entity-alias=REL rel-entity-alias=TOPERS
 rel-optional=true
  key-map field-name=partyIdTo rel-field-name=partyId/
  /view-link
  entity-condition
  condition-list combine=and
  condition-list combine=or
  condition-expr entity-alias=FROMPERS
 field-name=partyId operator=not-equals/
  condition-expr entity-alias=TOPERS
 field-name=partyId operator=not-equals/
  /condition-list
  condition-list combine=or
  condition-expr entity-alias=FROMGRP
 field-name=partyId operator=not-equals/
  condition-expr entity-alias=TOGRP
 field-name=partyId operator=not-equals/
  /condition-list
  condition-expr entity-alias=REL
 field-name=**partyRelationshipTypeId operator=equals
 value=EMPLOYMENT/
  /condition-list
  /entity-condition
  /view-entity



 On Thu, Feb 21, 2013 at 9:22 PM, James Piechota piech...@gmail.com
 wrote:

  I appreciate your help, Adrian, but I'm gonna have to move on. I haven't
 been able to find the magic code example you've alluded to, and honestly
 can't think of how to get what I need without using COALESCE, UNION, or
 an
 OR condition in a LEFT JOIN - none of which seem to be supported.

 No matter how I spin (even using 3 view-entities as you suggest) I can't
 get a single view-entity holding just a column of Person IDs and a column
 of PartyGroup IDs representing all EMPLOYEE - EMPLOYER and EMPLOYER -
 EMPLOYEE relationships.

 I'll either fall back on my 4 line code hack, or cobble something
 together
 in groovy.