Ejemplo n.º 1
0
  @Test
  public <T extends BaseAction> void test4_mockUpConcreteSubclassesUsingAnonymousMockUp() {
    actionB = new ConcreteAction1();

    new MockUp<T>() {
      @Mock
      int perform(int i) {
        return i + 1;
      }

      @Mock
      int toBeMockedAsWell() {
        return 123;
      }
    };

    assertEquals(2, actionB.perform(1));
    assertEquals(123, actionB.toBeMockedAsWell());
    assertEquals(1, actionB.notToBeMocked());

    ConcreteAction2 action2 = new ConcreteAction2();
    assertEquals(3, action2.perform(2));
    assertEquals(123, action2.toBeMockedAsWell());
    assertEquals(2, action2.notToBeMocked());

    ConcreteAction3 action3 = new ConcreteAction3();
    assertEquals(4, action3.perform(3));
    assertEquals(123, action3.toBeMockedAsWell());
    assertEquals(3, action3.notToBeMocked());
  }
Ejemplo n.º 2
0
  /**
   * Update the dialog contents.
   *
   * @param jheader The job portion of the dialog header.
   * @param job The queue job.
   * @param info The current job status information.
   */
  public void updateContents(
      String jheader, QueueJob job, QueueJobInfo info, SubProcessExecDetails details) {
    ActionAgenda agenda = job.getActionAgenda();
    QueueJobResults results = info.getResults();

    String dir = "-";
    if ((agenda != null) && (info.getOsType() != null))
      dir = agenda.getTargetPath(info.getOsType()).toString();

    String hostname = "";
    if (info.getHostname() != null) hostname = (" [" + info.getHostname() + "]");

    String command = "-";
    if (details != null) command = details.getCommand();

    TreeMap<String, String> env = new TreeMap<String, String>();
    if (details != null) env = details.getEnvironment();

    setHeader("Execution Details -" + jheader + hostname);

    pWorkingDirField.setText(dir);

    BaseAction action = job.getAction();
    pCommandLineLabel.setText(
        "Action Command:  " + action.getName() + " (v" + action.getVersionID() + ")");
    pCommandLineArea.setText(command);

    {
      Component comps[] = UIFactory.createTitledPanels();
      {
        JPanel tpanel = (JPanel) comps[0];
        JPanel vpanel = (JPanel) comps[1];

        if (!env.isEmpty()) {
          String last = env.lastKey();
          for (String key : env.keySet()) {
            String value = env.get(key);

            JTextField field =
                UIFactory.createTitledTextField(tpanel, key + ":", sTSize, vpanel, value, sVSize);
            field.setHorizontalAlignment(JLabel.LEFT);

            if (!key.equals(last)) UIFactory.addVerticalSpacer(tpanel, vpanel, 3);
          }
        } else {
          tpanel.add(Box.createRigidArea(new Dimension(sTSize, 0)));
          vpanel.add(Box.createHorizontalGlue());
        }
      }

      pEnvLabel.setText("Toolset Environment:  " + agenda.getToolset());
      pEnvScroll.setViewportView(comps[2]);
    }
  }
Ejemplo n.º 3
0
 private String login(UserStatus status) {
   super.clearSession();
   if ((user = userService.login(user, status)) != null) {
     // 将相关的用户id存入session
     super.saveUser(user);
     super.getSessionMap().put("relativeUsers", talkingService.preGetRelativeUserId(user));
     // 将相关的用户id存入session
     super.getSessionMap().put("relativeUsers", talkingService.preGetRelativeUserId(user));
     return SUCCESS;
   } else {
     return INPUT;
   }
 }
Ejemplo n.º 4
0
  @SuppressWarnings("unchecked")
  public void carryOut() {

    List list = super.findAll(queryString + " and id in (" + getIds() + "0 ) ");

    List list1 = new ArrayList();
    for (Object o : list) {
      Proflow source = (Proflow) o;
      source.setOvermark("1"); // 标志原入库流程已完成

      Proflow proFlow = new Proflow();
      proFlow.setProcode(source.getProcode());
      proFlow.setTypeid(source.getTypeid());
      proFlow.setSourcedate(new Date());
      proFlow.setCurware("4"); // 当前所在,未出库前,2表示仓库
      proFlow.setProsource("4"); // 1表示生产部,2表示仓库
      proFlow.setSourceoper(getSession().getAttribute("username").toString());
      proFlow.setSendarea(this.getSendarea());
      proFlow.setSendinfo("返修入库");

      proFlow.setSendto("2");
      proFlow.setOvermark("0");

      proFlow.setPreid(source.getId());

      list1.add(proFlow);
    }

    list1.addAll(list);
    super.uporsave(list1);

    this.setResult(true);
  }
Ejemplo n.º 5
0
 @Action(
     value = CENTER,
     results = {@Result(name = SUCCESS, location = BaseAction.FOREPART + CENTER + JSP)})
 public String center() {
   /** ************************ TT ****************************************** */
   List<User> focusUserList =
       userService.getFocusList(User.class, (User) getSessionMap().get("user"));
   if (focusUserList.size() > 9) {
     focusUserList = focusUserList.subList(0, 9);
   }
   getRequestMap().put("focusUserList", focusUserList);
   List<Club> focusClubList =
       userService.getFocusList(Club.class, (User) getSessionMap().get("user"));
   if (focusClubList.size() > 9) {
     focusClubList = focusClubList.subList(0, 9);
   }
   getRequestMap().put("focusClubList", focusClubList);
   List<Merchant> focusMerchantList =
       userService.getFocusList(Merchant.class, (User) getSessionMap().get("user"));
   if (focusMerchantList.size() > 9) {
     focusMerchantList = focusMerchantList.subList(0, 9);
   }
   getRequestMap().put("focusMerchantList", focusMerchantList);
   super.getRequestMap().put("allUsers", userService.allUsers());
   user = (User) getSessionMap().get("user");
   /** ************************ 相册 ****************************************** */
   page = pictureService.getRelativeByHql(eachPageNumber, currentPage, totalPageNumber);
   pics = pictureService.findRelativePictureByHql(page);
   /** *********************** 相关说说 ****************************************** */
   page = talkingService.getRelativePageByHql(user, eachPageNumber, currentPage, 1);
   taks = talkingService.findRelativeTalkingByHql(page, user);
   return SUCCESS;
 }
