留言板

Missing code in Liferay in Action sourcecode file?

Jaafar Altaie,修改在11 年前。

Missing code in Liferay in Action sourcecode file?

Junior Member 帖子: 69 加入日期: 12-4-26 最近的帖子
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?
thumbnail
sheela mk,修改在11 年前。

RE: Missing code in Liferay in Action sourcecode file?

Regular Member 帖子: 111 加入日期: 12-2-17 最近的帖子
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..
Jaafar Altaie,修改在11 年前。

RE: Missing code in Liferay in Action sourcecode file?

Junior Member 帖子: 69 加入日期: 12-4-26 最近的帖子
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,修改在11 年前。

RE: Missing code in Liferay in Action sourcecode file?

Junior Member 帖子: 69 加入日期: 12-4-26 最近的帖子
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,修改在11 年前。

RE: Missing code in Liferay in Action sourcecode file?

Junior Member 帖子: 69 加入日期: 12-4-26 最近的帖子
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!!
thumbnail
Hitoshi Ozawa,修改在11 年前。

RE: Missing code in Liferay in Action sourcecode file?

Liferay Legend 帖子: 7942 加入日期: 10-3-24 最近的帖子
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,修改在11 年前。

RE: Missing code in Liferay in Action sourcecode file?

Junior Member 帖子: 69 加入日期: 12-4-26 最近的帖子
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!!
thumbnail
Hitoshi Ozawa,修改在11 年前。

RE: Missing code in Liferay in Action sourcecode file?

Liferay Legend 帖子: 7942 加入日期: 10-3-24 最近的帖子
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,修改在11 年前。

RE: Missing code in Liferay in Action sourcecode file?

New Member 帖子: 20 加入日期: 12-11-28 最近的帖子
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)
[javac] @BeanReference(type = UserPersistence.class)
[javac] ^^^^
[javac] 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)
[javac] Object[] values = orderByComparator.getOrderByValues(part);
[javac] ^^^^^^^^^^^^^^^^
[javac] The method getOrderByValues(Part) is undefined for the type OrderByComparator

regards,
Chinna
thumbnail
sheela mk,修改在10 年前。

RE: Missing code in Liferay in Action sourcecode file?

Regular Member 帖子: 111 加入日期: 12-2-17 最近的帖子
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
thumbnail
Richard Sezov,修改在10 年前。

RE: Missing code in Liferay in Action sourcecode file?

Regular Member 帖子: 220 加入日期: 07-2-7 最近的帖子
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
portlets
folder in the Liferay in Action SDK to the
portlets
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
thumbnail
sheela mk,修改在10 年前。

RE: Missing code in Liferay in Action sourcecode file?

Regular Member 帖子: 111 加入日期: 12-2-17 最近的帖子
Hai..Richard..

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


Thanks and Regard,
Sheela
adg teq,修改在10 年前。

RE: Missing code in Liferay in Action sourcecode file?

New Member 帖子: 3 加入日期: 13-7-13 最近的帖子
hi Sheela,

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

thanks in advance
adg teq,修改在10 年前。

RE: Missing code in Liferay in Action sourcecode file?

New Member 帖子: 3 加入日期: 13-7-13 最近的帖子
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,修改在10 年前。

RE: Missing code in Liferay in Action sourcecode file?

New Member 帖子: 3 加入日期: 13-7-13 最近的帖子
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,修改在10 年前。

RE: Missing code in Liferay in Action sourcecode file?

Regular Member 帖子: 154 加入日期: 10-6-7 最近的帖子
Great to know you solved the problem.
thumbnail
Richard Sezov,修改在10 年前。

RE: Missing code in Liferay in Action sourcecode file?

Regular Member 帖子: 220 加入日期: 07-2-7 最近的帖子
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,修改在10 年前。

RE: Missing code in Liferay in Action sourcecode file?

New Member 发布: 1 加入日期: 13-9-29 最近的帖子
Thanks for that - I'm getting an error in slogan-contest-portlet in docroot/html/view.jsp, relating to searchContainer not being found ?
thumbnail
Mirto Silvio Busico,修改在9 年前。

RE: Missing code in Liferay in Action sourcecode file?

Regular Member 帖子: 240 加入日期: 12-1-18 最近的帖子
Sorry to restart the thread; but I'm trying to build the product registration portlet on Liferay 6.2 Ce GA2

I get a lot of build error:

BUILD FAILED
/LH/plugins/sdk62ga2/build-common-plugin.xml:482: The following error occurred while executing this line:
/LH/plugins/sdk62ga2/build-common.xml:1001: The following error occurred while executing this line:
/LH/plugins/sdk62ga2/build-common.xml:251: The following error occurred while executing this line:
/LH/plugins/sdk62ga2/build-common.xml:1278: The following error occurred while executing this line:
/LH/plugins/sdk62ga2/build-common.xml:219: The following error occurred while executing this line:
/LH/plugins/sdk62ga2/build-common.xml:496: The following error occurred while executing this line:
/LH/plugins/sdk62ga2/build-common.xml:620: /LH/plugins/sdk62ga2/portlets/product-registration-portlet/src does not exist.


I got the code from the Manning site of Liferay in action
What can I do?

Thanks