@Override public SpaceReference replaceParent(EntityReference oldParent, EntityReference newParent) { if (newParent == oldParent) { return this; } return new SpaceReference(this, oldParent, newParent); }
/** * Creates a {@link SpaceReference} from a string representing the space name and the reference of the parent space. * * @param spaceName the space name (e.g. "Main") * @param parent the reference of the parent space * @return the reference to the space * @since 7.3RC1 */ public SpaceReference createSpaceReference(String spaceName, SpaceReference parent) { return new SpaceReference(spaceName, parent); }
/** * Creates a {@link SpaceReference} from a string representing the space name. * * @param spaceName the space name (eg "Main") * @param parent the wiki reference in which the space is located * @return the reference to the space * @since 5.0M1 */ public SpaceReference createSpaceReference(String spaceName, WikiReference parent) { return new SpaceReference(spaceName, parent); }
/** * Create a new Document reference from wiki name, spaces names and page name. * * @param wikiName the name of the wiki containing the document, must not be null * @param spaceNames an ordered list of the names of the spaces containing the document from root space to last one, * must not be null * @param pageName the name of the document */ public DocumentReference(String wikiName, List<String> spaceNames, String pageName) { super(pageName, EntityType.DOCUMENT, new SpaceReference(wikiName, spaceNames)); }
@Override public SpaceReference resolve(String documentReferenceRepresentation, Object... parameters) { return new SpaceReference(this.entityReferenceResolver.resolve(documentReferenceRepresentation, EntityType.SPACE, parameters)); } }
@Override public SpaceReference resolve(EntityReference spaceReferenceRepresentation, Object... parameters) { if (spaceReferenceRepresentation instanceof SpaceReference) { return (SpaceReference) spaceReferenceRepresentation; } return new SpaceReference(this.entityReferenceResolver.resolve(spaceReferenceRepresentation, EntityType.SPACE, parameters)); } }
/** * Create a space reference based on a space name and a parent space reference. * * @param wikiName the name of the wiki * @param spaceNames the spaces names * @since 7.4M1 */ public SpaceReference(String wikiName, List<String> spaceNames) { this(spaceNames.get(spaceNames.size() - 1), spaceNames.size() > 1 ? new SpaceReference(wikiName, spaceNames.subList(0, spaceNames.size() - 1)) : new WikiReference(wikiName)); }
/** * @return the original space reference used when this security reference was built. Null if this is not * the reference to a space. */ public SpaceReference getOriginalSpaceReference() { return (this.getType() == EntityType.SPACE) ? (this.originalReference instanceof SpaceReference) ? (SpaceReference) this.originalReference : new SpaceReference(this.originalReference) : null; }
@Override public SpaceReference replaceParent(EntityReference newParent) { if (newParent == getParent()) { return this; } return new SpaceReference(this, newParent); }
@Override protected DocumentReference getDocumentReference() { return new DocumentReference("XWikiPreferences", new SpaceReference("XWiki", getCurrentWikiReference())); } }
@Override public List<SpaceReference> getExceptionSpaces() { List<String> exceptionSpaces = configuration.get().getProperty("exceptionSpaces", List.class); List<SpaceReference> result = new ArrayList<SpaceReference>(); for (String exceptionSpace : exceptionSpaces) { result.add(new SpaceReference(exceptionSpace, getCurrentWikiReference())); } return result; }
@Override protected DocumentReference getDocumentReference() { return new DocumentReference(CLASS_REFERENCE.getName(), new SpaceReference(CLASS_SPACE_NAME, getCurrentWikiReference())); } }
@Override protected DocumentReference getDocumentReference() { return new DocumentReference(CLASS_REFERENCE.getName(), new SpaceReference(CLASS_SPACE_NAME, getCurrentWikiReference())); }
/** * Create a new Document reference from wiki name, space name, page name and locale. * * @param wikiName the name of the wiki containing the document, must not be null * @param spaceName the name of the space containing the document, must not be null * @param pageName the name of the document * @param locale the locale of the document reference, may be null */ public DocumentReference(String wikiName, String spaceName, String pageName, Locale locale) { this(pageName, new SpaceReference(spaceName, new WikiReference(wikiName)), locale); }
private EntityReference getPre11EntityReference(File directory) throws IOException { String name = FileSystemStoreUtils.decode(directory.getName()); File parent = directory.getParentFile(); if (parent.getCanonicalPath().equals(getStoreRootDirectory().getCanonicalPath())) { return new WikiReference(name); } else { return new SpaceReference(name, getPre11EntityReference(parent)); } }
/** * Create a new Document reference from wiki, space and page name. * * @param wikiName the name of the wiki containing the document, must not be null * @param spaceName the name of the space containing the document, must not be null * @param pageName the name of the document */ public DocumentReference(String wikiName, String spaceName, String pageName) { this(pageName, new SpaceReference(spaceName, new WikiReference(wikiName))); }
public DocumentReference(String wikiName, String spaceName, String pageName) { this(pageName, new SpaceReference(spaceName, new WikiReference(wikiName))); }
@Override public SpaceReference get() { if (this.cachedReference == null) { EntityReference reference = this.provider.getDefaultReference(EntityType.SPACE); // Add wikis reference = reference.appendParent(this.wikiReferenceProvider.get()); this.cachedReference = this.factory.getReference(new SpaceReference(reference)); } return this.cachedReference; } }
/** * Redirects to the administration page of a specified space. * * @param spaceReferenceString the string serialized space reference * @return the administration page of the specified space * @since 7.2M3 */ public static AdministrationPage gotoSpaceAdministrationPage(String spaceReferenceString) { SpaceReference spaceReference = new SpaceReference(getUtil().resolveSpaceReference(spaceReferenceString)); return gotoSpaceAdministrationPage(spaceReference); }
private boolean isSpaceEnabled(String wiki, String space) { return this.properties.getEntities() == null || this.properties.getEntities().matches(new SpaceReference(space, new WikiReference(wiki))); }