An Object Database Web Implementation in Jasmine

Classes


  1. Abstraction Class
  2. Product Class
  3. Division Class
  4. Flavor Class
  5. Person Class
  6. Employee Class
  7. Customer Class
  8. Discussion Class
  9. Reply Class
  10. Demo Class
  11. Project Class

In an object database there are both class and instance level properties and methods. A class level method is applied to all the instances (objects) of a class and an instance method is applied to a single instance (object) of that class.

At first glance there will appear to be a large amount of complexity in this code. However, most of this code is embedding all database access into the database objects. This means that in order to access the database that simple object method calls are required. This particular example forms a hierarchical tree structure when filled with objects. This is important to note since once the root object is found all objects within that root object can be found from within their respective parent objects by scanning of included collection objects; class level methods are and always should be rarely used in database selection.

Jasmine will allow the packaging of classes into class families. There is no direct database object communication between class families by use of inheritance. The only link between class families is by instantiation of the objects from the classes into one class family from another. Class families tend to reduce confusion and complexity by effectively grouping related things into class families. Oracle or Java packages are generally the equivalent of Jasmine object database class families.

Abstraction Class

defaultCF clientCF;
defineClass Abstraction
{
	instance:
		String			name	mandatory:;
		mediaCF::MMFile		logo	default: NIL;
		Boolean	checkName	(String name := "");
		Bag<String> getText	(String filename := "");
		String displayDate	(Date d := NIL);
		String patternMatch	(String name);
		Boolean empty		();
};
buildClass clientCF::Abstraction;

Product Class

defaultCF clientCF;
defineClass Product super: Abstraction
{
	class:
		Product getProduct		(String name, Boolean IsUnique := TRUE);
		Bag<Product> getProducts	();
		Void addProduct			(String name, mediaCF::MMFile logo, String version, String caption, String quote, mediaCF::Text str, mediaCF::MMFile picture, Boolean InFocus, Bag<Flavor> flavors, Bag<Division> divisions, Bag<Demo> demos);
		Void changeProduct		(String fName := "", String tName := "", mediaCF::MMFile logo, String version, String caption, String quote, mediaCF::Text str, mediaCF::MMFile picture, Boolean InFocus, Bag<Flavor> flavors, Bag<Division> divisions, Bag<Demo> demos);
		Void deleteProduct		(String name);
		Bag<String> getText		(String filename, String name, Boolean IsUnique);
	instance:
		String				version		default: "";
		String				caption		default: "";
		String				quote		default: "";
		mediaCF::Text			str		default: NIL;
		mediaCF::MMFile			picture		default: NIL;
		Boolean				InFocus		default: FALSE;
		Bag<Flavor>			flavors		default: NIL;
		Bag<Division>			divisions	default: NIL;
		Bag<Demo>			demos		default: NIL;
		String getManagementType	();
		Flavor getFlavor 		(String name);
		Division getDivision 		(String name);
		Demo getDemo 			(String name);
		Void changeProduct 		(String name, mediaCF::MMFile logo, String version, String caption, String quote, mediaCF::Text str, mediaCF::MMFile picture, Boolean InFocus, Bag<Flavor> flavors, Bag<Division> divisions, Bag<Demo> demos);
		Boolean empty			();
		Boolean noFlavors		();
		Boolean noDivisions		();
		Boolean noDemos			();
};

Division Class

defaultCF clientCF;
defineClass Division super: Abstraction
{
	class:
		Division getDivision		(String name, Boolean IsUnique := TRUE);
		Bag<Division> getDivisions	();
		Void addDivision		(String name, mediaCF::MMFile logo, mediaCF::Text str, mediaCF::MMFile picture, Bag<Division> divisions);
		Void changeDivision		(String fName := "", String tName := "", mediaCF::MMFile logo, mediaCF::Text str, mediaCF::MMFile picture, Bag<Division> divisions);
		Void deleteDivision		(String name);
	instance:
		mediaCF::Text			str		default: NIL;
		mediaCF::MMFile			picture		default: NIL;
		Bag<Division>			divisions	default: NIL;
		Division getDivision		(String name);
		Void changeDivision		(String name, mediaCF::MMFile logo, mediaCF::Text str, mediaCF::MMFile picture, Bag<Division> divisions);
		Boolean empty			();
		Boolean noDivisions		();
};
buildClass clientCF::Division;

