use of org.finos.legend.pure.m3.compiler.postprocessing.processor.milestoning.GeneratedMilestonedProperties in project legend-pure by finos.
the class AssociationProcessor method processAssociationProperty.
private static ListIterable<AbstractProperty<?>> processAssociationProperty(Association association, Property property, GenericType sourceGenericType, Class sourceRawType, ModelRepository modelRepository, Context context, ProcessorSupport processorSupport) {
GeneratedMilestonedProperties generatedMilestonedProperties = MilestoningPropertyProcessor.processAssociationProperty(association, sourceRawType, property, context, processorSupport, modelRepository);
if (generatedMilestonedProperties.hasGeneratedProperties()) {
processOriginalMilestonedProperty(association, property, sourceGenericType, context, processorSupport);
Property edgePointProperty = (Property) generatedMilestonedProperties.getEdgePointProperty();
processAssociationProperty_internal(edgePointProperty, sourceGenericType, sourceRawType, context);
for (CoreInstance qualifiedProperty : generatedMilestonedProperties.getQualifiedProperties()) {
processAssociationQualifiedProperty_internal(association, (QualifiedProperty) qualifiedProperty, sourceRawType, context, processorSupport);
}
if (association.hasBeenValidated()) {
association.markNotValidated();
}
return generatedMilestonedProperties.getAllGeneratedProperties();
} else {
processAssociationProperty_internal(property, sourceGenericType, sourceRawType, context);
return Lists.immutable.empty();
}
}
use of org.finos.legend.pure.m3.compiler.postprocessing.processor.milestoning.GeneratedMilestonedProperties in project legend-pure by finos.
the class MilestoningPropertyProcessor method getSynthesizedMilestonedProperties.
public static ListIterable<GeneratedMilestonedProperties> getSynthesizedMilestonedProperties(PropertyOwner propertyOwner, CoreInstance propertySourceType, Iterable<? extends Property<?, ?>> properties, ModelRepository modelRepository, Context context, ProcessorSupport processorSupport) throws PureCompilationException {
MutableList<GeneratedMilestonedProperties> synthesizedMilestonedProperties = Lists.mutable.empty();
ListIterable<MilestoningStereotypeEnum> ownerMilestoneStereotypes = MilestoningFunctions.getTemporalStereoTypesFromTopMostNonTopTypeGeneralizations(propertySourceType, processorSupport);
properties.forEach(property -> {
CoreInstance returnType = ImportStub.withImportStubByPass(property._genericType()._rawTypeCoreInstance(), processorSupport);
if (returnType != null) {
ListIterable<MilestoningStereotypeEnum> returnTypeMilestoneStereotypes = MilestoningFunctions.getTemporalStereoTypesFromTopMostNonTopTypeGeneralizations(returnType, processorSupport);
if (returnTypeMilestoneStereotypes.notEmpty()) {
GeneratedMilestonedProperties generatedMilestonedProperties = new GeneratedMilestonedProperties(property);
String returnTypeIdOrPath = PackageableElement.getUserPathForPackageableElement(returnType);
org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.multiplicity.Multiplicity multiplicity = property._multiplicity();
returnTypeMilestoneStereotypes.forEach(milestoneStereotype -> {
ListIterable<AbstractProperty<?>> qualifiedProperties = getQualifiedProperties(property, propertyOwner, multiplicity, returnTypeIdOrPath, milestoneStereotype, ownerMilestoneStereotypes, context, processorSupport, modelRepository);
generatedMilestonedProperties.addQualifiedProperties(qualifiedProperties);
});
generatedMilestonedProperties.setEdgePointProperty(getEdgePointProperty(property, propertyOwner, multiplicity, returnTypeIdOrPath, modelRepository, context, processorSupport));
synthesizedMilestonedProperties.add(generatedMilestonedProperties);
}
}
});
return synthesizedMilestonedProperties;
}
Aggregations