本文整理汇总了Java中org.eclipse.m2m.qvt.oml.ModelExtent类的典型用法代码示例。如果您正苦于以下问题:Java ModelExtent类的具体用法?Java ModelExtent怎么用?Java ModelExtent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ModelExtent类属于org.eclipse.m2m.qvt.oml包,在下文中一共展示了ModelExtent类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: processSourcePair
import org.eclipse.m2m.qvt.oml.ModelExtent; //导入依赖的package包/类
private ModelExtent processSourcePair(String metamodel, String model) {
Resource mmRes =
this.rs.getResource(URI.createFileURI(new File(metamodel).getAbsolutePath()), true);
EObject eObject = mmRes.getContents().get(0);
if (eObject instanceof EPackage) {
EPackage p = (EPackage)eObject;
// rs.getPackageRegistry().put(p.getNsURI(), p);
EPackage.Registry.INSTANCE.put(p.getNsURI(), p);
}
Resource mRes =
this.rs.getResource(URI.createFileURI(new File(model).getAbsolutePath()), true);
/* TODO: validate model against metamodel */
return new BasicModelExtent(mRes.getContents());
}
开发者ID:mrcalvin,项目名称:qvto-cli,代码行数:19,代码来源:App.java
示例2: transform
import org.eclipse.m2m.qvt.oml.ModelExtent; //导入依赖的package包/类
private IStatus transform(URI transformationURI, Optional<URI> traceURI, Collection<URI> parameterURIs)
throws IOException {
final List<Pair<ModelExtent, Resource>> transformationResources = Lists.newArrayList();
for (URI parameterURI : parameterURIs) {
transformationResources.add(createPair(createModelExtent(parameterURI), createResource(parameterURI)));
}
final List<ModelExtent> transformationParameters = transformationResources.stream().map(r -> r.getFirst())
.collect(Collectors.toList());
final Optional<Trace> transformationTrace = createTrace(traceURI);
IStatus transformationResult = transform(transformationURI, transformationParameters, transformationTrace);
postProcessTransformationParametersBeforeSave(transformationParameters, transformationTrace,
determineParameterIndicesToSave(transformationURI));
if (transformationResult.getSeverity() == IStatus.OK) {
saveTransformationResources(transformationURI, transformationResources);
saveTraceModel(traceURI, transformationTrace);
}
return transformationResult;
}
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:21,代码来源:DomainIndependentTransformationBase.java
示例3: testRegular
import org.eclipse.m2m.qvt.oml.ModelExtent; //导入依赖的package包/类
protected void testRegular(String modelName, Function<Collection<Diff>, Collection<Diff>> diffProcessor)
throws Exception {
URI sourceModelURI = createResourceModelURI(resourcePluginId, modelName + "." + sourceFileExtension);
URI umlModelURI = createResourceModelURI(resourcePluginId, modelName + ".uml");
URI resultModelURI = createResourceModelURI(resourcePluginId, modelName + "." + targetFileExtension);
ModelExtent transformationResult = runTransformation(transformationURI, sourceModelURI, umlModelURI);
EObject expected = getRootElement(resultModelURI);
assertEquals(1, transformationResult.getContents().size());
EObject actual = transformationResult.getContents().get(0);
EcoreUtil.resolveAll(getResourceSet());
debugSerialize(expected, actual);
assertModelEquals(expected, actual, diffProcessor);
}
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:18,代码来源:DirectionalTransformationTestBase.java
示例4: testDeleteClass
import org.eclipse.m2m.qvt.oml.ModelExtent; //导入依赖的package包/类
@Test
public void testDeleteClass() throws Exception {
URI sourceModelURI = createResourceModelURI(TestEnvironmentConstants.TEST_PLUGIN_ID, "ClassDiagramSingleClass.notation");
URI umlModelURI = createResourceModelURI(TestEnvironmentConstants.TEST_PLUGIN_ID, "ClassDiagramSingleClass.uml");
// first transformation
Trace transformationTrace = new Trace(Collections.emptyList());
ModelExtent transformationResult = runTransformation(TRANSFORMATION_URI, sourceModelURI, umlModelURI,
transformationTrace);
// delete class from graphical model
Resource notationResource = getResourceSet().getResource(sourceModelURI, false);
Shape umlClassShape = ((Shape) ((Diagram) notationResource.getContents().get(0)).getChildren().get(0));
org.eclipse.uml2.uml.Class umlClass = (org.eclipse.uml2.uml.Class) umlClassShape.getElement();
EcoreUtil.remove(umlClassShape);
EcoreUtil.remove(umlClass);
ClassDiagram textualDiagram = (ClassDiagram) transformationResult.getContents().get(0);
textualDiagram.getRootPackage().getClassifiers().get(0)
.eUnset(TextualCommonsPackage.Literals.UML_REFERENCING_ELEMENT__REFERENCED_ELEMENT);
// second transformation (incremental)
transformationResult = runTransformation(TRANSFORMATION_URI, sourceModelURI, umlModelURI, transformationResult,
transformationTrace);
assertEquals(0, textualDiagram.getRootPackage().getClassifiers().size());
}
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:27,代码来源:GraphicalToTextualClassTest.java
示例5: arguments
import org.eclipse.m2m.qvt.oml.ModelExtent; //导入依赖的package包/类
@Override
protected ModelExtent[] arguments() {
final ModelExtent psmContents = new BasicModelExtent(theSelectedResource.getContents());
targetContents = new BasicModelExtent(Collections.<EObject> emptyList());
targetFolder = theSelectedResource.getURI().trimFileExtension();
final URI infrastructureTargetFolder = createURI(appendPath(targetFolder, getXmlSchemasFolder()).toString() + "/",
true);
final Collection<ModelExtent> modelExtents = new ArrayList<>(6);
modelExtents.add(psmContents);
for (final URI infrastructureSchemaLocation : org.search.niem.xsd.library.Activator.INSTANCE
.getInfrastructureSchemaLocations()) {
modelExtents.add(new BasicModelExtent(getInfrastructureResource(infrastructureSchemaLocation,
infrastructureTargetFolder).getContents()));
}
modelExtents.add(targetContents);
return modelExtents.toArray(new ModelExtent[modelExtents.size()]);
}
开发者ID:info-sharing-environment,项目名称:NIEM-Modeling-Tool,代码行数:19,代码来源:NIEMpsm2xsdDelegate.java
示例6: postProcessTransformationParametersBeforeSave
import org.eclipse.m2m.qvt.oml.ModelExtent; //导入依赖的package包/类
@Override
protected void postProcessTransformationParametersBeforeSave(List<ModelExtent> transformationParameters,
Optional<Trace> transformationTrace, List<Integer> writeableParameterIndices) {
List<ModelExtent> parametersToProcess = writeableParameterIndices.stream().map(transformationParameters::get)
.collect(Collectors.toList());
postProcessors.forEach(p -> p.process(parametersToProcess, transformationTrace));
}
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:8,代码来源:TransformationBase.java
示例7: process
import org.eclipse.m2m.qvt.oml.ModelExtent; //导入依赖的package包/类
@SuppressWarnings("restriction")
@Override
public void process(Collection<ModelExtent> transformationParameters, Optional<Trace> transformationTrace) {
if (!transformationTrace.isPresent()) {
return;
}
Set<org.eclipse.m2m.internal.qvt.oml.trace.Trace> traces = transformationTrace.get().getTraceContent().stream()
.filter(org.eclipse.m2m.internal.qvt.oml.trace.Trace.class::isInstance)
.map(org.eclipse.m2m.internal.qvt.oml.trace.Trace.class::cast).collect(Collectors.toSet());
Set<EObject> mappedElements = traces.stream()
.flatMap(t -> Stream.concat(t.getTargetToTraceRecordMap().keySet().stream(),
t.getSourceToTraceRecordMap().keySet().stream()))
.filter(EObject.class::isInstance).map(EObject.class::cast).collect(Collectors.toSet());
PostProcessingSwitch postProcessor = factory.create(mappedElements);
Set<EObject> relevantObjects = transformationParameters.stream().flatMap(m -> m.getContents().stream())
.filter(o -> postProcessor.isPackageSupported(o.eClass().getEPackage())).collect(Collectors.toSet());
for (TreeIterator<Object> contentIterator = EcoreUtil.getAllContents(relevantObjects, true); contentIterator
.hasNext();) {
Object content = contentIterator.next();
if (!(content instanceof EObject)) {
contentIterator.prune();
continue;
}
postProcessor.doSwitch((EObject) content);
}
postProcessor.getRequestedChanges().forEach(Runnable::run);
}
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:32,代码来源:ContentIteratingPostProcessor.java
示例8: saveTransformationResources
import org.eclipse.m2m.qvt.oml.ModelExtent; //导入依赖的package包/类
private void saveTransformationResources(URI transformationURI,
List<Pair<ModelExtent, Resource>> transformationResources) throws IOException {
List<Integer> indicesToSave = determineParameterIndicesToSave(transformationURI);
List<Pair<ModelExtent, Resource>> resourcesToSave = indicesToSave.stream()
.map(i -> transformationResources.get(i)).collect(Collectors.toList());
save(resourcesToSave);
}
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:8,代码来源:DomainIndependentTransformationBase.java
示例9: save
import org.eclipse.m2m.qvt.oml.ModelExtent; //导入依赖的package包/类
private void save(Pair<ModelExtent, Resource> transformationResource) throws IOException {
Resource resource = transformationResource.getSecond();
ModelExtent transformationResult = transformationResource.getFirst();
if (transformationResult.getContents().stream().anyMatch(o -> !resource.equals(o.eResource()))) {
resource.getContents().clear();
resource.getContents().addAll(transformationResource.getFirst().getContents());
}
resource.save(Collections.emptyMap());
}
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:11,代码来源:DomainIndependentTransformationBase.java
示例10: createModelExtent
import org.eclipse.m2m.qvt.oml.ModelExtent; //导入依赖的package包/类
private ModelExtent createModelExtent(URI uri) throws IOException {
EObject rootObject = null;
if ("qvto".equals(uri.fileExtension())) {
rootObject = getQVTOResource(uri).getFirstTransformation();
} else if (uri.hasFragment()) {
rootObject = rs.getEObject(uri, true);
} else if (rs.getURIConverter().exists(uri, Collections.emptyMap()) || rs.getResource(uri, false) != null) {
Resource r = rs.getResource(uri, true);
rootObject = r != null && !r.getContents().isEmpty() ? r.getContents().get(0) : null;
}
return createModelExtent(rootObject);
}
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:15,代码来源:DomainIndependentTransformationBase.java
示例11: runTransformation
import org.eclipse.m2m.qvt.oml.ModelExtent; //导入依赖的package包/类
protected ModelExtent runTransformation(URI transformationURI, ModelExtent sourceModel, ModelExtent umlModel,
ModelExtent destination, Trace traceModel) throws IOException {
ModelExtent umlPrimitives = createModelExtent(createResource(getResourceSet(), UML_PRIMITIVE_TYPES));
Collection<ModelExtent> transformationParameters = Arrays.asList(sourceModel, destination, umlModel,
umlPrimitives);
runTransformation(transformationURI, transformationParameters, traceModel);
URI virtualResultModelURI = umlModel.getContents().get(0).eResource().getURI().trimFileExtension()
.trimFragment().trimQuery().trimSegments(1).appendSegment("resultModel").appendFileExtension("xmi");
Resource resultResource = createResource(getResourceSet(), virtualResultModelURI);
resultResource.getContents().addAll(destination.getContents());
return destination;
}
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:16,代码来源:PlainTransformationTestBase.java
示例12: repairTransformationTrace
import org.eclipse.m2m.qvt.oml.ModelExtent; //导入依赖的package包/类
protected void repairTransformationTrace(ModelExtent expectedModel, ModelExtent actualModel, Trace trace) {
Comparison comparisonResult = modelComparator.compare(expectedModel.getContents().get(0),
actualModel.getContents().get(0));
ImmutableList<EObject> allContents = ImmutableList.copyOf(trace.getTraceContent().get(0).eAllContents());
allContents.stream().filter(o -> o instanceof EValue).map(o -> (EValue) o)
.forEach(o -> replaceModelElementWithMatchingOne(o, comparisonResult));
}
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:8,代码来源:TraceRecordTransformationTestBase.java
示例13: assertTraceEquals
import org.eclipse.m2m.qvt.oml.ModelExtent; //导入依赖的package包/类
protected void assertTraceEquals(Trace t2gTraceModel, ModelExtent actualTraceModel) throws IOException {
assertEquals(1, t2gTraceModel.getTraceContent().size());
EObject expectedTrace = t2gTraceModel.getTraceContent().get(0);
assertEquals(1, actualTraceModel.getContents().size());
EObject actualTrace = actualTraceModel.getContents().get(0);
sortTraceRecords(expectedTrace);
sortTraceRecords(actualTrace);
debugSerialize(Arrays.asList(expectedTrace), actualTraceModel.getContents());
DefaultComparisonScope scope = new DefaultComparisonScope(expectedTrace, actualTrace, null);
DefaultDiffEngine de = new DefaultDiffEngine() {
@Override
protected FeatureFilter createFeatureFilter() {
return new FeatureFilter() {
private final Collection<EClass> ignoredEClasses = Sets.newHashSet(
TracePackage.eINSTANCE.getMappingOperationToTraceRecordMapEntry(),
TracePackage.eINSTANCE.getObjectToTraceRecordMapEntry());
@Override
protected boolean isIgnoredReference(Match match, EReference reference) {
if (ignoredEClasses.contains(reference.getEContainingClass())) {
return true;
}
return super.isIgnoredReference(match, reference);
}
};
}
};
Comparison comparison = EMFCompare.builder().setDiffEngine(de).build().compare(scope);
assertEquals(prettyPrint(comparison), 0, comparison.getDifferences().size());
}
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:36,代码来源:TraceRecordTransformationTestBase.java
示例14: runTransformation
import org.eclipse.m2m.qvt.oml.ModelExtent; //导入依赖的package包/类
protected void runTransformation(URI transformationURI, Iterable<ModelExtent> transformationParameters,
Trace traceModel) {
TransformationExecutor executor = new TransformationExecutor(transformationURI);
ExecutionContextImpl ctx = new ExecutionContextImpl();
ctx.setLog(new Slf4JLogger(LOGGER, Level.INFO));
ctx.getSessionData().setValue(QVTEvaluationOptions.INCREMENTAL_UPDATE_TRACE, traceModel);
ExecutionDiagnostic result = executor.execute(ctx,
Iterables.toArray(transformationParameters, ModelExtent.class));
assertEquals(result.getMessage(), ExecutionDiagnostic.OK, result.getSeverity());
}
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:11,代码来源:TransformationTestBase.java
示例15: arguments
import org.eclipse.m2m.qvt.oml.ModelExtent; //导入依赖的package包/类
@Override
protected final ModelExtent[] arguments() {
final List<EObject> theCatalogContents = resourceSet.getResource(theSelectedResource.getURI(), true).getContents();
thePIM = resourceSet.createResource(getThePimUri());
System.out.println("thePimUri "+getThePimUri());
final Model theRoot = UMLFactory.eINSTANCE.createModel();
theRoot.setName("Data");
//
final List<EObject> thePIMContents = thePIM.getContents();
thePIMContents.add(theRoot);
thePIMExtent = new BasicModelExtent(thePIMContents);
return new ModelExtent[] { new BasicModelExtent(theCatalogContents), thePIMExtent };
}
开发者ID:GRA-UML,项目名称:tool,代码行数:14,代码来源:GRAsppartifact2modelDelegate.java
示例16: arguments
import org.eclipse.m2m.qvt.oml.ModelExtent; //导入依赖的package包/类
@Override
protected ModelExtent[] arguments() {
final ModelExtent psmContents = new BasicModelExtent(theSelectedResource.getContents());
targetContents = new BasicModelExtent(Collections.<EObject> emptyList());
targetFolder = theSelectedResource.getURI().trimFileExtension();
// tjd add gra path to targetFolder
// tjd TODO: need to support multiple IEPDs and name each one
// we could iterate at a higher level and adjust the targetFolder for each iteration
// but can not override the final transform of TransformDelegate, so would need to be outside the delegate pattern
// in any case, assume the qualifying PSM MPD Model is the name of the IEPD
org.eclipse.uml2.uml.Package psmIepdModel=getPsmIepdModel();
String iepdName="IEPD";
if(psmIepdModel!=null)iepdName=psmIepdModel.getName();
targetFolder = createURI(appendPath(targetFolder,"artifacts/service model/information model/"+iepdName).toString()+"/",true);
final URI infrastructureTargetFolder = createURI(appendPath(targetFolder, getXmlSchemasFolder()).toString() + "/",
true);
final Collection<ModelExtent> modelExtents = new ArrayList<>(6);
modelExtents.add(psmContents);
for (final URI infrastructureSchemaLocation : org.ijis.gra.xsd.library.Activator.INSTANCE
.getInfrastructureSchemaLocations()) {
modelExtents.add(new BasicModelExtent(getInfrastructureResource(infrastructureSchemaLocation,
infrastructureTargetFolder).getContents()));
}
modelExtents.add(targetContents);
return modelExtents.toArray(new ModelExtent[modelExtents.size()]);
}
开发者ID:GRA-UML,项目名称:tool,代码行数:30,代码来源:NIEMpsm2xsdDelegate.java
示例17: arguments
import org.eclipse.m2m.qvt.oml.ModelExtent; //导入依赖的package包/类
@Override
protected final ModelExtent[] arguments() {
/*
theTargetContents = new BasicModelExtent(Collections.<EObject> emptyList());
final ModelExtent targetLocation = new BasicModelExtent(Collections.<EObject> emptyList());
final List<ModelExtent> arguments = new ArrayList<>(asList(super.arguments()));
arguments.add(arguments.size() - 1, targetLocation);
arguments.add(theTargetContents);
return arguments.toArray(new ModelExtent[arguments.size()]);
*/
/*
* in uml:UML,out cat:SPPCAT,out metadata:METADATA,out wsdl:WSDL
*/
//targetFolder = theSelectedResource.getURI().trimFileExtension();
targetFolder=GraUtility.getTargeDirectorytURI(theSelectedResource);
final URI infrastructureTargetFolder = createURI(appendPath(targetFolder, getXmlSchemasFolder()).toString() + "/",
true);
ModelExtent psmContents = new BasicModelExtent(theSelectedResource.getContents());
//catTarget = new BasicModelExtent(Collections.<EObject> emptyList());
//metadataTarget = new BasicModelExtent(Collections.<EObject> emptyList());
//wsdlTarget = new BasicModelExtent(Collections.<EObject> emptyList());
annotationTarget = new BasicModelExtent(Collections.<EObject> emptyList());
final Collection<ModelExtent> modelExtents = new ArrayList<>();
modelExtents.add(psmContents);
for (final URI infrastructureSchemaLocation : org.ijis.gra.xsd.library.Activator.INSTANCE
.getInfrastructureSchemaLocations()) {
modelExtents.add(new BasicModelExtent(getInfrastructureResource(infrastructureSchemaLocation,
infrastructureTargetFolder).getContents()));
break;
}
//modelExtents.add(catTarget);
//modelExtents.add(metadataTarget);
//modelExtents.add(wsdlTarget);// no longer
modelExtents.add(annotationTarget);
return modelExtents.toArray(new ModelExtent[modelExtents.size()]);
}
开发者ID:GRA-UML,项目名称:tool,代码行数:40,代码来源:GraSppModel2artifactDelegate.java
示例18: arguments
import org.eclipse.m2m.qvt.oml.ModelExtent; //导入依赖的package包/类
@Override
protected final ModelExtent[] arguments() {
final List<EObject> theCatalogContents = resourceSet.getResource(theSelectedResource.getURI(), true).getContents();
thePIM = resourceSet.createResource(getThePimUri());
final Model theRoot = UMLFactory.eINSTANCE.createModel();
theRoot.setName("Data");
final List<EObject> thePIMContents = thePIM.getContents();
thePIMContents.add(theRoot);
thePIMExtent = new BasicModelExtent(thePIMContents);
return new ModelExtent[] { new BasicModelExtent(theCatalogContents), thePIMExtent };
}
开发者ID:info-sharing-environment,项目名称:NIEM-Modeling-Tool,代码行数:12,代码来源:NIEMmpdartifact2modelDelegate.java
示例19: execute
import org.eclipse.m2m.qvt.oml.ModelExtent; //导入依赖的package包/类
private QVTOTransformationResult execute() {
TransformationExecutor executor = new TransformationExecutor(qvtoTransformationFile);
ModelExtent[] inoutModelsExtent = createInoutModelsExtentWithInitialContent(inoutInitialModels);
ExecutionContextImpl context = setupExecutionEnvironment();
ExecutionDiagnostic result = executor.execute(context, inoutModelsExtent);
List<EObject>[] inoutFinalModels = createInoutFinalModels(inoutModelsExtent);
QVTOTransformationResult qvtResult = new QVTOTransformationResult(result, inoutFinalModels);
return qvtResult;
}
开发者ID:aciancone,项目名称:klapersuite,代码行数:10,代码来源:QVTOTransformation.java
示例20: createInoutFinalModels
import org.eclipse.m2m.qvt.oml.ModelExtent; //导入依赖的package包/类
private List<EObject>[] createInoutFinalModels(ModelExtent[] inoutModelsExtent) {
List<EObject>[] inoutFinalModels = new List[inoutModelsExtent.length];
for (int i = 0; i < inoutModelsExtent.length; i++) {
inoutFinalModels[i] = inoutModelsExtent[i].getContents();
}
return inoutFinalModels;
}
开发者ID:aciancone,项目名称:klapersuite,代码行数:8,代码来源:QVTOTransformation.java
注:本文中的org.eclipse.m2m.qvt.oml.ModelExtent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论