List of usage examples for java.lang Boolean TRUE
Boolean TRUE
To view the source code for java.lang Boolean TRUE.
Click Source Link
From source file:com.inkubator.hrm.web.reference.BankGroupFormController.java
@PostConstruct @Override//from w w w . ja v a2s. co m public void initialization() { super.initialization(); try { String bankGroupId = FacesUtil.getRequestParameter("bankGroupId"); model = new BankGroupModel(); isUpdate = Boolean.FALSE; if (StringUtils.isNotEmpty(bankGroupId)) { BankGroup bankGroup = service.getEntiyByPK(Long.parseLong(bankGroupId)); if (bankGroupId != null) { model = getModelFromEntity(bankGroup); isUpdate = Boolean.TRUE; } } } catch (Exception e) { LOGGER.error("Error", e); } }
From source file:ch.iceage.icedms.persistence.jdbc.impl.JdbcDocumentMapperIT.java
@Test public void testGet() { List<Document> all = mapper .get(new DefaultDocument("test-document", null, Boolean.TRUE, null, Status.NEW, null)); assertEquals(1, all.size());/*from ww w .j av a 2 s . c o m*/ }
From source file:cz.muni.fi.editor.webapp.forms.factories.UserFormCreateFactory.java
@Override public UserFormCreate getObject() throws Exception { UserFormCreate uf = new UserFormCreate(); uf.setActive(Boolean.TRUE); uf.setOrganizations(/*from w ww . j av a2 s . c o m*/ LazyList.lazyList(new ArrayList<>(), FactoryUtils.instantiateFactory(OrganizationForm.class))); return uf; }
From source file:com.assignment4.security.ValidateSaltFilter.java
@Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { // Assume its HTTP HttpServletRequest httpReq = (HttpServletRequest) request; // Get the salt sent with the request String salt = (String) httpReq.getParameter("randId"); // Validate that the salt is in the cache Cache<String, Boolean> csrfPreventionSaltCache = (Cache<String, Boolean>) httpReq.getSession() .getAttribute("csrfPreventionSaltCache"); if (csrfPreventionSaltCache != null && salt == null && (null != request.getParameter("activationtoken") || null != request.getParameter("crypt"))) { csrfPreventionSaltCache = CacheBuilder.newBuilder().maximumSize(5000) .expireAfterWrite(20, TimeUnit.MINUTES).build(); httpReq.getSession().setAttribute("csrfPreventionSaltCache", csrfPreventionSaltCache); // Generate the salt and store it in the users cache salt = RandomStringUtils.random(20, 0, 0, true, true, null, new SecureRandom()); csrfPreventionSaltCache.put(salt, Boolean.TRUE); // Add the salt to the current request so it can be used // by the page rendered in this request httpReq.setAttribute("randId", salt); }//from www .j a v a 2 s .c o m if (csrfPreventionSaltCache != null && salt != null && csrfPreventionSaltCache.getIfPresent(salt) != null) { // If the salt is in the cache, we move on chain.doFilter(request, response); } else { // Otherwise we throw an exception aborting the request flow throw new ServletException("Potential CSRF detected!! Inform a scary sysadmin ASAP."); } }
From source file:com.moviejukebox.TestLogger.java
/** * configure the logger with a simple in-memory file for the required log level * * @param level The logging level required * @return True if successful/*from ww w .j a v a2s . c o m*/ */ public static boolean configure(String level) { StringBuilder config = new StringBuilder("handlers = java.util.logging.ConsoleHandler\n"); config.append(".level = ").append(level).append(CRLF); config.append("java.util.logging.ConsoleHandler.level = ").append(level).append(CRLF); // Only works with Java 7 or later config.append("java.util.logging.SimpleFormatter.format = [%1$tH:%1$tM:%1$tS %4$6s] %2$s - %5$s %6$s%n") .append(CRLF); // Exclude http logging config.append("sun.net.www.protocol.http.HttpURLConnection.level = OFF").append(CRLF); config.append("org.apache.http.level = SEVERE").append(CRLF); try (InputStream ins = new ByteArrayInputStream(config.toString().getBytes())) { LogManager.getLogManager().readConfiguration(ins); } catch (IOException e) { LOG.warn("Failed to configure log manager due to an IO problem", e); return Boolean.FALSE; } LOG.debug("Logger initialized to '{}' level", level); return Boolean.TRUE; }
From source file:thymeleafsandbox.springjsp.web.controller.jsp.JspForm.java
@ModelAttribute("user") public User populateUser() { final User user = new User(); final Calendar registrationDate = Calendar.getInstance(); registrationDate.set(Calendar.MILLISECOND, 0); registrationDate.set(Calendar.SECOND, 0); registrationDate.set(Calendar.MINUTE, 0); registrationDate.set(Calendar.HOUR, 0); user.setId(Integer.valueOf(12345)); user.setRegistrationDate(registrationDate); user.setActive(Boolean.TRUE); user.setMultiValues(new ArrayList<String>(Arrays.asList(new String[] { "TWO", "FOUR" }))); return user;/*w w w. j a v a2 s .c o m*/ }
From source file:com.omertron.omdbapi.TestLogger.java
/** * configure the logger with a simple in-memory file for the required log level * * @param level The logging level required * @return True if successful/* w ww . jav a2s . co m*/ */ public static boolean configure(String level) { StringBuilder config = new StringBuilder("handlers = java.util.logging.ConsoleHandler\n"); config.append(".level = ").append(level).append(CRLF); config.append("java.util.logging.ConsoleHandler.level = ").append(level).append(CRLF); // Only works with Java 7 or later config.append("java.util.logging.SimpleFormatter.format = [%1$tH:%1$tM:%1$tS %4$6s] %2$s - %5$s %6$s%n") .append(CRLF); // Exclude logging messages config.append("org.apache.http.level = SEVERE").append(CRLF); InputStream ins = new ByteArrayInputStream(config.toString().getBytes()); try { LogManager.getLogManager().readConfiguration(ins); // Exclude http logging System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog"); System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http", "warn"); } catch (IOException ex) { LOG.warn("Failed to configure log manager due to an IO problem", ex); return Boolean.FALSE; } finally { try { ins.close(); } catch (IOException ex) { LOG.info("Failed to close input stream", ex); } } LOG.debug("Logger initialized to '{}' level", level); return Boolean.TRUE; }
From source file:cz.muni.fi.editor.webapp.forms.factories.UserFormProfileFactory.java
@Override public UserFormProfile getObject() throws Exception { UserFormProfile uf = new UserFormProfile(); uf.setActive(Boolean.TRUE); uf.setOrganizations(//from w w w . j a v a 2 s. c o m LazyList.lazyList(new ArrayList<>(), FactoryUtils.instantiateFactory(OrganizationForm.class))); return uf; }
From source file:de.gmorling.moapa.bvspel.SpelAssertValidator.java
@Override public boolean isValid(Object value, ConstraintValidatorContext context) { if (value == null) { return true; }/*w ww.j a va2s . c o m*/ return Boolean.TRUE.equals(expression.getValue(value, Boolean.class)); }
From source file:Transform.java
/** * Asks the TransformerFactory to try to load a precompiled version of * the translet from the class path to construct a Transformer object. * The translet performs the transformation on behalf of the * Transformer.transform() method./* w ww.ja v a2 s .com*/ */ public void run(String[] args) { String xml = args[0]; String transletURI = args[1]; try { // Set XSLTC's TransformerFactory implementation as the default System.setProperty("javax.xml.transform.TransformerFactory", "org.apache.xalan.xsltc.trax.TransformerFactoryImpl"); TransformerFactory tf = TransformerFactory.newInstance(); tf.setAttribute("use-classpath", Boolean.TRUE); Transformer transformer = tf.newTransformer(new StreamSource(transletURI)); StreamSource document = new StreamSource(xml); StreamResult result = new StreamResult(new OutputStreamWriter(System.out)); transformer.transform(document, result); } catch (Exception e) { System.err.println("Exception: " + e); e.printStackTrace(); } System.exit(0); }