Skip to content

Commit

Permalink
modified Description entry field and adjust methods
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisMWay committed Aug 15, 2013
1 parent f820fda commit 4c5cd11
Show file tree
Hide file tree
Showing 9 changed files with 143 additions and 138 deletions.
1 change: 0 additions & 1 deletion .description

This file was deleted.

74 changes: 45 additions & 29 deletions src/main/java/org/jenkinsci/plugins/relution/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public class Application extends AbstractDescribableImpl<Application> {
private String apiEndpointURL;
private String applicationName;
private String applicationReleaseNotes;
private String applicationDescription;

/**
* These constructor will be executed every time when the save/submit button will be triggered in the Jenkins.
Expand All @@ -57,13 +58,15 @@ public class Application extends AbstractDescribableImpl<Application> {
* @param apiReleaseStatus String Representation of the ReleaseState to the app will be published.
*/
@DataBoundConstructor
public Application(final String apiEndpointURL, final String applicationFile, final String applicationIcon, final String apiReleaseStatus, final String applicationName, final String applicationReleaseNotes) {
public Application(final String apiEndpointURL, final String applicationFile, final String applicationIcon, final String apiReleaseStatus, final String applicationName, final String applicationReleaseNotes, final String applicationDescription) {
this.setApiEndpointURL(apiEndpointURL);
this.setApplicationFile(applicationFile);
this.setApplicationIcon(applicationIcon);
this.setApiReleaseStatus(apiReleaseStatus);
this.setApplicationName(applicationName);
this.setApplicationReleaseNotes(applicationReleaseNotes);
System.out.println("Constructor: " + applicationDescription);
this.setApplicationDescription(applicationDescription);
}

/**
Expand Down Expand Up @@ -152,6 +155,19 @@ public void setApplicationReleaseNotes(String applicationReleaseNotes) {
this.applicationReleaseNotes = applicationReleaseNotes;
}

/**
* @return Content of the Descriptopm-File which will be set in the TextField.
*/
public String getApplicationDescription() {
return this.applicationDescription;
}

/**
* @param applicationDescription Content that should be set to the app.
*/
public void setApplicationDescription(String applicationDescription) {
this.applicationDescription = applicationDescription;
}

/**
* Descriptor for {@link DescriptorImpl}. Used as a singleton.
Expand Down Expand Up @@ -193,35 +209,35 @@ public ListBoxModel doFillApiEndpointURLItems() {
return items;
}

/**
* Validates if the enntry in the Inputfield is empty/not empty.
* @param value value of the input field applicationName.
* @return true if an entry exists, false if no entry exists.
* @throws IOException
* @throws ServletException
*/
public FormValidation doCheckApplicationName(@QueryParameter final String value)
throws IOException, ServletException {
if (value.length() == 0) {
return FormValidation.error(Messages.Relution_appName());
}
return FormValidation.ok();
}
// /**
// * Validates if the enntry in the Inputfield is empty/not empty.
// * @param value value of the input field applicationName.
// * @return true if an entry exists, false if no entry exists.
// * @throws IOException
// * @throws ServletException
// */
// public FormValidation doCheckApplicationName(@QueryParameter final String value)
// throws IOException, ServletException {
// if (value.length() == 0) {
// return FormValidation.error(Messages.Relution_appName());
// }
// return FormValidation.ok();
// }

/**
* Validates if the entry in the Inputfield is empty/no empty.
* @param value value of the input field applicationIcon.
* @return true if an entry exists, false if no entry exists.
* @throws IOException
* @throws ServletException
*/
public FormValidation doCheckApplicationIcon(@QueryParameter final String value)
throws IOException, ServletException {
if (value.length() == 0) {
return FormValidation.error(Messages.Relution_apiIconIsRequired());
}
return FormValidation.ok();
}
// /**
// * Validates if the entry in the Inputfield is empty/no empty.
// * @param value value of the input field applicationIcon.
// * @return true if an entry exists, false if no entry exists.
// * @throws IOException
// * @throws ServletException
// */
// public FormValidation doCheckApplicationIcon(@QueryParameter final String value)
// throws IOException, ServletException {
// if (value.length() == 0) {
// return FormValidation.error(Messages.Relution_apiIconIsRequired());
// }
// return FormValidation.ok();
// }

/**
* @return List of ReleaseStatuses that the actual app could have.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@
import org.apache.tools.ant.types.FileSet;
import org.jenkinsci.plugins.relution.entities.ApplicationInformation;
import org.jenkinsci.plugins.relution.entities.ShortApplicationInformation;
import org.jenkinsci.plugins.relution.json.APIObject;
import org.jenkinsci.plugins.relution.net.RequestFactory;

@SuppressWarnings("serial")
public class ApplicationFileCallable implements FileCallable<Boolean> {
Expand Down Expand Up @@ -117,7 +115,7 @@ public Boolean invoke(final File f, final VirtualChannel channel) throws IOExcep
final String uploadedAssetToken = communicator.uploadApplicationAsset("", applicationFile);
// this.listener.getLogger().println("[Relution Publisher]: Uploaded application asset (token " + uploadedAssetToken + ")");
// -----------------------------------------------------------------
final String appObject = communicator.analyzeUploadedApplication(uploadedAssetToken, app.getUUID(), this.application.getApplicationIcon(), this.application.getApiReleaseStatus(), this.application.getApplicationName(), this.application.getApplicationReleaseNotes(), fileSet, communicator);
final String appObject = communicator.analyzeUploadedApplication(uploadedAssetToken, app.getUUID(), this.application.getApplicationIcon(), this.application.getApiReleaseStatus(), this.application.getApplicationName(), this.application.getApplicationReleaseNotes(), this.application.getApplicationDescription(), fileSet, communicator);
if(appObject.equals("Version already exists. Please delete the old one to upload the same version again.")) {
this.listener.getLogger().println("[Relution Publisher]: Version already exists. Please delete the old one to upload the same version again.");
return false;
Expand All @@ -133,6 +131,10 @@ public Boolean invoke(final File f, final VirtualChannel channel) throws IOExcep
e.printStackTrace();
} catch (final URISyntaxException e) {
e.printStackTrace();
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}

return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ public class GlobalConfigurationImpl extends GlobalConfiguration {
private String apiOrganization;
private String response;
private String apiReleaseStatus;
private String gitDescription;

/**
* executed during startup of the Plugin and instantiate different GlobalConfiguration-Objects.
Expand All @@ -96,7 +95,7 @@ public GlobalConfigurationImpl() {
* @param proxyPort
*/
@DataBoundConstructor
public GlobalConfigurationImpl(final String apiEndpoint, final String apiUsername, final String apiPassword, final String apiOrganization, final String apiReleaseStatus, final String gitDescription, final String proxyHost, final int proxyPort) {
public GlobalConfigurationImpl(final String apiEndpoint, final String apiUsername, final String apiPassword, final String apiOrganization, final String apiReleaseStatus, final String proxyHost, final int proxyPort) {
super();
this.load();

Expand All @@ -105,7 +104,6 @@ public GlobalConfigurationImpl(final String apiEndpoint, final String apiUsernam
this.setApiPassword(apiPassword);
this.setApiOrganization(apiOrganization);
this.setApiReleaseStatus(apiReleaseStatus);
this.setGitDescription(gitDescription);
this.setProxyHost(proxyHost);
this.setProxyPort(proxyPort);
}
Expand Down Expand Up @@ -216,10 +214,9 @@ public boolean configure(final StaplerRequest req, final JSONObject formData) th
this.apiPassword = ((JSONObject)jsonArray.get(index)).get("apiPassword").toString();
this.apiOrganization = ((JSONObject)jsonArray.get(index)).get("apiOrganization").toString();
this.apiReleaseStatus = ((JSONObject)jsonArray.get(index)).get("apiReleaseStatus").toString();
this.gitDescription = ((JSONObject)jsonArray.get(index)).get("gitDescription").toString();
this.proxyHost = formData.getString("proxyHost");
this.proxyPort = formData.getInt("proxyPort");
instances.add(new GlobalConfigurationImpl(this.apiEndpoint, this.apiUsername, this.apiPassword, this.apiOrganization, this.apiReleaseStatus, this.gitDescription, this.proxyHost, this.proxyPort));
instances.add(new GlobalConfigurationImpl(this.apiEndpoint, this.apiUsername, this.apiPassword, this.apiOrganization, this.apiReleaseStatus, this.proxyHost, this.proxyPort));
loginCredentials.put(((JSONObject)jsonArray.get(index)).get("apiEndpoint").toString(), this.apiUsername + ":" + this.apiOrganization + ":" + this.apiPassword);
}
}
Expand All @@ -232,10 +229,9 @@ else if(apiEndpoint instanceof JSONObject) {
this.apiPassword = innerObject.get("apiPassword").toString();
this.apiOrganization = innerObject.get("apiOrganization").toString();
this.apiReleaseStatus = innerObject.getString("apiReleaseStatus");
this.gitDescription = innerObject.getString("gitDescription");
this.proxyHost = formData.getString("proxyHost");
this.proxyPort = formData.getInt("proxyPort");
instances.add(new GlobalConfigurationImpl(this.apiEndpoint, this.apiUsername, this.apiPassword, this.apiOrganization, this.apiReleaseStatus, this.gitDescription, this.proxyHost, this.proxyPort));
instances.add(new GlobalConfigurationImpl(this.apiEndpoint, this.apiUsername, this.apiPassword, this.apiOrganization, this.apiReleaseStatus, this.proxyHost, this.proxyPort));
loginCredentials.put(this.apiEndpoint, this.apiUsername + ":" + this.apiOrganization + ":" + this.apiPassword);
}
System.out.println(formData.toString());
Expand Down Expand Up @@ -387,19 +383,4 @@ public void setApiReleaseStatus(String apiReleaseStatus) {
public String getApiReleaseStatus() {
return this.apiReleaseStatus;
}

/**
* @param gitDescription Sets entry of the textfield gitDescription.
*/
public void setGitDescription(String gitDescription) {
this.gitDescription = gitDescription;
}

/**
* @return actual entered ReleaseStatus.
*/
public String getGitDescription() {
return this.gitDescription;
}

}
Loading

0 comments on commit 4c5cd11

Please sign in to comment.