An Object Database Web Implementation in Jasmine

Methods


  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

Abstraction Class

defaultCF clientCF;

defineProcedure Boolean Abstraction::instance:checkName (String name)
{
	$defaultCF clientCF;

	$if (name != "")
	{
		$name = name.subString (1, name.length() - 1);
		$name = name.subString (0, name.length() - 1);
		$if (name == self.name)
		{
			$return (TRUE);
		};
	};
	$return (FALSE);	
};

defineProcedure String Abstraction::instance:displayDate (Date d)
	language: "c++"
{
	$defaultCF clientCF;

	$return (d.convertToString());
};

defineProcedure String Abstraction::instance:patternMatch (String name)
	language: "c++"
{
	$defaultCF clientCF;
	$String pattern;

	$pattern = "*";
	$pattern = pattern.stringCat (name);
	$pattern = pattern.stringCat ("*");
	$return (pattern);
};

defineProcedure Boolean Abstraction::instance:empty ()
	language: "c++"
{
	$defaultCF clientCF;

	$if (self.name != "" or self.logo != NIL)
	{
		$return (FALSE);
	};
	$return (TRUE);
};

Product Class

defaultCF clientCF;

defineProcedure Product Product::class:getProduct (String name, Boolean IsUnique)
	language: "c++"
{
	$defaultCF clientCF;
	$Bag<Product> ps;
	$Product p;

	$ps = Product from Product alone where Product.name == name;
	$if (ps.count() != 0)
	{
		$if (IsUnique == TRUE)
		{
			$p = ps.unique();
		};
		$return (p);
	};
	$return (NIL);
};

defineProcedure Bag<Product> Product::class:getProducts()
	language: "c++"
{
	$defaultCF clientCF;
	$Bag<Product> ps;

	$ps = Product from Product alone;
	$if (ps.count() != 0)
	{
		$return (ps);
	};
	$return (NIL);
};

defineProcedure Void Product::class: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)
	language: "c++"
{
	$defaultCF clientCF;
	
	$self.new (name := name, logo := logo, version := version, caption := caption, quote := quote, str := str, picture := picture, InFocus := InFocus, flavors := flavors, divisions := divisions, demos := demos);
	$return;
};

defineProcedure Void Product::class: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)
	language: "c++"
{
	$defaultCF clientCF;
	$Product p;

	$if (fName != "" and tName != "")
	{
		$p = Product.getProduct (fName, TRUE);
		$if (p != NIL)
		{
			$p.changeProduct (tName, logo, version, caption, quote, str, picture, InFocus, flavors, divisions, demos);
		};
	};
	$return;
};

defineProcedure Void Product::class:deleteProduct (String name)
	language: "c++"
{
	$defaultCF clientCF;
	$Product p;

	$p = Product.getProduct (name, TRUE);
	$if (p != NIL)
	{
		$p.delete();
	};
	$return;
};

defineProcedure Bag<String> Product::class:getText (String filename, String name, Boolean IsUnique)
	language: "c++"
{
	$defaultCF clientCF;
	$Product p;

	$p = Product.getProduct (name, IsUnique);
	$if (p != NIL)
	{
		$return (p.getText (filename));
	};
	$return (NIL);
};

defineProcedure String Product::instance:getManagementType ()
	language: "c++"
{
	$defaultCF clientCF;

	$return ("");
};

defineProcedure Flavor Product::instance:getFlavor (String name)
	language: "c++"
{
	$defaultCF clientCF;
	$Bag<Flavor> fs;
	$Flavor f;

	$fs = self.flavors;
	$scan (fs, f)
	{
		$if (name == f.name)
		{
			$return (f);
		};
	};
	$return (NIL);
};

defineProcedure Division Product::instance:getDivision (String name)
	language: "c++"
{
	$defaultCF clientCF;
	$Bag<Division> ds;
	$Division d;

	$ds = self.divisions;
	$scan (ds, d)
	{
		$if (name == d.name)
		{
			$return (d);
		};
	};
	$return (NIL);
};