Ejemplo n.º 6
0
 @Action(
     value = REGISTER,
     results = {
       @Result(
           name = SUCCESS,
           type = REDIRECT_ACTION,
           location = "emailLoginJsp",
           params = {"email", "${#request.email}"}),
       @Result(
           name = INPUT,
           type = REDIRECT_ACTION,
           location = REGISTER_INPUT,
           params = {"msg", "请正确输入信息!"}),
       @Result(name = ERROR, location = FOREPART + ERROR_PAGE)
     })
 public String register() {
   if (portrait != null) {
     fillPortraitPathToUser(user.getName());
   }
   String[] email = user.getEmail().split("@");
   if (email.length != 2) {
     return INPUT;
   }
   super.getRequestMap().put("email", email[1]);
   if (userService.register(user, portrait)) {
     if (mailService.sendRegisterLetter(user)) {
       return SUCCESS;
     } else {
       return ERROR;
     }
   } else {
     return INPUT;
   }
 }
Ejemplo n.º 7
0
 @Action(
     value = LOGOUT,
     results = {@Result(name = SUCCESS, type = REDIRECT_ACTION, location = IndexAction.INDEX)})
 public String logout() {
   super.clearSession();
   return SUCCESS;
 }
Ejemplo n.º 8
0
 @Action(
     value = REFRESH_USER + "*",
     results = {@Result(name = SUCCESS, type = REDIRECT_ACTION, location = "{1}")})
 public String refreshUser() {
   super.saveUser(userService.refresh(currentUser()));
   return SUCCESS;
 }
Ejemplo n.º 9
0
 @Action(
     value = MY_INVITED,
     results = {@Result(name = SUCCESS, location = FOREPART + MY_INVITED + JSP)})
 public String myInvited() {
   super.getRequestMap().put(MY_INVITED, clubService.myInvited(super.currentUser()));
   return SUCCESS;
 }
Ejemplo n.º 10
0
  @Test
  public void test6_mockUpConcreteSubclassesUsingNamedMockUp() {
    new BaseClassMockUp();

    actionB = new ConcreteAction1();
    assertEquals(4, actionB.perform(1));
    assertEquals(5, new ConcreteAction2().perform(2));
    assertEquals(6, new ConcreteAction3().perform(3));
  }
Ejemplo n.º 11
0
 public void prepare() throws Exception {
   super.saveRequestParameter();
   if (tradecomment == null) {
     tradecomment = new Tradecomment();
   }
   String id = this.tradecomment.getTrade_id();
   if (!ValidateUtil.isDigital(id)) {
     tradecomment = this.tradecommentService.get(id);
   }
 }
