Transform a license from client/server model to database model

@param license the license to transform
@return DbLicense return a license in database model
194806
public DbLicense getDbLicense(final License license) {
        final DbLicense dbLicense = new DbLicense();
        dbLicense.setName(license.getName());
        dbLicense.setLongName(license.getLongName());
        dbLicense.setComments(license.getComments());
        dbLicense.setRegexp(license.getRegexp());
        dbLicense.setUrl(license.getUrl());

        return dbLicense;
    }
691256
@GET
    @Produces({MediaType.APPLICATION_JSON})
    @Path("/{gavc}" + ServerAPI.GET_LICENSES)
    public Response getLicenses(@PathParam("gavc") final String gavc, @Context final UriInfo uriInfo){

        if(LOG.isInfoEnabled()) {
            LOG.info(String.format("Got a get artifact licenses request [%s]", gavc));
        }
        final LicenseListView view = new LicenseListView("Licenses of " + gavc);

        final FiltersHolder filters = new FiltersHolder();
        filters.init(uriInfo.getQueryParameters());

        final List<DbLicense> dbLicenses = getArtifactHandler().getArtifactLicenses(gavc,filters);
        for(final DbLicense license: dbLicenses){
            view.add(getModelMapper().getLicense(license));
        }

        return Response.ok(view).build();
    }
1345302
public Artifact getArtifact(final DbArtifact dbArtifact) {
        final Artifact artifact = DataModelFactory.createArtifact(dbArtifact.getGroupId(), dbArtifact.getArtifactId(),
            dbArtifact.getVersion(), dbArtifact.getClassifier(), dbArtifact.getType(), dbArtifact.getExtension());

        artifact.setSha256(dbArtifact.getSha256());
        artifact.setDescription(dbArtifact.getDescription());
        artifact.setPromoted(dbArtifact.isPromoted());
        artifact.setSize(dbArtifact.getSize());
        artifact.setDownloadUrl(dbArtifact.getDownloadUrl());
        artifact.setProvider(dbArtifact.getProvider());
        artifact.setOrigin(dbArtifact.getOrigin());
        artifact.setCreatedDateTime(dbArtifact.getCreatedDateTime());
        artifact.setUpdatedDateTime(dbArtifact.getUpdatedDateTime());

        for (final String licenseId : dbArtifact.getLicenses()) {
            artifact.addLicense(licenseId);
        }

        return artifact;
    }
1028286
public List<License> getLicenses() {
        final ModelMapper modelMapper = new ModelMapper(repoHandler);
        final List<License> licenses = new ArrayList<>();
        for (final DbLicense dbLicense : licensesRegexp.values()) {
            licenses.add(modelMapper.getLicense(dbLicense));
        }
        return licenses;
    }
1287637
def license_export(data):
    
    resources = config_utils.get_resources("sentieon", data["config"])
    server = resources.get("keyfile")
    if not server:
        server = tz.get_in(["resources", "sentieon", "keyfile"], data)
    if not server:
        raise ValueError("Need to set resources keyfile with URL:port of license server, local license file or "
                         "environmental variables to export \n"
                         "http://bcbio-nextgen.readthedocs.io/en/latest/contents/configuration.html#resources\n"
                         "Configuration: %s" % pprint.pformat(data))
    if isinstance(server, six.string_types):
        return "export SENTIEON_LICENSE=%s && " % server
    else:
        assert isinstance(server, dict), server
        exports = ""
        for key, val in server.items():
            exports += "export %s=%s && " % (key.upper(), val)
        return exports
721018
public void showLicenseFile(InputStream licenseFile) {
        Object e = SelfExtract.class;
        if (licenseFile != null) {
            e = SelfExtractUtils.showLicenseFile(licenseFile);
        }
        if (e != null) {
            SelfExtract.err("licenseNotFound");
            System.exit(ReturnCode.UNREADABLE);
        }
    }
384981
public static License createLicense(final String name, final String longName, final String comments, final String regexp, final String url){
		final License license = new License();

		license.setName(name);
		license.setLongName(longName);
		license.setComments(comments);
		license.setRegexp(regexp);
		license.setUrl(url);

		return license;
	}
