Generate.

@param filer
the filer
@param model
the model
@return the pair
@throws Exception
the exception
347601
public static Pair<Set<GeneratedTypeElement>, Set<GeneratedTypeElement>> generate(Filer filer, M2MModel model)
			 {
		entityResult.clear();
		daoResult.clear();
		BindM2MBuilder visitor = new BindM2MBuilder(filer);

		for (M2MEntity item : model.getEntities()) {
			visitor.generate(item);
		}

		Pair<Set<GeneratedTypeElement>, Set<GeneratedTypeElement>> result = new Pair<>();
		result.value0 = entityResult;
		result.value1 = daoResult;

		return result;
	}
212392
@Override
    public String marshal( final TemplateModel model ) {
        model.putInSync();
        return this.xt.toXML( model );
    }
419858
@Override
    public List<InputRecord> generate() throws Exception {
        List<InputRecord> result = new ArrayList<InputRecord>();
        InputRecord testRecord = (InputRecord) this.getInput().clone();
        this.validate();
        result.add(
                new InputRecord(
                        testRecord.getName(),
                        testRecord.getType(),
                        "" + (lower + upper) / 2,
                        testRecord.getCondition(),
                        true));
        if (Math.abs(upper - lower) > 1) {
            result.add(
                    new InputRecord(
                            testRecord.getName(),
                            testRecord.getType(),
                            "" + ((lower + upper) / 2 + 1),
                            testRecord.getCondition(),
                            true));
        }
        result.add(
                new InputRecord(
                        testRecord.getName(),
                        testRecord.getType(),
                        "" + lower,
                        testRecord.getCondition(),
                        includeLower));
        result.add(
                new InputRecord(
                        testRecord.getName(),
                        testRecord.getType(),
                        "" + upper,
                        testRecord.getCondition(),
                        includeUpper));
        result.add(
                new InputRecord(
                        testRecord.getName(),
                        testRecord.getType(),
                        "" + (lower - 1),
                        testRecord.getCondition(),
                        false));
        result.add(
                new InputRecord(
                        testRecord.getName(),
                        testRecord.getType(),
                        "" + (upper + 1),
                        testRecord.getCondition(),
                        false));
        return result;
    }
824728
public static EventModel createEvent(ModelForm form, Object model) throws Exception {
		EventModel em = new EventModel();
		try {
			PropertyUtils.copyProperties(model, form);
			em.setModelIF(model);
			String action = form.getAction();
			em.setActionName(action);
			em.setActionType(FormBeanUtil.actionTransfer(action));
		} catch (Exception ex) {
			Debug.logError("[JdonFramework]create Event error:" + ex, module);
			throw new Exception(ex);
		}
		return em;
	}
930576
protected Field getField(String name, Model<Field> model) throws IOException
    {
        return model.getProperty(name);
    }
99190
public BufferedReader openModelFile() {
	String filename = modelDir + File.separator + modelFile;
	BufferedReader fin = null;
	
	try {
	    fin = new BufferedReader(new InputStreamReader(new FileInputStream(filename), "UTF-8"));
	    
	} catch (IOException e) {
	    System.out.println(e.toString());
	    return null;
	}
	
	return fin;	
    }
1320559
public static void generate(Elements elementUtils, Filer filer, SQLiteDatabaseSchema schema,
			Set<GeneratedTypeElement> generatedEntities) throws Exception {
		BindTableGenerator visitor = new BindTableGenerator(elementUtils, filer, schema);

		List<SQLiteEntity> orderedEntities = BindDataSourceBuilder.orderEntitiesList(schema);

		for (SQLiteEntity item : orderedEntities) {
			visitor.visit(schema, item);
		}

		// generate table for generated entity
		for (GeneratedTypeElement genItem : generatedEntities) {
			visitor.visit(schema, genItem);
		}
	}
1155966
@SuppressWarnings("unchecked")
    public Response insert(@NotNull @Valid final MODEL model) throws Exception {
        matchedInsert(model);
        setForInsertId(model);

        executeTx(t -> {
            preInsertModel(model);
            insertModel(model);
            postInsertModel(model);
        });
        MODEL_ID id = (MODEL_ID) this.server.getBeanId(model);

        return Response.created(buildLocationUri(id)).build();
    }
797015
public static Model load(Class<? extends Model> c, InputStream is) throws Exception {
        Model model = c.newInstance();
        return model.loadModel(is);
    }
1126533
public String toFile() throws Exception {
        File file = File.createTempFile("GuiceDependencies_", ".dot");
        toFile(file);
        return file.getCanonicalPath();
    }
828946
public function generate($model)
    {
        $generator = new Generator(
            $this->setting->getModelDirectory(),
            $model
        );

        if ($generator->fileExists()) {
            echo Color::red('The model already exists.');

            exit(1);
        }

        $generator->write('model/model', [
            'baseNamespace' => $this->namespaces['model']
        ]);

        echo Color::green("The model was well created.");
    }
582185
public void writeTo(Filer filer) throws IOException {
    String fileName = packageName.isEmpty()
        ? typeSpec.name
        : packageName + "." + typeSpec.name;
    List<Element> originatingElements = typeSpec.originatingElements;
    JavaFileObject filerSourceFile = filer.createSourceFile(fileName,
        originatingElements.toArray(new Element[originatingElements.size()]));
    try (Writer writer = filerSourceFile.openWriter()) {
      writeTo(writer);
    } catch (Exception e) {
      try {
        filerSourceFile.delete();
      } catch (Exception ignored) {
      }
      throw e;
    }
  }
