com.sap.portal.adminstudio.workunitfwapipublic interface IDataHandler
Load Data: In this method the data model should be created by the server data. The following example shows how to implement the method.
public void loadData(
IEditorContext ctx,
IPrincipal principal,
PPLogger logger)
throws EditorDataException {
ctx.setProperty("details.firstName", "John");
ctx.setProperty("details.lastName", "Smith");
ctx.setProperty("details.payment", "cash");
ctx.setProperty("details.adress",
"26 Elm Street");
ctx.setProperty("payment.type", "creditCard");
ctx.setProperty("payment.number", "123456");
ctx.setProperty("payment.company", "Visa");
ctx.setProperty("payment.month", "08");
ctx.setProperty("payment.year", "2004");
ctx.setProperty("credit.type", "Installments");
ctx.setProperty("credit.number","1");
//setting the data for the tables
TableDataModel tableModel = new TableDataModel();
StoreableList tableModelList = (StoreableList) getTableData(ctx);
tableModel.setTableViewModel(tableModelList);
ctx.setProperty(
TrainsTablePane.TIME_TABLE_GENERIC_PATH,tableModel);
TableDataModel orderTable = new TableDataModel();
StoreableList orderTableList = (StoreableList)getOrderTableData(ctx);
orderTable.setTableViewModel(orderTableList);
ctx.setProperty(
TrainsTablePane.ORDERS_TABLE_GENERIC_PATH,
orderTable);
}
The first section sets the data for all the components except the table.
The second section sets the table data. The getTableData and
getOrderTableData methods are used to create the rows that are
added to the table.
Save Data: In this method the data model data should be saved to the
server. The implementation of this method is optional. The following
example shows how to implement the method:
public void saveData(
IEditorContext ctx,
IPrincipal principal,
PPLogger logger)
throws EditorDataException,
EditorResourceException {
//apply changes according to ui fields
String lastName = (String)
ctx.getProperty("details.lastName");
//retrieving the property "description" from the property editorIProperty prop = this.
getModifiedPropertyObject(ctx).getProperty(
"com.sap.portal.pcm.Description");
String description = prop.getValue();
if (lastName.equals("failed") && description.equals("last name not failed"))
{
ctx.getEditorResponse().addMessageKey(
EditorMessageType.ERROR,"Save Failed");
throw new EditorDataException("failed");
}
else
super.saveData(ctx, principal, logger);
}
In this example, the handler extends PCMDataHandler , enabling retrieving the values from the property editor using the getModifiedPropertyObject method. If the user enters the value failed into the lastName field, and the value last name not failed in the description property in the property editor, then when trying to save, a Save Failed error message appears.
| Modifier and Type | Method and Description |
|---|---|
void |
loadData(IEditorContext ctx,
com.sap.security.api.IPrincipal principal,
PPLogger logger)
Deprecated.
Loads and stores the data editor context.
|
void |
saveData(IEditorContext ctx,
com.sap.security.api.IPrincipal principal,
PPLogger logger)
Deprecated.
Saves the edited data for this editor.
|
void loadData(IEditorContext ctx, com.sap.security.api.IPrincipal principal, PPLogger logger) throws EditorDataException, EditorResourceException
IEditorContext.setProperty.
pane1.input1, and the loaded data is
setProperty("pane1.input1",data), when the editor is
loaded, the input field contains the data.ctx - the current editor contextprincipal - a security principal that loads the
datalogger - a logger for sending log messagesEditorDataException - if the data could not be loaded or
there are no permissions, an
end-user message is presented
and read-only mode is setEditorResourceException - if an error occurs regarding the
resource for this editor, the editor
framework presents an end-user
message instead of the regular editor
user interfacevoid saveData(IEditorContext ctx, com.sap.security.api.IPrincipal principal, PPLogger logger) throws EditorDataException, EditorResourceException
ctx - the current editor contextprincipal - a security principal that saves the
datalogger - a logger for sending log messagesEditorDataException - if the data could not be loaded or
there are no permissions, an end-user
message is presented and read-only
mode is setEditorResourceException - if an error occurs regarding the
resource for this editor, the editor
framework presents the specified
end-user message instead of the
regular editor user interface| Access Rights |
|---|
| SC | DC | Public Part | ACH |
|---|---|---|---|
[sap.com] EP-RUNTIME
|
[sap.com] tc/ep/admin/api
|
api
|
EP-PIN
|
Copyright 2021 SAP SE Complete Copyright Notice