Ladies_Man

proc1subj1Refeinment

Jun 8th, 2016
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.50 KB | None | 0 0
  1. import java.io.BufferedReader;
  2. import java.io.File;
  3. import java.io.FileInputStream;
  4. import java.io.FileNotFoundException;
  5. import java.io.IOException;
  6. import java.io.InputStreamReader;
  7. import java.util.Set;
  8.  
  9. import org.apache.commons.logging.Log;
  10. import org.apache.commons.logging.LogFactory;
  11. import org.springframework.beans.factory.annotation.Autowired;
  12.  
  13. import ru.it.metasonic.workshop.bo1.BO1View;
  14.  
  15. import com.jcom1.api.constants.Constants.Storage.BusinessObject20;
  16. import com.jcom1.api.dto.interfaces.IStorageInstanceBean;
  17. import com.jcom1.api.dto.interfaces.ISubjectInstanceBean;
  18. import com.jcom1.api.dto.interfaces.storages.IStorageInstanceItemBeanReducedToId;
  19. import com.jcom1.api.interfaces.IBo20AccessApi;
  20. import com.jcom1.api.interfaces.ICommonApi;
  21. import com.jcom1.api.util.IViewStorageInstanceItemPair;
  22. import com.jcom1.runtime.refinement.AbstractRefinement;
  23. import com.jcom1.runtime.refinement.FunctionStateRequest;
  24. import com.jcom1.runtime.refinement.FunctionStateResponse;
  25. import com.jcom1.runtime.refinement.RefinementGenerator;
  26.  
  27. import de.metasonic.businessobjects.model.rules.AbstractServerAction;
  28.  
  29. @RefinementGenerator(id = "InternalSubjectDescription_oz7BYSu2EeaVpLwktGFxww")
  30. public class proc1subj1Refinement extends AbstractRefinement {
  31.  
  32.     @Autowired
  33.     ICommonApi commonApi;
  34.     @Autowired
  35.     IBo20AccessApi accessApi;
  36.     /**
  37.      * @generated
  38.      */
  39.     private final static Log log = LogFactory
  40.             .getLog("com.jcom1.refinement.proc1.proc1subj1");
  41.  
  42.     private File dir, currentFile;
  43.     private BufferedReader reader;
  44.     /**
  45.      * This method is called when the named function state is reached State:
  46.      * State1 StateType: FUNCTION
  47.      *
  48.      * Return values "FunctionTransitionDescription_sXeAoSu2EeaVpLwktGFxww" when
  49.      * result is "" to go to state State2
  50.      *
  51.      * @return return the id of the transition to follow e.g. // return new
  52.      *         FunctionStateResponse("transitionXXXXXXXX");
  53.      */
  54.     @RefinementGenerator(id = "FunctionStateDescription_rbzpoSu2EeaVpLwktGFxww")
  55.     public FunctionStateResponse functionState1(
  56.             FunctionStateRequest functionStateRequest) {
  57.         log.debug(">>>state 1");
  58.        
  59.  
  60.         String subjInstId = functionStateRequest.getSubjectInstanceId();
  61.         try {
  62.  
  63.             ISubjectInstanceBean subjInstBean = commonApi
  64.                     .getSubjectInstanceBean(subjInstId);
  65.             Set<IStorageInstanceBean> storages = accessApi.getStorages(
  66.                     subjInstBean, null);
  67.  
  68.             for (IStorageInstanceBean storInstBean : storages) {
  69.                 Set<IStorageInstanceItemBeanReducedToId> storItems = accessApi
  70.                         .getItems(subjInstBean, storInstBean);
  71.  
  72.                 for (IStorageInstanceItemBeanReducedToId storItem : storItems) {
  73.  
  74.                     String actionType = BusinessObject20.Action.READ;
  75.  
  76.                     IViewStorageInstanceItemPair storInstItem = accessApi
  77.                             .getIViewAndItem(subjInstBean, storItem, actionType);
  78.  
  79.                     BO1View iView = (BO1View) storInstItem.getiView();
  80.  
  81.                     //log.debug("String2beafore: " + iView.getString2());
  82.                     //iView.setString2(text);
  83.                     //log.debug("String2after: " + iView.getString2());
  84.  
  85.                 }
  86.             }
  87.  
  88.         } catch (Exception e) {
  89.             // e.printStackTrace();
  90.             log.error(e);
  91.         }
  92.  
  93.         return null;
  94.         // return new
  95.         // FunctionStateResponse("FunctionStateDescription_uiF1YyvHEeaai5222UHIUA");
  96.     }
  97.  
  98.     /**
  99.      * This state is an exit state Do all necessary clean up here. State: State2
  100.      * StateType: EXIT
  101.      */
  102.     @RefinementGenerator(id = "FunctionStateDescription_sXeAoyu2EeaVpLwktGFxww")
  103.     public void functionState2(FunctionStateRequest functionStateRequest) {
  104.         log.debug(">>>state 2");
  105.        
  106.  
  107.        
  108.     }
  109. }
Advertisement
Add Comment
Please, Sign In to add comment