680835
@Override
    public List<InputRecord> generate() throws Exception {
        List<InputRecord> result = new ArrayList<InputRecord>();
        this.validate();

        InputRecord inputValue = (InputRecord) this.getInput().clone();
        Calendar calendar = Calendar.getInstance();
        SimpleDateFormat format = new SimpleDateFormat(this.formatString);
        DateTime start = new DateTime(lower);
        DateTime end = new DateTime(upper);

        // Valid in range value
        int range = Days.daysBetween(start, end).getDays();
        calendar.setTime(lower);
        calendar.add(Calendar.DAY_OF_YEAR, range / 2);
        inputValue.setValue(format.format(calendar.getTime()));
        inputValue.setValidInput(true);
        result.add(inputValue);
        // Another valid value
        if (range > 1) {
            inputValue = (InputRecord) this.getInput().clone();
            calendar.setTime(lower);
            calendar.add(Calendar.DAY_OF_YEAR, range / 2 + 1);
            inputValue.setValue(format.format(calendar.getTime()));
            inputValue.setValidInput(true);
            result.add(inputValue);
        }
        // Lower border value
        inputValue = (InputRecord) this.getInput().clone();
        inputValue.setValue(format.format(lower));
        inputValue.setValidInput(this.includeLower);
        result.add(inputValue);
        // Upper border value
        inputValue = (InputRecord) this.getInput().clone();
        inputValue.setValue(format.format(upper));
        inputValue.setValidInput(this.includeUpper);
        result.add(inputValue);
        // Day before lower
        inputValue = (InputRecord) this.getInput().clone();
        calendar.setTime(lower);
        calendar.add(Calendar.DAY_OF_YEAR, -1);
        inputValue.setValue(format.format(calendar.getTime()));
        inputValue.setValidInput(false);
        result.add(inputValue);
        // Day after upper
        inputValue = (InputRecord) this.getInput().clone();
        calendar.setTime(upper);
        calendar.add(Calendar.DAY_OF_YEAR, 1);
        inputValue.setValue(format.format(calendar.getTime()));
        inputValue.setValidInput(false);
        result.add(inputValue);

        return result;
    }
260111
def generate_model_file(filename, project, model, fields):
    """"""
    for field in fields:
        field.type = field.__class__.__name__

    content = open(os.path.join(os.path.dirname(__file__), 'templates/model_page.html'), 'r').read()

    engine = StatikTemplateEngine(project)
    template = engine.create_template(content)

    # create context and update from project.config
    context = {'model': model,
                'fields': fields}
    context.update(dict(project.config.context_static))
    string = template.render(context)

    with open(filename, 'w') as file:
        file.write(string)
67733
private void genFiles() throws IOException {
		//
		// BufferedReader in = new BufferedReader(new FileReader(new File(inDir,
		// StructureGenerator.FILE_STRUCTURE_FILE_NAME)));
		// String line;
		// while ((line = in.readLine()) != null) {
		// String[] tokens = line.split(" ");
		// if (tokens.length != 2) {
		// throw new IOException("Expect at most 2 tokens per line: "
		// + line);
		// }
		// String fileName = root + tokens[0];
		// long fileSize = (long) (BLOCK_SIZE * Double.parseDouble(tokens[1]));
		// genFile(new Path(fileName), fileSize);
		// }

		config = new Configuration(getConf());
		config.setInt("dfs.replication", 3);
		config.set("dfs.rootdir", root.toString());

		JobConf job = new JobConf(config, DataGenerator.class);
		job.setJobName("data-genarator");

		FileOutputFormat.setOutputPath(job, new Path("data-generator-result"));
		// create the input for the map-reduce job
		Path inputPath = new Path(ROOT + "load_input");
		fs.mkdirs(inputPath);
		fs.copyFromLocalFile(new Path(inDir + "/"
				+ StructureGenerator.FILE_STRUCTURE_FILE_NAME), inputPath);
		FileInputFormat.setInputPaths(job, new Path(ROOT + "load_input"));

		job.setInputFormat(TextInputFormat.class);
		job.setOutputKeyClass(Text.class);
		job.setOutputValueClass(Text.class);

		job.setMapperClass(CreateFiles.class);

		job.setNumMapTasks(nFiles/10);
		job.setNumReduceTasks(0);
		JobClient.runJob(job);
	}
299103
public List<GeneratorOutput> getCheckOutput(Filer filer) throws IOException
    {
        HashMap<String,Object> map = new HashMap<String,Object>();
        map.put("impl", this);                                  // control implementation
        map.put("init", _init);                                  // control impl initializer

        Writer writer = new IndentingWriter(filer.createSourceFile(_init.getClassName()));
        GeneratorOutput genOut = 
            new GeneratorOutput(writer,"org/apache/beehive/controls/runtime/generator/ImplInitializer.vm",
                                map);
        ArrayList<GeneratorOutput> genList = new ArrayList<GeneratorOutput>(1);
        genList.add(genOut);
        return genList;
    }
1334455
public void writeToGSEA(final Model model, OutputStream out) throws IOException
	{
		Collection<GMTEntry> entries = convert(model);
		if (entries.size() > 0)
		{
			Writer writer = new OutputStreamWriter(out);
			for (GMTEntry entry : entries) {
				if ((minNumOfGenesPerEntry <= 1 && !entry.identifiers().isEmpty())
						|| entry.identifiers().size() >= minNumOfGenesPerEntry)
				{
					writer.write(entry.toString() + "\n");
				}
			}
			writer.flush();
		}
	}