/** * Constructor for use with maps passed back from the Perforce server only. */ public ServerInfo(Map<String, Object> map) { if (map != null) { setFromMap(map); } }
@Override public IServerInfo getServerInfo() throws ConnectionException, RequestException, AccessException { ServerInfo serverInfo = new ServerInfo(); List<Map<String, Object>> resultMaps = execMapCmdList(INFO, new String[0], null); if (nonNull(resultMaps)) { List<Map<String, Object>> validMaps = new ArrayList<>(); for (int i = 0; i < resultMaps.size(); i++) { Map<String, Object> map = resultMaps.get(i); // p4ic4idea: use IServerMessage ResultMapParser.handleErrors(ResultMapParser.toServerMessage(map)); validMaps.add(map); } serverInfo = new ServerInfo(validMaps); } return serverInfo; } }
@Override public IServerInfo getServerInfo() throws ConnectionException, RequestException, AccessException { ServerInfo serverInfo = new ServerInfo(); List<Map<String, Object>> resultMaps = execMapCmdList(INFO, new String[0], null); if (nonNull(resultMaps)) { List<Map<String, Object>> validMaps = new ArrayList<>(); for (int i = 0; i < resultMaps.size(); i++) { Map<String, Object> map = resultMaps.get(i); String errStr = ResultMapParser.getErrorStr(map); throwRequestExceptionIfConditionFails(isBlank(errStr), parseCode0ErrorString(map), errStr); validMaps.add(map); } serverInfo = new ServerInfo(validMaps); } return serverInfo; } }
/** * Constructor for use with maps passed back from the Perforce server only. * * When a broker is involved, there will be more than one map. */ public ServerInfo(List<Map<String, Object>> maps) { for (Map<String, Object> map : maps) { setFromMap(map); } }
/** * Constructor for use with maps passed back from the Perforce server only. */ public ServerInfo(Map<String, Object> map) { if (map != null) { setFromMap(map); } }
/** * Constructor for use with maps passed back from the Perforce server only. * * When a broker is involved, there will be more than one map. */ public ServerInfo(List<Map<String, Object>> maps) { for (Map<String, Object> map : maps) { setFromMap(map); } }
this.userName = setFromMap(map, "userName", this.userName); this.clientCurrentDirectory = setFromMap(map, "clientCwd", this.clientCurrentDirectory); this.clientName = setFromMap(map, "clientName", this.clientName); this.clientRoot = setFromMap(map, "clientRoot", this.clientRoot); this.clientHost = setFromMap(map, "clientHost", this.clientHost); this.clientAddress = setFromMap(map, "clientAddress", this.clientAddress); this.serverAddress = setFromMap(map, "serverAddress", this.serverAddress); this.serverDate = setFromMap(map, "serverDate", this.serverDate); this.serverLicense = setFromMap(map, "serverLicense", this.serverLicense); this.serverRoot = setFromMap(map, "serverRoot", this.serverRoot); this.serverUptime = setFromMap(map, "serverUptime", this.serverUptime); this.serverVersion = setFromMap(map, "serverVersion", this.serverVersion); this.serverLicenseIp = setFromMap(map, "serverLicense-ip", this.serverLicenseIp); this.serverId = setFromMap(map, "ServerID", this.serverId); this.serverCluster = setFromMap(map, "serverCluster", this.serverCluster); this.replica = setFromMap(map, "replica", this.replica); this.proxyVersion = setFromMap(map, "proxyVersion", this.proxyVersion); this.proxyAddress = setFromMap(map, "proxyAddress", this.proxyAddress); this.proxyRoot = setFromMap(map, "proxyRoot", this.proxyRoot); this.brokerVersion = setFromMap(map, "brokerVersion", this.brokerVersion); this.brokerAddress = setFromMap(map, "brokerAddress", this.brokerAddress); this.sandboxVersion = setFromMap(map, "p4sandboxBrokerVersion", this.sandboxVersion); this.sandboxPort = setFromMap(map, "p4sandboxBrokerPort", this.sandboxPort); this.integEngine = setFromMap(map, "integEngine", this.integEngine);
this.userName = setFromMap(map, "userName", this.userName); this.clientCurrentDirectory = setFromMap(map, "clientCwd", this.clientCurrentDirectory); this.clientName = setFromMap(map, "clientName", this.clientName); this.clientRoot = setFromMap(map, "clientRoot", this.clientRoot); this.clientHost = setFromMap(map, "clientHost", this.clientHost); this.clientAddress = setFromMap(map, "clientAddress", this.clientAddress); this.serverAddress = setFromMap(map, "serverAddress", this.serverAddress); this.serverDate = setFromMap(map, "serverDate", this.serverDate); this.serverLicense = setFromMap(map, "serverLicense", this.serverLicense); this.serverRoot = setFromMap(map, "serverRoot", this.serverRoot); this.serverUptime = setFromMap(map, "serverUptime", this.serverUptime); this.serverVersion = setFromMap(map, "serverVersion", this.serverVersion); this.serverLicenseIp = setFromMap(map, "serverLicense-ip", this.serverLicenseIp); this.serverId = setFromMap(map, "ServerID", this.serverId); this.serverCluster = setFromMap(map, "serverCluster", this.serverCluster); this.replica = setFromMap(map, "replica", this.replica); this.proxyVersion = setFromMap(map, "proxyVersion", this.proxyVersion); this.proxyAddress = setFromMap(map, "proxyAddress", this.proxyAddress); this.proxyRoot = setFromMap(map, "proxyRoot", this.proxyRoot); this.brokerVersion = setFromMap(map, "brokerVersion", this.brokerVersion); this.brokerAddress = setFromMap(map, "brokerAddress", this.brokerAddress); this.sandboxVersion = setFromMap(map, "p4sandboxBrokerVersion", this.sandboxVersion); this.sandboxPort = setFromMap(map, "p4sandboxBrokerPort", this.sandboxPort); this.integEngine = setFromMap(map, "integEngine", this.integEngine);