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

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

Import entities from Source Control - Java Extension SDK

AlessandroN
12-Amethyst

Import entities from Source Control - Java Extension SDK

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?

ACCEPTED SOLUTION

Accepted Solutions

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.

 

View solution in original post

3 REPLIES 3
slangley
23-Emerald II
(To:AlessandroN)

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

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.

 

slangley
23-Emerald II
(To:slangley)

Hi @AlessandroN.

 

Glad to hear you solved your issue.

 

For the benefit of others with the same question, please mark your last post as the Accepted Solution.

 

Thank you for your participation in our community!

 

Regards.

 

--Sharon

Announcements


Top Tags