当前位置: 首页>>代码示例>>Java>>正文


Java IArchimateModel类代码示例

本文整理汇总了Java中com.archimatetool.model.IArchimateModel的典型用法代码示例。如果您正苦于以下问题:Java IArchimateModel类的具体用法?Java IArchimateModel怎么用?Java IArchimateModel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IArchimateModel类属于com.archimatetool.model包,在下文中一共展示了IArchimateModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: askModelUserInfo

import com.archimatetool.model.IArchimateModel; //导入依赖的package包/类
private boolean askModelUserInfo(IArchimateModel model) throws DialogCancelException {
	NewModelDialog dialog = new NewModelDialog(Display.getCurrent().getActiveShell(), true, true);
	dialog.setBranchList(gitRepo.getBranchList());
	dialog.create();
	int returnCode = dialog.open();
	
	if(returnCode == NewModelDialog.CANCEL)
		throw new DialogCancelException("User cancelled at model user info dialog");
	
	String remoteBranch = dialog.getBranchToSaveTo();
	this.createModelProperty(model, IVersionModelPropertyConstants.MODEL_USER_PROPERTY_NAME, dialog.getModelUser());
	this.createModelProperty(model, IVersionModelPropertyConstants.MODEL_USER_EMAIL_NAME, dialog.getModelUserEmail());
	this.createModelProperty(model, IVersionModelPropertyConstants.MODEL_REPO_BRANCH_PROPERTY_NAME, remoteBranch.substring(remoteBranch.lastIndexOf('/')+1));

	chosenBranch = dialog.getChosenBranchToImportFrom();
	
	if(remoteBranch.equals(chosenBranch))
		return false;
	else
		return true;
}
 
开发者ID:CymaLtd,项目名称:ArchiGITPlugin,代码行数:22,代码来源:LocalRepositoryImport.java

示例2: createModelObjects

import com.archimatetool.model.IArchimateModel; //导入依赖的package包/类
private void createModelObjects(IArchimateModel model, Map objects) {
	for(Object objectKey: objects.keySet()) {
		String elementId = (String) objectKey;
		Map objectFeatureMap = (Map) objects.get(elementId);
		
		IArchimateElement element = (IArchimateElement)IArchimateFactory.eINSTANCE.create((EClass)IArchimatePackage.eINSTANCE.getEClassifier((String)objectFeatureMap.get(VersionElementAttribute.ELEMENT_TYPE.getKeyName())));
		element.setId((String)objectFeatureMap.get(VersionElementAttribute.ID.getKeyName()));
		element.setName((String)objectFeatureMap.get(VersionElementAttribute.NAME.getKeyName()));
		element.setDocumentation((String)objectFeatureMap.get(VersionElementAttribute.DOCUMENTATION.getKeyName()));
		
		List elementProperties = (ArrayList)objectFeatureMap.get(VersionElementAttribute.PROPERTIES.getKeyName());
		element.getProperties().addAll(elementProperties);
		
		String folderString = (String)objectFeatureMap.get(VersionElementAttribute.FOLDER_PATH.getKeyName());
		IFolder typeFolder = model.getDefaultFolderForElement(element);
		
		//put objects in folders if needs be
		handleFolders(folderString, typeFolder, element);	
		
		//put the element into a map so we can reference it
		this.modelElements.put(element.getId(), element);
		
 
	}

}
 
开发者ID:CymaLtd,项目名称:ArchiGITPlugin,代码行数:27,代码来源:LocalRepositoryImport.java

示例3: Header

import com.archimatetool.model.IArchimateModel; //导入依赖的package包/类
/**
 * @param model
 *            The Archimate model is provided in order to access and print meta data.
 */
public Header(final IArchimateModel model) {
    buf.append("/*\n");
    buf.append("This a prolog representation of an Archi model (http://www.archimatetool.com).\n");
    buf.append("It was created using the prolog exporter plugin (https://github.com/fkoehne/archi-prolog-exporter).\n");
    buf.append("The syntax (esp. the module syntax) is tested with SWI-Prolog, but should work with other engines as well.\n");

    buf.append("\nExport date: ");
    buf.append(new Date());
    buf.append("\n");
    buf.append("Model: ");
    buf.append(model.getName() == null ? "[undocumented]" : model.getName());
    buf.append("\n");
    buf.append(model.getPurpose() == null ? "[undocumented]" : model.getPurpose());
    buf.append("\n");
    buf.append("*/\n");

    buf.append(":- use_module(vocabulary).\n");
    buf.append(":- use_module(traversal).\n");
    buf.append(":- use_module(consistency).\n\n");
}
 
