Sunday, March 24, 2013

ADF - Setting value of an attribute explicitly

I have a form with 2 buttons, DRAFT and SUBMIT. On click of Draft button, the form will be saved with status attribute as Draft.

    public void onClickSaveDraft(ActionEvent actionEvent) {
        // Add event code here...
        DCBindingContainer bc = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
        DCIteratorBinding iter = bc.findIteratorBinding("IssueVO1Iterator");
        Row r = iter.getCurrentRow();
        r.setAttribute("Status", "DRAFT");

        String issueStatus = (String)r.getAttribute("Status");
        System.out.println("issueStatus: " + issueStatus);

        OperationBinding operationBinding = bc.getOperationBinding("Commit");
        operationBinding.execute();
        if (!operationBinding.getErrors().isEmpty()) {
            System.out.println("Error");
        }
        System.out.println("No Error");
    }

No comments:

Post a Comment