public Details getDetails(String id) throws InvokerException { Details details = new Details();
try {
URL url = new URL(BaseUrl, "/cxf/query/ask?id=" + id);
LOGGER.trace("URL: {}", url);
String xml = queryStore(url);
LOGGER.trace("Query result: {}", xml);
details = new Details();
InputSrc source = new InputSrc(new StringReader(xml));
ResultsContentHandler handler = new ResultsContentHandler();
XMLReader reader = XMLReaderFactory.createXMLReader();
reader.setContentHandler(handler);
reader.parse(source);
for (Hashtable<String,String> result : handler.getResultSet()) {
String baseId = result.get("baseId");
ArrayList<Details> list = getHistoryDetails(baseId );
for(Details t : list) {
details.setStatus(t.getStatus());
}
}
} catch (Exception e) {
throw new InvokerException(e);
}
return details;
}
我想要实现的是返回 Arraylist 中所有项目的详细信息。例如,我希望获得多个状态,但目前我只获得一种状态。
细节类
public class Details {
private Core core;
private String department;
private GregorianCalendar timestampReceived;
private GregorianCalendar timestampReported;
private String status;
private GregorianCalendar timestampStatus;
private String explanation;
public Details(){}
public Details(Core core,
String department, GregorianCalendar timestampReceived,
GregorianCalendar timestampReported, String status,
GregorianCalendar timestampStatus, String explanation) {
super();
this.core = core;
this.department = department;
this.timestampReceived = timestampReceived;
this.timestampReported = timestampReported;
this.status = status;
this.timestampStatus = timestampStatus;
this.explanation = explanation;
}
public Core getCore() {
return core;
}
public String getDepartment() {
return department;
}
public GregorianCalendar getTimestampReceived() {
return timestampReceived;
}
public GregorianCalendar getTimestampReported() {
return timestampReported;
}
public String getStatus() {
return status;
}
public GregorianCalendar getTimestampStatus() {
return timestampStatus;
}
public String getExplanation() {
return explanation;
}
public void setCore(Core core) {
this.core = core;
}
public void setDepartment(String department) {
this.department = department;
}
public void setTimestampReceived(GregorianCalendar timestampReceived) {
this.timestampReceived = timestampReceived;
}
public void setTimestampReported(GregorianCalendar timestampReported) {
this.timestampReported = timestampReported;
}
public void setStatus(String status) {
this.status = status;
}
public void setTimestampStatus(GregorianCalendar timestampStatus) {
this.timestampStatus = timestampStatus;
}
public void setExplanation(String explanation) {
this.explanation = explanation;
}
}