how to activate page with out create version in author instance - aem

When we do modifications in page activate page it will be creating version.
Is it possible disable version when we activate page.
To configure the Version Manager
PID com.day.cq.wcm.core.impl.VersionManagerImpl
versionmanager.createVersionOnActivation (Boolean, default: false)
If we click uncheckbox, when activate page I am able to disable versions.
but above one will be affect all projects.
Any other way do disable versions for specific project?
Below thing also creating versions
by programatically
replicator.replicate(session, ReplicationActionType.ACTIVATE,pagepath);
enter link description here

You can disable the version creation by enabling the "no version" flag in the replication agent settings.

Use a different method for replication, pass ReplicationOptions
void replicate(Session session,
ReplicationActionType type,
String path,
ReplicationOptions options)
throws ReplicationException
In ReplicationOptions, there is a way to suppress the implicit version
public void setSuppressVersions(boolean suppressVersions)

Related

Java Eclipse plugin Development - Save all project's files with opening of dialog with list of changed files

This question is already posted in link Java Eclipse plugin Development - Save all project's files programmatically
I was trying with the below code but it is not working/ So I have the query that what entry I would required to add in plugin.xml so that as I use ctrl+s or ctrl+all+ save icon below should start working. Or its better if I got complete example.
import org.eclipse.core.resources.IProject;
#SuppressWarnings("restriction")
public class SaveOpenFilesHandler extends org.eclipse.debug.internal.ui.launchConfigurations.SaveScopeResourcesHandler
{
public void showSaveDialog(IProject project)
{
super.showSaveDialog(new IProject[] {project}, true, true);
super.doSave();
}
}
The IDE.saveAllEditors method is the closest official API for this:
public boolean saveAllEditors(IResource[] resources, boolean confirm)
Save all dirty editors in the workbench that are open on files that
may be affected by this operation. Opens a dialog to prompt the user
if confirm is true. Return true if successful. Return false if the
user has canceled the command. Must be called from the UI thread.
The simplest call to this is:
IDE.saveAllEditors(new IResource[]{ResourcesPlugin.getWorkspace().getRoot()}, true);
to save everything in the workspace.
IDE is org.eclipse.ui.ide.IDE
I have done this with on early start up now it is working fine for me.

Is it possible to publish versions of a page/asset in AEM?

For a regulatory requirement, we are supposed to show the previous versions of a page/asset (state of page as of particular date) at publish instance. So when an end user searches an asset, and if the asset had multiple versions, he should be able to hit any version from the search result.
I managed this to solution from author instance wherein I included the versionId in query param or selector and a custom filter picked this version in url, used version manager to return the respective version of page.
When it comes to publish, from 6.1 AEM has made ACLs stricter in accessing /jcr:system. I tried to publish a revision say /jcr:system/jcr:versionStorage/1f/4f/d1/1f4fd128-b9e3-43cc-9d8a-9335bb34c3ae from activation tree and it didnt publish either.
With this requirement how can we publish versions of a page/asset?

How to restore multiple default values on a Preference page in Eclipse

I am writing a plugin, which will do the job of restoring all default values of a Preference page in Eclipse. My idea is to get the Preference page, and then invoke: performDefaults() to reset all the values. However, I can't manage to get the Preference page of that plugin: I used the following code to get the IPreferenceNode, then I want to use method getPage() to return the corresponding Preference page of the plugin, but it returns null. It seems that IPreferenceNode doesn't store the associated Preference page. So How can I get the Preference page of a plugin? Or is there any other method to reset multiple values in a Preference page?
PreferenceManager prefmngr = PlatformUI.getWorkbench( ).getPreferenceManager();
List<IPreferenceNode> nodelist = pm.getElements(PreferenceManager.PRE_ORDER);
Calling performDefaults() is not going to work as it expects to be run in an open preference dialog and calls user interface functions which will fail outside of an open dialog (it is also protected so you can't call it without reflection anyway).
Looking at a variety of preference pages there does not look to be any general way to reset a page's default.

Youtrack REST: setting default value for project custom field

I am implementing a release mechanism for my application and want to couple it with my YouTrack using the REST API.
Upon the release I want to set the default value of
'Fix Version' for newly created issues to the bumped version.
The Fix Version is a project's custom filed. When I query for it via REST API i get
<projectCustomField name="Fix version" type="version[1]" emptyText="Unknown" canBeEmpty="true">
<param name="bundle" value="MyProject Versions"/>
<defaultValue>2.8</defaultValue>
</projectCustomField>
The documentation mentions just the way to change the name and an unset value text. I have tried POSTing the dafaultValue and dafault parameters, but with no effect. Is it's possible at all?
I have contacted JetBrains, and apparently this functionality is, sadly, not there.

Disable Installed Software & Installation History tab on Help | About | Installation Details

Is there some way I can suppress or disable the "Installed Software" & "Installation History" tabs on Help | About | Installation Details button in a RCP?
I'm not using P2 for this particular application so there will never be any history and the installed software tab has no content.
If you do not want these do show then make sure that the following plug-ins are not deployed in your application's target platform:
org.eclipse.p2.ui
org.eclipse.p2.ui.discovery
org.eclipse.p2.ui.sdk
org.eclipse.p2.ui.updatechecker
Strictly speaking you only really need to remove the first bundle in the above list as the subsequent bundles depend on the core ui bundle. Typically, if I do not want the user to shcedule updates etc. I'll only inlcude the first bundle above. I then build a custom UI around p2 functionality whilst re-using some of the provided core p2 UI API (but without auto-scheduling UI etc. included).
If you want to remove the preference pages for the p2 sheduling/updates, then in your in your WorkbenchAdvisor you can use write the following in the postStartup() method:
PreferenceManager pm =
PlatformUI.getWorkbench(
).getPreferenceManager();
pm.remove("org.eclipse.equinox.internal.p2.ui.sdk.ProvisioningPreferencePage"); pm.remove("org.eclipse.update.internal.ui.preferences.MainPreferencePage");
I ended up deleting the org.eclipse.p2.ui plugin's & features from my built product.
Not the most elegant solution, but it works.
subclass the AboutDialog class and override the createButtonsForButtonBar(Composite) method :)
and use your own InstallationDialog subclass.
to avoid displaying the tabs you don't want you have to override the createFolderItems method.
give a look the loadElements method to understand how this part of the dialog works.