Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

Java Deprecated Inheritance Feature

Avatar

Level 5

Hi there!

I was attempting to recreate/experiment/learn more about the Social Component Framework and getting the following warning from Maven on build:

[WARNING] C:\Projects\my-project\core\src\main\java\com\sample-project\my-project\core\servlets\SetStatusOperation.java [1:1]:  Component com.sample-project.my-project.core.servlets.SetStatusOperation is using the deprecated inheritance feature and inherits from com.adobe.cq.social.scf.core.operations.AbstractSocialOperation. This feature will be removed in future versions.

From the following class[1]:

public class SetStatusOperation extends AbstractSocialOperation implements PostOperation { // ... }

I know it's just a warning, but since I'm just getting started with this now, I'm wondering if there's some new AbstractSocialOperation class we should be using?

For reference: I'm using AEM 6.2 with the latest Communities Feature Pack (FP1)[2]

[1] https://github.com/Adobe-Marketing-Cloud/aem-scf-sample-components-extension/blob/master/bundles/aem...
[2] https://repo.adobe.com/nexus/content/repositories/releases/com/adobe/cq/social/cq-socialcommunities-...

1 Accepted Solution

Avatar

Correct answer by
Level 9

Hi Greg,

An updated TodoMVC example is available on GitHub (still a work in process).

"SCF+SRP implementation of ToDo MVC Demostrates how to develop a SCF+SRP component from scratch"

See the use of ResourceResolverFactory and SocialResourceProvider.

Be aware that the API docs available from docs.adobe.com reflect the 6.2 GA release (Communities 1.9.xxx).  The API docs for Communities feature packs (1.10.xxx) will be available through your dev environment (IDE).

We hope this is helpful.

- JK

View solution in original post

4 Replies

Avatar

Level 5

Another deprecation warning I encountered:

The method create(ResourceResolver, String, Map<String,Object>) from the type ModifyingResourceProvider is deprecated.

This is from Line 108 of the TaskServiceImpl.java[1] example on the aem-scf-sample-components-customize github page[2]. It's using SocialResourceProvider (com.adobe.cq.social.srp.SocialResourceProvider), which I'm guessing extends/implements ModifyingResourceProvider (org.apache.sling.api.resource.ModifyingResourceProvider). Is there a recommended alternative or is Adobe updating their Communities API to address this deprecation?

One more issue I have after updating the dependencies in sample code from the github site above to work with AEM 6.2, looking at the SocialUtils Refactoring documentation[3]... I'm wondering why certain methods were made INTERNAL_USE_ONLY, specifically the ones used in the aforementioned sample project:

  • mayPost();
  • createUniqueNameHint();
  • generateRandomString();

If these have been removed because there's ONE other method that does the job of creating the UGC content, then please let me know!

Thanks!

[1] https://github.com/Adobe-Marketing-Cloud/aem-scf-sample-components-customize/blob/master/scf-tasks-s...
[2] https://github.com/Adobe-Marketing-Cloud/aem-scf-sample-components-customize
[3] https://docs.adobe.com/docs/en/aem/6-2/develop/communities/code-guide/socialutils.html

Avatar

Level 5

Wow, okay. Shortly after posting that, I stumbled across InternalSocialResourceUtilities[1] in the documentation and that appears to have the two of the three INTERNAL_USE_ONLY methods I mentioned in my last post. Still not sure what to do about mayPost(); though I guess I don't have to do that check and can just try to catch the error if it fails.

My question regarding the deprecated ModifyingResourceProvider still stands though.

[1] https://docs.adobe.com/docs/en/aem/6-2/develop/ref/javadoc/com/adobe/cq/social/srp/utilities/interna...

Avatar

Level 5

Sorry, one more missing method that has been deprecated but I can't find a replacement for:

boolean isResourceOwner(Resource resource)

Again, this is marked as INTERNAL_USE_ONLY on the SocialUtils Refactoring documentation[1] but I'm struggling to find an alternative to, or if there is a public method of a different name that will accomplish the same thing as what is provided in the sample customization code[2].

[1] https://docs.adobe.com/docs/en/aem/6-2/develop/communities/code-guide/socialutils.html
[2] https://github.com/Adobe-Marketing-Cloud/aem-scf-sample-components-customize/blob/master/scf-tasks-s...

Avatar

Correct answer by
Level 9

Hi Greg,

An updated TodoMVC example is available on GitHub (still a work in process).

"SCF+SRP implementation of ToDo MVC Demostrates how to develop a SCF+SRP component from scratch"

See the use of ResourceResolverFactory and SocialResourceProvider.

Be aware that the API docs available from docs.adobe.com reflect the 6.2 GA release (Communities 1.9.xxx).  The API docs for Communities feature packs (1.10.xxx) will be available through your dev environment (IDE).

We hope this is helpful.

- JK