Flavor Class

defineClass Flavor super: Product
{
	class:
		Flavor getFlavor 		(String name, Boolean IsUnique := TRUE);
		Bag<Flavor> getFlavors 		();
		Void addFlavor			(String name, mediaCF::MMFile logo, String version, String caption, String quote, mediaCF::Text str, mediaCF::MMFile picture, Boolean InFocus, Bag<Flavor> flavors, Bag<Division> divisions, Boolean enterpriseManagement, Boolean informationManagement);
		Void changeFlavor		(String fName := "", String tName := "", mediaCF::MMFile logo, String version, String caption, String quote, mediaCF::Text str, mediaCF::MMFile picture, Boolean InFocus, Bag<Flavor> flavors, Bag<Division> divisions, Boolean enterpriseManagement, Boolean informationManagement);
		Void deleteFlavor		(String name);
	instance:	
		Boolean				enterpriseManagement	default: FALSE;
		Boolean				informationManagement	default: FALSE;
		String getManagementType	();
		Void changeFlavor 		(String name, mediaCF::MMFile logo, String version, String caption, String quote, mediaCF::Text str, mediaCF::MMFile picture, Boolean InFocus, Bag<Flavor> flavors, Bag<Division> divisions, Boolean enterpriseManagement, Boolean informationManagement);
		Boolean empty			();
};

buildClass clientCF::Product;
buildClass clientCF::Flavor;

Person Class

defaultCF clientCF;
defineClass Person super: Abstraction
{
	class:
		Person getPerson		(String name, Boolean IsUnique := TRUE);
		Bag<Person> getPersons		();
		Void addPerson			(String name, mediaCF::MMFile logo, String title, String address, String phone, String email, mediaCF::MMFile picture);
		Void changePerson		(String fName := "", String tName := "", mediaCF::MMFile logo, String title, String address, String phone, String email, mediaCF::MMFile picture);
		Void deletePerson		(String name);
	instance:
		String				title	default: "";
		String				address	default: "";
		String				phone	default: "";
		String				email	default: "";
		mediaCF::MMFile			picture	default: NIL;
		Void changePerson		(String name, mediaCF::MMFile logo, String title, String address, String phone, String email, mediaCF::MMFile picture);
		Boolean empty			();
};

Employee Class

defineClass Employee super: Person
{
	class:
		Employee getEmployee		(String name, Boolean IsUnique := TRUE);
		Bag<Employee> getEmployees	();
		Void addEmployee		(String name, mediaCF::MMFile logo, String title, String address, String phone, String email, mediaCF::MMFile picture, Bag<Project> projects, Bag<Product> products);
		Void changeEmployee		(String fName := "", String tName := "", mediaCF::MMFile logo, String title, String address, String phone, String email, mediaCF::MMFile picture, Bag<Project> projects, Bag<Product> products);
		Void deleteEmployee		(String name);
	instance:
		Bag<Project>			projects default: NIL;
		Bag<Product>			products default: NIL;
		Project getProject		(String name);
		Product getProduct		(String name);
		Void changeEmployee		(String name, mediaCF::MMFile logo, String title, String address, String phone, String email, mediaCF::MMFile picture, Bag<Project> projects, Bag<Product> products);
		Boolean empty			();
		Boolean noProjects		();
		Boolean noProducts		();
};

Customer Class

