forked from aaronjwhiteside/pipeline-github
-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #51 from jenkinsci/improved-milestone-support
Improve support for getting and setting a PRs milestone
- Loading branch information
Showing
9 changed files
with
261 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
src/main/java/org/jenkinsci/plugins/pipeline/github/MilestoneGroovyObject.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
package org.jenkinsci.plugins.pipeline.github; | ||
|
||
import groovy.lang.GroovyObjectSupport; | ||
import org.eclipse.egit.github.core.Milestone; | ||
import org.jenkinsci.plugins.pipeline.github.client.ExtendedMilestone; | ||
import org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.Whitelisted; | ||
|
||
import java.io.Serializable; | ||
import java.util.Date; | ||
|
||
/** | ||
* Groovy wrapper over {@link Milestone} | ||
* | ||
* @author Aaron Whiteside | ||
* @see Milestone | ||
*/ | ||
public class MilestoneGroovyObject extends GroovyObjectSupport implements Serializable { | ||
private static final long serialVersionUID = 1L; | ||
|
||
private final ExtendedMilestone milestone; | ||
|
||
MilestoneGroovyObject(final ExtendedMilestone milestone) { | ||
this.milestone = milestone; | ||
} | ||
|
||
@Whitelisted | ||
public Date getCreatedAt() { | ||
return milestone.getCreatedAt(); | ||
} | ||
|
||
@Whitelisted | ||
public Date getDueOn() { | ||
return milestone.getDueOn(); | ||
} | ||
|
||
@Whitelisted | ||
public int getClosedIssues() { | ||
return milestone.getClosedIssues(); | ||
} | ||
|
||
@Whitelisted | ||
public int getNumber() { | ||
return milestone.getNumber(); | ||
} | ||
|
||
@Whitelisted | ||
public int getOpenIssues() { | ||
return milestone.getOpenIssues(); | ||
} | ||
|
||
@Whitelisted | ||
public String getDescription() { | ||
return milestone.getDescription(); | ||
} | ||
|
||
@Whitelisted | ||
public String getState() { | ||
return milestone.getState(); | ||
} | ||
|
||
@Whitelisted | ||
public String getTitle() { | ||
return milestone.getTitle(); | ||
} | ||
|
||
@Whitelisted | ||
public String getUrl() { | ||
return milestone.getUrl(); | ||
} | ||
|
||
@Whitelisted | ||
public String getCreator() { | ||
return milestone.getCreator().getLogin(); | ||
} | ||
|
||
@Whitelisted | ||
public Date getUpdatedAt() { | ||
return milestone.getUpdatedAt(); | ||
} | ||
|
||
@Whitelisted | ||
public Date getClosedAt() { | ||
return milestone.getClosedAt(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/main/java/org/jenkinsci/plugins/pipeline/github/client/ExtendedMilestone.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.jenkinsci.plugins.pipeline.github.client; | ||
|
||
import org.eclipse.egit.github.core.Milestone; | ||
import org.eclipse.egit.github.core.util.DateUtils; | ||
|
||
import java.util.Date; | ||
|
||
/** | ||
* @author Aaron Whiteside | ||
*/ | ||
public class ExtendedMilestone extends Milestone { | ||
private static final long serialVersionUID = 8017385076255266092L; | ||
|
||
private Date updatedAt; | ||
private Date closedAt; | ||
|
||
public Date getUpdatedAt() { | ||
return DateUtils.clone(this.updatedAt); | ||
} | ||
|
||
public void setUpdatedAt(final Date updatedAt) { | ||
this.updatedAt = DateUtils.clone(updatedAt); | ||
} | ||
|
||
public Date getClosedAt() { | ||
return DateUtils.clone(this.closedAt); | ||
} | ||
|
||
public void setClosedAt(final Date closedAt) { | ||
this.closedAt = DateUtils.clone(closedAt); | ||
} | ||
} |
Oops, something went wrong.