Пример #1
0
  protected void storeToForm(WorkflowAssignment wfAssignment, Map properties, Map object) {
    String formDefId = (String) properties.get("formDefId");
    if (formDefId != null && formDefId.trim().length() > 0) {
      ApplicationContext ac = AppUtil.getApplicationContext();
      AppService appService = (AppService) ac.getBean("appService");
      AppDefinition appDef = (AppDefinition) properties.get("appDef");

      Object[] fieldMapping = (Object[]) properties.get("fieldMapping");
      String multirowBaseObjectName = (String) properties.get("multirowBaseObject");

      FormRowSet rowSet = new FormRowSet();

      if (multirowBaseObjectName != null && multirowBaseObjectName.trim().length() > 0) {
        Object[] baseObjectArray = (Object[]) getObjectFromMap(multirowBaseObjectName, object);
        if (baseObjectArray != null && baseObjectArray.length > 0) {
          rowSet.setMultiRow(true);
          for (int i = 0; i < baseObjectArray.length; i++) {
            rowSet.add(getRow(wfAssignment, multirowBaseObjectName, i, fieldMapping, object));
          }
        }
      } else {
        rowSet.add(getRow(wfAssignment, null, null, fieldMapping, object));
      }

      if (rowSet.size() > 0) {
        appService.storeFormData(
            appDef.getId(), appDef.getVersion().toString(), formDefId, rowSet, null);
      }
    }
  }