Examples of UseCase


Examples of ca.uhn.hl7v2.conf.spec.usecase.UseCase

     * @param useCase New value of property useCase.
     *
     * @throws ProfileException
     */
    public void setUseCase(UseCase useCase) throws ProfileException {
        UseCase oldUseCase = this.useCase;
        try {
            vetoableChangeSupport.fireVetoableChange("useCase", oldUseCase, useCase);
        } catch (Exception e) {
            throw new ProfileException(null, e);
        }
View Full Code Here

Examples of cn.edu.pku.dr.requirement.elicitation.data.UseCase

        // 加场景名
        document.add(new Paragraph("场景" + (i + 1) + ": "
            + s.getScenarioName().toString(),
            RtfParagraphStyle.STYLE_HEADING_1));
        // TODO 加用况
        UseCase uc = new UseCase();
        uc.setScenarioId(s.getScenarioId());
        ArrayList ucs = cdp.query(uc);
        if (ucs.size() > 0) {
          for (int j = 0; j < ucs.size(); j++) {

            uc = (UseCase) ucs.get(j);
            document.add(new Paragraph(""));
            document.add(new Paragraph("用况" + (i + 1) + "."
                + (j + 1) + ": "
                + uc.getUseCaseName().toString(),
                RtfParagraphStyle.STYLE_HEADING_2));

            RtfBorderGroup normal = new RtfBorderGroup(
                Rectangle.BOX, RtfBorder.BORDER_SINGLE, 1,
                new Color(0, 0, 0));

            Paragraph title = new Paragraph();
            title.add(new Chunk(uc.getUseCaseName().trim()));
            title.setAlignment(1);
            document.add(title);

            RtfCell useCaseID = new RtfCell("用况编号:");
            useCaseID.setBorders(normal);

            RtfCell useCaseIDC = new RtfCell(uc.getUseCaseId()
                .toString());
            useCaseIDC.setBorders(normal);

            RtfCell useCaseName = new RtfCell("用况名称:");
            useCaseName.setBorders(normal);

            RtfCell useCaseNameC = new RtfCell(uc.getUseCaseName());
            useCaseNameC.setBorders(normal);

            RtfCell useCaseDescription = new RtfCell("用况描述:");
            useCaseDescription.setBorders(normal);

            RtfCell useCaseDescriptionC = new RtfCell(uc
                .getUseCaseDescription());
            useCaseDescriptionC.setBorders(normal);

            RtfCell useCasePriority = new RtfCell("用况优先级:");
            useCasePriority.setBorders(normal);

            RtfCell useCasePriorityC = null;

            if (uc.getUseCasePriority() != null) {
              useCasePriorityC = new RtfCell(uc
                  .getUseCasePriority().toString());
            } else {
              useCasePriorityC = new RtfCell("");
            }

            useCasePriorityC.setBorders(normal);

            RtfCell specialRequirement = new RtfCell("特殊要求:");
            specialRequirement.setBorders(normal);

            RtfCell specialRequirementC = new RtfCell(uc
                .getUseCaseSpecialRequirement());
            specialRequirementC.setColspan(3);
            specialRequirementC.setBorders(normal);

            RtfCell preCondition = new RtfCell("前置条件:");
            preCondition.setBorders(normal);

            RtfCell preConditionC = new RtfCell(uc
                .getUseCasePreconditions());
            preConditionC.setColspan(3);
            preConditionC.setBorders(normal);

            RtfCell fireCondition = new RtfCell("触发条件:");
            fireCondition.setBorders(normal);

            RtfCell fireConditionC = new RtfCell(uc
                .getUseCaseTrigger());
            fireConditionC.setColspan(3);
            fireConditionC.setBorders(normal);

            RtfCell postCondition = new RtfCell("后置条件:");
            postCondition.setBorders(normal);

            RtfCell postConditionC = new RtfCell(uc
                .getUseCasePostConditions());
            postConditionC.setColspan(3);
            postConditionC.setBorders(normal);

            RtfCell failedEndCondition = new RtfCell("失败情况:");
            failedEndCondition.setBorders(normal);

            RtfCell failedEndConditionC = new RtfCell(uc
                .getUseCaseFailedEndCondition());
            failedEndConditionC.setColspan(3);
            failedEndConditionC.setBorders(normal);

            Table table = new Table(4);
            table.addCell(useCaseID);
            table.addCell(useCaseIDC);
            table.addCell(useCaseName);
            table.addCell(useCaseNameC);
            table.addCell(useCaseDescription);
            table.addCell(useCaseDescriptionC);
            table.addCell(useCasePriority);
            table.addCell(useCasePriorityC);
           
            table.addCell(fireCondition);
            table.addCell(fireConditionC);
            table.addCell(preCondition);
            table.addCell(preConditionC);
            table.addCell(failedEndCondition);
            table.addCell(failedEndConditionC);
            table.addCell(postCondition);
            table.addCell(postConditionC);         
            table.addCell(specialRequirement);
            table.addCell(specialRequirementC);

            // 生成Use Case具体描述的标题

            RtfCell userOperation = new RtfCell("用户操作");
            userOperation.setBorders(normal);

            RtfCell systemOperation = new RtfCell("系统操作");
            systemOperation.setBorders(normal);

            RtfCell systemOutput = new RtfCell("系统输出");
            systemOutput.setBorders(normal);

            Table table2 = new Table(3);
            table2.addCell(userOperation);
            table2.addCell(systemOperation);
            table2.addCell(systemOutput);

            // 生成Use Case具体描述的内容
            ArrayList ucis = new ArrayList();

            UseCaseInteraction uci = new UseCaseInteraction();
            uci.setUseCaseId(uc.getUseCaseId());
            OrderRule orderule = new OrderRule();
            orderule.setOrderColumn("sequence");
            orderule.setOrderDirection(OrderDirection.ASC);
            OrderRule[] orderRules = { orderule };
            String temp;
View Full Code Here

Examples of com.gentics.cr.monitoring.UseCase

   * @param response - servlet responce to write back to
   * @throws IOException in case the container cannot process the request
   * @see #doService(HttpServletRequest, HttpServletResponse)
   */
  public void doServiceSafe(HttpServletRequest request, HttpServletResponse response) throws IOException {
    UseCase uc = MonitorFactory.startUseCase("RESTServlet(" + request.getServletPath() + ")");
    log.debug("Request:" + request.getQueryString());
    long starttime = new Date().getTime();
    try {
      doService(request, response);
    } finally {
      response.getOutputStream().flush();
      response.getOutputStream().close();
     
      long endtime = new Date().getTime();
      if (log.isInfoEnabled()) {
        StringBuilder requestID = new StringBuilder();
        requestID.append(request.getRequestURI());
        if (request.getQueryString() != null) {
          requestID.append('?');
          requestID.append(request.getQueryString());
        }
        log.info("Executiontime for " + requestID + ":" + (endtime - starttime));
      }
      uc.stop();
    }
  }
View Full Code Here

Examples of com.gentics.cr.monitoring.UseCase

      this.container.finalize();
  }

  public void doService(HttpServletRequest request, HttpServletResponse response) throws ServletException,
      IOException {
    UseCase uc = MonitorFactory.startUseCase("RESTServlet(" + request.getServletPath() + ")");
    this.log.debug("Request:" + request.getQueryString());

    // starttime
    long s = new Date().getTime();
    HashMap<String, Resolvable> objects = new HashMap<String, Resolvable>();
    objects.put("request", new BeanWrapper(request));
    objects.put("session", new HttpSessionWrapper(request.getSession()));
    CRNavigationRequestBuilder requestBuilder = new CRNavigationRequestBuilder(request, crConf);
    container.processService(requestBuilder, objects, response.getOutputStream(), new ServletResponseTypeSetter(
        response));
    response.getOutputStream().flush();
    response.getOutputStream().close();
    // endtime
    long e = new Date().getTime();
    this.log.info("Executiontime for " + request.getQueryString() + ":" + (e - s));
    uc.stop();
  }
View Full Code Here

Examples of com.gentics.cr.monitoring.UseCase

   * @return resulting objects
   * @throws CRException TODO javadoc
   */
  public final Collection<CRResolvableBean> getObjects(final CRRequest request, final boolean doNavigation)
      throws CRException {
    UseCase getObjectCase = MonitorFactory.startUseCase("CRRequestProcessor.getObjects(" + config.getName() + ")");
    Datasource ds = null;
    DatasourceFilter dsFilter;
    Vector<CRResolvableBean> collection = new Vector<CRResolvableBean>();
    if (request != null) {
      // Parse the given expression and create a datasource filter
      try {
        ds = this.config.getDatasource();
        if (ds == null) {
          throw (new DatasourceException("No Datasource available."));
        }

        dsFilter = request.getPreparedFilter(config, ds);
        // add base resolvables
        if (this.resolvables != null) {
          for (Iterator<String> it = this.resolvables.keySet().iterator(); it.hasNext();) {
            String name = it.next();
            dsFilter.addBaseResolvable(name, this.resolvables.get(name));
          }
        }

        String[] prefillAttributes = request.getAttributeArray();
        int first = request.getStart().intValue();
        int last = request.getCount().intValue();
        Sorting[] sorting = request.getSorting();
        // do the query
        Collection<Resolvable> col = getResult(ds, dsFilter, prefillAttributes, first, last, sorting);

        // convert all objects to serializeable beans
        if (col != null) {
          for (Iterator<Resolvable> it = col.iterator(); it.hasNext();) {
            CRResolvableBean crBean = new CRResolvableBean(it.next(), request.getAttributeArray());
            if (this.config.getFolderType().equals(crBean.getObj_type()) && doNavigation) {
              // Process child elements
              String fltr = "object.folder_id=='" + crBean.getContentid() + "'";
              if (request.getChildFilter() != null) {
                fltr += "AND (" + request.getChildFilter() + ")";
              }
              // If object is a folder => retrieve the childs of the object
              CRRequest childReq = request.Clone();
              childReq.setRequestFilter(fltr);
              crBean.fillChildRepository(this.getNavigation(childReq));
            }
            collection.add(this.replacePlinks(crBean, request));
          }
        }

      } catch (ParserException e) {
        e.printStackTrace();
        throw new CRException("ParserException", e.getMessage());
      } catch (ExpressionParserException e) {
        e.printStackTrace();
        throw new CRException("ExpressionParserException", e.getMessage());
      } catch (DatasourceException e) {
        e.printStackTrace();
        throw new CRException("DatasourceException", e.getMessage());
      } finally {
        CRDatabaseFactory.releaseDatasource(ds);
        getObjectCase.stop();
      }
    }
    return collection;
  }
View Full Code Here

Examples of com.gentics.cr.monitoring.UseCase

   * @param sorting {@link Sorting} that should be used.
   * @return {@link Collection} of {@link Resolvable}s described by the filter.
   */
  private Collection<Resolvable> getResult(final Datasource ds, final DatasourceFilter dsFilter,
      final String[] prefillAttributes, final int first, final int last, final Sorting[] sorting) {
    UseCase getResultCase = MonitorFactory.startUseCase("CRRequestProcessor.getResult(" + config.getName() + ")");
    Collection<?> result;
    Collection<Resolvable> checkCacheResult;
    Collection<Resolvable> collection = null;
    Collection<Resolvable> cachedResult;
    String cacheKey = config.getName() + "-" + dsFilter.getExpressionString();

    try {
      UseCase getResultFastCase = MonitorFactory.startUseCase("CRRequestProcessor.getResult(" + config.getName()
          + ")#fastResult");
      checkCacheResult = toResolvableCollection(ds.getResult(dsFilter, new String[] {}, first, last, sorting));
      getResultFastCase.stop();

      UseCase getResultCacheCase = MonitorFactory.startUseCase("CRRequestProcessor.getResult(" + config.getName()
          + ")#cache");
      cachedResult = getCachedResult(cacheKey);
      getResultCacheCase.stop();

      boolean up2date = compare(cachedResult, checkCacheResult);

      if (up2date) {
        collection = cachedResult;
      } else {
        UseCase getResultUncachedCase = MonitorFactory.startUseCase("CRRequestProcessor.getResult("
            + config.getName() + ")#uncached");
        result = ds.getResult(dsFilter, prefillAttributes, first, last, sorting);
        collection = toResolvableCollection(result);
        saveResult(cacheKey, collection);
        getResultUncachedCase.stop();
      }
    } catch (DatasourceException e) {
      logger.error("Cannot get the result from the Datasource.", e);
    }
    getResultCase.stop();
View Full Code Here

Examples of com.gentics.cr.monitoring.UseCase

   * @param left first Resolvable
   * @param right second Resolvable
   * @return returns false if they are not equal
   */
  public static boolean compare(final Collection<Resolvable> left, final Collection<Resolvable> right) {
    UseCase getResultVerifyCase = MonitorFactory.startUseCase("CRRequestProcessor.compare()#verify");
    if (left.size() != right.size()) {
      return false;
    } else {
      int leftUpdatetime = 0;
      for (Resolvable leftResolvable : left) {
        leftUpdatetime = checkUpdatetime(leftResolvable, leftUpdatetime);
      }
      int rightUpdatetime = 0;
      for (Resolvable rightResolvable : right) {
        rightUpdatetime = checkUpdatetime(rightResolvable, rightUpdatetime);
      }
      getResultVerifyCase.stop();
      if (rightUpdatetime != leftUpdatetime) {
        return false;
      }
    }
    return true;
View Full Code Here

Examples of com.gentics.cr.monitoring.UseCase

   * Process the specified bean with monitoring.
   * @param bean
   * @throws CRException
   */
  public void processBeanWithMonitoring(CRResolvableBean bean) throws CRException {
    UseCase pcase = MonitorFactory.startUseCase("Transformer:" + this.getClass());
    try {
      processBean(bean);
    } finally {
      pcase.stop();
    }
  }
View Full Code Here

Examples of com.gentics.cr.monitoring.UseCase

   * Process the specified bean with monitoring.
   * @param bean
   * @throws CRException
   */
  public void processBeanWithMonitoring(CRResolvableBean bean, IndexWriter writer) throws CRException {
    UseCase pcase = MonitorFactory.startUseCase("Transformer:" + this.getClass());
    try {
      processBean(bean, writer);
    } finally {
      pcase.stop();
    }
  }
View Full Code Here

Examples of com.gentics.cr.monitoring.UseCase

        if (!interrupted) {
          // Only Optimize the Index if the thread
          // has not been interrupted
          if (optimize) {
            log.debug("Executing optimize command.");
            UseCase uc = MonitorFactory.startUseCase("optimize(" + crid + ")");
            try {
              indexWriter.optimize();
            } finally {
              uc.stop();
            }
          } else if (maxSegmentsString != null) {
            log.debug("Executing optimize command with max" + " segments: " + maxSegmentsString);
            int maxs = Integer.parseInt(maxSegmentsString);
            UseCase uc = MonitorFactory.startUseCase("optimize(" + crid + ")");
            try {
              indexWriter.optimize(maxs);
            } finally {
              uc.stop();
            }
          }
        } else {
          log.debug("Job has been interrupted and will now be closed." + " Missing objects " + "will be reindexed next run.");
        }
        finishedIndexJobSuccessfull = true;
      } catch (Exception ex) {
        log.error("Could not complete index run... indexed Objects: " + status.getObjectsDone()
            + ", trying to close index and remove lock.", ex);
        finishedIndexJobWithError = true;
        status.setError("Could not complete index run... indexed " + "Objects: " + status.getObjectsDone()
            + ", trying to close index and remove lock.");
      } finally {
        if (!finishedIndexJobSuccessfull && !finishedIndexJobWithError) {
          log.fatal("There seems to be a run time exception from this" + " index job.\nLast slice was: " + slice);
        }
        //Set status for job if it was not locked
        status.setCurrentStatusString("Finished job.");
        int objectCount = status.getObjectsDone();
        log.debug("Indexed " + objectCount + " objects...");

        if (taxonomyAccessor != null && taxonomyWriter != null) {
          taxonomyAccessor.release(taxonomyWriter);
        }

        if (indexAccessor != null && indexWriter != null) {
          indexAccessor.release(indexWriter);
        }
        if (indexAccessor != null && indexReader != null) {
          indexAccessor.release(indexReader, false);
        }

        if (objectCount > 0) {
          indexLocation.createReopenFile();
        }
        UseCase ucFireEvent = MonitorFactory.startUseCase("indexCR(" + crid + ") fire IndexingFinishedEvent");
        EventManager.getInstance().fireEvent(new IndexingFinishedEvent(indexLocation));
        ucFireEvent.stop();
      }
    } catch (LockedIndexException ex) {
      log.debug("LOCKED INDEX DETECTED. TRYING AGAIN IN NEXT JOB.");
      if (this.indexLocation != null && !this.indexLocation.hasLockDetection()) {
        log.error("IT SEEMS THAT THE INDEX HAS UNEXPECTEDLY BEEN " + "LOCKED. TRYING TO REMOVE THE LOCK", ex);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.