Tribune

Home » Liferay Portal » English » 3. Development

Vista Combinata Vista Piatta Vista ad Albero
Discussioni [ Precedente | Successivo ]
toggle
Gnaniyar Zubair
Creating Organization Programmatically
18 febbraio 2013 4.23
Risposta

Gnaniyar Zubair

Punteggio: Liferay Master

Messaggi: 598

Data di Iscrizione: 19 dicembre 2007

Messaggi recenti

HI,

I am customizing liferay Registration flow through EXT by extending addUser Method of CreateAccountAction . While registering the user, i am creating the organization using below code:

Organization org = OrganizationLocalServiceUtil.addOrganization(userId],
OrganizationConstants.DEFAULT_PARENT_ORGANIZATION_ID, "some organization name", OrganizationConstants.TYPE_REGULAR_ORGANIZATION, true, 0, 0, ListTypeConstants.ORGANIZATION_STATUS_DEFAULT, "something", true, serviceContext);


But Always i am getting Null pointer exception for expando values as I am using some additional fields for user using expando.

I read some forum to add expando attributes into organization if you use expando values for user. So i inject those expando attributes into organization by setting in serviceContext like this?

serviceContext.setExpandoBridgeAttributes(expandoBridgeAttributes);


1. what is the purpose of injecting expando attributes while creating organization?
2. why I am getting [ExpandoBridgeImpl:507] java.lang.NullPointerException always ?
Gnaniyar Zubair
RE: Creating Organization Programmatically
18 febbraio 2013 6.02
Risposta

Gnaniyar Zubair

Punteggio: Liferay Master

Messaggi: 598

Data di Iscrizione: 19 dicembre 2007

Messaggi recenti

It got resolved . Instead of passing the existing serviceContext object in CreateAccountAction, i just created new one.

Organization org = OrganizationLocalServiceUtil.addOrganization(userId],
OrganizationConstants.DEFAULT_PARENT_ORGANIZATION_ID, "some organization name", OrganizationConstants.TYPE_REGULAR_ORGANIZATION, true, 0, 0, ListTypeConstants.ORGANIZATION_STATUS_DEFAULT, "something", true, new ServiceContext());



I am not sure whether i am going on right direction. But it got resolved . Not able to guess why it is throwing expando Null Pointer exception if i pass existing serviceContext object. GOK ( Google Only Knows) emoticon
Tanaji Londhe
RE: Creating Organization Programmatically
18 febbraio 2013 7.19
Risposta

Tanaji Londhe

Punteggio: Regular Member

Messaggi: 196

Data di Iscrizione: 25 aprile 2012

Messaggi recenti

Hi Gnaniyar,
Go thourgh this post.
http://www.liferay.com/community/forums/-/message_boards/message/17779167
Gnaniyar Zubair
RE: Creating Organization Programmatically
18 febbraio 2013 22.55
Risposta

Gnaniyar Zubair

Punteggio: Liferay Master

Messaggi: 598

Data di Iscrizione: 19 dicembre 2007

Messaggi recenti

Thanks Tanaj. I read your forum which belongs to my query. But it is not helpful.

My question is, why do we get the Expando Null Pointer Exception while we creating the organization even after setting the expando attributues in serviceContext?
Tanaji Londhe
RE: Creating Organization Programmatically
27 febbraio 2013 8.42
Risposta

Tanaji Londhe

Punteggio: Regular Member

Messaggi: 196

Data di Iscrizione: 25 aprile 2012

Messaggi recenti

Hi Gnaniyar,
Did you get the solution for this issue, because same problem here.
If you have any suggestion please let me know about this issue.
Gnaniyar Zubair
RE: Creating Organization Programmatically
4 marzo 2013 22.39
Risposta

Gnaniyar Zubair

Punteggio: Liferay Master

Messaggi: 598

Data di Iscrizione: 19 dicembre 2007

Messaggi recenti

Yes Tanaji. It got resolved after adding new ServiceContext() instead of passing the existing one which is available in CreateAccountAction...