Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
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: Junior Member

Posts: 92

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: 8000

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: 8000

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