defineProcedure Demo Product::instance:getDemo (String name)
	language: "c++"
{
	$defaultCF clientCF;
	$Bag<Demo> ds;
	$Demo d;

	$ds = self.demos;
	$scan (ds, d)
	{
		$if (name == d.name)
		{
			$return (d);
		};
	};
	$return (NIL);
};

defineProcedure Void Product::instance: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)
	language: "c++"
{
	$defaultCF clientCF;

	$self.name = name;
	$self.logo = logo;
	$self.version = version;
	$self.caption = caption;
	$self.quote = quote;
	$self.str = str;
	$self.picture = picture;
	$self.InFocus = InFocus;
	$self.flavors = flavors;
	$self.divisions = divisions;
	$self.demos = demos;
	$return;
};

defineProcedure Boolean Product::instance:empty ()
	language: "c++"
{
	$defaultCF clientCF;

	$if (self.version != "" or self.caption != "" or self.quote != "" or self.str != NIL or self.picture != NIL)
	{
		$return (FALSE);
	};
	$if (self.noFlavors () == FALSE)
	{
		$return (FALSE);
	};
	$if (self.noDivisions () == FALSE)
	{
		$return (FALSE);
	};
	$if (self.noDemos () == FALSE)
	{
		$return (FALSE);
	};
	$return (TRUE);
};

defineProcedure Boolean Product::instance:noFlavors ()
	language: "c++"
{
	$defaultCF clientCF;

	$if (self.flavors.count() != NIL)
	{
		$if (self.flavors.count() > 0)
		{
			$return (FALSE);
		};
	};
	$return (TRUE);
};

defineProcedure Boolean Product::instance:noDivisions ()
	language: "c++"
{
	$defaultCF clientCF;

	$if (self.divisions.count() != NIL)
	{
		$if (self.divisions.count() > 0)
		{
			$return (FALSE);
		};
	};
	$return (TRUE);
};

