aboutsummaryrefslogtreecommitdiff
path: root/target/site/jacoco/musichub.business/PlayList.java.html
diff options
context:
space:
mode:
authorClyhtsuriva <61652557+clyhtsuriva@users.noreply.github.com>2021-06-28 21:40:03 +0000
committerGitHub <noreply@github.com>2021-06-28 21:40:03 +0000
commit1504d0255279133668b85f5c092f040a14fbc35f (patch)
tree0c9b9e927aa4d5f35ccc07e45e8abd973b2bad08 /target/site/jacoco/musichub.business/PlayList.java.html
parent48d56d9db8fe93f1e1799674fefabdfc677d2eb7 (diff)
parent49196ae84aea338dbc6cd10f4d135e4b717cdd1f (diff)
Merge pull request #23 from Said-Belhadj/developHEADmaster
Merging develop to master.
Diffstat (limited to 'target/site/jacoco/musichub.business/PlayList.java.html')
-rw-r--r--target/site/jacoco/musichub.business/PlayList.java.html101
1 files changed, 101 insertions, 0 deletions
diff --git a/target/site/jacoco/musichub.business/PlayList.java.html b/target/site/jacoco/musichub.business/PlayList.java.html
new file mode 100644
index 0000000..3c1eb72
--- /dev/null
+++ b/target/site/jacoco/musichub.business/PlayList.java.html
@@ -0,0 +1,101 @@
+<?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="fr"><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>PlayList.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">spoteezer</a> &gt; <a href="index.source.html" class="el_package">musichub.business</a> &gt; <span class="el_source">PlayList.java</span></div><h1>PlayList.java</h1><pre class="source lang-java linenums">package musichub.business;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import java.util.ArrayList;
+import java.util.UUID;
+
+public class PlayList {
+ private final String title;
+ private final UUID uuid;
+ private ArrayList&lt;UUID&gt; elementUUIDs;
+
+<span class="fc" id="L16"> public PlayList(String title, String id, ArrayList&lt;UUID&gt; elementUUIDs) {</span>
+<span class="fc" id="L17"> this.title = title;</span>
+<span class="fc" id="L18"> this.uuid = UUID.fromString(id);</span>
+<span class="fc" id="L19"> this.elementUUIDs = elementUUIDs;</span>
+<span class="fc" id="L20"> }</span>
+
+<span class="fc" id="L22"> public PlayList(String title) {</span>
+<span class="fc" id="L23"> this.title = title;</span>
+<span class="fc" id="L24"> this.uuid = UUID.randomUUID();</span>
+<span class="fc" id="L25"> this.elementUUIDs = new ArrayList&lt;&gt;();</span>
+<span class="fc" id="L26"> }</span>
+
+<span class="fc" id="L28"> public PlayList(Element xmlElement) {</span>
+ {
+<span class="fc" id="L30"> this.title = xmlElement.getElementsByTagName(&quot;title&quot;).item(0).getTextContent();</span>
+
+<span class="fc" id="L32"> String uuid = null;</span>
+ try {
+<span class="fc" id="L34"> uuid = xmlElement.getElementsByTagName(&quot;UUID&quot;).item(0).getTextContent();</span>
+<span class="nc" id="L35"> } catch (Exception ex) {</span>
+<span class="nc" id="L36"> System.out.println(&quot;Empty playlist UUID, will create a new one&quot;);</span>
+<span class="fc" id="L37"> }</span>
+<span class="pc bpc" id="L38" title="2 of 4 branches missed."> if ((uuid == null) || (uuid.isEmpty()))</span>
+<span class="nc" id="L39"> this.uuid = UUID.randomUUID();</span>
+<span class="fc" id="L40"> else this.uuid = UUID.fromString(uuid);</span>
+
+ //parse list of elements:
+<span class="fc" id="L43"> Node elementsElement = xmlElement.getElementsByTagName(&quot;elements&quot;).item(0);</span>
+<span class="fc" id="L44"> NodeList elementUUIDNodes = elementsElement.getChildNodes();</span>
+<span class="pc bpc" id="L45" title="1 of 2 branches missed."> if (elementUUIDNodes == null) return;</span>
+
+<span class="fc" id="L47"> this.elementUUIDs = new ArrayList&lt;&gt;();</span>
+
+
+<span class="fc bfc" id="L50" title="All 2 branches covered."> for (int i = 0; i &lt; elementUUIDNodes.getLength(); i++) {</span>
+<span class="fc bfc" id="L51" title="All 2 branches covered."> if (elementUUIDNodes.item(i).getNodeType() == Node.ELEMENT_NODE) {</span>
+<span class="fc" id="L52"> Element elementElement = (Element) elementUUIDNodes.item(i);</span>
+<span class="pc bpc" id="L53" title="1 of 2 branches missed."> if (elementElement.getNodeName().equals(&quot;UUID&quot;)) {</span>
+ try {
+<span class="fc" id="L55"> this.addElement(UUID.fromString(elementElement.getTextContent()));</span>
+<span class="nc" id="L56"> } catch (Exception ex) {</span>
+<span class="nc" id="L57"> ex.printStackTrace();</span>
+<span class="fc" id="L58"> }</span>
+ }
+ }
+ }
+ }
+<span class="fc" id="L63"> }</span>
+
+ public void addElement(UUID element) {
+<span class="fc" id="L66"> elementUUIDs.add(element);</span>
+<span class="fc" id="L67"> }</span>
+
+ public ArrayList&lt;UUID&gt; getElements() {
+<span class="fc" id="L70"> return elementUUIDs;</span>
+ }
+
+ public String getTitle() {
+<span class="fc" id="L74"> return title;</span>
+ }
+
+ public void createXMLElement(Document document, Element parentElement) {
+<span class="fc" id="L78"> Element playlistElement = document.createElement(&quot;playlist&quot;);</span>
+<span class="fc" id="L79"> parentElement.appendChild(playlistElement);</span>
+
+<span class="fc" id="L81"> Element nameElement = document.createElement(&quot;title&quot;);</span>
+<span class="fc" id="L82"> nameElement.appendChild(document.createTextNode(title));</span>
+<span class="fc" id="L83"> playlistElement.appendChild(nameElement);</span>
+
+<span class="fc" id="L85"> Element UUIDElement = document.createElement(&quot;UUID&quot;);</span>
+<span class="fc" id="L86"> UUIDElement.appendChild(document.createTextNode(uuid.toString()));</span>
+<span class="fc" id="L87"> playlistElement.appendChild(UUIDElement);</span>
+
+
+<span class="fc" id="L90"> Element elementsElement = document.createElement(&quot;elements&quot;);</span>
+<span class="pc bpc" id="L91" title="1 of 2 branches missed."> for (UUID currentUUID : this.elementUUIDs) {</span>
+
+<span class="nc" id="L93"> Element elementUUIDElement = document.createElement(&quot;UUID&quot;);</span>
+<span class="nc" id="L94"> elementUUIDElement.appendChild(document.createTextNode(currentUUID.toString()));</span>
+<span class="nc" id="L95"> elementsElement.appendChild(elementUUIDElement);</span>
+<span class="nc" id="L96"> }</span>
+<span class="fc" id="L97"> playlistElement.appendChild(elementsElement);</span>
+<span class="fc" id="L98"> }</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> \ No newline at end of file