本文整理汇总了Java中org.apache.cayenne.map.DbEntity类的典型用法代码示例。如果您正苦于以下问题:Java DbEntity类的具体用法?Java DbEntity怎么用?Java DbEntity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DbEntity类属于org.apache.cayenne.map包,在下文中一共展示了DbEntity类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createTableModel
import org.apache.cayenne.map.DbEntity; //导入依赖的package包/类
static Table createTableModel(DatabaseChannel channel, DbEntity dbEntity) {
Column[] columns = new Column[dbEntity.getAttributes().size()];
int i = 0;
for (DbAttribute a : dbEntity.getAttributes()) {
columns[i++] = new Column(Objects.requireNonNull(a.getName()), a.getType());
}
// ensure predictable column order .. DbEntity's attributes are presumably already sorted, but just in case
Arrays.sort(columns, (c1, c2) -> c1.getName().compareTo(c2.getName()));
return Table.builder(channel, dbEntity.getFullyQualifiedName())
.columns(columns)
.quoteSqlIdentifiers(dbEntity.getDataMap().isQuotingSQLIdentifiers())
.build();
}
开发者ID:bootique,项目名称:bootique-cayenne,代码行数:17,代码来源:CayenneModelUtils.java
示例2: tablesInInsertOrder
import org.apache.cayenne.map.DbEntity; //导入依赖的package包/类
static Table[] tablesInInsertOrder(BQRuntime runtime, Collection<DbEntity> dbEntities) {
// note: do not obtain sorter from Cayenne DI. It is not a singleton and will come
// uninitialized
ServerRuntime serverRuntime = runtime.getInstance(ServerRuntime.class);
EntitySorter sorter = serverRuntime.getDataDomain().getEntitySorter();
List<DbEntity> list = new ArrayList<>(dbEntities);
sorter.sortDbEntities(list, false);
DatabaseChannel channel = DatabaseChannel.get(runtime);
Table[] tables = new Table[list.size()];
for (int i = 0; i < tables.length; i++) {
tables[i] = createTableModel(channel, list.get(i));
}
return tables;
}
开发者ID:bootique,项目名称:bootique-cayenne,代码行数:19,代码来源:CayenneModelUtils.java
示例3: getRelatedDbEntities
import org.apache.cayenne.map.DbEntity; //导入依赖的package包/类
static Stream<DbEntity> getRelatedDbEntities(EntityResolver resolver, Class<?> entityType, Property<?> relationship) {
ObjEntity entity = resolver.getObjEntity(entityType);
if (entity == null) {
throw new IllegalArgumentException("Not a Cayenne entity class: " + entityType.getName());
}
ObjRelationship objRelationship = entity.getRelationship(relationship.getName());
if (objRelationship == null) {
throw new IllegalArgumentException("No relationship '" + relationship.getName() + "' in entity " + entityType.getName());
}
List<DbRelationship> path = objRelationship.getDbRelationships();
if (path.size() < 2) {
return Stream.empty();
}
return path.subList(1, path.size()).stream().map(DbRelationship::getSourceEntity);
}
开发者ID:bootique,项目名称:bootique-cayenne,代码行数:21,代码来源:CayenneModelUtils.java
示例4: checkCreateFull
import org.apache.cayenne.map.DbEntity; //导入依赖的package包/类
private boolean checkCreateFull(DataNode dataNode) throws SQLException {
Map<String, Boolean> nameTables = getNameTablesInDB(dataNode);
Collection<DbEntity> entities = dataNode.getEntityResolver().getDbEntities();
for (DbEntity entity : entities) {
if (nameTables.get(entity.getName()) != null) {
return false;
}
}
generateFull(dataNode);
return true;
}
开发者ID:stariy95,项目名称:cayenne-android-demo,代码行数:13,代码来源:UpdateSchemaStrategy.java
示例5: DatabaseEntityAdapter
import org.apache.cayenne.map.DbEntity; //导入依赖的package包/类
public DatabaseEntityAdapter(final DbEntity databaseEntity)
{
// Must be assigned before property binding.
this.databaseEntity = databaseEntity;
try
{
nameProperty = bindString(DATAASE_ENTITY_NAME);
}
catch (final NoSuchMethodException e)
{
throw new RuntimeException("Fix the builder.", e);
}
}
开发者ID:apache,项目名称:cayenne-modeler,代码行数:15,代码来源:DatabaseEntityAdapter.java
示例6: display
import org.apache.cayenne.map.DbEntity; //导入依赖的package包/类
@Deprecated // Unused?
public void display(final DbEntity dbEntity)
{
LOGGER.debug("trying to display: " + dbEntity);
// attributesTableView.setItems(FXCollections.observableArrayList(objEntity.getAttributes()));
// objectEntityClassTabViewController.display(objEntity);
// objEntity.getAttributes()
}
开发者ID:apache,项目名称:cayenne-modeler,代码行数:9,代码来源:DatabaseEntityColumnsTabLayout.java
示例7: getPkName
import org.apache.cayenne.map.DbEntity; //导入依赖的package包/类
/**
* Return the database primary key column name for the given data object.
*
* @param dataObjectClass the class of the data object
* @return the primary key column name
*/
protected String getPkName(Class dataObjectClass) {
Validate.notNull(dataObjectClass, "Null dataObjectClass parameter.");
ObjEntity objEntity =
getDataContext().getEntityResolver().lookupObjEntity(dataObjectClass);
if (objEntity == null) {
throw new CayenneRuntimeException("Unmapped DataObject Class: "
+ dataObjectClass.getName());
}
DbEntity dbEntity = objEntity.getDbEntity();
if (dbEntity == null) {
throw new CayenneRuntimeException("No DbEntity for ObjEntity: "
+ objEntity.getName());
}
List pkAttributes = dbEntity.getPrimaryKey();
if (pkAttributes.size() != 1) {
throw new CayenneRuntimeException("PK contains "
+ pkAttributes.size()
+ " columns, expected 1.");
}
DbAttribute attr = (DbAttribute) pkAttributes.get(0);
return attr.getName();
}
开发者ID:florinpatrascu,项目名称:jpublish,代码行数:35,代码来源:CayenneTemplate.java
示例8: build
import org.apache.cayenne.map.DbEntity; //导入依赖的package包/类
public CayenneTestDataManager build() {
Set<DbEntity> mergedEntities = mergeEntities();
return new CayenneTestDataManager(
runtime.getInstance(ServerRuntime.class).getDataDomain(),
runtime.getInstance(CayenneTableManager.class),
deleteData,
refreshCayenneCaches,
CayenneModelUtils.tablesInInsertOrder(runtime, mergedEntities));
}
开发者ID:bootique,项目名称:bootique-cayenne,代码行数:12,代码来源:CayenneTestDataManagerBuilder.java
示例9: mergeEntities
import org.apache.cayenne.map.DbEntity; //导入依赖的package包/类
private Set<DbEntity> mergeEntities() {
if(dbEntityGraphRoots.isEmpty()) {
return dbEntities;
}
Set<DbEntity> merged = ModelDependencyResolver.resolve(dbEntityGraphRoots);
merged.addAll(dbEntities);
return merged;
}
开发者ID:bootique,项目名称:bootique-cayenne,代码行数:10,代码来源:CayenneTestDataManagerBuilder.java
示例10: getDbEntity
import org.apache.cayenne.map.DbEntity; //导入依赖的package包/类
static DbEntity getDbEntity(EntityResolver resolver, Class<?> entityType) {
ObjEntity entity = resolver.getObjEntity(entityType);
if (entity == null) {
throw new IllegalArgumentException("Not a Cayenne entity class: " + entityType.getName());
}
if (entity.getDbEntityName() == null) {
throw new IllegalArgumentException("Cayenne entity class is not mapped to a DbEntity: " + entityType.getName());
}
return entity.getDbEntity();
}
开发者ID:bootique,项目名称:bootique-cayenne,代码行数:14,代码来源:CayenneModelUtils.java
示例11: getTable
import org.apache.cayenne.map.DbEntity; //导入依赖的package包/类
public Table getTable(String name) {
return tables.computeIfAbsent(name, n -> {
DbEntity entity = resolver.getDbEntity(n);
if (entity == null) {
throw new IllegalArgumentException("Unknown DbEntity: " + n);
}
return CayenneModelUtils.createTableModel(channel, entity);
});
}
开发者ID:bootique,项目名称:bootique-cayenne,代码行数:12,代码来源:CayenneTableManager.java
示例12: isPrimaryKey
import org.apache.cayenne.map.DbEntity; //导入依赖的package包/类
/**
* @return true if all PK columns are represented in {@code keys}
*/
private boolean isPrimaryKey(DbEntity entity, Collection<String> keys) {
Collection<DbAttribute> pks = entity.getPrimaryKeys();
for (DbAttribute pk : pks) {
if (!keys.contains(pk.getName())) {
return false;
}
}
return true;
}
开发者ID:nhl,项目名称:link-rest,代码行数:13,代码来源:CayenneUpdateDataStoreStage.java
示例13: DatabaseEntityTreeViewModel
import org.apache.cayenne.map.DbEntity; //导入依赖的package包/类
public DatabaseEntityTreeViewModel(final DbEntity dbEntity)
{
this.dbEntity = dbEntity;
}
开发者ID:apache,项目名称:cayenne-modeler,代码行数:5,代码来源:DatabaseEntityTreeViewModel.java
示例14: getValue
import org.apache.cayenne.map.DbEntity; //导入依赖的package包/类
public DbEntity getValue()
{
return dbEntity;
}
开发者ID:apache,项目名称:cayenne-modeler,代码行数:5,代码来源:DatabaseEntityTreeViewModel.java
示例15: resolve
import org.apache.cayenne.map.DbEntity; //导入依赖的package包/类
static Set<DbEntity> resolve(Collection<DbEntity> entities) {
Set<DbEntity> resolved = new HashSet<>();
entities.forEach(e -> resolve(resolved, e));
return resolved;
}
开发者ID:bootique,项目名称:bootique-cayenne,代码行数:6,代码来源:ModelDependencyResolver.java
示例16: resolveDependent
import org.apache.cayenne.map.DbEntity; //导入依赖的package包/类
static private void resolveDependent(Set<DbEntity> resolved, DbRelationship relationship) {
if (relationship.isFromPK() && !relationship.isToMasterPK()) {
resolve(resolved, relationship.getTargetEntity());
}
}
开发者ID:bootique,项目名称:bootique-cayenne,代码行数:6,代码来源:ModelDependencyResolver.java
注:本文中的org.apache.cayenne.map.DbEntity类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论