コード例 #1
0
    /**
     * This method gets all the info we need from the server given the parse results. If some call
     * fails we simply return false and ignore the results.
     *
     * @param parseResult
     * @return
     */
    @Override
    public boolean validate(UrlHelper.ParseResult parseResult) {
      try {
        final URI collectionUri = URI.create(parseResult.getCollectionUrl());
        final GitHttpClient gitClient = new GitHttpClient(client, collectionUri);
        // Get the repository object and team project
        repository =
            gitClient.getRepository(parseResult.getProjectName(), parseResult.getRepoName());
        // Get the collection object
        final URI serverUri = URI.create(parseResult.getServerUrl());
        final CoreHttpClient coreClient = new CoreHttpClient(client, serverUri);
        collection = coreClient.getProjectCollection(parseResult.getCollectionName());
      } catch (Throwable throwable) {
        // TODO Log the failure
        return false;
      }

      return true;
    }