Class AbstractSurveyElement<F extends SurveyElementFactory>
- java.lang.Object
-
- org.ametys.plugins.repository.AbstractAmetysObject
-
- org.ametys.plugins.repository.jcr.SimpleAmetysObject<F>
-
- org.ametys.plugins.repository.jcr.DefaultTraversableAmetysObject<F>
-
- org.ametys.plugins.survey.repository.AbstractSurveyElement<F>
-
- Type Parameters:
F- the actual type of factory.
- All Implemented Interfaces:
ACLAmetysObject,AmetysObject,CopiableAmetysObject,DataAwareAmetysObject,ModelLessDataAwareAmetysObject,ModifiableModelLessDataAwareAmetysObject,DataHolder,ModelLessDataHolder,ModifiableDataHolder,ModifiableModelLessDataHolder,JCRAmetysObject,JCRTraversableAmetysObject,MetadataAwareAmetysObject,ModifiableMetadataAwareAmetysObject,ModifiableACLAmetysObject,ModifiableAmetysObject,ModifiableTraversableAmetysObject,RemovableAmetysObject,TraversableAmetysObject
- Direct Known Subclasses:
Survey,SurveyPage,SurveyQuestion
public abstract class AbstractSurveyElement<F extends SurveyElementFactory> extends DefaultTraversableAmetysObject<F> implements CopiableAmetysObject, ModifiableModelLessDataAwareAmetysObject
AbstractAmetysObjectfor storing elements of a survey
-
-
Field Summary
Fields Modifier and Type Field Description static StringPROPERTY_PICTUREConstant for picture data property.static StringPROPERTY_PICTURE_ALTERNATIVEConstant for picture alternative property.static StringPROPERTY_PICTURE_IDConstant for picture id property.static StringPROPERTY_PICTURE_TYPEConstant for picture type property.
-
Constructor Summary
Constructors Constructor Description AbstractSurveyElement(Node node, String parentPath, F factory)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcopyPictureTo(AbstractSurveyElement elmt)Copy the picture of thisAbstractSurveyElementto the element in argumentsModifiableModelLessDataHoldergetDataHolder()Returns theDataHolderof thisAmetysObject.BinarygetExternalPicture()Get the picture as a binary metadata.StringgetPictureAlternative()Get the picture alternative.StringgetPictureType()Get the picture type.StringgetResourcePictureId()Get the picture resource ID.protected voidremovePictureMetas()Remove all picture metas (picture ID and picture binary).voidsetExternalPicture(String mimeType, String filename, InputStream stream)Set the picture from an external file.voidsetNoPicture()Removes any picture currently assigned.voidsetPictureAlternative(String alternative)Set the picture alternative.voidsetPictureType(String type)Set the picture type.voidsetResourcePicture(String resourceId)Set the picture from an explorer resource.-
Methods inherited from class org.ametys.plugins.repository.jcr.DefaultTraversableAmetysObject
addAllowedGroups, addAllowedProfilesForAnonymous, addAllowedProfilesForAnyConnectedUser, addAllowedUsers, addDeniedGroups, addDeniedProfilesForAnonymous, addDeniedProfilesForAnyConnectedUser, addDeniedUsers, createChild, disallowInheritance, getAllowedGroups, getAllowedProfilesForAnonymous, getAllowedProfilesForAnyConnectedUser, getAllowedProfilesForGroups, getAllowedProfilesForUser, getAllowedProfilesForUsers, getAllowedUsers, getChild, getChildren, getDeniedGroups, getDeniedProfilesForAnonymous, getDeniedProfilesForAnyConnectedUser, getDeniedProfilesForGroups, getDeniedProfilesForUser, getDeniedProfilesForUsers, getDeniedUsers, hasChild, isInheritanceDisallowed, removeAllowedGroups, removeAllowedGroups, removeAllowedProfilesForAnonymous, removeAllowedProfilesForAnyConnectedUser, removeAllowedUsers, removeAllowedUsers, removeDeniedGroups, removeDeniedGroups, removeDeniedProfilesForAnonymous, removeDeniedProfilesForAnyConnectedUser, removeDeniedUsers, removeDeniedUsers
-
Methods inherited from class org.ametys.plugins.repository.jcr.SimpleAmetysObject
_getFactory, _invalidateName, _invalidateParentPath, getId, getMetadataHolder, getName, getNode, getParent, getParentPath, getPath, needsSave, remove, rename, revertChanges, saveChanges
-
Methods inherited from class org.ametys.plugins.repository.AbstractAmetysObject
equals, hashCode, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.ametys.plugins.repository.AmetysObject
equals, getId, getName, getParent, getParentPath, getPath, hashCode
-
Methods inherited from interface org.ametys.plugins.repository.CopiableAmetysObject
copyTo, copyTo
-
Methods inherited from interface org.ametys.plugins.repository.data.ametysobject.DataAwareAmetysObject
copyTo, dataToSAX, getDataNames
-
Methods inherited from interface org.ametys.plugins.repository.data.holder.DataHolder
dataToSAX
-
Methods inherited from interface org.ametys.plugins.repository.jcr.JCRAmetysObject
getNode
-
Methods inherited from interface org.ametys.plugins.repository.data.ametysobject.ModelLessDataAwareAmetysObject
dataToSAX, getType, getValue, getValue, getValueOfType, getValueOfType, hasValue, isMultiple
-
Methods inherited from interface org.ametys.plugins.repository.data.holder.ModelLessDataHolder
dataToSAX, hasValue
-
Methods inherited from interface org.ametys.plugins.repository.ModifiableAmetysObject
needsSave, rename, revertChanges, saveChanges
-
Methods inherited from interface org.ametys.plugins.repository.metadata.ModifiableMetadataAwareAmetysObject
getMetadataHolder
-
Methods inherited from interface org.ametys.plugins.repository.data.ametysobject.ModifiableModelLessDataAwareAmetysObject
getComposite, getComposite, getRepositoryData, removeValue, setValue, setValue, synchronizeValues
-
Methods inherited from interface org.ametys.plugins.repository.RemovableAmetysObject
remove
-
Methods inherited from interface org.ametys.plugins.repository.TraversableAmetysObject
getChildAt, getChildPosition
-
-
-
-
Field Detail
-
PROPERTY_PICTURE
public static final String PROPERTY_PICTURE
Constant for picture data property.- See Also:
- Constant Field Values
-
PROPERTY_PICTURE_TYPE
public static final String PROPERTY_PICTURE_TYPE
Constant for picture type property.- See Also:
- Constant Field Values
-
PROPERTY_PICTURE_ID
public static final String PROPERTY_PICTURE_ID
Constant for picture id property.- See Also:
- Constant Field Values
-
PROPERTY_PICTURE_ALTERNATIVE
public static final String PROPERTY_PICTURE_ALTERNATIVE
Constant for picture alternative property.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AbstractSurveyElement
public AbstractSurveyElement(Node node, String parentPath, F factory)
Constructor- Parameters:
node- the node backing thisAmetysObject.parentPath- the parent path in the Ametys hierarchy.factory- theDefaultTraversableAmetysObjectFactorywhich creates the AmetysObject.
-
-
Method Detail
-
getExternalPicture
public Binary getExternalPicture() throws AmetysRepositoryException
Get the picture as a binary metadata.- Returns:
- the picture as a binary metadata.
- Throws:
AmetysRepositoryException- if an error occurs.
-
setExternalPicture
public void setExternalPicture(String mimeType, String filename, InputStream stream) throws AmetysRepositoryException
Set the picture from an external file.- Parameters:
mimeType- the file MIME type.filename- the file name.stream- an input stream on the file bytes.- Throws:
AmetysRepositoryException- if an error occurs.
-
getResourcePictureId
public String getResourcePictureId() throws AmetysRepositoryException
Get the picture resource ID.- Returns:
- the resource ID.
- Throws:
AmetysRepositoryException- if an error occurs.
-
setResourcePicture
public void setResourcePicture(String resourceId) throws AmetysRepositoryException
Set the picture from an explorer resource.- Parameters:
resourceId- the resource ID.- Throws:
AmetysRepositoryException- if an error occurs.
-
setNoPicture
public void setNoPicture() throws AmetysRepositoryException
Removes any picture currently assigned.- Throws:
AmetysRepositoryException- if an error occurs.
-
getPictureType
public String getPictureType() throws AmetysRepositoryException
Get the picture type.- Returns:
- the picture type.
- Throws:
AmetysRepositoryException- if an error occurs.
-
setPictureType
public void setPictureType(String type) throws AmetysRepositoryException
Set the picture type.- Parameters:
type- the picture type to set.- Throws:
AmetysRepositoryException- if an error occurs.
-
getPictureAlternative
public String getPictureAlternative() throws AmetysRepositoryException
Get the picture alternative.- Returns:
- the picture alternative.
- Throws:
AmetysRepositoryException- if an error occurs.
-
setPictureAlternative
public void setPictureAlternative(String alternative) throws AmetysRepositoryException
Set the picture alternative.- Parameters:
alternative- the picture alternative to set.- Throws:
AmetysRepositoryException- if an error occurs.
-
removePictureMetas
protected void removePictureMetas() throws RepositoryException
Remove all picture metas (picture ID and picture binary).- Throws:
RepositoryException- if an error occurs.
-
copyPictureTo
protected void copyPictureTo(AbstractSurveyElement elmt)
Copy the picture of thisAbstractSurveyElementto the element in arguments- Parameters:
elmt- The element
-
getDataHolder
public ModifiableModelLessDataHolder getDataHolder()
Description copied from interface:DataAwareAmetysObjectReturns theDataHolderof thisAmetysObject.- Specified by:
getDataHolderin interfaceDataAwareAmetysObject- Specified by:
getDataHolderin interfaceModelLessDataAwareAmetysObject- Specified by:
getDataHolderin interfaceModifiableModelLessDataAwareAmetysObject- Returns:
- the
DataHolderof thisAmetysObject
-
-