Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: Liferay Guestbook Web Application 7.2, ModelResourcePermissionFactory e
Dear all, following the Guestbook tutorial from 7.1 documentation but in the 7.2 environment I found an issue in the "Using Resources and Permissions" chapter.
In the <somepackage>guestbook.internal.security.permission.resource I created the GuestbookModelResourcePermissionRegistrar class.
But in the activate() method I get an error that cause that I can't deploy the guestbook-service and guestbook-web modules:
@Activate
public void activate(BundleContext bundleContext) {
Dictionary<String, Object> properties = new HashMapDictionary<>();
properties.put("model.class.name", Guestbook.class.getName());
_serviceRegistration = bundleContext.registerService(
ModelResourcePermission.class,
ModelResourcePermissionFactory.create( // ERROR: The type com.liferay.petra.function.UnsafeFunction cannot be resolved. It is indirectly referenced from required .class files
Guestbook.class, Guestbook::getGuestbookId,
_guestbookLocalService::getGuestbook, _portletResourcePermission,
(modelResourcePermission, consumer) -> {
consumer.accept(
new StagedModelPermissionLogic<>(
_stagingPermission, GuestbookPortletKeys.GUESTBOOK,
Guestbook::getGuestbookId));
consumer.accept(
new WorkflowedModelPermissionLogic<>(
_workflowPermission, modelResourcePermission,
_groupLocalService, Guestbook::getGuestbookId));
}),
properties);
}
The same error happens for both Guestbook and Entity entities of the tutorial.
Please anyone is already aware of the above issues?
Thank you in advance,
Ivano C.
In the <somepackage>guestbook.internal.security.permission.resource I created the GuestbookModelResourcePermissionRegistrar class.
But in the activate() method I get an error that cause that I can't deploy the guestbook-service and guestbook-web modules:
@Activate
public void activate(BundleContext bundleContext) {
Dictionary<String, Object> properties = new HashMapDictionary<>();
properties.put("model.class.name", Guestbook.class.getName());
_serviceRegistration = bundleContext.registerService(
ModelResourcePermission.class,
ModelResourcePermissionFactory.create( // ERROR: The type com.liferay.petra.function.UnsafeFunction cannot be resolved. It is indirectly referenced from required .class files
Guestbook.class, Guestbook::getGuestbookId,
_guestbookLocalService::getGuestbook, _portletResourcePermission,
(modelResourcePermission, consumer) -> {
consumer.accept(
new StagedModelPermissionLogic<>(
_stagingPermission, GuestbookPortletKeys.GUESTBOOK,
Guestbook::getGuestbookId));
consumer.accept(
new WorkflowedModelPermissionLogic<>(
_workflowPermission, modelResourcePermission,
_groupLocalService, Guestbook::getGuestbookId));
}),
properties);
}
The same error happens for both Guestbook and Entity entities of the tutorial.
Please anyone is already aware of the above issues?
Thank you in advance,
Ivano C.
SOLVED
In build.grade I added:
compileOnly group: "com.liferay", name: "com.liferay.petra.function"
In build.grade I added:
compileOnly group: "com.liferay", name: "com.liferay.petra.function"
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™