Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Missing code in Liferay in Action sourcecode file? Jaafar Altaie July 1, 2012 2:16 PM
RE: Missing code in Liferay in Action sourcecode file? sheela mk July 1, 2012 11:20 PM
RE: Missing code in Liferay in Action sourcecode file? Jaafar Altaie July 3, 2012 1:46 AM
RE: Missing code in Liferay in Action sourcecode file? Jaafar Altaie July 4, 2012 12:50 AM
RE: Missing code in Liferay in Action sourcecode file? Jaafar Altaie July 6, 2012 4:50 AM
RE: Missing code in Liferay in Action sourcecode file? Hitoshi Ozawa July 8, 2012 6:42 AM
RE: Missing code in Liferay in Action sourcecode file? Jaafar Altaie July 8, 2012 2:11 PM
RE: Missing code in Liferay in Action sourcecode file? Hitoshi Ozawa July 8, 2012 2:35 PM
RE: Missing code in Liferay in Action sourcecode file? Chinnadurai Duraisami December 11, 2012 7:04 AM
RE: Missing code in Liferay in Action sourcecode file? sheela mk July 20, 2013 1:57 AM
RE: Missing code in Liferay in Action sourcecode file? Richard Sezov July 23, 2013 8:59 AM
RE: Missing code in Liferay in Action sourcecode file? sheela mk July 25, 2013 1:06 AM
RE: Missing code in Liferay in Action sourcecode file? adg teq July 31, 2013 3:16 AM
RE: Missing code in Liferay in Action sourcecode file? adg teq August 2, 2013 5:38 PM
RE: Missing code in Liferay in Action sourcecode file? adg teq August 3, 2013 12:06 PM
RE: Missing code in Liferay in Action sourcecode file? David Ilechukwu August 5, 2013 4:31 AM
RE: Missing code in Liferay in Action sourcecode file? Richard Sezov August 5, 2013 3:17 PM
RE: Missing code in Liferay in Action sourcecode file? David Milne September 29, 2013 3:55 AM
Jaafar Altaie
Missing code in Liferay in Action sourcecode file?
July 1, 2012 2:16 PM
Answer

Jaafar Altaie

Rank: Junior Member

Posts: 69

Join Date: April 26, 2012

Recent Posts

I'd like to ask a question about the book LIferay in Action. I'm on chapter 4 of the book.

I' downloaded the latest copy of the sourcecode for the book (http://www.liferay.com/web/richard.sezov/documents/-/document_library/view/1388559/90601?_20_redirect=http%3A%2F%2Fwww.liferay.com%2Fweb%2Frichard.sezov%2Fdocuments%2F-%2Fdocument_library%2Fview%2F1388559%3F_20_redirect%3Dhttp%253A%252F%252Fwww.liferay.com%252Fweb%252Frichard.sezov%252Fdocuments%253Fp_p_id%253D20%2526p_p_lifecycle%253D0%2526p_p_state%253Dnormal%2526p_p_mode%253Dview%2526p_p_col_id%253Dcolumn-2%2526p_p_col_count%253D2), but I notice there's classes missing. When I run Service Builder not all the classes and packages are created that are in the book. When I look at the source code and try to copy the classes into the Eclipse project, I still see a lot of skeleton code which create a number of build errors. Am I missing something or is the sourcecode not yet complete?

Is it possible to obtain sourcecode that allows me to build the example in Chapter 4 end to end without adding or looking for additional classes or packages?

I would expect all the source code files to be available from the download to allow me to build an end to application using the examples in the book, so should I be looking elsewhere for missing files and complete classes?
Attachments: build-common-web.xml (0.2k)
sheela mk
RE: Missing code in Liferay in Action sourcecode file?
July 1, 2012 11:20 PM
Answer

sheela mk

Rank: Regular Member

Posts: 112

Join Date: February 16, 2012

Recent Posts

Hai..Jaafar..You can check link..I 've attached all source code examples of Liferay in Action...

All examples are working fine..I tried it..
Attachments: liferayinactionportletexamples.zip (1,267.0k)
Jaafar Altaie
RE: Missing code in Liferay in Action sourcecode file?
July 3, 2012 1:46 AM
Answer

Jaafar Altaie

Rank: Junior Member

Posts: 69

Join Date: April 26, 2012

Recent Posts

Sheela,

Thanks a million. This looks more complete than the copy which I downloaded. I'll give it a try and let you know. Thanks again!!
Jaafar Altaie
RE: Missing code in Liferay in Action sourcecode file?
July 4, 2012 12:50 AM
Answer

Jaafar Altaie

Rank: Junior Member

Posts: 69

Join Date: April 26, 2012

Recent Posts

Sheela,

The code you provided is what I'm looking for. I imported this into Eclipse and it seems to be much more complete than the code which I previously downloaded. THANK YOU FOR YOUR HELP!
Jaafar Altaie
RE: Missing code in Liferay in Action sourcecode file?
July 6, 2012 4:50 AM
Answer

Jaafar Altaie

Rank: Junior Member

Posts: 69

Join Date: April 26, 2012

Recent Posts

Hi Sheela,

You mentioned that you tried the downloaded code it works. Were you able to create the entire inkwell example? On the whole the code which you gave me is much better than the version i previously downloaded, but I am still getting one particular error in ProductAdmintPortlet.java. The error is:

The method deleteProduct(long) in the type PRProductLocalServiceUtil is not applicable for the arguments (long, long)

It happens in the following line of the class:

public void deleteProduct(ActionRequest request, ActionResponse response)
throws Exception {
long productKey = ParamUtil.getLong(request, "resourcePrimKey");
ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(
WebKeys.THEME_DISPLAY);

if (Validator.isNotNull(productKey)) {
PRProductLocalServiceUtil.deleteProduct(productKey, themeDisplay.getCompanyId());

SessionMessages.add(request, "productDeleted");

} else {
SessionErrors.add(request, "error-deleting");

}

}



The part of PRProductLocalServiceUtil.java which defines the above method is:

/**
* Removes the specified product from the database.
*
* @param productId
* @throws com.inkwell.internet.portlets.prodreg.sb.NoSuchProductException
* @throws com.liferay.portal.kernel.exception.SystemException
* @throws com.liferay.portal.kernel.exception.PortalException
*/
public static void deleteProduct(long productId)
throws com.inkwell.internet.productregistration.NoSuchProductException,
com.liferay.portal.kernel.exception.PortalException,
com.liferay.portal.kernel.exception.SystemException {
getService().deleteProduct(productId);
}

/**
* Removes the specified product from the database.
*
* @param product
* @throws com.liferay.portal.kernel.exception.PortalException
* @throws com.liferay.portal.kernel.exception.SystemException
*/
public static void deleteProduct(
com.inkwell.internet.productregistration.model.PRProduct product)
throws com.liferay.portal.kernel.exception.PortalException,
com.liferay.portal.kernel.exception.SystemException {
getService().deleteProduct(product);
}


So i can see that ProductAdminPOrtlet is looking for two arguments, but only one exists in PRProductLocalServiceUtil.java (the pparent class). So my questions are:

1) Would I have to to add the second argument in the parent class?
2) What is the best way to add/ modify these two classes to fix this build error

I have also attached both classes. Many thanks!!
Attachments: PRProductLocalServiceUtil.java (12.5k), ProductAdminPortlet.class (7.1k), ProductAdminPortlet.java (7.7k)
Hitoshi Ozawa
RE: Missing code in Liferay in Action sourcecode file?
July 8, 2012 6:42 AM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7990

Join Date: March 23, 2010

Recent Posts

This is a little bit off the topic but there is a "Liferay in Action" errata page. I think you can contact the author there. :-)

http://www.manning-sandbox.com/forum.jspa?forumID=642
Jaafar Altaie
RE: Missing code in Liferay in Action sourcecode file?
July 8, 2012 2:11 PM
Answer

Jaafar Altaie

Rank: Junior Member

Posts: 69

Join Date: April 26, 2012

Recent Posts

Hitoshi,

Thanks a bunch! I tried that forum. The author doesn't always reply and the format of the page makes it really hard to paste code. Altogether not very helpful. Sorry!!
Hitoshi Ozawa
RE: Missing code in Liferay in Action sourcecode file?
July 8, 2012 2:35 PM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7990

Join Date: March 23, 2010

Recent Posts

The author doesn't always reply and the format of the page makes it really hard to paste code. Altogether not very helpful.


Well, seems liferay.com haven't improved too much yet.
Chinnadurai Duraisami
RE: Missing code in Liferay in Action sourcecode file?
December 11, 2012 7:04 AM
Answer

Chinnadurai Duraisami

Rank: New Member

Posts: 20

Join Date: November 28, 2012

Recent Posts

Hi Sheela,
I downloaded your code for testing the product registration. Unfortunately, i am getting lot of errors. I am using liferay-plugins-sdk-6.1.1 and liferay-portal-6.1.1-ce-ga2.
Could you please help me. These all are few of them.

177. ERROR in C:\Chinna\Tools\liferay-plugins-sdk-6.1.1\portlets\product-registration-portlet\docroot\WEB-INF\src\com\inkwell\internet\productregistration\service\persistence\PRUserPersistenceImpl.java (at line 2815)
@BeanReference(type = UserPersistence.class)
^^^^
The attribute type is undefined for the annotation type BeanReference

25. ERROR in C:\Chinna\Tools\liferay-plugins-sdk-6.1.1\portlets\parts-inventory-portlet\docroot\WEB-INF\src\com\liferay\training\parts\service\persistence\PartPersistenceImpl.java (at line 1170)
Object[] values = orderByComparator.getOrderByValues(part);
^^^^^^^^^^^^^^^^
The method getOrderByValues(Part) is undefined for the type OrderByComparator

