Skip to content

Commit 82f0c12

Browse files
author
TanyaEf
committed
Updated BatchAttributeAdapter
1 parent e17c89e commit 82f0c12

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/main/java/com/jaspersoft/jasperserver/jaxrs/client/apiadapters/attributes/BatchAttributeAdapter.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
*/
2121
package com.jaspersoft.jasperserver.jaxrs.client.apiadapters.attributes;
2222

23+
import com.jaspersoft.jasperserver.dto.authority.hypermedia.HypermediaAttribute;
2324
import com.jaspersoft.jasperserver.dto.authority.hypermedia.HypermediaAttributesListWrapper;
2425
import com.jaspersoft.jasperserver.jaxrs.client.apiadapters.AbstractAdapter;
2526
import com.jaspersoft.jasperserver.jaxrs.client.core.Callback;
@@ -30,7 +31,10 @@
3031
import com.jaspersoft.jasperserver.jaxrs.client.core.ThreadPoolUtil;
3132
import com.jaspersoft.jasperserver.jaxrs.client.core.exceptions.handling.DefaultErrorHandler;
3233
import com.jaspersoft.jasperserver.jaxrs.client.core.operationresult.OperationResult;
34+
import java.util.ArrayList;
3335
import java.util.Collection;
36+
import java.util.Iterator;
37+
import java.util.LinkedList;
3438
import javax.ws.rs.core.MultivaluedHashMap;
3539
import javax.ws.rs.core.MultivaluedMap;
3640

@@ -104,6 +108,14 @@ public void run() {
104108
}
105109

106110
public OperationResult<HypermediaAttributesListWrapper> createOrUpdate(HypermediaAttributesListWrapper attributesListWrapper) {
111+
LinkedList<HypermediaAttribute> list = new LinkedList<HypermediaAttribute>(attributesListWrapper.getProfileAttributes());
112+
for (Iterator<HypermediaAttribute> iterator = list.iterator();iterator.hasNext();) {
113+
HypermediaAttribute current = iterator.next();
114+
if (!params.get("name").contains(current.getName())) {
115+
iterator.remove();
116+
}
117+
}
118+
attributesListWrapper.setProfileAttributes(list);
107119
return buildRequest().put(attributesListWrapper);
108120
}
109121

0 commit comments

Comments
 (0)