ch.agent.crnickl.jdbc
Class WriteMethodsForSchema

java.lang.Object
  extended by ch.agent.crnickl.impl.DatabaseMethodsImpl
      extended by ch.agent.crnickl.jdbc.JDBCDatabaseMethods
          extended by ch.agent.crnickl.jdbc.ReadMethodsForSchema
              extended by ch.agent.crnickl.jdbc.WriteMethodsForSchema
All Implemented Interfaces:
ch.agent.crnickl.impl.DatabaseMethods, ch.agent.crnickl.impl.PermissionChecker

public class WriteMethodsForSchema
extends ReadMethodsForSchema

A stateless object with methods providing write access to schemas.

Version:
1.0.0
Author:
Jean-Paul Vetterli

Nested Class Summary
 
Nested classes/interfaces inherited from class ch.agent.crnickl.jdbc.ReadMethodsForSchema
ReadMethodsForSchema.RawSchema
 
Constructor Summary
WriteMethodsForSchema()
           
 
Method Summary
 void createSchema(ch.agent.crnickl.impl.UpdatableSchemaImpl schema, ch.agent.crnickl.api.Schema base)
          Create an empty schema in the database.
 void createSchemaComponent(ch.agent.crnickl.api.UpdatableSchema schema, int seriesNr, String description, ch.agent.crnickl.api.AttributeDefinition<?> def)
          Create an attribute definition in the database.
 void deleteSchema(ch.agent.crnickl.impl.UpdatableSchemaImpl schema, ch.agent.crnickl.impl.SchemaUpdatePolicy policy)
          Delete a schema from the database.
 void deleteSchemaComponent(ch.agent.crnickl.api.UpdatableSchema schema, int seriesNr, int attribNr)
          Delete an attribute definition from the database.
 void deleteSchemaComponents(ch.agent.crnickl.api.UpdatableSchema schema, int seriesNr)
          Delete a series definition from the database.
 Collection<ch.agent.crnickl.api.Surrogate> findChronicles(Collection<ch.agent.crnickl.api.UpdatableSchema> schemas)
          Find all chronicles referencing one of the schemas.
 Collection<ch.agent.crnickl.api.Surrogate> findChronicles(ch.agent.crnickl.api.Property<?> property, Collection<ch.agent.crnickl.api.UpdatableSchema> schemas)
          Find all chronicles with an explicit attribute value for a given property and schemas.
 Collection<ch.agent.crnickl.api.Surrogate> findChronicles(ch.agent.crnickl.api.SeriesDefinition ss, Collection<ch.agent.crnickl.api.UpdatableSchema> schemas)
          Find all chronicles with actual series in a collection of schemas.
 boolean updateSchema(ch.agent.crnickl.api.UpdatableSchema schema, ch.agent.crnickl.api.UpdatableSchema base, String name)
          Update the basic schema setup in the database.
 void updateSchemaComponent(ch.agent.crnickl.api.UpdatableSchema schema, int seriesNr, String description, ch.agent.crnickl.api.AttributeDefinition<?> def)
          Update an attribute definition in the database.
 
Methods inherited from class ch.agent.crnickl.jdbc.ReadMethodsForSchema
getRawSchema, getSchema, getSchemaSurrogateList
 
Methods inherited from class ch.agent.crnickl.jdbc.JDBCDatabaseMethods
close, executeAndGetNewId, open, open, open
 
Methods inherited from class ch.agent.crnickl.impl.DatabaseMethodsImpl
check, check, check, check, getId, getId, getIdOrZero, makeSurrogate, makeSurrogate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WriteMethodsForSchema

public WriteMethodsForSchema()
Method Detail

createSchema

public void createSchema(ch.agent.crnickl.impl.UpdatableSchemaImpl schema,
                         ch.agent.crnickl.api.Schema base)
                  throws ch.agent.crnickl.T2DBException
Create an empty schema in the database. Throw an exception if the operation cannot be done.

Parameters:
schema - a schema
base - a base schema or null
Throws:
ch.agent.crnickl.T2DBException

deleteSchema

public void deleteSchema(ch.agent.crnickl.impl.UpdatableSchemaImpl schema,
                         ch.agent.crnickl.impl.SchemaUpdatePolicy policy)
                  throws ch.agent.crnickl.T2DBException
