Wednesday, June 5, 2013

Use Transient Attribute to get a value in managed bean from a read only view object(ROVO) SOC

    public void onSubmit(ActionEvent actionEvent) {
       

        DCBindingContainer dcBindings =
            (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
        DCIteratorBinding iterBind =
            (DCIteratorBinding)dcBindings.get("InsertReviewROVOIterator");

        Row[] rows = iterBind.getAllRowsInRange();

        for (Row row : rows) {
            if (row.getAttribute("InsertStatus") != null) {

                operationBinding.getParamsMap().put("tableName", "INSERT");
                operationBinding.getParamsMap().put("insertId",
                                                    row.getAttribute("insertId"));
                operationBinding.getParamsMap().put("empId", getEmpId());
                operationBinding.getParamsMap().put("commentRef",
                                                    row.getAttribute("insertStatus"));
                operationBinding.getParamsMap().put("commentText",
                                                    row.getAttribute("Comments"));
                operationBinding.execute();

                // Insert into InsertStatus with ID and PENDING
                if (row.getAttribute("InsertStatus ").toString().equalsIgnoreCase("83")) {

                    insertStatusBinding.getParamsMap().put("insertId",
                                                           row.getAttribute("insertId"));
                    insertStatusBinding.getParamsMap().put("statusCode",
                                                           "decline");
                    insertStatusBinding.getParamsMap().put("empId",
                                                           getEmpId());
                    insertStatusBinding.execute();
                }

                if (row.getAttribute("InspectionStatus").toString().equalsIgnoreCase("84")) {

                   insertStatusBinding.getParamsMap().put("insertId",
                                                           row.getAttribute("insertId"));
                    insertStatusBinding.getParamsMap().put("statusCode",
                                                           "Hold");
                   
                    insertStatusBinding.getParamsMap().put("empId",
                                                           getEmpId());
                    insertStatusBinding.execute();
                }

                if (row.getAttribute("InsertStatus").toString().equalsIgnoreCase("2")) {

                    insertStatusBinding.getParamsMap().put("insertId",
                                                           row.getAttribute("insertId"));
                    insertStatusBinding.getParamsMap().put("statusCode",
                                                           "PENDING");
                    insertStatusBinding.getParamsMap().put("empId",
                                                           getEmpId());
                    insertStatusBinding.execute();
                }


                PopupUtil.invokePopup(p2.getClientId(FacesContext.getCurrentInstance()));


            }


        }
        OperationBinding saveOperation = ADFUtils.findOperation("Commit");
        saveOperation.execute();


    }

No comments: