Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor improvements #1543

Merged
merged 3 commits into from
Oct 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/smart-cows-tan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@finos/legend-application-studio': patch
'@finos/legend-extension-dsl-diagram': patch
'@finos/legend-extension-store-service-store': patch
'@finos/legend-graph': patch
'@finos/legend-query-builder': patch
---
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ import {
MULTIPLICITY_INFINITE,
Unit,
Type,
Multiplicity,
Enumeration,
Class,
PrimitiveType,
Expand Down Expand Up @@ -191,7 +190,7 @@ const ParameterBasicEditor = observer(
if (!isNaN(lBound) && (uBound === undefined || !isNaN(uBound))) {
rawVariableExpression_setMultiplicity(
parameter,
new Multiplicity(lBound, uBound),
editorStore.graphManagerState.graph.getMultiplicity(lBound, uBound),
);
}
};
Expand Down Expand Up @@ -445,7 +444,7 @@ const ReturnTypeEditor = observer(
if (!isNaN(lBound) && (uBound === undefined || !isNaN(uBound))) {
function_setReturnMultiplicity(
functionElement,
new Multiplicity(lBound, uBound),
editorStore.graphManagerState.graph.getMultiplicity(lBound, uBound),
);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ import {
type TaggedValue,
MULTIPLICITY_INFINITE,
Profile,
Multiplicity,
Class,
PrimitiveType,
Unit,
Expand Down Expand Up @@ -166,7 +165,10 @@ const AssociationPropertyBasicEditor = observer(
? upper
: parseInt(upper, 10);
if (!isNaN(lBound) && (uBound === undefined || !isNaN(uBound))) {
property_setMultiplicity(property, new Multiplicity(lBound, uBound));
property_setMultiplicity(
property,
editorStore.graphManagerState.graph.getMultiplicity(lBound, uBound),
);
}
};
const changeLowerBound: React.ChangeEventHandler<HTMLInputElement> = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ import {
Class,
GenericType,
Profile,
Multiplicity,
Type,
PrimitiveType,
Unit,
Expand Down Expand Up @@ -208,7 +207,10 @@ const PropertyBasicEditor = observer(
? upper
: parseInt(upper, 10);
if (!isNaN(lBound) && (uBound === undefined || !isNaN(uBound))) {
property_setMultiplicity(property, new Multiplicity(lBound, uBound));
property_setMultiplicity(
property,
editorStore.graphManagerState.graph.getMultiplicity(lBound, uBound),
);
}
};
const changeLowerBound: React.ChangeEventHandler<HTMLInputElement> = (
Expand Down Expand Up @@ -538,7 +540,7 @@ const DerivedPropertyBasicEditor = observer(
if (!isNaN(lBound) && (uBound === undefined || !isNaN(uBound))) {
property_setMultiplicity(
derivedProperty,
new Multiplicity(lBound, uBound),
editorStore.graphManagerState.graph.getMultiplicity(lBound, uBound),
);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ import {
} from '@finos/legend-art';
import {
type Type,
type Multiplicity,
Class,
DerivedProperty,
Property,
Multiplicity,
ELEMENT_PATH_DELIMITER,
MULTIPLICITY_INFINITE,
GenericType,
Expand Down Expand Up @@ -960,6 +960,7 @@ const DiagramEditorInlinePropertyMultiplicityEditor = observer(
const [upperBound, setUpperBound] = useState<string | number>(
value.upperBound ?? MULTIPLICITY_INFINITE,
);
const editorStore = useEditorStore();
const updateMultiplicity = (
lower: number | string,
upper: number | string,
Expand All @@ -972,7 +973,9 @@ const DiagramEditorInlinePropertyMultiplicityEditor = observer(
? upper
: parseInt(upper, 10);
if (!isNaN(lBound) && (uBound === undefined || !isNaN(uBound))) {
updateValue(new Multiplicity(lBound, uBound));
updateValue(
editorStore.graphManagerState.graph.getMultiplicity(lBound, uBound),
);
}
};
const changeLowerBound: React.ChangeEventHandler<HTMLInputElement> = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ import {
fromElementPathToMappingElementId,
InferableMappingElementIdImplicitValue,
InferableMappingElementRootExplicitValue,
Multiplicity,
V1_ElementBuilder,
V1_initPackageableElement,
V1_buildFullPath,
Expand Down Expand Up @@ -258,7 +257,7 @@ export class STO_ServiceStore_PureProtocolProcessorPlugin
const mappingProperty = new LocalMappingProperty();
mappingProperty.type = localMappingProperty.type;
mappingProperty.name = localMappingProperty.name;
const multiplicity = new Multiplicity(
const multiplicity = context.graph.getMultiplicity(
localMappingProperty.multiplicity.lowerBound,
localMappingProperty.multiplicity.upperBound,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import { Class } from '../../../../../../../../graph/metamodel/pure/packageableE
import { DerivedProperty } from '../../../../../../../../graph/metamodel/pure/packageableElements/domain/DerivedProperty.js';
import { GenericType } from '../../../../../../../../graph/metamodel/pure/packageableElements/domain/GenericType.js';
import { GenericTypeExplicitReference } from '../../../../../../../../graph/metamodel/pure/packageableElements/domain/GenericTypeReference.js';
import { Multiplicity } from '../../../../../../../../graph/metamodel/pure/packageableElements/domain/Multiplicity.js';
import { Property } from '../../../../../../../../graph/metamodel/pure/packageableElements/domain/Property.js';
import { V1_Multiplicity } from '../../../../model/packageableElements/domain/V1_Multiplicity.js';
import type { V1_ValueSpecification } from '../../../../model/valueSpecification/V1_ValueSpecification.js';
Expand Down Expand Up @@ -83,7 +82,7 @@ export const V1_buildMilestoningProperties = (
];
const milestonedAllVersions = new Property(
`${property.name}${MILESTONING_VERSION_PROPERTY_SUFFIX.ALL_VERSIONS}`,
new Multiplicity(property.multiplicity.lowerBound, undefined),
graph.getMultiplicity(property.multiplicity.lowerBound, undefined),
GenericTypeExplicitReference.create(
new GenericType(property.genericType.value.rawType),
),
Expand Down Expand Up @@ -126,7 +125,7 @@ export const V1_buildMilestoningProperties = (
];
const milestonedAllVersions = new Property(
`${property.name}${MILESTONING_VERSION_PROPERTY_SUFFIX.ALL_VERSIONS}`,
new Multiplicity(property.multiplicity.lowerBound, undefined),
graph.getMultiplicity(property.multiplicity.lowerBound, undefined),
GenericTypeExplicitReference.create(
new GenericType(property.genericType.value.rawType),
),
Expand Down Expand Up @@ -172,7 +171,7 @@ export const V1_buildMilestoningProperties = (
];
const milestonedAllVersions = new Property(
`${property.name}${MILESTONING_VERSION_PROPERTY_SUFFIX.ALL_VERSIONS}`,
new Multiplicity(property.multiplicity.lowerBound, undefined),
graph.getMultiplicity(property.multiplicity.lowerBound, undefined),
GenericTypeExplicitReference.create(
new GenericType(property.genericType.value.rawType),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ import {
PureListInstanceValue,
CollectionInstanceValue,
} from '../../../../../../../../graph/metamodel/pure/valueSpecification/InstanceValue.js';
import { Multiplicity } from '../../../../../../../../graph/metamodel/pure/packageableElements/domain/Multiplicity.js';
import type { Multiplicity } from '../../../../../../../../graph/metamodel/pure/packageableElements/domain/Multiplicity.js';
import type { Type } from '../../../../../../../../graph/metamodel/pure/packageableElements/domain/Type.js';
import { PropertyExplicitReference } from '../../../../../../../../graph/metamodel/pure/packageableElements/domain/PropertyReference.js';
import { PackageableElementExplicitReference } from '../../../../../../../../graph/metamodel/pure/packageableElements/PackageableElementReference.js';
Expand Down Expand Up @@ -168,7 +168,7 @@ export class V1_ValueSpecificationBuilder
visit_Variable(variable: V1_Variable): ValueSpecification {
this.openVariables.push(variable.name);
if (variable.class && variable.multiplicity) {
const multiplicity = new Multiplicity(
const multiplicity = this.context.graph.getMultiplicity(
variable.multiplicity.lowerBound,
variable.multiplicity.upperBound,
);
Expand Down Expand Up @@ -264,7 +264,7 @@ export class V1_ValueSpecificationBuilder
),
);
const instance = new CollectionInstanceValue(
new Multiplicity(
this.context.graph.getMultiplicity(
valueSpecification.multiplicity.lowerBound,
valueSpecification.multiplicity.upperBound,
),
Expand Down Expand Up @@ -380,7 +380,7 @@ export class V1_ValueSpecificationBuilder
PRIMITIVE_TYPE.INTEGER,
valueSpecification.values,
this.context,
new Multiplicity(
this.context.graph.getMultiplicity(
valueSpecification.multiplicity.lowerBound,
valueSpecification.multiplicity.upperBound,
),
Expand All @@ -392,7 +392,7 @@ export class V1_ValueSpecificationBuilder
PRIMITIVE_TYPE.DECIMAL,
valueSpecification.values,
this.context,
new Multiplicity(
this.context.graph.getMultiplicity(
valueSpecification.multiplicity.lowerBound,
valueSpecification.multiplicity.upperBound,
),
Expand All @@ -404,7 +404,7 @@ export class V1_ValueSpecificationBuilder
PRIMITIVE_TYPE.STRING,
valueSpecification.values,
this.context,
new Multiplicity(
this.context.graph.getMultiplicity(
valueSpecification.multiplicity.lowerBound,
valueSpecification.multiplicity.upperBound,
),
Expand All @@ -416,7 +416,7 @@ export class V1_ValueSpecificationBuilder
PRIMITIVE_TYPE.BOOLEAN,
valueSpecification.values,
this.context,
new Multiplicity(
this.context.graph.getMultiplicity(
valueSpecification.multiplicity.lowerBound,
valueSpecification.multiplicity.upperBound,
),
Expand All @@ -428,7 +428,7 @@ export class V1_ValueSpecificationBuilder
PRIMITIVE_TYPE.FLOAT,
valueSpecification.values,
this.context,
new Multiplicity(
this.context.graph.getMultiplicity(
valueSpecification.multiplicity.lowerBound,
valueSpecification.multiplicity.upperBound,
),
Expand All @@ -440,7 +440,7 @@ export class V1_ValueSpecificationBuilder
PRIMITIVE_TYPE.DATETIME,
valueSpecification.values,
this.context,
new Multiplicity(
this.context.graph.getMultiplicity(
valueSpecification.multiplicity.lowerBound,
valueSpecification.multiplicity.upperBound,
),
Expand All @@ -452,7 +452,7 @@ export class V1_ValueSpecificationBuilder
PRIMITIVE_TYPE.STRICTDATE,
valueSpecification.values,
this.context,
new Multiplicity(
this.context.graph.getMultiplicity(
valueSpecification.multiplicity.lowerBound,
valueSpecification.multiplicity.upperBound,
),
Expand All @@ -464,7 +464,7 @@ export class V1_ValueSpecificationBuilder
PRIMITIVE_TYPE.STRICTTIME,
valueSpecification.values,
this.context,
new Multiplicity(
this.context.graph.getMultiplicity(
valueSpecification.multiplicity.lowerBound,
valueSpecification.multiplicity.upperBound,
),
Expand All @@ -476,7 +476,7 @@ export class V1_ValueSpecificationBuilder
PRIMITIVE_TYPE.LATESTDATE,
[],
this.context,
new Multiplicity(
this.context.graph.getMultiplicity(
valueSpecification.multiplicity.lowerBound,
valueSpecification.multiplicity.upperBound,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import {
MULTIPLICITY_INFINITE,
PRIMITIVE_TYPE,
VariableExpression,
Multiplicity,
GenericTypeExplicitReference,
GenericType,
} from '@finos/legend-graph';
Expand Down Expand Up @@ -347,7 +346,7 @@ export const QueryBuilderParametersPanel = observer(
const parmaterState = new LambdaParameterState(
new VariableExpression(
generateEnumerableNameFromToken(varNames, DEFAULT_VARIABLE_NAME),
new Multiplicity(1, 1),
queryBuilderState.graphManagerState.graph.getMultiplicity(1, 1),
GenericTypeExplicitReference.create(
new GenericType(
queryParameterState.queryBuilderState.graphManagerState.graph.getPrimitiveType(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import {
extractElementNameFromPath,
V1_AppliedProperty,
CollectionInstanceValue,
Multiplicity,
INTERNAL__UnknownValueSpecification,
V1_Variable,
V1_serializeValueSpecification,
Expand Down Expand Up @@ -390,7 +389,7 @@ export const V1_buildProjectFunctionExpression = (

// build column expressions taking into account of derivation
const processedColumnExpressions = new CollectionInstanceValue(
new Multiplicity(
compileContext.graph.getMultiplicity(
columnExpressions.multiplicity.lowerBound,
columnExpressions.multiplicity.upperBound,
),
Expand Down Expand Up @@ -510,7 +509,7 @@ export const V1_buildGroupByFunctionExpression = (

// build column expressions taking into account of derivation
const processedColumnExpressions = new CollectionInstanceValue(
new Multiplicity(
compileContext.graph.getMultiplicity(
columnExpressions.multiplicity.lowerBound,
columnExpressions.multiplicity.upperBound,
),
Expand All @@ -532,7 +531,7 @@ export const V1_buildGroupByFunctionExpression = (

// build aggregation expressions taking into account of derivation
const processedAggregationExpressions = new CollectionInstanceValue(
new Multiplicity(
compileContext.graph.getMultiplicity(
aggregationExpressions.multiplicity.lowerBound,
aggregationExpressions.multiplicity.upperBound,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {
extractElementNameFromPath,
GenericType,
GenericTypeExplicitReference,
Multiplicity,
PrimitiveInstanceValue,
PRIMITIVE_TYPE,
SimpleFunctionExpression,
Expand Down Expand Up @@ -126,10 +125,11 @@ const appendResultSetModifier = (
),
multiplicityOne,
);
const multiplicity = new Multiplicity(
resultModifierState.sortColumns.length,
resultModifierState.sortColumns.length,
);
const multiplicity =
resultModifierState.projectionState.queryBuilderState.graphManagerState.graph.getMultiplicity(
resultModifierState.sortColumns.length,
resultModifierState.sortColumns.length,
);
const collection = new CollectionInstanceValue(
multiplicity,
undefined,
Expand Down Expand Up @@ -215,21 +215,21 @@ export const appendProjection = (
);

const colLambdas = new CollectionInstanceValue(
new Multiplicity(
queryBuilderState.graphManagerState.graph.getMultiplicity(
projectionState.columns.length -
projectionState.aggregationState.columns.length,
projectionState.columns.length -
projectionState.aggregationState.columns.length,
),
);
const aggregateLambdas = new CollectionInstanceValue(
new Multiplicity(
queryBuilderState.graphManagerState.graph.getMultiplicity(
projectionState.aggregationState.columns.length,
projectionState.aggregationState.columns.length,
),
);
const colAliases = new CollectionInstanceValue(
new Multiplicity(
queryBuilderState.graphManagerState.graph.getMultiplicity(
projectionState.columns.length,
projectionState.columns.length,
),
Expand Down Expand Up @@ -330,13 +330,13 @@ export const appendProjection = (
multiplicityOne,
);
const colLambdas = new CollectionInstanceValue(
new Multiplicity(
queryBuilderState.graphManagerState.graph.getMultiplicity(
projectionState.columns.length,
projectionState.columns.length,
),
);
const colAliases = new CollectionInstanceValue(
new Multiplicity(
queryBuilderState.graphManagerState.graph.getMultiplicity(
projectionState.columns.length,
projectionState.columns.length,
),
Expand Down