开发者ID:fkoehne,项目名称:archi-prolog-exporter,代码行数:25,代码来源:Header.java

示例4: generateVersionModel

import com.archimatetool.model.IArchimateModel; //导入依赖的package包/类
public IVersionModel generateVersionModel(IArchimateModel model) throws IOException {
	versionModel = VersionFactory.init(model);
	
	//add in the properties held on the model
	Map<String, IProperty> modelProperties = ArchiUtils.getPropertiesMap(model.getProperties());
	if(modelProperties.containsKey(IVersionModelPropertyConstants.MODEL_USER_PROPERTY_NAME))
		versionModel.setModelUserName(modelProperties.get(IVersionModelPropertyConstants.MODEL_USER_PROPERTY_NAME).getValue());
	
	if(modelProperties.containsKey(IVersionModelPropertyConstants.MODEL_USER_EMAIL_NAME))
		versionModel.setModelUserEmail(modelProperties.get(IVersionModelPropertyConstants.MODEL_USER_EMAIL_NAME).getValue());	
	
	if(modelProperties.containsKey(IVersionModelPropertyConstants.WORKING_DIR_PROPERTY_NAME))
		versionModel.setWorkingDirLocation(new File(modelProperties.get(IVersionModelPropertyConstants.WORKING_DIR_PROPERTY_NAME).getValue()));
	
	if(modelProperties.containsKey(IVersionModelPropertyConstants.MODEL_REPO_BRANCH_PROPERTY_NAME))
		versionModel.setRepoBranch(modelProperties.get(IVersionModelPropertyConstants.MODEL_REPO_BRANCH_PROPERTY_NAME).getValue());
	
	
	this.createFolderObjects(model.getFolder(FolderType.BUSINESS));
	this.createFolderObjects(model.getFolder(FolderType.APPLICATION));
	this.createFolderObjects(model.getFolder(FolderType.TECHNOLOGY));
	this.createFolderObjects(model.getFolder(FolderType.MOTIVATION));
	this.createFolderObjects(model.getFolder(FolderType.IMPLEMENTATION_MIGRATION));
	this.createFolderObjects(model.getFolder(FolderType.CONNECTORS));
	if (model.getFolder(FolderType.DERIVED) != null)
		this.createFolderObjects(model.getFolder(FolderType.DERIVED));
	this.createFolderObjects(model.getFolder(FolderType.RELATIONS));
	this.createFolderObjects(model.getFolder(FolderType.DIAGRAMS));
	//versionModel.createBusinessVersionObjects(model.getFolder(FolderType.BUSINESS));
	
	//model.getFolder(FolderType.BUSINESS)
	
	return versionModel;
}
 
开发者ID:CymaLtd,项目名称:ArchiGITPlugin,代码行数:35,代码来源:ModelPreparer.java

示例5: setupWorkingDirectory

import com.archimatetool.model.IArchimateModel; //导入依赖的package包/类
private File setupWorkingDirectory(IArchimateModel model) throws DialogCancelException {
	File repoLocation = ArchiUtils.getModelGitDir(ArchiUtils.getSafeUniqueModelName(model.getName(), model.getId()), true);
	versionModel.setWorkingDirLocation(repoLocation);
	versionModel.setRepoBranch(GitWrapper.DEFAULT_GIT_BRANCH_NAME);
	gitRepo = new GitWrapper(repoLocation);
	return repoLocation;
}
 
开发者ID:CymaLtd,项目名称:ArchiGITPlugin,代码行数:8,代码来源:ModelVersioner.java

示例6: importBranchInfo

import com.archimatetool.model.IArchimateModel; //导入依赖的package包/类
private void importBranchInfo(File workingDir, IArchimateModel model) {
	
	Map repoInfo;
	try {
		repoInfo = YamlReader.readVersionObject(new File(workingDir.toString() + File.separatorChar + IVersionModelPropertyConstants.BRANCH_FILE_NAME + ".yml"));
	} catch (IOException e) {
		//the file might not be there, so if we get an error just exit
		return;
	}
	
	model.setName((String) repoInfo.get(IVersionModelPropertyConstants.BRANCH_NAME_PROPERTY_NAME));
	model.setPurpose((String) repoInfo.get(IVersionModelPropertyConstants.BRANCH_DESCRIPTION_PROPERTY_NAME));
}
 
开发者ID:CymaLtd,项目名称:ArchiGITPlugin,代码行数:14,代码来源:LocalRepositoryImport.java

示例7: askCloneInfo

