Interface PageRefFolder
- All Superinterfaces:
Comparable<StoreElement>
,DataProvider
,HistoryProvider
,IDProvider
,PackagePoolItem
,Referenceable
,SiteStoreFolder
,StartNode
,StoreElement
,StoreElementFolder
,Workflowable
public interface PageRefFolder
extends SiteStoreFolder, Referenceable, PackagePoolItem, StoreElementFolder
This interface provides methods to handle the SiteStore-folder
- Since:
- 3.0
- Example:
- Example how to modify variables of SiteStoreFolder
import de.espirit.firstspirit.access.store.sitestore.*; import de.espirit.firstspirit.access.Language; import de.espirit.firstspirit.access.editor.SiteStoreVariableValue; import de.espirit.firstspirit.access.editor.value.InvalidValueException; import de.espirit.firstspirit.access.store.Data; import de.espirit.firstspirit.access.store.DataValue; import de.espirit.firstspirit.access.store.ElementDeletedException; import de.espirit.firstspirit.access.store.LockException; import de.espirit.firstspirit.forms.FormField; import de.espirit.firstspirit.forms.NoSuchFormFieldException; /** * Examples how to modify variables of SiteStoreFolder. * * @since 4.2.34 */ public class SiteStoreFolderVariablesExample { /** * Example how to add a variable. * * @since 4.2.34 * @deprecated since 4.2.440 - see {@link #addVariable_FormData(SiteStoreFolder)} instead */ @Deprecated public void addVariable(final SiteStoreFolder folder) throws ClassNotFoundException, IllegalAccessException, InstantiationException, InvalidValueException, LockException, ElementDeletedException { final String variableName = "myVariable"; // 1. lock the folder folder.setLock(true, false); try { // 2. retrieve Data (variables) from SiteStoreFolder final Data data = folder.getData(); // 3. try to retrieve a DataValue (variable) with desired name DataValue dataValue = data.get(variableName); // 4. if a DataValue is existent, no new one can created using the desired name if (dataValue != null) { throw new IllegalArgumentException("Variable named " + variableName + " already existent!"); } // 5. create new DataValue (variable) dataValue = data.create(variableName, folder.getProject().getUserService(), null); // 6. retrieve the EditorValue from DataValue final SiteStoreVariableValue editor = (SiteStoreVariableValue) dataValue.getEditor(); // 7. set desired value for each language for (final Language language : folder.getProject().getLanguages()) { editor.set(language, "myValue"); } // 8. don't forget to set changed data back to folder folder.setData(data); // 9. save changes and unlock the folder folder.save("add variable", false); } finally { folder.setLock(false, false); } } /** * Example how to add a variable. * * @since 4.2.440 */ public void addVariable_FormData(final SiteStoreFolder folder) throws LockException, ElementDeletedException { final String variableName = "myVariable"; // 1. lock the folder folder.setLock(true, false); try { // 2. retrieve FormData (variables) from SiteStoreFolder final SiteStoreVariableFormData formData = folder.getFormData(); // 3. try to retrieve a DataValue (variable) with desired name FormField<String> formField; final Language masterLanguage = folder.getProject().getMasterLanguage(); try { formField = formData.get(masterLanguage, variableName); } catch (NoSuchFormFieldException e) { formField = formData.createVariable(masterLanguage, variableName); } // 4. set new value formField.set("myValue"); // 5. don't forget to set changed data back to folder folder.setFormData(formData); // 6. save changes and unlock the folder folder.save("add variable", false); } finally { folder.setLock(false, false); } } /** * Example how to change a variables value. * * @since 4.2.34 * @deprecated since 4.2.440 - see {@link #setVariableValue_FormData(SiteStoreFolder)} instead */ @Deprecated public void setVariableValue(final SiteStoreFolder folder) throws InvalidValueException, LockException, ElementDeletedException { final String variableName = "myVariable"; // 1. lock the folder folder.setLock(true, false); try { // 2. retrieve Data (variables) from SiteStoreFolder final Data data = folder.getData(); // 3. try to retrieve a DataValue (variable) with desired name final DataValue dataValue = data.get(variableName); // 4. check existence of the DataValue (variable) if (dataValue == null) { throw new IllegalArgumentException("Variable named " + variableName + " doesn't exist!"); } // 5. retrieve the EditorValue from DataValue final SiteStoreVariableValue editor = (SiteStoreVariableValue) dataValue.getEditor(); // 6. set desired value for each language for (final Language language : folder.getProject().getLanguages()) { editor.set(language, "myNewValue"); } // 7. don't forget to set changed data back to folder folder.setData(data); // 8. save changes and unlock the folder folder.save("set variable value", false); } finally { folder.setLock(false, false); } } /** * Example how to change a variable value. * * @since 4.2.440 */ public void setVariableValue_FormData(final SiteStoreFolder folder) throws InvalidValueException, LockException, ElementDeletedException { final String variableName = "myVariable"; // 1. lock the folder folder.setLock(true, false); // 2. retrieve FormData (variables) from SiteStoreFolder final SiteStoreVariableFormData formData = folder.getFormData(); try { // 3. try to retrieve a form field with desired name final FormField<String> field = formData.get(folder.getProject().getMasterLanguage(), variableName); // 4. set new value field.set("myNewValue"); // 5. don't forget to set changed formdata back to folder folder.setFormData(formData); // 6. save changes and unlock the folder folder.save("set variable value", false); } finally { folder.setLock(false, false); } } /** * Example how to remove a variable. * * @since 4.2.440 * @deprecated since 4.2.440 - see {@link #removeVariable_FormData(SiteStoreFolder)} instead */ @Deprecated public void removeVariable(final SiteStoreFolder folder) throws LockException, ElementDeletedException { final String variableName = "myVariable"; // 1. lock the folder folder.setLock(true, false); try { // 2. retrieve Data (variables) from SiteStoreFolder final Data data = folder.getData(); // 3. try to retrieve a DataValue (variable) with desired name final DataValue dataValue = data.get(variableName); // 4. check existence of the DataValue (variable) if (dataValue == null) { throw new IllegalArgumentException("Variable named " + variableName + " doesn't exist!"); } // 5. remove the DataValue data.remove(dataValue); // 6. don't forget to set changed data back to folder folder.setData(data); // 7. save changes and unlock the folder folder.save("remove variable", false); } finally { folder.setLock(false, false); } } /** * Example how to remove a variable. * * @since 4.2.34 */ public void removeVariable_FormData(final SiteStoreFolder folder) throws LockException, ElementDeletedException { final String variableName = "myVariable"; // 1. lock the folder folder.setLock(true, false); try { // 2. retrieve FormData (variables) from SiteStoreFolder final SiteStoreVariableFormData formData = folder.getFormData(); // 3. remove variable with desired name formData.removeVariable(variableName); // 4. don't forget to set changed formdata back to folder folder.setFormData(formData); // 5. save changes and unlock the folder folder.save("remove variable", false); } finally { folder.setLock(false, false); } } }
-
Nested Class Summary
Nested classes/interfaces inherited from interface de.espirit.firstspirit.storage.HistoryProvider
HistoryProvider.RevisionProvider
Nested classes/interfaces inherited from interface de.espirit.firstspirit.access.store.IDProvider
IDProvider.DependentReleaseType, IDProvider.RevertType, IDProvider.UidType
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Graphical navigation attribute for media.static final int
Graphical navigation attribute for media mouse over.static final int
Graphical navigation attribute for media selected.static final int
Graphical navigation attribute for media selected with mouseover.Fields inherited from interface de.espirit.firstspirit.storage.HistoryProvider
ALL_REVISIONS, EVER_SINCE, UNTIL_NOW
Fields inherited from interface de.espirit.firstspirit.access.store.IDProvider
CHANGED, NEVER_RELEASED, RELEASED
Fields inherited from interface de.espirit.firstspirit.access.store.PackagePoolItem
BLOCKED, MODIFIED, UNMODIFIED
Fields inherited from interface de.espirit.firstspirit.access.store.sitestore.SiteStoreFolder
UID_TYPE
-
Method Summary
Modifier and TypeMethodDescription@NotNull FolderLangSpec
getFolderLangSpec
(Language language) Get the folder specification for the given languagegetGraphicalNavigationMedia
(int state) Gets themedia
for the given graphical navigation state (on ofMEDIA
,MEDIA_MOUSEOVER
,MEDIA_SELECTED
,MEDIA_SELECTED_MOUSEOVER
) ornull
if no media is set for the given state.getGraphicalNavigationMediaUid
(int state) Gets the media uid for the given graphical navigation state (on ofMEDIA
,MEDIA_MOUSEOVER
,MEDIA_SELECTED
,MEDIA_SELECTED_MOUSEOVER
) ornull
if no media uid is set for the given state.int
Returns the position of this pagereffolder in menu order of the parent folder.boolean
isFolder()
Implementing classes must returntrue
void
setGraphicalNavigationMedia
(int state, Media media) Sets themedia
for the graphical navigation for the given graphical navigation state (on ofMEDIA
,MEDIA_MOUSEOVER
,MEDIA_SELECTED
,MEDIA_SELECTED_MOUSEOVER
)
To reset the picture for a specific state call withnull
for param 'media'Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface de.espirit.firstspirit.access.store.pagestore.DataProvider
clearCachedData, getData, setData, setFormData
Methods inherited from interface de.espirit.firstspirit.storage.HistoryProvider
asRevisionProvider, getHistory, getHistory
Methods inherited from interface de.espirit.firstspirit.access.store.IDProvider
contrastWith, getDisplayName, getId, getInRevision, getLanguageInfo, getLongID, getMeta, getMetaFormData, getParent, getReleasedBy, getReleaseRevision, getReleaseStatus, getRevision, getUid, getUidType, hasMeta, hasUid, isInReleaseStore, isReleased, isReleaseSupported, moveChild, moveChild, release, release, revert, setDisplayName, setMeta, setMetaFormData, setUid
Methods inherited from interface de.espirit.firstspirit.access.store.PackagePoolItem
addToPackage, getChangeState, getPackage, getPackageName, isAddable, isChangeable, isPackageItem, isSubscribedItem, removeFromPackage, setChangeState
Methods inherited from interface de.espirit.firstspirit.access.store.Referenceable
getReferenceName
Methods inherited from interface de.espirit.firstspirit.access.store.sitestore.SiteStoreFolder
createDocumentGroup, createPageGroup, createPageRef, createPageRef, createPageRef, createPageRefFolder, createPageRefFolder, createPageRefFolder, createPageRefFolder, deletePageGroup, findStartNode, getFormData, getPageGroups, getParentFolder, getStartNode, getStoredUrl, setStartNode
Methods inherited from interface de.espirit.firstspirit.access.store.sitestore.StartNode
isStartNode
Methods inherited from interface de.espirit.firstspirit.access.store.StoreElement
appendChild, appendChildBefore, delete, exportStoreElement, getChildCount, getChildIndex, getChildren, getChildren, getChildren, getChildren, getCreateWorkflowPermission, getDefinedPrincipalPermissions, getEditor, getElementType, getFirstChild, getIncomingReferences, getInheritedPrincipalPermissions, getLastChanged, getName, getNextSibling, getOutgoingReferences, getPermission, getPermission, getPermission, getPreviousSibling, getProject, getReferences, getStore, getTreePermission, getWorkflowPermission, getWorkflowPermissions, getWriteLock, hasIncomingReferences, hasPermissions, importStoreElement, importStoreElements, inheritWorkflowPermission, isDeleted, isExportSupported, isImportSupported, isLocked, isLockedOnServer, isLockSupported, isPermissionSupported, isWorkflowAllowed, isWorkflowSupported, refresh, removeAllWorkflowPermissions, removeChild, removePermission, removePermission, removePermission, removeWorkflowPermission, replaceChild, save, save, save, setInheritWorkflowPermission, setLock, setLock, setPermission, setPermission, setPermission, setWorkflowPermission, setWorkflowPermissions, setWriteLock, toXml, toXml, toXml
Methods inherited from interface de.espirit.firstspirit.access.Workflowable
getColor, getTask, hasTask, removeTask, setColor, setTask
-
Field Details
-
MEDIA
static final int MEDIAGraphical navigation attribute for media.- Since:
- 3.1.191
- See Also:
-
MEDIA_MOUSEOVER
static final int MEDIA_MOUSEOVERGraphical navigation attribute for media mouse over.- Since:
- 3.1.191
- See Also:
-
MEDIA_SELECTED
static final int MEDIA_SELECTEDGraphical navigation attribute for media selected.- Since:
- 3.1.191
- See Also:
-
MEDIA_SELECTED_MOUSEOVER
static final int MEDIA_SELECTED_MOUSEOVERGraphical navigation attribute for media selected with mouseover.- Since:
- 3.1.191
- See Also:
-
-
Method Details
-
getFolderLangSpec
Get the folder specification for the given language- Parameters:
language
- language for that folder specification will be returned- Returns:
- folder specification as object
- Since:
- 3.0
-
isFolder
boolean isFolder()Implementing classes must returntrue
- Specified by:
isFolder
in interfaceSiteStoreFolder
- Specified by:
isFolder
in interfaceStoreElement
- Returns:
true
- Since:
- 3.0
-
getPosition
int getPosition()Returns the position of this pagereffolder in menu order of the parent folder. The position is only related to otherpagereffolders
in the parent. UseStoreElement.getChildIndex(de.espirit.firstspirit.access.store.StoreElement)
to get the absolute index in child list- Returns:
- position in the menu order of the parent or -1
- Since:
- 3.0.4
- See Also:
-