Menu

Setting values remotely

Alexander Ilyin

You can set values by some complicated actions on the server.
That can be done using SendControlValue or UpdateInCurrentEditor actions.

F.g. using some Dict control you can send some dict value to the server to execute the remote action addOutgoingDocumentOperation

    <act:Action id="addOutgoingDocumentOperation" navigateUITo="$Binding/docOperationsTable/$last">
        <pta:SendControlValue usecase="s1:OutgoingDocumentManagement"
            action="addOutgoingDocumentOperation"
            source="com.yourcompany.outgoingdocoperationadder">
            <act:param name="docId" byRoot="true" xpath="@identity" />
            <act:param name="commitMode" value="OutgoingDocuments" />
        </pta:SendControlValue>
        <act:InvalidateStructure />
    </act:Action>

You have to say what mode to use to save all unsaved data before to execute the action(the parameter commitMode)

On the server you have take care on retrieving of sent parameters.

Usually you will sent some identity id. Special case is to take care on identity id when we handle new object.
So when server will save unsent data it actually will create new object with new identity id which was unknown when we send remote action request. So you have to find out new id on the server manually.

It usually can be done by code like that:

    public long getObjectId(Element rootParameter,
            AbstractParamHolder paramHolder) {
        long objectId = StringUtils.parseLong(rootParameter
                .getAttribute("objectId")); //$NON-NLS-1$
        if (objectId < 1) {
            LongIdentity identity = (LongIdentity) paramHolder
                    .getParamByName(DocFlowerServerConsts.PARAM_COMMITED_OBJECT_KEY);

            objectId = identity.getKey();
        }
        return objectId;
    }

MongoDB Logo MongoDB