Class PNMessageProp
- All Implemented Interfaces:
EventListener, IGProp<GProp<?>[]>, IPropCnr, Cloneable
What this is, and what it is not. The canonical in-flight form of a notification is the lightweight IPushNotification object: that is what the engine holds, what the admission-gated dispatch loop carries, and what the VAPID/FCM device path encrypts and ships. A PNMessageProp is the heavyweight form, materialised on demand only at the two boundaries that actually need the framework:
- in-session streaming to a JavaScript client, over the normal IIZI transports; and
- persistence - the spool, the app-session retention, and crash recovery - as XML.
The children map onto showNotification(title,options). The browser leg needs no translation, so the tree is deliberately flat and value-property-based:
TITLEandBODY-KStringProp. One property type carries both plain and HTML text, theKString's ownTypedistinguishing them, so text - the bulk of any notification - is fully covered by existing machinery.TAGandICON-StringProp, through the inheritedgetString/setStringaccessors.DATA-StringMapProp, the orderedoptions.datastring map.OPTIONS-StringMapProp, every othershowNotificationoption (badge,image,requireInteraction, ...), each value as its JSON text. Absent from a notification that carries none.BINARY-ByteArrayProp, an optional opaque binary payload. Absent from a notification that carries none.ACTIONS-PNActions, the ordered action buttons. Predefined, so a message is self-describing; not written to XML while empty.
JS-facing: the leaf types are a closed set. Everything that reaches the JavaScript client must be one of the property classes that has a hand-written JavaScript reconstructor - KStringProp, StringProp, IntProp, NumberProp, StringMapProp, StringArrayProp, ByteArrayProp and PropCnr. A custom GProp<VALUE> is Java-only: it serialises perfectly to XML and then does not reconstruct on the client. No leaf of this tree may be one, which is why every child above is drawn from the closed set. The containers themselves need no new JavaScript class - they are reconstructed by the generic PropCnr JavaScript, which is what the jsclient="PropCnr" registration in base-properties.xml selects.
Timestamps do not live here. A notification is pure payload; when it was created, when it should next be retried and when it expires are spool bookkeeping and live on PNSpoolEntry.
- Author:
- Christopher Mindus
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe action buttons property: "actions", i.e.static final StringThe optional opaque binary payload property: "binary".static final StringThe notification body text property: "body".static final StringThe notification data map property: "data", i.e.static final StringThe notification icon URL property: "icon", i.e.static final StringThe remaining options property: "options", i.e.static final StringThe notification tag property: "tag", i.e.static final StringThe notification title property: "title".Fields inherited from class PropCnr
EMPTY, EMPTY_CLASSES, EMPTY_CNRS, EXTENDS_FRAMEWORK_ERROR_IDFields inherited from class GProp
GPDEBUG, PROP_ATTR_STRING_EDITOR_PROP, PROP_ATTR_STRING_ERRORED_NAME, PROP_ATTR_STRING_EXTENDS, PROP_ATTR_STRING_EXTENDS_FINAL, PROP_ATTR_STRING_EXTENDS_PRIVATE, PROP_ATTR_STRING_NULLABLE, PROP_ATTR_STRING_PRIVATE, PROP_ATTR_STRING_PRIVATE_CHANGE_EVENT, PROP_ATTR_STRING_READ_ONLY, PROP_USER_1, PROP_USER_2Fields inherited from interface IGProp
EQC_ERROR_IGNORE_ALL, EQC_ERROR_IGNORE_REFERENCES, EQC_IGNORE_ARRAY, EQC_IGNORE_VOLATILE_OR_EDITOR, EQC_INCLUDE_PRIVATE, EQC_SAVE_FILE, EXT_CONTAINER_EXTENDS, EXT_CONTAINER_EXTENDS_VALID, EXT_EXTENDED, EXT_FINAL, EXT_OVERRIDES, EXT_OVERRIDES_FINAL_ERR, EXT_PRIVATEConstructor Summary
ConstructorsConstructorDescriptionCreates a push notification message container without name and with a null value.PNMessageProp(Atom propertyAtom) Creates a push notification message container with the specified name with a null value.Method Summary
Modifier and TypeMethodDescriptionprotected voidAdds the predefined properties, i.e.clone()Creates a clone out of this property.Gets the action buttons container, i.e.byte[]Gets the opaque binary payload.getBody()Gets the body text as aKString, which carries its own plain-or-HTML type.Gets the data map property, i.e.getIcon()Gets the notification icon URL, i.e.Gets the remaining-options map property, i.e.getTag()Gets the notification tag, i.e.getTitle()Gets the title as aKString, which carries its own plain-or-HTML type.Puts one entry in the data map, creating the map property if the notification does not yet carry one.Puts one entry in the remaining-options map, creating the map property if the notification does not yet carry one.booleansetBinary(byte[] data) Sets the opaque binary payload.booleanSets the body text from aKString, of either plain or HTML type.booleansetBodyHTML(String body) Sets the body text from HTML.booleansetBodyPlain(String body) Sets the body text from plain text.booleanSets the notification icon URL, i.e.booleanSets the notification tag, i.e.booleanSets the title from aKString, of either plain or HTML type.booleansetTitleHTML(String title) Sets the title from HTML.booleansetTitlePlain(String title) Sets the title from plain text.Methods inherited from class PropCnr
__transferChildProps, addProp, addProp, addProp2, addProp2, appendPropValue, canRequestFocus, completeVirtualize, containsProp, containsProp, convertLoadedProp, couldRequestFocusIfVirtualized, createCopyOfAtom, createUniqueAtom, createUniqueAtom, createUniqueAtom, createVSReference, doPropEqualsArrayValues, enablePropCommunication, enablePropHashMap, equalsTree, equalsTree, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getBool, getBool, getBool, getBool, getChildPropError, getChildPropError, getChildPropErrorSeverity, getChildPropErrorSeverity, getErrorsProp, getExtendsContainer, getExtendsError, getExtendsName, getExtendsOverride, getExtendsPossibleClasses, getFirstProp, getFirstProp, getFocusEngine, getInt, getInt, getInt, getInt, getLong, getLong, getLong, getLong, getNumber, getNumber, getNumber, getNumber, getPossibleChildren, getPredefinedProps, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getPropBaseReference, getPropCnr, getPropCount, getPropCount, getPropIndex, getPropIndex, getPropIndexes, getProps, getProps, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue0, getRetargetedVerifyContainer, getString, getString, getString, getString, getValueClasses, getVSReference, hasFocus, hasSendData, initializeElement, initializeExtendsFramework, initializeProp, initializeValue, initPropCnr, insertProp, insertProp2, isChild, isExtendsOverriden, isExtendsPropertyValid, isExtendsRoot, isPropAddRemoveAllowed, isPropCommunicating, isPropExtended, isPropValueTreeLockNeeded, list, list, logPropNotFound, maybeAddProp, onInsertProp, onPropDispose, onPropRemoved, onPropTreeInitialized, onReferenceEvent, onVirtualContainerCreated, onVirtualizationCompleted, paramString, prepare, removeAllProps, removeAllProps2, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, reorderProps, replaceProps, requestFocus, requestFocus, requestFocusEx, requestFocusEx, resolveReferences, resolveRuntimeReferences, setBool, setBool, setBool, setBool, setCreateRequiredProp, setExtendsName, setExtendsOverride, setInt, setInt, setInt, setLong, setLong, setLong, setLong, setNumber, setNumber, setNumber, setNumber, setProp, setProp, setProp, setProp2, setProp2, setPropValue, setPropValue, setPropValue, setPropValue, setPropValue, setPropValue, setString, setString, setString, setString, shouldCreateProps, shouldSerializeToXML, toElementString, toNativeValue0, usePropHashMap, usesPropIndex, validateChildPropInValue, validateClassInstances, validatePropType, validatePropValue, verify, verifyInternalUseOnly, verifyTree, virtualizeMethods inherited from class GProp
addPropError, addPropListener, appendProp, convertPropError, dispose, equals, equals, equalsErrors, equalsObj, equalsPropValue, equalValues, finalize, fine, fine, finer, finer, finest, finest, fromElementString, getAliasName, getAppSessionGyro, getAppWorker, getAtomPath, getAttribute, getChildReferencePropName, getClientSessionGyro, getClientWorker, getConstraints, getEnvironment, getErroredPropItems, getErroredProps, getErrorsProp, getExtendsRootContainer, getFullPropName, getFullPropName, getFullPropNameDebug, getFullPropNameDebug, getListeners, getModuleFolder, getModuleFolder, getParent, getParent, getProjectName, getPropAtom, getPropError, getPropError, getPropErroredName, getPropErrorSeverity, getPropExtendsFlags, getPropFromPath, getPropFromPath, getPropFromReference, getPropFromReference, getPropIndex, getPropName, getPropPath, getPropPath, getPropReferenceTarget, getPropRootPropMgr, getPropTreeErrorSeverity, getPropValue, getPropValue, getPropValueObject, getReferencePropName, getReferencePropNameNoAssert, getRelativePropName, getRootFromName, getRootName, getRootParent, getRootParentNoAssert, getTreeLock, hasChanged, hasCircularReferencesError, hashCode, hasPrivateChangeEventProp, hasPropError, hasPropTreeError, info, info, initializeGElement, initializeGProp, isDisposed, isPropChildOf, isPropClientCreated, isPropCreateRequired, isPropExtended, isPropExtendsFinal, isPropExtendsPrivate, isPropExtendsPrivateInRoot, isPropExtendsPrivateInRoot, isPropFile, isPropFolder, isPropForEditor, isPropNullable, isPropPrivate, isPropPrivateAtCreation, isPropReadOnly, isPropReferenceTreeValid, isPropRoot, isPropRootLoading, isPropRootTreeModificationsAllowed, isPropUSER, isPropVirtualized, isPropVirtualizing, isPropVolatile, isPropVolatileOrEditorOnly, isProxied, isSibling, list, list, list, mapAliasToReference, mapAliasToReference, mapReferenceToAlias, mapReferenceToAlias, mapReferenceToProjectRelative, modifyPropValue, moveProp, moveProp, moveProp, onEvent, onEventSelf, onPrepare, onPropInvalidateCache, onPropParentChanged, onPropValueSet, onRemoteEvent, paramString, paramValue, post, post, removePropError, removePropListener, removePropUSER, renameProp, renameProp2, resetChangedTree, setChanged, setConstraints, setConstraints, setParent, setPrivateChangeEventProp, setPrivateCreateRequiredProp, setPropError, setPropErroredName, setPropExtended, setPropExtendsFinal, setPropExtendsPrivate, setPropForEditor, setPropNullable, setPropPrivate, setPropReadOnly, setPropUSER, setPropValue, setPropValue, setPropValue, setPropValueIncognito, setPropVolatile, severe, severe, severe, shouldSerializeToXML, throwIfReadOnly, toNativeValue, toString, toString, triggerRemoteEvent, triggerRemoteEvent, validateProp, warning, warning, warningMethods inherited from interface IGProp
addPropError, addPropListener, dispose, equals, fine, fine, finer, finer, finest, finest, fromElementString, getAppSessionGyro, getAtomPath, getClientSessionGyro, getConstraints, getEnvironment, getErroredPropItems, getErroredProps, getErrorsProp, getExtendsRootContainer, getFullPropName, getFullPropNameDebug, getModuleFolder, getModuleFolder, getParent, getParent, getPropAtom, getPropError, getPropError, getPropErrorSeverity, getPropExtendsFlags, getPropFromPath, getPropFromReference, getPropIndex, getPropName, getPropPath, getPropPath, getPropRootPropMgr, getPropTreeErrorSeverity, getPropValue, getPropValue, getReferencePropName, getRelativePropName, getRootParent, getTreeLock, hasChanged, hasCircularReferencesError, hasPrivateChangeEventProp, hasPropError, hasPropTreeError, info, info, initializeGElement, initializeGProp, isDisposed, isPropChildOf, isPropClientCreated, isPropCreateRequired, isPropExtended, isPropExtendsFinal, isPropExtendsPrivate, isPropExtendsPrivateInRoot, isPropExtendsPrivateInRoot, isPropFile, isPropFolder, isPropNullable, isPropPrivate, isPropReadOnly, isPropReferenceTreeValid, isPropRoot, isPropVirtualized, isSibling, list, list, list, mapAliasToReference, mapReferenceToAlias, mapReferenceToProjectRelative, moveProp, moveProp, moveProp, onEvent, onEventSelf, onRemoteEvent, removePropError, removePropListener, renameProp, setChanged, setConstraints, setConstraints, setParent, setPrivateChangeEventProp, setPropError, setPropExtendsFinal, setPropExtendsPrivate, setPropNullable, setPropPrivate, setPropReadOnly, setPropValue, setPropValue, severe, severe, severe, toNativeValue, triggerRemoteEvent, triggerRemoteEvent, validateProp, warning, warning, warningMethods inherited from interface IPropCnr
canRequestFocus, canRequestFocus, couldRequestFocusIfVirtualized, couldRequestFocusIfVirtualized
Field Details
TITLE
The notification title property: "title". AKStringProp, plain or HTML.- See Also:
BODY
The notification body text property: "body". AKStringProp, plain or HTML.- See Also:
TAG
The notification tag property: "tag", i.e.options.tag, the identifier that lets a later notification replace an earlier one on the device.- See Also:
ICON
The notification icon URL property: "icon", i.e.options.icon.- See Also:
DATA
The notification data map property: "data", i.e.options.data. AStringMapProp, which preserves insertion order.- See Also:
OPTIONS
The remaining options property: "options", i.e. every member of the browsershowNotificationoptions object that has no dedicated leaf of its own -badge,image,lang,dir,requireInteraction,silent,renotify,vibrate,timestampand any application-defined member. AStringMapPropwhose every value is the JSON text of the option - a string quoted, a number, boolean, array or object as written - so that a spooled notification replays with every option it was sent with, and a string option that happens to read as a number or boolean comes back a string. Absent from a notification that carries none.- See Also:
BINARY
The optional opaque binary payload property: "binary". AByteArrayProp.- See Also:
ACTIONS
Constructor Details
PNMessageProp
public PNMessageProp()Creates a push notification message container without name and with a null value.PNMessageProp
Creates a push notification message container with the specified name with a null value.- Parameters:
propertyAtom- The property atom.
Method Details
clone
Creates a clone out of this property.addPredefinedProps
Adds the predefined properties, i.e. the emptyPNActionscontainer, so that a message is self-describing rather than assembled ad hoc by its callers andgetActions()never returnsnull.No reference is cached, so no
getPredefinedProps()override is needed after a clone:getActions()looks the child up each time.- Overrides:
addPredefinedPropsin classPropCnr- Throws:
PropException- If the container cannot be added.
getTitle
Gets the title as aKString, which carries its own plain-or-HTML type.- Returns:
- The title, or
nullwhen not set.
setTitle
Sets the title from aKString, of either plain or HTML type.- Parameters:
title- The title.- Returns:
- true when this property container has been changed, false otherwise.
- Throws:
PropException- If the property cannot be added or the value is rejected.
setTitlePlain
Sets the title from plain text.- Parameters:
title- The plain title text.- Returns:
- true when this property container has been changed, false otherwise.
- Throws:
PropException- If the property cannot be added or the value is rejected.
setTitleHTML
Sets the title from HTML.- Parameters:
title- The HTML title text.- Returns:
- true when this property container has been changed, false otherwise.
- Throws:
PropException- If the property cannot be added or the value is rejected.KStringException- If the HTML string cannot be parsed.
getBody
Gets the body text as aKString, which carries its own plain-or-HTML type.- Returns:
- The body, or
nullwhen not set.
setBody
Sets the body text from aKString, of either plain or HTML type.- Parameters:
body- The body text.- Returns:
- true when this property container has been changed, false otherwise.
- Throws:
PropException- If the property cannot be added or the value is rejected.
setBodyPlain
Sets the body text from plain text.- Parameters:
body- The plain body text.- Returns:
- true when this property container has been changed, false otherwise.
- Throws:
PropException- If the property cannot be added or the value is rejected.
setBodyHTML
Sets the body text from HTML.- Parameters:
body- The HTML body text.- Returns:
- true when this property container has been changed, false otherwise.
- Throws:
PropException- If the property cannot be added or the value is rejected.KStringException- If the HTML string cannot be parsed.
getTag
Gets the notification tag, i.e.options.tag.- Returns:
- The tag, or
nullwhen not set.
setTag
Sets the notification tag, i.e.options.tag.- Parameters:
tag- The tag.- Returns:
- true when this property container has been changed, false otherwise.
getIcon
Gets the notification icon URL, i.e.options.icon.- Returns:
- The icon URL, or
nullwhen not set.
setIcon
Sets the notification icon URL, i.e.options.icon.- Parameters:
icon- The icon URL.- Returns:
- true when this property container has been changed, false otherwise.
getDataProp
Gets the data map property, i.e.options.data.- Returns:
- The data map property, or
nullwhen the notification carries no data.
putData
Puts one entry in the data map, creating the map property if the notification does not yet carry one.- Parameters:
key- The key.value- The value.- Returns:
- The previous value for the key, or
nullwhen there was none. - Throws:
PropException- If the map property cannot be added or is read-only.
getOptionsProp
Gets the remaining-options map property, i.e. theshowNotificationoptions that have no dedicated leaf.- Returns:
- The options map property, or
nullwhen the notification carries none.
putOption
Puts one entry in the remaining-options map, creating the map property if the notification does not yet carry one.- Parameters:
key- The option name.value- The option value as JSON text: a string quoted, any other value as written.- Returns:
- The previous value for the key, or
nullwhen there was none. - Throws:
PropException- If the map property cannot be added or is read-only.
getBinary
public byte[] getBinary()Gets the opaque binary payload.- Returns:
- The binary payload, or
nullwhen the notification carries none.
setBinary
Sets the opaque binary payload.- Parameters:
data- The binary payload.- Returns:
- true when this property container has been changed, false otherwise.
- Throws:
PropException- If the property cannot be added.
getActions
Gets the action buttons container, i.e.options.actions.- Returns:
- The actions container; never
null, because it is a predefined property.