Backendless Support
 
Solved

SocialType class not found in generated Business Logic code in Java

Hello,

I've added new Event Handler to my Business Logic - Before SocialLogin.

Generated code is:

  1. import com.backendless.BackendlessCollection;
  2. import com.backendless.commons.util.SocialType;
  3. import com.backendless.persistence.BackendlessDataQuery;
  4. import com.backendless.property.UserProperty;
  5. import com.backendless.servercode.ExecutionResult;
  6. import com.backendless.servercode.RunnerContext;
  7. import com.backendless.servercode.annotation.Async;
  8. import java.util.HashMap;
  9. import java.util.Map;
  10. /**
  11. * GenericUserEventHandler handles the User Service events.
  12. * The event handlers are the individual methods implemented in the class.
  13. * The "before" and "after" prefix determines if the handler is executed before
  14. * or after the default handling logic provided by Backendless.
  15. * The part after the prefix identifies the actual event.
  16. * For example, the "beforeLogin" method is the "Login" event handler and will
  17. * be called before Backendless applies the default login logic. The event
  18. * handling pipeline looks like this:
  19. * Client Request ---> Before Handler ---> Default Logic ---> After Handler --->
  20. * Return Response
  21. */
  22. public class GenericUserEventHandler extends com.backendless.servercode.extension.UserExtender
  23. {
  24. @Async
  25. @Override
  26. public void beforeSocialLogin( RunnerContext context, Map<String, String> userProperties, SocialType socialType ) throws Exception
  27. {
  28. // add your code here
  29. }
  30. }

However looks like backendless.jar doesn't contain com.backendless.commons package so SocialType class can't be imported, so I downloaded commons.jar from http://maven.backendless.com/repository/backendless_public/com/backendless/commons/

It hasn't helped because in the commons package SocialType class can't be found. Also there is no beforeSocialLogin method in the com.backendless.servercode.extension.UserExtender class so it can't be overriden.

How to fix the generated code?

I've tried with commons-3.0.22.jar as well as with commons.4.0.0.jar + backendless-4.0-snapshot.jar

Best,

Matt

Leave a Comment

Comments (2)

photo
1

I have just generated beforeSocialLogin event handler in the Developers Console and downloaded the project. The backendless.jar included into the zip contains SocialType class.

photo
1

Looks like replacing those *.jar files was not enough. I've deleted all IntelliJ related files and reimported the project and this fixed the problem.

Thanks.