You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by jm...@apache.org on 2016/06/06 21:59:05 UTC
[4/9] incubator-guacamole-client git commit: GUACAMOLE-44: Provide
for direct translation of status codes into GuacamoleStatus values.
GUACAMOLE-44: Provide for direct translation of status codes into GuacamoleStatus values.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/2bb52601
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/2bb52601
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/2bb52601
Branch: refs/heads/master
Commit: 2bb5260144697316e5c93cfca9812511ee0b3354
Parents: 75baa69
Author: Michael Jumper <mj...@apache.org>
Authored: Sun Jun 5 16:01:08 2016 -0700
Committer: Michael Jumper <mj...@apache.org>
Committed: Sun Jun 5 16:03:12 2016 -0700
----------------------------------------------------------------------
.../guacamole/protocol/GuacamoleStatus.java | 28 +++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/2bb52601/guacamole-common/src/main/java/org/apache/guacamole/protocol/GuacamoleStatus.java
----------------------------------------------------------------------
diff --git a/guacamole-common/src/main/java/org/apache/guacamole/protocol/GuacamoleStatus.java b/guacamole-common/src/main/java/org/apache/guacamole/protocol/GuacamoleStatus.java
index 4dbae64..a5e84c6 100644
--- a/guacamole-common/src/main/java/org/apache/guacamole/protocol/GuacamoleStatus.java
+++ b/guacamole-common/src/main/java/org/apache/guacamole/protocol/GuacamoleStatus.java
@@ -166,5 +166,31 @@ public enum GuacamoleStatus {
public int getGuacamoleStatusCode() {
return guac_code;
}
-
+
+ /**
+ * Returns the GuacamoleStatus corresponding to the given Guacamole
+ * protocol status code. If no such GuacamoleStatus is defined, null is
+ * returned.
+ *
+ * @param code
+ * The Guacamole protocol status code to translate into a
+ * GuacamoleStatus.
+ *
+ * @return
+ * The GuacamoleStatus corresponding to the given Guacamole protocol
+ * status code, or null if no such GuacamoleStatus is defined.
+ */
+ public static GuacamoleStatus fromGuacamoleStatusCode(int code) {
+
+ // Search for a GuacamoleStatus having the given status code
+ for (GuacamoleStatus status : values()) {
+ if (status.getGuacamoleStatusCode() == code)
+ return status;
+ }
+
+ // No such status found
+ return null;
+
+ }
+
}