defineProcedure Boolean Product::instance:noDemos ()
	language: "c++"
{
	$defaultCF clientCF;

	$if (self.demos.count() != NIL)
	{
		$if (self.demos.count() > 0)
		{
			$return (FALSE);
		};
	};
	$return (TRUE);

Division Class

defaultCF clientCF;

defineProcedure Division Division::class:getDivision (String name, Boolean IsUnique)
	language: "c++"
{
	$defaultCF clientCF;
	$Bag<Division> ps;
	$Division p;

	$ps = Division from Division alone where Division.name == name;
	$if (ps.count() != 0)
	{
		$if (IsUnique == TRUE)
		{
			$p = ps.unique();
		};
		$return (p);
	};
	$return (NIL);
};

defineProcedure Bag<Division> Division::class:getDivisions()
	language: "c++"
{
	$defaultCF clientCF;
	$Bag<Division> ps;

	$ps = Division from Division alone;
	$if (ps.count() != 0)
	{
		$return (ps);
	};
	$return (NIL);
};

defineProcedure Void Division::class:addDivision (String name, mediaCF::MMFile logo, mediaCF::Text str, mediaCF::MMFile picture, Bag<Division> divisions)
	language: "c++"
{
	$defaultCF clientCF;
	
	$self.new (name := name, logo := logo, str := str, picture := picture, divisions := divisions);
	$return;
};

defineProcedure Void Division::class:changeDivision (String fName, String tName, mediaCF::MMFile logo, mediaCF::Text str, mediaCF::MMFile picture, Bag<Division> divisions)
	language: "c++"
{
	$defaultCF clientCF;
	$Division p;

	$if (fName != "" and tName != "")
	{
		$p = Division.getDivision (fName, TRUE);
		$if (p != NIL)
		{
			$p.changeDivision (tName, logo, str, picture, divisions);
		};
	};
	$return;
};

defineProcedure Void Division::class:deleteDivision (String name)
	language: "c++"
{
	$defaultCF clientCF;
	$Division p;

	$p = Division.getDivision (name, TRUE);
	$if (p != NIL)
	{
		$p.delete();
	};
	$return;
};

defineProcedure Division Division::instance:getDivision (String name)
	language: "c++"
{
	$defaultCF clientCF;
	$Bag<Division> ds;
	$Division d;

	$ds = self.divisions;
	$scan (ds, d)
	{
		$if (name == d.name)
		{
			$return (d);
		};
	};
	$return (NIL);
};

defineProcedure Void Division::instance:changeDivision (String name, mediaCF::MMFile logo, mediaCF::Text str, mediaCF::MMFile picture, Bag<Division> divisions)
	language: "c++"
{
	$defaultCF clientCF;

	$self.name = name;
	$self.logo = logo;
	$self.str = str;
	$self.picture = picture;
	$self.divisions = divisions;
	$return;
};

defineProcedure Boolean Division::instance:empty ()
	language: "c++"
{
	$defaultCF clientCF;

	$if (self.str != NIL or self.picture != NIL)
	{
		$return (FALSE);
	};
	$if (self.noDivisions () == FALSE)
	{
		$return (FALSE);
	};
	$return (TRUE);
};

defineProcedure Boolean Division::instance:noDivisions ()
	language: "c++"
{
	$defaultCF clientCF;

	$if (self.divisions.count() != NIL)
	{
		$if (self.divisions.count() > 0)
		{
			$return (FALSE);
		};
	};
	$return (TRUE);
};

Flavor Class

defineProcedure Flavor Flavor::class:getFlavor (String name, Boolean IsUnique)
	language: "c++"
{
	$defaultCF clientCF;
	$Bag<Flavor> fs;
	$Flavor f;

	$fs = Flavor from Flavor where Flavor.name == name;
	$if (fs.count() != 0)
	{
		$if (IsUnique == TRUE)
		{
			$f = fs.unique();
		};
		$return (f);
	};
	$return (NIL);
};

defineProcedure Bag<Flavor> Flavor::class:getFlavors()
	language: "c++"
{
	$defaultCF clientCF;
	$Bag<Flavor> fs;

	$fs = Flavor from Flavor;
	$if (fs.count() != 0)
	{
		$return (fs);
	};
	$return (NIL);
};

defineProcedure Void Flavor::class: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)
	language: "c++"
{
	$defaultCF clientCF;

	$if (informationManagement != enterpriseManagement)
	{
		$self.new (name := name, logo := logo, version := version, caption := caption, quote := quote, str := str, picture := picture, InFocus := InFocus, flavors := flavors, divisions := divisions, enterpriseManagement := enterpriseManagement, informationManagement := informationManagement);
	};
	$return;
};

defineProcedure Void Flavor::class: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)
	language: "c++"
{
	$defaultCF clientCF;
	$Flavor f;

	$if (fName != "" and tName != "" and informationManagement != enterpriseManagement)
		{
		$f = Flavor.getFlavor (fName, TRUE);
		$if (f != NIL)
		{
			$f.changeFlavor (tName, logo, version, caption, quote, str, picture, InFocus, flavors, divisions, enterpriseManagement, informationManagement);
		};
	};
	$return;
};

defineProcedure Void Flavor::class:deleteFlavor (String name)
	language: "c++"
{
	$defaultCF clientCF;
	$Flavor f;

	$f = Flavor.getFlavor (name, TRUE);
	$if (f != NIL)
	{
		$f.delete();
	};
	$return;
};

defineProcedure String Flavor::instance:getManagementType ()
	language: "c++"
{
	$defaultCF clientCF;

	$if (self.enterpriseManagement == TRUE)
	{
		$return ("Enterprise Management");
	};
	$if (self.informationManagement == TRUE)	
	{
		$return ("Information Management");
	};
	$return ("");
};