defineClass Customer super: Person
{
	class:
		Customer getCustomer		(String name, Boolean IsUnique := TRUE);
		Bag<Customer> getCustomers	();
		Void addCustomer		(String name, mediaCF::MMFile logo, String title, String address, String phone, String email, mediaCF::MMFile picture, Bag<Project> projects, Bag<Product> products);
		Void changeCustomer		(String fName := "", String tName := "", mediaCF::MMFile logo, String title, String address, String phone, String email, mediaCF::MMFile picture, Bag<Project> projects, Bag<Product> products);
		Void deleteCustomer		(String name);
	instance:
		Bag<Project>			projects default: NIL;
		Bag<Product>			products default: NIL;
		Project getProject		(String name);
		Product getProduct		(String name);
		Void changeCustomer		(String name, mediaCF::MMFile logo, String title, String address, String phone, String email, mediaCF::MMFile picture, Bag<Project> projects, Bag<Product> products);
		Boolean empty			();
		Boolean noProjects		();
		Boolean noProducts		();
};

buildClass clientCF::Person;
buildClass clientCF::Employee;
buildClass clientCF::Customer;

Discussion Class

defaultCF clientCF;
defineClass Discussion super: Abstraction
{
	class:
		Bag<Discussion>	getDiscussions	();
		Bag<Discussion>	getSubsetByName	(String name);
		Bag<Discussion>	getSubsetByDate	(Date dte);
		Void addDiscussion		(String name, mediaCF::MMFile logo, mediaCF::Text question := NIL, Bag<Reply> replies := NIL);
	instance:
		Date				booked		default: NIL;
		mediaCF::Text			question	default: NIL;
		Bag<Reply> 			replies		default: NIL;
		Boolean empty			();
		Boolean noReplies		();
};
buildClass clientCF::Discussion;

Reply Class

defaultCF clientCF;
defineClass Reply super: Abstraction
{
	class:
		Bag<Reply> getReplies 	();
		Bag<Reply> getSubset	(String name);
		Void addReply 		(String name, mediaCF::MMFile logo, mediaCF::Text reply:=NIL, String prize:="", String prizeDescription:="");
	instance:
		mediaCF::Text		reply			default: NIL;
		String			prize			default: "";
		String			prizeDescription	default: "";
		Boolean empty		();
	Bag<instance>:
		Bag<Reply> getSubset	(String name);
};
buildClass clientCF::Reply;

Demo Class

defaultCF clientCF;
defineClass Demo super: Abstraction
{
	class:
		Demo getDemo		(String name, Boolean IsUnique := TRUE);
		Bag<Demo> getDemos	();
		Void addDemo		(String name, mediaCF::MMFile logo, mediaCF::Video video, mediaCF::Audio audio);
		Void changeDemo		(String fName := "", String tName := "", mediaCF::MMFile logo, mediaCF::Video video, mediaCF::Audio audio);
		Void deleteDemo		(String name);
	instance:
		mediaCF::Video		video	default: NIL;
		mediaCF::Audio		audio	default: NIL;
		Void changeDemo		(String name, mediaCF::MMFile logo, mediaCF::Video video, mediaCF::Audio audio);
		String mediaType	();
};
buildClass clientCF::Demo;

Project Class

defaultCF clientCF;
defineClass Project super: Abstraction
{
	class:
		Project getProject		(String name, Boolean IsUnique := TRUE);
		Bag<Project> getProjects	();
		Void addProject			(String name, mediaCF::MMFile logo, mediaCF::Text responsibility, mediaCF::Text contribution);
		Void changeProject		(String fName := "", String tName := "", mediaCF::MMFile logo, mediaCF::Text responsibility, mediaCF::Text contribution);
		Void deleteProject		(String name);
	instance:
		mediaCF::Text			responsibility	default: NIL;
		mediaCF::Text			contribution	default: NIL;
		Void changeProject		(String name, mediaCF::MMFile logo, mediaCF::Text responsibility, mediaCF::Text contribution);
		Boolean empty			();
};
buildClass clientCF::Project;