45 $sql =
"SELECT rf_shortname FROM license_candidate;";
46 $stmt = __METHOD__.
".rf_candidate_shortnames";
49 $stmt = __METHOD__.
".rf_shortnames";
50 $params[] = LicenseMap::CONCLUSION;
53 $res = $this->
dbManager->execute($stmt, $params);
57 $licshortnames = array();
58 foreach ($vars as $rf_entry) {
59 $shortname = $rf_entry[
'rf_shortname'];
60 $licshortnames[$shortname] = $shortname;
63 return $licshortnames;
76 $tableName =
"license_candidate";
78 $tableName =
"license_ref";
80 $sql =
"SELECT * FROM ONLY $tableName WHERE rf_shortname = $1;";
81 $statement = __METHOD__ .
".getLicId.$tableName";
82 $results = $this->
dbManager->getRows($sql, array($shortname), $statement);
83 $licenseIds = array();
84 foreach ($results as $row) {
85 $licenseIds[] = $row[
'rf_pk'];
99 $sql =
"SELECT * FROM ONLY license_candidate WHERE rf_pk = $1;";
101 $sql =
"SELECT * FROM ONLY license_ref WHERE rf_pk = $1;";
103 $statement = __METHOD__ .
"." . ($candidate ?
"candidate" :
"license");
104 $result = $this->
dbManager->getSingleRow($sql,array($rfId), $statement);
105 return $result[
'rf_shortname'];
118 $sql =
"SELECT rf_fk FROM obligation_candidate_map WHERE ob_fk=$1;";
119 $stmt = __METHOD__.
".om_candidate";
121 $sql =
"SELECT rf_fk FROM obligation_map WHERE ob_fk=$1;";
122 $stmt = __METHOD__.
".om_license";
125 $res = $this->
dbManager->execute($stmt, array($obId));
126 $vars = $this->
dbManager->fetchAll($res);
128 foreach ($vars as $map_entry) {
132 return join(
";", array_unique($liclist));
146 $stmt = __METHOD__.
".om_testcandidate";
147 $tableName .=
"obligation_candidate_map";
149 $stmt = __METHOD__.
".om_testlicense";
150 $tableName .=
"obligation_map";
152 $sql =
"SELECT * FROM $tableName WHERE ob_fk = $1 AND rf_fk = $2;";
154 $res = $this->
dbManager->execute($stmt,array($obId,$licId));
155 $vars = $this->
dbManager->fetchAll($res);
175 $sql =
"INSERT INTO obligation_candidate_map (ob_fk, rf_fk) VALUES ($1, $2)";
176 $stmt = __METHOD__ .
".om_addcandidate";
178 $sql =
"INSERT INTO obligation_map (ob_fk, rf_fk) VALUES ($1, $2)";
179 $stmt = __METHOD__ .
".om_addlicense";
182 $res = $this->
dbManager->execute($stmt, array($obId,$licId));
197 $stmt = __METHOD__.
".omdel_all";
199 $sql =
"DELETE FROM obligation_candidate_map WHERE ob_fk=$1";
200 $stmt .=
".candidate";
202 $sql =
"DELETE FROM obligation_map WHERE ob_fk=$1";
205 $res = $this->
dbManager->execute($stmt,array($obId));
207 $stmt = __METHOD__.
".omdel_lic";
209 $sql =
"DELETE FROM obligation_candidate_map WHERE ob_fk=$1 AND rf_fk=$2";
210 $stmt .=
".candidate";
212 $sql =
"DELETE FROM obligation_map WHERE ob_fk=$1 AND rf_fk=$2";
215 $res = $this->
dbManager->execute($stmt,array($obId,$licId));
227 $sql =
"SELECT * FROM obligation_ref;";
238 $sql =
"SELECT ob_topic FROM obligation_ref WHERE ob_pk = $1;";
239 $result = $this->
dbManager->getSingleRow($sql,array($ob_pk));
240 return $result[
'ob_topic'];
253 foreach ($licenses as $license) {
270 foreach ($licenses as $license) {
282 $sql =
"SELECT * FROM obligation_ref WHERE ob_pk = $1;";
283 return $this->
dbManager->getSingleRow($sql, [$ob_pk]);
294 $stmt = __METHOD__ .
'.deleteObligation';
295 $sql =
"DELETE FROM obligation_ref WHERE ob_pk = $1";
296 $this->
dbManager->getSingleRow($sql, [$ob_pk], $stmt);
static getMappedLicenseRefView($usageExpr=' $1')
Query to get license map view along with license ref.
Wrapper class for obligation map.
isLicenseAssociated($obId, $licId, $candidate=false)
Check if the obligation is already associated with the license.
getObligations()
Get all obligations from DB.
getAvailableShortnames($candidate=false)
Get the list of license shortnames.
getShortnameFromId($rfId, $candidate=false)
Get the shortname of the license by Id.
getIdFromShortname($shortname, $candidate=false)
Get the license ids from the shortname.
associateLicenseFromLicenseList($obligationId, $licenses, $candidate=false)
unassociateLicenseFromLicenseList($obligationId, $licenses, $candidate=false)
getLicenseList($obId, $candidate=false)
Get the list of licenses associated with the obligation.
unassociateLicenseFromObligation($obId, $licId=0, $candidate=false)
Unassociate a license from an obligation.
getTopicNameFromId($ob_pk)
Get the obligation topic from the obligation id.
associateLicenseWithObligation($obId, $licId, $candidate=false)
Associate a license with an obligation.
__construct(DbManager $dbManager)
getObligationById($ob_pk)
fo_dbManager * dbManager
fo_dbManager object
Contains business rules for FOSSology.