Project

General

Profile

« Previous | Next » 

Revision 51432

Registering providers as catalogue groups

View differences:

CatalogueAPIClient.java
35 35
	private final String purgeItemPath = "rest/api/items/purge";
36 36
	private final String showGroupPath = "rest/api/groups/show"; //param id
37 37
	private final String createGroupPath = "rest/api/groups/create";
38
	private final String purgeGroupPath = "rest/api/groups/purge";
38 39
	private String purgeBodyTemplate = "{\"id\":\"%s\"}";
39 40

  
40 41
	@Autowired
......
122 123
	}
123 124

  
124 125

  
125
	protected boolean purge(final String resCatName) throws URISyntaxException, IOException {
126
		log.debug(String.format("Catalogue --> Purge %s", resCatName));
127
		String body = String.format(purgeBodyTemplate, resCatName);
126

  
127
	protected boolean purgeGroup(final String groupname) throws IOException, URISyntaxException {
128
		log.debug(String.format("Catalogue --> Purge Group %s", groupname));
129
		return purge(purgeGroupPath, groupname);
130
	}
131

  
132
	protected boolean purgeItem(final String resCatName) throws URISyntaxException, IOException {
133
		log.debug(String.format("Catalogue --> Purge Item %s", resCatName));
134
		return purge(purgeItemPath, resCatName);
135
	}
136

  
137

  
138
	private boolean purge(String purgePath, String id) throws URISyntaxException, IOException {
139
		String body = String.format(purgeBodyTemplate, id);
128 140
		log.warn("DEL BODY: "+body);
129 141
		HttpEntity<String> entity = new HttpEntity<String>(body, getHeaders());
130
		URI uri = new URIBuilder(getBaseURL()+purgeItemPath).addParameter("gcube-token", getApplicationToken()).build();
142
		URI uri = new URIBuilder(getBaseURL()+purgePath).addParameter("gcube-token", getApplicationToken()).build();
131 143
		ResponseEntity<String> res = jrrRestTemplate.exchange(uri, HttpMethod.DELETE, entity, String.class);
132 144
		CatalogueAPIResponse response = new CatalogueAPIResponse();
133 145
		if(res.getStatusCode() == HttpStatus.OK){

Also available in: Unified diff