private PhenoData setValue(
      CustomField customField,
      CustomFieldDisplay customFieldDisplay,
      PhenoData data,
      String theDataAsString) {
    //		log.warn("cf=" + customField + "\ndata=" + data+ "dataAsString=" + theDataAsString);

    if (customField.getFieldType().getName().equalsIgnoreCase(Constants.FIELD_TYPE_NUMBER)) {
      data.setNumberDataValue(new Double(theDataAsString));
    } else if (customField.getFieldType().getName().equalsIgnoreCase(Constants.FIELD_TYPE_DATE)) {
      DateFormat dateFormat = new SimpleDateFormat(au.org.theark.core.Constants.DD_MM_YYYY);
      Date dateFieldValue;
      try {
        dateFieldValue = dateFormat.parse(theDataAsString);
        data.setDateDataValue(dateFieldValue);
      } catch (ParseException e) {
        data.setErrorDataValue(theDataAsString);
      }
    } else if (customField
        .getFieldType()
        .getName()
        .equalsIgnoreCase(Constants.FIELD_TYPE_CHARACTER)) {
      if (customField.getEncodedValues() != null
          && !customField.getEncodedValues().isEmpty()
          && customFieldDisplay.getAllowMultiselect()) {
        if (theDataAsString != null) {
          theDataAsString = theDataAsString.replaceAll(" ", ";");
        }
      }
      data.setTextDataValue(theDataAsString);
    }
    return data;
  }
Beispiel #2
0
  private void initCustomFieldDataListPanel() {
    cfdProvider.setCriteriaModel(
        new PropertyModel<CustomFieldDisplay>(cpModel, "customFieldGroup"));
    List<CustomField> selectedList =
        iPhenotypicService.getCustomFieldsLinkedToCustomFieldGroup(
            getModelObject().getCustomFieldGroup());
    Boolean disableEditButton = false;
    if (getModelObject().getCustomFieldGroup().getPublished()) {
      for (CustomField customField : selectedList) {
        if (customField.getCustomFieldHasData()) {
          disableEditButton = true;
          break;
        }
      }
    }

    CustomFieldDisplayListPanel cfdListPanel =
        new CustomFieldDisplayListPanel(
            "cfdListPanel", feedBackPanel, arkCrudContainerVO, disableEditButton);
    cfdListPanel.setOutputMarkupId(true);
    cfdListPanel.initialisePanel();
    dataView = cfdListPanel.buildDataView(cfdProvider);
    dataView.setItemsPerPage(iArkCommonService.getRowsPerPage());

    AjaxPagingNavigator pageNavigator =
        new AjaxPagingNavigator("cfDisplayNavigator", dataView) {

          private static final long serialVersionUID = 1L;

          @Override
          protected void onAjaxEvent(AjaxRequestTarget target) {
            target.add(arkCrudContainerVO.getWmcForCustomFieldDisplayListPanel());
          }
        };
    cfdListPanel.addOrReplace(pageNavigator);
    cfdListPanel.addOrReplace(dataView);
    arkCrudContainerVO.getWmcForCustomFieldDisplayListPanel().addOrReplace(cfdListPanel);
  }
Beispiel #3
0
  /*
   * (non-Javadoc)
   *
   * @see au.org.theark.core.web.form.AbstractDetailForm#onDeleteConfirmed(org.apache.wicket.ajax.AjaxRequestTarget, java.lang.String)
   */
  @Override
  protected void onDeleteConfirmed(AjaxRequestTarget target, String selection) {
    // Get a list of CustomFields for the given group
    ArrayList<CustomField> selectedList =
        (ArrayList)
            iPhenotypicService.getCustomFieldsLinkedToCustomFieldGroup(
                getModelObject().getCustomFieldGroup());

    Boolean allowDelete = true;
    for (CustomField customField : selectedList) {
      if (customField.getCustomFieldHasData()) {
        allowDelete = false;
        break;
      }
    }
    if (allowDelete) {
      iPhenotypicService.deleteCustomFieldGroup(getModelObject());
      this.info("Data Set has been deleted successfully.");
      editCancelProcess(target);

    } else {
      this.error("This Data Set cannot be deleted.");
    }
  }