regards,
Chinna
sheela mk
RE: Missing code in Liferay in Action sourcecode file?
July 20, 2013 1:57 AM
Answer

sheela mk

Rank: Regular Member

Posts: 112

Join Date: February 16, 2012

Recent Posts

Hai..All..

Liferay in Action..Source code..product registration portlet..example..

I wants to execute the same in Liferay 6.1.1 ga2 version..

Due to version problem..its not executing it seems,,

Pls let..me know..How to upgrade this application..into Liferay 6.1.1 ga2 version..n execute it successfully..


thanks,,
Sheela
Richard Sezov
RE: Missing code in Liferay in Action sourcecode file?
July 23, 2013 8:59 AM
Answer

Richard Sezov

LIFERAY STAFF

Rank: Regular Member

Posts: 196

Join Date: February 7, 2007

Recent Posts

Hi!
Liferay in Action was completed a few months before Liferay 6.1 came out, so the code was written for 6.0. It should only take a few minor steps to get it running in 6.1, though. Here's what I would do:

1. Extract the Liferay in Action plugins sdk and the latest 6.1 Plugins SDK into two separate folders.
2. Copy the portlets from the
1portlets
folder in the Liferay in Action SDK to the
1portlets
folder in the 6.1 SDK.
3. Set up the 6.1 SDK with Liferay IDE and a Liferay 6.1 runtime.
4. Import the portlets using Liferay IDE.
5. Re-run Service Builder. This should take care of most of the errors.
6. There were minor API updates between 6.0 and 6.1, most notably the asset API now requires a Map locale instead of a String (because it was internationalized).
7. Fix all these, and the portlets should run.

I would love to spend some time doing this myself, but I'm very busy right now getting the documentation together for 6.2. For that reason, I don't want to promise anything necessarily, for fear of disappointing people. But I will try to get to it and make a 6.1 version available.

Thanks for your interest in the book, and I hope this helps!

--Rich
sheela mk
RE: Missing code in Liferay in Action sourcecode file?
July 25, 2013 1:06 AM
Answer

sheela mk

Rank: Regular Member

Posts: 112

Join Date: February 16, 2012

Recent Posts

Hai..Richard..

Thanks for the reply..Now its running fine..with seperate..Liferay sdk 6.1.1..


Thanks and Regard,
Sheela
adg teq
RE: Missing code in Liferay in Action sourcecode file?
July 31, 2013 3:16 AM
Answer

adg teq

Rank: New Member

Posts: 3

Join Date: July 13, 2013

Recent Posts

hi Sheela,

would you mind sharing your results (upgraded source code) with us?

thanks in advance
adg teq
RE: Missing code in Liferay in Action sourcecode file?
August 2, 2013 5:38 PM
Answer

adg teq

Rank: New Member

Posts: 3

Join Date: July 13, 2013

Recent Posts

hi,
has anyone succeeded in upgrading the book examples for liferay 6.1.1 and can share them with us?
I'm new to liferay and I'm trying to learn it from Rich's nice book. should I move back to the 6.0 version?
adg teq
RE: Missing code in Liferay in Action sourcecode file?
August 3, 2013 12:06 PM
Answer

adg teq

Rank: New Member

Posts: 3

Join Date: July 13, 2013

Recent Posts

Problem Solved!
I downloaded liferay 6.0 and the examples worked fine. gotta accept my post as answer. it's good to come to a deserted forum like this and talk to yourself until the answer is inspired to yourself emoticon
but aside from kidding, i can't understand why a point change in version should alter so many package names. it's so frightening for a noob.
David Ilechukwu
RE: Missing code in Liferay in Action sourcecode file?
August 5, 2013 4:31 AM
Answer

David Ilechukwu

Rank: Regular Member

Posts: 114

Join Date: June 7, 2010

Recent Posts

Great to know you solved the problem.
Richard Sezov
RE: Missing code in Liferay in Action sourcecode file?
August 5, 2013 3:17 PM
Answer

Richard Sezov

LIFERAY STAFF

Rank: Regular Member

Posts: 196

Join Date: February 7, 2007

Recent Posts

I spent some time today modifying the two portlets from Liferay in Action to work on Liferay 6.1. Beyond rebuilding the services, there wasn't much to change.

I've uploaded a 6.1 SDK with the portlets in it here. I hope this helps everybody with running the examples in the book, and thanks for reading!

--Rich
David Milne
RE: Missing code in Liferay in Action sourcecode file?
September 29, 2013 3:55 AM
Answer

David Milne

Rank: New Member

Posts: 1

Join Date: September 29, 2013

Recent Posts

Thanks for that - I'm getting an error in slogan-contest-portlet in docroot/html/view.jsp, relating to searchContainer not being found ?