getCmisSession method

CmisSession? getCmisSession(
  1. String? urlPrefix, [
  2. String? serviceUrlPrefix,
  3. String? userName,
  4. String? password,
  5. String? repId,
])

Return either a new CmisSession or one from the cache if we have one

Implementation

CmisSession? getCmisSession(String? urlPrefix,
    [String? serviceUrlPrefix,
    String? userName,
    String? password,
    String? repId]) {
  /// Check for an existing session
  if (_sessionMap.containsKey(repId)) {
    return _sessionMap[repId!];
  }

  // Generate a new one
  final newSession = CmisSession(
      urlPrefix, httpAdapter, environmentSupport, serviceUrlPrefix, repId);

  // Login if asked
  if ((userName != null) && (password != null)) {
    newSession.login(userName, password);
  }

  // Add to the map
  if (repId != null) {
    _sessionMap[repId] = newSession;
  }

  // Return the new session
  return newSession;
}