Ejemplo n.º 12
0
 public void delete() {
   boolean flag = false;
   String id = request.getParameter("id");
   try {
     messageCommentService.removeEntityById(Long.valueOf(id), MessageComment.class);
     flag = true;
     super.reponseWriter(JSON.toJSONString(flag));
   } catch (NumberFormatException e) {
     e.printStackTrace();
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
Ejemplo n.º 13
0
  @Override
  protected void service(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {

    HttpRequest request = new RequestContext(req);
    HttpResponse response = new ResponseContext(resp);

    //	 if (!_isIstall()) {//没有安装转移到安装页面
    //		  String url = request.basePath()+"install/index.html";
    //		  response.sendRedirect(url );
    //		  return;
    //	  }

    String module = request.getModule(); // 取得调用类
    String action = request.getAction(); // 取得调方法
    BaseAction baseAction = _retrieveModule(module); // 初始调用类
    if (baseAction == null) {
      // 没有找到Module 返回404
      response.sendError(HttpServletResponse.SC_NOT_FOUND); // 返回404
      return;
    }

    baseAction.init(request, response); // 初始化baseAction

    if (StringUtils.isNotEmpty(action)) {
      baseAction.run(); // 执行
    } else // 默认执行
    {
      try {
        baseAction.execute();
      } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      } finally {
        DBManager.closeConnection(); // 释放数据库连接到连接池中
      }
    }
  }
Ejemplo n.º 14
0
  /** 查询主页 */
  public void query() {
    String page = request.getParameter("page"); // 当前页数
    String rows = request.getParameter("rows"); // 每页显示行数

    try {
      BBSMessage bbsMessage = new BBSMessage();
      Pager pager =
          bbsMessageService.queryBBSMessageByPage(
              bbsMessage, Integer.valueOf(rows), Integer.valueOf(page));
      super.reponseWriter(JSON.toJSONString(pager));
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Ejemplo n.º 15
0
 public void update() {
   boolean flag = false;
   String id = request.getParameter("id");
   MessageComment messageComment = getMessageComment();
   try {
     messageComment.setId(Long.valueOf(id));
     messageCommentService.saveEntity(messageComment);
     flag = true;
     super.reponseWriter(JSON.toJSONString(flag));
   } catch (NumberFormatException e) {
     e.printStackTrace();
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
Ejemplo n.º 16
0
 public void update() {
   boolean flag = false;
   String id = request.getParameter("id");
   BBSMessage bbsMessage = getBBSMessage();
   try {
     bbsMessage.setId(Long.valueOf(id));
     bbsMessageService.saveEntity(bbsMessage);
     flag = true;
     super.reponseWriter(JSON.toJSONString(flag));
   } catch (NumberFormatException e) {
     e.printStackTrace();
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
Ejemplo n.º 17
0
  @After
  public void checkImplementationClassesAreNoLongerMocked() {
    if (actionI != null) {
      assertEquals(-1, actionI.perform(0));
    }

    assertEquals(-2, new ActionImpl2().perform(0));

    if (actionB != null) {
      assertEquals(-1, actionB.perform(0));
    }

    assertEquals(-2, new ConcreteAction2().perform(0));
    assertEquals(-3, new ConcreteAction3().perform(0));
  }
Ejemplo n.º 18
0
  public void save() {
    boolean flag = false;
    BBSMessage bbsMessage = getBBSMessage();

    try {
      bbsMessage.setScannum(Long.parseLong("0"));
      bbsMessage.setIsessence(0);
      bbsMessageService.saveEntity(bbsMessage);
      flag = true;
      super.reponseWriter(JSON.toJSONString(flag));
    } catch (NumberFormatException e) {
      e.printStackTrace();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Ejemplo n.º 19
0
  /** 查询主页 */
  public void query() {
    messageid = Long.parseLong(request.getParameter("messageid"));
    String page = request.getParameter("page"); // 当前页数
    String rows = request.getParameter("rows"); // 每页显示行数

    try {
      MessageComment messageComment = new MessageComment();
      messageComment.setMessageid(messageid);
      Pager pager =
          messageCommentService.queryMessageCommentByPage(
              messageComment, Integer.valueOf(rows), Integer.valueOf(page));
      super.reponseWriter(JSON.toJSONString(pager));
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Ejemplo n.º 20
0
  public String save() {
    boolean flag = false;
    MessageComment messageComment = getMessageComment();

    try {
      messageCommentService.saveEntity(messageComment);
      bbsMessageQuery = bbsMessageService.findBBSMessageQuery(messageComment.getMessageid());
      commentslist = bbsMessageService.queryCommentsByMsgId(messageComment.getMessageid());
      flag = true;
      super.reponseWriter(JSON.toJSONString(flag));
    } catch (NumberFormatException e) {
      e.printStackTrace();
    } catch (Exception e) {
      e.printStackTrace();
    }
    return "bbs_detail";
  }
Ejemplo n.º 21
0
 @Action(
     value = REGISTER_VALIDATE,
     results = {
       @Result(name = SUCCESS, type = REDIRECT_ACTION, location = IndexAction.INDEX),
       @Result(
           name = INPUT,
           type = REDIRECT_ACTION,
           location = MANAGER_LOGIN_INPUT,
           params = {"msg", "注册验证失败(可能链接已过期)!"})
     })
 public String registerValidate() {
   user = mailService.validateRegisterUser(code);
   if (user != null) {
     super.saveUser(user);
     return SUCCESS;
   } else {
     return INPUT;
   }
 }
Ejemplo n.º 22
0
 // main :userHome
 @Action(
     value = MAIN,
     results = {@Result(name = SUCCESS, location = BaseAction.FOREPART + MAIN + JSP)})
 public String home() {
   /** ************************ TT ****************************************** */
   List<User> focusUserList =
       userService.getFocusList(User.class, (User) getSessionMap().get("user"));
   if (focusUserList.size() > 9) {
     focusUserList = focusUserList.subList(0, 9);
   }
   getRequestMap().put("focusUserList", focusUserList);
   List<Club> focusClubList =
       userService.getFocusList(Club.class, (User) getSessionMap().get("user"));
   if (focusClubList.size() > 9) {
     focusClubList = focusClubList.subList(0, 9);
   }
   getRequestMap().put("focusClubList", focusClubList);
   List<Merchant> focusMerchantList =
       userService.getFocusList(Merchant.class, (User) getSessionMap().get("user"));
   if (focusMerchantList.size() > 9) {
     focusMerchantList = focusMerchantList.subList(0, 9);
   }
   getRequestMap().put("focusMerchantList", focusMerchantList);
   super.getRequestMap().put("allUsers", userService.allUsers());
   if (null == user || null == user.getId()) {
     user = (User) getSessionMap().get("user");
     user = userService.findById(user.getId());
   } else {
     user = userService.findById(user.getId());
   }
   /** ************************ 指定用户相册 ****************************************** */
   page = pictureService.getMyPageByHql(user, 1, currentPage, 1);
   pics = pictureService.findMyPictureByHql(page, user);
   /** ************************* 指定用户线上活动 **************************************** */
   page = onlineActivityService.getOneOnlineActivityPageByHql(4, currentPage, 1, null, null, user);
   onlineActs = onlineActivityService.findOneClubOnlineActivityByHql(page, null, null, user);
   /** ************************ 指定用户说说说说 ****************************************** */
   page = talkingService.getMyPageByHql(user, 10, currentPage, 1);
   taks = talkingService.findMyTalkingByHql(page, user);
   return SUCCESS;
 }
Ejemplo n.º 23
0
  public String queryBBSMessageDetail() {
    super.commonQuery();
    String id = request.getParameter("id");
    try {
      bbsMessageQuery = bbsMessageService.findBBSMessageQuery(Long.parseLong(id));
      BBSMessage bbs = new BBSMessage();
      bbs.setId(bbsMessageQuery.getId());
      bbs.setContent(bbsMessageQuery.getContent());
      bbs.setCreateTime(bbsMessageQuery.getCreateTime());
      bbs.setScannum(bbsMessageQuery.getScannum() + 1);
      bbs.setTitle(bbsMessageQuery.getTitle());
      bbs.setUserid(bbsMessageQuery.getUserid());

      bbsMessageService.saveEntity(bbs);
      commentslist = bbsMessageService.queryCommentsByMsgId(Long.parseLong(id));
    } catch (NumberFormatException e) {
      e.printStackTrace();
    } catch (Exception e) {
      e.printStackTrace();
    }
    return "bbs_detail";
  }
Ejemplo n.º 24
0
 @Override
 public void actionPerformed(AnActionEvent anActionEvent) {
   super.actionPerformed(anActionEvent);
   //			Resource res = new Resource();
   String ss[] = ViewCodeUtil.getCode(path);
   try {
     //			String strs = Utils.fromInputStreamToString(new FileInputStream(res
     //					.getDosCmd()));
     System.out.println("-----" + ss[0]);
     System.out.println("-----" + ss[1]);
     //			strs.replace("genStatementdata", ss[0]);
     //			strs.replace("genfindviewByIddata", ss[1]);
     //			System.out.println("-----"+strs);
     //			File file = new File(res.getDosCmd());
     //			file.setWritable(true);
     //			FileOutputStream fo = new FileOutputStream(file);
     //			fo.write(strs.getBytes("utf-8"));
     //			fo.flush();
     //			fo.close();
     //			System.out.println("6@@@@@@@@@@@"+"cmd /k  start " + res.getDosCmd());
     //			Runtime.getRuntime().exec(
     //					"cmd /k  start echo" + ss[0]+ss[1]);
     FindViewByIdEditDialog dialog = new FindViewByIdEditDialog(ss[0] + "" + "\n" + ss[1]);
     dialog.setVisible(true);
   } catch (Exception e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   // try {
   // Process process =
   // Runtime.getRuntime().exec("cmd /k start echo
   // ==========statement==========echo"+ss[0]+"echo======findviewByid========echo"+ss[1]);
   // } catch (IOException e) {
   // // TODO Auto-generated catch block
   // e.printStackTrace();
   // }
 }
Ejemplo n.º 25
0
  /** @param args */
  public static void main(String[] args) {
    String user = "******";
    String view = "build";
    String toolset = "csg_rev18";
    MasterMgrClient client = new MasterMgrClient();
    Wrapper w = null;
    String project = "lr";

    try {
      w = new Wrapper(user, view, toolset, client);
      PluginMgrClient.init();
    } catch (PipelineException e1) {
      e1.printStackTrace();
    }

    String baseModel = "/projects/lr/assets/prop/asylianHelmet/asylianHelmet";
    String finalizeMel = "/projects/lr/assets/tools/mel/finalize-character";

    int pass = 3;

    LinkedList<String> toAdd = new LinkedList<String>();
    for (int i = 2; i <= 10; i++) {
      toAdd.add("asylianHelmet" + i);
    }
    if (pass == 1) {
      try {
        SonyAsset baseAsset = SonyConstants.stringToAsset(w, baseModel);
        Globals.getNewest(
            w, baseAsset.finalScene, CheckOutMode.OverwriteAll, CheckOutMethod.AllFrozen);
        Globals.getNewest(
            w, baseAsset.lr_finalScene, CheckOutMode.OverwriteAll, CheckOutMethod.AllFrozen);

        AssetType baseType = baseAsset.assetType;

        for (String name : toAdd) {
          TreeSet<String> addedNodes = new TreeSet<String>();
          try {
            SonyAsset as = new SonyAsset(project, name, baseType);

            log(as.texGroup + " : ");
            if (!Globals.doesNodeExists(w, as.texGroup)) {
              logLine("Building");
              NodeMod mod = Globals.registerNode(w, as.texGroup, null, Plugins.editorKWrite(w));
              addedNodes.add(as.texGroup);
              BaseAction act = Plugins.actionListSources(w);
              mod.setAction(act);
              doReqs(mod);
              client.modifyProperties(user, view, mod);
            } else logLine("Already Exists");

            log(as.matScene + " : ");
            if (!Globals.doesNodeExists(w, as.matScene)) {
              logLine("Building");
              NodeMod mod = Globals.registerNode(w, as.matScene, "ma", Plugins.editorMaya(w));
              addedNodes.add(as.matScene);
              BaseAction act = Plugins.actionMayaReference(w);
              Globals.referenceNode(w, as.matScene, baseAsset.rigScene, act, REF, "rig");
              client.link(user, view, as.matScene, as.texGroup, REF, LINKALL, null);
              mod.setAction(act);
              doReqs(mod);
              client.modifyProperties(user, view, mod);
            } else logLine("Already Exists");

            log(as.finalScene + " : ");
            if (!Globals.doesNodeExists(w, as.finalScene)) {
              logLine("Building");
              NodeMod mod = Globals.registerNode(w, as.finalScene, "ma", Plugins.editorMaya(w));
              addedNodes.add(as.finalScene);
              BaseAction act = Plugins.actionMayaImport(w);
              Globals.referenceNode(w, as.finalScene, as.matScene, act, DEP, "mat");
              client.link(user, view, as.finalScene, finalizeMel, DEP, LINKALL, null);
              act.setSingleParamValue("ModelMEL", finalizeMel);
              mod.setAction(act);
              doReqs(mod);
              client.modifyProperties(user, view, mod);
            } else logLine("Already Exists");

            log(as.lr_matScene + " : ");
            if (!Globals.doesNodeExists(w, as.lr_matScene)) {
              logLine("Building");
              NodeMod mod = Globals.registerNode(w, as.lr_matScene, "ma", Plugins.editorMaya(w));
              addedNodes.add(as.lr_matScene);
              BaseAction act = Plugins.actionMayaReference(w);
              Globals.referenceNode(w, as.lr_matScene, baseAsset.lr_rigScene, act, REF, "rig");
              mod.setAction(act);
              doReqs(mod);
              client.modifyProperties(user, view, mod);
            } else logLine("Already Exists");

            log(as.lr_finalScene + " : ");
            if (!Globals.doesNodeExists(w, as.lr_finalScene)) {
              logLine("Building");
              NodeMod mod = Globals.registerNode(w, as.lr_finalScene, "ma", Plugins.editorMaya(w));
              addedNodes.add(as.lr_finalScene);
              BaseAction act = Plugins.actionMayaImport(w);
              Globals.referenceNode(w, as.lr_finalScene, as.lr_matScene, act, DEP, "mat");
              client.link(user, view, as.lr_finalScene, finalizeMel, DEP, LINKALL, null);
              act.setSingleParamValue("ModelMEL", finalizeMel);
              mod.setAction(act);
              doReqs(mod);
              client.modifyProperties(user, view, mod);
            } else logLine("Already Exists");

            try {
              client.submitJobs(user, view, as.finalScene, null);
              client.submitJobs(user, view, as.lr_finalScene, null);
            } catch (PipelineException ex) {
              ex.printStackTrace();
            }

          } catch (PipelineException ex) {
            try {
              Globals.releaseNodes(w, addedNodes);
            } catch (PipelineException e) {
              e.printStackTrace();
            }
            ex.printStackTrace();
            return;
          }
        }

      } catch (PipelineException e) {
        e.printStackTrace();
      }
    } else if (pass == 2) {
      for (String name : toAdd) {
        try {
          logLine(name);
          SonyAsset baseAsset = SonyConstants.stringToAsset(w, baseModel);
          AssetType baseType = baseAsset.assetType;
          SonyAsset as = new SonyAsset(project, name, baseType);
          Globals.disableAction(w, as.matScene);
          Globals.disableAction(w, as.lr_matScene);
        } catch (PipelineException e) {
          e.printStackTrace();
        }
      }

    } else if (pass == 3) {
      for (String name : toAdd) {
        try {
          logLine(name);
          SonyAsset baseAsset = SonyConstants.stringToAsset(w, baseModel);
          AssetType baseType = baseAsset.assetType;
          SonyAsset as = new SonyAsset(project, name, baseType);
          NodeID nodeID = new NodeID(user, view, as.finalScene);

          client.checkIn(
              nodeID,
              "Inital model tree built by the BuildDerivedModels tool.  Built off the "
                  + baseModel
                  + " model",
              VersionID.Level.Minor);

          nodeID = new NodeID(user, view, as.lr_finalScene);
          client.checkIn(
              nodeID,
              "Inital model tree built by the BuildDerivedModels tool.  Built off the "
                  + baseModel
                  + " model",
              VersionID.Level.Minor);
        } catch (PipelineException e) {
          e.printStackTrace();
        }
      }
    }
  }
Ejemplo n.º 26
0
  private boolean dylanate(
      MasterMgrClient mclient,
      String switchName,
      DoubleMap<String, String, TreeSet<VersionID>> plugs)
      throws PipelineException {
    err.println("\nProcessing: " + switchName);
    String animName = null;

    {
      NodeMod switchMod = null;
      try {
        switchMod = mclient.getWorkingVersion(pUser, pView, switchName);
      } catch (PipelineException e) {
        mclient.checkOut(pUser, pView, switchName, null, keep, pFroz);
        switchMod = mclient.getWorkingVersion(pUser, pView, switchName);
      }

      TreeSet<String> switchSrcs = new TreeSet<String>(switchMod.getSourceNames());

      for (String src : switchSrcs) {
        if (src.matches(animPattern)) {
          animName = src;
          err.println("Found anim node: " + src);
          mclient.checkOut(pUser, pView, src, null, over, frozU);
          continue;
        } // end if

        mclient.checkOut(pUser, pView, src, null, over, frozU);

        LinkMod lMod = switchMod.getSource(src);
        LinkPolicy rel = lMod.getPolicy();
        System.err.println(src + ": " + rel);
        if (!rel.equals(REF)) {
          System.err.println("umm");
          lMod.setPolicy(REF);
          switchMod.setSource(lMod);
          mclient.modifyProperties(pUser, pView, switchMod);
        }
      } // end for

      err.println("anim node: " + animName);

      mclient.modifyProperties(pUser, pView, switchMod);

      if (animName == null)
        throw new PipelineException("This switch node does not have an associated anim node");
    }
    err.println("Checked out the anim and switch nodes");

    String actionName = null;
    VersionID ttVer = null;
    boolean toCache = false;

    /*change the action setting on the Switch node*/
    {
      NodeMod switchMod = mclient.getWorkingVersion(pUser, pView, switchName);

      Path p = new Path(switchName);
      Path syfRoot = new Path(p.getParentPath().getParentPath(), "syf");
      System.err.println("Going to look for caches in: " + syfRoot);
      ArrayList<String> syfDirs = getChildrenDirs(mclient, syfRoot.toString());

      for (String dir : syfDirs) {
        System.err.println(dir);
        Path dPath = new Path(syfRoot, dir);
        ArrayList<String> simDir = getChildrenNodes(mclient, dPath.toString());
        for (String pCache : simDir) {
          Path cPath = new Path(dPath, pCache);
          if (cPath.toString().matches(cltPattern)) {
            System.err.println("\t" + cPath.toString());
            try {
              mclient.checkOut(pUser, pView, cPath.toString(), null, over, froz);
              mclient.lock(pUser, pView, cPath.toString(), null);
              mclient.link(pUser, pView, switchMod.getName(), cPath.toString(), DEP, LINKALL, null);
            } catch (PipelineException e) {
              e.printStackTrace();
            }
            toCache = true;
          }
        }
      }

      {
        BaseAction action = switchMod.getAction();
        if (!switchMod.getToolset().equals(pToolset)) {
          switchMod.setToolset(pToolset);
          mclient.modifyProperties(pUser, pView, switchMod);
        }

        if (!toCache) {
          actionName = modRep;
        } else {
          actionName = modRep + "Syflex";
        }
        ttVer = plugs.get("SCEA", actionName).last();

        if ((action == null)
            || (!action.getName().equals(actionName))
            || (!action.getVersionID().equals(ttVer))) {
          System.err.println(
              "Action name is incorrect - the switch node "
                  + switchName
                  + " doesn't have a "
                  + actionName
                  + "Action");

          action = plug.newAction(actionName, ttVer, "SCEA");
          action.setSingleParamValue("Source", animName);
          action.setSingleParamValue("Response", "Ignore");
          if (toCache) action.setSingleParamValue(aApplyCache, true);
          switchMod.setAction(action);
          mclient.modifyProperties(pUser, pView, switchMod);
        } else {
          if (!action.getSingleParamValue("Response").equals("Ignore")) {
            //						action = plug.newAction(actionName, ttVer, "SCEA");
            //						action.setSingleParamValue("Source", animName);
            action.setSingleParamValue("Response", "Ignore");
            //						if(toCache)
            //						action.setSingleParamValue(aApplyCache, true);
            switchMod.setAction(action);
            mclient.modifyProperties(pUser, pView, switchMod);
          } // end if
        } // end else
      }
    }

    {
      /*-check out and lock the animation sources-*/
      NodeMod animMod = mclient.getWorkingVersion(pUser, pView, animName);
      Set<String> animSrcs = animMod.getSourceNames();
      for (String src : animSrcs) {
        if (src.matches(loresPattern)) {
          pLoresSrcs.add(src);
          err.println("Adding lores src " + src);
        }
        mclient.checkOut(pUser, pView, src, null, keep, pFroz);
      } // end for
      err.println("lores:" + pLoresSrcs);
    }

    /*-sync the animation assets with the switch assets.*/
    // also remove unnecessary hires models
    {
      NodeMod switchMod = mclient.getWorkingVersion(pUser, pView, switchName);
      for (String src : switchMod.getSourceNames()) {
        if (src.matches(hiresPattern)) {
          err.println("Found hires source " + src);
          if (pLoresSrcs.contains(src + "_lr")) {
            pHiresSrcs.add(src);
            err.println("The hires source matched the anim node.");
          } else {
            err.println("Gotta remove " + src);
          } // end else
        } // end if
      } // end for
    }

    // add necessary hires models
    for (String lores : pLoresSrcs) {
      String hr = lores.replace("_lr", "");
      err.println("Looking at lores source " + lores + " which matches " + hr);
      if (!pHiresSrcs.contains(hr)) {
        err.println("Gotta add " + hr + " to " + switchName);
        pHiresSrcs.add(hr);
      }
    }

    {
      NodeMod switchMod = mclient.getWorkingVersion(pUser, pView, switchName);
      TreeSet<String> switchSrcs = new TreeSet<String>(switchMod.getSourceNames());
      err.println("Final hiRes list:" + pHiresSrcs + "\n");
      err.println("switch now has:\n\t" + switchSrcs + "\n");
      err.println("Looking for things to add.");
      for (String src : pHiresSrcs) {
        if ((src.matches(hiresPattern) && (!switchSrcs.contains(src)))) {
          err.print("Linking ");
          mclient.checkOut(pUser, pView, src, null, over, frozU);
          mclient.link(pUser, pView, pPrimary, src, REF, LINKALL, null);
          switchSrcs.add(src);
        }
        err.println("src from hiRes list: " + src);
      }
    }

    {
      NodeMod switchMod = mclient.getWorkingVersion(pUser, pView, switchName);
      TreeSet<String> switchSrcs = new TreeSet<String>(switchMod.getSourceNames());
      err.println("switch now has:\n\t" + switchSrcs + "\n");
      for (String src : switchSrcs) {
        if ((src.matches(hiresPattern) && (!pHiresSrcs.contains(src)))) {
          err.print("Unlinking ");
          mclient.unlink(pUser, pView, pPrimary, src);
        }
        err.println("src from switch node list: " + src);
      }
    }

    /*queue the switch node*/
    mclient.submitJobs(pUser, pView, switchName, null);

    return false;
  }
Ejemplo n.º 27
0
  @Override
  public void run(String[] args) {
    try {
      TreeMap<String, LinkedList<String>> parsedArgs = argParser(args);
      if (!checkArgsAndSetParams(parsedArgs)) {
        return;
      }
    } catch (PipelineException ex) {
      System.err.println("There was a problem reading the arguments.\n" + ex.getMessage());
      printHelp();
      return;
    }

    for (String turntableName : turntables) {
      logLine("Doing turntable: " + turntableName);
      for (String passName : passes) {
        logLine("\tDoing pass: "******"\t\tDoing asset: " + as.assetName);
            LairTurntable tt = new LairTurntable(as, turntableName, passName);
            w = new Wrapper(user, view, toolset, client);

            logLine("\t\tFreezing all the textures");
            getLatest(w, as.texGroup, over, froz);

            logLine("\t\tChecking out the final model scene");
            getNewest(w, as.finalScene, keep, pFroz);
            getNewest(w, as.lr_finalScene, keep, pFroz);

            logLine("\t\tChecking out the shader scene.");
            getNewest(w, as.shdScene, keep, pFroz);

            logLine("\t\tChecking out the turntable scene.");
            getNewest(w, tt.turntableScene, keep, pFroz);

            logLine("\t\tChecking out the overRide scene.");
            getNewest(w, tt.ttCamOverMI, keep, pFroz);

            logLine("\t\tChecking out the options scene.");
            getNewest(w, tt.ttOptionsMI, keep, pFroz);

            logLine("\t\tChecking out the camera MI node.");
            getNewest(w, tt.ttCamMI, keep, pFroz);

            logLine("\t\tChecking out the light MI node.");
            getNewest(w, tt.ttLightMI, keep, pFroz);

            logLine("\t\tChecking out the shade MI node.");
            getNewest(w, tt.ttShadeMI, keep, pFroz);

            logLine("\t\tChecking out the geo MI node.");
            getNewest(w, tt.ttGeoMI, keep, pFroz);

            logLine("\t\tChecking out the images node.");
            getNewest(w, tt.ttImages, keep, pFroz);

            logLine("\t\tFixing the turntable node");
            {
              NodeMod mod = client.getWorkingVersion(user, view, tt.turntableScene);
              if (toolset != null) mod.setToolset(toolset);
              client.modifyProperties(user, view, mod);
            }

            logLine("\t\tFixing the camera override node");
            {
              NodeMod mod = client.getWorkingVersion(user, view, tt.ttCamOverMI);
              if (toolset != null) mod.setToolset(toolset);
              BaseAction act = mod.getAction();
              act.setSingleParamValue("ImageWidth", 1280);
              act.setSingleParamValue("ImageHeight", 720);
              act.setSingleParamValue("AspectRatio", 1.777);
              act.setSingleParamValue("Aperture", 1.41732);
              act.setSingleParamValue("OverrideFocal", false);
              act.setSingleParamValue("OverrideClipping", false);
              mod.setAction(act);
              client.modifyProperties(user, view, mod);
            }

            logLine("\t\tFixing the camera node");
            {
              NodeMod mod = client.getWorkingVersion(user, view, tt.ttCamMI);
              if (toolset != null) mod.setToolset(toolset);
              client.modifyProperties(user, view, mod);
            }

            logLine("\t\tFixing the light node");
            {
              NodeMod mod = client.getWorkingVersion(user, view, tt.ttLightMI);
              if (toolset != null) mod.setToolset(toolset);
              client.modifyProperties(user, view, mod);
            }

            logLine("\t\tFixing the geo node");
            {
              NodeMod mod = client.getWorkingVersion(user, view, tt.ttGeoMI);
              if (toolset != null) mod.setToolset(toolset);
              BaseAction act = mod.getAction();
              act.setSingleParamValue("CustomText", true);
              mod.setAction(act);
              client.modifyProperties(user, view, mod);
            }

            logLine("\t\tFixing the shader node");
            {
              NodeMod mod = client.getWorkingVersion(user, view, tt.ttShadeMI);
              if (toolset != null) mod.setToolset(toolset);
              BaseAction act = mod.getAction();
              BaseAction act2 = LairConstants.actionMayaMiShader();
              act2.setSingleParamValues(act);
              mod.setAction(act2);
              JobReqs req = mod.getJobRequirements();
              req.addSelectionKey("MentalRay");
              mod.setJobRequirements(req);
              mod.setExecutionMethod(ExecutionMethod.Parallel);
              mod.setBatchSize(100);
              client.modifyProperties(user, view, mod);
            }

            logLine("\t\tFixing the images node");
            {
              NodeMod mod = client.getWorkingVersion(user, view, tt.ttImages);
              if (toolset != null) mod.setToolset(toolset);
              BaseAction act = mod.getAction();
              act.setSingleParamValue("TexturePath", "$WORKING");
              mod.setAction(act);
              JobReqs req = mod.getJobRequirements();
              req.addSelectionKey("MentalRay");
              mod.setJobRequirements(req);
              mod.setExecutionMethod(ExecutionMethod.Parallel);
              mod.setBatchSize(5);
              client.modifyProperties(user, view, mod);
            }

            logLine(
                "All Done.  Remember to set your export set on the mod node "
                    + "if you want to export a custom part of the body");
          } catch (PipelineException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          }
        }
      }
    }
  }
Ejemplo n.º 28
0
  /**
   * Updates the asset references for a shot within Maya and then in pipeline.
   *
   * @param shotName The name of the shot being processed.
   * @param pRemoveRef The list of assets being dereferenced from the shot.
   * @param pReplaceRef The list of assets being referenced into the shot.
   * @param nameMap
   */
  private void editShotReferences(
      String shotName,
      NodeMod targetMod,
      TreeSet<String> pRemoveRef,
      TreeSet<String> pReplaceRef,
      TreeMap<String, String> nameMap)
      throws PipelineException {
    logLine("Editing shot: " + shotName);
    boolean anim = !shotName.matches(lgtPattern);

    /* writing the mel script */
    if (anim) {
      File script = null;
      try {
        script = File.createTempFile("UpdateAssetGUI.", ".mel", PackageInfo.sTempPath.toFile());
        FileCleaner.add(script);
      } // end try
      catch (IOException ex) {
        throw new PipelineException(
            "Unable to create the temporary MEL script used to collect "
                + "texture information from the Maya scene!");
      } // end catch

      try {
        PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(script)));

        for (String asset : pReplaceRef) {
          String nameSpace;
          if (asset.endsWith(lr))
            nameSpace = nameMap.get(getShortName(asset.substring(0, asset.length() - 3)));
          else {
            System.err.println("This should not be happening, a hi res asset in a lo-res node.");
            continue;
            // nameSpace = nameMap.get(getShortName(asset));
          }
          out.println("print (\"referencing file: $WORKING" + asset + ".ma\");");
          out.println(
              "file -reference -namespace \"" + nameSpace + "\" \"$WORKING" + asset + ".ma\";");
        } // end for

        for (String asset : pRemoveRef) {
          out.println("print (\"dereferencing file: $WORKING" + asset + ".ma\");");
          out.println("file -rr \"$WORKING" + asset + ".ma\";");
        } // end for

        out.println("// SAVE");
        out.println("file -save;");

        out.close();
      } // end try
      catch (IOException ex) {
        throw new PipelineException(
            "Unable to write the temporary MEL script(" + script + ") used add the references!");
      } // end catch

      NodeID targetID = new NodeID(w.user, w.view, shotName);
      // NodeStatus targetStat = mclient.status(targetID);

      /* run Maya to collect the information */
      try {

        Path targetPath = getNodePath(shotName);
        ArrayList<String> args = new ArrayList<String>();
        args.add("-batch");
        args.add("-script");
        args.add(script.getPath());
        args.add("-file");
        args.add(targetPath.toOsString());

        Path wdir = new Path(PackageInfo.sProdPath.toOsString() + targetID.getWorkingParent());

        TreeMap<String, String> env =
            mclient.getToolsetEnvironment(
                w.user, w.view, targetMod.getToolset(), PackageInfo.sOsType);

        Map<String, String> nenv = env;
        String midefs = env.get("PIPELINE_MI_SHADER_PATH");
        if (midefs != null) {
          nenv = new TreeMap<String, String>(env);
          Path dpath = new Path(new Path(wdir, midefs));
          nenv.put("MI_CUSTOM_SHADER_PATH", dpath.toOsString());
        }

        String command = "maya";
        if (PackageInfo.sOsType.equals(OsType.Windows)) command += ".exe";

        SubProcessLight proc =
            new SubProcessLight("UpdateAssetGUI", command, args, env, wdir.toFile());
        try {
          proc.start();
          proc.join();
          if (!proc.wasSuccessful()) {
            throw new PipelineException(
                "Did not correctly edit the reference due to a maya error.!\n\n"
                    + proc.getStdOut()
                    + "\n\n"
                    + proc.getStdErr());
          } // end if
        } // end try
        catch (InterruptedException ex) {
          throw new PipelineException(ex);
        } // end catch
      } // end try
      catch (Exception ex) {
        throw new PipelineException(ex);
      } // end catch
    }

    /*-edit the references in pipeline once they are done in the file-*/
    BaseAction targetAction = targetMod.getAction();
    for (String asset : pReplaceRef) {
      mclient.link(
          w.user, w.view, shotName, asset, LinkPolicy.Reference, LinkRelationship.All, null);
      if (anim) {
        /*Set the namespaces*/
        String nameSpace = nameMap.get(getShortName(asset.substring(0, asset.length() - 3)));
        System.err.println(nameSpace);
        targetAction.initSourceParams(asset);
        targetAction.setSourceParamValue(asset, "PrefixName", nameSpace);
        targetMod.setAction(targetAction);
      }
    }
    w.mclient.modifyProperties(w.user, w.view, targetMod);

    for (String asset : pRemoveRef) mclient.unlink(w.user, w.view, shotName, asset);

    if (!anim) {
      System.err.println("Queuing the switchLgt node " + shotName);
      mclient.submitJobs(w.user, w.view, shotName, null);
    }
  } // end editShotReferences
Ejemplo n.º 29
0
  /**
   * 先根据用户输入的用户名获取用户信息,然后再决定是否允许用户登录
   *
   * @return
   */
  @Override
  @Action(
      value = "login",
      results = {
        @Result(name = SUCCESS, location = "/smsmain.jsp"),
        @Result(name = ERROR, location = "/smslogin.jsp")
      })
  public String execute() {
    UserVO users = userService.getUserByAccount(this.account);

    /*
     * if (!StringUtils.endsWithIgnoreCase(this.getVerifyCode(), (String)
     * ActionContext.getContext().getSession().get("verifyCode"))) {
     * this.getRequest().setAttribute("message", "验证码错误!"); return ERROR; }
     */
    // 登录次数限制及验证
    if (users == null) {
      this.getRequest().setAttribute("message", "用户名或密码错误!");
      return ERROR;
    } else if (!MasPasswordTool.getDesString(users.getPassword(), users.getAccount())
        .equals(this.getLoginPwd())) {
      String message = "用户名或密码错误!";
      if (LoginCheckUtil.isAccountlock(getSession(), users)) {
        UserVO uvo = users;
        uvo.setLockFlag(1);
        uvo.setActiveFlag(0);
        uvo.setPassword(MasPasswordTool.getDesString(users.getPassword(), users.getAccount()));
        userService.updateUser(uvo);
        message = "用户已被锁定,请联系管理员!";
      }
      this.getRequest().setAttribute("message", message);
      return ERROR;
    } else if (users.getLockFlag() == 1) {
      this.getRequest().setAttribute("message", "用户已被锁定,请联系管理员!");
      return ERROR;
    }
    // 当此用户的鉴权方式为用户名或密码时,将不在验证手机号、/
    if (users.getLoginType() != 1)
      // 手机验证码
      if (!StringUtils.endsWithIgnoreCase(
          getMobileChecking(),
          (String)
              ActionContext.getContext()
                  .getSession()
                  .get(ApSmsConstants.SESSION_SMS_CHECKING_NUMBER))) {
        this.getRequest().setAttribute("message", "手机验证码错误!");
        return ERROR;
      } else {
        // 清空手机验证码
        ActionContext.getContext().getSession().remove(ApSmsConstants.SESSION_SMS_CHECKING_NUMBER);
      }
    // 获取用户菜单
    super.getSession().setAttribute(ApSmsConstants.SESSION_USER_INFO, users);
    Set<RoleVO> roleVOs = users.getRoles();
    Set<Resources> tempResources = null;
    for (RoleVO roleVO : roleVOs) {
      Set<Resources> parentResources = roleVO.getResources();
      if (tempResources == null) {
        tempResources = parentResources;
      } else {
        tempResources.addAll(parentResources);
        for (Resources resource : tempResources) {
          for (Resources undoResource : parentResources) {
            if (resource.getId() == undoResource.getId()) {
              resource.getSubResources().addAll(undoResource.getSubResources());
            }
          }
        }
      }
    }
    if (tempResources == null || tempResources.isEmpty()) {
      this.getRequest().setAttribute("message", "对不起,用户未被赋予访问系统权限!");
      return ERROR;
    }

    List<Resources> resList = new ArrayList<Resources>();
    ResourcesComparator comparator = new ResourcesComparator();
    // 排序二级菜单
    List<Resources> tempList = new ArrayList<Resources>(tempResources);
    for (Resources res : tempList) {
      // 只保留一级菜单 非管理功能菜单
      if (res.getParentId() > 0 || res.getIsManagementFun() == 1) {
        continue;
      }
      if (res.getSubResources() != null) {
        List<Resources> subList = new ArrayList<Resources>(res.getSubResources());
        Collections.sort(subList, comparator);
        res.setSortedSubRes(subList);
        resList.add(res);
      }
    }
    // 排序主菜单
    Collections.sort(resList, comparator);
    ActionContext.getContext().getSession().put("resources", resList);
    return "success";
  }