use of com.google.cloud.bigquery.connection.v1.Connection in project osate2 by osate.
the class AadlBusinessObjectProvider method getChildBusinessObjects.
@Override
public Stream<?> getChildBusinessObjects(final BusinessObjectProviderContext ctx) {
final Object bo = ctx.getBusinessObjectContext().getBusinessObject();
// An IProject is specified as the business object for contextless diagrams.
if (bo instanceof IProject) {
// Special handling for project
final IProject project = (IProject) bo;
// Perform an incremental project build to ensure new packages are included.
try {
project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, new NullProgressMonitor());
} catch (CoreException e) {
throw new RuntimeException(e);
}
Stream<Object> packages = getPackages(project);
// If no packages were found, assume that the project needs to be built. This can happen if the Eclipse process is forcefully terminated.
if (packages == null) {
try {
project.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
} catch (CoreException e) {
throw new RuntimeException(e);
}
packages = getPackages(project);
}
return packages;
} else if (bo instanceof AadlPackage) {
return getChildren((AadlPackage) bo, ctx.getExtensionRegistry());
} else if (bo instanceof Classifier) {
return getChildren((Classifier) bo, true, ctx.getExtensionRegistry());
} else if (bo instanceof FeatureGroup) {
final FeatureGroupType fgt = AadlFeatureUtil.getFeatureGroupType(ctx.getBusinessObjectContext(), (FeatureGroup) bo);
return fgt == null ? Stream.empty() : AadlFeatureUtil.getAllFeatures(fgt).stream();
} else if (bo instanceof Subcomponent) {
return getChildren((Subcomponent) bo, ctx.getBusinessObjectContext(), ctx.getExtensionRegistry());
} else if (bo instanceof SubprogramCall) {
return getChildren((SubprogramCall) bo);
} else if (bo instanceof SubprogramCallSequence) {
return getChildren((SubprogramCallSequence) bo);
} else if (bo instanceof ModeTransition) {
final ModeTransition mt = ((ModeTransition) bo);
final String modeTransitionTriggersDesc = mt.getOwnedTriggers().stream().map(mtt -> mttHandler.getName(mtt)).collect(Collectors.joining(","));
return Stream.concat(mt.getOwnedTriggers().stream(), Stream.of(new Tag(Tag.KEY_MODE_TRANSITION_TRIGGERS, modeTransitionTriggersDesc)));
} else if (bo instanceof ComponentInstance) {
return getChildren((ComponentInstance) bo);
} else if (bo instanceof FeatureInstance) {
return ((FeatureInstance) bo).getFeatureInstances().stream();
} else if (bo instanceof Connection) {
if (!((Connection) bo).isAllBidirectional()) {
return Stream.of(new Tag(Tag.KEY_UNIDIRECTIONAL, null));
}
} else if (bo instanceof ConnectionInstance) {
if (!((ConnectionInstance) bo).isBidirectional()) {
return Stream.of(new Tag(Tag.KEY_UNIDIRECTIONAL, null));
}
}
return Stream.empty();
}
use of com.google.cloud.bigquery.connection.v1.Connection in project osate2 by osate.
the class ConnectionHandler method getGraphicalConfiguration.
@Override
public Optional<GraphicalConfiguration> getGraphicalConfiguration(final GetGraphicalConfigurationContext ctx) {
final BusinessObjectContext boc = ctx.getBusinessObjectContext();
final QueryService queryService = ctx.getQueryService();
final Connection c = boc.getBusinessObject(Connection.class).orElseThrow();
final QueryResult src = queryService.getFirstResult(SRC_QUERY, boc, c).orElse(null);
final QueryResult dst = queryService.getFirstResult(DST_QUERY, boc, c).orElse(null);
final boolean partial = (src != null && src.isPartial()) || (dst != null && dst.isPartial());
final StyleBuilder sb = StyleBuilder.create(AadlInheritanceUtil.isInherited(boc) ? Styles.INHERITED_ELEMENT : Style.EMPTY);
if (partial) {
sb.dotted();
}
return Optional.of(GraphicalConfigurationBuilder.create().graphic(GRAPHIC).style(sb.build()).source(src == null ? null : src.getBusinessObjectContext()).destination(dst == null ? null : dst.getBusinessObjectContext()).build());
}
use of com.google.cloud.bigquery.connection.v1.Connection in project osate2 by osate.
the class Aadl2OutlineTreeProvider method internalCreateChildren.
@Override
protected void internalCreateChildren(final IOutlineNode parentNode, final EObject modelElement) {
if (modelElement instanceof Element) {
final Element element = (Element) modelElement;
final EObject annexRoot = AnnexUtil.getAnnexRoot(element);
if (annexRoot != null) {
// delegate to annex specific outline tree provider
IParseResult annexParseResult = ParseResultHolder.Factory.INSTANCE.adapt(annexRoot).getParseResult();
if (annexParseResult != null) {
Injector injector = AnnexUtil.getInjector(annexParseResult);
if (injector != null) {
try {
final IOutlineTreeStructureProvider outlineTree = injector.getInstance(IOutlineTreeStructureProvider.class);
if (outlineTree instanceof BackgroundOutlineTreeProvider) {
outlineTree.createChildren(parentNode, element);
} else {
Aadl2Activator.getInstance().getLog().log(new Status(IStatus.ERROR, Aadl2Activator.PLUGIN_ID, IStatus.OK, "Annex outline tree structure provider '" + outlineTree.getClass().getCanonicalName() + "' does not implement BackgroundOutlineTreeProvider", null));
}
} catch (ConfigurationException e) {
// ignore: no outline provider for this annex
}
}
}
} else {
for (EObject childElement : element.getChildren()) {
if (childElement instanceof Realization || childElement instanceof TypeExtension || childElement instanceof ImplementationExtension || childElement instanceof ContainmentPathElement || childElement instanceof PropertyAssociation) {
continue;
}
if (element instanceof Connection && childElement instanceof ConnectedElement) {
continue;
}
createNode(parentNode, childElement);
}
}
}
}
use of com.google.cloud.bigquery.connection.v1.Connection in project osate2 by osate.
the class CreateEndToEndFlowSpecificationTool method createEndToEndFlow.
/**
* Create an EndToEndFlow based on user selections
*/
private EndToEndFlow createEndToEndFlow() {
final EndToEndFlow endToEndFlow = (EndToEndFlow) createFlowDialog.pkg.getEFactoryInstance().create(createFlowDialog.pkg.getEndToEndFlow());
endToEndFlow.setName(createFlowDialog.endToEndFlowName);
segmentSelections.forEach(entry -> {
final BusinessObjectContext boc = entry.getBoc();
final EndToEndFlowSegment eTEFlowSegment = endToEndFlow.createOwnedEndToEndFlowSegment();
final EndToEndFlowElement eTEFlowElement = (EndToEndFlowElement) boc.getBusinessObject();
if (!(boc.getBusinessObject() instanceof Connection) && !(boc.getBusinessObject() instanceof DataSubcomponent) && !(boc.getBusinessObject() instanceof EndToEndFlow)) {
final Context context = ToolUtil.findContext(boc);
eTEFlowSegment.setContext(context);
}
eTEFlowSegment.setFlowElement(eTEFlowElement);
endToEndFlow.getOwnedEndToEndFlowSegments().add(eTEFlowSegment);
});
modeFeatureSelections.forEach(modeFeatureBoc -> endToEndFlow.getInModeOrTransitions().add((ModeFeature) modeFeatureBoc.getBusinessObject()));
return endToEndFlow;
}
use of com.google.cloud.bigquery.connection.v1.Connection in project osate2 by osate.
the class EMV2Util method findConnectionErrorSourceForConnection.
/**
* Find ConnectionErrorSource with given classifier by looking through all connection error sources
* @param conni the connection instance whose connection declarations we're using
* @return the connection error source or null
*/
public static ErrorSource findConnectionErrorSourceForConnection(ConnectionInstance conni) {
for (ConnectionReference connref : conni.getConnectionReferences()) {
Connection conn = connref.getConnection();
Classifier cl = getAssociatedClassifier(conn);
if (cl != null) {
Collection<ErrorSource> ceslist = getAllConnectionErrorSources(cl);
for (ErrorSource ces : ceslist) {
if (ces.isAll() || ces.getSourceModelElement().getName().equalsIgnoreCase(conn.getName())) {
return ces;
}
}
}
}
return null;
}
Aggregations