Skip to content

Commit

Permalink
Google java code standard
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasbjerre committed Mar 17, 2017
1 parent 12e2273 commit 1dbafea
Show file tree
Hide file tree
Showing 13 changed files with 949 additions and 831 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.factorypath
target
.project
.settings
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Changelog of Violation Comments to Bitbucket Server Plugin.
**Jenkinsfile**


[a46bd8cd4e13233](https://github.com/jenkinsci/violation-comments-to-stash-plugin/commit/a46bd8cd4e13233) Tomas Bjerre *2017-03-04 23:03:28*
[12e227314c669b2](https://github.com/jenkinsci/violation-comments-to-stash-plugin/commit/12e227314c669b2) Tomas Bjerre *2017-03-08 05:27:26*

**doc**

Expand Down
14 changes: 13 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,18 @@ Changelog of Violation Comments to Bitbucket Server Plugin.
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.coveo</groupId>
<artifactId>fmt-maven-plugin</artifactId>
<version>1.3.0</version>
<executions>
<execution>
<goals>
<goal>format</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
Expand Down Expand Up @@ -184,7 +196,7 @@ Changelog of Violation Comments to Bitbucket Server Plugin.
<dependency>
<groupId>se.bjurr.violations</groupId>
<artifactId>violation-comments-to-bitbucket-server-lib</artifactId>
<version>1.21</version>
<version>1.22</version>
</dependency>

<!-- test // -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,70 +29,76 @@
import net.sf.json.JSONObject;

public final class ViolationsToBitbucketServerDescriptor extends BuildStepDescriptor<Publisher> {
private ViolationsToBitbucketServerConfig config;
private ViolationsToBitbucketServerConfig config;

public ViolationsToBitbucketServerDescriptor() {
super(ViolationsToBitbucketServerRecorder.class);
load();
if (config == null
|| config.getViolationConfigs().size() != createNewConfig().getViolationConfigs().size()) {
config = createNewConfig();
}
}

public ListBoxModel doFillUsernamePasswordCredentialsIdItems() {
return CredentialsHelper.doFillUsernamePasswordCredentialsIdItems();
}

@Override
public String getDisplayName() {
return "Report Violations to Bitbucket Server";
}

public ViolationsToBitbucketServerDescriptor() {
super(ViolationsToBitbucketServerRecorder.class);
load();
if (config == null || config.getViolationConfigs().size() != createNewConfig().getViolationConfigs().size()) {
config = createNewConfig();
@Override
public String getHelpFile() {
return super.getHelpFile();
}
}

public ListBoxModel doFillUsernamePasswordCredentialsIdItems() {
return CredentialsHelper.doFillUsernamePasswordCredentialsIdItems();
}

@Override
public String getDisplayName() {
return "Report Violations to Bitbucket Server";
}

@Override
public String getHelpFile() {
return super.getHelpFile();
}

/**
* Create new blank configuration. Used when job is created.
*/
public ViolationsToBitbucketServerConfig getNewConfig() {
return createNewConfig();
}

@Override
public boolean isApplicable(@SuppressWarnings("rawtypes") final Class<? extends AbstractProject> jobType) {
return true;
}

@SuppressWarnings("unchecked")
@Override
public Publisher newInstance(StaplerRequest req, JSONObject formData) throws hudson.model.Descriptor.FormException {
ViolationsToBitbucketServerConfig config = createNewConfig();
config.setBitbucketServerUrl(formData.getString(FIELD_BITBUCKETSERVERURL));
config.setRepoSlug(formData.getString(FIELD_REPOSLUG));
config.setProjectKey(formData.getString(FIELD_PROJECTKEY));
config.setPullRequestId(formData.getString(FIELD_PULLREQUESTID));

config.setUseUsernamePassword(formData.getBoolean(FIELD_USEUSERNAMEPASSWORD));
config.setUsername(formData.getString(FIELD_USERNAME));
config.setPassword(formData.getString(FIELD_PASSWORD));

config.setUseUsernamePasswordCredentials(formData.getBoolean(FIELD_USEUSERNAMEPASSWORDCREDENTIALS));
config.setUsernamePasswordCredentialsId(formData.getString(FIELD_USERNAMEPASSWORDCREDENTIALSID));

config.setCreateCommentWithAllSingleFileComments(
formData.getString(FIELD_CREATECOMMENTWITHALLSINGLEFILECOMMENTS).equalsIgnoreCase("true"));

config.setCreateSingleFileComments(formData.getString(FIELD_CREATESINGLEFILECOMMENTS).equalsIgnoreCase("true"));
config.setCommentOnlyChangedContent(formData.getString(FIELD_COMMENTONLYCHANGEDCONTENT).equalsIgnoreCase("true"));
config.setCommentOnlyChangedContentContext(formData.getInt(FIELD_COMMENTONLYCHANGEDCONTENTCONTEXT));
int i = 0;
for (String pattern : (List<String>) formData.get(FIELD_PATTERN)) {
config.getViolationConfigs().get(i++).setPattern(pattern);

/** Create new blank configuration. Used when job is created. */
public ViolationsToBitbucketServerConfig getNewConfig() {
return createNewConfig();
}

@Override
public boolean isApplicable(
@SuppressWarnings("rawtypes") final Class<? extends AbstractProject> jobType) {
return true;
}

@SuppressWarnings("unchecked")
@Override
public Publisher newInstance(StaplerRequest req, JSONObject formData)
throws hudson.model.Descriptor.FormException {
ViolationsToBitbucketServerConfig config = createNewConfig();
config.setBitbucketServerUrl(formData.getString(FIELD_BITBUCKETSERVERURL));
config.setRepoSlug(formData.getString(FIELD_REPOSLUG));
config.setProjectKey(formData.getString(FIELD_PROJECTKEY));
config.setPullRequestId(formData.getString(FIELD_PULLREQUESTID));

config.setUseUsernamePassword(formData.getBoolean(FIELD_USEUSERNAMEPASSWORD));
config.setUsername(formData.getString(FIELD_USERNAME));
config.setPassword(formData.getString(FIELD_PASSWORD));

config.setUseUsernamePasswordCredentials(
formData.getBoolean(FIELD_USEUSERNAMEPASSWORDCREDENTIALS));
config.setUsernamePasswordCredentialsId(
formData.getString(FIELD_USERNAMEPASSWORDCREDENTIALSID));

config.setCreateCommentWithAllSingleFileComments(
formData.getString(FIELD_CREATECOMMENTWITHALLSINGLEFILECOMMENTS).equalsIgnoreCase("true"));

config.setCreateSingleFileComments(
formData.getString(FIELD_CREATESINGLEFILECOMMENTS).equalsIgnoreCase("true"));
config.setCommentOnlyChangedContent(
formData.getString(FIELD_COMMENTONLYCHANGEDCONTENT).equalsIgnoreCase("true"));
config.setCommentOnlyChangedContentContext(
formData.getInt(FIELD_COMMENTONLYCHANGEDCONTENTCONTEXT));
int i = 0;
for (String pattern : (List<String>) formData.get(FIELD_PATTERN)) {
config.getViolationConfigs().get(i++).setPattern(pattern);
}
ViolationsToBitbucketServerRecorder publisher = new ViolationsToBitbucketServerRecorder();
publisher.setConfig(config);
return publisher;
}
ViolationsToBitbucketServerRecorder publisher = new ViolationsToBitbucketServerRecorder();
publisher.setConfig(config);
return publisher;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,103 +14,112 @@

import com.google.common.base.Optional;

/**
* Created by magnayn on 07/04/2016.
*/
/** Created by magnayn on 07/04/2016. */
@Extension
public class ViolationsToBitbucketServerGlobalConfiguration extends GlobalConfiguration implements Serializable {

private static final long serialVersionUID = -5458709657500220354L;

/**
* Returns this singleton instance.
*
* @return the singleton.
*/
public static Optional<ViolationsToBitbucketServerGlobalConfiguration> get() {
return Optional.fromNullable(GlobalConfiguration.all().get(ViolationsToBitbucketServerGlobalConfiguration.class));
}

public String bitbucketServerUrl;
public String password;
public String projectKey;
public String repoSlug;
public String username;
private String usernamePasswordCredentialsId;

public ViolationsToBitbucketServerGlobalConfiguration() {
load();
}

@Override
public boolean configure(StaplerRequest req, JSONObject json) throws FormException {
req.bindJSON(this, json);
save();
return true;
}

public ListBoxModel doFillUsernamePasswordCredentialsIdItems() {
return CredentialsHelper.doFillUsernamePasswordCredentialsIdItems();
}

public String getBitbucketServerUrl() {
return this.bitbucketServerUrl;
}

public String getPassword() {
return this.password;
}

public String getProjectKey() {
return this.projectKey;
}

public String getRepoSlug() {
return this.repoSlug;
}

public String getUsername() {
return this.username;
}

public String getUsernamePasswordCredentialsId() {
return this.usernamePasswordCredentialsId;
}

@DataBoundSetter
public void setBitbucketServerUrl(String bitbucketServerUrl) {
this.bitbucketServerUrl = bitbucketServerUrl;
}

@DataBoundSetter
public void setPassword(String password) {
this.password = password;
}

@DataBoundSetter
public void setProjectKey(String projectKey) {
this.projectKey = projectKey;
}

@DataBoundSetter
public void setRepoSlug(String repoSlug) {
this.repoSlug = repoSlug;
}

@DataBoundSetter
public void setUsername(String username) {
this.username = username;
}

public void setUsernamePasswordCredentialsId(String usernamePasswordCredentialsId) {
this.usernamePasswordCredentialsId = usernamePasswordCredentialsId;
}

@Override
public String toString() {
return "ViolationsToBitbucketServerGlobalConfiguration [bitbucketServerUrl=" + this.bitbucketServerUrl
+ ", password=" + this.password + ", projectKey=" + this.projectKey + ", repoSlug=" + this.repoSlug + ", username="
+ this.username + ", usernamePasswordCredentialsId=" + this.usernamePasswordCredentialsId + "]";
}

public class ViolationsToBitbucketServerGlobalConfiguration extends GlobalConfiguration
implements Serializable {

private static final long serialVersionUID = -5458709657500220354L;

/**
* Returns this singleton instance.
*
* @return the singleton.
*/
public static Optional<ViolationsToBitbucketServerGlobalConfiguration> get() {
return Optional.fromNullable(
GlobalConfiguration.all().get(ViolationsToBitbucketServerGlobalConfiguration.class));
}

public String bitbucketServerUrl;
public String password;
public String projectKey;
public String repoSlug;
public String username;
private String usernamePasswordCredentialsId;

public ViolationsToBitbucketServerGlobalConfiguration() {
load();
}

@Override
public boolean configure(StaplerRequest req, JSONObject json) throws FormException {
req.bindJSON(this, json);
save();
return true;
}

public ListBoxModel doFillUsernamePasswordCredentialsIdItems() {
return CredentialsHelper.doFillUsernamePasswordCredentialsIdItems();
}

public String getBitbucketServerUrl() {
return this.bitbucketServerUrl;
}

public String getPassword() {
return this.password;
}

public String getProjectKey() {
return this.projectKey;
}

public String getRepoSlug() {
return this.repoSlug;
}

public String getUsername() {
return this.username;
}

public String getUsernamePasswordCredentialsId() {
return this.usernamePasswordCredentialsId;
}

@DataBoundSetter
public void setBitbucketServerUrl(String bitbucketServerUrl) {
this.bitbucketServerUrl = bitbucketServerUrl;
}

@DataBoundSetter
public void setPassword(String password) {
this.password = password;
}

@DataBoundSetter
public void setProjectKey(String projectKey) {
this.projectKey = projectKey;
}

@DataBoundSetter
public void setRepoSlug(String repoSlug) {
this.repoSlug = repoSlug;
}

@DataBoundSetter
public void setUsername(String username) {
this.username = username;
}

public void setUsernamePasswordCredentialsId(String usernamePasswordCredentialsId) {
this.usernamePasswordCredentialsId = usernamePasswordCredentialsId;
}

@Override
public String toString() {
return "ViolationsToBitbucketServerGlobalConfiguration [bitbucketServerUrl="
+ this.bitbucketServerUrl
+ ", password="
+ this.password
+ ", projectKey="
+ this.projectKey
+ ", repoSlug="
+ this.repoSlug
+ ", username="
+ this.username
+ ", usernamePasswordCredentialsId="
+ this.usernamePasswordCredentialsId
+ "]";
}
}
Loading

0 comments on commit 1dbafea

Please sign in to comment.