List of usage examples for java.lang Character MAX_RADIX
int MAX_RADIX
To view the source code for java.lang Character MAX_RADIX.
Click Source Link
From source file:org.wso2.carbon.device.mgt.iot.services.firealarm.FireAlarmManagerService.java
private static String shortUUID() { UUID uuid = UUID.randomUUID(); long l = ByteBuffer.wrap(uuid.toString().getBytes()).getLong(); return Long.toString(l, Character.MAX_RADIX); }
From source file:no.kantega.useradmin.controls.ResetPasswordController.java
public ModelAndView doHandleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { RequestParameters param = new RequestParameters(request); String domain = param.getString("domain"); String id = param.getString("userId"); DefaultIdentity ident = new DefaultIdentity(); ident.setUserId(id);// w ww . j a va 2 s . c o m ident.setDomain(domain); Profile user = getProfileConfiguration(domain).getProfileManager().getProfileForUser(ident); String password1 = param.getString("password1"); String password2 = param.getString("password2"); Map<String, Object> model = new HashMap<>(); model.put("domain", domain); Configuration aksessConf = Aksess.getConfiguration(); String mailtemplate = aksessConf.getString("security.passwordmail.template"); if (mailtemplate != null && getProfileConfiguration(domain).getPasswordManager() != null) { if (isBlank(user.getEmail())) { model.put("noemail", Boolean.TRUE); } else { model.put("maildefault", aksessConf.getBoolean("security.passwordmail.default", false)); Velocity.init(); File confDir = new File(Configuration.getApplicationDirectory()); File mailDir = new File(confDir, "mail"); File temp = new File(mailDir, mailtemplate); VelocityContext context = new VelocityContext(); context.put("editor", aksessConf.getString("mail.editor")); StringBuilder name = new StringBuilder(); name.append(user.getGivenName()); if (user.getSurname() != null && !user.getSurname().trim().equals("")) { name.append(" ").append(user.getSurname()); } context.put("userId", id); context.put("name", name.toString()); StringWriter sw = new StringWriter(); Velocity.evaluate(context, sw, mailtemplate, new InputStreamReader(new FileInputStream(temp), aksessConf.getString("velocity.templateencoding", "iso-8859-1"))); model.put("mailtemplate", sw.toString()); model.put("mailto", user.getEmail()); { String from = aksessConf.getString("security.passwordmail.from"); from = from == null ? aksessConf.getString("mail.editor") : from; model.put("mailfrom", from); } { String subject = aksessConf.getString("security.passwordmail.subject"); subject = subject == null ? "Nytt passord" : subject; model.put("mailsubject", subject); } } } if (password1 != null) { // We're sending email if (request.getParameter("mailsubmit") != null) { String from = param.getString("from"); String subject = param.getString("subject"); String message = param.getString("message"); VelocityContext context = new VelocityContext(); BigInteger number = new BigInteger(40, random); String generatedPassword = number.toString(Character.MAX_RADIX); context.put("password", generatedPassword); StringWriter sw = new StringWriter(); Velocity.evaluate(context, sw, "message", new StringReader(message)); MailSender.send(from, user.getEmail(), subject, sw.toString()); ProfileManagementConfiguration config = getProfileConfiguration(domain); PasswordManager passwordManager = config.getPasswordManager(); if (passwordManager != null) { passwordManager.setPassword(ident, generatedPassword, generatedPassword); model.put("userId", id); model.put("message", "useradmin.password.saved"); return new ModelAndView(new RedirectView("../profile/search"), model); } } else { // Just set the password ValidationErrors errors = passwordValidator.isValidPassword(password1, password2, ident); if (errors.getLength() > 0) { model.put("errors", errors); } else { ProfileManagementConfiguration config = getProfileConfiguration(domain); PasswordManager passwordManager = config.getPasswordManager(); if (passwordManager != null) { passwordManager.setPassword(ident, password1, password2); model.put("userId", id); model.put("message", "useradmin.password.saved"); return new ModelAndView(new RedirectView("../profile/search"), model); } } } } model.put("userId", id); return new ModelAndView("password/reset", model); }
From source file:org.hammurapi.HammurapiArchiver.java
private String uniquilize(String name, Set names) { int idx = name.lastIndexOf('.'); String newName = name;/*from w w w. j ava 2 s. c o m*/ String ext = ""; if (idx != -1) { ext = name.substring(idx); name = name.substring(0, idx); } for (int i = 0; names.contains(newName.toLowerCase()); i++) { newName = name + "_" + Integer.toString(i, Character.MAX_RADIX) + ext; } names.add(newName.toLowerCase()); return newName; }
From source file:com.epam.ta.reportportal.core.project.settings.impl.CreateProjectSettingsHandler.java
private static String shortUUID() { long l = ByteBuffer.wrap(UUID.randomUUID().toString().getBytes(Charsets.UTF_8)).getLong(); return Long.toString(l, Character.MAX_RADIX); }
From source file:org.apache.myfaces.custom.redirectTracker.RedirectTrackerManager.java
/** * add the current state to the redirect map/list * @return the new path used for redirect *//* w w w . j a va 2 s.co m*/ public String trackRedirect(FacesContext facesContext, String redirectPath) { long rtid = getNextRequestNo(); String mapKey = Long.toString(rtid, Character.MAX_RADIX); Entry entry = new Entry(mapKey); RedirectTrackerContext context = new RedirectTrackerContext(this, entry, facesContext); RedirectTrackerPolicy policy = getRedirectTrackerPolicy(); redirectPath = policy.trackRedirect(context, redirectPath); // saveBeans(entry); // saveMessages(facesContext, entry); // prepare for next redirect clearSaveStateBean(); if (!entry.hasCapturedData()) { // nothing to restore return redirectPath; } initRedirectEntryMap(); synchronized (redirectEntryMap) { redirectEntryMap.put(mapKey, entry); redirectEntryList.add(entry); while (redirectEntryList.size() > redirects) { Entry prevEntry = (Entry) redirectEntryList.remove(0); redirectEntryMap.remove(prevEntry.mapKey); } } if (redirectPath.indexOf('?') == -1) { return redirectPath + "?" + REDIRECT_ARG + "=" + mapKey; } else { return redirectPath + "&" + REDIRECT_ARG + "=" + mapKey; } }
From source file:nl.b3p.viewer.stripes.CombineImageActionBean.java
/** * Create unique number. /*from w w w.ja va 2 s .c om*/ */ public static String uniqueId() { // Use miliseconds to generate a code long now = (new Date()).getTime(); String val1 = Long.toString(now, Character.MAX_RADIX).toUpperCase(); // add random to make sure it's unique Random rg = new Random(); long rnum = (long) rg.nextInt(1000); String val2 = Long.toString(rnum, Character.MAX_RADIX).toUpperCase(); return val1 + val2; }
From source file:org.apache.lucene.index.TransIndex.java
private final String newTransSegmentName() { return "_" + Integer.toString(transSegmentInfos.counter++, Character.MAX_RADIX); }
From source file:org.apache.lucene.index.TransIndex.java
private final String newSegmentName() { return "_" + Integer.toString(segmentInfos.counter++, Character.MAX_RADIX); }
From source file:org.apache.lucene.index.SegmentInfos.java
/** * Parse the generation off the segments file name and * return it.//from w w w .ja v a2 s .c o m */ public static long generationFromSegmentsFileName(String fileName) { if (fileName.equals(IndexFileNames.SEGMENTS)) { return 0; } else if (fileName.startsWith(IndexFileNames.SEGMENTS)) { return Long.parseLong(fileName.substring(1 + IndexFileNames.SEGMENTS.length()), Character.MAX_RADIX); } else { throw new IllegalArgumentException("fileName \"" + fileName + "\" is not a segments file"); } }
From source file:org.homeautomation.doormanager.api.DoorManagerManagerServiceImpl.java
/** * Generate UUID/*from w w w.j a va 2 s. c om*/ * * @return generated UUID */ private static String shortUUID() { UUID uuid = UUID.randomUUID(); long l = ByteBuffer.wrap(uuid.toString().getBytes(StandardCharsets.UTF_8)).getLong(); return Long.toString(l, Character.MAX_RADIX); }