defineProcedure Void Flavor::instance: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)
	language: "c++"
{
	$defaultCF clientCF;

	$if (informationManagement != enterpriseManagement)
	{
		$self.name = name;
		$self.logo = logo;
		$self.version = version;
		$self.caption = caption;
		$self.quote = quote;
		$self.str = str;
		$self.picture = picture;
		$self.InFocus = InFocus;
		$self.flavors = flavors;
		$self.divisions = divisions;
		$self.enterpriseManagement = enterpriseManagement;
		$self.informationManagement = informationManagement;
	};
	$return;
};

defineProcedure Boolean Flavor::instance:empty ()
	language: "c++"
{
	$defaultCF clientCF;

	$if (self.version != "" or self.caption != "" or self.quote != "" or self.str != NIL or self.picture != NIL)
	{
		$return (FALSE);
	};
	$return (TRUE);
};

Person Class

defaultCF imagesCF;
defaultCF clientCF;

defineProcedure Person Person::class:getPerson (String name, Boolean IsUnique)
	language: "c++"
{
	$defaultCF clientCF;
	$Bag<Person> ps;
	$Person p;

	$ps = Person from Person alone where Person.name.like(p.patternMatch (name));
	$if (ps.count() != 0)
	{
		$if (IsUnique == TRUE)
		{
			$p = ps.unique();
		};
		$return (p);
	};
	$return (NIL);
};

defineProcedure Bag<Person> Person::class:getPersons ()
	language: "c++"
{
	$defaultCF clientCF;
	$Bag<Person> ps;

	$ps = Person from Person alone;
	$if (ps.count() != 0)
	{
		$return (ps);
	};
	$return (NIL);
};

defineProcedure Void Person::class:addPerson (String name, mediaCF::MMFile logo, String title, String address, String phone, String email, mediaCF::MMFile picture)
	language: "c++"
{
	$defaultCF clientCF;

	$self.new (name := name, logo := logo, title := title, address := address, phone := phone, email := email, picture := picture);
	$return;
};

defineProcedure Void Person::class:changePerson (String fName, String tName, mediaCF::MMFile logo, String title, String address, String phone, String email, mediaCF::MMFile picture)
	language: "c++"
{
	$defaultCF clientCF;
	$Person p;

	$if (fName != "" and tName != "")
	{
		$p = Person.getPerson (fName, TRUE);
		$if (p != NIL)
		{
			$p.changePerson (tName, logo, title, address, phone, email, picture);
		};
	};
	$return;
};

defineProcedure Void Person::class:deletePerson (String name)
	language: "c++"
{
	$defaultCF clientCF;
	$Person p;

	$p = Person.getPerson (name, TRUE);
	$if (p != NIL)
	{
		$p.delete();
	};
	$return;
};

defineProcedure Void Person::instance:changePerson (String name, mediaCF::MMFile logo, String title, String address, String phone, String email, mediaCF::MMFile picture)
	language: "c++"
{
	$defaultCF clientCF;

	$self.name = name;
	$self.logo = logo;
	$self.title = title;
	$self.address = address;
	$self.phone = phone;
	$self.email = email;
	$self.picture = picture;
	$return;
};

defineProcedure Boolean Person::instance:empty ()
	language: "c++"
{
	$defaultCF clientCF;

	$if (self.title != "" or self.address != "" or self.phone != "" or self.email != "" or self.picture != NIL)
	{
		$return (FALSE);
	};
	$return (TRUE);
};

Employee Class

defineProcedure Employee Employee::class:getEmployee (String name, Boolean IsUnique)
	language: "c++"
{
	$defaultCF clientCF;
	$Bag<Employee> es;
	$Employee e;

	$es = Employee from Employee where Employee.name.like (e.patternMatch (name));
	$if (es.count() != 0)
	{
		$if (IsUnique == TRUE)
		{
			$e = es.unique();
		};
		$return (e);
	};
	$return (NIL);
};

defineProcedure Bag<Employee> Employee::class:getEmployees ()
	language: "c++"
{
	$defaultCF clientCF;
	$Bag<Employee> es;

	$es = Employee from Employee;
	$if (es.count() != 0)
	{
		$return (es);
	};
	$return (NIL);
};

