@Override /** * Add flowConfig locally and trigger all listeners iff @param triggerListener is set to true */ public CreateResponse createFlowConfig(FlowConfig flowConfig, boolean triggerListener) throws FlowConfigLoggedException { log.info("[GAAS-REST] Create called with flowGroup " + flowConfig.getId().getFlowGroup() + " flowName " + flowConfig.getId().getFlowName()); FlowSpec flowSpec = createFlowSpecForConfig(flowConfig); this.flowCatalog.put(flowSpec, triggerListener); FlowStatusId flowStatusId = new FlowStatusId() .setFlowName(flowSpec.getConfigAsProperties().getProperty(ConfigurationKeys.FLOW_NAME_KEY)) .setFlowGroup(flowSpec.getConfigAsProperties().getProperty(ConfigurationKeys.FLOW_GROUP_KEY)); if (flowSpec.getConfigAsProperties().containsKey(ConfigurationKeys.FLOW_EXECUTION_ID_KEY)) { flowStatusId.setFlowExecutionId(Long.valueOf(flowSpec.getConfigAsProperties().getProperty(ConfigurationKeys.FLOW_EXECUTION_ID_KEY))); } else { flowStatusId.setFlowExecutionId(-1L); } return new CreateResponse(new ComplexResourceKey<>(flowConfig.getId(), flowStatusId), HttpStatus.S_201_CREATED); } }
boolean isGetAfterCreate = createResponse instanceof CreateKVResponse; if (createResponse.hasError()) RestLiServiceException exception = createResponse.getError(); return new RestLiResponseDataImpl<>(new CreateResponseEnvelope(exception, isGetAfterCreate), headers, cookies); if (createResponse.hasId()) id = ResponseUtils.translateCanonicalKeyToAlternativeKeyIfNeeded(createResponse.getId(), routingResult); final ProtocolVersion protocolVersion = routingResult.getContext().getRestliProtocolVersion(); String stringKey = URIParamUtils.encodeKeyForUri(id, UriComponent.Type.PATH_SEGMENT, protocolVersion); if (createResponse.getStatus() == null) return new RestLiResponseDataImpl<>(new CreateResponseEnvelope(createResponse.getStatus(), idResponse, isGetAfterCreate), headers, cookies);
Object id = ResponseUtils.translateCanonicalKeyToAlternativeKeyIfNeeded(createResponse.getId(), routingResult); if (createResponse.getError() == null) createResponse.getStatus().getCode(), id, collectionCreateList.add(new BatchCreateResponseEnvelope.CollectionCreateResponseItem(createResponse.getError()));
@SuppressWarnings("unchecked") public K getId() { return (K) super.getId(); }
/** * Add flowConfig locally and trigger all listeners iff @param triggerListener is set to true */ public CreateResponse createFlowConfig(FlowConfig flowConfig, boolean triggerListener) throws FlowConfigLoggedException { log.info("[GAAS-REST] Create called with flowGroup " + flowConfig.getId().getFlowGroup() + " flowName " + flowConfig.getId().getFlowName()); FlowSpec flowSpec = createFlowSpecForConfig(flowConfig); // Existence of a flow spec in the flow catalog implies that the flow is currently running. // If the new flow spec has a schedule we should allow submission of the new flow to accept the new schedule. // However, if the new flow spec does not have a schedule, we should allow submission only if it is not running. if (!flowConfig.hasSchedule() && this.flowCatalog.exists(flowSpec.getUri())) { return new CreateResponse(new ComplexResourceKey<>(flowConfig.getId(), new EmptyRecord()), HttpStatus.S_409_CONFLICT); } else { this.flowCatalog.put(flowSpec, triggerListener); return new CreateResponse(new ComplexResourceKey<>(flowConfig.getId(), new EmptyRecord()), HttpStatus.S_201_CREATED); } }
return new CreateResponse(new ComplexResourceKey<>(flowConfig.getId(), new EmptyRecord()), HttpStatus.S_201_CREATED); } else { return this.localHandler.createFlowConfig(flowConfig);
public CreateResponse create(Message message) { // Associations should never support creates or batch_creates. This is a bug in Rest.li that needs to be fixed. // For now we are implementing this method to make sure that calling getId() on the client throws an exception. return new CreateResponse(SIMPLE_COMPOUND_KEY, HttpStatus.S_201_CREATED); }
@Override CreateResponse buildResponse() { return new CreateResponse(1); } });
@Override public CreateResponse create(GroupContact entity) { return new CreateResponse(S_201_CREATED); }
@Override CreateResponse buildResponse() { return new CreateResponse(1); } });
@Override public CreateResponse create(final Message message) { ComplexResourceKey<TwoPartKey, TwoPartKey> key = _dataProvider.create(message); return new CreateResponse(key); }
@Override public CreateResponse create(Greeting entity) { return new CreateResponse(entity.getId()); }
public void run() { callback.onSuccess(new CreateResponse(HttpStatus.S_200_OK)); } };
@Override public void onFinished() { _createResponseCallback.onSuccess(new CreateResponse(150)); }
@Override public CreateResponse create(Greeting greeting) { Map<String, String> requestHeaders = getContext().getRequestHeaders(); if (!requestHeaders.get(TEST1_HEADER).equals(TEST1_VALUE) || !requestHeaders.get(TEST2_HEADER).equals(TEST2_VALUE)) { throw new RestLiServiceException(HttpStatus.S_500_INTERNAL_SERVER_ERROR, "Request headers are not modified from filter."); } return new CreateResponse(1234L); } }
public void run() { ComplexResourceKey<TwoPartKey, TwoPartKey> key = _dataProvider.create(message); result.done(new CreateResponse(key)); } };
@RestMethod.Create public CreateResponse create(Message entity) { _db.put(entity.getId().toString(), entity); return new CreateResponse(entity.getId()); }
@RestMethod.Create public CreateResponse create(Greeting entity) { //Based off of the message in the greeting, we send back various types of nulls if (entity.getMessage().equalsIgnoreCase("nullCreateResponse")) { //Return a null CreateResponse return null; } else { //Return a valid CreateResponse but with a null HttpStatus final HttpStatus nullStatus = null; return new CreateResponse(nullStatus); } //Note, we don't need a test for returning a null entityID }
@Override public BatchCreateResult<ComplexResourceKey<TwoPartKey, TwoPartKey>, Message> batchCreate(final BatchCreateRequest<ComplexResourceKey<TwoPartKey, TwoPartKey>, Message> entities) { List<CreateResponse> createResponses = new ArrayList<CreateResponse>(entities.getInput().size()); for(Message message : entities.getInput()) { ComplexResourceKey<TwoPartKey, TwoPartKey> key = _dataProvider.create(message); CreateResponse createResponse = new CreateResponse(key); createResponses.add(createResponse); } return new BatchCreateResult<ComplexResourceKey<TwoPartKey, TwoPartKey>, Message>(createResponses); }
@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()); }