Fórum

Shopping portlet hook with service builder

thumbnail
chandru palaniyappan, modificado 13 Anos atrás.

Shopping portlet hook with service builder

Junior Member Postagens: 85 Data de Entrada: 29/07/10 Postagens Recentes
Hi all,

I want to hook shopping portlet to add category field: so that the products which are belonging to the categories will have unique fields to be get filled up;
And we can bring up those values and compare the products...emoticon

I want to add two tables-1.ShoppingCategoryField
2. ShoppingCategoryFieldValues for shopping portlet.

1. ShoppingCategoryField

The columns of this table are
  • categoryfieldId (primary key)
  • categoryId (from shoppingcategory table)
  • categoryfieldname(adding category fields)


2. ShoppingCategoryFieldValues

The columns of this table are
  • categoryfieldId (from ShoppingCategoryField)
  • itemId (from shoppingitem)
  • values (values for category fieldnames)


I planned to use service builder to create the tables and the services.
I'm having a doubt on how to make relationship with shoppingitem and shoppingcategory entities for itemId and categoryId with these two tables.

so i have created service.xml like this.

<!--?xml version="1.0" encoding="UTF-8"?-->

<service-builder package-path="com.liferay.portlet.shopping">
	<author>chandru.p</author>
	<namespace>Shopping</namespace>

	<entity name="ShoppingCategoryField" local-service="true" remote-service="true">
			<!-- PK fields -->
			
				<column name="categoryFieldId" type="long" primary="true" />

			<!-- Audit fields -->
			
				<column name="fieldName" type="String" />			

			<!-- Relationships -->

				<column name="categoryId" type="long" entity="ShoppingCategory" mapping-key="categoryId" />

			<!-- Order -->

				<order by="asc">
					<order-column name="categoryFieldId" />
				</order>
				
	</entity>
	
	<entity name="ShoppingCategoryFieldValues" local-service="true" remote-service="false">
     <!--	Primary Key Field	-->
     <column name="categoryFieldValuesId" type="long" primary="true" />
     <!--	Other Field     -->
     <column name="catFieldValues" type="String" />
     <!--	RelationShips     -->
     <column name="categoryFieldId" type="long" entity="ShoppingCategoryField" mapping-key="categoryFieldId" />
     <column name="itemId" type="long" entity="ShoppingItem" mapping-key="itemId" />
     </entity>	
			
	</service-builder>




When i do ant-deploy because of non existence of the shoppigitem and shoppingcategory entities i'm having these errors. - i think;


compile-java:
       [javac] Compiling 35 source files to C:\projectss\liferay\Pluginsdk6.0.5\hooks\Shopping-hook\docroot\WEB-INF\service-classes
       [javac] C:\projectss\liferay\Pluginsdk6.0.5\hooks\Shopping-hook\docroot\WEB-INF\service\com\liferay\portlet\shopping\model\ShoppingCategoryFieldClp.java:85: clone() has protected access in java.lang.Object
       [javac] 		clone.setName((ShoppingCategory)getName().clone());
       [javac] 		                                         ^
       [javac] C:\projectss\liferay\Pluginsdk6.0.5\hooks\Shopping-hook\docroot\WEB-INF\service\com\liferay\portlet\shopping\model\ShoppingCategoryFieldClp.java:85: setName(java.lang.String) in com.liferay.portlet.shopping.model.ShoppingCategoryFieldClp cannot be applied to (com.liferay.portlet.shopping.model.ShoppingCategory)
       [javac] 		clone.setName((ShoppingCategory)getName().clone());
       [javac] 		     ^
       [javac] C:\projectss\liferay\Pluginsdk6.0.5\hooks\Shopping-hook\docroot\WEB-INF\service\com\liferay\portlet\shopping\model\ShoppingCategoryFieldValuesClp.java:94: long cannot be dereferenced
       [javac] 		clone.setItemId((ShoppingItem)getItemId().clone());
       [javac] 		                                         ^
       [javac] C:\projectss\liferay\Pluginsdk6.0.5\hooks\Shopping-hook\docroot\WEB-INF\service\com\liferay\portlet\shopping\model\ShoppingCategoryFieldValuesClp.java:94: setItemId(long) in com.liferay.portlet.shopping.model.ShoppingCategoryFieldValuesClp cannot be applied to (com.liferay.portlet.shopping.model.ShoppingItem)
       [javac] 		clone.setItemId((ShoppingItem)getItemId().clone());
       [javac] 		     ^
       [javac] C:\projectss\liferay\Pluginsdk6.0.5\hooks\Shopping-hook\docroot\WEB-INF\service\com\liferay\portlet\shopping\model\ShoppingCategoryFieldValuesClp.java:96: long cannot be dereferenced
       [javac] 															.clone());
       [javac] 															^
       [javac] C:\projectss\liferay\Pluginsdk6.0.5\hooks\Shopping-hook\docroot\WEB-INF\service\com\liferay\portlet\shopping\model\ShoppingCategoryFieldValuesClp.java:95: setCategoryFieldId(long) in com.liferay.portlet.shopping.model.ShoppingCategoryFieldValuesClp cannot be applied to (com.liferay.portlet.shopping.model.ShoppingCategoryField)
       [javac] 		clone.setCategoryFieldId((ShoppingCategoryField)getCategoryFieldId()
       [javac] 		     ^
       [javac] Note: Some input files use unchecked or unsafe operations.
       [javac] Note: Recompile with -Xlint:unchecked for details.
       [javac] 6 errors

BUILD FAILED
C:\projectss\liferay\Pluginsdk6.0.5\build-common-plugin.xml:216: The following error occurred while executing this line:
C:\projectss\liferay\Pluginsdk6.0.5\build-common.xml:90: Compile failed; see the compiler error output for details.


Feel like in the service.xml i made some mistake;
Can anyone please help me to solve this problem...emoticon



Thanks in advance,

Chandru P
thumbnail
chandru palaniyappan, modificado 13 Anos atrás.

RE: Shopping portlet hook with service builder

Junior Member Postagens: 85 Data de Entrada: 29/07/10 Postagens Recentes
Hi all,

What is this...?
oh come on guys...!
Tell me that my approach is wrong or right...,
This is the way forums work....?

emoticon
thumbnail
chandru palaniyappan, modificado 13 Anos atrás.

RE: Shopping portlet hook with service builder

Junior Member Postagens: 85 Data de Entrada: 29/07/10 Postagens Recentes
I dont know whether no one know the answer or not interested to respond
thumbnail
James Stuart Milne, modificado 13 Anos atrás.

RE: Shopping portlet hook with service builder

New Member Postagens: 11 Data de Entrada: 23/02/10 Postagens Recentes
if i were to guess i would say that the compilation error is because you forgot to put the full class path of the entity entity="com.liferay.portlet.shopping.model.ShoppingItem" the same applys to category

Remember than when mapping to an exterenal entity you must put the whole route.

good luck
thumbnail
chandru palaniyappan, modificado 13 Anos atrás.

RE: Shopping portlet hook with service builder

Junior Member Postagens: 85 Data de Entrada: 29/07/10 Postagens Recentes
Hi James Stuart Milne ,

Thanks for your reply...


Chandru P