Example #1
0
  public void executeLoginProc(
      HttpServletRequest request, HttpServletResponse response, String loginName) throws Exception {
    IProcedureManager procedureManager =
        (IProcedureManager) objectRegistry.getInstanceOfType(IProcedureManager.class);
    IServiceFactory serviceFactory =
        (IServiceFactory) objectRegistry.getInstanceOfType(IServiceFactory.class);
    Procedure proc = procedureManager.loadProcedure(autoLoginProc);
    CompositeMap auroraContext = new CompositeMap("sso_conext");
    auroraContext.createChild("parameter").put("user_name", loginName);

    HttpServiceInstance svc =
        createHttpService(autoLoginProc, request, response, procedureManager, auroraContext);

    ServiceThreadLocal.setCurrentThreadContext(auroraContext);
    ServiceInvoker.invokeProcedureWithTransaction(
        autoLoginProc, proc, serviceFactory, svc, auroraContext);

    ServiceThreadLocal.setCurrentThreadContext(auroraContext);
    HttpRequestTransfer.copyRequest(svc);
    HttpSessionCopy.copySession(auroraContext, request.getSession(false));
  }
Example #2
0
  private void init(BuildSession session, ViewContext view_context) throws Exception {
    CompositeMap context = ServiceThreadLocal.getCurrentThreadContext();
    if (context == null)
      throw new IllegalStateException("No service context set in ThreadLocal yet");
    CompositeMap view = view_context.getView();
    CompositeMap base_model = view_context.getModel();
    HTMLIncludeConfig hic = HTMLIncludeConfig.getInstance(view);
    String path = TextParser.parse(hic.getPath(), base_model);
    version = TextParser.parse(hic.getVersion(), base_model);
    if (null != path && !path.isEmpty()) {
      int begin = path.indexOf("/release");
      if (begin < 0) return;
      path = path.substring(begin, path.length());
      articlePath = "../.." + path;
      sourcePath =
          session.getContextPath() + path.replaceAll("\\\\", "/").replaceAll("(.*/)[^/]*$", "$1");
      return;
    }
    String pathField = hic.getPathField();
    String model = hic.getModel();
    CompositeMap params = hic.getParams();
    Map map = new HashMap();
    if (null != params) {
      Iterator pit = params.getChildIterator();
      while (pit.hasNext()) {
        CompositeMap param = (CompositeMap) pit.next();
        map.put(
            param.get("name"),
            TextParser.parse((String) param.get("value"), view_context.getModel()));
      }
    }
    BusinessModelService service = factory.getModelService(model, context);

    CompositeMap resultMap = service.queryAsMap(map);
    if (null == resultMap || null == resultMap.getChilds()) {
      throw new ClassNotFoundException("文章未找到,输入的路径不正确。");
    }
    Iterator it = resultMap.getChildIterator();
    while (it.hasNext()) {
      path = ((CompositeMap) it.next()).getString(pathField);
      if (null != path) {
        articlePath = "../.." + path;
        sourcePath =
            session.getContextPath() + path.replaceAll("\\\\", "/").replaceAll("(.*/)[^/]*$", "$1");
        break;
      }
    }
  }
 @Override
 public void onPrepareBusinessModel(BusinessModel model, CompositeMap context) throws Exception {
   boolean customization_enabled = model.getCustomizationenabled();
   if (customization_enabled) {
     /* This context may be "<model-service-context BusinessModel="aurora.bm.BusinessModel@e73b917"/>",
      * so need ServiceThreadLocal.getCurrentThreadContext();
      */
     CompositeMap fullContext = ServiceThreadLocal.getCurrentThreadContext();
     if (fullContext == null) return;
     LoggingContext.getLogger(fullContext, this.getClass().getCanonicalName())
         .log(Level.CONFIG, fullContext.getRoot().toXML());
     //			String function_id = TextParser.parse(FUNCTION_ID_PATH, fullContext);
     String function_code = TextParser.parse(FUNCTION_CODE_PATH, fullContext);
     // if not called by a Screen.
     if (function_code == null || "".equals(function_code)) {
       return;
     }
     CompositeMap custDetailRecords = getCustomizationData(model, function_code, fullContext);
     if (custDetailRecords != null) {
       LovBMCustomSourceCode.custom(model, custDetailRecords, objectRegistry);
     }
   }
 }