Given a valid SPDX license ID, this method will return a LicenseChoice object.
@param licenseId a valid SPDX license ID
@return a LicenseChoice object
@throws InvalidSPDXAnalysisException an exception while parsing the license ID
197855
public static LicenseChoice resolveSpdxLicenseId(String licenseId) throws InvalidSPDXAnalysisException {
        final SpdxListedLicense spdxLicense = LicenseInfoFactory.getListedLicenseById(licenseId);
        final LicenseChoice choice = new LicenseChoice();
        choice.addLicense(createLicenseObject(spdxLicense));
        return choice;
    }
748133
private static boolean obtainLicenseAgreement(LicenseProvider licenseProvider) {
        // Prompt for word-wrapped display of license agreement & information
        boolean view;

        SelfExtract.wordWrappedOut(SelfExtract.format("showAgreement", "--viewLicenseAgreement"));
        view = SelfExtract.getResponse(SelfExtract.format("promptAgreement"), "", "xX");
        if (view) {
            SelfExtract.showLicenseFile(licenseProvider.getLicenseAgreement());
            System.out.println();
        }

        SelfExtract.wordWrappedOut(SelfExtract.format("showInformation", "--viewLicenseInfo"));
        view = SelfExtract.getResponse(SelfExtract.format("promptInfo"), "", "xX");
        if (view) {
            SelfExtract.showLicenseFile(licenseProvider.getLicenseInformation());
            System.out.println();
        }

        System.out.println();
        SelfExtract.wordWrappedOut(SelfExtract.format("licenseOptionDescription"));
        System.out.println();

        boolean accept = SelfExtract.getResponse(SelfExtract.format("licensePrompt", new Object[] { "[1]", "[2]" }),
                                                 "1", "2");
        System.out.println();

        return accept;
    }
1178963
@GET
	@Produces(MediaType.APPLICATION_JSON)
	@Path("/{dashboardId}")
	@Description("Returns a dashboard by its ID.")
	public DashboardDto getDashboardByID(@Context HttpServletRequest req,
			@PathParam("dashboardId") BigInteger dashboardId) {
		if (dashboardId == null || dashboardId.compareTo(BigInteger.ZERO) < 1) {
			throw new WebApplicationException("Dashboard Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST);
		}

		Dashboard dashboard = dService.findDashboardByPrimaryKey(dashboardId);

		if (dashboard != null && !dashboard.isShared()) {
			validateAndGetOwner(req, null);
			validateResourceAuthorization(req, dashboard.getOwner(), getRemoteUser(req));
		}
		if (dashboard != null) {
			return DashboardDto.transformToDto(dashboard);
		}
		throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND);
	}
608519
public static license_file delete(nitro_service client, license_file resource) throws Exception
	{
		resource.validate("delete");
		return ((license_file[]) resource.delete_resource(client))[0];
	}
764881
public static void validateServiceInstanceID(String id) throws ServiceException {
        if (!validateRequiredField(id, idRegEx)) {
            throw new ServiceException(
                    ErrorCode.SERVICE_INSTANCE_ID_FORMAT_ERROR);
        }
    }
1317712
public static X500Principal getIssuerX500Principal(X509Certificate cert) {
        try {
            return getX500Principal(cert, true);
        } catch (Exception e) {
            throw new RuntimeException("Could not parse issuer", e);
        }
    }
102758
public com.google.api.ads.admanager.axis.v201808.DateTime getLicenseWindowEndDateTime() {
        return licenseWindowEndDateTime;
    }
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);
        }
    }
1122299
@Override
  public X509Certificate getClientCertificate()
    throws CertificateException
  {
    X509Certificate []certs = getClientCertificates();

    if (certs == null || certs.length == 0)
      return null;
    else
      return certs[0];
  }
1192220
public function getLicenseByIdentifier($identifier)
    {
        if (!isset($this->licenses[$identifier])) {
            return;
        }

        $license = $this->licenses[$identifier];

        // add URL for the license text (it's not included in the json)
        $license[2] = 'http://spdx.org/licenses/' . $identifier . '#licenseText';

        return $license;
    }
747598
public List<LicenseTemplate> getAllLicenseTemplates() throws GitLabApiException {
        Response response = get(Response.Status.OK, null, "licenses");
        return (response.readEntity(new GenericType<List<LicenseTemplate>>() {}));
    }
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;
    }
30977
private ICredentialRepository getValidCredentialRepository()
    {
        ICredentialRepository repository = getCredentialRepository();

        if (repository == null)
        {
            throw new UnsupportedOperationException(
                    String.format("An instance of the %s service must be " +
                                    "configured in order to use this feature.",
                            ICredentialRepository.class.getName()
                    )
            );
        }

        return repository;
    }
564470
public Object displayLicenseFile(InputStream licenseFile, CommandConsole commandConsole) {
        Object e = LicenseUtility.class;
        if (licenseFile != null) {
            e = showLicenseFile(licenseFile, commandConsole);
        }
        if (e != null) {
            commandConsole.printErrorMessage(CommandUtils.getMessage("LICENSE_NOT_FOUND"));
        }
        return e;
    }
338817
private static License createLicenseObject(SpdxListedLicense spdxListedLicense) {
        final License license = new License();
        license.setId(spdxListedLicense.getLicenseId());
        license.setName(spdxListedLicense.getName());
        if (spdxListedLicense.getSeeAlso() != null && spdxListedLicense.getSeeAlso().length > 0) {
            license.setUrl(spdxListedLicense.getSeeAlso()[0]);
        }
        if (spdxListedLicense.getLicenseText() != null) {
            final LicenseText text = new LicenseText();
            text.setContentType("plain/text");
            text.setEncoding("base64");
            text.setText(Base64.getEncoder().encodeToString(spdxListedLicense.getLicenseText().getBytes()));
            license.setLicenseText(text);
        }
        return license;
    }
1072429
public DbLicense resolve(final String licenseId) {

        for (final Entry<String, DbLicense> regexp : licensesRegexp.entrySet()) {
            try {
                if (licenseId.matches(regexp.getKey())) {
                    return regexp.getValue();
                }
            } catch (PatternSyntaxException e) {
                LOG.error("Wrong pattern for the following license " + regexp.getValue().getName(), e);
                continue;
            }
        }

        if(LOG.isWarnEnabled()) {
            LOG.warn(String.format("No matching pattern for license %s", licenseId));
        }
        return null;
    }
606168
@Override
  public Splittable getSerializedProxyId(final SimpleProxyId<?> stableId) {
    final AutoBean<IdMessage> bean = MessageFactoryHolder.FACTORY.id();
    final IdMessage ref = bean.as();
    ref.setServerId(stableId.getServerId());
    ref.setTypeToken(this.getRequestFactory().getTypeToken(stableId.getProxyClass()));
    if (stableId.isSynthetic()) {
      ref.setStrength(Strength.SYNTHETIC);
      ref.setSyntheticId(stableId.getSyntheticId());
    } else if (stableId.isEphemeral()) {
      ref.setStrength(Strength.EPHEMERAL);
      ref.setClientId(stableId.getClientId());
    }
    return AutoBeanCodex.encode(bean);
  }