/** * Handle common logic for updating a hardware asset. * * @param hardware * @param request * @throws SiteWhereException */ public static void hardwareAssetUpdateLogic(HardwareAsset hardware, IHardwareAssetCreateRequest request) throws SiteWhereException { assetUpdateLogic(hardware, request); if (request.getSku() != null) { hardware.setSku(request.getSku()); } if (request.getDescription() != null) { hardware.setDescription(request.getDescription()); } }
/** * Handle common logic for updating a person asset. * * @param person * @param request * @throws SiteWhereException */ public static void personAssetUpdateLogic(PersonAsset person, IPersonAssetCreateRequest request) throws SiteWhereException { assetUpdateLogic(person, request); if (request.getUserName() != null) { person.setUserName(request.getUserName()); } if (request.getEmailAddress() != null) { person.setEmailAddress(request.getEmailAddress()); } if (request.getRoles() != null) { person.getRoles().clear(); person.getRoles().addAll(request.getRoles()); } }
/** * Handle common logic for updating a location asset. * * @param location * @param request * @throws SiteWhereException */ public static void locationAssetUpdateLogic(LocationAsset location, ILocationAssetCreateRequest request) throws SiteWhereException { assetUpdateLogic(location, request); if (request.getLatitude() != null) { location.setLatitude(request.getLatitude()); } if (request.getLongitude() != null) { location.setLongitude(request.getLongitude()); } if (request.getElevation() != null) { location.setElevation(request.getElevation()); } }