aboutsummaryrefslogtreecommitdiff
path: root/src/musichub/business/AudioElement.java
diff options
context:
space:
mode:
authorClyhtsuriva <aimeric@adjutor.xyz>2021-06-26 12:34:26 +0200
committerClyhtsuriva <aimeric@adjutor.xyz>2021-06-26 12:34:26 +0200
commite64ffae239b19871704b4ac1e9cd58275ed58622 (patch)
treeb7586af24fc281116a2913eaa9f4d8d849468d3b /src/musichub/business/AudioElement.java
parente38c5887682b13b7d9dadc822c02654939fc7401 (diff)
Changed the architecture to respect maven and generated an empty javadoc
Diffstat (limited to 'src/musichub/business/AudioElement.java')
-rw-r--r--src/musichub/business/AudioElement.java88
1 files changed, 0 insertions, 88 deletions
diff --git a/src/musichub/business/AudioElement.java b/src/musichub/business/AudioElement.java
deleted file mode 100644
index e0a686b..0000000
--- a/src/musichub/business/AudioElement.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package musichub.business;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-import java.util.UUID;
-
-public abstract class AudioElement {
- protected String title;
- protected String artist;
- protected int lengthInSeconds;
- protected UUID uuid;
- protected String content;
-
- public AudioElement(String title, String artist, int lengthInSeconds, String id, String content) {
- this.title = title;
- this.artist = artist;
- this.lengthInSeconds = lengthInSeconds;
- this.uuid = UUID.fromString(id);
- this.content = content;
- }
-
- public AudioElement(String title, String artist, int lengthInSeconds, String content) {
- this.title = title;
- this.artist = artist;
- this.lengthInSeconds = lengthInSeconds;
- this.content = content;
- this.uuid = UUID.randomUUID();
- }
-
- public AudioElement(Element xmlElement) {
- {
- title = xmlElement.getElementsByTagName("title").item(0).getTextContent();
- artist = xmlElement.getElementsByTagName("artist").item(0).getTextContent();
- lengthInSeconds = Integer.parseInt(xmlElement.getElementsByTagName("length").item(0).getTextContent());
- content = xmlElement.getElementsByTagName("content").item(0).getTextContent();
- String uuid = null;
- try {
- uuid = xmlElement.getElementsByTagName("UUID").item(0).getTextContent();
- } catch (Exception ex) {
- System.out.println("Empty element UUID, will create a new one");
- }
- if ((uuid == null) || (uuid.isEmpty()))
- this.uuid = UUID.randomUUID();
- else this.uuid = UUID.fromString(uuid);
- }
- }
-
- public UUID getUUID() {
- return this.uuid;
- }
-
- public String getArtist() {
- return this.artist;
- }
-
- public String getTitle() {
- return this.title;
- }
-
- public String toString() {
- return "Title = " + this.title + ", Artist = " + this.artist + ", Length = " + this.lengthInSeconds + ", Content = " + this.content;
- }
-
- public void createXMLElement(Document document, Element parentElement) {
- Element nameElement = document.createElement("title");
- nameElement.appendChild(document.createTextNode(title));
- parentElement.appendChild(nameElement);
-
- Element artistElement = document.createElement("artist");
- artistElement.appendChild(document.createTextNode(artist));
- parentElement.appendChild(artistElement);
-
- Element lengthElement = document.createElement("length");
- lengthElement.appendChild(document.createTextNode(Integer.valueOf(lengthInSeconds).toString()));
- parentElement.appendChild(lengthElement);
-
- Element UUIDElement = document.createElement("UUID");
- UUIDElement.appendChild(document.createTextNode(uuid.toString()));
- parentElement.appendChild(UUIDElement);
-
- Element contentElement = document.createElement("content");
- contentElement.appendChild(document.createTextNode(content));
- parentElement.appendChild(contentElement);
-
- }
-
-} \ No newline at end of file