Adapt to changes in Argeo Commons.
authorMathieu Baudier <mbaudier@argeo.org>
Mon, 30 Aug 2021 07:48:28 +0000 (09:48 +0200)
committerMathieu Baudier <mbaudier@argeo.org>
Mon, 30 Aug 2021 07:48:28 +0000 (09:48 +0200)
cms/org.argeo.slc.client.ui.dist/src/org/argeo/slc/client/ui/dist/commands/UnregisterRemoteRepo.java
cms/org.argeo.slc.client.ui.dist/src/org/argeo/slc/client/ui/dist/wizards/RegisterRepoWizard.java
cms/org.argeo.slc.repo/src/org/argeo/slc/repo/RepoConstants.java

index 460c0aa0086d0ecbad0e771f2872a9c85b975336..8ff0e4a9463385d95b4ee207a84320248ed573a7 100644 (file)
@@ -6,6 +6,7 @@ import javax.jcr.Repository;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 
+import org.argeo.api.NodeConstants;
 import org.argeo.cms.ArgeoTypes;
 import org.argeo.cms.ui.workbench.util.CommandUtils;
 import org.argeo.jcr.JcrUtils;
@@ -24,14 +25,12 @@ import org.eclipse.jface.resource.ImageDescriptor;
 public class UnregisterRemoteRepo extends AbstractHandler {
        // private static final Log log = LogFactory
        // .getLog(UnregisterRemoteRepo.class);
-       
+
        public final static String ID = DistPlugin.PLUGIN_ID + ".unregisterRemoteRepo";
        public final static String DEFAULT_LABEL = "Unregister";
-       public final static ImageDescriptor DEFAULT_ICON = DistPlugin
-                       .getImageDescriptor("icons/removeItem.gif");
+       public final static ImageDescriptor DEFAULT_ICON = DistPlugin.getImageDescriptor("icons/removeItem.gif");
 
-       public final static String PARAM_REPO_PATH = DistPlugin.PLUGIN_ID
-                       + ".repoNodePath";
+       public final static String PARAM_REPO_PATH = DistPlugin.PLUGIN_ID + ".repoNodePath";
 
        // DEPENCY INJECTION
        private Repository nodeRepository;
@@ -43,18 +42,16 @@ public class UnregisterRemoteRepo extends AbstractHandler {
                        return null;
 
                try {
-                       session = nodeRepository.login();
+                       session = nodeRepository.login(NodeConstants.HOME_WORKSPACE);
                        Node rNode = session.getNode(repoPath);
                        if (rNode.isNodeType(ArgeoTypes.ARGEO_REMOTE_REPOSITORY)) {
 
-                               String alias = rNode.getProperty(Property.JCR_TITLE)
-                                               .getString();
-                               String msg = "Your are about to unregister remote repository: "
-                                               + alias + "\n" + "Are you sure you want to proceed ?";
+                               String alias = rNode.getProperty(Property.JCR_TITLE).getString();
+                               String msg = "Your are about to unregister remote repository: " + alias + "\n"
+                                               + "Are you sure you want to proceed ?";
 
-                               boolean result = MessageDialog.openConfirm(DistPlugin
-                                               .getDefault().getWorkbench().getDisplay()
-                                               .getActiveShell(), "Confirm Delete", msg);
+                               boolean result = MessageDialog.openConfirm(
+                                               DistPlugin.getDefault().getWorkbench().getDisplay().getActiveShell(), "Confirm Delete", msg);
 
                                if (result) {
                                        rNode.remove();
@@ -63,9 +60,7 @@ public class UnregisterRemoteRepo extends AbstractHandler {
                                CommandUtils.callCommand(RefreshDistributionsView.ID);
                        }
                } catch (RepositoryException e) {
-                       throw new SlcException(
-                                       "Unexpected error while unregistering remote repository.",
-                                       e);
+                       throw new SlcException("Unexpected error while unregistering remote repository.", e);
                } finally {
                        JcrUtils.logoutQuietly(session);
                }
index 3cebd6862d936a1164c89e9b39187cd8265345ca..75a801574bdeb9ecd1e57c0ddbadeff669cafb92 100644 (file)
@@ -11,6 +11,7 @@ import javax.jcr.Session;
 import javax.jcr.SimpleCredentials;
 import javax.jcr.nodetype.NodeType;
 
+import org.argeo.api.NodeConstants;
 import org.argeo.api.NodeUtils;
 import org.argeo.api.security.Keyring;
 import org.argeo.cms.ArgeoNames;
@@ -87,7 +88,7 @@ public class RegisterRepoWizard extends Wizard {
 
                Session nodeSession = null;
                try {
-                       nodeSession = nodeRepository.login();
+                       nodeSession = nodeRepository.login(NodeConstants.HOME_WORKSPACE);
                        String reposPath = NodeUtils.getUserHome(nodeSession).getPath() + RepoConstants.REPOSITORIES_BASE_PATH;
 
                        Node repos = nodeSession.getNode(reposPath);
index 572ac9e7f2bf08a54dddf26d4bfdf790eab7a462..0645664c8b74812d90006923f1c00ce596b4bd78 100644 (file)
@@ -1,5 +1,7 @@
 package org.argeo.slc.repo;
 
+import org.argeo.api.NodeConstants;
+
 /** SLC repository constants */
 public interface RepoConstants {
        String DEFAULT_JAVA_REPOSITORY_ALIAS = "java";
@@ -21,5 +23,5 @@ public interface RepoConstants {
        String SLC_CATEGORY_ID = "SLC-Category";
 
        // TODO find a more generic way
-       String DEFAULT_DEFAULT_WORKSPACE = "main";
+       String DEFAULT_DEFAULT_WORKSPACE = NodeConstants.SYS_WORKSPACE;
 }