Package com.linkedin.data.template

Examples of com.linkedin.data.template.StringArray


                      prevRec.getMetadata(GetMode.DEFAULT),
                      currRec.getMetadata(GetMode.DEFAULT));

    final String prevAssocKey = prevRec.getAssocKey(GetMode.DEFAULT);
    final String currAssocKey = currRec.getAssocKey(GetMode.DEFAULT);
    final StringArray prevAssocKeys = prevRec.getAssocKeys(GetMode.DEFAULT);
    final StringArray currAssocKeys = currRec.getAssocKeys(GetMode.DEFAULT);

    // assocKey and assocKeys are mutually exclusive
    assert((prevAssocKey == null || prevAssocKeys == null) && (currAssocKey == null || currAssocKeys == null));

    // assocKey is deprecated
    // assocKey upgrading to single-element assocKeys is compatible
    // the opposite direction is deprecated thus incompatible

    if (prevAssocKeys == null && currAssocKeys == null)
    {
      checkEqualSingleValue(prevRec.schema().getField("assocKey"), prevAssocKey, currAssocKey);
    }
    else if (prevAssocKey == null && currAssocKey == null)
    {
      checkEqualSingleValue(prevRec.schema().getField("assocKeys"), prevAssocKeys, currAssocKeys);
    }
    else if (prevAssocKeys == null)
    {
      // upgrade case

      final StringArray upgradedPrevAssocKeys = new StringArray();
      upgradedPrevAssocKeys.add(prevAssocKey);
      checkEqualSingleValue(prevRec.schema().getField("assocKey"), upgradedPrevAssocKeys, currAssocKeys);
    }
    else
    {
      // downgrade case
View Full Code Here


    JClass keyClass;
    JClass keyKeyClass = null;
    JClass keyParamsClass = null;
    Class<?> resourceSchemaClass;
    Map<String, AssocKeyTypeInfo> assocKeyTypeInfos = Collections.emptyMap();
    StringArray supportsList=null;
    RestMethodSchemaArray restMethods = null;
    FinderSchemaArray finders = null;
    ResourceSchemaArray subresources = null;
    ActionSchemaArray resourceActions = null;
    ActionSchemaArray entityActions = null;
View Full Code Here

              connectSchemaToResource(visitContext, returnsSchema);
            }
          }
        }

        final StringArray throwsArray = actionSchema.getThrows();
        if (throwsArray != null)
        {
          for (String errorName: throwsArray)
          {
            final NamedDataSchema errorSchema = extractSchema(errorName);
View Full Code Here

    if (!(paramObject instanceof DataList))
    {
      throw new RestLiInternalException("Invalid value type for parameter " + key);
    }

    return new StringArray((DataList) paramObject);
  }
View Full Code Here

    TwitterAccountsResource accountsResource;

    // #1 no defaults provided
    methodDescriptor = accountsResourceModel.findActionMethod("closeAccounts", ResourceLevel.COLLECTION);
    accountsResource = getMockResource(TwitterAccountsResource.class);
    StringArray emailAddresses = new StringArray(Lists.newArrayList("bob@test.linkedin.com", "joe@test.linkedin.com"));

    EasyMock.expect(accountsResource.closeAccounts(eq(emailAddresses), eq(true), eq((StringMap)null)))
    .andReturn((new StringMap())).once();

    String jsonEntityBody = RestLiTestHelper.doubleQuote(
View Full Code Here

    group.setLastModifiedTimestamp(System.currentTimeMillis());
    group.setLocale("en_US");

    Location location = new Location();
    location.setCountryCode("us");
    StringArray geoPlaceCodes = new StringArray();
    geoPlaceCodes.add("1-2-3-4-5");
    location.setGeoPlaceCodes(geoPlaceCodes);
    location.setGeoPostalCode("94043");
    location.setGmtOffset(-8f);
    location.setLatitude(122.1f);
    location.setLongitude(37.4f);
    location.setPostalCode("94043");
    location.setRegionCode(37);
    location.setUsesDaylightSavings(true);
    group.setLocation(location);

    group.setMaxFeeds(100);
    group.setMaxIdentityChanges(5);
    group.setMaxMembers(2000);
    group.setMaxModerators(10);
    group.setMaxSubgroups(20);
    group.setName(name);
    group.setNewsFormat(NewsFormat.RECENT);
    group.setNonMemberPermissions(NonMemberPermissions.COMMENT_AND_POST_WITH_MODERATION);
    group.setNumIdentityChanges(5);
    group.setNumMemberFlagsToDelete(3);
    group.setOpenedToNonMembersTimestamp(System.currentTimeMillis());
    group.setOtherCategory(3);
    // group.setParentGroupId();

    StringArray preApprovedEmailDomains = new StringArray();
    preApprovedEmailDomains.add("example.com");
    preApprovedEmailDomains.add("linkedin.com");

    group.setPreApprovedEmailDomains(preApprovedEmailDomains);
    group.setPreModerateMembersWithLowConnections(true);
    group.setPreModerateNewMembersPeriodInDays(3);
    group.setPreModeration(PreModerationType.COMMENTS);
View Full Code Here

  public void testWrappedArray()
  {
    Object result;

    result = test("[\"Hello\", \"World\"]", StringArray.class);
    Assert.assertEquals(result, new StringArray(Arrays.asList("Hello", "World")));
    Assert.assertSame(result.getClass(), StringArray.class);

    result = test("[false, true]", BooleanArray.class);
    Assert.assertEquals(result, new BooleanArray(Arrays.asList(false, true)));
    Assert.assertSame(result.getClass(), BooleanArray.class);
View Full Code Here

    Assert.assertEquals(messageArray.get(1).getId(), "My Message Id 2");
    Assert.assertEquals(messageArray.get(1).getMessage(), "My Message 2");

    //Primitive type array
    StringArray inputStringArray = new StringArray();
    inputStringArray.add("message1");
    inputStringArray.add("message2");
    Request<StringArray> stringArrayRequest =
        builders.<StringArray>action("EchoStringArray").setActionParam("Strings", inputStringArray).build();
    StringArray stringArray = REST_CLIENT.sendRequest(stringArrayRequest).getResponse().getEntity();

    Assert.assertEquals(stringArray.get(0), "message1");
    Assert.assertEquals(stringArray.get(1), "message2");

    //Enum array
    ToneArray inputTonesArray = new ToneArray();
    inputTonesArray.add(Tone.SINCERE);
    inputTonesArray.add(Tone.FRIENDLY);
View Full Code Here

        ParameterSchemaArray parameters = createParameters(resourceMethodDescriptor);
        if (parameters.size() > 0)
        {
          finder.setParameters(parameters);
        }
        StringArray assocKeys = createAssocKeyParameters(resourceMethodDescriptor);
        if (assocKeys.size() > 0)
        {
          finder.setAssocKeys(assocKeys);
        }
        if (resourceMethodDescriptor.getFinderMetadataType() != null)
        {
View Full Code Here

    return findersArray;
  }

  private StringArray createAssocKeyParameters(final ResourceMethodDescriptor resourceMethodDescriptor)
  {
    StringArray assocKeys = new StringArray();
    for (Parameter<?> param : resourceMethodDescriptor.getParameters())
    {
      // assocKeys are listed outside the parameters list
      if (param.getParamType() == Parameter.ParamType.KEY || param.getParamType() == Parameter.ParamType.ASSOC_KEY_PARAM)
      {
        assocKeys.add(param.getName());
        continue;
      }
    }
    return assocKeys;
  }
View Full Code Here

TOP

Related Classes of com.linkedin.data.template.StringArray

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.