5 * Copyright 2002, GForge, LLC
6 * Copyright 2009, Roland Mas
8 * This file is part of FusionForge. FusionForge is free software;
9 * you can redistribute it and/or modify it under the terms of the
10 * GNU General Public License as published by the Free Software
11 * Foundation; either version 2 of the Licence, or (at your option)
14 * FusionForge is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License along
20 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 require_once $gfcommon.'include/Error.class.php';
25 require_once $gfcommon.'tracker/ArtifactQuery.class.php';
27 class ArtifactQueryFactory extends Error {
29 * The ArtifactType object.
36 * The ArtifactQueries array.
38 * @var array ArtifactQueries.
40 var $ArtifactQueries = null;
45 * @param object $ArtifactType The Group object to which this ArtifactQueryFactory is associated
47 function __construct(&$ArtifactType) {
49 if (!$ArtifactType || !is_object($ArtifactType)) {
50 $this->setError('ArtifactQueryFactory:: No ArtifactType Object');
53 if ($ArtifactType->isError()) {
54 $this->setError('ArtifactQueryFactory:: '.$ArtifactType->getErrorMessage());
57 $this->ArtifactType =& $ArtifactType;
60 function &getArtifactQueries() {
61 if (!is_null($this->ArtifactQueries)) {
62 return $this->ArtifactQueries;
65 $this->ArtifactQueries = array();
67 $res = db_query_params ('SELECT * FROM artifact_query WHERE user_id=$1
68 AND group_artifact_id=$2',
70 $this->ArtifactType->getID())) ;
72 $this->setError("ArtifactQueryFactory:: Database error");
75 while ($data = db_fetch_array($res)) {
76 $artifactQuery = new ArtifactQuery($this->ArtifactType, $data["artifact_query_id"]);
77 $this->ArtifactQueries[] = $artifactQuery;
80 return $this->ArtifactQueries;
86 // c-file-style: "bsd"