public class APIUtil extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
APIUtil.SectionVisitor
Implementations of this interface can be used as parameter to
traverseSections and resolveUserSectionsForPublication.
|
Constructor and Description |
---|
APIUtil() |
Modifier and Type | Method and Description |
---|---|
static Link |
determineIfImageType(Article pArticle) |
static neo.xredsys.content.type.ArticleType |
getArticleType(IOHashKey pKey) |
static Person |
getCurrentUser()
Utility method to get the logged in user for the current thread.
|
static Article |
getProfileImage(Person pPerson)
Retrives the article representing the profile image of the provided person
|
static User |
getUser(Subject pSubject)
Utility method to get the logged in user for the given subject.
|
static String |
getUUID(IOObject pIOObject)
Retrieves the UUID of the given object or
null if the object does not have an UUID |
static Article |
getVariantArticle(Article pArticleVariant)
This will return the published variant of a staged article.
|
static boolean |
isLive(Date pActivatedDate,
Date pExpireDate,
String pState,
Date pNow) |
static boolean |
isStillValid(IOAtom.ObjectType pObjectType,
int pObjectId,
String pUUID)
Validate the UUID against the value stored for the IOObject in the database.
|
static boolean |
isStillValid(IOObject pObject)
Validate the UUID against the value stored for the IOObject in
the database.
|
static boolean |
isValid(String pUUID,
IOObject pIOObject)
Validates if the provided uuid is valid for the given IOObject
|
static List<Section> |
resolveUserSectionsForPublication(User pUser,
Publication pPublication,
APIUtil.SectionVisitor pVisitor)
Utility method to look up all sections where the given user has any access rights.
|
static List<Section> |
traverseSections(Section parent,
boolean includeAll,
APIUtil.SectionVisitor pVisitor)
Utility method to look up all sub sections of the given
section.
|
public static boolean isStillValid(IOObject pObject)
pObject
- The object to validate against the database.public static boolean isStillValid(IOAtom.ObjectType pObjectType, int pObjectId, String pUUID)
pObject
- The object to validate against the database.public static Article getVariantArticle(Article pArticleVariant)
pArticleVariant
- The possible staged articlepublic static Person getCurrentUser()
public static User getUser(Subject pSubject)
public static List<Section> resolveUserSectionsForPublication(User pUser, Publication pPublication, APIUtil.SectionVisitor pVisitor)
pUser
- Find all sections where this user has access. Can not be null.pPublication
- Limit the scope to the given publication. Can not be null.pVisitor
- The pVisitor.visit method will be called for each section being traversed. Can be null.public static List<Section> traverseSections(Section parent, boolean includeAll, APIUtil.SectionVisitor pVisitor)
parent
- Find all sub section of this sectionincludeAll
- If true then all sub sections will be
included. If false then sub sections which do not inherit access
rights will not be included in the result.pVisitor
- The pVisitor.visit method will be called for each section being traversed. Can be null.public static neo.xredsys.content.type.ArticleType getArticleType(IOHashKey pKey)
public static boolean isLive(Date pActivatedDate, Date pExpireDate, String pState, Date pNow)
public static String getUUID(IOObject pIOObject)
null
if the object does not have an UUIDpublic static boolean isValid(String pUUID, IOObject pIOObject)
pUUID
- the UUID to validate. If the UUID is null
, the method will always return false
pIOObject
- the object to validate.© 1998- 2021 Escenic AS