@Override public IZone createZone(ISite site, IZoneCreateRequest request) throws SiteWhereException { return delegate.createZone(site, request); }
@Override public IZone createZone(IZoneCreateRequest request) throws SiteWhereException { return getDelegate().createZone(request); }
/** * Persist a previously created zone. * * @param builder * @return * @throws SiteWhereException */ public IZone persist(ZoneCreateRequest.Builder builder) throws SiteWhereException { return getDeviceManagement().createZone(builder.build()); }
public IZone persist(ISite site, ZoneCreateRequest.Builder builder) throws SiteWhereException { return getDeviceManagement().createZone(site, builder.build()); }
@Override public void createZone(GCreateZoneRequest request, StreamObserver<GCreateZoneResponse> responseObserver) { try { GrpcUtils.handleServerMethodEntry(this, DeviceManagementGrpc.getCreateZoneMethod()); IZoneCreateRequest apiRequest = DeviceModelConverter.asApiZoneCreateRequest(request.getRequest()); IZone apiResult = getDeviceManagement().createZone(apiRequest); GCreateZoneResponse.Builder response = GCreateZoneResponse.newBuilder(); response.setZone(DeviceModelConverter.asGrpcZone(apiResult)); responseObserver.onNext(response.build()); responseObserver.onCompleted(); } catch (Throwable e) { GrpcUtils.handleServerMethodException(DeviceManagementGrpc.getCreateZoneMethod(), e, responseObserver); } finally { GrpcUtils.handleServerMethodExit(DeviceManagementGrpc.getCreateZoneMethod()); } }
/** * Create a new zone for a site. * * @param input * @return * @throws SiteWhereException */ @RequestMapping(value = "/{siteToken}/zones", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "Create new zone for site") @Secured({ SiteWhereRoles.REST }) @Documented(examples = { @Example(stage = Stage.Request, json = Sites.CreateZoneRequest.class, description = "createZoneRequest.md"), @Example(stage = Stage.Response, json = Sites.CreateZoneResponse.class, description = "createZoneResponse.md") }) public Zone createZone(@ApiParam(value = "Unique site token", required = true) @PathVariable String siteToken, @RequestBody ZoneCreateRequest request, HttpServletRequest servletRequest) throws SiteWhereException { Tracer.start(TracerCategory.RestApiCall, "createZone", LOGGER); try { ISite site = SiteWhere.getServer().getDeviceManagement(getTenant(servletRequest)).getSiteByToken(siteToken); if (site == null) { throw new SiteWhereSystemException(ErrorCode.InvalidSiteToken, ErrorLevel.ERROR); } IZone zone = SiteWhere.getServer().getDeviceManagement(getTenant(servletRequest)).createZone(site, request); return Zone.copy(zone); } finally { Tracer.stop(LOGGER); } }