private List<ShortInstance> convertToShortList(List<GSInstance> list) { List<ShortInstance> swList = new ArrayList<>(list.size()); for (GSInstance item : list) { swList.add(new ShortInstance(item)); } return swList; }
/** * Simplified operation used for quick re-insertion of data extracted with a GET op in the related service */ @Override public void setInstances(RESTShortInstanceList instances) throws BadRequestRestEx, NotFoundRestEx, InternalErrorRestEx { int okCnt = 0; for (ShortInstance si : instances) { LOGGER.info("Adding instance " +si ); try { GSInstance i = new GSInstance(); i.setName(si.getName()); i.setDescription(si.getDescription()); i.setBaseURL(si.getUrl()); i.setUsername("unknown"); i.setPassword("unknown"); instanceAdminService.insert(i); okCnt++; } catch (Exception e) { LOGGER.info("Could not add instance " +si +": " + e.getMessage()); } } LOGGER.info(okCnt+"/"+instances.getList().size() + " items inserted"); }
long id = it.next().getId(); org.geoserver.geofence.core.model.GSInstance remote = geofenceRemoteService.getInstanceAdminService().get(id);