protected Collection filterCommittedInstances(Set<Entity> instances) { return instances.stream() .filter(entity -> !getMetadataTools().isEmbeddable(entity.getClass())) .collect(Collectors.toList()); }
/** * @return table name for the given entity, or null if the entity is Embeddable, MappedSuperclass or non-persistent */ @Nullable public String getDatabaseTable(MetaClass metaClass) { if (isEmbeddable(metaClass) || !isPersistent(metaClass)) return null; Class<?> javaClass = metaClass.getJavaClass(); javax.persistence.Table annotation = javaClass.getAnnotation(javax.persistence.Table.class); if (annotation != null && StringUtils.isNotEmpty(annotation.name())) { return annotation.name(); } else if (metaClass.getAncestor() != null) { return getDatabaseTable(metaClass.getAncestor()); } return null; }
protected JsonObject serializeEntity(Entity entity, @Nullable View view, Set<Entity> cyclicReferences) { JsonObject jsonObject = new JsonObject(); MetaClass metaClass = entity.getMetaClass(); if (!metadataTools.isEmbeddable(metaClass)) { jsonObject.addProperty(ENTITY_NAME_PROP, metaClass.getName()); if (serializeInstanceName) {
|| metadataTools.isEmbeddable(effectiveMetaClass) || effectiveMetaClass.getProperties().isEmpty()) { return false;
@Override public boolean isEntityAttrUpdatePermitted(MetaPropertyPath mpp) { MetaClass propertyMetaClass = metadata.getTools().getPropertyEnclosingMetaClass(mpp); if (metadata.getTools().isEmbeddable(propertyMetaClass)) { return isEntityOpPermitted(propertyMetaClass, EntityOp.UPDATE) && isEntityAttrPermitted(propertyMetaClass, mpp, EntityAttrAccess.MODIFY); } return (isEntityOpPermitted(propertyMetaClass, EntityOp.CREATE) || isEntityOpPermitted(propertyMetaClass, EntityOp.UPDATE)) && isEntityAttrPermitted(propertyMetaClass, mpp, EntityAttrAccess.MODIFY); }
protected void addParentsToNested() { if (parentDs == null || getDsContext() == parentDs.getDsContext()) { return; } // Iterate through all datasources in the same DsContext for (Datasource sibling : getDsContext().getAll()) { // If the datasource is a property datasource of the Child if (sibling instanceof NestedDatasource && ((NestedDatasource) sibling).getMaster().equals(this) && !metadata.getTools().isEmbeddable(sibling.getMetaClass())) { // Look for corresponding property datasource in the Parent's DsContext for (Datasource siblingOfParent : parentDs.getDsContext().getAll()) { if (siblingOfParent instanceof NestedDatasource && ((NestedDatasource) siblingOfParent).getProperty().equals(((NestedDatasource) sibling).getProperty()) && ((NestedDatasource) siblingOfParent).getMaster() == parentDs) { // If such corresponding datasource found, set it as a parent for our property datasource ((DatasourceImplementation) sibling).setParent(siblingOfParent); } } } } }
@Override protected boolean isLoadedSpecificCheck(Object entity, String property, MetaClass metaClass, MetaProperty metaProperty) { if (metadataTools.isEmbeddable(metaClass) || (entity instanceof BaseGenericIdEntity && BaseEntityInternalAccess.isNew((BaseGenericIdEntity) entity))) { //TODO eude: // this is workaround for unexpected EclipseLink behaviour when PersistenceUnitUtil.isLoaded // throws exception if embedded entity refers to persistent entity return checkIsLoadedWithGetter(entity, property); } if (!metadataTools.isPersistent(metaClass)) { return checkIsLoadedWithGetter(entity, property); } EntityManagerFactory jpaEmf = ((PersistenceImpl) persistence).getJpaEmf(metadataTools.getStoreName(metaClass)); return jpaEmf.getPersistenceUnitUtil().isLoaded(entity, property); } }
if ((metaTools.isEmbeddable(effectiveMetaClass) || metaTools.isPersistent(effectiveMetaClass)) && PersistenceHelper.isNew(instance)) { includeParam("table.showInfoAction.state", messages.getMessage(getClass(), "table.showInfoAction.isNew")); if (metaTools.isEmbeddable(effectiveMetaClass)) { includeParam("table.showInfoAction.specificInstance", messages.getMessage(getClass(), "table.showInfoAction.embeddableInstance")); } else if (!metaTools.isPersistent(effectiveMetaClass)) {
if (metadataTools.isEmbeddable(field.getMetaProperty().getDomain())) { fieldDs = datasources.get(field.getParentFqn());
MetaClass metaMetaClass = masterDs.getMetaClass(); if (metadata.getTools().isPersistent(metaMetaClass) || metadata.getTools().isEmbeddable(metaMetaClass)) { View masterView = masterDs.getView(); if (masterView == null) {