@ActionParam("matchRule") String matchRule, @ActionParam("scenePath") String scenePath, @ActionParam("proxyHost") @Optional String proxyHost, @ActionParam("proxyPort") @Optional String proxyPort, @ActionParam("caCertPath") @Optional String caCertPath, @ActionParam("caCertPwd") @Optional String caCertPwd, @ActionParam("caAlias") @Optional String caAlias, @ActionParam("caKeyPwd") @Optional String caKeyPwd, @ActionParam("caCertCN") @Optional String caCertCN, @ActionParam("caCertOU") @Optional String caCertOU, @ActionParam("caCertO") @Optional String caCertO, @ActionParam("caCertL") @Optional String caCertL, @ActionParam("caCertCC") @Optional String caCertCC) { _currSceneMode = SceneMode.fromString(sceneMode); if (_currSceneMode == null) {
@Finder("assocKeyFinderOpt") public List<Message> assocKeyFinderOpt(@Optional @AssocKeyParam("src") String src) { return Collections.emptyList(); } }
@Action(name="returnIntOptionalParam") public int returnIntOptionalParam(@Optional @ActionParam ("param") final Integer param) { return (param == null? 0 : param); }
@Action(name="returnBoolOptionalParam") public boolean returnBoolOptionalParam(@Optional @ActionParam("param") final Boolean param) { return (param == null? Boolean.TRUE : param); }
@Action(name = "someAction", resourceLevel = ResourceLevel.ENTITY) public Greeting someAction(@ActionParam("a") @Optional("1") int a, @ActionParam("b") @Optional("default") String b, @ActionParam("c") @Optional TransferOwnershipRequest c, @ActionParam("d") TransferOwnershipRequest d, @ActionParam("e") Integer e) { return createGreeting(); }
@Finder("search") public List<Group> search(@PagingContextParam PagingContext pagingContext, @QueryParam("keywords") @Optional String keywords, @QueryParam("nameKeywords") @Optional String nameKeywords, @QueryParam("groupID") @Optional Integer groupID) { return getGroupMgr().search(keywords, nameKeywords, groupID, pagingContext.getStart(), pagingContext.getCount()); }
@QueryParam("nativeArray") @Optional("[1.1, 2.2, 3.3]") double[] nativeArray, @QueryParam("coercedArray") @Optional("[1.1, 2.2, 3.3]") int[] coercedArray, @QueryParam("wrappedArray") @Optional("[2, 3, 4]") IntegerArray wrappedArray, @QueryParam("wrappedMap") @Optional("{\"A\": 1, \"B\": 2}") IntegerMap wrappedMap, @QueryParam("bytes") @Optional("\u0007") ByteString bytes, @QueryParam("fixed") @Optional("\u0001\u0002\u0003\u0004" + "\u0005\u0006\u0007\u0008" + "\u0009\n\u000B\u000C" + "\r\u000E\u000F\u0010") Fixed16 fixed, @QueryParam("union") @Optional("{\"string\": \"I'm String\"}") Union union, @QueryParam("unionArray") @Optional("[{\"int\": 123}]") Union[] unionArray, @QueryParam("record") @Optional("{\"intParameter\": 7, \"stringParameter\": \"success\"}") GroupMembershipParam record, @QueryParam("records") @Optional("[{\"intParameter\": 7, \"stringParameter\": \"success\"}]") GroupMembershipParam[] records)
@Finder("search") public List<Message> search(@PagingContextParam PagingContext ctx, @QueryParam("keyword") @Optional String keyword) { keyword = keyword.toLowerCase(); List<Message> messages = new ArrayList<Message>(); int idx = 0; int start = ctx.getStart(); int stop = start + ctx.getCount(); for (Message g : _db.values()) { if (keyword == null || g.getMessage().toLowerCase().contains(keyword)) { if (idx++ >= ctx.getStart()) { messages.add(g); } if (idx == stop) { break; } } } return messages; } }
@Finder("searchWithTones") public List<Greeting> searchWithTones(@PagingContextParam PagingContext ctx, @QueryParam("tones") @Optional Tone[] tones) { Set<Tone> toneSet = new HashSet<Tone>(Arrays.asList(tones)); List<Greeting> greetings = new ArrayList<Greeting>(); int idx = 0; int start = ctx.getStart(); int stop = start + ctx.getCount(); for (Greeting g : _db.values()) { if (idx++ >= ctx.getStart()) { if (tones == null || toneSet.contains(g.getTone())) { greetings.add(g); } if (idx == stop) { break; } } } return greetings; }
@RestMethod.Create public CreateResponse createGreeting(Greeting entity, @Optional @QueryParam("auth") String auth) { validateAuth(auth); return _impl.create(entity, false); }
@RestMethod.Create public CreateResponse create(Greeting entity, @QueryParam("isNullId") @Optional("false") boolean isNullId) { entity.setId(_idSeq.incrementAndGet()); _db.put(entity.getId(), entity); if (isNullId) { return new CreateResponse(null, HttpStatus.S_201_CREATED); } return new CreateResponse(entity.getId()); }
@Finder("searchWithDefault") public List<Greeting> searchWithDefault(@PagingContextParam PagingContext ctx, @QueryParam("tone") @Optional("FRIENDLY") Tone tone) { return search(ctx, tone); }
@RestMethod.Delete public UpdateResponse deleteGreeting(Long key, @Optional @QueryParam("auth") String auth) { validateAuth(auth); return _impl.delete(key); }
@RestMethod.PartialUpdate public UpdateResponse updateGreeting(Long key, PatchRequest<Greeting> patch, @Optional @QueryParam("auth") String auth) { validateAuth(auth); return _impl.update(key, patch); }
@RestMethod.Update public UpdateResponse updateGreeting(Long key, Greeting entity, @Optional @QueryParam("auth") String auth) { validateAuth(auth); return _impl.update(key, entity); }
/** * @see AssociationResource#get */ @RestMethod.Get public ComplexKeyGroupMembership get(ComplexResourceKey<GroupMembershipKey, GroupMembershipParam> id, @Optional @QueryParam("testParam") GroupMembershipParam param, @Optional @QueryParam("testParamArray") GroupMembershipQueryParamArray paramArray) { // For the purpose of test, if param is present, must contain both int and string // parts and the int param string value must equal the string parameter value. if (param != null) { String stringParam = param.getStringParameter(); Integer intParam = param.getIntParameter(); if (stringParam == null || intParam == null || !stringParam.equals(intParam.toString())) { throw new RestLiServiceException(S_400_BAD_REQUEST, "The values of testParam parameter don't match"); } } return fromGroupMembership(_app.getMembershipMgr().get(complexKeyToCompoundKey(id))); }