@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); } }
/** * 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()); }
@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()); }
@Override public CreateResponse create(Group group) { Group createdGroup = getGroupMgr().create(group); return new CreateResponse(createdGroup.getId()); }
@Override public BatchCreateResult<CustomLong, Greeting> batchCreate(BatchCreateRequest<CustomLong, Greeting> entities) { List<CreateResponse> results = new ArrayList<CreateResponse>(); for (Greeting greeting: entities.getInput()) { // just echo back the provided ids (for testing only, this would not a be correct implementation of POST) results.add(new CreateResponse(new CustomLong(greeting.getId()), HttpStatus.S_204_NO_CONTENT)); } return new BatchCreateResult<CustomLong, Greeting>(results); } }
@RestMethod.Create public CreateResponse create(final ValidationDemo entity, @ValidatorParam RestLiDataValidator validator) { ValidationResult result = validator.validateInput(entity); if (!result.isValid()) { throw new RestLiServiceException(HttpStatus.S_422_UNPROCESSABLE_ENTITY, result.getMessages().toString()); } return new CreateResponse(1234); }
@RestMethod.Create public CreateResponse create(final Greeting greeting, @QueryParam(value="unionRefParam") @Optional UnionRefInline unionRef) { // just echo back the provided id (for testing only, this would not a be correct implementation of POST) return new CreateResponse(new CustomLong(greeting.getId())); }