forked from finos/legend-sdlc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid duplicate enum class generations (finos#641)
* Avoid duplicate enum class generations * Update writeEnumJavaClass * Fix build * Update Exception Co-authored-by: Kevin Knight <[email protected]> --------- Co-authored-by: Kevin Knight <[email protected]>
- Loading branch information
1 parent
83043c2
commit bb4bf2d
Showing
4 changed files
with
363 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...rc/test/resources/generation/service/RelationalServiceWithEnumParamsReused.generated.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package org.finos.service; | ||
|
||
import org.eclipse.collections.api.factory.Lists; | ||
import org.finos.legend.engine.language.pure.dsl.service.execution.AbstractServicePlanExecutor; | ||
import org.finos.legend.engine.language.pure.dsl.service.execution.ServiceVariable; | ||
import org.finos.legend.engine.plan.execution.result.Result; | ||
import org.finos.legend.engine.plan.execution.stores.StoreExecutorConfiguration; | ||
import org.finos.legend.engine.shared.core.url.StreamProvider; | ||
|
||
import java.util.List; | ||
|
||
public class RelationalServiceWithEnumParamsReused extends AbstractServicePlanExecutor | ||
{ | ||
public RelationalServiceWithEnumParamsReused() | ||
{ | ||
super("service::RelationalServiceWithEnumParamsReused", "org/finos/legend/sdlc/generation/service/entities/service/RelationalServiceWithEnumParamsReused.json", false); | ||
} | ||
|
||
public RelationalServiceWithEnumParamsReused(StoreExecutorConfiguration... storeExecutorConfigurations) | ||
{ | ||
super("service::RelationalServiceWithEnumParamsReused", "org/finos/legend/sdlc/generation/service/entities/service/RelationalServiceWithEnumParamsReused.json", storeExecutorConfigurations); | ||
} | ||
|
||
public Result execute(org.finos.model.Country cou, org.finos.model._enum.Country couName, String name) | ||
{ | ||
return this.execute(cou, couName, name, null); | ||
} | ||
|
||
public Result execute(org.finos.model.Country cou, org.finos.model._enum.Country couName, String name, StreamProvider streamProvider) | ||
{ | ||
return this.newExecutionBuilder(3) | ||
.withStreamProvider(streamProvider) | ||
.withParameter("cou", cou) | ||
.withParameter("couName", couName) | ||
.withParameter("name", name) | ||
.execute(); | ||
} | ||
|
||
@Override | ||
public final List<ServiceVariable> getServiceVariables() | ||
{ | ||
return Lists.mutable.of( | ||
this.newServiceVariable("cou", org.finos.model.Country.class, 0, 1), | ||
this.newServiceVariable("couName", org.finos.model._enum.Country.class, 1, 1), | ||
this.newServiceVariable("name", String.class, 1, 1) | ||
); | ||
} | ||
} |
289 changes: 289 additions & 0 deletions
289
...egend/sdlc/generation/service/entities/service/RelationalServiceWithEnumParamsReused.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,289 @@ | ||
{ | ||
"content": { | ||
"_type": "service", | ||
"autoActivateUpdates": true, | ||
"documentation": "", | ||
"execution": { | ||
"_type": "pureSingleExecution", | ||
"func": { | ||
"_type": "lambda", | ||
"body": [ | ||
{ | ||
"_type": "func", | ||
"function": "project", | ||
"parameters": [ | ||
{ | ||
"_type": "func", | ||
"function": "filter", | ||
"parameters": [ | ||
{ | ||
"_type": "func", | ||
"function": "getAll", | ||
"parameters": [ | ||
{ | ||
"_type": "packageableElementPtr", | ||
"fullPath": "model::SourcePerson" | ||
} | ||
] | ||
}, | ||
{ | ||
"_type": "lambda", | ||
"body": [ | ||
{ | ||
"_type": "func", | ||
"function": "and", | ||
"parameters": [ | ||
{ | ||
"_type": "func", | ||
"function": "equal", | ||
"parameters": [ | ||
{ | ||
"_type": "property", | ||
"parameters": [ | ||
{ | ||
"_type": "var", | ||
"name": "p" | ||
} | ||
], | ||
"property": "countryName" | ||
}, | ||
{ | ||
"_type": "var", | ||
"name": "couName" | ||
} | ||
] | ||
}, | ||
{ | ||
"_type": "func", | ||
"function": "equal", | ||
"parameters": [ | ||
{ | ||
"_type": "property", | ||
"parameters": [ | ||
{ | ||
"_type": "var", | ||
"name": "p" | ||
} | ||
], | ||
"property": "firstName" | ||
}, | ||
{ | ||
"_type": "var", | ||
"name": "name" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
], | ||
"parameters": [ | ||
{ | ||
"_type": "var", | ||
"name": "p" | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"_type": "collection", | ||
"multiplicity": { | ||
"lowerBound": 2, | ||
"upperBound": 2 | ||
}, | ||
"values": [ | ||
{ | ||
"_type": "lambda", | ||
"body": [ | ||
{ | ||
"_type": "property", | ||
"parameters": [ | ||
{ | ||
"_type": "var", | ||
"name": "x" | ||
} | ||
], | ||
"property": "lastName" | ||
} | ||
], | ||
"parameters": [ | ||
{ | ||
"_type": "var", | ||
"name": "x" | ||
} | ||
] | ||
}, | ||
{ | ||
"_type": "lambda", | ||
"body": [ | ||
{ | ||
"_type": "func", | ||
"function": "if", | ||
"parameters": [ | ||
{ | ||
"_type": "func", | ||
"function": "and", | ||
"parameters": [ | ||
{ | ||
"_type": "func", | ||
"function": "isNotEmpty", | ||
"parameters": [ | ||
{ | ||
"_type": "var", | ||
"name": "cou" | ||
} | ||
] | ||
}, | ||
{ | ||
"_type": "func", | ||
"function": "equal", | ||
"parameters": [ | ||
{ | ||
"_type": "var", | ||
"name": "cou" | ||
}, | ||
{ | ||
"_type": "property", | ||
"parameters": [ | ||
{ | ||
"_type": "packageableElementPtr", | ||
"fullPath": "model::Country" | ||
} | ||
], | ||
"property": "AMEA" | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"_type": "lambda", | ||
"body": [ | ||
{ | ||
"_type": "string", | ||
"value": "America" | ||
} | ||
], | ||
"parameters": [] | ||
}, | ||
{ | ||
"_type": "lambda", | ||
"body": [ | ||
{ | ||
"_type": "string", | ||
"value": "India" | ||
} | ||
], | ||
"parameters": [] | ||
} | ||
] | ||
} | ||
], | ||
"parameters": [ | ||
{ | ||
"_type": "var", | ||
"name": "x" | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"_type": "collection", | ||
"multiplicity": { | ||
"lowerBound": 2, | ||
"upperBound": 2 | ||
}, | ||
"values": [ | ||
{ | ||
"_type": "string", | ||
"value": "Last Name" | ||
}, | ||
{ | ||
"_type": "string", | ||
"value": "Country" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
], | ||
"parameters": [ | ||
{ | ||
"_type": "var", | ||
"class": "model::Country", | ||
"multiplicity": { | ||
"lowerBound": 0, | ||
"upperBound": 1 | ||
}, | ||
"name": "cou" | ||
}, | ||
{ | ||
"_type": "var", | ||
"class": "model::enum::Country", | ||
"multiplicity": { | ||
"lowerBound": 1, | ||
"upperBound": 1 | ||
}, | ||
"name": "couName" | ||
}, | ||
{ | ||
"_type": "var", | ||
"class": "String", | ||
"multiplicity": { | ||
"lowerBound": 1, | ||
"upperBound": 1 | ||
}, | ||
"name": "name" | ||
} | ||
] | ||
}, | ||
"mapping": "model::RelationalMapping", | ||
"runtime": { | ||
"_type": "engineRuntime", | ||
"connections": [ | ||
{ | ||
"store": { | ||
"path": "store::MyDatabase", | ||
"type": "STORE" | ||
}, | ||
"storeConnections": [ | ||
{ | ||
"connection": { | ||
"_type": "RelationalDatabaseConnection", | ||
"authenticationStrategy": { | ||
"_type": "h2Default" | ||
}, | ||
"databaseType": "H2", | ||
"datasourceSpecification": { | ||
"_type": "h2Local", | ||
"testDataSetupCsv": "MAIN_SCHEMA\nPERSON_TABLE\nID,FIRST_NAME,LAST_NAME,AGE,COUNTRY,COUNTRY_NAME\n1,Peter,Smith,22,AMEA,Europe\n2,John,Johnson,23,AMEA,America\n3,John,Peterson,26,AMEA,America\n" | ||
}, | ||
"element": "store::MyDatabase", | ||
"type": "H2" | ||
}, | ||
"id": "connection_1" | ||
} | ||
] | ||
} | ||
], | ||
"mappings": [ | ||
{ | ||
"path": "model::RelationalMapping", | ||
"type": "MAPPING" | ||
} | ||
] | ||
} | ||
}, | ||
"name": "RelationalServiceWithEnumParamsReused", | ||
"owners": [], | ||
"package": "service", | ||
"pattern": "/relationalService/{couName}/{name}", | ||
"test": { | ||
"_type": "singleExecutionTest", | ||
"asserts": [], | ||
"data": "" | ||
} | ||
}, | ||
"classifierPath": "meta::legend::service::metamodel::Service" | ||
} |