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 The Group object to which this ArtifactQueryFactory is associated
46 * @return boolean success.
48 function __construct(&$ArtifactType) {
50 if (!$ArtifactType || !is_object($ArtifactType)) {
51 $this->setError('ArtifactQueryFactory:: No ArtifactType Object');
54 if ($ArtifactType->isError()) {
55 $this->setError('ArtifactQueryFactory:: '.$ArtifactType->getErrorMessage());
58 $this->ArtifactType =& $ArtifactType;
64 function &getArtifactQueries() {
65 if (!is_null($this->ArtifactQueries)) {
66 return $this->ArtifactQueries;
69 $this->ArtifactQueries = array();
71 $res = db_query_params ('SELECT * FROM artifact_query WHERE user_id=$1
72 AND group_artifact_id=$2',
74 $this->ArtifactType->getID())) ;
76 $this->setError("ArtifactQueryFactory:: Database error");
79 while ($data = db_fetch_array($res)) {
80 $artifactQuery = new ArtifactQuery($this->ArtifactType, $data["artifact_query_id"]);
81 $this->ArtifactQueries[] = $artifactQuery;
84 return $this->ArtifactQueries;
90 // c-file-style: "bsd"