defineProcedure Void Employee::class:addEmployee (String name, mediaCF::MMFile logo, String title, String address, String phone, String email, mediaCF::MMFile picture, Bag<Project> projects, Bag<Product> products)
	language: "c++"
{
	$defaultCF clientCF;

	$self.new (name := name, logo := logo, title := title, address := address, phone := phone, email := email, picture := picture, projects := projects, products := products);
	$return;
};

defineProcedure Void Employee::class: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)
	language: "c++"
{
	$defaultCF clientCF;
	$Employee e;

	$if (fName != "" and tName != "")
	{
		$e = Employee.getEmployee (fName, TRUE);
		$if (e != NIL)
		{
			$e.changeEmployee (tName, logo, title, address, phone, email, picture, projects, products);
		};
	};
	$return;
};

defineProcedure Void Employee::class:deleteEmployee (String name)
	language: "c++"
{
	$defaultCF clientCF;
	$Employee e;

	$e = Employee.getEmployee (name, TRUE);
	$if (e != NIL)
	{
		$e.delete();
	};
	$return;
};

defineProcedure Project Employee::instance:getProject (String name)
	language: "c++"
{
	$defaultCF clientCF;
	$Bag<Project> ps;
	$Project p;

	$ps = self.projects;
	$scan (ps, p)
	{
		$if (name == p.name)
		{
			$return (p);
		};
	};
	$return (NIL);
};

defineProcedure Product Employee::instance:getProduct (String name)
	language: "c++"
{
	$defaultCF clientCF;
	$Bag<Product> ps;
	$Product p;

	$ps = self.products;
	$scan (ps, p)
	{
		$if (name == p.name)
		{
			$return (p);
		};
	};
	$return (NIL);
};

defineProcedure Void Employee::instance:changeEmployee (String name, mediaCF::MMFile logo, String title, String address, String phone, String email, mediaCF::MMFile picture, Bag<Project> projects, Bag<Product> products)
	language: "c++"
{
	$defaultCF clientCF;

	$self.name = name;
	$self.logo = logo;
	$self.title = title;
	$self.address = address;
	$self.phone = phone;
	$self.email = email;
	$self.picture = picture;
	$self.projects = projects;
	$self.products = products;
	$return;
};

defineProcedure Boolean Employee::instance:empty ()
	language: "c++"
{
	$defaultCF clientCF;

	$if (self.title != "" or self.address != "" or self.phone != "" or self.email != "" or self.picture != NIL)
	{
		$return (FALSE);
	};
	$if (self.noProjects () == FALSE)
	{
		$return (FALSE);
	};
	$if (self.noProducts () == FALSE)
	{
		$return (FALSE);
	};
	$return (TRUE);
};

defineProcedure Boolean Employee::instance:noProjects ()
	language: "c++"
{
	$defaultCF clientCF;

	$if (self.projects.count() != NIL)
	{
		$if (self.projects.count() > 0)
		{
			$return (FALSE);
		};
	};
	$return (TRUE);
};

defineProcedure Boolean Employee::instance:noProducts ()
	language: "c++"
{
	$defaultCF clientCF;

	$if (self.products.count() != NIL)
	{
		$if (self.products.count() > 0)
		{
			$return (FALSE);
		};
	};
	$return (TRUE);
};

Customer Class

defineProcedure Customer Customer::class:getCustomer (String name, Boolean IsUnique)
	language: "c++"
{
	$defaultCF clientCF;
	$Bag<Customer> cs;
	$Customer c;

	$cs = Customer from Customer where Customer.name.like (c.patternMatch (name));
	$if (cs.count() != 0)
	{
		$if (IsUnique == TRUE)
		{
			$c = cs.unique();
		};
		$return (c);
	};
	$return (NIL);
};

defineProcedure Bag<Customer> Customer::class:getCustomers ()
	language: "c++"
{
	$defaultCF clientCF;
	$Bag<Customer> cs;

	$cs = Customer from Customer;
	$if (cs.count() != 0)
	{
		$return (cs);
	};
	$return (NIL);
};

