Files
github-api/jacoco/org.kohsuke.github/GHProjectCard.java.html
2021-06-02 11:09:28 -07:00

228 lines
8.1 KiB
HTML

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>GHProjectCard.java</title><link rel="stylesheet" href="../jacoco-resources/prettify.css" type="text/css"/><script type="text/javascript" src="../jacoco-resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">GitHub API for Java</a> &gt; <a href="index.source.html" class="el_package">org.kohsuke.github</a> &gt; <span class="el_source">GHProjectCard.java</span></div><h1>GHProjectCard.java</h1><pre class="source lang-java linenums">package org.kohsuke.github;
import org.apache.commons.lang3.StringUtils;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URL;
import static org.kohsuke.github.internal.Previews.INERTIA;
/**
* The type GHProjectCard.
*
* @author Gunnar Skjold
*/
<span class="fc" id="L16">public class GHProjectCard extends GHObject {</span>
private GHProject project;
private GHProjectColumn column;
private String note;
private GHUser creator;
private String content_url, project_url, column_url;
private boolean archived;
public URL getHtmlUrl() throws IOException {
<span class="nc" id="L26"> return null;</span>
}
/**
* Wrap gh project card.
*
* @param root
* the root
* @return the gh project card
*/
public GHProjectCard wrap(GitHub root) {
<span class="fc" id="L37"> this.root = root;</span>
<span class="fc" id="L38"> return this;</span>
}
/**
* Wrap gh project card.
*
* @param column
* the column
* @return the gh project card
*/
public GHProjectCard wrap(GHProjectColumn column) {
<span class="fc" id="L49"> this.column = column;</span>
<span class="fc" id="L50"> this.project = column.project;</span>
<span class="fc" id="L51"> this.root = column.root;</span>
<span class="fc" id="L52"> return this;</span>
}
/**
* Gets root.
*
* @return the root
*/
public GitHub getRoot() {
<span class="nc" id="L61"> return root;</span>
}
/**
* Gets project.
*
* @return the project
* @throws IOException
* the io exception
*/
public GHProject getProject() throws IOException {
<span class="nc bnc" id="L72" title="All 2 branches missed."> if (project == null) {</span>
try {
<span class="nc" id="L74"> project = root.createRequest().withUrlPath(getProjectUrl().getPath()).fetch(GHProject.class).wrap(root);</span>
<span class="nc" id="L75"> } catch (FileNotFoundException e) {</span>
<span class="nc" id="L76"> return null;</span>
<span class="nc" id="L77"> }</span>
}
<span class="nc" id="L79"> return project;</span>
}
/**
* Gets column.
*
* @return the column
* @throws IOException
* the io exception
*/
public GHProjectColumn getColumn() throws IOException {
<span class="nc bnc" id="L90" title="All 2 branches missed."> if (column == null) {</span>
try {
<span class="nc" id="L92"> column = root.createRequest()</span>
<span class="nc" id="L93"> .withUrlPath(getColumnUrl().getPath())</span>
<span class="nc" id="L94"> .fetch(GHProjectColumn.class)</span>
<span class="nc" id="L95"> .wrap(root);</span>
<span class="nc" id="L96"> } catch (FileNotFoundException e) {</span>
<span class="nc" id="L97"> return null;</span>
<span class="nc" id="L98"> }</span>
}
<span class="nc" id="L100"> return column;</span>
}
/**
* Gets content.
*
* @return the content
* @throws IOException
* the io exception
*/
public GHIssue getContent() throws IOException {
<span class="nc bnc" id="L111" title="All 2 branches missed."> if (StringUtils.isEmpty(content_url))</span>
<span class="nc" id="L112"> return null;</span>
try {
<span class="nc bnc" id="L114" title="All 2 branches missed."> if (content_url.contains(&quot;/pulls&quot;)) {</span>
<span class="nc" id="L115"> return root.createRequest()</span>
<span class="nc" id="L116"> .withUrlPath(getContentUrl().getPath())</span>
<span class="nc" id="L117"> .fetch(GHPullRequest.class)</span>
<span class="nc" id="L118"> .wrap(root);</span>
} else {
<span class="nc" id="L120"> return root.createRequest().withUrlPath(getContentUrl().getPath()).fetch(GHIssue.class).wrap(root);</span>
}
<span class="nc" id="L122"> } catch (FileNotFoundException e) {</span>
<span class="nc" id="L123"> return null;</span>
}
}
/**
* Gets note.
*
* @return the note
*/
public String getNote() {
<span class="fc" id="L133"> return note;</span>
}
/**
* Gets creator.
*
* @return the creator
*/
public GHUser getCreator() {
<span class="nc" id="L142"> return creator;</span>
}
/**
* Gets content url.
*
* @return the content url
*/
public URL getContentUrl() {
<span class="fc" id="L151"> return GitHubClient.parseURL(content_url);</span>
}
/**
* Gets project url.
*
* @return the project url
*/
public URL getProjectUrl() {
<span class="nc" id="L160"> return GitHubClient.parseURL(project_url);</span>
}
/**
* Gets column url.
*
* @return the column url
*/
public URL getColumnUrl() {
<span class="nc" id="L169"> return GitHubClient.parseURL(column_url);</span>
}
/**
* Is archived boolean.
*
* @return the boolean
*/
public boolean isArchived() {
<span class="fc" id="L178"> return archived;</span>
}
/**
* Sets note.
*
* @param note
* the note
* @throws IOException
* the io exception
*/
public void setNote(String note) throws IOException {
<span class="fc" id="L190"> edit(&quot;note&quot;, note);</span>
<span class="fc" id="L191"> }</span>
/**
* Sets archived.
*
* @param archived
* the archived
* @throws IOException
* the io exception
*/
public void setArchived(boolean archived) throws IOException {
<span class="fc" id="L202"> edit(&quot;archived&quot;, archived);</span>
<span class="fc" id="L203"> }</span>
private void edit(String key, Object value) throws IOException {
<span class="fc" id="L206"> root.createRequest().method(&quot;PATCH&quot;).withPreview(INERTIA).with(key, value).withUrlPath(getApiRoute()).send();</span>
<span class="fc" id="L207"> }</span>
/**
* Gets api route.
*
* @return the api route
*/
protected String getApiRoute() {
<span class="fc" id="L215"> return String.format(&quot;/projects/columns/cards/%d&quot;, getId());</span>
}
/**
* Delete.
*
* @throws IOException
* the io exception
*/
public void delete() throws IOException {
<span class="fc" id="L225"> root.createRequest().withPreview(INERTIA).method(&quot;DELETE&quot;).withUrlPath(getApiRoute()).send();</span>
<span class="fc" id="L226"> }</span>
}
</pre><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.8.7.202105040129</span></div></body></html>