Class ProtectedContentUtil
- java.lang.Object
-
- de.trustable.ca3s.core.service.util.ProtectedContentUtil
-
@Service public class ProtectedContentUtil extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static InstantMAX_INSTANT
-
Constructor Summary
Constructors Constructor Description ProtectedContentUtil(String protectionSecret)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ProtectedContentcreateProtectedContent(String plainText, ProtectedContentType pct, ContentRelationType crt, long connectionId)create a new ProtectedContent object and save the given contentProtectedContentcreateProtectedContent(String plainText, ProtectedContentType pct, ContentRelationType crt, long connectionId, int leftUsages, Instant validTo)create a new ProtectedContent object and save the given contentStringprotectString(String content)List<ProtectedContent>retrieveProtectedContent(ProtectedContentType type, ContentRelationType crt, long id)StringunprotectString(String protectedContent)
-
-
-
Field Detail
-
MAX_INSTANT
public static final Instant MAX_INSTANT
-
-
Constructor Detail
-
ProtectedContentUtil
public ProtectedContentUtil(@Value("${protectionSecret:S3cr3t}") String protectionSecret)
-
-
Method Detail
-
createProtectedContent
public ProtectedContent createProtectedContent(String plainText, ProtectedContentType pct, ContentRelationType crt, long connectionId)
create a new ProtectedContent object and save the given content- Parameters:
plainText- the plain text to be protectedpct- the content type of the plainTextcrt- the related entityconnectionId- the related entity- Returns:
- the freshly created object
-
createProtectedContent
public ProtectedContent createProtectedContent(String plainText, ProtectedContentType pct, ContentRelationType crt, long connectionId, int leftUsages, Instant validTo)
create a new ProtectedContent object and save the given content- Parameters:
plainText- the plain text to be protectedpct- the content type of the plainTextcrt- the related entityconnectionId- the related entityleftUsages- number of left usages for this elementvalidTo- element usable until 'validTo'- Returns:
- the freshly created object
-
retrieveProtectedContent
public List<ProtectedContent> retrieveProtectedContent(ProtectedContentType type, ContentRelationType crt, long id)
- Parameters:
type- the type of object which is requiredcrt- the related entityid- the object id- Returns:
- list of
-
-