defineProcedure Void Customer::class:addCustomer (String name, mediaCF::MMFile logo, String title, String address, String phone, String email, mediaCF::MMFile picture, Bag<Project> projects, Bag<Product> products)
	language: "c++"
{
	$defaultCF clientCF;

	$self.new (name := name, logo := logo, title := title, address := address, phone := phone, email := email, picture := picture, projects := projects, products := products);
	$return;
};

defineProcedure Void Customer::class: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)
	language: "c++"
{
	$defaultCF clientCF;
	$Customer c;

	$if (fName != "" and tName != "")
	{
		$c = Customer.getCustomer (fName, TRUE);
		$if (c != NIL)
		{
			$c.changeCustomer (tName, logo, title, address, phone, email, picture, projects, products);
		};
	};
	$return;
};

defineProcedure Void Customer::class:deleteCustomer (String name)
	language: "c++"
{
	$defaultCF clientCF;
	$Customer c;

	$c = Customer.getCustomer (name, TRUE);
	$if (c != NIL)
	{
		$c.delete();
	};
	$return;
};

defineProcedure Project Customer::instance:getProject (String name)
	language: "c++"
{
	$defaultCF clientCF;
	$Bag<Project> ps;
	$Project p;

	$ps = self.projects;
	$scan (ps, p)
	{
		$if (name == p.name)
		{
			$return (p);
		};
	};
	$return (NIL);
};

defineProcedure Product Customer::instance:getProduct (String name)
	language: "c++"
{
	$defaultCF clientCF;
	$Bag<Product> ps;
	$Product p;

	$ps = self.products;
	$scan (ps, p)
	{
		$if (name == p.name)
		{
			$return (p);
		};
	};
	$return (NIL);
};

defineProcedure Void Customer::instance:changeCustomer (String name, mediaCF::MMFile logo, String title, String address, String phone, String email, mediaCF::MMFile picture, Bag<Project> projects, Bag<Product> products)
	language: "c++"
{
	$defaultCF clientCF;

	$self.name = name;
	$self.logo = logo;
	$self.title = title;
	$self.address = address;
	$self.phone = phone;
	$self.email = email;
	$self.picture = picture;
	$self.projects = projects;
	$self.products = products;
	$return;
};

defineProcedure Boolean Customer::instance:empty ()
	language: "c++"
{
	$defaultCF clientCF;

	$if (self.title != "" or self.address != "" or self.phone != "" or self.email != "" or self.picture != NIL)
	{
		$return (FALSE);
	};
	$if (self.noProjects () == FALSE)
	{
		$return (FALSE);
	};
	$if (self.noProducts () == FALSE)
	{
		$return (FALSE);
	};
	$return (TRUE);
};

defineProcedure Boolean Customer::instance:noProjects ()
	language: "c++"
{
	$defaultCF clientCF;

	$if (self.projects.count() != NIL)
	{
		$if (self.projects.count() > 0)
		{
			$return (FALSE);
		};
	};
	$return (TRUE);
};

defineProcedure Boolean Customer::instance:noProducts ()
	language: "c++"
{
	$defaultCF clientCF;

	$if (self.products.count() != NIL)
	{
		$if (self.products.count() > 0)
		{
			$return (FALSE);
		};
	};
	$return (TRUE);
};

Discussion Class

defaultCF clientCF;

defineProcedure Bag<Discussion> Discussion::class:getDiscussions ()
	language: "c++"
{
	$defaultCF clientCF;
	$Bag<Discussion> ds;

	$ds = Discussion from Discussion;
	$if (ds.count() != 0)
	{
		$return (ds);
	};
	$return (NIL);
};

