Convert the legacy Decision Table model to the new

@param legacyDTModel
@return The new DTModel
181520
public GuidedDecisionTable52 upgrade(GuidedDecisionTable legacyDTModel) {

        assertConditionColumnPatternGrouping(legacyDTModel);

        GuidedDecisionTable52 newDTModel = new GuidedDecisionTable52();

        newDTModel.setTableFormat(GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY);

        newDTModel.setTableName(legacyDTModel.tableName);
        newDTModel.setParentName(legacyDTModel.parentName);

        newDTModel.setRowNumberCol(new RowNumberCol52());
        newDTModel.setDescriptionCol(new DescriptionCol52());

        //Metadata columns' data-type is implicitly defined in the metadata value. For example
        //a String metadata attribute is: "value", a numerical: 1. No conversion action required
        if (legacyDTModel.metadataCols != null) {
            for (MetadataCol c : legacyDTModel.metadataCols) {
                newDTModel.getMetadataCols().add(makeNewColumn(c));
            }
        }

        //Attribute columns' data-type is based upon the attribute name
        if (legacyDTModel.attributeCols != null) {
            for (AttributeCol c : legacyDTModel.attributeCols) {
                newDTModel.getAttributeCols().add(makeNewColumn(c));
            }
        }

        //Legacy decision tables did not have Condition field data-types. Set all Condition 
        //fields to a *sensible* default of String (as this matches legacy behaviour).
        List<Pattern52> patterns = new ArrayList<Pattern52>();
        Map<String, Pattern52> uniquePatterns = new HashMap<String, Pattern52>();
        if (legacyDTModel.conditionCols != null) {
            for (int i = 0; i < legacyDTModel.conditionCols.size(); i++) {
                ConditionCol c = legacyDTModel.conditionCols.get(i);
                String boundName = c.boundName;
                Pattern52 p = uniquePatterns.get(boundName);
                if (p == null) {
                    p = new Pattern52();
                    p.setBoundName(boundName);
                    p.setFactType(c.factType);
                    patterns.add(p);
                    uniquePatterns.put(boundName,
                                       p);
                }
                if (p.getFactType() != null && !p.getFactType().equals(c.factType)) {
                    throw new IllegalArgumentException("Inconsistent FactTypes for ConditionCols bound to '" + boundName + "' detected.");
                }
                p.getChildColumns().add(makeNewColumn(c));
            }
            for (Pattern52 p : patterns) {
                newDTModel.getConditions().add(p);
            }
        }

        //Action columns have a discrete data-type. No conversion action required.
        if (legacyDTModel.actionCols != null) {
            for (ActionCol c : legacyDTModel.actionCols) {
                newDTModel.getActionCols().add(makeNewColumn(c));
            }
        }

        //Copy across data
        newDTModel.setData(DataUtilities.makeDataLists(legacyDTModel.data));

        //Copy the boundName for ActionRetractFactCol into the data of the new Guided Decision Table model
        if (legacyDTModel.actionCols != null) {
            final int metaDataColCount = (legacyDTModel.metadataCols == null ? 0 : legacyDTModel.metadataCols.size());
            final int attributeColCount = (legacyDTModel.attributeCols == null ? 0 : legacyDTModel.attributeCols.size());
            final int conditionColCount = (legacyDTModel.conditionCols == null ? 0 : legacyDTModel.conditionCols.size());
            final int DATA_COLUMN_OFFSET = metaDataColCount + attributeColCount + conditionColCount + GuidedDecisionTable.INTERNAL_ELEMENTS;
            for (int iCol = 0; iCol < legacyDTModel.actionCols.size(); iCol++) {
                ActionCol lc = legacyDTModel.actionCols.get(iCol);
                if (lc instanceof ActionRetractFactCol) {
                    String boundName = ((ActionRetractFactCol) lc).boundName;
                    for (List<DTCellValue52> row : newDTModel.getData()) {
                        row.get(DATA_COLUMN_OFFSET + iCol).setStringValue(boundName);
                    }
                }
            }
        }

        return newDTModel;
    }
1043463
public static IModel newModel(String groupId, String artifactId, String version, String service, MuleVersionEnum muleVersion, TransportEnum inboundTransport, TransportEnum outboundTransport, TransformerEnum transformerType) {
		return doCreateNewModel(groupId, artifactId, version, service, muleVersion, null, null, inboundTransport, outboundTransport, transformerType, null, null);
	}
