51 $sql =
"SELECT rf_shortname FROM license_candidate;";
52 $stmt = __METHOD__.
".rf_candidate_shortnames";
54 $sql =
"SELECT rf_shortname FROM ONLY license_ref;";
55 $stmt = __METHOD__.
".rf_shortnames";
62 $licshortnames = array();
63 foreach ($vars as $rf_entry) {
64 $shortname = $rf_entry[
'rf_shortname'];
65 $licshortnames[$shortname] = $shortname;
68 return $licshortnames;
81 $tableName =
"license_candidate";
83 $tableName =
"license_ref";
85 $sql =
"SELECT * FROM ONLY $tableName WHERE rf_shortname = $1;";
86 $statement = __METHOD__ .
".getLicId.$tableName";
87 $results = $this->
dbManager->getRows($sql, array($shortname), $statement);
88 $licenseIds = array();
89 foreach ($results as $row) {
90 $licenseIds[] = $row[
'rf_pk'];
104 $sql =
"SELECT * FROM ONLY license_candidate WHERE rf_pk = $1;";
106 $sql =
"SELECT * FROM ONLY license_ref WHERE rf_pk = $1;";
108 $statement = __METHOD__ .
"." . ($candidate ?
"candidate" :
"license");
109 $result = $this->
dbManager->getSingleRow($sql,array($rfId), $statement);
110 return $result[
'rf_shortname'];
123 $sql =
"SELECT rf_fk FROM obligation_candidate_map WHERE ob_fk=$1;";
124 $stmt = __METHOD__.
".om_candidate";
126 $sql =
"SELECT rf_fk FROM obligation_map WHERE ob_fk=$1;";
127 $stmt = __METHOD__.
".om_license";
130 $res = $this->
dbManager->execute($stmt, array($obId));
131 $vars = $this->
dbManager->fetchAll($res);
133 foreach ($vars as $map_entry) {
137 return join(
";", array_unique($liclist));
151 $stmt = __METHOD__.
".om_testcandidate";
152 $tableName .=
"obligation_candidate_map";
154 $stmt = __METHOD__.
".om_testlicense";
155 $tableName .=
"obligation_map";
157 $sql =
"SELECT * FROM $tableName WHERE ob_fk = $1 AND rf_fk = $2;";
159 $res = $this->
dbManager->execute($stmt,array($obId,$licId));
160 $vars = $this->
dbManager->fetchAll($res);
180 $sql =
"INSERT INTO obligation_candidate_map (ob_fk, rf_fk) VALUES ($1, $2)";
181 $stmt = __METHOD__ .
".om_addcandidate";
183 $sql =
"INSERT INTO obligation_map (ob_fk, rf_fk) VALUES ($1, $2)";
184 $stmt = __METHOD__ .
".om_addlicense";
187 $res = $this->
dbManager->execute($stmt, array($obId,$licId));
202 $stmt = __METHOD__.
".omdel_all";
204 $sql =
"DELETE FROM obligation_candidate_map WHERE ob_fk=$1";
205 $stmt .=
".candidate";
207 $sql =
"DELETE FROM obligation_map WHERE ob_fk=$1";
210 $res = $this->
dbManager->execute($stmt,array($obId));
212 $stmt = __METHOD__.
".omdel_lic";
214 $sql =
"DELETE FROM obligation_candidate_map WHERE ob_fk=$1 AND rf_fk=$2";
215 $stmt .=
".candidate";
217 $sql =
"DELETE FROM obligation_map WHERE ob_fk=$1 AND rf_fk=$2";
220 $res = $this->
dbManager->execute($stmt,array($obId,$licId));
232 $sql =
"SELECT * FROM obligation_ref;";
243 $sql =
"SELECT ob_topic FROM obligation_ref WHERE ob_pk = $1;";
244 $result = $this->
dbManager->getSingleRow($sql,array($ob_pk));
245 return $result[
'ob_topic'];
258 foreach ($licenses as $license) {
275 foreach ($licenses as $license) {
getObligations()
Get all obligations from DB.
associateLicenseFromLicenseList($obligationId, $licenses, $candidate=false)
unassociateLicenseFromLicenseList($obligationId, $licenses, $candidate=false)
unassociateLicenseFromObligation($obId, $licId=0, $candidate=false)
Unassociate a license from an obligation.
associateLicenseWithObligation($obId, $licId, $candidate=false)
Associate a license with an obligation.
__construct(DbManager $dbManager)
getAvailableShortnames($candidate=false)
Get the license id from the shortname.
Contains business rules for FOSSology.
getShortnameFromId($rfId, $candidate=false)
Get the shortname of the license by Id.
getIdFromShortname($shortname, $candidate=false)
Get the license ids from the shortname.
fo_dbManager * dbManager
fo_dbManager object
getTopicNameFromId($ob_pk)
Get the obligation topic from the obligation id.
getLicenseList($obId, $candidate=false)
Get the list of licenses associated with the obligation.
isLicenseAssociated($obId, $licId, $candidate=false)
Check if the obligation is already associated with the license.
Wrapper class for obligation map.