/**
  * Create example state change events.
  *
  * @param assignment
  * @param start
  * @return
  * @throws SiteWhereException
  */
 protected List<IDeviceStateChange> createDeviceStateChanges(
     IDeviceAssignment assignment, IDeviceSpecification specification, Date start)
     throws SiteWhereException {
   List<IDeviceStateChange> stateChanges = new ArrayList<IDeviceStateChange>();
   DeviceRegistrationRequest register = new DeviceRegistrationRequest();
   register.setHardwareId(assignment.getDeviceHardwareId());
   register.setSpecificationToken(specification.getToken());
   register.setEventDate(start);
   stateChanges.add(getDeviceManagement().addDeviceStateChange(assignment.getToken(), register));
   return stateChanges;
 }
 public Builder(IDeviceAssignment api) {
   request.setToken(api.getToken());
   request.setDeviceHardwareId(api.getDeviceHardwareId());
   request.setAssetModuleId(api.getAssetModuleId());
   request.setAssetId(api.getAssetId());
   request.setAssignmentType(api.getAssignmentType());
   if (api.getMetadata() != null) {
     request.setMetadata(new HashMap<String, String>());
     request.getMetadata().putAll(api.getMetadata());
   }
 }