@Override public boolean shouldGenerateEvent(IDeviceAssignment assignment, IDeviceStateChangeCreateRequest request) throws SiteWhereException { if (assignment.getState().getPresenceMissingDate() != null) { return false; } return true; } }
try { IDeviceAssignment assignment = getDeviceManagement().getDeviceAssignmentByToken(key); DeviceAssignmentState state = (assignment.getState() != null) ? DeviceAssignmentState.copy(assignment.getState()) : new DeviceAssignmentState(); List<IDeviceEvent> events = working.get(key); mergeEvents(state, events);
try { IDeviceAssignment assignment = getDeviceAssignment(token, servletRequest); DeviceAssignmentState state = (DeviceAssignmentState) assignment.getState(); ISearchResults<IDeviceLocation> locations = listLocations(token, 1, 1, null, null, servletRequest, response);
/** * Copy information from SPI into Mongo {@link Document}. * * @param source * @param target */ public static void toDocument(IDeviceAssignment source, Document target) { if (source.getActiveDate() != null) { target.append(PROP_ACTIVE_DATE, source.getActiveDate()); } target.append(PROP_ASSET_MODULE_ID, source.getAssetModuleId()); target.append(PROP_ASSET_ID, source.getAssetId()); if (source.getAssignmentType() != null) { target.append(PROP_ASSIGNMENT_TYPE, source.getAssignmentType().name()); } if (source.getReleasedDate() != null) { target.append(PROP_RELEASED_DATE, source.getReleasedDate()); } if (source.getStatus() != null) { target.append(PROP_STATUS, source.getStatus().name()); } target.append(PROP_TOKEN, source.getToken()); target.append(PROP_DEVICE_HARDWARE_ID, source.getDeviceHardwareId()); target.append(PROP_SITE_TOKEN, source.getSiteToken()); if (source.getState() != null) { setState(source.getState(), target); } MongoSiteWhereEntity.toDocument(source, target); MongoMetadataProvider.toDocument(source, target); }