Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X
I am creating an extesion on java using the TW plugin, and I am creating some thingtemplates, I want to tag them but I do not see that option, can someone tell me if that is possible?
Hi Armando,
What does your existing code look like to create your ThingTemplates? That might help provide some insight to what you are having trouble with.
Hi alex, basically I used the sdk documentation and just click on the thingworx perpestive and add a thing template and the code was generated automatically
here is what I have
package iQorSDM_v3_Extention;
import java.io.StringReader;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import javax.swing.text.Document;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathFactory;
import com.thingworx.entities.utils.EntityUtilities;
import com.thingworx.entities.utils.ThingUtilities;
import com.thingworx.logging.LogUtilities;
import com.thingworx.metadata.annotations.ThingworxServiceDefinition;
import com.thingworx.metadata.annotations.ThingworxServiceParameter;
import com.thingworx.metadata.annotations.ThingworxServiceResult;
import com.thingworx.relationships.RelationshipTypes.ThingworxRelationshipTypes;
import com.thingworx.resources.entities.EntityServices;
import com.thingworx.resources.content.*;
import com.thingworx.things.Thing;
import com.thingworx.types.collections.ValueCollection;
import com.thingworx.types.primitives.StringPrimitive;
import com.thingworx.types.primitives.NumberPrimitive;
import com.thingworx.types.primitives.BooleanPrimitive;
import com.thingworx.types.primitives.JSONPrimitive;
import com.thingworx.types.primitives.XMLPrimitive;
import com.thingworx.types.InfoTable;
//
import com.thingworx.types.collections.ValueCollection;
public class iQorSDMWrapper_TimeoutTemplateV3 extends Thing {
public iQorSDMWrapper_TimeoutTemplateV3() {
// TODO Auto-generated constructor stub
}
}
I don't believe that there is a way to add tags through java code.
One way that I have used is to add the 'tags' aspect to the entity in the metadata.xml - here is an example:
<ThingTemplate name="myThingTemplate" tags="Applications:MyCustomTag" ... />
Just make sure that the Tag library that you are using either already has the tag in it, or is set up to be dynamic.
Hope this helps.