Class EntityImportPlanJsonBuilderImpl

java.lang.Object
io.jmix.core.impl.importexport.EntityImportPlanJsonBuilderImpl
All Implemented Interfaces:
EntityImportPlanJsonBuilder

@Component("core_EntityImportPlanJsonBuilder") public class EntityImportPlanJsonBuilderImpl extends Object implements EntityImportPlanJsonBuilder
  • Field Details

    • metadataTools

      @Autowired protected MetadataTools metadataTools
    • metadata

      @Autowired protected Metadata metadata
    • accessManager

      @Autowired protected AccessManager accessManager
    • entityImportPlans

      @Autowired protected EntityImportPlans entityImportPlans
  • Constructor Details

    • EntityImportPlanJsonBuilderImpl

      public EntityImportPlanJsonBuilderImpl()
  • Method Details

    • buildFromJson

      public EntityImportPlan buildFromJson(String json, MetaClass metaClass)
      Description copied from interface: EntityImportPlanJsonBuilder
      Builds an EntityImportPlan that contains all fields that are presented in the JSON object.

      All references will be added to the plan as a ReferenceImportBehaviour.ERROR_ON_MISSING behavior. All references that have a @Composition annotation will be added to the plan with a property that has a EntityImportPlanProperty. This means that compositions will be persisted during the import. Absent collection items will be removed from the database.

      For many-to-many association items corresponding entities will be searched in the database. If any of them is missing, an error will be thrown. Absent collection members will be excluded from the many-to-many association.

      Specified by:
      buildFromJson in interface EntityImportPlanJsonBuilder
      Parameters:
      json - a string that represents a JSON object
      metaClass - a MetaClass of the entity
      Returns:
      an EntityImportPlan
    • buildFromJsonObject

      protected EntityImportPlan buildFromJsonObject(com.google.gson.JsonObject jsonObject, MetaClass metaClass)
    • buildFromJsonArray

      protected EntityImportPlan buildFromJsonArray(com.google.gson.JsonArray jsonArray, MetaClass metaClass)
      Builds an EntityImportPlan that contains properties from all collection members. If the first member contains the property A, and the second one contains a property B then a result import plan will contain both properties A and B. Plans for nested collections (2nd level compositions) are also merged.
      Parameters:
      jsonArray - a JsonArray
      metaClass - a metaClass of entities that are in the jsonArray
      Returns:
      an EntityImportPlan
    • mergeImportPlans

      protected EntityImportPlan mergeImportPlans(@Nullable EntityImportPlan plan1, @Nullable EntityImportPlan plan2)
      Recursively merges two import plans. The result import plan will contain all fields that are defined either in plan1 or in plan2.