-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FAIRSPC-82: got rid of PermissionService
- Loading branch information
1 parent
c8217f6
commit 41d5807
Showing
5 changed files
with
155 additions
and
21 deletions.
There are no files selected for viewing
19 changes: 0 additions & 19 deletions
19
projects/saturn/src/main/java/io/fairspace/saturn/auth/PermissionService.java
This file was deleted.
Oops, something went wrong.
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
139 changes: 139 additions & 0 deletions
139
projects/saturn/src/main/java/io/fairspace/saturn/config/ViewsConfigProperties.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,139 @@ | ||
package io.fairspace.saturn.config; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonSetter; | ||
import com.fasterxml.jackson.annotation.JsonValue; | ||
import com.fasterxml.jackson.annotation.Nulls; | ||
import jakarta.validation.constraints.NotBlank; | ||
import jakarta.validation.constraints.NotNull; | ||
import org.springframework.context.annotation.PropertySource; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@PropertySource("classpath:views.yaml") | ||
public class ViewsConfigProperties { | ||
|
||
// private Map<String, View> nameToViewConfigMap; | ||
|
||
public List<View> views = new ArrayList<>(); | ||
|
||
public enum ColumnType { | ||
Text, | ||
Set, | ||
Term, | ||
TermSet, | ||
Number, | ||
Date, | ||
Boolean, | ||
Identifier; | ||
|
||
public boolean isSet() { | ||
return this == Set || this == TermSet; | ||
} | ||
|
||
@JsonValue | ||
public String getName() { | ||
return this.name(); | ||
} | ||
|
||
private static final Map<String, ColumnType> mapping = new HashMap<>(); | ||
|
||
static { | ||
for (ColumnType type : values()) { | ||
mapping.put(type.name().toLowerCase(), type); | ||
} | ||
} | ||
|
||
@JsonCreator | ||
public static ColumnType forName(String name) { | ||
if (name == null) { | ||
return null; | ||
} | ||
name = name.toLowerCase(); | ||
if (!mapping.containsKey(name)) { | ||
throw new IllegalArgumentException("Unknown column type: " + name); | ||
} | ||
return mapping.get(name); | ||
} | ||
} | ||
|
||
public static class View { | ||
/** | ||
* The view name. | ||
*/ | ||
@NotBlank | ||
public String name; | ||
/** | ||
* The view title. | ||
*/ | ||
@NotBlank | ||
public String title; | ||
/** | ||
* The name of the items that appear as rows. | ||
*/ | ||
public String itemName; | ||
/** | ||
* The max count value to be requested for a view total count. | ||
* If total count is greater than this max value, the total count value will look like 'more than 1000' on FE. | ||
* This is to prevent performance issues when the total count is too large. | ||
*/ | ||
public Long maxDisplayCount; | ||
/** | ||
* The URLs of the types of entities that should be indexed in this view. | ||
*/ | ||
@JsonSetter(nulls = Nulls.AS_EMPTY) | ||
public List<String> types; | ||
/** | ||
* Specifies which other views (and which columns) to embed in this view. | ||
*/ | ||
@JsonSetter(nulls = Nulls.AS_EMPTY) | ||
public List<JoinView> join; | ||
/** | ||
* The columns of the view, not including columns from joined views. | ||
*/ | ||
@JsonSetter(nulls = Nulls.AS_EMPTY) | ||
public List<Column> columns; | ||
|
||
public static class Column { | ||
@NotBlank | ||
public String name; | ||
|
||
@NotBlank | ||
public String title; | ||
|
||
@NotNull | ||
public ColumnType type; | ||
|
||
@NotBlank | ||
public String source; | ||
// displayIndex determines the order of columns on the view page. | ||
@NotNull | ||
public Integer displayIndex = Integer.MAX_VALUE; | ||
|
||
public String rdfType; | ||
|
||
public int priority; | ||
} | ||
|
||
public static class JoinView { | ||
@NotBlank | ||
public String view; | ||
|
||
@NotBlank | ||
public String on; | ||
|
||
public boolean reverse = false; | ||
|
||
@JsonSetter(nulls = Nulls.AS_EMPTY) | ||
public List<String> include; | ||
// displayIndex determines the order of columns on the view page, for joinView it is the column displaying | ||
// the related entity | ||
public Integer displayIndex = Integer.MAX_VALUE; | ||
} | ||
} | ||
} |
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