Learn about step to get login user and add to search criteria.

Procedure

  1. From ONEWEB workspace, create java file name "com.manual.doc.order.java.OrderRequestRequesterSearchMode" in MasterWeb with coding below.


import java.util.HashMap;


import org.apache.log4j.Logger;


import com.master.form.EntityFormHandler;

import com.master.form.MasterFormHandler;

import com.master.util.EAFManualUtil;

import com.master.util.ProcessAction;

import com.master.util.ProcessHelper;


public class OrderRequestRequesterSearchMode extends ProcessHelper implements ProcessAction {

       Logger logger = Logger.getLogger(OrderRequestRequesterInsertMode.class);

       @Override

       public HashMap getSearchResult() {

               //get data model of main module

               String entityID = (String)getRequest().getSession().getAttribute("entityID");

               EntityFormHandler entityForm = (EntityFormHandler)getRequest().getSession().getAttribute(entityID +"_session");

               String moduleID = entityForm.getMainModuleID();

                               

               MasterFormHandler moduleForm = (MasterFormHandler) request.getSession().getAttribute(moduleID + "_session");

               String userName = (String)request.getSession().getAttribute("userName");

               StringBuilder appendSql = new StringBuilder(" and wf_service_request.requester ='");

               appendSql.append(userName).append("' ");

               

               String sql = moduleForm.getModuleM().getSqlWorkQueue();

               logger.info("@@@@@ old sql :" + sql);

               

               StringBuilder newSql = new StringBuilder(sql);

               newSql.append(appendSql);

               

               logger.info("@@@@@ new sql :" + newSql.toString());

               

               //moduleForm.getModuleM().setSqlWorkQueue(sql);

               

               return EAFManualUtil.loadTableData(request, newSql.toString(), moduleForm.getPage(), moduleForm.getVolumePerPage());

       }

}


  1. From ONEWEB workspace, export EafMasterEar.ear and deploy update to server. The new class name "com.manual.doc.order.java.OrderRequestRequesterSearchMode" will deploy to server.


  1. Go to App Designer and open entity name "Doc Order Request - Requester" to edit.


  1. From Tools > Action drag Entity Action to the box under entity name. The action name "SEARCH" shows then click icon pencil to edit it. The dialog of Action Field Configuration opens.
    1. Put "com.manual.doc.order.java.OrderRequestRequesterSearchMode" to Class Action.  
    2. Click OK.


  1. Click Save this Entity.


  1. Test by log in to FrontWeb.
    1. Click menu SETTING > Refresh Cache to update new configuration at App Designer to server.
    2. Click menu DOC Order Request and click SEARCH. Result will display only record that create by Requester who login.