use of org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel._import.ImportStub in project legend-pure by finos.
the class MilestoningFunctions method isGeneratedMilestoningProperty.
public static boolean isGeneratedMilestoningProperty(CoreInstance property, ProcessorSupport processorSupport, String stereotype, String milestoningPathSuffix) {
if (property instanceof ElementWithStereotypes) {
RichIterable<? extends CoreInstance> stereotypes = ((ElementWithStereotypes) property)._stereotypesCoreInstance();
if (stereotypes.notEmpty()) {
CoreInstance profile = processorSupport.package_getByUserPath(M3Paths.Milestoning);
CoreInstance milestoningStereotype = Profile.findStereotype(profile, stereotype);
return stereotypes.anySatisfy(st -> (st instanceof ImportStub) ? ((ImportStub) st)._idOrPath().endsWith(milestoningPathSuffix) : milestoningStereotype.equals(st));
}
}
return false;
}
use of org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel._import.ImportStub in project legend-pure by finos.
the class NavigationGraphBuilder method visitEnumStub.
@Override
public CoreInstance visitEnumStub(EnumStubContext ctx) {
Token type = ctx.VALID_STRING(0).getSymbol();
Token enumValue = ctx.VALID_STRING(1).getSymbol();
ImportStub importStub = ImportStubInstance.createPersistent(this.repository, this.sourceInformation.getPureSourceInformation(type), type.getText(), this.importId);
return EnumStubInstance.createPersistent(this.repository, this.sourceInformation.getPureSourceInformation(type), enumValue.getText(), importStub);
}
use of org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel._import.ImportStub in project legend-pure by finos.
the class RootGraphFetchTreeUnbind method unbindPropertyGraphFetchTree.
private void unbindPropertyGraphFetchTree(PropertyGraphFetchTree propertyGraphFetchTree, RootGraphFetchTree mainTree, MatcherState state, Matcher matcher) {
ProcessorSupport processorSupport = state.getProcessorSupport();
PropertyStub property = (PropertyStub) propertyGraphFetchTree._propertyCoreInstance();
CoreInstance resolved = property._resolvedPropertyCoreInstance();
if (resolved != null) {
ReferenceUsage.removeReferenceUsagesForUser(resolved, mainTree, state.getProcessorSupport());
}
Shared.cleanPropertyStub(property, processorSupport);
property._ownerRemove();
for (ValueSpecification vs : propertyGraphFetchTree._parameters()) {
if (vs instanceof InstanceValue) {
for (CoreInstance value : ((InstanceValue) vs)._valuesCoreInstance()) {
Shared.cleanEnumStub(value, processorSupport);
}
vs._genericTypeRemove();
vs._multiplicityRemove();
}
matcher.fullMatch(vs, state);
}
for (GraphFetchTree subTree : propertyGraphFetchTree._subTrees()) {
this.unbindPropertyGraphFetchTree((PropertyGraphFetchTree) subTree, mainTree, state, matcher);
}
ImportStub subTypeClass = (ImportStub) propertyGraphFetchTree._subTypeCoreInstance();
if (subTypeClass != null) {
CoreInstance resolvedSubTypeClass = subTypeClass._resolvedNodeCoreInstance();
if (resolvedSubTypeClass != null) {
ReferenceUsage.removeReferenceUsagesForUser(resolvedSubTypeClass, mainTree, state.getProcessorSupport());
}
Shared.cleanImportStub(subTypeClass, processorSupport);
}
propertyGraphFetchTree._classifierGenericTypeRemove();
}
use of org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel._import.ImportStub in project legend-pure by finos.
the class DatabaseUnloadUnbind method processTableAliasColumn.
private static void processTableAliasColumn(TableAliasColumn tableAliasColumn, TableAlias joinTarget, ProcessorSupport processorSupport) throws PureCompilationException {
TableAlias tableAlias = tableAliasColumn._alias();
if ((joinTarget != null) && (tableAlias == joinTarget)) {
// Replace the join target with a {target} alias
ModelRepository repository = tableAliasColumn.getRepository();
TableAlias targetAlias = (TableAlias) repository.newAnonymousCoreInstance(tableAliasColumn.getSourceInformation(), joinTarget.getClassifier());
targetAlias._name(DatabaseProcessor.SELF_JOIN_TABLE_NAME);
tableAliasColumn._alias(targetAlias);
} else {
tableAlias._relationalElementRemove();
ImportStub tableAliasDatabase = (ImportStub) tableAlias._databaseCoreInstance();
if (tableAliasDatabase != null) {
Shared.cleanImportStub(tableAliasDatabase, processorSupport);
}
}
tableAliasColumn._columnRemove();
}
use of org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel._import.ImportStub in project legend-pure by finos.
the class RelationalAssociationImplementationUnbind method run.
@Override
public void run(RelationalAssociationImplementation instance, MatcherState state, Matcher matcher, ModelRepository modelRepository, Context context) throws PureCompilationException {
ProcessorSupport processorSupport = state.getProcessorSupport();
ImportStub mappingImportStub = (ImportStub) instance._parentCoreInstance();
RelationalPropertyMappingUnbind.cleanPropertyMappings(instance, modelRepository, processorSupport, mappingImportStub);
}
Aggregations