@function initModelNew

new instance controller

@param {object} args
358085
function initModelNew (args) {
    var controller = this
    var model = this.model
    // if model/controller does not have form then cannot create new controller
    if (!this.form) {
        return
    }
    // create path if it does not exist
    if (!this.paths['/new']) {
        this.paths['/new'] = {}
    }
    // get accountId column
    var accountIdColumn = model.columnName('accountId') 
    // set role to authenticated if model requires account id
    var role = args.defaultRole || (accountIdColumn && model.columns[accountIdColumn].null === false ? 'authenticated' : 'all')
    // form inputs
    var input = {
        redirect: 'query.redirect',
    }
    // input may include pre-filled form values
    input[model.name] = 'query.'+model.name
    // add handler for GET /new
    this.paths['/new'].get = [
        {
            before: function (args) {
                return newInstance(controller, args)
            },
            input: input,
            method: function (args) {
                return {form: args.form}
            },
            methodName: 'new',
            role: role,
            template: 'instance',
        },
    ]
}
242347
public static void initApplication(String... args) {
		if (args.length < 1) {
			System.err.println("Please specify an Application as argument");
			System.exit(-1);
		}
		setInstance(createApplicationByClassName(args[0]));
	}
817684
function (args) {
  tgi.Model.call(this, args);
  this.modelType = "Actor";
  this.attributes.push(new tgi.Attribute('Name'));
  this.attributes.push(new tgi.Attribute('Born', 'Number'));
  this.attributes.push(new tgi.Attribute({name:'Today', type:'Date', hidden:'*'}));
  this.attributes.push(new tgi.Attribute('Sex'));
  this.attributes.push(new tgi.Attribute('Joystick','Boolean'));
}
1313482
function(arg) {
    return /^f/.test(typeof arg) ? /c/.test(document.readyState) ? arg() : u._defInit.push(arg) : new Init(arg);
  }
126860
function initNew (args) {
    // get module
    var module = this.component.module
    // if module has new method run it
    if (module.new) {
        // call new method with original new args
        this.promise = module.new(args.args).then(res => {
            // if new returns undefined do not set
            if (!defined(res)) {
                return
            }
            // require data to be object
            this.assert(typeof res === 'object' && res, 110)
            // if data is set then use it
            if (defined(res.data)) {
                // require data to be object
                this.assert(typeof res.data === 'object' && res.data, 110)
                // set component data to data returned by new method
                this.data = res.data
            }
            // if id set set it data use it
            if (defined(res.id)) {
                this.id = res.id
            }
        })
    }
    // otherwise set resolved promise
    else {
        // use any args for data
        _.merge(this.data, args.args)
        // set init promise as resolved
        this.promise = Promise.resolve()
    }
}
992608
function (model) {
			var c = this.c,
				s = this;
			this.m[model]=function () {
				var modelClass = c[model];
				return new modelClass({ autoInit: true }, s.c, s, s.db);
			};
		}
262216
function (args) {
          Model.call(this, args);
          this.modelType = "Actor";

          this.attributes.push(new Attribute('name'));
          this.attributes.push(new Attribute('born', 'Number'));
          this.attributes.push(new Attribute('isMale', 'Boolean'));
        }
889332
function (args) {
            var modules = args.modules;

            for (var i = 0; i < modules.length; i += 1) {
                var bindings = modules[i].bind, refpath = modules[i].refpath;
                if (bindings) {
                    for (var bind in bindings) {
                        if (bindings.hasOwnProperty(bind) && !this.json.isMetadata(bind)) {
                            var location = this._getStorage(bindings[bind]);
                            if (location) {

                                var moduleDescription = this._getModuleDataDescription(refpath, bind);
                                this.$assert(2, !!moduleDescription);
                                var listener = {
                                    fn : this._bindModuleChange,
                                    scope : this,
                                    args : {
                                        boundTo : location,
                                        moduleDescription : moduleDescription
                                    }
                                };
                                this.json.addListener(moduleDescription.container, moduleDescription.property, listener, false, true);
                                this._bindings[refpath] = this._bindings[refpath] || {};
                                this._bindings[refpath][bind] = [bindings[bind], listener];
                            }
                        }
                    }
                }
            }
            this._updateModulesData();
            this.$callback(args.callback, args.callback.args);
        }
542229
@Override
    public void init(Model model, Object... args) {
        mediaDriverContext = new MediaDriver.Context();
        mediaDriver = MediaDriver.launchEmbedded(mediaDriverContext);
        parameterServerNode = new ParameterServerNode(mediaDriver, statusServerPort, numWorkers);
        if (parameterServerArgs == null)
            parameterServerArgs = new String[] {"-m", "true", "-s", "1," + String.valueOf(model.numParams()), "-p",
                            "40323", "-h", "localhost", "-id", "11", "-md", mediaDriver.aeronDirectoryName(), "-sh",
                            "localhost", "-sp", String.valueOf(statusServerPort), "-u",
                            String.valueOf(numUpdatesPerEpoch)};

    }
1212406
function init ( cb ) {
    if (my.args.length > 0) {
      console.log('ignoring extra arguments')
    }
    stats(process.cwd(), 'isDirectory', function (err, currentbin) {
      if (err) return cb(err)
      var newbin = currentbin.name
      if (my.state.bins.hasOwnProperty(newbin)) {
        return cb( erf( 'A bin with name ' + path.basename(newbin)
                        + ' has already been initialized') )
      }
      my.state.bins = setActiveBin(my.state.bins, newbin)
      cb(null, my.state)

    })
  }
