com.google.api.client.repackaged.com.google.common.base.Strings Java Examples

The following examples show how to use com.google.api.client.repackaged.com.google.common.base.Strings. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AndroidPublisherHelper.java    From gradle-android-publisher with Apache License 2.0 6 votes vote down vote up
/**
 * Performs all necessary setup steps for running requests against the API.
 *
 * @param applicationName the name of the application: com.example.app
 * @param serviceAccountEmail the Service Account Email (empty if using
 *            installed application)
 * @return the {@Link AndroidPublisher} service
 * @throws GeneralSecurityException
 * @throws IOException
 */
protected static AndroidPublisher init(String applicationName,
        String serviceAccountEmail, File serviceAccountKeyFile)
throws IOException, GeneralSecurityException {
    Preconditions.checkArgument(!Strings.isNullOrEmpty(applicationName),
            "Application name cannot be null or empty!");

    // Authorization.
    newTrustedTransport();
    Credential credential = authorizeWithServiceAccount(serviceAccountEmail, serviceAccountKeyFile);

    // Set up and return API client.
    return new AndroidPublisher.Builder(
            HTTP_TRANSPORT, JSON_FACTORY, credential).setApplicationName(applicationName)
            .build();
}
 
Example #2
Source File: AndroidPublishTask.java    From gradle-android-publisher with Apache License 2.0 6 votes vote down vote up
private AndroidPublisherExtension getAndVerifyExtension() {
	AndroidPublisherExtension publisherExtension = getProject().getExtensions()
			.getByType(AndroidPublisherExtension.class);

	Preconditions.checkArgument(!Strings.isNullOrEmpty(
					publisherExtension.getApplicationName()),
			"Application name cannot be null or empty!");
	Preconditions.checkArgument(!Strings.isNullOrEmpty(
					publisherExtension.getTrack()),
			"Track cannot be null or empty!");
	Preconditions.checkArgument(!Strings.isNullOrEmpty(
					publisherExtension.getVariantName()),
			"Variant name cannot be null or empty!");
	Preconditions.checkArgument(!Strings.isNullOrEmpty(
					publisherExtension.getPackageName()),
			"Package name cannot be null or empty!");
	Preconditions.checkArgument(!Strings.isNullOrEmpty(
					publisherExtension.getServiceAccountEmail()),
			"Service account email cannot be null or empty!");
	Preconditions.checkArgument(publisherExtension.getServiceAccountKeyFile() != null,
			"Service account key file cannot be null or empty!");

	return publisherExtension;
}
 
Example #3
Source File: RememberTheMilkService.java    From data-transfer-project with Apache License 2.0 5 votes vote down vote up
public String createTimeline() throws IOException {
  TimelineCreateResponse timelineCreateResponse =
      makeRequest(
          ImmutableMap.of("method", RememberTheMilkMethods.TIMELINES_CREATE.getMethodName()),
          TimelineCreateResponse.class);
  checkState(!Strings.isNullOrEmpty(timelineCreateResponse.timeline));
  return timelineCreateResponse.timeline;
}
 
Example #4
Source File: AndroidPromoteTask.java    From gradle-android-publisher with Apache License 2.0 5 votes vote down vote up
private AndroidPublisherExtension getAndVerifyExtension() {
	AndroidPublisherExtension publisherExtension = getProject().getExtensions()
			.getByType(AndroidPublisherExtension.class);

	Preconditions.checkArgument(!Strings.isNullOrEmpty(
					publisherExtension.getApplicationName()),
			"Application name cannot be null or empty!");
	Preconditions.checkArgument(!Strings.isNullOrEmpty(
					publisherExtension.getTrack()),
			"Track cannot be null or empty!");
	Preconditions.checkArgument(!Strings.isNullOrEmpty(
					publisherExtension.getPromotionTrack()),
			"Promotion track cannot be null or empty!");
	Preconditions.checkArgument(!publisherExtension.getTrack()
					.equals(publisherExtension.getPromotionTrack()),
			"The publishing track cannot be the same as the promotion track!");
	Preconditions.checkArgument(!Strings.isNullOrEmpty(
					publisherExtension.getPackageName()),
			"Package name cannot be null or empty!");
	Preconditions.checkArgument(!Strings.isNullOrEmpty(
					publisherExtension.getServiceAccountEmail()),
			"Service account email cannot be null or empty!");
	Preconditions.checkArgument(publisherExtension.getServiceAccountKeyFile() != null,
			"Service account key file cannot be null or empty!");

	return publisherExtension;
}
 
Example #5
Source File: StackV4RequestToStackConverter.java    From cloudbreak with Apache License 2.0 5 votes vote down vote up
private void validateStackAuthentication(StackV4Request source) {
    if (Strings.isNullOrEmpty(source.getAuthentication().getPublicKey())
            && Strings.isNullOrEmpty(source.getAuthentication().getPublicKeyId())) {
        throw new BadRequestException("You should define the publickey or publickeyid!");
    } else if (source.getAuthentication().getLoginUserName() != null) {
        throw new BadRequestException("You can not modify the default user!");
    }
}
 
Example #6
Source File: ExportMessaging.java    From fenixedu-academic with GNU Lesser General Public License v3.0 4 votes vote down vote up
private static JsonElement toJson(String string) {
    return new JsonPrimitive(Strings.nullToEmpty(string));
}