Editable DM

The EditableDM element provides functionality for a user to edit and modify data measure bucket values.

<TLVList xmlns="http://www.onenetwork.com/Platform">
<TLV>
<Name>EditableTLVExample</Name>
<Bucketization>DAILY</Bucketization>
<BucketsPerPage>7</BucketsPerPage>
<EditableTLV>
<RoleTypeRef>
<IntrinsicRoleType>REPLENISHMENT_ANALYST</IntrinsicRoleType>
</RoleTypeRef>
 
<EditHandler class="com.onenetwork.platformtestmodule.tlv.TestUpdateHandler">
<Param>
<name>DMName</name>
<value>RequestQuantity</value>
</Param>
</EditHandler>
</EditableTLV>
<Filters bindSqlNulls="true">
<CustomFilterField>
<FieldRef category="PDF" levelType="Undefined">
<FieldName>DateRange</FieldName>
</FieldRef>
<Hidden>false</Hidden>
<Editable>true</Editable>
<Type>DATE_RANGE</Type>
<Optional>false</Optional>
<DateRangeMapping fromSqlName="DATE_RANGE_START" toSqlName="DATE_RANGE_END"/>
</CustomFilterField>
<DateRange start="$NULL$" end="$NULL$"/>
</Filters>
<ColumnHierarchy/>
<DM bucketization="DAILY" editable="true">
<Name>EditableDM</Name>
<DisplayName>Editable DM</DisplayName>
<EditableConfig>
<RoleTypeRef>
<IntrinsicRoleType>REPLENISHMENT_ANALYST</IntrinsicRoleType>
</RoleTypeRef>
</EditableConfig>
<SqlDefRef>
<GroupName>PTA.TlvSqls</GroupName>
<SqlName>DummySql</SqlName>
</SqlDefRef>
<SqlQuantityField levelType="Undefined">
<FieldName>quantity</FieldName>
</SqlQuantityField>
<SqlDateField levelType="Undefined">
<FieldName>the_date</FieldName>
</SqlDateField>
</DM>
</TLV>
</TLVList>

A DataMeasure is rendered as editable if:


  1. EditableTLV element is present on the TLV, and the editable attribute is true on the Data Measure.

  2. Either the roleType list is empty, or the logged in user's role matches (or is derived from) any of the provided roleTypes. The list of roleTypes can be overridden at data measure level.

  3. BaseTLVEditHandler.isEditable() method returns true. The default implementation of BaseTLVEditHandler returns true, but subclasses can override this to provide their own more complex edit logic.

EditableTLV defintion details:


  1. saveWithoutMods (attribute)—When provided and true, the save() method of the handler will be called, even if no data measure modifications are made by the user.

  2. RoleTypeRef—List of RoleTypeRefs (optional).

  3. EditHandler—the class attribute should be provided on this element. Here the developer should provide a fully qualified class name that extends com.onenetwork.platform.data.tlv.BaseTLVEditHandler and provides an implementation for save() method.

  4. Param—List of params containing name-value pair (optional). These will be set on the BaseTLVEditHandler subclass after instantiation.

Please refer to ComputedDM to see the available methods on the DataMeasure interface. This should provide the BaseTLVEditHandler implementation enough information to save updates to the database.

The BaseTLVEditHandler implementation can throw DMSaveException from the handler class to rollback everything and display all the errors on the UI.
images/download/attachments/144835693/EditableDM-version-1-modificationdate-1645048711000-api-v2.png