79398
public AbstractThinTableModel getModel(JTable table)
    {
        AbstractThinTableModel model = null;
        if (table != null)
            model = (AbstractThinTableModel)table.getModel();
        return model;
    }
742143
def convert_old_project(self, project, legacy_id, name):
        

        new_id = str(uuid4())
        legacy_project_files_path = os.path.join(project.path, "{}-files".format(project.name))
        new_project_files_path = os.path.join(project.path, "project-files")
        if os.path.exists(legacy_project_files_path) and not os.path.exists(new_project_files_path):
            # move the project files
            log.info("Converting old project...")
            try:
                log.info('Moving "{}" to "{}"'.format(legacy_project_files_path, new_project_files_path))
                yield from wait_run_in_executor(shutil.move, legacy_project_files_path, new_project_files_path)
            except OSError as e:
                raise aiohttp.web.HTTPInternalServerError(text="Could not move project files directory: {} to {} {}".format(legacy_project_files_path,
                                                                                                                            new_project_files_path, e))

        if project.is_local() is False:
            legacy_remote_project_path = os.path.join(project.location, project.name, self.module_name.lower())
            new_remote_project_path = os.path.join(project.path, "project-files", self.module_name.lower())
            if os.path.exists(legacy_remote_project_path) and not os.path.exists(new_remote_project_path):
                # move the legacy remote project (remote servers only)
                log.info("Converting old remote project...")
                try:
                    log.info('Moving "{}" to "{}"'.format(legacy_remote_project_path, new_remote_project_path))
                    yield from wait_run_in_executor(shutil.move, legacy_remote_project_path, new_remote_project_path)
                except OSError as e:
                    raise aiohttp.web.HTTPInternalServerError(text="Could not move directory: {} to {} {}".format(legacy_remote_project_path,
                                                                                                                  new_remote_project_path, e))

        if hasattr(self, "get_legacy_vm_workdir"):
            # rename old project node working dir
            log.info("Converting old node working directory...")
            legacy_vm_dir = self.get_legacy_vm_workdir(legacy_id, name)
            legacy_vm_working_path = os.path.join(new_project_files_path, legacy_vm_dir)
            new_vm_working_path = os.path.join(new_project_files_path, self.module_name.lower(), new_id)
            if os.path.exists(legacy_vm_working_path) and not os.path.exists(new_vm_working_path):
                try:
                    log.info('Moving "{}" to "{}"'.format(legacy_vm_working_path, new_vm_working_path))
                    yield from wait_run_in_executor(shutil.move, legacy_vm_working_path, new_vm_working_path)
                except OSError as e:
                    raise aiohttp.web.HTTPInternalServerError(text="Could not move vm working directory: {} to {} {}".format(legacy_vm_working_path,
                                                                                                                             new_vm_working_path, e))

        return new_id
1143901
static DataModelDto toDataModelDto(final IDataModel dataModel) {

        Map<String, Object> names = dataModel.getNamedAddresses()
                .entrySet()
                .stream()
                .collect(Collectors.toMap(
                            e -> e.getKey(),
                            e -> e.getValue().address()));

        dataModel.getNamedValues().forEach( (k,v) -> names.put(k, v.get()) );

        Map<String, Object> table = new HashMap<>();
        Map<String, Object> result = new HashMap<>();
        
        for (IDmRow r : dataModel) {
            for (IDmCell c : r) {
                ICellAddress address = c.getAddress();
                
                table.put(address.a1Address().address(), c.getContent().get());

                if (c.getValue().isPresent()) {
                    result.put(address.a1Address().address(), c.getValue().get().get());
                }
            }
        }

        DataModelDto dto = new DataModelDto();
        
        dto.names = names;
        dto.table = table;
        dto.result = result;
        
        dto.dataModelId = dataModel.getDataModelId().toString();
        dto.name = dataModel.getName();
        
        return dto;
    }
746277
@Override
	public Map<String, Object> getValuesForModifiedData(double evaluationTime, MonteCarloSimulationModel model, Map<String,Object> dataModified) throws CalculationException
	{
		MonteCarloSimulationModel modelModified = model.getCloneWithModifiedData(dataModified);

		return getValues(evaluationTime, modelModified);
	}
