Skip to main content
14-Alexandrite
September 9, 2019
Solved

ConfigurationTable in ThingShapes / Where does it show up?

  • September 9, 2019
  • 15 replies
  • 4865 views

Hello,

 

I started to develop some Java-Extensions to solve some issues, that we where not able to solve with pure javascript. For some of these functional modules it would be interesting to have them as ThingShape to enable reuse on different Things.

The Eclipse-Plugin allows me to add a ConfigurationTable to the ThingShape and everything compiles properly.

But when I use this ThingShape, I can not see my ConfigurationTable entries anywhere?

 

Ok my first use example, we would like to have a TimerShape that behaves similar like TimerTemplate:

@ThingworxConfigurationTableDefinitions(tables = {
		@ThingworxConfigurationTableDefinition(name = "Settings", description = "General Settings", isMultiRow = false, ordinal = 0, dataShape = @ThingworxDataShapeDefinition( fields = {
				@com.thingworx.metadata.annotations.ThingworxFieldDefinition(name="updateRate", description="Update rate", baseType="NUMBER", aspects={"defaultValue:60000"}), 
				@com.thingworx.metadata.annotations.ThingworxFieldDefinition(name="enabled", description="Automatically enable timer on startup", baseType="BOOLEAN", aspects={"defaultValue:true"}), 
				@com.thingworx.metadata.annotations.ThingworxFieldDefinition(name="runAsUser", description="User context in which to run event handlers", baseType="USERNAME") 
			}))
		})
public class TimerTS {

//	private static Logger _logger = LogUtilities.getInstance().getApplicationLogger(TimerTS.class);

	public TimerTS() {
		// TODO Auto-generated constructor stub
	}

	@ThingworxServiceDefinition(name = "OnTimerTick", description = "Called by timer each time the it is triggered ...", category = "Timer", isAllowOverride = true )
	@ThingworxServiceResult(name = "Result", description = "", baseType = "NOTHING", aspects = {})
	public void OnTimerTick(
			@ThingworxServiceParameter(name = "Timestamp", description = "\t", baseType = "DATETIME") DateTime Timestamp) {
	}

}

 

 

 

Best answer by Constantine

@atondorf 

 

On the second thought it looks like I found a workable solution -- you can define configuration via in the metadata / entity XML where you reference your class name. The easiest way to do this would be to add it on some dummy thing shape in the Composer, then export it for source control, pick ConfigurationTableDefinitions / ConfigurationTables blocks from this XML file and paste it into your XML where you define ThingShapes (metadata.xml in my case, even though it's not recommended).

 

I've just tried it in 8.4.3 -- and it worked, my Java thing shape got a configuration.

 

/ Constantine

15 replies

Support
September 10, 2019

Hi @atondorf.

 

Which version of ThingWorx are you running?  It appears this issue was corrected in ThingWorx 8.4.4.

 

Regards.

 

--Sharon

atondorf14-AlexandriteAuthor
14-Alexandrite
September 11, 2019

Hi Sharon,

 

we have 8.4.4 and after your comment I tested it with a ThingShape created in the Composer .. it's working.

But still not with my shape created as a JavaExtension in Eclipse. So there must be something wrong with the source code. But it is just blank code created by the eclipse thingworx assistant. 

Support
October 30, 2019

Hi @atondorf.

 

Were you able to find a solution to your problem?  If so, we encourage you to post it here for the benefit of others on the community.

 

Regards.

 

--Sharon

atondorf14-AlexandriteAuthor
14-Alexandrite
October 30, 2019

No solution, yet ... do you have any idea?

18-Opal
October 30, 2019

@atondorf 

 

On the second thought it looks like I found a workable solution -- you can define configuration via in the metadata / entity XML where you reference your class name. The easiest way to do this would be to add it on some dummy thing shape in the Composer, then export it for source control, pick ConfigurationTableDefinitions / ConfigurationTables blocks from this XML file and paste it into your XML where you define ThingShapes (metadata.xml in my case, even though it's not recommended).

 

I've just tried it in 8.4.3 -- and it worked, my Java thing shape got a configuration.

 

/ Constantine