Issue #358 merged esb.camel project for plot update compatibility

Former-commit-id: ba90282320443c6c41c3188db9f43ffb11399bdd
This commit is contained in:
Max Schenkelberg 2012-03-02 13:26:44 -06:00
parent 1f714b1a5b
commit 76e7a02f76
2 changed files with 3 additions and 23 deletions

View file

@ -44,8 +44,6 @@ public class DataUriAggregator {
private List<String> dataUris = new ArrayList<String>(); private List<String> dataUris = new ArrayList<String>();
private List<Integer> ids = new ArrayList<Integer>();
/** /**
* Add data uris to the queue * Add data uris to the queue
* *
@ -55,11 +53,7 @@ public class DataUriAggregator {
synchronized (this) { synchronized (this) {
for (String uri : uris) { for (String uri : uris) {
if (uri != null) { if (uri != null) {
int idx = uri.lastIndexOf('/');
Integer id = Integer.valueOf(uri.substring(idx + 1));
uri = uri.substring(0, idx);
dataUris.add(uri); dataUris.add(uri);
ids.add(id);
} }
} }
} }
@ -73,7 +67,7 @@ public class DataUriAggregator {
*/ */
public boolean hasUris(Object obj) { public boolean hasUris(Object obj) {
synchronized (this) { synchronized (this) {
return dataUris.size() > 0 || ids.size() > 0; return dataUris.size() > 0;
} }
} }
@ -85,16 +79,9 @@ public class DataUriAggregator {
public DataURINotificationMessage sendQueuedUris() { public DataURINotificationMessage sendQueuedUris() {
synchronized (this) { synchronized (this) {
String[] uris = dataUris.toArray(new String[dataUris.size()]); String[] uris = dataUris.toArray(new String[dataUris.size()]);
int[] ids = new int[this.ids.size()];
int idx = 0;
for (Integer i : this.ids) {
ids[idx++] = i.intValue();
}
dataUris.clear(); dataUris.clear();
this.ids.clear();
DataURINotificationMessage msg = new DataURINotificationMessage(); DataURINotificationMessage msg = new DataURINotificationMessage();
msg.setDataURIs(uris); msg.setDataURIs(uris);
msg.setIds(ids);
return msg; return msg;
} }
} }
@ -107,16 +94,9 @@ public class DataUriAggregator {
public PracticeDataURINotificationMessage sendPracticeQueuedUris() { public PracticeDataURINotificationMessage sendPracticeQueuedUris() {
synchronized (this) { synchronized (this) {
String[] uris = dataUris.toArray(new String[dataUris.size()]); String[] uris = dataUris.toArray(new String[dataUris.size()]);
int[] ids = new int[this.ids.size()];
int idx = 0;
for (Integer i : this.ids) {
ids[idx++] = i.intValue();
}
dataUris.clear(); dataUris.clear();
this.ids.clear();
PracticeDataURINotificationMessage msg = new PracticeDataURINotificationMessage(); PracticeDataURINotificationMessage msg = new PracticeDataURINotificationMessage();
msg.setDataURIs(uris); msg.setDataURIs(uris);
msg.setIds(ids);
return msg; return msg;
} }
} }

View file

@ -42,13 +42,13 @@ public class ToDataURI {
public String[] toDataURI(PluginDataObject[] pdo) { public String[] toDataURI(PluginDataObject[] pdo) {
String[] strs = new String[pdo.length]; String[] strs = new String[pdo.length];
for (int i = 0; i < strs.length; i++) { for (int i = 0; i < strs.length; i++) {
strs[i] = pdo[i].getDataURI() + '/' + pdo[i].getId(); strs[i] = pdo[i].getDataURI();
} }
return strs; return strs;
} }
public String toDataURI(PluginDataObject pdo) { public String toDataURI(PluginDataObject pdo) {
return pdo.getDataURI() + '/' + pdo.getId(); return pdo.getDataURI();
} }
} }