package won.bot.framework.eventbot.behaviour.botatom;

import org.apache.jena.query.Dataset;
import org.apache.jena.rdf.model.Resource;
import org.apache.jena.vocabulary.RDF;
import won.bot.vocabulary.WXBOT;
import won.protocol.util.DefaultAtomModelWrapper;
import won.protocol.vocabulary.WXCHAT;
import won.protocol.vocabulary.WXHOLD;
import won.protocol.vocabulary.WXREVIEW;

import java.net.URI;

public class ServiceAtomModelWrapper extends DefaultAtomModelWrapper {
    // TODO: ADD MORE SERVICE BOT ATOM CONTENT MAKE SOCKETS CONFIGURABLE
    private ServiceAtomContent serviceAtomContent;

    public ServiceAtomModelWrapper(URI atomUri, ServiceAtomContent serviceAtomContent) {
        this(atomUri.toString(), serviceAtomContent);
    }

    public ServiceAtomModelWrapper(String atomUri, ServiceAtomContent serviceAtomContent) {
        super(atomUri);
        // SET CONTENT OBJECT
        this.serviceAtomContent = serviceAtomContent;
        Resource atom = this.getAtomModel().createResource(atomUri.toString());
        atom.addProperty(RDF.type, WXBOT.ServiceAtom);
        // SET RDF STRUCTURE
        this.setTitle(serviceAtomContent.getName());
        this.setDescription(serviceAtomContent.getDescription());
        this.addSocket("#HolderSocket", WXHOLD.HolderSocketString);
        this.addSocket("#ChatSocket", WXCHAT.ChatSocketString);
        this.addSocket("#ReviewSocket", WXREVIEW.ReviewSocketString);
    }

    public ServiceAtomModelWrapper(Dataset atomDataset) {
        super(atomDataset);
        serviceAtomContent = new ServiceAtomContent(this.getSomeTitleFromIsOrAll());
        serviceAtomContent.setDescription(this.getSomeDescription());
    }

    public ServiceAtomContent getServiceAtomContent() {
        return serviceAtomContent;
    }
}

@@ -391,16 +391,42 @@
 net.URI;
+%0Aimport java.util.Objects;
 %0A%0Apublic
@@ -961,24 +961,53 @@
 tomContent;%0A
+        // SET RDF STRUCTURE%0A
         Reso
@@ -1133,156 +1133,8 @@
 m);%0A
-        // SET RDF STRUCTURE%0A        this.setTitle(serviceAtomContent.getName());%0A        this.setDescription(serviceAtomContent.getDescription());%0A
     
@@ -1327,24 +1327,225 @@
 ketString);%0A
+        this.setTitle(serviceAtomContent.getName());%0A        if (Objects.nonNull(serviceAtomContent.getDescription())) %7B%0A            this.setDescription(serviceAtomContent.getDescription());%0A        %7D%0A
     %7D%0A%0A    p

Add nonNull check for serviceAtom Description