check author or publish instance from java | Community
Skip to main content
Level 4
September 21, 2020
Solved

check author or publish instance from java

  • September 21, 2020
  • 2 replies
  • 5562 views

Hi,

 

I am currently using AEM 6.5

My requirement is to check whether instance is author or publish instance.

As I have to disable one functionality on front end html.

i dont want to know from WCM MODE.

 

can anyone help me with appropriate solution.

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Nupur_Jain

Hi @kiranc13433869 

 

You can use SlingSettingService to check author or publish mode. Check this sample java code if it helps:

import com.day.cq.commons.Externalizer; // If using in sling model @Inject SlingSettingsService slingSettingsService; private boolean isAuthorRunMode() { Set<String> runModes = slingSettingsService.getRunModes(); return runModes.contains(Externalizer.AUTHOR); }

 

Hope it helps!

Thanks!

Nupur

2 replies

Nupur_Jain
Adobe Employee
Nupur_JainAdobe EmployeeAccepted solution
Adobe Employee
September 21, 2020

Hi @kiranc13433869 

 

You can use SlingSettingService to check author or publish mode. Check this sample java code if it helps:

import com.day.cq.commons.Externalizer; // If using in sling model @Inject SlingSettingsService slingSettingsService; private boolean isAuthorRunMode() { Set<String> runModes = slingSettingsService.getRunModes(); return runModes.contains(Externalizer.AUTHOR); }

 

Hope it helps!

Thanks!

Nupur

Level 4
September 22, 2020
vanegi
Adobe Employee
Adobe Employee
September 21, 2020

You can check the runmodes from http://localhost:6530/system/console/status-slingsettings

or

directly from tools->operation->system overview