cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Tagging while creating an extesion

aluna
7-Bedrock

Tagging while creating an extesion

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?

3 REPLIES 3
alexe1
12-Amethyst
(To:aluna)

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.

aluna
7-Bedrock
(To:alexe1)

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

  }

}

thearonh
12-Amethyst
(To:aluna)

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.

Announcements


Top Tags