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

Merge Release #3366

Merged
merged 140 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
140 commits
Select commit Hold shift + click to select a range
b03725c
adds endpoint for form backend version info
thoniTUB Jan 31, 2024
0cdf0a7
adds version fallback
thoniTUB Jan 31, 2024
2c5f984
collect values on shards, send them to manager and register in search
awildturtok Jul 13, 2023
02d2b56
remove obsolete shared dictionary reference in test
thoniTUB Feb 7, 2024
8ac2385
adds message interfaces for messages that require coordination betwee…
thoniTUB Feb 7, 2024
8687be1
shrink all searches
thoniTUB Feb 7, 2024
f76c4b9
Rearrange methods for filter search so that searches are partially in…
thoniTUB Feb 8, 2024
59895a6
Rearrange methods for filter search so that searches are partially in…
thoniTUB Feb 8, 2024
2decb44
group out searchable columns earlier
thoniTUB Feb 8, 2024
5fb04ac
fix NPE
thoniTUB Feb 8, 2024
7bde674
adds logs about job progression
thoniTUB Feb 8, 2024
a6db9eb
use Object2IntMap in Bucket and add serdes
thoniTUB Feb 12, 2024
1f522bc
fix NPE
thoniTUB Feb 13, 2024
6d41c8f
fix empty store condition
thoniTUB Feb 13, 2024
389df43
Remove dead code
thoniTUB Feb 14, 2024
3c49a6a
reenable FilterAutocompleteTest in SQLMode
thoniTUB Feb 14, 2024
57ef0d3
remove dead code
thoniTUB Feb 14, 2024
6d0d0f9
remove entities map, as it is covered by entity2bucket map
thoniTUB Feb 19, 2024
0cd361f
fixes from rebase
thoniTUB Feb 20, 2024
c6dab75
capsule entity set in BucketManager
thoniTUB Feb 20, 2024
67c18a6
Merge branch 'develop' into feature/bye-bye-dictionaries
thoniTUB Feb 22, 2024
6a96d41
adds missing import for Objects
awildturtok Feb 22, 2024
a3ce448
open and close all tested stores
thoniTUB Feb 29, 2024
6186847
fix log message
thoniTUB Feb 29, 2024
f757a18
Merge branch 'develop' into feature/bye-bye-dictionaries
thoniTUB Mar 5, 2024
c5e70cb
remove shared dict from sql test
thoniTUB Mar 5, 2024
d4ef09d
remove shared dict from openapi spec
thoniTUB Mar 5, 2024
ae3ad5b
Merge pull request #3131 from ingef/feature/bye-bye-dictionaries
thoniTUB Mar 5, 2024
bf7c6b3
capsule environment management
thoniTUB Mar 5, 2024
333698f
use env location as key as it is a unique identifier
thoniTUB Mar 5, 2024
ca6887e
Merge branch 'develop' into fix/dangling-open-xodux-store
thoniTUB Mar 5, 2024
7f6160c
fix not testing nested ReusedQueries, and fix not checking DateFormat…
awildturtok Mar 5, 2024
422004b
adds docu
thoniTUB Mar 5, 2024
63c6f0e
Merge pull request #3326 from ingef/feature/fix-contains-dates-of-reused
awildturtok Mar 5, 2024
4a06118
unroll span in MatchingStats.Entry#addEvent
awildturtok Mar 5, 2024
dedb8e3
use delegate instead of proxy
thoniTUB Mar 6, 2024
d9c3888
Merge branch 'develop' into fix/dangling-open-xodux-store
thoniTUB Mar 6, 2024
7e75d0d
Fix date restriction and validity date conversion (#3325)
jnsrnhld Mar 6, 2024
3ad99ff
Merge branch 'develop' into fix/dangling-open-xodux-store
thoniTUB Mar 6, 2024
dfa8049
Merge pull request #3321 from ingef/fix/dangling-open-xodux-store
thoniTUB Mar 6, 2024
175f889
Merge branch 'develop' into reintegrate-master
awildturtok Mar 6, 2024
c89bdd3
fix slow BooleanColumnStatsCollector
awildturtok Mar 6, 2024
f4f337c
Implement SecondaryId conversion (#3317)
jnsrnhld Mar 6, 2024
c1d8b14
fix usage of Atomics in singleThreaded code
awildturtok Mar 6, 2024
84cb616
cleanup tests after merge
awildturtok Mar 6, 2024
de3768c
fix Entry constructor
awildturtok Mar 6, 2024
b731823
ignore getSpan for json
awildturtok Mar 6, 2024
0c8b06c
drop subclasses of CDateRange as vtables are expensive
awildturtok Mar 6, 2024
a2f286a
Merge pull request #3328 from ingef/reintegrate-master
awildturtok Mar 6, 2024
22273a8
Merge branch 'develop' into feature/dont-use-atomics
awildturtok Mar 6, 2024
f2ad7e4
adds `missing` label to boolean stats extras
awildturtok Mar 6, 2024
87f9a54
fix more missing for string ColumnStats
awildturtok Mar 6, 2024
eb601f4
Merge CDateRange classes and close it
awildturtok Mar 6, 2024
fecb070
Merge pull request #3330 from ingef/feature/faster-matching-stats
awildturtok Mar 6, 2024
094bbe3
Merge pull request #3331 from ingef/feature/drop-CDateRange-subclasses
awildturtok Mar 6, 2024
88ba41b
Merge pull request #3329 from ingef/feature/dont-use-atomics
awildturtok Mar 6, 2024
d2cbe78
shutdown ExecutorService
awildturtok Mar 6, 2024
9e84864
Fix not counting entities
awildturtok Mar 6, 2024
b8fbcf3
adds ProtoRole to AuthorizationConfig and implementations. Registers …
awildturtok Mar 6, 2024
e820b9e
cleanup file
awildturtok Mar 6, 2024
a6c2fff
attach Roles to incoming users in JwtPkceVerifyingRealm
awildturtok Mar 6, 2024
7bd8ef8
adds null-checks
awildturtok Mar 6, 2024
55f08e7
adds process-barrier to JwtPkceVerifyingRealm.handleRoleClaims to avo…
awildturtok Mar 7, 2024
d04f71d
adds default admin role with admin permissions
awildturtok Mar 7, 2024
7209256
migrate to key-id, as access token hash is null
awildturtok Mar 7, 2024
85ed3a4
Implement test for role mapping
awildturtok Mar 7, 2024
dfe8f82
cleanup usage of audience
awildturtok Mar 7, 2024
e2495d8
fixes reusing JWT-Key-Id, with differing contents.
awildturtok Mar 7, 2024
2459a82
short-cut admin login
thoniTUB Mar 7, 2024
4cd1218
cleanup ftl
thoniTUB Mar 7, 2024
44eec14
Merge pull request #3336 from ingef/feature/short-cut-admin-ui-login
thoniTUB Mar 7, 2024
90c02e5
Merge branch 'develop' into feature/clean-up-ftl
thoniTUB Mar 7, 2024
f1a9606
Merge pull request #3337 from ingef/feature/clean-up-ftl
thoniTUB Mar 7, 2024
43f02db
Merge branch 'develop' into feature/role-matching-oidc
awildturtok Mar 7, 2024
b8c4ad3
Merge pull request #3335 from ingef/feature/role-matching-oidc
awildturtok Mar 7, 2024
8a388e0
Rework SqlTables (#3332)
jnsrnhld Mar 8, 2024
fe16a40
Merge pull request #3334 from ingef/feature/properly-count-rows
awildturtok Mar 11, 2024
cf04337
speedup DateColumnStatsCollector:
awildturtok Mar 11, 2024
21cc4c0
Merge pull request #3340 from ingef/feature/speedup-date-statistics
awildturtok Mar 11, 2024
b5850a3
i deleted the wrong field: We need months not quarters
awildturtok Mar 11, 2024
cb2beb1
use fastmap and sort at later
awildturtok Mar 11, 2024
378ff5c
Merge pull request #3341 from ingef/feature/speedup-date-statistics
awildturtok Mar 11, 2024
01cb649
Use java.nio.file.Files::createDirectories to create the dumpfile parent
SebChmie Mar 11, 2024
36247df
Apply suggestions from code review
SebChmie Mar 12, 2024
ebb55a8
Merge pull request #3342 from ingef/fix/storage-dump
awildturtok Mar 12, 2024
2f9d5a6
allow Statistics for all SingleTableResults
awildturtok Mar 14, 2024
9334178
don't compute dates stats when no dates in query.
awildturtok Mar 14, 2024
78085db
drop SqlManagedQuery, and instead move SQL concerns into SqlExecution…
awildturtok Mar 14, 2024
ce6236f
wip
awildturtok Mar 18, 2024
3e8877c
Merge branch 'develop' into feature/form_backend_version_info
thoniTUB Mar 18, 2024
af5422a
Merge pull request #3286 from ingef/feature/form_backend_version_info
thoniTUB Mar 18, 2024
f969776
Move frontend Dockerfile to root; add git describe
Kadrian Mar 18, 2024
5d94b55
Merge branch 'develop' into improve-version-handling
Kadrian Mar 18, 2024
5620aba
And fix typo in frontend Dockerfile
Kadrian Mar 18, 2024
717ae50
Check if file exsits; add Version to HelpMenu
Kadrian Mar 18, 2024
d6e8568
Fix types
Kadrian Mar 18, 2024
16a08d3
fix NPE when concept is not present for entity
awildturtok Mar 18, 2024
617b61d
don't write Map if already written. Log mismatched Bucket assignment
awildturtok Mar 18, 2024
931d7b6
Fix z-index stacking for forms navigation
Kadrian Mar 18, 2024
986e5ad
Merge pull request #3350 from ingef/fix-z-index-stacking
Kadrian Mar 18, 2024
b6b5f46
Remove overly complicated drag handle disabling
Kadrian Mar 18, 2024
e427793
Merge pull request #3352 from ingef/fix-drag-handles-z-index
Kadrian Mar 18, 2024
6dc0964
Merge pull request #3351 from ingef/feature/log-trace-exceptions
awildturtok Mar 18, 2024
19e17ed
Merge pull request #3344 from ingef/feature/stats-for-internal-form
awildturtok Mar 18, 2024
89a2d4a
Select input after selecting item
Kadrian Mar 18, 2024
91dc405
Merge pull request #3354 from ingef/select-input-after-selecting-item
Kadrian Mar 18, 2024
201f5f0
Merge branch 'develop' into improve-version-handling
thoniTUB Mar 19, 2024
3b964a9
Merge pull request #3349 from ingef/improve-version-handling
thoniTUB Mar 19, 2024
73a11cc
set log message to trace
thoniTUB Mar 19, 2024
8329f7d
adds finalize message to support multiple ReactionMessage per worker
thoniTUB Mar 19, 2024
989f9e7
apply intellij suggestions
thoniTUB Mar 19, 2024
7c15a45
prepare unification of SqlExecutionManager and DistributedExecutionMa…
awildturtok Mar 19, 2024
74449b0
Merge pull request #3356 from ingef/fix/verbose-logging-of-empty-date…
thoniTUB Mar 19, 2024
c3a3055
unify Distributed and SqlExecutionManager
awildturtok Mar 19, 2024
03aca7a
Fix form handling in Sql execution manager
jnsrnhld Mar 19, 2024
3fd4a38
Fix endless loop
jnsrnhld Mar 19, 2024
740ac38
inline CollectQueryResult into ShardResults
awildturtok Mar 19, 2024
d572e29
Merge pull request #3355 from ingef/master
awildturtok Mar 19, 2024
aadf06a
log warning for faulty message reception
awildturtok Mar 19, 2024
37dbb80
Update backend/src/main/java/com/bakdata/conquery/models/query/Distri…
awildturtok Mar 21, 2024
82e6829
Merge pull request #3347 from ingef/feature/invert-control-for-Execut…
awildturtok Mar 21, 2024
6f053f2
Merge branch 'develop' into fix/action-reaction-multiple-messages-han…
awildturtok Mar 21, 2024
a3c39f4
Merge pull request #3357 from ingef/fix/action-reaction-multiple-mess…
awildturtok Mar 21, 2024
618f526
adds more explicit logging for WorkerHandler
awildturtok Mar 25, 2024
8f68b37
drop limit for large MultiSelects, as the performance penalty is no l…
awildturtok Mar 27, 2024
99df7e1
Merge pull request #3362 from ingef/feature/dont-block-large-filter-q…
awildturtok Mar 27, 2024
fe1094c
Merge pull request #3364 from ingef/fix/search-already-shrunk
awildturtok Mar 28, 2024
5b11240
Merge pull request #3346 from ingef/feature/dont-render-empty-dates
awildturtok Mar 28, 2024
67cc873
gather searchables independentyl and sum them up
thoniTUB Apr 4, 2024
bfd703a
removes unecessary members from FilterSearch
thoniTUB Apr 8, 2024
fff0bba
generate hashcode for LabelMap
thoniTUB Apr 8, 2024
85a86e3
adds FilterSearchTest
thoniTUB Apr 8, 2024
8d4c027
request all search totals after UpdateFilterSearchJob
thoniTUB Apr 8, 2024
1ec91d8
Update backend/src/test/java/com/bakdata/conquery/service/FilterSearc…
awildturtok Apr 8, 2024
ece2ced
don't cache label map in SelectFilter
thoniTUB Apr 8, 2024
78de795
optimize imports
thoniTUB Apr 8, 2024
2eb9ec6
puts search finalizer in job
thoniTUB Apr 8, 2024
1310f67
Merge pull request #3376 from ingef/fix/search-totals
awildturtok Apr 8, 2024
9fc8a41
fix casting of query result preview
awildturtok Apr 8, 2024
32d05c4
Merge pull request #3377 from ingef/fix/internal-form-cast
thoniTUB Apr 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion .github/workflows/create_backend_branch_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
- master
- release
- staging/**

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}-backend
Expand Down Expand Up @@ -48,6 +48,7 @@ jobs:
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
file: backend.Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
1 change: 1 addition & 0 deletions .github/workflows/create_backend_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
file: backend.Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
5 changes: 3 additions & 2 deletions .github/workflows/create_frontend_branch_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
- master
- release
- staging/*

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}-frontend
Expand Down Expand Up @@ -47,7 +47,8 @@ jobs:
- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: ./frontend
context: .
file: frontend.Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
3 changes: 2 additions & 1 deletion .github/workflows/create_frontend_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ jobs:
- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: ./frontend
context: .
file: frontend.Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
15 changes: 8 additions & 7 deletions .github/workflows/test_build_backend_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ on:
- develop
- master
paths:
- 'backend/**'
- 'executable/**'
- 'Dockerfile'
- 'pom.xml'
- 'lombok.config'
- 'scripts/**'
- '.github/workflows/test_build_backend_image.yml'
- "backend/**"
- "executable/**"
- "Dockerfile"
- "pom.xml"
- "lombok.config"
- "scripts/**"
- ".github/workflows/test_build_backend_image.yml"

env:
REGISTRY: ghcr.io
Expand All @@ -42,4 +42,5 @@ jobs:
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
file: backend.Dockerfile
push: false
9 changes: 5 additions & 4 deletions .github/workflows/test_build_frontend_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ on:
- develop
- master
paths:
- 'frontend/*'
- 'scripts/*'
- '.github/workflows/test_build_frontend_image.yml'
- "frontend/*"
- "scripts/*"
- ".github/workflows/test_build_frontend_image.yml"
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}-frontend
Expand All @@ -36,5 +36,6 @@ jobs:
- name: Build docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: ./frontend
context: .
file: frontend.Dockerfile
push: false
File renamed without changes.
2 changes: 0 additions & 2 deletions backend/src/main/java/com/bakdata/conquery/Conquery.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import javax.validation.Validator;

import ch.qos.logback.classic.Level;
import com.bakdata.conquery.commands.CollectEntitiesCommand;
import com.bakdata.conquery.commands.DistributedStandaloneCommand;
import com.bakdata.conquery.commands.ManagerNode;
import com.bakdata.conquery.commands.MigrateCommand;
Expand Down Expand Up @@ -54,7 +53,6 @@ public void initialize(Bootstrap<ConqueryConfig> bootstrap) {

bootstrap.addCommand(new ShardNode());
bootstrap.addCommand(new PreprocessorCommand());
bootstrap.addCommand(new CollectEntitiesCommand());
bootstrap.addCommand(new DistributedStandaloneCommand(this));
bootstrap.addCommand(new RecodeStoreCommand());
bootstrap.addCommand(new MigrateCommand());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public class ConqueryConstants {
OBSERVATION_SCOPE_INFO =
new LocalizedDefaultResultInfo((l) -> C10N.get(ResultHeadersC10n.class, l).observationScope(), new ResultType.StringT(FeatureGroup::localizeValue), Set.of());

public static final String PRIMARY_DICTIONARY = "PRIMARY_DICTIONARY";
/**
* Drawn from random.org
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import com.bakdata.conquery.apiv1.frontend.FrontendValue;
import com.bakdata.conquery.io.cps.CPSType;
import com.bakdata.conquery.io.jackson.serializer.NsIdRef;
import com.bakdata.conquery.io.storage.NamespaceStorage;
import com.bakdata.conquery.models.config.IndexConfig;
import com.bakdata.conquery.models.datasets.Dataset;
import com.bakdata.conquery.models.datasets.concepts.Searchable;
Expand Down Expand Up @@ -40,7 +39,7 @@
@ToString
@Slf4j
@CPSType(id = "CSV_TEMPLATE", base = SearchIndex.class)
public class FilterTemplate extends IdentifiableImpl<SearchIndexId> implements Searchable<SearchIndexId>, SearchIndex {
public class FilterTemplate extends IdentifiableImpl<SearchIndexId> implements Searchable, SearchIndex {

private static final long serialVersionUID = 1L;

Expand Down Expand Up @@ -90,7 +89,7 @@ public boolean isSearchDisabled() {
return false;
}

public TrieSearch<FrontendValue> createTrieSearch(IndexConfig config, NamespaceStorage storage) {
public TrieSearch<FrontendValue> createTrieSearch(IndexConfig config) {

final URI resolvedURI = FileUtil.getResolvedUri(config.getBaseUrl(), getFilePath());
log.trace("Resolved filter template reference url for search '{}': {}", this.getId(), resolvedURI);
Expand Down
71 changes: 71 additions & 0 deletions backend/src/main/java/com/bakdata/conquery/apiv1/LabelMap.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package com.bakdata.conquery.apiv1;

import java.util.List;
import java.util.stream.Collectors;

import com.bakdata.conquery.apiv1.frontend.FrontendValue;
import com.bakdata.conquery.models.config.IndexConfig;
import com.bakdata.conquery.models.datasets.concepts.Searchable;
import com.bakdata.conquery.models.identifiable.ids.specific.FilterId;
import com.bakdata.conquery.models.query.FilterSearch;
import com.bakdata.conquery.util.search.TrieSearch;
import com.google.common.collect.BiMap;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.experimental.Delegate;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.time.StopWatch;

@Getter
@RequiredArgsConstructor
@Slf4j
@EqualsAndHashCode
public class LabelMap implements Searchable {

private final FilterId id;
@Delegate
private final BiMap<String, String> delegate;
private final int minSuffixLength;
private final boolean generateSearchSuffixes;

@Override
public TrieSearch<FrontendValue> createTrieSearch(IndexConfig config) {

final TrieSearch<FrontendValue> search = config.createTrieSearch(true);

final List<FrontendValue> collected = delegate.entrySet().stream()
.map(entry -> new FrontendValue(entry.getKey(), entry.getValue()))
.collect(Collectors.toList());

if (log.isTraceEnabled()) {
log.trace("Labels for {}: `{}`", getId(), collected.stream().map(FrontendValue::toString).collect(Collectors.toList()));
}

StopWatch timer = StopWatch.createStarted();
log.trace("START-SELECT ADDING_ITEMS for {}", getId());

collected.forEach(feValue -> search.addItem(feValue, FilterSearch.extractKeywords(feValue)));

log.trace("DONE-SELECT ADDING_ITEMS for {} in {}", getId(), timer);

timer.reset();
log.trace("START-SELECT SHRINKING for {}", getId());

search.shrinkToFit();

log.trace("DONE-SELECT SHRINKING for {} in {}", getId(), timer);

return search;
}

@Override
public boolean isGenerateSuffixes() {
return generateSearchSuffixes;
}

@Override
public boolean isSearchDisabled() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -555,15 +555,14 @@ public Stream<Map<String, String>> resolveEntities(Subject subject, List<FilterV
.filter(Predicate.not(Map::isEmpty));
}

public ResultStatistics getResultStatistics(ManagedQuery managedQuery) {
final Query query = managedQuery.getQuery();
final List<ResultInfo> resultInfos = query.getResultInfos();
public ResultStatistics getResultStatistics(SingleTableResult managedQuery) {
final List<ResultInfo> resultInfos = managedQuery.getResultInfos();

final Optional<ResultInfo>
dateInfo =
query.getResultInfos().stream().filter(info -> info.getSemantics().contains(new SemanticType.EventDateT())).findFirst();
resultInfos.stream().filter(info -> info.getSemantics().contains(new SemanticType.EventDateT())).findFirst();

final int dateIndex = dateInfo.map(resultInfos::indexOf).orElse(0 /*Discarded if dateInfo is not present*/);
final Optional<Integer> dateIndex = dateInfo.map(resultInfos::indexOf);

final Locale locale = I18n.LOCALE.get();
final NumberFormat decimalFormat = NumberFormat.getNumberInstance(locale);
Expand All @@ -576,7 +575,6 @@ public ResultStatistics getResultStatistics(ManagedQuery managedQuery) {
new PrintSettings(true, locale, managedQuery.getNamespace(), config, null, null, decimalFormat, integerFormat);
final UniqueNamer uniqueNamer = new UniqueNamer(printSettings);


return ResultStatistics.collectResultStatistics(managedQuery, resultInfos, dateInfo, dateIndex, printSettings, uniqueNamer, config);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package com.bakdata.conquery.apiv1.auth;

import java.util.Collections;
import java.util.Objects;
import java.util.Set;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

import com.bakdata.conquery.io.storage.MetaStorage;
import com.bakdata.conquery.models.auth.entities.Role;
import com.bakdata.conquery.models.auth.permissions.WildcardPermission;
import com.bakdata.conquery.models.identifiable.ids.specific.RoleId;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Builder;
import lombok.Getter;
import lombok.NonNull;

/**
* Factory class to create configured initial roles.

*/
@Getter
@Builder
public class ProtoRole {

private String label;

@NotEmpty
private final String name;

/**
* String permissions in the form of
* {@link org.apache.shiro.authz.permission.WildcardPermission}, that the user
* should hold after initialization.
*/
@Builder.Default
@NotNull
private Set<String> permissions = Collections.emptySet();

public Role createOrOverwriteRole(@NonNull MetaStorage storage) {
label = Objects.requireNonNullElse(label, name);


Role role = new Role(name, label, storage);

storage.updateRole(role);

for (String permission : permissions) {
role.addPermission(new WildcardPermission(permission));
}

return role;
}

@JsonIgnore
public RoleId createId() {
return new RoleId(name);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,29 @@
import com.bakdata.conquery.io.storage.MetaStorage;
import com.bakdata.conquery.models.auth.UserManageable;
import com.bakdata.conquery.models.auth.basic.LocalAuthenticationRealm;
import com.bakdata.conquery.models.auth.entities.Role;
import com.bakdata.conquery.models.auth.entities.User;
import com.bakdata.conquery.models.auth.permissions.WildcardPermission;
import com.bakdata.conquery.models.identifiable.ids.specific.RoleId;
import com.bakdata.conquery.models.identifiable.ids.specific.UserId;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Builder;
import lombok.Getter;
import lombok.NonNull;
import lombok.extern.slf4j.Slf4j;

/**
* Factory class to create configured initial users.

*/
@Getter
@Builder
@Slf4j
public class ProtoUser {

private String label;
@NotEmpty
private final String name;

private final Set<String> roles;
private String label;
/**
* String permissions in the form of
* {@link org.apache.shiro.authz.permission.WildcardPermission}, that the user
Expand All @@ -51,11 +54,29 @@ public User createOrOverwriteUser(@NonNull MetaStorage storage) {
if (label == null) {
label = name;
}
User user = new User(name, label, storage);

final User user = new User(name, label, storage);
storage.updateUser(user);

if (roles != null){
for (String roleId : roles) {
final Role role = storage.getRole(new RoleId(roleId));

if(role == null){
log.warn("Unknown Role[{}] for {}", roleId, this);
continue;
}

user.addRole(role);
}
}


for (String sPermission : permissions) {
user.addPermission(new WildcardPermission(sPermission));
}


return user;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,6 @@ public String getLocalizedTypeLabel() {

@Override
public ManagedInternalForm<FullExportForm> toManagedExecution(User user, Dataset submittedDataset, MetaStorage storage) {
return new ManagedInternalForm<FullExportForm>(this, user, submittedDataset, storage);
return new ManagedInternalForm<>(this, user, submittedDataset, storage);
}
}
Loading
Loading