All Superinterfaces:
Comparable<StoreElement>, HistoryProvider, IDProvider, PackagePoolItem, StoreElement, TemplateStoreElement, Workflowable

public interface Schema extends TemplateStoreElement, PackagePoolItem
Definition of a database schema description.
Since:
3.0
  • Field Details

  • Method Details

    • getSession

      @NotNull @NotNull Session getSession()
      Returns the current or session Same as getSession(false).
      Since:
      3.0
    • getSession

      @NotNull @NotNull Session getSession(boolean release)
      Returns the or session. Use true to get the release or session, false to get the current or session.
      Since:
      4.0
    • getOrSchema

      Schema getOrSchema()
      The database schema.
      Returns:
      The database schema.
      Since:
      4.0.52
    • setOrSchema

      void setOrSchema(Schema orSchema)
      Set the database schema.
      Parameters:
      orSchema - The database schema to set.
      Since:
      4.0.52
    • getLayer

      String getLayer()
      Provides the layer name for this schema.
      Returns:
      The layer name.
      Since:
      4.0.24
    • setLayer

      void setLayer(@Nullable @Nullable String layerName)
      Set the database layer to use for this schema. Simplified usage example:
        String newLayer = ...;
        String dbSchemaName = ...;
        schema.setLock(true, false);
        schema.setLayer(newLayer);
        schema.StoreElement.save(); // sync layer information
        de.espirit.or.schema.Schema orSchema = schema.getOrSchema();
        orSchema.setName(dbSchemaName);
        schema.setOrSchema(orSchema);
        schema.StoreElement.save(); // sync database information
        schema.setLock(false, false);
       
      Ensure the layer specified by given layerName exists in the belonging project.
      Parameters:
      layerName - The layer name
      Since:
      5.0.313
      See Also:
    • getLayout

      String getLayout() throws IOException
      Provides the type of the layout used for arranging the schema's entries.
      Returns:
      The layout type.
      Throws:
      IOException
      Since:
      3.0
    • setLayout

      void setLayout(String value) throws IOException
      Defines the type of the layout used for arranging the schema's entries.
      Parameters:
      value - The layout type.
      Throws:
      IOException
      Since:
      3.0
    • addTableTemplate

      TableTemplate addTableTemplate(EntityType table, String uidSuggestion) throws LockException, ElementDeletedException
      Creates and adds a table template based on this schema's definition to the store.
      Parameters:
      table - The table type.
      uidSuggestion - The suggested UID.
      Returns:
      The created Template.
      Throws:
      LockException - if a required lock could not be acquired.
      ElementDeletedException - if the schema no longer exists.
      Since:
      3.0
    • createTableTemplate

      TableTemplate createTableTemplate(EntityType entityType, String uidSuggestion, boolean unifyUidOnServer) throws LockException, ElementDeletedException
      Creates a table template under this schema for the given entity type. Use unifyUidOnServer == true to unify uid on the server. Otherwise a DuplicateReferenceNameException will be thrown if a table template with the given uid already exists on the server.
      Parameters:
      entityType - the entity type to create the table template for (see getOrSchema().getEntityType(String)).
      uidSuggestion - the suggestion for the uid for the created table template
      unifyUidOnServer - indicates wether the given uid should be unified on the server or not
      Returns:
      the new table template
      Throws:
      LockException - if this schema is locked on the server in a different session
      DuplicateReferenceNameException - if a table template with the given uid already exists for this schema and param unifyUidOnServer == false
      ElementDeletedException - if this schema is already deleted on the server.
      Since:
      4.0
      See Also:
    • addQuery

      Creates and adds a query based on this schema's definition to the store.
      Parameters:
      uid - The desired UID.
      Returns:
      The created query.
      Throws:
      IOException - if accessing the schema failed.
      LockException - if a required lock could not be acquired.
      ElementDeletedException - if the schema no longer exists.
      Since:
      3.0
    • createQuery

      Query createQuery(String uidSuggestion, boolean unifyUidOnServer) throws LockException, ElementDeletedException
      Creates a new query under this schema with the given uidSuggestioni. Use unifyUidOnServer == true to unify uid on the server. Otherwise a DuplicateReferenceNameException will be thrown if a query or table template with the given uid already exists on the server.
      Parameters:
      uidSuggestion - the suggestion for the uid for the created table template
      unifyUidOnServer - indicates wether the given uid should be unified on the server or not
      Returns:
      the new query
      Throws:
      LockException - if this schema is locked on the server in a different session
      DuplicateReferenceNameException - if a query with the given uid already exists for this schema and param unifyUidOnServer == false
      ElementDeletedException
      Since:
      4.0
    • isReadOnly

      boolean isReadOnly()
      Indicates the schema to be in read only mode.
      Returns:
      true, if read only.
      Since:
      3.0
    • isSyncable

      boolean isSyncable()
      Indicates the schema to be syncable.
      Returns:
      true, if syncable.
      Since:
      3.0.110
    • getIncomingReferences

      @NotNull @NotNull ReferenceEntry[] getIncomingReferences(Entity entity)
      Returns current incoming references of the given entity.
      Parameters:
      entity - data object
      Returns:
      current incoming references.
      Since:
      4.0
    • getIncomingReferences

      @NotNull @NotNull ReferenceEntry[] getIncomingReferences(Entity entity, boolean release)
      Returns current or release incoming references of the given entity.
      Parameters:
      entity - data object
      release - current or release references.
      Returns:
      current incoming references.
      Since:
      4.0.120
    • getOutgoingReferences

      @NotNull @NotNull ReferenceEntry[] getOutgoingReferences(Entity entity)
      Returns current outgoing references of the given entity.
      Parameters:
      entity - data object
      Returns:
      current outgoing references.
      Since:
      4.0
    • getOutgoingReferences

      @NotNull @NotNull ReferenceEntry[] getOutgoingReferences(Entity entity, boolean release)
      Returns current or release outgoing references of the given entity.
      Parameters:
      entity - data object
      release - current or release references.
      Returns:
      current outgoing references.
      Since:
      4.0.120
    • resetReadTimestamp

      void resetReadTimestamp()
      Resest the read timestamp of the sessions so that external changes in the database become visible.
      Since:
      4.2.401