import com.archimatetool.model.IArchimateModel; //导入依赖的package包/类
private void askCloneInfo(IArchimateModel model) throws DialogCancelException {
  	//first ask for the working directory
  	workingDir = this.askSaveDirectory();
  	
  	//then the clone info
  	RemoteRepositoryDialog dialog = new RemoteRepositoryDialog(Display.getCurrent().getActiveShell());
  	dialog.create();
  	int returnCode = dialog.open();
  	if(returnCode == RemoteRepositoryDialog.CANCEL)
  		throw new DialogCancelException("User cancelled at remote repository dialog");
  	
  	try {
	repoToClone = new URI(dialog.getRepositoryToClone());
} catch (URISyntaxException e) {
	MessageBox errorDialog = new MessageBox(Display.getCurrent().getActiveShell(), SWT.ICON_ERROR | SWT.OK);
	errorDialog.setText("Repository to clone error");
	errorDialog.setMessage("Sorry, the you have entered an invalid URI for the repository to clone.");

	dialog.open(); 

	e.printStackTrace();
}
  	
  	repoUser = dialog.getRepoUser();
  	repoPassword = dialog.getRepoPassword();
  	
  	this.createModelProperty(model, IVersionModelPropertyConstants.WORKING_DIR_PROPERTY_NAME, workingDir.toString());
  	this.createModelProperty(model, IVersionModelPropertyConstants.REMOTE_REPO_LOCATION_PROPERTY_NAME, repoToClone.toString());
  	this.createModelProperty(model, IVersionModelPropertyConstants.REMOTE_REPO_USER_PROPERTY_NAME, repoUser);
  }
 
开发者ID:CymaLtd,项目名称:ArchiGITPlugin,代码行数:31,代码来源:LocalRepositoryImport.java

示例8: createModelProperty

import com.archimatetool.model.IArchimateModel; //导入依赖的package包/类
private void createModelProperty(IArchimateModel model, String key, String value) {
ArchimateFactory f = new ArchimateFactory();
IProperty repoProp = f.createProperty();
repoProp.setKey(key);
repoProp.setValue(value);
model.getProperties().add(repoProp);
  }
 
开发者ID:CymaLtd,项目名称:ArchiGITPlugin,代码行数:8,代码来源:LocalRepositoryImport.java

示例9: VersionModel

import com.archimatetool.model.IArchimateModel; //导入依赖的package包/类
protected VersionModel(IArchimateModel archiModel) {
	this.archiModel = archiModel;
	this.setupLocations();
	this.versionPrefs = new Preferences();
	this.businessElements = new <String, IVersionElement>HashMap();
	this.applicationElements = new <String, IVersionElement>HashMap();
	this.technologyElements = new <String, IVersionElement>HashMap();
	this.motivationElements = new <String, IVersionElement>HashMap();
	this.implementationElements = new <String, IVersionElement>HashMap();
	this.connectorElements = new <String, IVersionElement>HashMap();
	this.relationshipElements = new <String, IVersionElement>HashMap();
	this.derivedRelationshipElements = new <String, IVersionElement>HashMap();
	this.diagramElements = new <String, IVersionElement>HashMap();
}
 
开发者ID:CymaLtd,项目名称:ArchiGITPlugin,代码行数:15,代码来源:VersionModel.java

示例10: export

import com.archimatetool.model.IArchimateModel; //导入依赖的package包/类
@Override
public void export(final IArchimateModel model) throws IOException {
    writer = fileChooser.chooseFileAndCreateWriter();
    Header header = new Header(model);
    writer.write(header.toString());

    writeFolder(model.getFolder(FolderType.BUSINESS));
    writeFolder(model.getFolder(FolderType.APPLICATION));
    writeFolder(model.getFolder(FolderType.TECHNOLOGY));
    writeFolder(model.getFolder(FolderType.CONNECTORS));
    writeFolder(model.getFolder(FolderType.MOTIVATION));
    writeFolder(model.getFolder(FolderType.RELATIONS));

    writer.close();
}
 
开发者ID:fkoehne,项目名称:archi-prolog-exporter,代码行数:16,代码来源:PrologExporter.java

示例11: shouldGenerateMeaningfulOutputForEmptyModels

import com.archimatetool.model.IArchimateModel; //导入依赖的package包/类
@Test
public void shouldGenerateMeaningfulOutputForEmptyModels() {
    IArchimateModel emptyModel = ArchimateFactory.init().createArchimateModel();
    Header header = new Header(emptyModel);
    assertNotNull("Header could not be generated", header.toString());
    assertFalse("At least one field is empty and exported as 'null': " + header.toString(), header.toString()
            .contains("null"));
}
 
开发者ID:fkoehne,项目名称:archi-prolog-exporter,代码行数:9,代码来源:TestHeader.java

示例12: doImport

import com.archimatetool.model.IArchimateModel; //导入依赖的package包/类
@Override
public void doImport() throws IOException {
	
	//create our new model and collect some info before checking out from the new repository
	IArchimateModel model;
	try {
		model = IArchimateFactory.eINSTANCE.createArchimateModel();
		model.setDefaults();
		model.setName("Versioned Import");
		
		//find out where the local repository is
		askCloneInfo(model);
		
		//clone the repository
		GitWrapper.cloneArchiRepository(repoToClone, workingDir, repoUser, repoPassword);
		
		//get the model repo file from repository, if we can't find it, throw an error because it means
		//this git repo is not an archi one
		gitRepo = new GitWrapper(workingDir);
		gitRepo.getExistingGitRepo();
		gitRepo.checkoutModelFileFromMaster(IVersionModelPropertyConstants.MODEL_FILE_NAME+".yml");
		//TODO check for existance of repo file
		
		//now ask for info that will allow the model we are about to import to continue to be versioned
		//this will ask which branch contains the model we are importing
		boolean saveToNewBranch = this.askModelUserInfo(model);
		if (saveToNewBranch) {
			gitRepo.createAndCheckoutBranchFromExistingBranch(ArchiUtils.getPropertiesMap(model.getProperties()).get(IVersionModelPropertyConstants.MODEL_REPO_BRANCH_PROPERTY_NAME).getValue(), this.chosenBranch);
		}
		else {
			gitRepo.checkoutRemoteBranch(chosenBranch);
		}
		
		
		gitRepo.close();
	} catch (DialogCancelException e) {
		if(this.gitRepo!=null)
			gitRepo.close();
		return;
	}
	
	//now read in the repository info and set the relevant properties in the model
	this.importRepositoryInfo(workingDir, model);
	this.importBranchInfo(workingDir, model);
	
	//now try to import the objects into the repository
	this.importObjects(model);
	
	
	//lastly if the branch to save to is not the one we imported from, we need to create a new branch and put the model on there

	
	
	//finally open the model in the editor and save it
	IEditorModelManager.INSTANCE.openModel(model);
	IEditorModelManager.INSTANCE.saveModel(model);
	
	
}
 
开发者ID:CymaLtd,项目名称:ArchiGITPlugin,代码行数:60,代码来源:LocalRepositoryImport.java

示例13: importRepositoryInfo

import com.archimatetool.model.IArchimateModel; //导入依赖的package包/类
private void importRepositoryInfo(File workingDir, IArchimateModel model) throws IOException {
	Map repoInfo = YamlReader.readVersionObject(new File(workingDir.toString() + File.separatorChar + IVersionModelPropertyConstants.MODEL_FILE_NAME + ".yml"));
	
	this.createModelProperty(model, IVersionModelPropertyConstants.MODEL_REPO_ID_PROPERTY_NAME, (String) repoInfo.get(IVersionModelPropertyConstants.MODEL_REPO_ID_PROPERTY_NAME));
	this.createModelProperty(model, IVersionModelPropertyConstants.MODEL_REPO_DESCRIPTION_PROPERTY_NAME, (String) repoInfo.get(IVersionModelPropertyConstants.MODEL_REPO_DESCRIPTION_PROPERTY_NAME));
}
 
开发者ID:CymaLtd,项目名称:ArchiGITPlugin,代码行数:7,代码来源:LocalRepositoryImport.java

示例14: importObjects

import com.archimatetool.model.IArchimateModel; //导入依赖的package包/类
private void importObjects(IArchimateModel model) throws IOException {
	Map businessObjects = null;
	Map applicationObjects = null;
	Map technologyObjects = null;
	Map motivationObjects = null;
	Map implementationObjects = null;
	Map connectorObjects = null;
	Map relationshipObjects = null;
	Map derivedRelationshipObjects = null;
	Map diagramObjects = null;
	
	for(RepositoryDirectory dirName: RepositoryDirectory.values()) {
		File dir = new File(this.workingDir.toString() + File.separatorChar + dirName.getDirectoryName());

		switch(dirName) {
			case BUSINESS_LAYER:
				businessObjects = YamlReader.readDirectoryVersionObjects(dir);
				this.createModelObjects(model, businessObjects);
				break;
			case APPLICATION_LAYER:
				applicationObjects = YamlReader.readDirectoryVersionObjects(dir);
				this.createModelObjects(model, applicationObjects);
				break;
			case TECHNOLOGY_LAYER:
				technologyObjects = YamlReader.readDirectoryVersionObjects(dir);
				this.createModelObjects(model, technologyObjects);
				break;
			case MOTIVATION_LAYER:
				motivationObjects = YamlReader.readDirectoryVersionObjects(dir);
				this.createModelObjects(model, motivationObjects);
				break;
			case IMPLEMENTATION_LAYER:
				implementationObjects = YamlReader.readDirectoryVersionObjects(dir);
				this.createModelObjects(model, implementationObjects);
				break;
			case CONNECTORS:
				connectorObjects = YamlReader.readDirectoryVersionObjects(dir);
				this.createModelObjects(model, connectorObjects);
				break;
			case RELATIONSHIPS:
				relationshipObjects = YamlReader.readDirectoryVersionObjects(dir);
				this.createModelRelationships(model, relationshipObjects);
				break;
			case DERIVED_RELATIONSHIPS:
				derivedRelationshipObjects = YamlReader.readDirectoryVersionObjects(dir);
				this.createModelRelationships(model, derivedRelationshipObjects);
				break;
			case DIAGRAMS:
				diagramObjects = YamlReader.readDirectoryVersionObjects(dir);
				this.createModelDiagrams(model, diagramObjects);
				break;
		}
	}
}
 
