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.