Statistics
| Branch: | Tag: | Revision:

root / web_client / src / gr / grnet / pithos / web / client / rest / resource / GroupsResource.java @ 9e8e14e4

History | View | Annotate | Download (1.2 kB)

1
/*
2
 *  Copyright (c) 2011 Greek Research and Technology Network
3
 */
4
package gr.grnet.pithos.web.client.rest.resource;
5

    
6
import java.util.ArrayList;
7
import java.util.List;
8

    
9
import com.google.gwt.json.client.JSONArray;
10
import com.google.gwt.json.client.JSONObject;
11
import com.google.gwt.json.client.JSONParser;
12

    
13
public class GroupsResource extends RestResource {
14

    
15
        public GroupsResource(String aUri) {
16
                super(aUri);
17
        }
18

    
19
        List<String> groupPaths = new ArrayList<String>();
20

    
21
        /**
22
         * Retrieve the groupPaths.
23
         *
24
         * @return the groupPaths
25
         */
26
        public List<String> getGroupPaths() {
27
                return groupPaths;
28
        }
29

    
30
        /**
31
         * Modify the groupPaths.
32
         *
33
         * @param newGroupPaths the groupPaths to set
34
         */
35
        public void setGroupPaths(List<String> newGroupPaths) {
36
                groupPaths = newGroupPaths;
37
        }
38

    
39
        @Override
40
        public void createFromJSON(String text) {
41
                JSONArray array = (JSONArray) JSONParser.parse(text);
42
                if (array != null)
43
                        for (int i = 0; i < array.size(); i++) {
44
                                JSONObject js = array.get(i).isObject();
45
                                if(js != null){
46
                                        String groupUri = unmarshallString(js, "uri");
47
                                        if(groupUri != null)
48
                                                getGroupPaths().add(groupUri);
49
                                }
50
                        }
51
        }
52

    
53
        @Override
54
        public String getLastModifiedSince() {
55
                return null;
56
        }
57
}