Skip to main content
12-Amethyst
October 12, 2020
Solved

Import entities from Source Control - Java Extension SDK

  • October 12, 2020
  • 1 reply
  • 2028 views

Hi,

i'm trying to build a Thingworx Extension service who has to Export and Import entities from a Source Control thing.
I've already built the "Export", invoking SourceControlFunctions resource and its ExportSourceControlledEntities service.

 

 

@ThingworxServiceDefinition(name = "ExportEntitiesToFileRepository", description = "Esporta le entities di una collection/project nel path specificato della thing File Repository indicata nella configurazione.\r\nNON ESEGUE NESSUNA ATTIVITA' di source control", category = "", isAllowOverride = false, aspects = {
			"isAsync:false" })
	@ThingworxServiceResult(name = "Result", description = "", baseType = "BOOLEAN", aspects = {})
	public Boolean ExportEntitiesToFileRepository() {
		
		String repositoryThingName = getStringConfigurationSetting("Configuration", "repository_thing");
		_logger.error("Repository Thing: "+repositoryThingName);
		
		SourceControlFunctions scf = (SourceControlFunctions) EntityUtilities.findEntity("SourceControlFunctions", ThingworxRelationshipTypes.Resource);
		try {
			Thing fsThing = (Thing)EntityUtilities.findEntity(repositoryThingName, ThingworxRelationshipTypes.Thing);
			if(fsThing != null) {
				scf.ExportSourceControlledEntities(repositoryThingName, null, "Things", null, null, null, null, false);
				return true;
			}
			_logger.error("the Repository Thing specified doesn't exists!");
		} catch (Exception e) {
			e.printStackTrace();
			_logger.error(e.getMessage());
		}
		
		return false;
	}

 

 



Despite the SourceControlFunctions resource has a ImportSourceControlledEntities  service on the THingowrx Composer, I can't find the same service on the Java library, since this entity seems doesn't have an implementation of this method.
How can I achieve this?

Best answer by AlessandroN

Hi, @slangley 

after some research i found the Thingworx GIT Extension on Github, both for 8.4/8.5 and 9.0.

Actually this is a new version, totally renewed from the last one i used years ago and it answers to all my needs.

 

1 reply

Community Manager
October 27, 2020

Hi @AlessandroN.

 

This doesn't actually answer your question and the content is a little old, but it may be helpful in providing some insight and possibly an alternative to what you need to do.

 

Let us know if you still prefer using the java SDK and we can check with R&D on the service that appears to be missing.

 

Regards.

 

--Sharon

AlessandroN12-AmethystAuthorAnswer
12-Amethyst
October 27, 2020

Hi, @slangley 

after some research i found the Thingworx GIT Extension on Github, both for 8.4/8.5 and 9.0.

Actually this is a new version, totally renewed from the last one i used years ago and it answers to all my needs.