コード例 #1
0
  /**
   * Link OperationRecords and DataBeans by adding real input DataBean references to
   * OperationRecords.
   */
  private void linkInputsToOperations() {

    for (OperationRecord operationRecord : operationRecords.values()) {

      // get data bean ids from session data
      for (InputType inputType : operationTypes.get(operationRecord).getInput()) {

        String inputID = inputType.getData();
        if (inputID == null) {
          continue;
        }

        // find the data bean
        DataBean inputBean = dataBeans.get(inputID);
        if (inputBean == null) {
          continue;
        }

        // skip phenodata, it is bound automatically
        if (inputBean.queryFeatures("/phenodata/").exists()) {
          continue;
        }

        // add the reference to the operation record
        operationRecord.addInput(createNameID(inputType.getName()), inputBean);
      }
    }
  }
コード例 #2
0
ファイル: DataManager.java プロジェクト: Linhua-Sun/chipster
  private void deleteDataBean(DataBean bean) {

    // remove from operation history
    for (DataBean source : databeans()) {
      // we must iterate all datas because links cannot be trusted (they might have been removed by
      // user)
      OperationRecord operationRecord = source.getOperationRecord();
      if (operationRecord != null) {
        operationRecord.removeInput(bean);
      }
    }

    // remove links
    for (Link linkType : Link.values()) {
      // Remove outgoing links
      for (DataBean target : bean.getLinkTargets(linkType)) {
        bean.removeLink(linkType, target);
      }
      // Remove incoming links
      for (DataBean source : bean.getLinkSources(linkType)) {
        source.removeLink(linkType, bean);
      }
    }

    // remove bean
    DataFolder folder = bean.getParent();
    if (folder != null) {
      disconnectChild(bean, folder);
    }

    // remove physical file
    bean.delete();
  }
コード例 #3
0
 public static OperationRecord getUnkownOperationRecord() {
   OperationRecord record = new OperationRecord();
   record.setNameID(new NameID("unknown", "Unknown", "No tool information available."));
   record.setCategoryName("Unknown");
   record.setCategoryColor(ToolCategory.UNKNOWN_CATEGORY_COLOR);
   record.setSourceCode("Source code not available.");
   return record;
 }
コード例 #4
0
ファイル: Task.java プロジェクト: Linhua-Sun/chipster
 public List<String> getParameters() throws TaskException, MicroarrayException {
   List<String> parameterStrings;
   parameterStrings = new LinkedList<String>();
   for (ParameterRecord parameter : operationRecord.getParameters()) {
     parameterStrings.add(parameter.getValue());
   }
   return parameterStrings;
 }
コード例 #5
0
  /**
   * Add links form DataBeans to the OperationRecord which created the DataBean.
   *
   * <p>If OperationRecord is not found, use unknown OperationRecord.
   */
  private void linkOperationsToOutputs() {

    for (DataBean dataBean : dataBeans.values()) {
      String operationId = dataTypes.get(dataBean).getResultOf();
      OperationRecord operationRecord = null;
      if (operationId != null) {
        operationRecord = operationRecords.get(operationId);
      }

      // if operation record is not found use dummy
      if (operationRecord == null) {
        operationRecord = OperationRecord.getUnkownOperationRecord();
      }

      dataBean.setOperationRecord(operationRecord);
    }
  }
コード例 #6
0
ファイル: Task.java プロジェクト: Linhua-Sun/chipster
 public int getInputCount() {
   return operationRecord.getInputRecords().size();
 }
コード例 #7
0
ファイル: Task.java プロジェクト: Linhua-Sun/chipster
 public Iterable<DataBean> getInputDataBeans() {
   return operationRecord.getInputDataBeans();
 }
コード例 #8
0
ファイル: Task.java プロジェクト: Linhua-Sun/chipster
 public Collection<InputRecord> getInputRecords() {
   return operationRecord.getInputRecords();
 }
コード例 #9
0
ファイル: Task.java プロジェクト: Linhua-Sun/chipster
 public String getFullName() {
   return operationRecord.getCategoryName() + " / " + operationRecord.getNameID().getDisplayName();
 }
コード例 #10
0
ファイル: Task.java プロジェクト: Linhua-Sun/chipster
 public String getName() {
   return operationRecord.getNameID().getDisplayName();
 }
コード例 #11
0
ファイル: Task.java プロジェクト: Linhua-Sun/chipster
 public String getOperationID() {
   return operationRecord.getNameID().getID();
 }
コード例 #12
0
  private void createOperations() {
    for (OperationType operationType : sessionType.getOperation()) {
      String operationSessionId = operationType.getId();

      // check for unique id
      if (operationRecords.containsKey(operationSessionId)) {
        logger.warn("duplicate operation id: " + operationSessionId);
        continue;
      }

      OperationRecord operationRecord = new OperationRecord();

      // name id
      operationRecord.setNameID(createNameID(operationType.getName()));

      // category
      operationRecord.setCategoryName(operationType.getCategory());
      String colorString = operationType.getCategoryColor();
      if (colorString != null) {
        operationRecord.setCategoryColor(Color.decode(colorString));
      }

      // module
      operationRecord.setModule(operationType.getModule());

      // parameters
      for (ParameterType parameterType : operationType.getParameter()) {
        operationRecord.addParameter(
            parameterType.getName().getId(),
            parameterType.getName().getDisplayName(),
            parameterType.getName().getDescription(),
            parameterType.getValue());
      }

      // source code
      String sourceCodeFileName = operationType.getSourceCodeFile();
      if (sourceCodeFileName != null && !sourceCodeFileName.isEmpty()) {
        String sourceCode = null;
        try {
          sourceCode = getSourceCode(sourceCodeFileName);
        } catch (Exception e) {
          logger.warn("could not load source code from " + sourceCodeFileName);
        }

        // might be null, is ok
        operationRecord.setSourceCode(sourceCode);
      }

      // update names, category from the current version of the tool
      OperationDefinition currentTool;
      currentTool =
          Session.getSession()
              .getApplication()
              .getOperationDefinitionBestMatch(
                  operationRecord.getNameID().getID(),
                  operationRecord.getModule(),
                  operationRecord.getCategoryName());
      if (currentTool != null) {
        operationRecord.getNameID().setDisplayName(currentTool.getDisplayName());
        operationRecord.getNameID().setDescription(currentTool.getDescription());
        if (currentTool.getCategory().getModule() != null) {
          operationRecord.setModule(currentTool.getCategory().getModule().getModuleName());
        }
        operationRecord.setCategoryName(currentTool.getCategoryName());
        operationRecord.setCategoryColor(currentTool.getCategory().getColor());

        for (ParameterRecord parameterRecord : operationRecord.getParameters()) {
          Parameter currentParameter =
              currentTool.getParameter(parameterRecord.getNameID().getID());
          if (currentParameter != null) {
            parameterRecord.getNameID().setDisplayName(currentParameter.getDisplayName());
            parameterRecord.getNameID().setDescription(currentParameter.getDescription());
          }
        }
      }

      // store the operation record
      operationRecords.put(operationSessionId, operationRecord);
      operationTypes.put(operationRecord, operationType);
    }
  }