List of usage examples for java.util UUID fromString
public static UUID fromString(String name)
From source file:io.acme.solution.application.handler.RegisterNewUserProfileCommandHandler.java
@Override public void handleMessage(final Map<String, Object> commandEntries) { if (commandEntries.containsKey(MAPKEY_ID)) { final UUID id = UUID.fromString(commandEntries.get(MAPKEY_ID).toString()); final String username = commandEntries.get(MAPKEY_USERNAME) != null ? commandEntries.get(MAPKEY_USERNAME).toString() : null;/*from ww w . j a va 2s. c om*/ final String email = commandEntries.get(MAPKEY_EMAIL) != null ? commandEntries.get(MAPKEY_EMAIL).toString() : null; final String password = commandEntries.get(MAPKEY_PASSWORD) != null ? commandEntries.get(MAPKEY_PASSWORD).toString() : null; if (username != null && password != null && email != null) { final Profile userProfile = new Profile(id, username, email, password); this.profileRepository.save(userProfile); } else { log.error("RegisterNewUserProfileCommandHandler received an invalid command type"); } } }
From source file:fr.ribesg.bukkit.ncore.config.UuidDb.java
public static UUID getId(final String nodeName, final String name, final boolean askMojangIfUnknown) { final PlayerInfo info = instance.byName.get(name.toLowerCase()); if (info != null) { return info.uuid; } else {/* w w w.ja v a 2 s . c o m*/ UUID id; if (!Bukkit.getOnlineMode()) { id = PlayerIdsUtil.getOfflineUuid(name); register(id, name); } else if (!askMojangIfUnknown) { id = null; } else { final Profile profile = getMojangProfile(nodeName, name, 3); if (profile == null) { id = null; } else { try { id = UUID.fromString(profile.getId()); } catch (final IllegalArgumentException e) { id = PlayerIdsUtil.shortUuidToUuid(profile.getId()); } register(id, profile.getName()); } } return id; } }
From source file:fm.last.musicbrainz.data.dao.impl.ReleaseDaoImplIT.java
@Test public void getByExistingRedirectedGidReturnsOneRelease() { UUID gid = UUID.fromString("5d32bacc-d62a-4e77-9f0e-d934e53d5359"); Release release = dao.getByGid(gid); assertThat(release.getName(), is("Multi-Disc Extravaganza")); }
From source file:net.chris54721.infinitycubed.data.Account.java
public Account(String uuid, String username, String nickname, String accessToken, String clientToken) { this.uuid = UUID.fromString(uuid); this.username = username; this.nickname = nickname; this.accessToken = accessToken; this.clientToken = clientToken; }
From source file:eu.griend.grpf.controller.NodeController.java
@RequestMapping(value = "/nodes/{id}", method = RequestMethod.DELETE) public void deleteNode(@PathVariable String id) { UUID uuid = UUID.fromString(id); this.nodeService.deleteNode(uuid); }
From source file:com.publicuhc.pluginframework.util.UUIDFetcherTest.java
@Test public void testUUIDFetchMulti() throws ParseException, InterruptedException, IOException { UUIDFetcher fetcher = new UUIDFetcher("ghowden", "Eluinhost"); Map<String, UUID> uuids = fetcher.call(); Map<String, UUID> expected = new HashMap<String, UUID>(); expected.put("ghowden", UUID.fromString("048fa310-30de-44fe-9f5e-c7443e91ad46")); expected.put("Eluinhost", UUID.fromString("6ac803fd-132f-4540-a741-cb18ffeed8ce")); assertThat(uuids, is(equalTo(expected))); }
From source file:net.sourceforge.vulcan.spring.jdbc.DependencyQuery.java
@Override @SuppressWarnings("unchecked") protected Entry<String, UUID> mapRow(ResultSet rs, int rowNumber) throws SQLException { return new DefaultMapEntry(rs.getString("name"), UUID.fromString(rs.getString("uuid"))); }
From source file:de.kaiserpfalzEdv.office.core.impl.KPOEntity.java
public UUID getId() { try {/*from ww w. ja v a2s . co m*/ return UUID.fromString(id); } catch (IllegalArgumentException e) { throw new IllegalStateException(e.getMessage() + "'" + id + "'", e); } }
From source file:com.spectralogic.ds3cli.command.RecoverPutBulk.java
@Override public CliCommand init(final Arguments args) throws Exception { processCommandOptions(requiredArgs, optionalArgs, args); this.jobId = UUID.fromString(args.getId()); this.bucketName = args.getBucket(); final String srcDir = args.getDirectory(); this.inputDirectory = Paths.get(srcDir); this.prefix = args.getPrefix(); this.numberOfThreads = args.getNumberOfThreads(); return this; }
From source file:net.sourceforge.vulcan.spring.jdbc.BuildQuery.java
@Override protected JdbcBuildOutcomeDto mapRow(ResultSet rs, int rowNumber) throws SQLException { final JdbcBuildOutcomeDto dto = new JdbcBuildOutcomeDto(); dto.setPrimaryKey(rs.getInt("id")); dto.setName(rs.getString("name")); dto.setId(UUID.fromString(rs.getString("uuid"))); dto.setStatus(ProjectStatusDto.Status.valueOf(rs.getString("status"))); dto.setMessageKey(rs.getString("message_key")); dto.setBuildReasonKey(rs.getString("build_reason_key")); dto.setStartDate(new Date(rs.getTimestamp("start_date").getTime())); dto.setCompletionDate(new Date(rs.getTimestamp("completion_date").getTime())); dto.setBuildNumber(rs.getInt("build_number")); dto.setWorkDir(rs.getString("work_dir")); dto.setWorkDirSupportsIncrementalUpdate(rs.getBoolean("work_dir_vcs_clean")); dto.setTagName(rs.getString("tag_name")); dto.setRepositoryUrl(rs.getString("repository_url")); dto.setScheduledBuild(rs.getBoolean("scheduled_build")); dto.setStatusChanged(rs.getBoolean("status_changed")); dto.setRequestedBy(rs.getString("requested_by")); dto.setBrokenBy(rs.getString("broken_by_user_name")); final Timestamp claimed_date = rs.getTimestamp("claimed_date"); if (StringUtils.isNotBlank(dto.getBrokenBy()) && !rs.wasNull()) { dto.setClaimDate(new Date(claimed_date.getTime())); }/*from ww w .j a v a 2 s . c o m*/ final String updateTypeString = rs.getString("update_type"); if (!rs.wasNull() && StringUtils.isNotEmpty(updateTypeString)) { dto.setUpdateType(ProjectStatusDto.UpdateType.valueOf(updateTypeString)); } else { dto.setUpdateType(null); } final Integer lastGoodBuildNumber = rs.getInt("last_good_build_number"); if (!rs.wasNull()) { dto.setLastGoodBuildNumber(lastGoodBuildNumber); } final Long revision = rs.getLong("revision"); if (!rs.wasNull()) { final RevisionTokenDto revisionTokenDto = new RevisionTokenDto(revision, rs.getString("revision_label")); if (rs.getBoolean("revision_unavailable")) { dto.setLastKnownRevision(revisionTokenDto); } else { dto.setRevision(revisionTokenDto); } } dto.setMessageArgs(mapMessageArgs(rs, "message_arg_")); dto.setBuildReasonArgs(mapMessageArgs(rs, "build_reason_arg_")); return dto; }