19 package org.turro.phase;
21 import java.util.Collection;
22 import java.util.HashMap;
23 import java.util.HashSet;
25 import java.util.Optional;
27 import org.turro.entities.IElephantEntity;
28 import org.turro.security.ConceptPermission;
29 import org.turro.security.ConceptPermissionMap;
30 import org.turro.util.CompareUtil;
38 private final int index;
39 private final String name;
40 private final Set<PhaseType> types;
41 private final Map<String, Integer> mapping =
new HashMap<>();
42 private final Set<String> documentation =
new HashSet<>();
46 private String icon, description;
54 this.description = description;
59 this.mapping.put(targetEntity, targetPhase);
64 this.documentation.add(documentation);
69 permissions.
put(permission);
90 return this.types.stream().anyMatch(types::contains);
106 return documentation;
110 return Optional.ofNullable(permissions.
get(name, iee)).orElse(
null);
121 int result = Integer.compare(index, o.index);
123 result = CompareUtil.compare(name, o.name);
134 private PhaseDefinition(
int index, String name, Set<PhaseType> types) {
Map< String, Integer > getMapping()
int compareTo(PhaseDefinition o)
static PhaseDefinition create(int index, String name, Set< PhaseType > types)
PhaseDefinition icon(String icon)
ConceptPermission getPermission(String name, IElephantEntity iee)
PhaseDefinition addMapping(String targetEntity, Integer targetPhase)
PhaseDefinition addDocumentation(String documentation)
Collection< String > getConcepts()
PhaseDefinition addPermission(ConceptPermission permission)
PhaseDefinition described(String description)
boolean anyStringMatch(Collection< String > types)
Set< String > getDocumentation()
boolean anyTypeMatch(Collection< PhaseType > types)
Set< PhaseType > getTypes()
Collection< String > concepts()
ConceptPermission put(String key, ConceptPermission value)
ConceptPermission get(Object key)