/**
   * Transforms the Collection of Repositories into a Vector of Repositories parameters by
   * repositoriy types.
   *
   * @param repositories
   * @return the Collection of Repositories into a Vecotr of Repositories parameters by type.
   */
  public static Vector<Object> toXmlRpcRepositoriesParameters(Collection<Repository> repositories) {
    Vector<Object> repositoriesParams = new Vector<Object>();
    for (Repository repo : repositories) {
      repositoriesParams.add(repo.marshallize());
    }

    return repositoriesParams;
  }
  /**
   * Transforms the Vector of the Repository parameters into a Repository Object.<br>
   * Structure of the parameters:<br>
   * Vector[name, Vector[project parameters], type, content type, uri]
   *
   * @param xmlRpcParameters Vector[name, Vector[project parameters], type, content type, uri]
   * @return the Repository.
   */
  @SuppressWarnings("unchecked")
  public static Repository toRepository(Vector<Object> xmlRpcParameters) {
    Repository repository = null;
    if (!xmlRpcParameters.isEmpty()) {
      repository = Repository.newInstance((String) xmlRpcParameters.get(REPOSITORY_UID_IDX));
      repository.setName((String) xmlRpcParameters.get(REPOSITORY_NAME_IDX));
      repository.setProject(toProject((Vector) xmlRpcParameters.get(REPOSITORY_PROJECT_IDX)));
      repository.setType(toRepositoryType((Vector) xmlRpcParameters.get(REPOSITORY_TYPE_IDX)));
      repository.setContentType(
          ContentType.getInstance((String) xmlRpcParameters.get(REPOSITORY_CONTENTTYPE_IDX)));
      repository.setBaseUrl((String) xmlRpcParameters.get(REPOSITORY_BASE_URL_IDX));
      repository.setBaseRepositoryUrl((String) xmlRpcParameters.get(REPOSITORY_BASEREPO_URL_IDX));
      repository.setBaseTestUrl((String) xmlRpcParameters.get(REPOSITORY_BASETEST_URL_IDX));
      repository.setUsername(toNullIfEmpty((String) xmlRpcParameters.get(REPOSITORY_USERNAME_IDX)));
      repository.setPassword(toNullIfEmpty((String) xmlRpcParameters.get(REPOSITORY_PASSWORD_IDX)));
      repository.setMaxUsers((Integer) xmlRpcParameters.get(REPOSITORY_MAX_USERS_IDX));
    }

    return repository;
  }