GUAC-1176: Remove all human-readable title properties from the REST form objects.

This commit is contained in:
Michael Jumper
2015-06-08 16:15:31 -07:00
parent 4eb5989c18
commit dcd82f9e63
23 changed files with 79 additions and 611 deletions

View File

@@ -35,24 +35,19 @@ import java.util.Collections;
public class BooleanField extends Field {
/**
* Creates a new BooleanField with the given name, title, and truth value.
* The truth value is the value that, when assigned to this field, means
* that this field is "true".
* Creates a new BooleanField with the given name and truth value. The
* truth value is the value that, when assigned to this field, means that
* this field is "true".
*
* @param name
* The unique name to associate with this field.
*
* @param title
* The human-readable title to associate with this field.
*
* @param truthValue
* The value to consider "true" for this field. All other values will
* be considered "false".
*/
public BooleanField(String name, String title, String truthValue) {
super(name, title, Field.Type.BOOLEAN, Collections.singletonList(
new FieldOption(truthValue, truthValue)
));
public BooleanField(String name, String truthValue) {
super(name, Field.Type.BOOLEAN, Collections.singletonList(truthValue));
}
}

View File

@@ -33,19 +33,16 @@ import java.util.Collection;
public class EnumField extends Field {
/**
* Creates a new EnumField with the given name, title, and possible values.
* Creates a new EnumField with the given name and possible values.
*
* @param name
* The unique name to associate with this field.
*
* @param title
* The human-readable title to associate with this field.
*
* @param options
* All possible legal options for this field.
*/
public EnumField(String name, String title, Collection<FieldOption> options) {
super(name, title, Field.Type.ENUM, options);
public EnumField(String name, Collection<String> options) {
super(name, Field.Type.ENUM, options);
}
}

View File

@@ -91,11 +91,6 @@ public class Field {
*/
private String name;
/**
* A human-readable name to be presented to the user.
*/
private String title;
/**
* The type of this field.
*/
@@ -104,52 +99,42 @@ public class Field {
/**
* A collection of all legal values of this field.
*/
private Collection<FieldOption> options;
private Collection<String> options;
/**
* Creates a new Parameter with no associated name, title, or type.
* Creates a new Parameter with no associated name or type.
*/
public Field() {
}
/**
* Creates a new Field with the given name, title, and type.
* Creates a new Field with the given name and type.
*
* @param name
* The unique name to associate with this field.
*
* @param title
* The human-readable title to associate with this field.
*
* @param type
* The type of this field.
*/
public Field(String name, String title, String type) {
public Field(String name, String type) {
this.name = name;
this.title = title;
this.type = type;
}
/**
* Creates a new Field with the given name, title, type, and possible
* values.
* Creates a new Field with the given name, type, and possible values.
*
* @param name
* The unique name to associate with this field.
*
* @param title
* The human-readable title to associate with this field.
*
* @param type
* The type of this field.
*
* @param options
* A collection of all possible valid options for this field.
*/
public Field(String name, String title, String type,
Collection<FieldOption> options) {
public Field(String name, String type, Collection<String> options) {
this.name = name;
this.title = title;
this.type = type;
this.options = options;
}
@@ -174,27 +159,6 @@ public class Field {
this.name = name;
}
/**
* Returns the human-readable title associated with this field.
*
* @return
* The human-readable title associated with this field.
*/
public String getTitle() {
return title;
}
/**
* Sets the title associated with this field. The title must be a human-
* readable string which describes accurately this field.
*
* @param title
* A human-readable string describing this field.
*/
public void setTitle(String title) {
this.title = title;
}
/**
* Returns the type of this field.
*
@@ -223,7 +187,7 @@ public class Field {
* A mutable collection of field options, or null if the field has no
* options.
*/
public Collection<FieldOption> getOptions() {
public Collection<String> getOptions() {
return options;
}
@@ -233,7 +197,7 @@ public class Field {
* @param options
* The options to associate with this field.
*/
public void setOptions(Collection<FieldOption> options) {
public void setOptions(Collection<String> options) {
this.options = options;
}

View File

@@ -40,41 +40,32 @@ public class Form {
*/
private String name;
/**
* The a human-readable title describing this form.
*/
private String title;
/**
* All fields associated with this form.
*/
private Collection<Field> fields;
/**
* Creates a new Form object with no associated fields. The name and title
* of the form are left unset as null. If no form name is provided, this
* form must not be used in the same context as another unnamed form.
* Creates a new Form object with no associated fields. The name is left
* unset as null. If no form name is provided, this form must not be used
* in the same context as another unnamed form.
*/
public Form() {
fields = new ArrayList<Field>();
}
/**
* Creates a new Form object having the given name and title, and
* containing the given fields.
* Creates a new Form object having the given name and containing the given
* fields.
*
* @param name
* A name which uniquely identifies this form.
*
* @param title
* A human-readable title describing this form.
*
* @param fields
* The fields to provided within the new Form.
*/
public Form(String name, String title, Collection<Field> fields) {
public Form(String name, Collection<Field> fields) {
this.name = name;
this.title = title;
this.fields = fields;
}
@@ -120,26 +111,4 @@ public class Form {
this.name = name;
}
/**
* Returns the human-readable title associated with this form. A form's
* title describes the form, but need not be unique.
*
* @return
* A human-readable title describing this form.
*/
public String getTitle() {
return title;
}
/**
* Sets the human-readable title associated with this form. A form's title
* describes the form, but need not be unique.
*
* @param title
* A human-readable title describing this form.
*/
public void setTitle(String title) {
this.title = title;
}
}

View File

@@ -30,16 +30,13 @@ package org.glyptodon.guacamole.form;
public class MultilineField extends Field {
/**
* Creates a new MultilineField with the given name and title.
* Creates a new MultilineField with the given name.
*
* @param name
* The unique name to associate with this field.
*
* @param title
* The human-readable title to associate with this field.
*/
public MultilineField(String name, String title) {
super(name, title, Field.Type.MULTILINE);
public MultilineField(String name) {
super(name, Field.Type.MULTILINE);
}
}

View File

@@ -30,16 +30,13 @@ package org.glyptodon.guacamole.form;
public class NumericField extends Field {
/**
* Creates a new NumericField with the given name and title.
* Creates a new NumericField with the given name.
*
* @param name
* The unique name to associate with this field.
*
* @param title
* The human-readable title to associate with this field.
*/
public NumericField(String name, String title) {
super(name, title, Field.Type.NUMERIC);
public NumericField(String name) {
super(name, Field.Type.NUMERIC);
}
}

View File

@@ -31,16 +31,13 @@ package org.glyptodon.guacamole.form;
public class PasswordField extends Field {
/**
* Creates a new PasswordField with the given name and title.
* Creates a new PasswordField with the given name.
*
* @param name
* The unique name to associate with this field.
*
* @param title
* The human-readable title to associate with this field.
*/
public PasswordField(String name, String title) {
super(name, title, Field.Type.PASSWORD);
public PasswordField(String name) {
super(name, Field.Type.PASSWORD);
}
}

View File

@@ -31,16 +31,13 @@ package org.glyptodon.guacamole.form;
public class TextField extends Field {
/**
* Creates a new TextField with the given name and title.
* Creates a new TextField with the given name.
*
* @param name
* The unique name to associate with this field.
*
* @param title
* The human-readable title to associate with this field.
*/
public TextField(String name, String title) {
super(name, title, Field.Type.TEXT);
public TextField(String name) {
super(name, Field.Type.TEXT);
}
}

View File

@@ -31,16 +31,13 @@ package org.glyptodon.guacamole.form;
public class UsernameField extends Field {
/**
* Creates a new UsernameField with the given name and title.
* Creates a new UsernameField with the given name.
*
* @param name
* The unique name to associate with this field.
*
* @param title
* The human-readable title to associate with this field.
*/
public UsernameField(String name, String title) {
super(name, title, Field.Type.USERNAME);
public UsernameField(String name) {
super(name, Field.Type.USERNAME);
}
}

View File

@@ -73,13 +73,13 @@ public class CredentialsInfo {
* A field describing the username HTTP parameter expected by Guacamole
* during login, if usernames are being used.
*/
public static final Field USERNAME = new UsernameField("username", "username");
public static final Field USERNAME = new UsernameField("username");
/**
* A field describing the password HTTP parameter expected by Guacamole
* during login, if passwords are being used.
*/
public static final Field PASSWORD = new PasswordField("password", "password");
public static final Field PASSWORD = new PasswordField("password");
/**
* CredentialsInfo object which describes standard username/password

View File

@@ -35,11 +35,6 @@ import org.glyptodon.guacamole.form.Form;
*/
public class ProtocolInfo {
/**
* The human-readable title associated with this protocol.
*/
private String title;
/**
* The unique name associated with this protocol.
*/
@@ -51,65 +46,37 @@ public class ProtocolInfo {
private Collection<Form> forms;
/**
* Creates a new ProtocolInfo with no associated name, title, or
* forms.
* Creates a new ProtocolInfo with no associated name or forms.
*/
public ProtocolInfo() {
this.forms = new ArrayList<Form>();
}
/**
* Creates a new ProtocolInfo having the given name and title, but without
* any forms.
* Creates a new ProtocolInfo having the given name, but without any forms.
*
* @param name
* The unique name associated with the protocol.
*
* @param title
* The human-readable title to associate with the protocol.
*/
public ProtocolInfo(String name, String title) {
public ProtocolInfo(String name) {
this.name = name;
this.title = title;
this.forms = new ArrayList<Form>();
}
/**
* Creates a new ProtocolInfo having the given name, title, and forms.
* Creates a new ProtocolInfo having the given name and forms.
*
* @param name
* The unique name associated with the protocol.
*
* @param title
* The human-readable title to associate with the protocol.
*
* @param forms
* The forms to associate with the protocol.
*/
public ProtocolInfo(String name, String title, Collection<Form> forms) {
public ProtocolInfo(String name, Collection<Form> forms) {
this.name = name;
this.title = title;
this.forms = forms;
}
/**
* Returns the human-readable title associated with this protocol.
*
* @return The human-readable title associated with this protocol.
*/
public String getTitle() {
return title;
}
/**
* Sets the human-readable title associated with this protocol.
*
* @param title The human-readable title to associate with this protocol.
*/
public void setTitle(String title) {
this.title = title;
}
/**
* Returns the unique name of this protocol. The protocol name is the
* value required by the corresponding protocol plugin for guacd.

View File

@@ -1,272 +1,156 @@
{
"title" : "RDP",
"name" : "rdp",
"forms" : [
{
"title" : "Network",
"name" : "network",
"fields" : [
{
"name" : "hostname",
"title" : "Hostname",
"type" : "TEXT"
},
{
"name" : "port",
"title" : "Port",
"type" : "NUMERIC"
}
]
},
{
"title" : "Authentication",
"name" : "authentication",
"fields" : [
{
"name" : "username",
"title" : "Username",
"type" : "USERNAME"
},
{
"name" : "password",
"title" : "Password",
"type" : "PASSWORD"
},
{
"name" : "domain",
"title" : "Domain",
"type" : "TEXT"
},
{
"name" : "security",
"title" : "Security mode",
"type" : "ENUM",
"options" : [
{
"value" : "",
"title" : ""
},
{
"value" : "rdp",
"title" : "RDP encryption"
},
{
"value" : "tls",
"title" : "TLS encryption"
},
{
"value" : "nla",
"title" : "NLA (Network Level Authentication)"
},
{
"value" : "any",
"title" : "Any"
}
]
"options" : [ "", "rdp", "tls", "nla", "any" ]
},
{
"name" : "disable-auth",
"title" : "Disable authentication",
"type" : "BOOLEAN",
"options" : [{
"value" : "true",
"title" : "true"
}]
"options" : [ "true" ]
},
{
"name" : "ignore-cert",
"title" : "Ignore server certificate",
"type" : "BOOLEAN",
"options" : [{
"value" : "true",
"title" : "true"
}]
"options" : [ "true" ]
}
]
},
{
"title" : "Basic Parameters",
"name" : "basic-parameters",
"fields" : [
{
"name" : "initial-program",
"title" : "Initial program",
"type" : "TEXT"
},
{
"name" : "client-name",
"title" : "Client name",
"type" : "TEXT"
},
{
"name" : "server-layout",
"title" : "Keyboard layout",
"type" : "ENUM",
"options" : [
{
"value" : "",
"title" : ""
},
{
"value" : "en-us-qwerty",
"title" : "US English (Qwerty)"
},
{
"value" : "fr-fr-azerty",
"title" : "French (Azerty)"
},
{
"value" : "de-de-qwertz",
"title" : "German (Qwertz)"
},
{
"value" : "it-it-qwerty",
"title" : "Italian (Qwerty)"
},
{
"value" : "sv-se-qwerty",
"title" : "Swedish (Qwerty)"
},
{
"value" : "failsafe",
"title" : "Unicode"
}
"",
"en-us-qwerty",
"fr-fr-azerty",
"de-de-qwertz",
"it-it-qwerty",
"sv-se-qwerty",
"failsafe"
]
},
{
"name" : "console",
"title" : "Administrator console",
"type" : "BOOLEAN",
"options" : [{
"value" : "true",
"title" : "true"
}]
"options" : [ "true" ]
}
]
},
{
"title" : "Display",
"name" : "display",
"fields" : [
{
"name" : "width",
"title" : "Display width",
"type" : "NUMERIC"
},
{
"name" : "height",
"title" : "Display height",
"type" : "NUMERIC"
},
{
"name" : "dpi",
"title" : "Display resolution (DPI)",
"type" : "NUMERIC"
},
{
"name" : "color-depth",
"title" : "Color depth",
"type" : "ENUM",
"options" : [
{
"value" : "",
"title" : ""
},
{
"value" : "8",
"title" : "256 color"
},
{
"value" : "16",
"title" : "Low color (16-bit)"
},
{
"value" : "24",
"title" : "True color (24-bit)"
},
{
"value" : "32",
"title" : "True color (32-bit)"
}
]
"options" : [ "", "8", "16", "24", "32" ]
}
]
},
{
"title" : "Device Redirection",
"name" : "device-redirection",
"fields" : [
{
"name" : "console-audio",
"title" : "Support audio in console",
"type" : "BOOLEAN",
"options" : [{
"value" : "true",
"title" : "true"
}]
"options" : [ "true" ]
},
{
"name" : "disable-audio",
"title" : "Disable audio",
"type" : "BOOLEAN",
"options" : [{
"value" : "true",
"title" : "true"
}]
"options" : [ "true" ]
},
{
"name" : "enable-printing",
"title" : "Enable printing",
"type" : "BOOLEAN",
"options" : [{
"value" : "true",
"title" : "true"
}]
"options" : [ "true" ]
},
{
"name" : "enable-drive",
"title" : "Enable drive",
"type" : "BOOLEAN",
"options" : [{
"value" : "true",
"title" : "true"
}]
"options" : [ "true" ]
},
{
"name" : "drive-path",
"title" : "Drive path",
"type" : "TEXT"
},
{
"name" : "static-channels",
"title" : "Static channel names",
"type" : "TEXT"
}
]
},
{
"title" : "RemoteApp",
"name" : "remoteapp",
"fields" : [
{
"name" : "remote-app",
"title" : "RemoteApp program",
"type" : "TEXT"
},
{
"name" : "remote-app-dir",
"title" : "RemoteApp working directory",
"type" : "TEXT"
},
{
"name" : "remote-app-args",
"title" : "RemoteApp parameters",
"type" : "TEXT"
}
]

View File

@@ -1,143 +1,65 @@
{
"title" : "SSH",
"name" : "ssh",
"forms" : [
{
"title" : "Network",
"name" : "network",
"fields" : [
{
"name" : "hostname",
"title" : "Hostname",
"type" : "TEXT"
},
{
"name" : "port",
"title" : "Port",
"type" : "NUMERIC"
}
]
},
{
"title" : "Authentication",
"name" : "authentication",
"fields" : [
{
"name" : "username",
"title" : "Username",
"type" : "USERNAME"
},
{
"name" : "password",
"title" : "Password",
"type" : "PASSWORD"
},
{
"name" : "private-key",
"title" : "Private key",
"type" : "MULTILINE"
},
{
"name" : "passphrase",
"title" : "Passphrase",
"type" : "PASSWORD"
}
]
},
{
"title" : "Display",
"name" : "display",
"fields" : [
{
"name" : "font-name",
"title" : "Font name",
"type" : "TEXT"
},
{
"name" : "font-size",
"title" : "Font size",
"type" : "ENUM",
"options" : [
{
"value" : "",
"title" : ""
},
{
"value" : "8",
"title" : "8"
},
{
"value" : "9",
"title" : "9"
},
{
"value" : "10",
"title" : "10"
},
{
"value" : "11",
"title" : "11"
},
{
"value" : "12",
"title" : "12"
},
{
"value" : "14",
"title" : "14"
},
{
"value" : "18",
"title" : "18"
},
{
"value" : "24",
"title" : "24"
},
{
"value" : "30",
"title" : "30"
},
{
"value" : "36",
"title" : "36"
},
{
"value" : "48",
"title" : "48"
},
{
"value" : "60",
"title" : "60"
},
{
"value" : "72",
"title" : "72"
},
{
"value" : "96",
"title" : "96"
}
]
"options" : [ "", "8", "9", "10", "11", "12", "14", "18", "24", "30", "36", "48", "60", "72", "96" ]
}
]
},
{
"title" : "SFTP",
"name" : "sftp",
"fields" : [
{
"name" : "enable-sftp",
"title" : "Enable SFTP",
"type" : "BOOLEAN",
"options" : [{
"value" : "true",
"title" : "true"
}]
"options" : [ "true" ]
}
]
}

View File

@@ -1,122 +1,50 @@
{
"title" : "Telnet",
"name" : "telnet",
"forms" : [
{
"title" : "Network",
"name" : "network",
"fields" : [
{
"name" : "hostname",
"title" : "Hostname",
"type" : "TEXT"
},
{
"name" : "port",
"title" : "Port",
"type" : "NUMERIC"
}
]
},
{
"title" : "Authentication",
"name" : "authentication",
"fields" : [
{
"name" : "username",
"title" : "Username",
"type" : "USERNAME"
},
{
"name" : "password",
"title" : "Password",
"type" : "PASSWORD"
},
{
"name" : "password-regex",
"title" : "Password regular expression",
"type" : "TEXT"
}
]
},
{
"title" : "Display",
"name" : "display",
"fields" : [
{
"name" : "font-name",
"title" : "Font name",
"type" : "TEXT"
},
{
"name" : "font-size",
"title" : "Font size",
"type" : "ENUM",
"options" : [
{
"value" : "",
"title" : ""
},
{
"value" : "8",
"title" : "8"
},
{
"value" : "9",
"title" : "9"
},
{
"value" : "10",
"title" : "10"
},
{
"value" : "11",
"title" : "11"
},
{
"value" : "12",
"title" : "12"
},
{
"value" : "14",
"title" : "14"
},
{
"value" : "18",
"title" : "18"
},
{
"value" : "24",
"title" : "24"
},
{
"value" : "30",
"title" : "30"
},
{
"value" : "36",
"title" : "36"
},
{
"value" : "48",
"title" : "48"
},
{
"value" : "60",
"title" : "60"
},
{
"value" : "72",
"title" : "72"
},
{
"value" : "96",
"title" : "96"
}
]
"options" : [ "", "8", "9", "10", "11", "12", "14", "18", "24", "30", "36", "48", "60", "72", "96" ]
}
]
}

View File

@@ -1,141 +1,81 @@
{
"title" : "VNC",
"name" : "vnc",
"forms" : [
{
"title" : "Network",
"name" : "network",
"fields" : [
{
"name" : "hostname",
"title" : "Hostname",
"type" : "TEXT"
},
{
"name" : "port",
"title" : "Port",
"type" : "NUMERIC"
}
]
},
{
"title" : "Authentication",
"name" : "authentication",
"fields" : [
{
"name" : "password",
"title" : "Password",
"type" : "PASSWORD"
}
]
},
{
"title" : "Display",
"name" : "display",
"fields" : [
{
"name" : "read-only",
"title" : "Read-only",
"type" : "BOOLEAN",
"options" : [{
"value" : "true",
"title" : "true"
}]
"options" : [ "true" ]
},
{
"name" : "swap-red-blue",
"title" : "Swap red/blue components",
"type" : "BOOLEAN",
"options" : [{
"value" : "true",
"title" : "true"
}]
"options" : [ "true" ]
},
{
"name" : "cursor",
"title" : "Cursor",
"type" : "ENUM",
"options" : [
{
"value" : "",
"title" : ""
},
{
"value" : "local",
"title" : "Local"
},
{
"value" : "remote",
"title" : "Remote"
}
]
"options" : [ "", "local", "remote" ]
},
{
"name" : "color-depth",
"title" : "Color depth",
"type" : "ENUM",
"options" : [
{
"value" : "",
"title" : ""
},
{
"value" : "8",
"title" : "256 color"
},
{
"value" : "16",
"title" : "Low color (16-bit)"
},
{
"value" : "24",
"title" : "True color (24-bit)"
},
{
"value" : "32",
"title" : "True color (32-bit)"
}
]
"options" : [ "", "8", "16", "24", "32" ]
}
]
},
{
"title" : "Repeater",
"name" : "repeater",
"fields" : [
{
"name" : "dest-host",
"title" : "Repeater destination host",
"type" : "TEXT"
},
{
"name" : "dest-port",
"title" : "Repeater destination port",
"type" : "NUMERIC"
}
]
},
{
"title" : "Audio",
"name" : "audio",
"fields" : [
{
"name" : "enable-audio",
"title" : "Enable audio",
"type" : "BOOLEAN",
"options" : [{
"value" : "true",
"title" : "true"
}]
"options" : [ "true" ]
},
{
"name" : "audio-servername",
"title" : "Audio server name",
"type" : "TEXT"
}
]