defineProcedure Bag<Discussion> Discussion::class:getSubsetByName (String name)
	language: "c++"
{
	$defaultCF clientCF;
	$Bag<Discussion> ds;
	$Discussion d;

	$ds = Discussion from Discussion where Discussion.name.like (d.patternMatch (name));
	$if (ds.count() != 0)
	{
		$return (ds);
	};
	$return (NIL);
};

defineProcedure Bag<Discussion> Discussion::class:getSubsetByDate (Date dte)
	language: "c++"
{
	$defaultCF clientCF;
	$Bag<Discussion> ds;

	$ds = Discussion from Discussion where Discussion.booked == dte;
	$if (ds.count() != 0)
	{
		$return (ds);
	};
	$return (NIL);
};

defineProcedure Void Discussion::class:addDiscussion (String name, mediaCF::MMFile logo, mediaCF::Text question, Bag<Reply> replies)
	language: "c++"
{
	$defaultCF clientCF;

	$self.new (booked := Date.getCurrent(), name := name, logo := logo, question := question, replies := replies);
	$return;
};

defineProcedure Boolean Discussion::instance:empty ()
	language: "c++"
{
	$defaultCF clientCF;

	$if (self.question != NIL)
	{
		$return (FALSE);
	};
	$if (self.noReplies () == FALSE)
	{
		$return (FALSE);
	};
	$return (TRUE);
};

defineProcedure Boolean Discussion::instance:noReplies ()
	language: "c++"
{
	$defaultCF clientCF;

	$if (self.replies.count() != NIL)
	{
		$if (self.replies.count() > 0)
		{
			$return (FALSE);
		};
	};
	$return (TRUE);
};

Reply Class

defaultCF clientCF;

defineProcedure Bag<Reply> Reply::class:getReplies ()
	language: "c++"
{
	$defaultCF clientCF;
	$Bag<Reply> rs;

	$rs = Reply from Reply;
	$if (rs.count() != 0)
	{
		$return (rs);
	};
	$return (NIL);
};

defineProcedure Bag<Reply> Reply::class:getSubset (String name)
	language: "c++"
{
	$defaultCF clientCF;
	$Bag<Reply> rs;
	$Reply r;

	$rs = Reply from Reply where Reply.name.like (r.patternMatch (name));
	$if (rs.count() != 0)
	{
		$return (rs);
	};
	$return (NIL);
};

defineProcedure Void Reply::class:addReply (String name, mediaCF::MMFile logo, mediaCF::Text reply, String prize, String prizeDescription)
	language: "c++"
{
	$defaultCF clientCF;

	$self.new (name := name, logo := logo, reply := reply, prize := prize, prizeDescription := prizeDescription);
	$return;
};

defineProcedure Boolean Reply::instance:empty ()
	language: "c++"
{
	$defaultCF clientCF;

	$if (self.reply != NIL or self.prize != "" or self.prizeDescription != "")
	{
		$return (FALSE);
	};
	$return (TRUE);
};

defineProcedure Bag<Reply> Reply::Bag <instance>:getSubset (String name)
{
	$defaultCF clientCF;
	$Bag<Reply> rs;
	$Reply r;

	$scan (self, r)
	{
		$if (r.name.like (r.patternMatch (name)))
		{
			$rs.directAdd (r);
		};
	};
	$return (rs);
};

Demo Class

defaultCF clientCF;

defineProcedure Demo Demo::class:getDemo (String name, Boolean IsUnique)
	language: "c++"
{
	$defaultCF clientCF;
	$Bag<Demo> ps;
	$Demo p;

	$ps = Demo from Demo alone where Demo.name == name;
	$if (ps.count() != 0)
	{
		$if (IsUnique == TRUE)
		{
			$p = ps.unique();
		};
		$return (p);
	};
	$return (NIL);
};

defineProcedure Bag<Demo> Demo::class:getDemos()
	language: "c++"
{
	$defaultCF clientCF;
	$Bag<Demo> ps;

	$ps = Demo from Demo alone;
	$if (ps.count() != 0)
	{
		$return (ps);
	};
	$return (NIL);
};

