1
/* Copyright (C) 2000-2004 Thomas Bopp, Thorsten Hampel, Ludger Merkens
2
* Copyright (C) 2003-2004 Martin Baehr
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
* $Id: BugFactory.pike,v 1.1.1.1 2005/02/23 14:47:21 cvs Exp $
21
constant cvs_version="$Id: BugFactory.pike,v 1.1.1.1 2005/02/23 14:47:21 cvs Exp $";
23
inherit "/factories/ObjectFactory";
30
#include <attributes.h>
35
* The execute function - create a new instance of type "Bug"
37
* @param mapping vars - variables like name and description
39
* 'attributes' - default attributes
40
* @return the newly created object
41
* @author <a href="mailto:astra@upb.de">Thomas Bopp</a>)
43
object execute(mapping vars)
47
string name = vars["name"];
48
try_event(EVENT_EXECUTE, CALLER, obj);
49
obj = ::object_create(name, get_class_name(), 0,
50
vars["attributes"], vars["attributesAcquired"],
51
vars["attributesLocked"]);
52
if ( stringp(vars["description"]) )
53
obj->set_attribute(OBJ_DESC, vars["description"]);
54
run_event(EVENT_EXECUTE, CALLER, obj);
58
static void create_object()
61
init_class_attribute("status", CMD_TYPE_STRING, "bug status",
62
0, EVENT_ATTRIBUTES_CHANGE,0,
63
CONTROL_ATTR_SERVER, "new" );
66
static void init_factory()
68
::init_factory(); // Calling the parent function.
69
// new attributes could be registered here too
70
init_class_attribute("status", CMD_TYPE_STRING, "bug status",
71
0, EVENT_ATTRIBUTES_CHANGE,0,
72
CONTROL_ATTR_SERVER, "new" );
76
string get_identifier() { return "Bug.factory"; }
77
string get_class_name() { return "Bug"; }
78
int get_class_id() { return CLASS_BUG; }