Build inheritance model.

@return inheritance model instance.
769091
private InheritanceModel buildInheritenceModel()
    {
        InheritanceModel model = null;

        if (superClazzType != null)
        {
            // means there is a super class
            // scan for inheritence model.

            if (superClazzType.getPersistenceType().equals(PersistenceType.ENTITY)
                    && superClazzType.getJavaType().isAnnotationPresent(Inheritance.class))
            {
                Inheritance inheritenceAnn = superClazzType.getJavaType().getAnnotation(Inheritance.class);

                InheritanceType strategyType = inheritenceAnn.strategy();

                String descriminator = null;
                String descriminatorValue = null;
                String tableName = null;
                String schemaName = null;
                tableName = superClazzType.getJavaType().getSimpleName();

                if (superClazzType.getJavaType().isAnnotationPresent(Table.class))
                {
                    tableName = superClazzType.getJavaType().getAnnotation(Table.class).name();
                    schemaName = superClazzType.getJavaType().getAnnotation(Table.class).schema();
                }

                model = onStrategyType(model, strategyType, descriminator, descriminatorValue, tableName, schemaName);

            }

        }

        return model;
    }
668647
public function build()
    {
        $config = array_merge([
            'type' => $this->type,
        ], $this->getConfig());

        foreach ($config as $key => $value) {
            if ($value instanceof Builder) {
                $config[$key] = $value->build();
            }
        }

        return $config;
    }
621498
public function create(): Model
	{
		$model_class = $this->getModelClass();
		$instance = new $model_class;
		$this->fill($instance);

		return $instance;
	}
1344993
public function build()
    {
        if (!$this->transferStrategy) {
            throw new RuntimeException('No transfer strategy has been specified');
        }

        if (!$this->divisorStrategy) {
            throw new RuntimeException('No divisor strategy has been specified');
        }

        $batch = new Batch($this->transferStrategy, $this->divisorStrategy);

        if ($this->exceptionBuffering) {
            $batch = new ExceptionBufferingBatch($batch);
        }

        if ($this->afterFlush) {
            $batch = new NotifyingBatch($batch, $this->afterFlush);
        }

        if ($this->autoFlush) {
            $batch = new FlushingBatch($batch, $this->autoFlush);
        }

        if ($this->history) {
            $batch = new HistoryBatch($batch);
        }

        return $batch;
    }
864283
public function build()
	{
		$filterMapper = $this->getMapper();
		$input = Input::all();

		$result = new FilterResult();
		foreach ($filterMapper->getFields() as $field) {
			$clone = clone $field;
			$name  = $clone->getName();

			if (Input::has($name)) {
				$clone->setValue($input[$name]);
			}

			$clone->setContext(BaseField::CONTEXT_FILTER);

			$result->addField($name, $clone);
		}
		$this->setResult($result);
	}
888535
public function build(): GetInlineStylesForNodeRequest
	{
		$instance = new GetInlineStylesForNodeRequest();
		if ($this->nodeId === null) {
			throw new BuilderException('Property [nodeId] is required.');
		}
		$instance->nodeId = $this->nodeId;
		return $instance;
	}
212984
public function build(): RequestNodeRequest
	{
		$instance = new RequestNodeRequest();
		if ($this->objectId === null) {
			throw new BuilderException('Property [objectId] is required.');
		}
		$instance->objectId = $this->objectId;
		return $instance;
	}
170318
public Properties build() {
        Properties buildProperties = new Properties();
        merge(_defaultProperties, buildProperties);
        merge(_modelProperties, buildProperties);
        merge(_overrideProperties, buildProperties);
        return buildProperties;
    }
508713
public function build(): SetOverrideCertificateErrorsRequest
	{
		$instance = new SetOverrideCertificateErrorsRequest();
		if ($this->override === null) {
			throw new BuilderException('Property [override] is required.');
		}
		$instance->override = $this->override;
		return $instance;
	}
726114
public function build(): SetTouchEmulationEnabledRequest
	{
		$instance = new SetTouchEmulationEnabledRequest();
		if ($this->enabled === null) {
			throw new BuilderException('Property [enabled] is required.');
		}
		$instance->enabled = $this->enabled;
		$instance->configuration = $this->configuration;
		return $instance;
	}
632810
public function build(): GetAttributesRequest
	{
		$instance = new GetAttributesRequest();
		if ($this->nodeId === null) {
			throw new BuilderException('Property [nodeId] is required.');
		}
		$instance->nodeId = $this->nodeId;
		return $instance;
	}
533158
public function build(): QueryObjectsRequest
	{
		$instance = new QueryObjectsRequest();
		if ($this->prototypeObjectId === null) {
			throw new BuilderException('Property [prototypeObjectId] is required.');
		}
		$instance->prototypeObjectId = $this->prototypeObjectId;
		$instance->objectGroup = $this->objectGroup;
		return $instance;
	}