开发者ID:CymaLtd,项目名称:ArchiGITPlugin,代码行数:55,代码来源:LocalRepositoryImport.java

示例15: createModelRelationships

import com.archimatetool.model.IArchimateModel; //导入依赖的package包/类
private void createModelRelationships(IArchimateModel model, Map objects) {
	//it's optional, but easier to always create a derived relations folder
	IFolder derivedRelations = model.addDerivedRelationsFolder();
	
	for(Object objectKey: objects.keySet()) {
		String elementId = (String) objectKey;
		Map objectFeatureMap = (Map) objects.get(elementId);
		
		IRelationship relationship = (IRelationship)IArchimateFactory.eINSTANCE.create((EClass)IArchimatePackage.eINSTANCE.getEClassifier((String)objectFeatureMap.get(VersionElementAttribute.ELEMENT_TYPE.getKeyName())));
		relationship.setId((String)objectFeatureMap.get(VersionElementAttribute.ID.getKeyName()));
		relationship.setName((String)objectFeatureMap.get(VersionElementAttribute.NAME.getKeyName()));
		relationship.setDocumentation((String)objectFeatureMap.get(VersionElementAttribute.DOCUMENTATION.getKeyName()));
		
		List elementProperties = (ArrayList)objectFeatureMap.get(VersionElementAttribute.PROPERTIES.getKeyName());
		relationship.getProperties().addAll(elementProperties);
		
		//relationships
		IArchimateElement source = (IArchimateElement) modelElements.get(objectFeatureMap.get(VersionRelationshipAttribute.SOURCE_ELEMENT.getKeyName()));
		relationship.setSource(source);
		
   		IArchimateElement target = (IArchimateElement) modelElements.get(objectFeatureMap.get(VersionRelationshipAttribute.TARGET_ELEMENT.getKeyName()));
		relationship.setTarget(target);
		
		String folderString = (String)objectFeatureMap.get(VersionElementAttribute.FOLDER_PATH.getKeyName());
		IFolder typeFolder = model.getDefaultFolderForElement(relationship);
		String relationType = (String)objectFeatureMap.get(VersionElementAttribute.TYPE.getKeyName());
		if(relationType.equals("derived")) {
			typeFolder = derivedRelations;
		}
		
		//relationship type specific
		if (relationship instanceof IAccessRelationship) {
			IAccessRelationship accessRel = (IAccessRelationship) relationship;
			if ((Map)objectFeatureMap.get(VersionRelationshipAttribute.ADDITIONAL_ATTRIBUTES.getKeyName()) !=null && ((Map)objectFeatureMap.get(VersionRelationshipAttribute.ADDITIONAL_ATTRIBUTES.getKeyName())).containsKey(VersionRelationshipAttribute.ACCESS_TYPE.getKeyName())) {
				int accessType = Integer.parseInt((String)((Map)objectFeatureMap.get(VersionRelationshipAttribute.ADDITIONAL_ATTRIBUTES.getKeyName())).get(VersionRelationshipAttribute.ACCESS_TYPE.getKeyName()));
				accessRel.setAccessType(accessType);
			}
		}
		
		//handle folders if needs be
		handleFolders(folderString, typeFolder, relationship);	
		
		
		modelRelationships.put(relationship.getId(), relationship);
	}
	
	
	//
}
 
开发者ID:CymaLtd,项目名称:ArchiGITPlugin,代码行数:50,代码来源:LocalRepositoryImport.java


注:本文中的com.archimatetool.model.IArchimateModel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。