1179440
def license(self, key, value):
    """"""
    def _get_license(value):
        a_values = force_list(value.get('a'))

        oa_licenses = [el for el in a_values if el == 'OA' or el == 'Open Access']
        other_licenses = [el for el in a_values if el != 'OA' and el != 'Open Access']

        if not other_licenses:
            return force_single_element(oa_licenses)
        return force_single_element(other_licenses)

    def _get_material(value):
        material = value.get('3', '').lower()
        if material == 'article':
            return 'publication'
        return material

    return {
        'imposing': value.get('b'),
        'license': _get_license(value),
        'material': _get_material(value),
        'url': value.get('u'),
    }
178
protected function generateLicense()
    {
        $command = $this->prepareSignCommand() . ' 2>&1';

        $this->log('Creating license at ' . $this->outputFile);

        $this->log('Running: ' . $command, Project::MSG_VERBOSE);
        $tmp = exec($command, $output, $return_var);

        // Check for exit value 1. Zendenc_sign command for some reason
        // returns 0 in case of failure and 1 in case of success...
        if ($return_var !== 1) {
            throw new BuildException("Creating license failed. \n\nZendenc_sign msg:\n" . implode(
                "\n",
                $output
            ) . "\n\n");
        }
    }
1267160
public Collection<String> getSampleLicense(Locale locale) throws InstallException {
        Collection<String> licenses = new ArrayList<String>();
        for (List<List<RepositoryResource>> targetList : getResolveDirector().getInstallResources().values()) {
            for (List<RepositoryResource> mrList : targetList) {
                for (RepositoryResource mr : mrList) {
                    ResourceType type = mr.getType();
                    if (type.equals(ResourceType.PRODUCTSAMPLE) ||
                        type.equals(ResourceType.OPENSOURCE)) {
                        try {
                            AttachmentResource lar = mr.getLicenseAgreement(locale);
                            if (lar != null)
                                licenses.add(InstallLicenseImpl.getLicense(lar));
                        } catch (RepositoryException e) {
                            throw ExceptionUtils.createByKey(e, "ERROR_FAILED_TO_GET_ASSET_LICENSE", mr.getName());
                        }
                    }
                }
            }
        }
        return licenses;
    }
393430
public void approveLicense(final String name, final Boolean approved) {
        final DbLicense license = getLicense(name);
        repoHandler.approveLicense(license, approved);
    }
1304180
public License<ConnectorDescriptor> getOrCreateLicense()
   {
      Node node = model.getOrCreate("license");
      License<ConnectorDescriptor> license = new LicenseImpl<ConnectorDescriptor>(this, "license", model, node);
      return license;
   }
515503
public LicenseType<ConnectorType<T>> getOrCreateLicense()
   {
      Node node = childNode.getOrCreate("license");
      LicenseType<ConnectorType<T>> license = new LicenseTypeImpl<ConnectorType<T>>(this, "license", childNode, node);
      return license;
   }
199710
public function prune($license = null)
    {
        if ($license) {
            $this->addUsingAlias(LicensePeer::ID, $license->getId(), Criteria::NOT_EQUAL);
        }

        return $this;
    }
212527
public static String getLicenseAgreement(final JarFile jar, final Map<String, String> manifestAttrs) {
        String licenseAgreement = null;

        if (manifestAttrs.isEmpty()) {
            return licenseAgreement;
        }

        String licenseAgreementPrefix = manifestAttrs.get(ArchiveUtils.LICENSE_AGREEMENT);

        LicenseProvider licenseProvider = (licenseAgreementPrefix != null) ? ZipLicenseProvider.createInstance(jar, licenseAgreementPrefix) : null;

        if (licenseProvider != null)
            licenseAgreement = new InstallLicenseImpl("", LicenseType.UNSPECIFIED, licenseProvider).getAgreement();

        return licenseAgreement;
    }
395400
private function getLicenseAsComment()
    {
        $license = explode(PHP_EOL, $this->licenseHeader);

        // if there are a bunch of new lines at the end of the license file
        // then we want to remove these
        while (end($license) === '') {
            array_pop($license);
        }
        reset($license);

        $license = array_map(function ($licenseLine) {
            return rtrim(' * ' . $licenseLine);
        }, $license);

        $license = implode(PHP_EOL, $license);
        $license = '/*' . PHP_EOL . $license . PHP_EOL . ' */';

        return $license;
    }
388749
private function setLicense() {
		if ( ! $this->getApiKey() ) {
			$license = 'Missing Connect Key';
		} else if ( ! ( $license = $this->getTransient() ) || ! $this->isVersionValid( $license ) ) {
			delete_site_transient( $this->getKey() );
			$license = $this->getRemoteLicense();
		}

		return $this->license = $license;
	}