Buggy code:
@ Override public IDeviceAssignment getCurrentDeviceAssignment ( IDevice device ) throws SiteWhereException { } @ Override public SearchResults < IDevice > listDevices ( boolean includeDeleted , IDeviceSearchCriteria criteria ) throws SiteWhereException { } @ Override public IDevice createDeviceElementMapping ( String hardwareId , IDeviceElementMapping mapping ) throws SiteWhereException { } @ Override public IDevice deleteDeviceElementMapping ( String hardwareId , String path ) throws SiteWhereException { } @ Override public IDevice deleteDevice ( String hardwareId , boolean force ) throws SiteWhereException { } protected DBObject getDeviceDBObjectByHardwareId ( String hardwareId ) throws SiteWhereException { } @ Override public IDeviceAssignment createDeviceAssignment ( IDeviceAssignmentCreateRequest request ) throws SiteWhereException { } @ Override public IDeviceAssignment getDeviceAssignmentByToken ( String token ) throws SiteWhereException { } @ Override public IDeviceAssignment deleteDeviceAssignment ( String token , boolean force ) throws SiteWhereException { } @ Override public IDevice getDeviceForAssignment ( IDeviceAssignment assignment ) throws SiteWhereException { } @ Override public ISite getSiteForAssignment ( IDeviceAssignment assignment ) throws SiteWhereException { } @ Override public IDeviceAssignment updateDeviceAssignmentMetadata ( String token , IMetadataProvider metadata ) throws SiteWhereException { } @ Override public IDeviceAssignment updateDeviceAssignmentStatus ( String token , DeviceAssignmentStatus status ) throws SiteWhereException { } @ Override public IDeviceAssignment updateDeviceAssignmentState ( String token , IDeviceAssignmentState state ) throws SiteWhereException { } @ Override public IDeviceEventBatchResponse addDeviceEventBatch ( String assignmentToken , IDeviceEventBatch batch ) throws SiteWhereException { } @ Override public IDeviceAssignment endDeviceAssignment ( String token ) throws SiteWhereException { } @ Override public SearchResults < IDeviceAssignment > getDeviceAssignmentHistory ( String hardwareId , ISearchCriteria criteria ) throws SiteWhereException { } @ Override public SearchResults < IDeviceAssignment > getDeviceAssignmentsForSite ( String siteToken , ISearchCriteria criteria ) throws SiteWhereException { } protected DBObject getDeviceAssignmentDBObjectByToken ( String token ) throws SiteWhereException { } @ Override public IDeviceEvent getDeviceEventById ( String id ) throws SiteWhereException { } @ Override public ISearchResults < IDeviceEvent > listDeviceEvents ( String assignmentToken , IDateRangeSearchCriteria criteria ) throws SiteWhereException { } @ Override public IDeviceMeasurements addDeviceMeasurements ( String assignmentToken , IDeviceMeasurementsCreateRequest request ) throws SiteWhereException { } @ Override public SearchResults < IDeviceMeasurements > listDeviceMeasurements ( String token , IDateRangeSearchCriteria criteria ) throws SiteWhereException { } @ Override public SearchResults < IDeviceMeasurements > listDeviceMeasurementsForSite ( String siteToken , IDateRangeSearchCriteria criteria ) throws SiteWhereException { } @ Override public IDeviceLocation addDeviceLocation ( String assignmentToken , IDeviceLocationCreateRequest request ) throws SiteWhereException { } @ Override public SearchResults < IDeviceLocation > listDeviceLocations ( String assignmentToken , IDateRangeSearchCriteria criteria ) throws SiteWhereException { } @ Override public SearchResults < IDeviceLocation > listDeviceLocationsForSite ( String siteToken , IDateRangeSearchCriteria criteria ) throws SiteWhereException { } @ Override public SearchResults < IDeviceLocation > listDeviceLocations ( List < String > assignmentTokens , IDateRangeSearchCriteria criteria ) throws SiteWhereException { } @ Override public IDeviceAlert addDeviceAlert ( String assignmentToken , IDeviceAlertCreateRequest request ) throws SiteWhereException { } @ Override public SearchResults < IDeviceAlert > listDeviceAlerts ( String assignmentToken , IDateRangeSearchCriteria criteria ) throws SiteWhereException { } @ Override public SearchResults < IDeviceAlert > listDeviceAlertsForSite ( String siteToken , IDateRangeSearchCriteria criteria ) throws SiteWhereException { } @ Override public IDeviceCommandInvocation addDeviceCommandInvocation ( String assignmentToken , IDeviceCommand command , IDeviceCommandInvocationCreateRequest request ) throws SiteWhereException { } @ Override public ISearchResults < IDeviceCommandInvocation > listDeviceCommandInvocations ( String assignmentToken , IDateRangeSearchCriteria criteria ) throws SiteWhereException { } @ Override public ISearchResults < IDeviceCommandInvocation > listDeviceCommandInvocationsForSite ( String siteToken , IDateRangeSearchCriteria criteria ) throws SiteWhereException { } @ Override public ISearchResults < IDeviceCommandResponse > listDeviceCommandInvocationResponses ( String invocationId ) throws SiteWhereException { } @ Override public IDeviceCommandResponse addDeviceCommandResponse ( String assignmentToken , IDeviceCommandResponseCreateRequest request ) throws SiteWhereException { } @ Override public ISearchResults < IDeviceCommandResponse > listDeviceCommandResponses ( String assignmentToken , IDateRangeSearchCriteria criteria ) throws SiteWhereException { } @ Override public ISearchResults < IDeviceCommandResponse > listDeviceCommandResponsesForSite ( String siteToken , IDateRangeSearchCriteria criteria ) throws SiteWhereException { } @ Override public IDeviceStateChange addDeviceStateChange ( String assignmentToken , IDeviceStateChangeCreateRequest request ) throws SiteWhereException { } @ Override public ISearchResults < IDeviceStateChange > listDeviceStateChanges ( String assignmentToken , IDateRangeSearchCriteria criteria ) throws SiteWhereException { } @ Override public ISearchResults < IDeviceStateChange > listDeviceStateChangesForSite ( String siteToken , IDateRangeSearchCriteria criteria ) throws SiteWhereException { } @ Override public ISite createSite ( ISiteCreateRequest request ) throws SiteWhereException { <START_BUG> Site site = SiteWherePersistence . siteCreateLogic ( request , UUID . randomUUID ( ) . toString ( ) ) ; <END_BUG> DBCollection sites = getMongoClient ( ) . getSitesCollection ( ) ; DBObject created = MongoSite . toDBObject ( site ) ; MongoPersistence . insert ( sites , created ) ; return MongoSite . fromDBObject ( created ) ; } @ Override public ISite updateSite ( String token , ISiteCreateRequest request ) throws SiteWhereException { } @ Override public ISite getSiteByToken ( String token ) throws SiteWhereException { } @ Override public ISite deleteSite ( String siteToken , boolean force ) throws SiteWhereException { } protected DBObject getSiteDBObjectByToken ( String token ) throws SiteWhereException { } @ Override public SearchResults < ISite > listSites ( ISearchCriteria criteria ) throws SiteWhereException { } @ Override public IZone createZone ( ISite site , IZoneCreateRequest request ) throws SiteWhereException { } @ Override public IZone updateZone ( String token , IZoneCreateRequest request ) throws SiteWhereException { } @ Override public IZone getZone ( String zoneToken ) throws SiteWhereException { } @ Override public SearchResults < IZone > listZones ( String siteToken , ISearchCriteria criteria ) throws SiteWhereException { } @ Override public IZone deleteZone ( String zoneToken , boolean force ) throws SiteWhereException { } @ Override public IDeviceGroup createDeviceGroup ( IDeviceGroupCreateRequest request ) throws SiteWhereException { } @ Override public IDeviceGroup updateDeviceGroup ( String token , IDeviceGroupCreateRequest request ) throws SiteWhereException { } @ Override public IDeviceGroup getDeviceGroup ( String token ) throws SiteWhereException { } @ Override public ISearchResults < IDeviceGroup > listDeviceGroups ( boolean includeDeleted , ISearchCriteria criteria ) throws SiteWhereException { } @ Override public ISearchResults < IDeviceGroup > listDeviceGroupsWithRole ( String role , boolean includeDeleted , ISearchCriteria criteria ) throws SiteWhereException { }

Fix:
Site site = SiteWherePersistence . siteCreateLogic ( request ) ;