defineProcedure Void Demo::class:addDemo (String name, mediaCF::MMFile logo, mediaCF::Video video, mediaCF::Audio audio)
	language: "c++"
{
	$defaultCF clientCF;
	
	$self.new (name := name, logo := logo, video := video, audio := audio);
	$return;
};

defineProcedure Void Demo::class:changeDemo (String fName, String tName, mediaCF::MMFile logo, mediaCF::Video video, mediaCF::Audio audio)
	language: "c++"
{
	$defaultCF clientCF;
	$Demo p;

	$if (fName != "" and tName != "")
	{
		$p = Demo.getDemo (fName, TRUE);
		$if (p != NIL)
		{
			$p.changeDemo (tName, logo, video, audio);
		};
	};
	$return;
};

defineProcedure Void Demo::class:deleteDemo (String name)
	language: "c++"
{
	$defaultCF clientCF;
	$Demo p;

	$p = Demo.getDemo (name, TRUE);
	$if (p != NIL)
	{
		$p.delete();
	};
	$return;
};

defineProcedure Void Demo::instance:changeDemo (String name, mediaCF::MMFile logo, mediaCF::Video video, mediaCF::Audio audio)
	language: "c++"
{
	$defaultCF clientCF;

	$self.name = name;
	$self.logo = logo;
	$self.video = video;
	$self.audio = audio;
	$return;
};

defineProcedure String Demo::instance:mediaType ()
	language: "c++"
{
	$defaultCF clientCF;

	$if (self.video != NIL)
	{
		$return ("Video");
	};
	$if (self.audio != NIL)
	{
		$return ("Audio");
	};
	$return ("None");
};

Project Class

defaultCF clientCF;

defineProcedure Project Project::class:getProject(String name, Boolean IsUnique)
	language: "c++"
{
	$defaultCF clientCF;
	$Bag<Project> ps;
	$Project p;

	$ps = Project from Project where Project.name == name;
	$if (ps.count() != 0)
	{
		$if (IsUnique == TRUE)
		{
			$p = ps.unique();
		};
		$return (p);
	};
	$return (NIL);
};

defineProcedure Bag<Project> Project::class:getProjects()
	language: "c++"
{
	$defaultCF clientCF;
	$Bag<Project> ps;

	$ps = Project from Project;
	$if (ps.count() != 0)
	{
		$return (ps);
	};
	$return (NIL);
};

defineProcedure Void Project::class:addProject (String name, mediaCF::MMFile logo, mediaCF::Text responsibility, mediaCF::Text contribution)
	language: "c++"
{
	$defaultCF clientCF;

	$self.new (name := name, logo := logo, responsibility := responsibility, contribution := contribution);
	$return;
};

defineProcedure Void Project::class:changeProject (String fName, String tName, mediaCF::MMFile logo, mediaCF::Text responsibility, mediaCF::Text contribution)
	language: "c++"
{
	$defaultCF clientCF;
	$Project p;

	$if (fName != "" and tName != "")
	{
		$p = Project.getProject (fName, TRUE);
		$if (p != NIL)
		{
			$p.changeProject (tName, logo, responsibility, contribution);
		};
	};
	$return;
};

defineProcedure Void Project::class:deleteProject (String name)
	language: "c++"
{
	$defaultCF clientCF;
	$Project p;

	$p = Project.getProject (name, TRUE);
	$if (p != NIL)
	{
		$p.delete();
	};
	$return;
};

defineProcedure Void Project::instance:changeProject (String name, mediaCF::MMFile logo, mediaCF::Text responsibility, mediaCF::Text contribution)
	language: "c++"
{
	$defaultCF clientCF;

	$self.name = name;
	$self.logo = logo;
	$self.responsibility = responsibility;
	$self.contribution = contribution;
	$return;
};

defineProcedure Boolean Project::instance:empty ()
	language: "c++"
{
	$defaultCF clientCF;

	$if (self.responsibility != NIL or self.contribution != NIL)
	{
		$return (FALSE);
	};
	$return (TRUE);
};