List of usage examples for java.util UUID fromString
public static UUID fromString(String name)
From source file:com.boxedfolder.carrot.service.impl.SyncServiceImpl.java
@Override public Map<String, Object> sync(Long timestamp, String appKey) { if (timestamp == null) { timestamp = 0L;// w w w . ja va2 s .c om } // First look for the concrete application App app = appRepository.findByApplicationKey(UUID.fromString(appKey)); if (app == null) { throw new GeneralExceptions.InvalidAppKey(); } // Build result Map<String, Object> result = new HashMap<>(); result.put(SyncService.Keys.TIMESTAMP_KEY, System.currentTimeMillis() / 1000L); result.put(SyncService.Keys.BEACONS_KEY, beaconMap(timestamp, app)); result.put(SyncService.Keys.EVENTS_KEY, eventMap(timestamp, app)); return result; }
From source file:com.easemob.dataexport.utils.ConversionUtils.java
/** * @param uuid//from w w w. j a va2 s.c om * @return */ public static UUID uuid(String uuid) { try { return UUID.fromString(uuid); } catch (Exception e) { logger.error("Bad UUID", e); } return UUIDUtils.ZERO_UUID; }
From source file:at.alladin.rmbt.db.fields.UUIDField.java
@Override public void setString(final String string) { value = UUID.fromString(string); }
From source file:org.trustedanalytics.servicebroker.hdfs.plans.HdfsPlanShared.java
@Override public void provision(ServiceInstance serviceInstance, Optional<Map<String, Object>> parameters) throws ServiceInstanceExistsException, ServiceBrokerException { UUID instanceId = UUID.fromString(serviceInstance.getServiceInstanceId()); UUID orgId = UUID.fromString(serviceInstance.getOrganizationGuid()); hdfsOperations.provisionDirectory(instanceId, orgId); }
From source file:org.hawkular.accounts.api.model.BaseEntity.java
/** * @deprecated Use the BaseEntity(UUID) instead. * @param id the ID as String to be parsed as UUID. *///from w w w. java 2 s . c o m public BaseEntity(String id) { if (null != id) { if (!UUID_PATTERN.matcher(id).matches()) { // not an UUID, so, let's convert it to UUID this.id = UUID.nameUUIDFromBytes(id.getBytes()); } else { this.id = UUID.fromString(id); } } }
From source file:org.openlmis.fulfillment.security.CustomUserAuthenticationConverter.java
/** * {@inheritDoc}.//from w w w . j ava2 s . c o m */ public Authentication extractAuthentication(Map<String, ?> map) { if (map.containsKey(REFERENCE_DATA_USER_ID)) { UUID principal = UUID.fromString((String) map.get(REFERENCE_DATA_USER_ID)); Collection<? extends GrantedAuthority> authorities = getAuthorities(map); return new UsernamePasswordAuthenticationToken(principal, "N/A", authorities); } return null; }
From source file:com.misczak.joinmybridge.Bridge.java
public Bridge(JSONObject json) throws JSONException { mBridgeId = UUID.fromString(json.getString(JSON_ID)); mBridgeName = json.getString(JSON_NAME); mBridgeNumber = json.getString(JSON_NUMBER); mHostCode = json.getString(JSON_HOST); mParticipantCode = json.getString(JSON_PARTICIPANT); mFirstTone = json.getString(JSON_FIRSTTONE); mSecondTone = json.getString(JSON_SECONDTONE); mCallOrder = json.getString(JSON_CALLORDER); mDialingPause = json.getInt(JSON_DIALINGPAUSE); }
From source file:net.sourceforge.msscodefactory.cfcore.v2_1.CFGenKb.CFGenKbSecDevicePKey.java
public CFGenKbSecDevicePKey() { requiredSecUserId = UUID.fromString(CFGenKbSecDeviceBuff.SECUSERID_INIT_VALUE.toString()); requiredDevName = new String(CFGenKbSecDeviceBuff.DEVNAME_INIT_VALUE); }
From source file:at.alladin.rmbt.controlServer.ResultUpdateResource.java
@Post("json") public String request(final String entity) { addAllowOrigin();/*from www .j a v a2 s . c o m*/ JSONObject request = null; final ErrorList errorList = new ErrorList(); final JSONObject answer = new JSONObject(); final String ip = getIP(); System.out.println(MessageFormat.format(labels.getString("NEW_RESULT_UPDATE"), ip)); if (entity != null && !entity.isEmpty()) { try { request = new JSONObject(entity); final UUID clientUUID = UUID.fromString(request.getString("uuid")); final UUID testUUID = UUID.fromString(request.getString("test_uuid")); final int zipCode = request.optInt("zip_code", 0); final double geoLat = request.optDouble("geo_lat", Double.NaN); final double geoLong = request.optDouble("geo_long", Double.NaN); final float geoAccuracy = (float) request.optDouble("accuracy", 0); final String provider = request.optString("provider").toLowerCase(); final Client client = new Client(conn); final long clientId = client.getClientByUuid(clientUUID); if (clientId < 0) throw new IllegalArgumentException("error while loading client"); final Test test = new Test(conn); if (test.getTestByUuid(testUUID) < 0) throw new IllegalArgumentException("error while loading test"); if (test.getField("client_id").longValue() != clientId) throw new IllegalArgumentException("client UUID does not match test"); if (zipCode > 0) { ((IntField) test.getField("zip_code")).setValue(zipCode); } if (!Double.isNaN(geoLat) && !Double.isNaN(geoLong) && (provider.equals(GEO_PROVIDER_GEOCODER) || provider.equals(GEO_PROVIDER_MANUAL))) { final GeoLocation geoloc = new GeoLocation(conn); geoloc.setTest_id(test.getUid()); final Timestamp tstamp = java.sql.Timestamp .valueOf(new Timestamp((new Date().getTime())).toString()); geoloc.setTime(tstamp, TimeZone.getDefault().toString()); geoloc.setAccuracy(geoAccuracy); geoloc.setGeo_lat(geoLat); geoloc.setGeo_long(geoLong); geoloc.setProvider(provider); geoloc.storeLocation(); ((DoubleField) test.getField("geo_lat")).setValue(geoLat); ((DoubleField) test.getField("geo_long")).setValue(geoLong); ((DoubleField) test.getField("geo_accuracy")).setValue(geoAccuracy); test.getField("geo_provider").setString(provider); } test.storeTestResults(true); if (test.hasError()) errorList.addError(test.getError()); } catch (final JSONException e) { errorList.addError("ERROR_REQUEST_JSON"); System.out.println("Error parsing JSDON Data " + e.toString()); } catch (final IllegalArgumentException e) { errorList.addError("ERROR_REQUEST_JSON"); System.out.println("Error parsing JSDON Data " + e.toString()); } } return answer.toString(); }
From source file:com.vangent.hieos.services.xds.bridge.utils.UUIDUtils.java
/** * Method description// w ww. j a v a2 s. c o m * * * @param uuidstr * @param prefix * * @return */ public static String toOIDFromUUIDString(String uuidstr, String prefix) throws XdsFormatException { String result = null; try { UUID uuid = UUID.fromString(uuidstr); result = toOID(uuid, prefix); } catch (IllegalArgumentException e) { throw new XdsFormatException(String.format("String[%s] is not a UUID.", uuidstr), e); } return result; }