Foren
Service Builder
Beppo Ivel, geändert vor 9 Jahren.
Service Builder
Regular Member Beiträge: 112 Beitrittsdatum: 09.04.14 Neueste Beiträge
Hi.
I imported the example code of this tutorial. What is the reason for that service builder builds the method EventServiceUtil.addEvent? If I try to create a similar portlet e.g. without the Location classes, service builder does not create the EventServiceUtil.addEvent method.
I imported the example code of this tutorial. What is the reason for that service builder builds the method EventServiceUtil.addEvent? If I try to create a similar portlet e.g. without the Location classes, service builder does not create the EventServiceUtil.addEvent method.
Manali Lalaji, geändert vor 9 Jahren.
RE: Service Builder
Expert Beiträge: 362 Beitrittsdatum: 09.03.10 Neueste Beiträge
Hi Beppo,
In the portlet that you have created can you check whether EventServiceImpl class has this method addEvent? If yes, then you need to do ant build-service.
For any custom methods added here, Service Builder adds corresponding methods to the EventServiceUtil class next time you run it.
HTH!
In the portlet that you have created can you check whether EventServiceImpl class has this method addEvent? If yes, then you need to do ant build-service.
For any custom methods added here, Service Builder adds corresponding methods to the EventServiceUtil class next time you run it.
HTH!
Beppo Ivel, geändert vor 9 Jahren.
RE: Service Builder
Regular Member Beiträge: 112 Beitrittsdatum: 09.04.14 Neueste Beiträge
Hi Manali,
I implement a addEvent method to the class EventLocalServiceImpl.java, like the tutorial suggest. Is it possible to send you the project?
I implement a addEvent method to the class EventLocalServiceImpl.java, like the tutorial suggest. Is it possible to send you the project?
Manali Lalaji, geändert vor 9 Jahren.
RE: Service Builder
Expert Beiträge: 362 Beitrittsdatum: 09.03.10 Neueste Beiträge
Hi Beppo,
Sure you can attach a zip file of your portlet or paste code of files over here.
Sure you can attach a zip file of your portlet or paste code of files over here.
Beppo Ivel, geändert vor 9 Jahren.
RE: Service Builder
Regular Member Beiträge: 112 Beitrittsdatum: 09.04.14 Neueste Beiträge
The file size is to large for uploading. If I would post the code e.g. the add method, then you will just see the code similar to the tutorial:
Should I add this method to EventServiceImpl?
public class EventLocalServiceImpl extends EventLocalServiceBaseImpl {
public Event addEvent(long userId, long groupId, String name,
String description, String dataSet, int month, int day, int year, int hour,
int minute, ServiceContext serviceContext)
throws PortalException, SystemException {
User user = userPersistence.findByPrimaryKey(userId);
Date now = new Date();
long eventId = counterLocalService.increment(Event.class.getName());
Event event = eventPersistence.create(eventId);
event.setName(name);
event.setDescription(description);
Calendar dateCal = CalendarFactoryUtil.getCalendar(user.getTimeZone());
dateCal.set(year, month, day, hour, minute);
Date date = dateCal.getTime();
event.setDate(date);
event.setGroupId(groupId);
event.setCompanyId(user.getCompanyId());
event.setUserId(user.getUserId());
event.setCreateDate(serviceContext.getCreateDate(now));
event.setModifiedDate(serviceContext.getModifiedDate(now));
super.addEvent(event);
// Resources
if (serviceContext.isAddGroupPermissions()
|| serviceContext.isAddGuestPermissions()) {
addEventResources(event, serviceContext.isAddGroupPermissions(),
serviceContext.isAddGuestPermissions());
} else {
addEventResources(event, serviceContext.getGroupPermissions(),
serviceContext.getGuestPermissions());
}
return event;
}
public void addEventResources(Event event, boolean addGroupPermissions,
boolean addGuestPermissions) throws PortalException,
SystemException {
resourceLocalService.addResources(event.getCompanyId(),
event.getGroupId(), event.getUserId(), Event.class.getName(),
event.getEventId(), false, addGroupPermissions,
addGuestPermissions);
}
public void addEventResources(Event event, String[] groupPermissions,
String[] guestPermissions) throws PortalException, SystemException {
resourceLocalService.addModelResources(event.getCompanyId(),
event.getGroupId(), event.getUserId(), Event.class.getName(),
event.getEventId(), groupPermissions, guestPermissions);
}
public void addEventResources(long eventId, boolean addGroupPermissions,
boolean addGuestPermissions) throws PortalException,
SystemException {
Event event = eventPersistence.findByPrimaryKey(eventId);
addEventResources(event, addGroupPermissions, addGuestPermissions);
}
public void addEventResources(long eventId, String[] groupPermissions,
String[] guestPermissions) throws PortalException, SystemException {
Event event = eventPersistence.findByPrimaryKey(eventId);
addEventResources(event, groupPermissions, guestPermissions);
}
}
Should I add this method to EventServiceImpl?
Manali Lalaji, geändert vor 9 Jahren.
RE: Service Builder
Expert Beiträge: 362 Beitrittsdatum: 09.03.10 Neueste Beiträge
Hi Beppo,
Few points to be known:
1. The code you have pasted above is of EventLocalServiceImpl - It is LocalService Implementation
So after ant build-service, service builder shall add these methods in EventLocalServiceUtil
2. EventServiceImpl is different class - It is Remote Service Implementation.
If you are executing tutorial example, take code from link
After following same step - ant build-service, corresponding methods will be available in EventServiceUtil.
Refer page: link
Even after doing above steps, you are facing issue, check your error logs.
HTH!
Few points to be known:
1. The code you have pasted above is of EventLocalServiceImpl - It is LocalService Implementation
So after ant build-service, service builder shall add these methods in EventLocalServiceUtil
2. EventServiceImpl is different class - It is Remote Service Implementation.
If you are executing tutorial example, take code from link
After following same step - ant build-service, corresponding methods will be available in EventServiceUtil.
Refer page: link
Even after doing above steps, you are facing issue, check your error logs.
HTH!
Beppo Ivel, geändert vor 9 Jahren.
RE: Service Builder
Regular Member Beiträge: 112 Beitrittsdatum: 09.04.14 Neueste Beiträge
I executed the sample code, if I try to add a Event and click save there comes a massage "Portlet is temporarily unavailable.". I like to try these examples. I imported sample-service-builder-portlet but it throws the errors:
[javac] 1. ERROR in C:\repository\liferay-plugins-master\portlets\sample-service-builder-portlet\docroot\WEB-INF\src\com\liferay\sampleservicebuilder\model\impl\FooModelImpl.java (at line 626)
[javac] public boolean isEntityCacheEnabled() {
[javac] ^^^^^^^^^^^^^^^^^^^^^^
[javac] The method isEntityCacheEnabled() of type FooModelImpl must override or implement a supertype method
[javac] ----------
[javac] 2. ERROR in C:\repository\liferay-plugins-master\portlets\sample-service-builder-portlet\docroot\WEB-INF\src\com\liferay\sampleservicebuilder\model\impl\FooModelImpl.java (at line 631)
[javac] public boolean isFinderCacheEnabled() {
[javac] ^^^^^^^^^^^^^^^^^^^^^^
[javac] The method isFinderCacheEnabled() of type FooModelImpl must override or implement a supertype method
[javac] ----------
[javac] ----------
[javac] 3. ERROR in C:\repository\liferay-plugins-master\portlets\sample-service-builder-portlet\docroot\WEB-INF\src\com\liferay\sampleservicebuilder\service\persistence\FooPersistenceImpl.java (at line 1981)
[javac] EntityCacheUtil.clearCache(FooImpl.class);
[javac] ^^^^^^^^^^
[javac] The method clearCache(String) in the type EntityCacheUtil is not applicable for the arguments (Class<fooimpl>)
[javac] ----------
[javac] 4. ERROR in C:\repository\liferay-plugins-master\portlets\sample-service-builder-portlet\docroot\WEB-INF\src\com\liferay\sampleservicebuilder\service\persistence\FooPersistenceImpl.java (at line 2259)
[javac] EntityCacheUtil.putResult(FooModelImpl.ENTITY_CACHE_ENABLED,
[javac] ^^^^^^^^^
[javac] The method putResult(boolean, Class<!--?-->, Serializable, Serializable) in the type EntityCacheUtil is not applicable for the arguments (boolean, Class<fooimpl>, long, Foo, boolean)
[javac] ----------
[javac] 4 problems (4 errors)
BUILD FAILED
C:\repository\liferay-plugins-master\build-common.xml:2553: The following error occurred while executing this line:
: The following error occurred while executing this line:
C:\repository\liferay-plugins-master\build-common.xml:1078: The following error occurred while executing this line:
: The following error occurred while executing this line:
C:\repository\liferay-plugins-master\build-common.xml:2345: The following error occurred while executing this line:
: The following error occurred while executing this line:
C:\repository\liferay-plugins-master\build-common.xml:431: The following error occurred while executing this line:
C:\repository\liferay-plugins-master\build-common.xml:761: The following error occurred while executing this line:
C:\repository\liferay-plugins-master\build-common.xml:648: Compile failed; see the compiler error output for details.
</fooimpl></fooimpl>
Meera Prince, geändert vor 9 Jahren.
RE: Service Builder
Liferay Legend Beiträge: 1111 Beitrittsdatum: 08.02.11 Neueste Beiträge
HI
Have a look into following links it more about SB tool..
http://www.liferaysavvy.com/2014/05/liferay-mvc-portlet-database.html
http://www.liferaysavvy.com/2014/06/liferay-service-builder-custom-service.html
All sample portlets here
https://sourceforge.net/projects/meeralferay/files/
Regards,
Meera Prince
http://www.liferaysavvy.com
Have a look into following links it more about SB tool..
http://www.liferaysavvy.com/2014/05/liferay-mvc-portlet-database.html
http://www.liferaysavvy.com/2014/06/liferay-service-builder-custom-service.html
All sample portlets here
https://sourceforge.net/projects/meeralferay/files/
Regards,
Meera Prince
http://www.liferaysavvy.com
Manali Lalaji, geändert vor 9 Jahren.
RE: Service Builder
Expert Beiträge: 362 Beitrittsdatum: 09.03.10 Neueste Beiträge
Hi Beppo,
The problem is Java version related for ant. Go to build.properties file of your liferay-plugins sdk and check below properties:
ant.build.javac.source=1.5
ant.build.javac.target=1.5
It should be:
ant.build.javac.source=1.6
ant.build.javac.target=1.6
If you are using Java 1.7 change it to 1.7
HTH!
The problem is Java version related for ant. Go to build.properties file of your liferay-plugins sdk and check below properties:
ant.build.javac.source=1.5
ant.build.javac.target=1.5
It should be:
ant.build.javac.source=1.6
ant.build.javac.target=1.6
If you are using Java 1.7 change it to 1.7
HTH!
Beppo Ivel, geändert vor 9 Jahren.
RE: Service Builder
Regular Member Beiträge: 112 Beitrittsdatum: 09.04.14 Neueste Beiträge
Hi Manali.
Iam using 1.7 but in the build properties of the sdk, which I use for some hello world portlets the value of the properties is 1.6. The same in the sdk which comes with these example plugin portlets.
Iam using 1.7 but in the build properties of the sdk, which I use for some hello world portlets the value of the properties is 1.6. The same in the sdk which comes with these example plugin portlets.
Manali Lalaji, geändert vor 9 Jahren.
RE: Service Builder
Expert Beiträge: 362 Beitrittsdatum: 09.03.10 Neueste Beiträge
Yes so change that value to 1.7 of your build.properties and execute your code again. It should work!
Beppo Ivel, geändert vor 9 Jahren.
RE: Service Builder
Regular Member Beiträge: 112 Beitrittsdatum: 09.04.14 Neueste Beiträge
@Meera, does one of your sample portlets deals with a form for file upload?
Meera Prince, geändert vor 9 Jahren.
RE: Service Builder
Liferay Legend Beiträge: 1111 Beitrittsdatum: 08.02.11 Neueste Beiträge
Hi
have a look into following links
http://www.liferaysavvy.com/2013/12/using-blob-data-type-in-liferay-service.html
http://www.liferaysavvy.com/2014/01/store-and-retrieve-images-using-blob.html
All liferay collection
https://sourceforge.net/projects/meeralferay/files/
Regards,
Meera Prince
have a look into following links
http://www.liferaysavvy.com/2013/12/using-blob-data-type-in-liferay-service.html
http://www.liferaysavvy.com/2014/01/store-and-retrieve-images-using-blob.html
All liferay collection
https://sourceforge.net/projects/meeralferay/files/
Regards,
Meera Prince
Beppo Ivel, geändert vor 9 Jahren.
RE: Service Builder
Regular Member Beiträge: 112 Beitrittsdatum: 09.04.14 Neueste Beiträge
Many thx, there are also example portlets they working with the data definition of a dynamic data list?
Jinendra Jain, geändert vor 7 Jahren.
RE: Service Builder
New Member Beiträge: 13 Beitrittsdatum: 04.12.15 Neueste Beiträge
Hi Meera Prince ,
Today i was trying your sample portlet which you have provided in the below link ,
http://www.liferaysavvy.com/2014/06/liferay-service-builder-custom-service.html
But when i try again to build service.xml , i get this error (file-attached)
Can you please let me know what can be the issue ?
Today i was trying your sample portlet which you have provided in the below link ,
http://www.liferaysavvy.com/2014/06/liferay-service-builder-custom-service.html
But when i try again to build service.xml , i get this error (file-attached)
Can you please let me know what can be the issue ?
Anhänge: