use of org.glassfish.api.admin.progress.ProgressStatusDTO.ChildProgressStatusDTO in project Payara by payara.
the class ProgressStatusDTOJsonProprietaryReader method readChildProgressStatus.
public static ChildProgressStatusDTO readChildProgressStatus(JsonParser jp) throws IOException {
ProgressStatusDTO psd = new ProgressStatusDTO();
int allocatedSteps = 0;
while (jp.nextToken() != JsonToken.END_OBJECT) {
String fieldname = jp.getCurrentName();
// move to value
jp.nextToken();
if ("name".equals(fieldname)) {
psd.setName(jp.getText());
} else if ("id".equals(fieldname)) {
psd.setId(jp.getText());
} else if ("total-step-count".equals(fieldname)) {
psd.setTotalStepCount(jp.getIntValue());
} else if ("current-step-count".equals(fieldname)) {
psd.setCurrentStepCount(jp.getIntValue());
} else if ("complete".equals(fieldname)) {
psd.setCompleted(jp.getBooleanValue());
} else if ("allocated-steps".equals(fieldname)) {
allocatedSteps = jp.getIntValue();
} else if ("children".equals(fieldname)) {
while (jp.nextToken() != JsonToken.END_ARRAY) {
if (jp.getCurrentToken() == JsonToken.START_OBJECT) {
ProgressStatusDTO.ChildProgressStatusDTO child = readChildProgressStatus(jp);
psd.getChildren().add(child);
}
}
}
}
return new ChildProgressStatusDTO(allocatedSteps, psd);
}
Aggregations