-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3366 from ingef/release
Merge Release
- Loading branch information
Showing
363 changed files
with
5,508 additions
and
7,521 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
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
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
File renamed without changes.
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
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
71 changes: 71 additions & 0 deletions
71
backend/src/main/java/com/bakdata/conquery/apiv1/LabelMap.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,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; | ||
} | ||
} |
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
60 changes: 60 additions & 0 deletions
60
backend/src/main/java/com/bakdata/conquery/apiv1/auth/ProtoRole.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,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); | ||
} | ||
} |
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
Oops, something went wrong.