195554
public function build() {

        // Add some extra settings that related processors are going to need
        $this->add_setting(new backup_activity_generic_setting(backup::VAR_COURSEID, base_setting::IS_INTEGER, $this->get_courseid()));
        $this->add_setting(new backup_activity_generic_setting(backup::VAR_CONTEXTID, base_setting::IS_INTEGER, $this->contextid));

        // Create the course directory
        $this->add_step(new create_taskbasepath_directory('create_course_directory'));

        // Create the course.xml file with course & category information
        // annotating some bits, tags and module restrictions
        $this->add_step(new backup_course_structure_step('course_info', 'course.xml'));

        // Generate the enrolment file (conditionally, prevent it in any IMPORT/HUB operation)
        if ($this->plan->get_mode() != backup::MODE_IMPORT && $this->plan->get_mode() != backup::MODE_HUB) {
            $this->add_step(new backup_enrolments_structure_step('course_enrolments', 'enrolments.xml'));
        }

        // Annotate enrolment custom fields.
        $this->add_step(new backup_enrolments_execution_step('annotate_enrol_custom_fields'));

        // Annotate all the groups and groupings belonging to the course. This can be optional.
        if ($this->get_setting_value('groups')) {
            $this->add_step(new backup_annotate_course_groups_and_groupings('annotate_course_groups'));
        }

        // Annotate the groups used in already annotated groupings (note this may be
        // unnecessary now that we are annotating all the course groups and groupings in the
        // step above). This is here to support course->defaultgroupingid.
        // This may not be required to annotate if groups are not being backed up.
        if ($this->get_setting_value('groups')) {
            $this->add_step(new backup_annotate_groups_from_groupings('annotate_groups_from_groupings'));
        }

        // Annotate the question_categories belonging to the course context (conditionally).
        if ($this->get_setting_value('questionbank')) {
            $this->add_step(new backup_calculate_question_categories('course_question_categories'));
        }

        // Generate the roles file (optionally role assignments and always role overrides)
        $this->add_step(new backup_roles_structure_step('course_roles', 'roles.xml'));

        // Generate the filter file (conditionally)
        if ($this->get_setting_value('filters')) {
            $this->add_step(new backup_filters_structure_step('course_filters', 'filters.xml'));
        }

        // Generate the comments file (conditionally)
        if ($this->get_setting_value('comments')) {
            $this->add_step(new backup_comments_structure_step('course_comments', 'comments.xml'));
        }

        // Generate the calender events file (conditionally)
        if ($this->get_setting_value('calendarevents')) {
            $this->add_step(new backup_calendarevents_structure_step('course_calendar', 'calendar.xml'));
        }

        // Generate the logs file (conditionally)
        if ($this->get_setting_value('logs')) {
            // Legacy logs.
            $this->add_step(new backup_course_logs_structure_step('course_logs', 'logs.xml'));
            // New log stores.
            $this->add_step(new backup_course_logstores_structure_step('course_logstores', 'logstores.xml'));
        }

        // Generate the course competencies.
        $this->add_step(new backup_course_competencies_structure_step('course_competencies', 'competencies.xml'));

        // Annotate activity completion defaults.
        $this->add_step(new backup_completion_defaults_structure_step('course_completion_defaults', 'completiondefaults.xml'));

        // Generate the inforef file (must be after ALL steps gathering annotations of ANY type)
        $this->add_step(new backup_inforef_structure_step('course', 'inforef.xml'));

        // Migrate the already exported inforef entries to final ones
        $this->add_step(new move_inforef_annotations_to_final('migrate_inforef'));

        // At the end, mark it as built
        $this->built = true;
    }
188079
public function build(): CollectClassNamesFromSubtreeRequest
	{
		$instance = new CollectClassNamesFromSubtreeRequest();
		if ($this->nodeId === null) {
			throw new BuilderException('Property [nodeId] is required.');
		}
		$instance->nodeId = $this->nodeId;
		return $instance;
	}
1331735
public function build()
    {
        if (empty($this->attribute['source'])) {
            Throw new ElementException('No mediasource set.');
        }

        if (empty($this->attribute['type'])) {
            Throw new ElementException('No media type set.');
        }

        return parent::build();
    }
1151928
public function build()
    {
        if ($this->getContext()) {
            $context = $this->getContext();
        } else {
            $context = new Array2ObjectContext();
        }

        $this->prepareContext($context);

        return new Array2Object($context);
    }
719692
public function build()
	{
		$formMapper = $this->getMapper();
		$model      = $this->getModel();
		$primaryKey = (new $model)->getKeyName();

		/**
		 * Empty form
		 */
		$result = new FormResult();
		if ($this->getIdentifier() === null) {
			foreach ($formMapper->getFields() as $field) {
				$clone = clone $field;
				$name  = $clone->getName();

				// Is this a multiple field?
				if ($clone->isMultiple()) {
					$clone->setValue(['']);
				}

				$clone->setContext(BaseField::CONTEXT_FORM);
				$result->addField($name, $clone);
			}

			$this->setResult($result);
			return;
		}

		$items = $model::with([]);

		$items->where($primaryKey, $this->getIdentifier());
		$item = $items->first();

		// modifyModelItem hook
		if (method_exists($this->getMapper()->getAdmin(), 'modifyModelItem')) {
			$item = $this->getMapper()->getAdmin()->modifyModelItem($item);
		}

		$result = new FormResult;
		$result->setIdentifier($item->{$primaryKey});

		foreach ($formMapper->getFields() as $field) {
			$clone = clone $field;
			$name  = $clone->getName();
			$value = $item->{$name};

			if ($clone->hasBefore()) {
				$before = $clone->getBefore();

				if ($before instanceof Closure) {
					$value = $before($value);
				} else {
					$value = $before;
				}
			}

			// Is this a multiple field?
			if ($clone->isMultiple()) {
				$value = Value::decode(Config::get('bauhaus::admin.multiple-serializer'), $value);
			}

			$clone
				->setContext(BaseField::CONTEXT_FORM)
				->setValue($value);

			$result->addField($name, $clone);
		}

		$this->setResult($result);
	}