1276479
public static <T> T newInstance(Constructor<T> constructor, Object... args) {
        try {
            return constructor.newInstance(args);
        } catch (Exception e) {
            throw new ClientException(e);
        }
    }
1251430
public T newInstance(Object... args) {
                try {
                        con.setAccessible(true);
                        return con.newInstance(args);
                } catch (Exception e) {
                        throw $(e);
                }
        }
783981
function() {
		var args = Array.prototype.slice.call(arguments);
		args.unshift(null);
		var Factory = classFunc.bind.apply(
			classFunc,
			args
		);
		this._inst = new Factory();
	}
841238
function initModelDelete (args) {
    var controller = this
    var model = this.model
    // if model does not have delete action then do not add
    if (!defined(model.columns.d)) {
        return
    }
    // if model does not have id column then cannot use default controller
    if (!model.columnName('id')) {
        return
    }
    // get accountId column
    var accountIdColumn = model.columnName('accountId') 
    // set role to authenticated if model requires account id
    var role = args.defaultRole || (accountIdColumn && model.columns[accountIdColumn].null === false ? 'authenticated' : 'all')
    // index inputs
    var input = {
        // get current revision of record
        current: 'query.current',
        // get record even if deleted
        deleted: 'query.deleted',
        // ignore conflicts
        force: 'query.force',
        // record id
        id: 'params.id',
        // add option to set meta data for query
        meta: 'query.meta',
        // url to redirect to when done
        redirect: 'params.redirect',
        // http referrer
        referrer: 'headers.referer',
    }
    // record data is in body under model name
    input[model.name] = 'body.'+model.name
    // create path if it does not exist
    if (!defined(this.paths['/:id'])) {
        this.paths['/:id'] = {}
    }
    if (!defined(this.paths['/:id/delete'])) {
        this.paths['/:id/delete'] = {}
    }
    if (!defined(this.paths['/:id/undelete'])) {
        this.paths['/:id/undelete'] = {}
    }
    // add handler for GET /:id/delete and DELETE /:id to delete
    this.paths['/:id'].delete = this.paths['/:id/delete'].get = [
        {
            before: function (args) {
                // load record
                return loadRecordForUpdate(controller, args)
            },
            input: input,
            method: function (args) {
                // perform delete
                return deleteMethod(controller, 'delete', args)
            },
            role: role,
            methodName: 'delete',
        },
    ]
    // add handler for GET and POST /:id/undelete to undelete
    this.paths['/:id/undelete'].get = this.paths['/:id/undelete'].post = [
        {
            before: function (args) {
                // load record
                return loadRecordForUpdate(controller, args)
            },
            input: input,
            method: function (args) {
                // perform undelete
                return deleteMethod(controller, 'undelete', args)
            },
            role: role,
            methodName: 'undelete',
        },
    ]
}
386429
function (args) {
				var k;
				// error catching
				if (typeof args !== "object" && args instanceof Array) throw new Error("args must be an object");
				// set parameters
				for (k in args) {
					if (args.hasOwnProperty(k)) {
						this[k] = args[k];
					}
				}
			}
39571
function create (controller, args, node, relations) {
    // get model from controller
    var model = controller.model
    // get model data from input
    var data = args[model.name]
    // if meta flag is not set then data is instance data
    var createArgs = args.meta ? _.clone(data) : {data: data}
    // do not accept allow flag
    if (createArgs.allow) {
        httpError(403)
    }
    // add session to args
    createArgs.session = args.session
    // create instance
    return model.createMeta(createArgs)
    // create any relation models
    .then(instance => {
        // if no relations do nothing
        if (!relations) {
            return instance
        }
        // create all relations
        return Promise.all(_.map(_.keys(relations), relation => {
            // get relation through instance
            return instance.createMeta({
                data: relations[relation],
                relation: relation,
            })
        }))
        // resolve with instance
        .then(() => instance)
    })
    // redirect on success
    .then(instance => {
        // if being called in json mode or there is an after function
        // return the created instace
        if (args.json || node.after) {
            return instance
        }
        // otherwise redirect to instance page
        else {
            // use redirect from input or redirect to new instance
            var url = args.redirect || './'+instance.id
            // redirect
            httpRedirect(url)
        }
    })
    // catch errors
    .catch(error => {
        // if error is redirect throw it
        if (error.code === 302) {
            throw error
        }
        // if in json mode or there is no form return 400 error
        if (args.json || !controller.form) {
            httpError(400, undefined, error.data)
        }
        // create new form instance with input and error data
        var form = controller.form.newInstance({
            input: data,
            error: error,
        })
        // javascript for page
        var js = []
        // if form uses ckeditor add js
        if (form.ckeditor) {
            js.push({
                crossorigin: 'anonymous',
                //integrity: 'sha256-TTtB6JD2qVpmE4ydlMyYH52d7OSMq5FQh2f0ECHR0Bw=',
                src: '//cdn.jsdelivr.net/ckeditor/4.3.1/ckeditor.js',
            })
        }
        // return form
        return {
            form: form,
            js: js,
        }
    })
}
1235531
function Init(arg) {
    array.push.apply(this, arg && (arg.nodeType || /^o/.test(typeof arg)) && !u.isArray(arg) && arg !== null ? [arg] : u.isArray(arg) ? arg : '' + arg === arg ? u.isHtml(arg) ? u.toHtml(arg) : document.querySelectorAll(arg) : undefined);
  }