Search in sources :

Example 1 with GeneratedMilestonedProperties

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();
    }
}
Also used : CoreInstance(org.finos.legend.pure.m4.coreinstance.CoreInstance) GeneratedMilestonedProperties(org.finos.legend.pure.m3.compiler.postprocessing.processor.milestoning.GeneratedMilestonedProperties) AbstractProperty(org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.property.AbstractProperty) QualifiedProperty(org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.property.QualifiedProperty) Property(org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.property.Property)

Example 2 with GeneratedMilestonedProperties

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;
}
Also used : AbstractProperty(org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.property.AbstractProperty) CoreInstance(org.finos.legend.pure.m4.coreinstance.CoreInstance)

Aggregations

AbstractProperty (org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.property.AbstractProperty)2 CoreInstance (org.finos.legend.pure.m4.coreinstance.CoreInstance)2 GeneratedMilestonedProperties (org.finos.legend.pure.m3.compiler.postprocessing.processor.milestoning.GeneratedMilestonedProperties)1 Property (org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.property.Property)1 QualifiedProperty (org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.property.QualifiedProperty)1