Delete a schema from the database. Throw an exception if the operation cannot be done.

Parameters:
schema - a schema
policy - a schema udpdating policy
Throws:
ch.agent.crnickl.T2DBException

createSchemaComponent

public void createSchemaComponent(ch.agent.crnickl.api.UpdatableSchema schema,
                                  int seriesNr,
                                  String description,
                                  ch.agent.crnickl.api.AttributeDefinition<?> def)
                           throws ch.agent.crnickl.T2DBException
Create an attribute definition in the database. Throw an exception if the operation cannot be done.

Parameters:
schema - a schema
seriesNr - a series number
description - a string
def - an attribute definition
Throws:
ch.agent.crnickl.T2DBException

updateSchema

public boolean updateSchema(ch.agent.crnickl.api.UpdatableSchema schema,
                            ch.agent.crnickl.api.UpdatableSchema base,
                            String name)
                     throws ch.agent.crnickl.T2DBException
Update the basic schema setup in the database. Throw an exception if the operation cannot be done.

Parameters:
schema - a schema
base - a base schema
name - a string
Returns:
true if the schema was updated
Throws:
ch.agent.crnickl.T2DBException

deleteSchemaComponent

public void deleteSchemaComponent(ch.agent.crnickl.api.UpdatableSchema schema,
                                  int seriesNr,
                                  int attribNr)
                           throws ch.agent.crnickl.T2DBException
Delete an attribute definition from the database. Throw an exception if the operation cannot be done.

Parameters:
schema - a schema
seriesNr - a series number
attribNr - an attribute number
Throws:
ch.agent.crnickl.T2DBException

deleteSchemaComponents

public void deleteSchemaComponents(ch.agent.crnickl.api.UpdatableSchema schema,
                                   int seriesNr)
                            throws ch.agent.crnickl.T2DBException
Delete a series definition from the database. Throw an exception if the operation cannot be done.

Parameters:
schema - a schema
seriesNr - a series number
Throws:
ch.agent.crnickl.T2DBException

updateSchemaComponent

public void updateSchemaComponent(ch.agent.crnickl.api.UpdatableSchema schema,
                                  int seriesNr,
                                  String description,
                                  ch.agent.crnickl.api.AttributeDefinition<?> def)
                           throws ch.agent.crnickl.T2DBException
Update an attribute definition in the database. Throw an exception if the operation cannot be done.

Parameters:
schema - a schema
seriesNr - a series number
description - a string
def - an attribute definition
Throws:
ch.agent.crnickl.T2DBException

findChronicles

public Collection<ch.agent.crnickl.api.Surrogate> findChronicles(Collection<ch.agent.crnickl.api.UpdatableSchema> schemas)
                                                          throws ch.agent.crnickl.T2DBException
Find all chronicles referencing one of the schemas. This looks like a "reading" method but is used in the context of schema updating.

Parameters:
schemas - a collection of schemas
Returns:
a collection of chronicle surrogates
Throws:
ch.agent.crnickl.T2DBException

findChronicles

public Collection<ch.agent.crnickl.api.Surrogate> findChronicles(ch.agent.crnickl.api.Property<?> property,
                                                                 Collection<ch.agent.crnickl.api.UpdatableSchema> schemas)
                                                          throws ch.agent.crnickl.T2DBException
Find all chronicles with an explicit attribute value for a given property and schemas. This looks like a "reading" method but is used in the context of schema updating.

Parameters:
property - a property
schemas - a collection of schemas
Returns:
a collection of chronicle surrogates
Throws:
ch.agent.crnickl.T2DBException

findChronicles

public Collection<ch.agent.crnickl.api.Surrogate> findChronicles(ch.agent.crnickl.api.SeriesDefinition ss,
                                                                 Collection<ch.agent.crnickl.api.UpdatableSchema> schemas)
                                                          throws ch.agent.crnickl.T2DBException
Find all chronicles with actual series in a collection of schemas. This looks like a "reading" method but is used in the context of schema updating.

Parameters:
ss - a series definition
schemas - a collection of schemas
Returns:
a collection of chronicle surrogates
Throws:
ch.agent.crnickl.T2DBException


Copyright © 2012. All Rights Reserved.