提交 e81b2741 编写于 作者: P pengys5

add application id into mapping builder which inside of for.

上级 a41b037d
......@@ -23,14 +23,16 @@ public class ApplicationRegisterServiceHandler extends ApplicationRegisterServic
@Override public void register(Application request, StreamObserver<ApplicationMapping> responseObserver) {
logger.debug("register application");
ProtocolStringList applicationCodes = request.getApplicationCodeList();
ApplicationMapping.Builder builder = ApplicationMapping.newBuilder();
for (int i = 0; i < applicationCodes.size(); i++) {
String applicationCode = applicationCodes.get(i);
int applicationId = applicationIDService.getOrCreate(applicationCode);
KeyWithIntegerValue value = KeyWithIntegerValue.newBuilder().setKey(applicationCode).setValue(applicationId).build();
ApplicationMapping mapping = ApplicationMapping.newBuilder().addApplication(i, value).build();
responseObserver.onNext(mapping);
builder.addApplication(i, value);
}
responseObserver.onNext(builder.build());
responseObserver.onCompleted();
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册