public class ClaimUtils extends Object
Constructor and Description |
---|
ClaimUtils() |
Modifier and Type | Method and Description |
---|---|
ProcessedClaimCollection |
add(ProcessedClaimCollection collection,
ProcessedClaim... claims) |
ProcessedClaimCollection |
add(ProcessedClaimCollection collection,
ProcessedClaimCollection... claimCollections) |
ProcessedClaim |
create(String processedClaimTypeURI,
String... values) |
ProcessedClaim |
distinctValues(ProcessedClaim processedClaim)
This function removes duplicated values.
|
ProcessedClaim |
filterValues(ProcessedClaim processedClaim,
String filter)
Filtering all values from the given claim according to the provided regex filter.
|
ProcessedClaim |
get(ProcessedClaimCollection processedClaims,
String processedClaimType) |
ProcessedClaim |
lowerCaseValues(ProcessedClaim processedClaim) |
ProcessedClaimCollection |
mapType(ProcessedClaimCollection processedClaims,
Map<String,String> map,
boolean keepUnmapped) |
ProcessedClaim |
mapValues(ProcessedClaim processedClaim,
Map<Object,Object> mapping,
boolean keepUnmapped)
Mapping all values from the given claim according to the provided map.
|
ProcessedClaim |
merge(ProcessedClaimCollection processedClaims,
String targetClaimType,
String delimiter,
String... processedClaimType)
Merges the first value (only) from different claim types in a collection to a new claim type separated
by the provided delimiter.
|
ProcessedClaim |
multiToSingleValue(ProcessedClaim processedClaim,
String delimiter)
This function is especially useful if values from multiple claim values need to be condensed into a
single value element.
|
ProcessedClaimCollection |
removeEmptyClaims(ProcessedClaimCollection processedClaims)
Removes Claims without values.
|
ProcessedClaim |
setType(ProcessedClaim processedClaim,
String processedClaimTypeURI) |
ProcessedClaim |
singleToMultiValue(ProcessedClaim processedClaim,
String delimiter)
This function is especially useful if multi values from a claim are stored within a single value entry.
|
ProcessedClaimCollection |
updateIssuer(ProcessedClaimCollection processedClaims,
String newIssuer)
All claims within the provided collection will be updated in the following manner: If no original
issuer is set, the issuer in the provided claims will be set as original issuer.
|
ProcessedClaim |
upperCaseValues(ProcessedClaim processedClaim) |
ProcessedClaim |
wrapValues(ProcessedClaim processedClaim,
String prefix,
String suffix) |
public ProcessedClaimCollection add(ProcessedClaimCollection collection, ProcessedClaim... claims)
collection
- Collection that should be used to add further claims toclaims
- Claims to be added to the provided collectionpublic ProcessedClaimCollection add(ProcessedClaimCollection collection, ProcessedClaimCollection... claimCollections)
collection
- Collection that should be used to add claims from the other provided claim
collectionsclaimCollections
- All claims contained within the provided collections will be added to the
targetCollectionpublic ProcessedClaim create(String processedClaimTypeURI, String... values)
processedClaimTypeURI
- claim type URIvalues
- values of created claim. Can be null if no values shall be added to claim.public ProcessedClaim get(ProcessedClaimCollection processedClaims, String processedClaimType)
processedClaims
- Collection of multiple claims with different claim typesprocessedClaimType
- URI of claim type to be selected from claim collectionpublic ProcessedClaimCollection mapType(ProcessedClaimCollection processedClaims, Map<String,String> map, boolean keepUnmapped)
processedClaims
- Collection of claims to be mapped to a different claim typemap
- Map of old:new claim typeskeepUnmapped
- if set to false only claims with a claim type contained in the map will be
returned. If set to false claims with an unmapped claim type will also be returned.public ProcessedClaim mapValues(ProcessedClaim processedClaim, Map<Object,Object> mapping, boolean keepUnmapped)
processedClaim
- Claim providing values to be mappedmapping
- Map of old:new mapping valueskeepUnmapped
- if set to false only values contained in the map will be returned. If set to true,
values not contained in the map will also remain in the returned claim.public ProcessedClaim filterValues(ProcessedClaim processedClaim, String filter)
processedClaim
- Claim containing arbitrary valuesfilter
- Regex filter to be used to match with claim valuespublic ProcessedClaim merge(ProcessedClaimCollection processedClaims, String targetClaimType, String delimiter, String... processedClaimType)
processedClaims
- Collection of claims containing claims with claim types of listed
claimType
arraytargetClaimType
- claim type URI of merged result claimdelimiter
- Delimiter added between multiple claim types. Value can be null
.processedClaimType
- URIs of claim types to be merged. Merging will be in the same order as the
provided claim type URIs. If a claim type is not found in the collection this claim type
will be omitted.public ProcessedClaim setType(ProcessedClaim processedClaim, String processedClaimTypeURI)
processedClaim
- Claim to be updatedprocessedClaimTypeURI
- URI as String to be set as claim type in provided claimpublic ProcessedClaimCollection updateIssuer(ProcessedClaimCollection processedClaims, String newIssuer)
processedClaims
- Collection of claims to be updatednewIssuer
- Issuer to be set for all claims within the collectionpublic ProcessedClaim upperCaseValues(ProcessedClaim processedClaim)
processedClaim
- values of this claim will be used for result claimpublic ProcessedClaim lowerCaseValues(ProcessedClaim processedClaim)
processedClaim
- values of this claim will be used for result claimpublic ProcessedClaim wrapValues(ProcessedClaim processedClaim, String prefix, String suffix)
processedClaim
- Claim providing values to be wrappedprefix
- Prefix to be added to each claim value. Can be null.suffix
- Suffix to be appended to each claim value. Can be null.public ProcessedClaim singleToMultiValue(ProcessedClaim processedClaim, String delimiter)
processedClaim
- claim containing multi-values in a single value entrydelimiter
- Delimiter to split multi-values into single valuespublic ProcessedClaim multiToSingleValue(ProcessedClaim processedClaim, String delimiter)
processedClaim
- claim containing multi-valuesdelimiter
- Delimiter to concatenate multi-values into a single valuepublic ProcessedClaim distinctValues(ProcessedClaim processedClaim)
processedClaim
- claim containing multi-values of which some might be duplicatedpublic ProcessedClaimCollection removeEmptyClaims(ProcessedClaimCollection processedClaims)
processedClaims
- Collection of claims with and/or without valuesApache CXF