org.trustedanalytics.user.invite.AngularInvitationLinkGenerator.java Source code

Java tutorial

Introduction

Here is the source code for org.trustedanalytics.user.invite.AngularInvitationLinkGenerator.java

Source

/**
 *  Copyright(c)2015 IntelCorporation
 *
 *  LicensedundertheApacheLicense,Version2.0(the"License");
 *  youmaynotusethisfileexceptincompliancewiththeLicense.
 *  YoumayobtainacopyoftheLicenseat
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unlessrequiredbyapplicablelaworagreedtoinwriting,software
 *  distributedundertheLicenseisdistributedonan"ASIS"BASIS,
 *  WITHOUTWARRANTIESORCONDITIONSOFANYKIND,eitherexpressorimplied.
 *  SeetheLicenseforthespecificlanguagegoverningpermissionsand
 *  limitationsundertheLicense.
 */
package org.trustedanalytics.user.invite;

import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;

public class AngularInvitationLinkGenerator implements InvitationLinkGenerator {
    @Override
    public String getLink(String code) {
        Preconditions.checkArgument(!Strings.isNullOrEmpty(code));
        return ServletUriComponentsBuilder.fromCurrentContextPath().path("/new-account?code=" + code).build()
                .toUriString();
    }
}