713579
@SuppressWarnings("unchecked")
    public <T> T convertEDBObjectToModel(Class<T> model, EDBObject object) {
        return (T) convertEDBObjectToUncheckedModel(model, object);
    }
290365
def to_model
      mv = @value ? @value.to_model : nil
      met = @effective_time ? @effective_time.to_model : nil
      mtr = @temporal_references
      mso = @subset_operators
      HQMF::DataCriteria.new(@id, @title, nil, @description, @code_list_id, @children_criteria,
                             @derivation_operator, @definition, @status, mv, field_values, met, @inline_code_list,
                             @negation, @negation_code_list_id, mtr, mso, @specific_occurrence,
                             @specific_occurrence_const, @source_data_criteria, @comments, @variable)
    end
305955
function legacyAttrClass(domRef, oldClass, newValue, anim){
      var newClass = newValue || '';

      if (newClass != oldClass)
      {
        var className = domRef.className;
        var classNameIsObject = typeof className != 'string';
        var classList;

        if (classNameIsObject)
          className = className.baseVal;

        classList = className.split(WHITESPACE);

        if (oldClass)
          basis.array.remove(classList, oldClass);

        if (newClass)
        {
          classList.push(newClass);

          if (anim)
          {
            basis.array.add(classList, newClass + '-anim');
            basis.nextTick(function(){
              var classList = (classNameIsObject ? domRef.className.baseVal : domRef.className).split(WHITESPACE);

              basis.array.remove(classList, newClass + '-anim');

              if (classNameIsObject)
                domRef.className.baseVal = classList.join(' ');
              else
                domRef.className = classList.join(' ');
            });
          }
        }

        if (classNameIsObject)
          domRef.className.baseVal = classList.join(' ');
        else
          domRef.className = classList.join(' ');
      }

      return newClass;
    }
1361015
public void setModel (PropertySheetModel pm)
  {
    if (pm instanceof org.apache.ojb.tools.mapping.reversedb.DBTable)
    {
      this.aTable = (org.apache.ojb.tools.mapping.reversedb.DBTable)pm;
      this.readValuesFromTable();
    }
    else
      throw new IllegalArgumentException();        
  }
902616
@Override
    public ModelNode toModelNode() throws CommandFormatException {
        ModelNode node = new ModelNode();
        if(props != null) {
            for(String propName : props.keySet()) {
                node.get(propName).set(props.get(propName));
            }
        }
        return node;
    }
801659
public static PropertiesBuilder builder(KnowledgeComponentImplementationModel implementationModel) {
        PropertiesModel propertiesModel = null;
        if (implementationModel != null) {
            propertiesModel = implementationModel.getProperties();
        }
        return new PropertiesBuilder(propertiesModel);
    }
978826
public <T extends D6Model> T[] execSelectTable(Class<T> modelClazz) {

    final DBTable dbTable = modelClazz.getAnnotation(DBTable.class);
    final String dbTableName = dbTable.tableName();
    return (T[]) execSelectTable("SELECT * FROM " + dbTableName, modelClazz);
  }
217225
static IDataModel toDataModel(final IDataModel book, final ICellAddress address) {
        return toDataModel(DataModelConverters.toWorkbook(book), address);
    }
818070
public void cloneCommonColumnConfigFrom( DTColumnConfig52 model ) {
        setWidth( model.getWidth() );
        setHideColumn( model.isHideColumn() );
        setHeader( model.getHeader() );
        setDefaultValue( model.getDefaultValue() != null ? new DTCellValue52( model.getDefaultValue() ) : null );
    }
102920
@Override
    public void setModel(final TableModel dataModel) {
        super.setModel(dataModel);
        if (_panel != null) {
            _panel.updateUI();
        }
    }
751459
public Table createTable(String tableName, String fieldName) {
    // [START ]
    Schema schema = Schema.of(Field.of(fieldName, LegacySQLTypeName.STRING));
    StandardTableDefinition definition =
        StandardTableDefinition.newBuilder()
            .setSchema(schema)
            .setTimePartitioning(TimePartitioning.of(TimePartitioning.Type.DAY))
            .build();
    Table table = dataset.create(tableName, definition);
    // [END ]
    return table;
  }