ch.claudio.contactdb
Class Model

java.lang.Object
  extended by ch.claudio.contactdb.Model

public class Model
extends java.lang.Object

The model will contain all procedures to be called from the different views.

I switched in the early phase from using a traditional SQL database to db4o. Beeing this the first project where I use an object database, and as with an object database you just store your instances instead of having to create SQL statements, I refreined of having a special class for handling the databse. This, because in my first attempt at an object db design I would not know yet, where the separation line between this and the DBInterface module would be.

The structure of the database is defined through the classes in the ch.claudio.contactdb.data package.

Copyright (C) 2005-2006 Claudio Nieder <private@claudio.ch>, CH-8610 Uster

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

Version:
$Id: Model.java 181 2007-04-18 14:53:43Z claudio $
Author:
Claudio Nieder

Field Summary
static java.lang.String dbname
          Name of the database file
 
Constructor Summary
Model()
           
 
Method Summary
 java.util.List<Address> addAddress(Address addr)
          Test it the person ist not yet stored in the database and add it..
 java.util.List<Message> addMessage(Message msg)
          Test with the help of a digest, if the message was already added to the database.
 java.util.List<Person> addPerson(Person pers)
          Test it the person ist not yet stored in the database and add it..
 java.util.List<Place> addPlace(Place place)
          Test it the person ist not yet stored in the database and add it..
 java.util.Vector<java.lang.String> getPersonNames()
          Generate a list of the names of all persons.
static void main(java.lang.String[] args)
          Print license.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dbname

public static final java.lang.String dbname
Name of the database file

Constructor Detail

Model

public Model()
Method Detail

addMessage

public java.util.List<Message> addMessage(Message msg)
Test with the help of a digest, if the message was already added to the database. If not, add it.

Parameters:
msg - Message text
Returns:
List of messages with same digest found in the database.

addPlace

public java.util.List<Place> addPlace(Place place)
Test it the person ist not yet stored in the database and add it..

Parameters:
place - Person object
Returns:
List of persons with same digest found in the database.

addPerson

public java.util.List<Person> addPerson(Person pers)
Test it the person ist not yet stored in the database and add it..

Parameters:
pers - Person object
Returns:
List of persons with same digest found in the database.

addAddress

public java.util.List<Address> addAddress(Address addr)
Test it the person ist not yet stored in the database and add it..

Parameters:
addr - Person object
Returns:
List of persons with same digest found in the database.

getPersonNames

public java.util.Vector<java.lang.String> getPersonNames()
Generate a list of the names of all persons.

Returns:
name list

main

public static void main(java.lang.String[] args)
Print license.

Parameters:
args - ignored