Package com.cmobilecom.af.model.property
Class EntityHierarchyProperty<T extends PersistenceEntity>
- java.lang.Object
-
- com.cmobilecom.af.model.bean.Component
-
- com.cmobilecom.af.model.property.EntityProperty<T>
-
- com.cmobilecom.af.model.property.EntityHierarchyProperty<T>
-
- Type Parameters:
T
- PersistenceEntity, it is entity type, not property type
- All Implemented Interfaces:
ClientBehaviorHolder
,MenuNodeActionHandler
,java.io.Serializable
public class EntityHierarchyProperty<T extends PersistenceEntity> extends EntityProperty<T>
EntityHierarchyProperty whose value is Hierarchy entity.Its render style can be multi-level selects or input text. auto complete will be enabled by default for input text render style.
- Since:
- 4.0
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.cmobilecom.af.model.bean.Component
Component.ComponentVisitor
-
-
Field Summary
-
Fields inherited from class com.cmobilecom.af.model.property.EntityProperty
backingBean, COMMAND_OPEN_INPUT_DIALOG, CSS_ALIGN_CENTER, CSS_ALIGN_LEFT, CSS_ALIGN_RIGHT, CSS_BREAK_WORD, CSS_LONG_TEXT, CSS_PROPERTY_NAME_PREFIX, CSS_PROPERTY_VALUE_PREFIX, customProperty, EMAIL_PATTERN, KEY_DIALOG_ENTITY, NAME_PATH_SEPARATOR_CHAR, parent
-
Fields inherited from class com.cmobilecom.af.model.bean.Component
parentComponent, uiView
-
-
Constructor Summary
Constructors Constructor Description EntityHierarchyProperty(PersistenceDataBackingBean<T> backingBean, java.lang.String name, java.lang.Class type, java.lang.reflect.Method readMethod, java.lang.reflect.Method writeMethod, EntityProperty<T> parent)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.Object
convert(java.lang.Object value)
Convert value to the property type if necessary, and validate property value if not delayed for model update phase.java.util.List<EntityProperty<T>>
getChildren()
If edit is enabled and render style is select, the property will be rendered as a list of child properties for multi-level hierarchy select.HierarchyAccessor
getHierarchyAccessor()
Get the HierarchyAccessor for this property.java.lang.String
getHierarchyPathAsString(T entity)
Get hierarchy path as string.<Q> javax.persistence.criteria.Expression<java.lang.Boolean>
getQueryCriterion(javax.persistence.criteria.CriteriaBuilder criteriaBuilder, javax.persistence.criteria.CriteriaQuery<Q> criteriaQuery)
Build query restriction from this hierarchy property.protected java.lang.Object
getValueInternal(T entity, boolean convertToString)
Get property value.boolean
isGrouping()
If edit is enabled and render style is select, the property will be rendered as a group of select properties for multi-level hierarchy select.void
setRenderStyle(RenderStyle renderStyle, boolean initPartialBehaviorSupportFromViewConfig)
Set renderStyle.protected boolean
setValueInternal(T entity, java.lang.Object value)
Set property value.void
validate(java.lang.Object value)
Validate property value including required, length, and value ranges.-
Methods inherited from class com.cmobilecom.af.model.property.EntityProperty
addChild, addChild, addChildren, addMenuNode, anyRowHasInvalidUserInput, asVisitTarget, autoCompleteSuggestions, canBeExecuteTarget, clearInvalidUserInput, clickLink, clickMenuNode, clickValueLink, createDialogContent, getActionPartialBehavior, getActionRenderRegions, getBackingBean, getCheckImageURL, getChild, getChildCount, getContainerBean, getContainerRenderRegions, getCurrentEntity, getCustomValue, getDisplayName, getDomEventDynamicHandler, getDomEventDynamicHandler, getDomEventSupport, getDomEventSupport, getEditable, getEmbeddedStatisticsValueString, getEntity, getEntityAttr, getEntityBackingBean, getGroup, getGroupPropertyList, getHelp, getHelpMessage, getInvalidUserInput, getMaxLength, getMaxValue, getMediaURLs, getMenuBean, getMenuBean, getMenuBean, getMenuNode, getMenuNodeCount, getMessage, getMinLength, getMinValue, getName, getNamePath, getNamePath, getOpenInputDialogMenuNode, getParent, getParent, getParentComponent, getPartialBehavior, getPartialBehaviorSupport, getPartialBehaviorSupport, getPath, getPattern, getPlaceholder, getPlaceholderText, getProgressDescriptor, getQueryInfo, getReadMethod, getReadMethod, getRenderStyle, getRoot, getRowIndex, getSelectItemCount, getSelectItems, getSelectPropertyQueryElements, getStatisticsValueString, getStyleClass, getStyleClassByNamePath, getStyleClassByNamePath, getType, getTypeOrMemberType, getValue, getValue, getValueAutoComplete, getValueBoolean, getValueBoolean, getValueChangePartialBehavior, getValueConverter, getValueDate, getValueDate, getValueInt, getValueInt, getValueInternal, getValueList, getValueList, getValueObject, getValueObject, getValueString, getValueString, getValueStringNative, getValueStringNative, getValueToShowOnActionClick, getViewConfig, getVisibleName, getVisibleName, getWriteMethod, handlePartialBehaviorEvent, handlePartialBehaviorEvent, hasInvalidUserInput, isAutoCompleteMultiValues, isCheckAvailabilityEnabled, isChildProperty, isCustomProperty, isDisplayValueOnly, isDynamicPartialBehaviorSupport, isDynamicRenderStyle, isDynamicSelectQuery, isDynamicValue, isEditable, isEditableIfCreating, isEditEnabled, isEntityDefined, isGroupTitleRow, isHelpRenderable, isHidden, isMarkAsRequired, isMenuNodeRenderable, isMessageRenderable, isNameRenderable, isOpenInputDialog, isReadOnly, isRenderable, isRenderAsOutputText, isRequired, isRequiredStarRenderable, isSelected, isShowIfNull, isShowing, isShowing, isShowing, isShowName, isUserDefined, isValidationDelayed, isValueRenderable, postInit, setBackingBean, setCheckAvailabilityEnabled, setChildren, setCurrentEntity, setCustomProperty, setCustomValue, setDefaultValueFromSelectItems, setDomEventSupport, setDynamicPartialBehaviorSupport, setDynamicRenderStyle, setDynamicSelectQuery, setDynamicValue, setEditable, setEditableIfCreating, setEditableRecursively, setEditEnabled, setEntityAttr, setGroup, setGrouping, setGroupTitleRow, setHelp, setHidden, setInvalidUserInput, setMarkAsRequired, setMaxLength, setMaxValue, setMessage, setMessage, setMessage, setMinLength, setMinValue, setName, setParent, setPartialBehaviorSupport, setPattern, setPlaceholder, setQueryInfo, setRenderStyle, setRequired, setSelected, setSelectPropertyQueryElements, setShowIfNull, setShowName, setStyleClass, setType, setValidationDelayed, setValue, setValue, setValue, setValue, setValueAutoComplete, setValueBoolean, setValueBoolean, setValueConverter, setValueDate, setValueDate, setValueInt, setValueInt, setValueList, setValueList, setValueObject, setValueString, setValueString, setValueStringNative, setValueStringNative, setVisibleName, setVisibleName, toString, walkComponentTree
-
Methods inherited from class com.cmobilecom.af.model.bean.Component
existPathToAncestorType, getAuthenticatedUser, getBackingBeanContext, getCalcContext, getChildOfClosestAncestor, getClientId, getClosestAncestor, getComponentsOnPathTo, getCountryFromCurrentLocale, getCurrencyCode, getCurrentDate, getCurrentLocalDateTime, getDataAccessUnit, getDataAccessUnit, getDataConverter, getInstanceUser, getParameters, getParameters, getPathTo, getPersistenceEntityManager, getPersistenceEntityManager, getPersistenceEntityManager, getPersistenceEntityManager, getQueryHints, getResourceBundle, getRootComponent, getUiView, getUiView, getYearStartDate, isAncestorComponentOf, isEntityI18NEnabled, isInPageContent, setClientId, setParentComponent, setUiView
-
-
-
-
Constructor Detail
-
EntityHierarchyProperty
public EntityHierarchyProperty(PersistenceDataBackingBean<T> backingBean, java.lang.String name, java.lang.Class type, java.lang.reflect.Method readMethod, java.lang.reflect.Method writeMethod, EntityProperty<T> parent)
Constructor.- Parameters:
backingBean
- entity or entity list backing beanname
- property nametype
- property typereadMethod
- read methodwriteMethod
- write methodparent
- parent property
-
-
Method Detail
-
validate
public void validate(java.lang.Object value) throws InvalidValueException, SystemException
Description copied from class:EntityProperty
Validate property value including required, length, and value ranges.If validation is delayed, validate() is called by EntityBackingBean.validate() during Invoke Application Phase, and property value has been set during model update phase even though the value is invalid.
Otherwise, if validation is not delayed(default), validate() is called before setting property value after data conversion during Model Update phase.
- Overrides:
validate
in classEntityProperty<T extends PersistenceEntity>
- Parameters:
value
- property value that has been converted to property type- Throws:
InvalidValueException
- throw if the value is invalidSystemException
- throw if any ohter error occurs
-
getValueInternal
protected java.lang.Object getValueInternal(T entity, boolean convertToString) throws SystemException
Description copied from class:EntityProperty
Get property value. return previous invalid input value (if any) to display invalid input back to user.- Overrides:
getValueInternal
in classEntityProperty<T extends PersistenceEntity>
- Parameters:
entity
- the entity to get value fromconvertToString
- flag indicating whether the property value should be converted into a string- Returns:
- property value
- Throws:
SystemException
- throw if an error occurs
-
getHierarchyPathAsString
public java.lang.String getHierarchyPathAsString(T entity) throws SystemException
Get hierarchy path as string.- Parameters:
entity
- the entity to get value from- Returns:
- path as string such as a/b/c
- Throws:
SystemException
- throw if an error occurs- Since:
- 5.17
-
getHierarchyAccessor
public HierarchyAccessor getHierarchyAccessor() throws SystemException
Get the HierarchyAccessor for this property.- Returns:
- HierarchyAccessor instance.
- Throws:
SystemException
- throw if an error occurs
-
getQueryCriterion
public <Q> javax.persistence.criteria.Expression<java.lang.Boolean> getQueryCriterion(javax.persistence.criteria.CriteriaBuilder criteriaBuilder, javax.persistence.criteria.CriteriaQuery<Q> criteriaQuery) throws SystemException
Build query restriction from this hierarchy property.If matchType is START_WITH, match the hierarchy value or its descendants.
- Overrides:
getQueryCriterion
in classEntityProperty<T extends PersistenceEntity>
- Parameters:
criteriaBuilder
- the CriteriaBuilder instancecriteriaQuery
- the CriteriaQuery being built- Returns:
- Predicate instance
- Throws:
SystemException
- throw if an error occurs
-
isGrouping
public boolean isGrouping()
If edit is enabled and render style is select, the property will be rendered as a group of select properties for multi-level hierarchy select.- Overrides:
isGrouping
in classEntityProperty<T extends PersistenceEntity>
- Returns:
- true if grouping
-
setRenderStyle
public void setRenderStyle(RenderStyle renderStyle, boolean initPartialBehaviorSupportFromViewConfig) throws SystemException
Description copied from class:EntityProperty
Set renderStyle. If openInputDialog is true, add menuNode for opening the input dialog in editing mode. Also add menu node to show/manage I18N translations if this property is I18n enabled. @see EntityI18N- Overrides:
setRenderStyle
in classEntityProperty<T extends PersistenceEntity>
- Parameters:
renderStyle
- the renderStyle to setinitPartialBehaviorSupportFromViewConfig
- whether to initialize partialBehaviorSupport defined in the ViewConfig of its backing bean.- Throws:
SystemException
- throw if an error occurs in checking property showing mode or adding menu ndoes
-
getChildren
public java.util.List<EntityProperty<T>> getChildren()
If edit is enabled and render style is select, the property will be rendered as a list of child properties for multi-level hierarchy select.- Overrides:
getChildren
in classEntityProperty<T extends PersistenceEntity>
- Returns:
- child properties. return null or empty list if there is no child properties.
-
convert
protected java.lang.Object convert(java.lang.Object value) throws SystemException
Description copied from class:EntityProperty
Convert value to the property type if necessary, and validate property value if not delayed for model update phase. Always validate for other phases such as Invoke Application Phase.- Overrides:
convert
in classEntityProperty<T extends PersistenceEntity>
- Parameters:
value
- user input value- Returns:
- the converted value(if necessary) that can be invalid if not validated.
- Throws:
InvalidValueException
- throw if a data conversion error occursSystemException
- throw if any other error occurs
-
setValueInternal
protected boolean setValueInternal(T entity, java.lang.Object value)
Description copied from class:EntityProperty
Set property value. If the value is a string, convert the string to the property type if necessary. If the value is not a string, no type conversion.- Overrides:
setValueInternal
in classEntityProperty<T extends PersistenceEntity>
- Parameters:
entity
- the entity of the property to set value tovalue
- the property value to set- Returns:
- true if value is changed and set successfully, false if not changed or value is invalid
-
-