Package com.linkedin.restli.examples.greetings.api

Examples of com.linkedin.restli.examples.greetings.api.Greeting


  {
    Map<CustomLong, Greeting> result = new HashMap<CustomLong, Greeting>(ids.size());

    for (CustomLong id: ids)
    {
      result.put(id, new Greeting().setId(id.toLong()));
    }

    return result;
  }
View Full Code Here


    {
      String s = (new String[0])[42];
    }
    catch (ArrayIndexOutOfBoundsException e)
    {
      Greeting details = new Greeting().setMessage("Hello, Sorry for the mess");

      throw new RestLiServiceException(HttpStatus.S_500_INTERNAL_SERVER_ERROR, "error processing request", e)
              .setServiceErrorCode(42).setErrorDetails(details.data());
    }
    return null;
  }
View Full Code Here

  private static final String NO_HEADER_MESSAGE = "No Header!";

  @RestMethod.Get
  public Greeting get(Long key, @ProjectionParam MaskTree projection, @PathKeysParam PathKeys keys)
  {
    Greeting greeting = createGreeting(projection, keys);
    greeting.setId(key);

    return greeting;
  }
View Full Code Here

  @Finder("finder")
  public List<Greeting> finder(@HeaderParam("Expected-Header") String header, @ProjectionParam MaskTree projection, @PathKeysParam PathKeys keys)
  {
    List<Greeting> list = new ArrayList<Greeting>();

    Greeting greeting1 = createGreeting(projection, keys);
    greeting1.setId(1L);

    Greeting greeting2 = createGreeting(header);
    greeting2.setId(2L);

    list.add(greeting1);
    list.add(greeting2);
    return list;
  }
View Full Code Here

    return list;
  }

  private static Greeting createGreeting(String header)
  {
    Greeting greeting = new Greeting();
    if (header != null)
    {
      greeting.setMessage(header);
    }
    else
    {
      greeting.setMessage(NO_HEADER_MESSAGE);
    }
    greeting.setTone(Tone.SINCERE);
    return greeting;

  }
View Full Code Here

  }

  private static Greeting createGreeting(MaskTree projection, PathKeys keys)
  {
    Greeting greeting = new Greeting();
    if (projection != null)
    {
      greeting.setMessage(PROJECTION_MESSAGE);
    }
    else
    {
      greeting.setMessage(NO_PROJECTION_MESSAGE);
    }
    if (keys.get(ID) == null)
    {
      greeting.setTone(Tone.INSULTING);
    }
    else
    {
      greeting.setTone(Tone.FRIENDLY);
    }
    return greeting;
  }
View Full Code Here

public class ExceptionsResource2 extends CollectionResourceTemplate<Long, Greeting>
{
  @RestMethod.Get
  public GetResult<Greeting> getWithResult(Long key)
  {
    final Greeting value = new Greeting().setMessage("Hello, sorry for the mess");
    return new GetResult<Greeting>(value, HttpStatus.S_500_INTERNAL_SERVER_ERROR);
  }
View Full Code Here

  @RestMethod.Get
  public Greeting getGreeting(Long idx, @Optional @QueryParam("auth") String auth,
                              @Optional @QueryParam("testComplex") GroupMembershipParam complexParam)
  {
    validateAuth(auth);
    Greeting g = _impl.get(idx);
    return g;
  }
View Full Code Here

  public Greeting get(CompoundKey key)
  {
    CustomLong longId = (CustomLong)key.getPart("longId");
    Date dateId = (Date)key.getPart("dateId");

    return new Greeting().setId(longId.toLong() + dateId.getTime());
  }
View Full Code Here

    RestLiResponseException exception = null;

    try
    {
      Request<EmptyRecord> createRequest = builders.create()
          .input(new Greeting().setId(11L).setMessage("@#$%@!$%").setTone(Tone.INSULTING))
          .build();
      ResponseFuture<EmptyRecord> future;

      if (explicit)
      {
View Full Code Here

TOP

Related Classes of com.linkedin.restli.examples.greetings.api.Greeting

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.