All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.ebeaninternal.server.persist.dmlbind.FactoryAssocOnes Maven / Gradle / Ivy

There is a newer version: 15.8.1
Show newest version
package io.ebeaninternal.server.persist.dmlbind;

import io.ebeaninternal.server.deploy.BeanDescriptor;
import io.ebeaninternal.server.deploy.BeanPropertyAssocOne;
import io.ebeaninternal.server.persist.dml.DmlMode;

import java.util.List;

/**
 * A factory that builds Bindable for BeanPropertyAssocOne properties.
 */
public class FactoryAssocOnes {

  public FactoryAssocOnes() {
  }

  /**
   * Add foreign key columns from associated one beans.
   */
  public void create(List list, BeanDescriptor desc, DmlMode mode) {

    BeanPropertyAssocOne[] ones = desc.propertiesOneImported();

    for (BeanPropertyAssocOne one : ones) {
      if (!one.isImportedPrimaryKey()) {
        switch (mode) {
          case INSERT:
            if (!one.isInsertable()) {
              continue;
            }
            break;
          case UPDATE:
            if (!one.isUpdateable()) {
              continue;
            }
            break;
        }
        list.add(new BindableAssocOne(one));
      }
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy