/** * Common code for copying information from an update request to an existing * zone. * * @param request * @param target * @throws SiteWhereException */ public static void zoneUpdateLogic(IZoneCreateRequest request, Zone target) throws SiteWhereException { Persistence.entityUpdateLogic(request, target); if (request.getName() != null) { target.setName(request.getName()); } if (request.getBorderColor() != null) { target.setBorderColor(request.getBorderColor()); } if (request.getFillColor() != null) { target.setFillColor(request.getFillColor()); } if (request.getOpacity() != null) { target.setOpacity(request.getOpacity()); } if (request.getBounds() != null) { target.setBounds(Location.copy(request.getBounds())); } }
/** * Common logic for creating a zone based on an incoming request. * * @param request * @param area * @param uuid * @return * @throws SiteWhereException */ public static Zone zoneCreateLogic(IZoneCreateRequest request, IArea area, String uuid) throws SiteWhereException { Zone zone = new Zone(); Persistence.entityCreateLogic(request, zone); zone.setAreaId(area.getId()); zone.setName(request.getName()); zone.setBorderColor(request.getBorderColor()); zone.setFillColor(request.getFillColor()); zone.setOpacity(request.getOpacity()); zone.setBounds(Location.copy(request.getBounds())); return zone; }
grpc.setName(GOptionalString.newBuilder().setValue(api.getName())); grpc.addAllBounds(CommonModelConverter.asGrpcLocations(api.getBounds())); if (api.getFillColor() != null) { grpc.setFillColor(GOptionalString.newBuilder().setValue(api.getFillColor()));