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
AbstractAmetysObject
for storing elements of a survey
-
-
Field Summary
Fields Modifier and Type Field Description static String
PROPERTY_PICTURE
Constant for picture data property.static String
PROPERTY_PICTURE_ALTERNATIVE
Constant for picture alternative property.static String
PROPERTY_PICTURE_ID
Constant for picture id property.static String
PROPERTY_PICTURE_TYPE
Constant 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 void
copyPictureTo(AbstractSurveyElement elmt)
Copy the picture of thisAbstractSurveyElement
to the element in argumentsModifiableModelLessDataHolder
getDataHolder()
Returns theDataHolder
of thisAmetysObject
.Binary
getExternalPicture()
Get the picture as a binary metadata.String
getPictureAlternative()
Get the picture alternative.String
getPictureType()
Get the picture type.String
getResourcePictureId()
Get the picture resource ID.protected void
removePictureMetas()
Remove all picture metas (picture ID and picture binary).void
setExternalPicture(String mimeType, String filename, InputStream stream)
Set the picture from an external file.void
setNoPicture()
Removes any picture currently assigned.void
setPictureAlternative(String alternative)
Set the picture alternative.void
setPictureType(String type)
Set the picture type.void
setResourcePicture(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, getChild, getChildren, getProfilesForAnonymousAndAnyConnectedUser, getProfilesForGroups, getProfilesForUsers, 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, dataToSAX, getDataNames
-
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, hasValueOrEmpty, isMultiple
-
Methods inherited from interface org.ametys.plugins.repository.data.holder.ModelLessDataHolder
dataToSAX, hasValue, hasValueOrEmpty
-
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, getParentDataHolder, getRepositoryData, getRootDataHolder, 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
- theDefaultTraversableAmetysObjectFactory
which 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 thisAbstractSurveyElement
to the element in arguments- Parameters:
elmt
- The element
-
getDataHolder
public ModifiableModelLessDataHolder getDataHolder()
Description copied from interface:DataAwareAmetysObject
Returns theDataHolder
of thisAmetysObject
.- Specified by:
getDataHolder
in interfaceDataAwareAmetysObject
- Specified by:
getDataHolder
in interfaceModelLessDataAwareAmetysObject
- Specified by:
getDataHolder
in interfaceModifiableModelLessDataAwareAmetysObject
- Returns:
- the
DataHolder
of thisAmetysObject
-
-