Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit58f13a4

Browse files
Thomasludomikula
Thomas
authored andcommitted
Add Bundle DSP
1 parent4b4f61d commit58f13a4

File tree

3 files changed

+37
-3
lines changed

3 files changed

+37
-3
lines changed

‎server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/bundle/model/Bundle.java‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
importorg.lowcoder.sdk.models.HasIdAndAuditing;
1010
importorg.springframework.data.mongodb.core.mapping.Document;
1111

12+
importjava.util.Map;
13+
1214
@Getter
1315
@Setter
1416
@Document
@@ -23,7 +25,11 @@ public class Bundle extends HasIdAndAuditing {
2325
privateStringcategory;
2426
privateStringimage;
2527
privateBundleStatusbundleStatus;
28+
2629
privateBooleanpublicToAll;
2730
privateBooleanpublicToMarketplace;
2831
privateBooleanagencyProfile;
32+
33+
privateMap<String,Object>editingBundleDSL;
34+
privateMap<String,Object>publishedBundleDSL;
2935
}

‎server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/bundle/BundleApiServiceImpl.java‎

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,13 @@
1616
importorg.lowcoder.api.permission.PermissionHelper;
1717
importorg.lowcoder.api.permission.view.PermissionItemView;
1818
importorg.lowcoder.api.usermanagement.OrgDevChecker;
19+
importorg.lowcoder.domain.application.model.Application;
1920
importorg.lowcoder.domain.application.model.ApplicationStatus;
2021
importorg.lowcoder.domain.application.model.ApplicationType;
22+
importorg.lowcoder.domain.application.repository.ApplicationRepository;
2123
importorg.lowcoder.domain.application.service.ApplicationServiceImpl;
2224
importorg.lowcoder.domain.bundle.model.*;
25+
importorg.lowcoder.domain.bundle.repository.BundleRepository;
2326
importorg.lowcoder.domain.bundle.service.BundleElementRelationService;
2427
importorg.lowcoder.domain.bundle.service.BundleNode;
2528
importorg.lowcoder.domain.bundle.service.BundleService;
@@ -47,6 +50,7 @@
4750
importjava.util.*;
4851
importjava.util.function.Function;
4952
importjava.util.function.ToLongFunction;
53+
importjava.util.stream.Collectors;
5054

5155
importstaticorg.apache.commons.collections4.CollectionUtils.isNotEmpty;
5256
importstaticorg.lowcoder.domain.bundle.model.BundleStatus.NORMAL;
@@ -72,6 +76,8 @@ public class BundleApiServiceImpl implements BundleApiService {
7276
privatefinalOrganizationServiceorganizationService;
7377
privatefinalFolderApiServicefolderApiService;
7478
privatefinalApplicationServiceImplapplicationServiceImpl;
79+
privatefinalApplicationRepositoryapplicationRepository;
80+
privatefinalBundleRepositorybundleRepository;
7581

7682
@Override
7783
publicMono<BundleInfoView>create(CreateBundleRequestcreateBundleRequest) {
@@ -262,11 +268,27 @@ public Mono<Void> moveApp(String applicationId, String fromBundleId, String toBu
262268
if (StringUtils.isBlank(toBundleId)) {
263269
returnMono.empty();
264270
}
265-
returnbundleElementRelationService.create(toBundleId,applicationId);
271+
returnbundleService.findById(fromBundleId).map(bundle -> {
272+
varmap =bundle.getEditingBundleDSL();
273+
if(map ==null)map =newHashMap<>();
274+
((List<Application>)map.computeIfAbsent("applications",k->newArrayList<>())).removeIf(app ->app.getId() ==applicationId);
275+
bundle.setEditingBundleDSL(map);
276+
returnbundle;
277+
}).map(bundle ->applicationRepository.findById(applicationId)
278+
.flatMap(newapplication ->addAppToBundle(bundle,newapplication)))
279+
.then(bundleElementRelationService.create(toBundleId,applicationId));
266280
})
267281
.then();
268282
}
269283

284+
privateMono<Bundle>addAppToBundle(Bundlebundle,Applicationnewapplication) {
285+
varmap =bundle.getEditingBundleDSL();
286+
if(map ==null)map =newHashMap<>();
287+
((List<Application>)map.computeIfAbsent("applications",k->newArrayList<>())).add(newapplication);
288+
bundle.setEditingBundleDSL(map);
289+
returnbundleRepository.save(bundle);
290+
}
291+
270292
/**
271293
* @param applicationId app id to add
272294
* @param toBundleId bundle id to add app to
@@ -283,7 +305,9 @@ public Mono<Void> addApp(String applicationId, String toBundleId) {
283305
if (StringUtils.isBlank(toBundleId)) {
284306
returnMono.empty();
285307
}
286-
returnbundleElementRelationService.create(toBundleId,applicationId);
308+
returnbundleService.findById(toBundleId).map(bundle ->applicationRepository.findById(applicationId)
309+
.flatMap(newapplication->addAppToBundle(bundle,newapplication)))
310+
.then(bundleElementRelationService.create(toBundleId,applicationId));
287311
})
288312
.then();
289313
}
@@ -344,6 +368,8 @@ public Mono<BundleInfoView> getPublishedBundle(String bundleId, BundleRequestTyp
344368
.category(bundle.getCategory())
345369
.description(bundle.getDescription())
346370
.image(bundle.getImage())
371+
// .editingBundleDSL(bundle.getEditingBundleDSL())
372+
.publishedBundleDSL(bundle.getPublishedBundleDSL())
347373
.publicToMarketplace(bundle.getPublicToMarketplace())
348374
.publicToAll(bundle.getPublicToAll())
349375
.agencyProfile(bundle.getAgencyProfile())

‎server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/bundle/view/BundleInfoView.java‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
importjava.time.Instant;
1010
importjava.util.List;
11+
importjava.util.Map;
1112

1213
@Getter
1314
@Setter
@@ -31,7 +32,8 @@ public class BundleInfoView {
3132
privatebooleanisVisible;
3233
privatebooleanisManageable;
3334

34-
privateList<ApplicationInfoView>subApplications;
35+
privateMap<String,Object>editingBundleDSL;
36+
privateMap<String,Object>publishedBundleDSL;
3537

3638
privatefinalInstantcreateTime;
3739

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp