Processes embedded beans.
Each embedded bean will be indexed and foreign keys will
be created if the bean is in the dependency list.

@param RedBean_OODBBean $bean          bean
@param array            $embeddedBeans embedded beans
350321
private function processEmbeddedBeans($bean, $embeddedBeans) {
		foreach($embeddedBeans as $linkField=>$embeddedBean) {
			if (!$this->isFrozen) {
				$this->writer->addIndex($bean->getMeta('type'),
							'index_foreignkey_'.$bean->getMeta('type').'_'.$embeddedBean->getMeta('type'),
							 $linkField);
				$isDep = $this->isDependentOn($bean->getMeta('type'),$embeddedBean->getMeta('type'));
				$this->writer->addFK($bean->getMeta('type'),$embeddedBean->getMeta('type'),$linkField,'id',$isDep);
			}
		}
		
	}
1303355
public function associate($beans1, $beans2) {
		$results = array();
		if (!is_array($beans1)) $beans1 = array($beans1);
		if (!is_array($beans2)) $beans2 = array($beans2);
		foreach($beans1 as $bean1) {
			foreach($beans2 as $bean2) {
				$table = $this->getTable( array($bean1->getMeta('type') , $bean2->getMeta('type')) );
				$bean = $this->oodb->dispense($table);
				$results[] = $this->associateBeans( $bean1, $bean2, $bean );
			}
		}
		return (count($results)>1) ? $results : reset($results);
	}
278175
public void processClassBeanAttributes() {
        preInitializeBeans(getEnvironment().getClassBeans());
        preInitializeBeans(getEnvironment().getDecorators());
        preInitializeBeans(getEnvironment().getInterceptors());

        processBeans(getEnvironment().getClassBeans());
        processBeans(getEnvironment().getDecorators());
        processBeans(getEnvironment().getInterceptors());

        // now that we know that the bean won't be vetoed, it's the right time to register @New injection points
        searchForNewBeanDeclarations(getEnvironment().getClassBeans());
        searchForNewBeanDeclarations(getEnvironment().getDecorators());
        searchForNewBeanDeclarations(getEnvironment().getInterceptors());
    }
502869
public function inject(RedBean_OODBBean $otherBean) {
		$myID = $this->id;
		$array = $otherBean->export();
		$this->import($array);
		$this->id = $myID;
		return $this;
	}
1097842
private void process(Object entity, MetamodelImpl metamodel, Row row, Set<Attribute> attributes, Table schemaTable,
            EntityMetadata metadata)
    {

        for (Attribute attribute : attributes)
        {
            // by pass association.
            if (!attribute.isAssociation())
            {
                // in case of embeddable id.
                if (attribute.equals(metadata.getIdAttribute())
                        && metamodel.isEmbeddable(((AbstractAttribute) attribute).getBindableJavaType()))
                {
                    processEmbeddableAttribute(entity, metamodel, row, schemaTable, metadata, attribute);
                }
                else
                {
                    if (metamodel.isEmbeddable(((AbstractAttribute) attribute).getBindableJavaType()))
                    {
                        processEmbeddableAttribute(entity, metamodel, row, schemaTable, metadata, attribute);
                    }
                    else
                    {
                        setField(row, schemaTable, entity, attribute);
                    }
                }
            }
        }
    }
272017
private void beanToBean(Object providerBean, Object destBean) {
		valueProviderToBean(new BeanValueProvider(providerBean, this.copyOptions.ignoreCase, this.copyOptions.ignoreError), destBean);
	}
283739
@SuppressWarnings("unchecked")
    @Override
    public void postProcessBeforeDestruction(Object bean, String beanName) throws BeansException {
        if (clazz.isInstance(bean)) {
            unregister((V) bean);
        }
    }
627624
void process() {
        fixImports();
        if (insertRegion != null) {
            data.ensureImport(BeanDefinition.class);
            if (properties.size() > 0) {
                data.ensureImport(PropertyDefinition.class);
            }
            removeOld();
            if (data.isRootClass() && data.isExtendsDirectBean()) {
                data.ensureImport(DirectBean.class);
            }
            generateMeta();
            generateSerializationVersionId();
            generatePropertyChangeSupportField();
            generateHashCodeField();
            generateFactory();
            generateImmutableBuilderMethod();
            generateArgBasedConstructor();
            generateBuilderBasedConstructor();
            generateMetaBean();
            generateGettersSetters();
            generateSeparator();
            generateImmutableToBuilder();
            generateClone();
            generateEquals();
            generateHashCode();
            generateToString();
            generateMetaClass();
            generateBuilderClass();
            resolveImports();
            resolveIndents();
        }
    }
280366
private void connectReferences() {
        // ready to associate initalized beans with references
        for (Bean bean : beans.values()) {
            for (JpaRef ref : refs.get(bean.getId())) {
                BeanId target = ref.getTarget();
                Bean targetBean = beans.get(target);
                target.setBean(targetBean);
                bean.addReference(ref.getPropertyName(), target);
            }
        }
    }
549226
public static function swap( $beans, $property ) {
		$bean1 = array_shift($beans);
		$bean2 = array_shift($beans);
		$tmp = $bean1->$property;
		$bean1->$property = $bean2->$property;
		$bean2->$property = $tmp;
		RedBean_Facade::store($bean1);
		RedBean_Facade::store($bean2);
	}
853640
public function owns($related, $exclusive = true)
    {
        $table = ucfirst($related::getTable());
        $column = ($exclusive ? 'x' : '') . "own{$table}List";
        $this->bean->$column[] = $related->getBean();
    }
1049574
public function append($bean)
	{
		$this->validate($bean);
		parent::offsetSet($bean->getIndex(), $bean);
		$this->rewind();
	}
401887
private void installBean(JComponent bean) {
		try {
			componentPanel.removeAll();
			componentPanel.add(bean);

			BeanInfo beanInfo = Introspector.getBeanInfo(bean.getClass(), bean.getClass()
					.getSuperclass());
			PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();

			propertyPanel.removeAll();

			GridBagLayout gridbag = new GridBagLayout();
			GridBagConstraints c = new GridBagConstraints();
			c.fill = GridBagConstraints.BOTH;

			propertyPanel.setLayout(gridbag);

			int count = 0;

			String[] types = new String[] { "class java.util.Locale", "boolean", "int",
					"class java.awt.Color", "class java.util.Date", "class java.lang.String" };

			for (int t = 0; t < types.length; t++) {
				for (int i = 0; i < propertyDescriptors.length; i++) {
					if (propertyDescriptors[i].getWriteMethod() != null) {
						String type = propertyDescriptors[i].getPropertyType().toString();

						final PropertyDescriptor propertyDescriptor = propertyDescriptors[i];
						final JComponent currentBean = bean;
						final Method readMethod = propertyDescriptor.getReadMethod();
						final Method writeMethod = propertyDescriptor.getWriteMethod();

						if (type.equals(types[t])
								&& (((readMethod != null) && (writeMethod != null)) || ("class java.util.Locale"
										.equals(type)))) {
							if ("boolean".equals(type)) {
								boolean isSelected = false;

								try {
									Boolean booleanObj = ((Boolean) readMethod.invoke(bean, null));
									isSelected = booleanObj.booleanValue();
								} catch (Exception e) {
									e.printStackTrace();
								}

								final JCheckBox checkBox = new JCheckBox("", isSelected);
								checkBox.addActionListener(new ActionListener() {
									public void actionPerformed(ActionEvent event) {
										try {
											if (checkBox.isSelected()) {
												writeMethod.invoke(currentBean,
														new Object[] { new Boolean(true) });
											} else {
												writeMethod.invoke(currentBean,
														new Object[] { new Boolean(false) });
											}
										} catch (Exception e) {
											e.printStackTrace();
										}
									}
								});
								addProperty(propertyDescriptors[i], checkBox, gridbag);
								count += 1;
							} else if ("int".equals(type)) {
								JSpinField spinField = new JSpinField();
								spinField.addPropertyChangeListener(new PropertyChangeListener() {
									public void propertyChange(PropertyChangeEvent evt) {
										try {
											if (evt.getPropertyName().equals("value")) {
												writeMethod.invoke(currentBean, new Object[] { evt
														.getNewValue() });
											}
										} catch (Exception e) {
										}
									}
								});

								try {
									Integer integerObj = ((Integer) readMethod.invoke(bean, null));
									spinField.setValue(integerObj.intValue());
								} catch (Exception e) {
									e.printStackTrace();
								}

								addProperty(propertyDescriptors[i], spinField, gridbag);
								count += 1;
							} else if ("class java.lang.String".equals(type)) {
								String string = "";

								try {
									string = ((String) readMethod.invoke(bean, null));
								} catch (Exception e) {
									e.printStackTrace();
								}

								JTextField textField = new JTextField(string);
								ActionListener actionListener = new ActionListener() {
									public void actionPerformed(ActionEvent e) {
										try {
											writeMethod.invoke(currentBean, new Object[] { e
													.getActionCommand() });
										} catch (Exception ex) {
										}
									}
								};

								textField.addActionListener(actionListener);

								addProperty(propertyDescriptors[i], textField, gridbag);
								count += 1;
							} else if ("class java.util.Locale".equals(type)) {
								JLocaleChooser localeChooser = new JLocaleChooser(bean);
								localeChooser.setPreferredSize(new Dimension(200, localeChooser
										.getPreferredSize().height));
								addProperty(propertyDescriptors[i], localeChooser, gridbag);
								count += 1;
							} else if ("class java.util.Date".equals(type)) {
								Date date = null;

								try {
									date = ((Date) readMethod.invoke(bean, null));
								} catch (Exception e) {
									e.printStackTrace();
								}

								JDateChooser dateChooser = new JDateChooser(date);

								dateChooser.addPropertyChangeListener(new PropertyChangeListener() {
									public void propertyChange(PropertyChangeEvent evt) {
										try {
											if (evt.getPropertyName().equals("date")) {
												writeMethod.invoke(currentBean, new Object[] { evt
														.getNewValue() });
											}
										} catch (Exception e) {
										}
									}
								});

								addProperty(propertyDescriptors[i], dateChooser, gridbag);
								count += 1;
							} else if ("class java.awt.Color".equals(type)) {
								final JButton button = new JButton();

								try {
									final Color colorObj = ((Color) readMethod.invoke(bean, null));
									button.setText("...");
									button.setBackground(colorObj);

									ActionListener actionListener = new ActionListener() {
										public void actionPerformed(ActionEvent e) {
											Color newColor = JColorChooser.showDialog(
													JCalendarDemo.this, "Choose Color", colorObj);
											button.setBackground(newColor);

											try {
												writeMethod.invoke(currentBean,
														new Object[] { newColor });
											} catch (Exception e1) {
												e1.printStackTrace();
											}
										}
									};

									button.addActionListener(actionListener);
								} catch (Exception e) {
									e.printStackTrace();
								}

								addProperty(propertyDescriptors[i], button, gridbag);
								count += 1;
							}
						}
					}
				}
			}

			URL iconURL = bean.getClass().getResource("images/" + bean.getName() + "Color16.gif");
			ImageIcon icon = new ImageIcon(iconURL);

			componentTitlePanel.setTitle(bean.getName(), icon);
			bean.invalidate();
			propertyPanel.invalidate();
			componentPanel.invalidate();
			componentPanel.repaint();
		} catch (IntrospectionException e) {
			e.printStackTrace();
		}
	}
1028224
public void postProcessBeanFactory(final ConfigurableListableBeanFactory reg)
			throws BeansException {
		DefaultListableBeanFactory  bf = (DefaultListableBeanFactory) reg;
		bf.setAutowireCandidateResolver(new FSMAnnotationResolver());
	}
1265333
@SuppressWarnings("unused")
    private void initalizeReferences(Collection<Bean> beans) {
        Map<BeanId, Bean> userProvided = BeanUtils.uniqueIndex(beans);
        for (Bean bean : beans) {
            for (String name : bean.getReferenceNames()) {
                List<BeanId> values = bean.getReference(name);
                if (values == null) {
                    continue;
                }
                for (BeanId beanId : values) {
                    // the does not exist in storage, but may exist in the
                    // set of beans provided by the user.
                    Bean ref = userProvided.get(beanId);
                    if (ref == null) {
                        Optional<Bean> optional = beanManager.getEager(beanId);
                        if (optional.isPresent()) {
                            ref = optional.get();
                        }
                    }
                    beanId.setBean(ref);
                    schemaManager.setSchema(Arrays.asList(beanId.getBean()));
                }
            }
        }
    }
268144
protected function execute(InputInterface $oInput, OutputInterface $oOutput)
    {
        parent::execute($oInput, $oOutput);

        $oOutput->writeln('');
        $oOutput->writeln('<info>----------------------</info>');
        $oOutput->writeln('<info>Nails Database Seeder </info>');
        $oOutput->writeln('<info>----------------------</info>');
        $oOutput->writeln('');

        // --------------------------------------------------------------------------

        if ($oInput->getArgument('component') == 'list') {

            $oOutput->writeln('');
            $aSeeders = $this->getSeeders();
            if (empty($aSeeders)) {
                $oOutput->writeln('No seeders were discovered. Make one using <comment>make:db:seed</comment>'
                );
            } else {
                $oOutput->writeln('The following seeders are available:');
                $oOutput->writeln('');
                foreach ($aSeeders as $oSeeder) {
                    $oOutput->writeln(' - <comment>' . $oSeeder->component . ' [' . $oSeeder->class . ']</comment>');
                }
            }
            $oOutput->writeln('');

            return static::EXIT_CODE_SUCCESS;
        }

        // --------------------------------------------------------------------------

        //  Check environment
        if (Environment::is(Environment::ENV_PROD)) {

            $oOutput->writeln('');
            $oOutput->writeln('--------------------------------------');
            $oOutput->writeln('| <info>WARNING: The app is in PRODUCTION.</info> |');
            $oOutput->writeln('--------------------------------------');
            $oOutput->writeln('');
            $oOutput->writeln('Aborting seed.');

            return static::EXIT_CODE_FAILURE;
        }

        // --------------------------------------------------------------------------

        //  Find seeds
        $aSeedersAll = $this->getSeeders();

        //  Filter out seeders
        $sComponent = strtolower($oInput->getArgument('component'));
        $aClasses   = explode(',', $oInput->getArgument('class'));
        $aClasses   = array_filter($aClasses);
        $aClasses   = array_unique($aClasses);
        $aSeeders   = [];

        /**
         * If component and class arguments are empty then execute all seeds
         * If component is defined and class is empty, execute all seeds for that component
         * If both are defined then only execute seeds which match both
         */

        if (empty($sComponent) && empty($aClasses)) {
            $aSeeders = $aSeedersAll;
        } elseif (!empty($sComponent) && empty($aClasses)) {
            foreach ($aSeedersAll as $oSeeder) {
                if ($oSeeder->component === $sComponent) {
                    $aSeeders[] = $oSeeder;
                }
            }
        } else {
            foreach ($aSeedersAll as $oSeeder) {
                if ($oSeeder->component === $sComponent && in_array($oSeeder->class, $aClasses)) {
                    $aSeeders[] = $oSeeder;
                }
            }
        }

        if (empty($aSeeders)) {
            return $this->abort(
                static::EXIT_CODE_SUCCESS,
                [
                    'No seeders were discovered. Make one using <comment>make:db:seed</comment>',
                ]
            );
        }

        //  Get confirmation
        $oOutput->writeln('The following seeds will be executed in this order:');
        $oOutput->writeln('');
        foreach ($aSeeders as $oSeeder) {
            //  Execute migration
            $oOutput->writeln(
                ' - <comment>' . $oSeeder->component . ' [' . $oSeeder->class . ']</comment>'
            );
        }
        $oOutput->writeln('');

        $bDoSeed = $this->confirm('Does this look OK?', true);

        if ($bDoSeed) {
            $oOutput->writeln('');
            $oOutput->writeln('Executing seeds...');
            $oOutput->writeln('');

            $oDb = Factory::service('PDODatabase');

            foreach ($aSeeders as $oSeeder) {
                //  Execute seed
                $oOutput->write(
                    str_pad(
                        ' - <comment>' . $oSeeder->component . ' [' . $oSeeder->class . ']</comment>... ',
                        50,
                        ' '
                    )
                );
                $sClassName = $oSeeder->namespace . 'Seed\\' . $oSeeder->class;
                $oClass     = new $sClassName($oDb);
                $oClass->pre();
                $oClass->execute();
                $oClass->post();
                $oOutput->writeln('<info>done!</info>');
            }
            $oOutput->writeln('');
        } else {
            $oOutput->writeln('');
            $oOutput->writeln('No seeds were executed');
            $oOutput->writeln('');
        }

        // --------------------------------------------------------------------------

        //  Cleaning up
        $oOutput->writeln('');
        $oOutput->writeln('<comment>Cleaning up...</comment>');

        // --------------------------------------------------------------------------

        //  And we're done
        $oOutput->writeln('');
        $oOutput->writeln('Complete!');

        return static::EXIT_CODE_SUCCESS;
    }
169771
public void initBeans(Object[] beans) {
        this.controllers = Arrays.stream(beans).filter(bean -> this.getController(bean) != null).map(bean -> this.getController(bean)).collect(Collectors.toList());
    }