Class SpaceNameResolver
java.lang.Object
org.exoplatform.documents.mcp.SpaceNameResolver
Finds the space a document tool call names by its name, among the spaces
the calling user is a member of, and only those: a space the user isn't a
member of is never found, whatever its visibility.
The name is matched against the space's display name, ignoring case,
leading and trailing whitespace and repeated inner whitespace. Only when no
display name matches, it is matched against the space's pretty name (its
URL name) or its group id (/spaces/<pretty name>), ignoring case.
Nothing is ever guessed: no match is refused with the closest names the
user's spaces carry, and several spaces with that name are refused with
their ids, so the caller picks one by its id.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe most spaces a refusal names. -
Constructor Summary
ConstructorsConstructorDescriptionSpaceNameResolver(org.exoplatform.social.core.space.spi.SpaceService spaceService) -
Method Summary
-
Field Details
-
MAX_SUGGESTIONS
public static final int MAX_SUGGESTIONSThe most spaces a refusal names.- See Also:
-
-
Constructor Details
-
SpaceNameResolver
public SpaceNameResolver(org.exoplatform.social.core.space.spi.SpaceService spaceService) - Parameters:
spaceService- reads the spaces the user is a member of
-
-
Method Details
-
resolve
public org.exoplatform.social.core.space.model.Space resolve(String spaceName, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException Finds the one space with that name among the spaces the user is a member of.- Parameters:
spaceName- the space's name as the caller gave itusername- the calling user- Returns:
- the space, never null
- Throws:
IllegalArgumentException- when the name is blank, or when several of the user's spaces carry it: the message lists them with their idsorg.exoplatform.commons.exception.ObjectNotFoundException- when none of the user's spaces carries it: the message names the closest ones
-