/** * Method description * * * @param validateable */ public static void assertIsValid(Validateable validateable) { assertIsNotNull(validateable); if (!validateable.isValid()) { throw new IllegalStateException("object is not valid"); } }
/** * Method description * * * @param repository * * @return */ @Override public RepositoryBrowser getRepositoryBrowser(Repository repository) { AssertUtil.assertIsNotNull(repository); return new SvnRepositoryBrowser(this, repository); }
/** * Method description * * * @param repositoryDirectory * @param context * * @return */ HgChangesetViewer getChangesetViewer(File repositoryDirectory, HgContext context) { AssertUtil.assertIsNotNull(repositoryDirectory); AssertUtil.assertIsNotNull(context); if (!repositoryDirectory.isDirectory()) { throw new IllegalStateException("directory not found"); } return new HgChangesetViewer(this, context, repositoryDirectory); }
/** * Method description * * * @param repository * * @return */ @Override public RepositoryBrowser getRepositoryBrowser(Repository repository) { AssertUtil.assertIsNotNull(repository); return new GitRepositoryBrowser(this, repository); }
/** * Method description * * * @param directory * * @return * * @throws IOException */ private String getRepositoryName(File directory) throws IOException { AssertUtil.assertIsNotNull(directory); return RepositoryUtil.getRepositoryName(handler, directory); }
/** * Method description * * * @param validateable */ public static void assertIsValid(Validateable validateable) { assertIsNotNull(validateable); if (!validateable.isValid()) { throw new IllegalStateException("object is not valid"); } }
/** * Add a http header for the request. * * * @param name name of the request header * @param values values of the request header * * @return {@code this} */ public HttpRequest addHeader(String name, String... values) { AssertUtil.assertIsNotNull(name); if (headers == null) { headers = new HashMap<String, List<String>>(); } appendValues(headers, name, values); return this; }
/** * Add a parameter to the request. * * * @param name name of the parameter * @param values values of the parameter * * @return {@code this} */ public HttpRequest addParameters(String name, String... values) { AssertUtil.assertIsNotNull(name); if (parameters == null) { parameters = new HashMap<String, List<String>>(); } appendValues(parameters, name, values); return this; }
/** * Add a http header for the request. * * * @param name name of the request header * @param values values of the request header * * @return {@code this} */ public HttpRequest addHeader(String name, String... values) { AssertUtil.assertIsNotNull(name); if (headers == null) { headers = new HashMap<String, List<String>>(); } appendValues(headers, name, values); return this; }
/** * Add a parameter to the request. * * * @param name name of the parameter * @param values values of the parameter * * @return {@code this} */ public HttpRequest addParameters(String name, String... values) { AssertUtil.assertIsNotNull(name); if (parameters == null) { parameters = new HashMap<String, List<String>>(); } appendValues(parameters, name, values); return this; }
/** * Method description * * * @param contextProvider * * @return */ public static User getCurrentUser( Provider<? extends SecurityContext> contextProvider) { AssertUtil.assertIsNotNull(contextProvider); SecurityContext context = contextProvider.get(); AssertUtil.assertIsNotNull(context); User user = context.getUser(); if (user == null) { throw new ScmSecurityException("user is not authenticated"); } return user; }
/** * Method description * * * @param contextProvider * * @return */ public static User getCurrentUser( Provider<? extends SecurityContext> contextProvider) { AssertUtil.assertIsNotNull(contextProvider); SecurityContext context = contextProvider.get(); AssertUtil.assertIsNotNull(context); User user = context.getUser(); if (user == null) { throw new ScmSecurityException("user is not authenticated"); } return user; }
/** * Method description * * * @return */ private String getInterpreter() { HgConfig config = handler.getConfig(); AssertUtil.assertIsNotNull(config); String python = config.getPythonBinary(); if ((python != null) && config.isUseOptimizedBytecode()) { python = python.concat(" -O"); } return python; }
/** * Method description * * * @param repository * * @return */ @Override public BlameViewer getBlameViewer(Repository repository) { GitBlameViewer blameViewer = null; AssertUtil.assertIsNotNull(repository); String type = repository.getType(); AssertUtil.assertIsNotEmpty(type); if (TYPE_NAME.equals(type)) { blameViewer = new GitBlameViewer(this, repository); } else { throw new IllegalArgumentException("git repository is required"); } return blameViewer; }
/** * Method description * * * @param repository * * @return */ @Override public BlameViewer getBlameViewer(Repository repository) { SvnBlameViewer blameViewer = null; AssertUtil.assertIsNotNull(repository); String type = repository.getType(); AssertUtil.assertIsNotEmpty(type); if (TYPE_NAME.equals(type)) { blameViewer = new SvnBlameViewer(this, repository); } else { throw new IllegalArgumentException("svn repository is required"); } return blameViewer; }
/** * Method description * * * @param repository * * @return */ @Override public ChangesetViewer getChangesetViewer(Repository repository) { SvnChangesetViewer changesetViewer = null; AssertUtil.assertIsNotNull(repository); String type = repository.getType(); AssertUtil.assertIsNotEmpty(type); if (TYPE_NAME.equals(type)) { changesetViewer = new SvnChangesetViewer(this, repository); } else { throw new IllegalArgumentException("svn repository is required"); } return changesetViewer; }
/** * Method description * * * @param repository * * @return */ @Override public ChangesetViewer getChangesetViewer(Repository repository) { GitChangesetViewer changesetViewer = null; AssertUtil.assertIsNotNull(repository); String type = repository.getType(); AssertUtil.assertIsNotEmpty(type); if (TYPE_NAME.equals(type)) { changesetViewer = new GitChangesetViewer(this, repository); } else { throw new IllegalArgumentException("git repository is required"); } return changesetViewer; }
/** * Method description * * * @param repository * * @return */ @Override public DiffViewer getDiffViewer(Repository repository) { GitDiffViewer diffViewer = null; AssertUtil.assertIsNotNull(repository); String type = repository.getType(); AssertUtil.assertIsNotEmpty(type); if (TYPE_NAME.equals(type)) { diffViewer = new GitDiffViewer(this, repository); } else { throw new IllegalArgumentException("git repository is required"); } return diffViewer; }
/** * Method description * * * @param contextProvider * * @return */ public static boolean isAdmin(SecurityContext contextProvider) { AssertUtil.assertIsNotNull(contextProvider); return (contextProvider.getUser() != null) && contextProvider.getUser().isAdmin(); }
/** * Method description * * * @param contextProvider * * @return */ public static boolean isAdmin(SecurityContext contextProvider) { AssertUtil.assertIsNotNull(contextProvider); return (contextProvider.getUser() != null) && contextProvider.getUser().isAdmin(); }