Example usage for java.lang Boolean TRUE

List of usage examples for java.lang Boolean TRUE

Introduction

In this page you can find the example usage for java.lang Boolean TRUE.

Prototype

Boolean TRUE

To view the source code for java.lang Boolean TRUE.

Click Source Link

Document

The Boolean object corresponding to the primitive value true .

Usage

From source file:com.oddprints.servlets.EditPano.java

@GET
@Produces(MediaType.TEXT_HTML)/* w  w w  . j  a  va 2  s.  c  o  m*/
public Viewable view(@Context HttpServletRequest req) {
    Edit edit = new Edit();
    req.setAttribute("panoMode", Boolean.TRUE);
    // forward to normal servlet
    return edit.view(req);
}

From source file:ru.xxlabaza.test.aspectj.MyService.java

@Async
public Future<Boolean> doSomeAsync() throws InterruptedException {
    val myPojo = new MyPojo();
    myPojo.setName("Popa");
    myPojo.setAge(13);// www  .  j a v  a  2s . co  m

    Thread.sleep(3000L);
    log.info("Delyed HELLO WORLD!");

    val notBean = new NotBean();
    notBean.doSomeUseful("Hello from not a bean");

    log.error("Pojo name '{}', age {}", myPojo.getName(), myPojo.getAge());

    return new AsyncResult<>(Boolean.TRUE);
}

From source file:psiprobe.controllers.apps.ListAppAttributesController.java

@Override
protected ModelAndView handleContext(String contextName, Context context, HttpServletRequest request,
        HttpServletResponse response) throws Exception {

    List<Attribute> appAttrs = ApplicationUtils.getApplicationAttributes(context);
    ModelAndView mv = new ModelAndView(getViewName(), "appAttributes", appAttrs);

    if (SecurityUtils.hasAttributeValueRole(getServletContext(), request)) {
        mv.addObject("displayValues", Boolean.TRUE);
    }// w w  w  .  j  a v a  2  s .com
    return mv;
}

From source file:BusinessLayer.service.UserDetailsService.java

@Override
@Transactional(readOnly = true)/*from  ww w .j av  a  2 s .c om*/
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
    Utilisateur user = userDAO.findUserByName(username); //our own User model class

    if (user != null) {
        String password = user.getPass();
        //additional information on the security object
        boolean enabled = user.getEnabled().equals(Boolean.TRUE);
        boolean accountNonExpired = user.getEnabled().equals(Boolean.TRUE);
        boolean credentialsNonExpired = user.getEnabled().equals(Boolean.TRUE);
        boolean accountNonLocked = user.getEnabled().equals(Boolean.TRUE);

        //Let's populate user roles
        Collection<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>();

        authorities.add(new GrantedAuthorityImpl(user.getRole()));

        //Now let's create Spring Security User object
        CustomSecurityUser securityUser = new CustomSecurityUser(username, password, enabled, accountNonExpired,
                credentialsNonExpired, accountNonLocked, authorities, user.getId());
        return securityUser;
    } else {
        throw new UsernameNotFoundException("User Not Found");
    }
}

From source file:io.smartspaces.expression.OgnlFilterExpression.java

@Override
public boolean accept(Object object) {
    try {/*from   w w w  .  jav a  2s  .c o  m*/
        Boolean value = Ognl.getValue(expression, context, object);
        return Boolean.TRUE.equals(value);
    } catch (OgnlException e) {
        throw new SmartSpacesException(String.format("Could not evaluate expression %s", expression), e);
    }
}

From source file:com.uimirror.auth.conf.ThymeleafConfig.java

@Bean
public TemplateResolver defaultTemplateResolver() {
    ClassLoaderTemplateResolver clTemplateResolver = new ClassLoaderTemplateResolver();
    clTemplateResolver.setPrefix("pages/");
    clTemplateResolver.setSuffix(".html");
    clTemplateResolver.setTemplateMode("HTML5");
    clTemplateResolver.setCharacterEncoding(Constants.UTF_8);
    //clTemplateResolver.setOrder(1);
    clTemplateResolver.setCacheable(Boolean.TRUE);
    clTemplateResolver.initialize();/* ww  w  .j a  v  a 2  s  . c o  m*/
    return clTemplateResolver;
}

From source file:com.omertron.slackbot.utils.PropertiesUtil.java

/**
 * Set the properties filename//  www .j  a  v  a  2  s  .c o  m
 *
 * @param streamName
 * @return
 */
public static boolean setPropertiesStreamName(final String streamName) {
    LOG.info("Using properties file '{}'", FilenameUtils.normalize(streamName));

    try (InputStream propertiesStream = new FileInputStream(streamName);) {
        try (Reader reader = new InputStreamReader(propertiesStream, PROPERTIES_CHARSET)) {
            PROPS.load(reader);
        }
    } catch (IOException error) {
        LOG.error(
                "Failed loading file {}: Please check your configuration. The properties file should be in the classpath.",
                streamName, error);
        return Boolean.FALSE;
    }
    return Boolean.TRUE;
}

From source file:org.yamj.api.trakttv.TestLogger.java

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);/*w  w  w .j  a va  2  s  .  co  m*/
    // 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:edu.stanford.muse.email.VerifyEmailSetup.java

public static Pair<Boolean, String> run() {
    PrintStream savedOut = System.out;
    InputStream savedIn = System.in;

    try {/*from ww  w.  j a v a  2s.c o m*/
        // Get a Properties object
        Properties props = System.getProperties();

        // Get a Session object
        Session session = Session.getInstance(props, null);
        session.setDebug(true);
        String filename = System.getProperty("java.io.tmpdir") + File.separatorChar + "verifyEmailSetup";
        PrintStream ps = new PrintStream(new FileOutputStream(filename));
        System.setOut(ps);
        System.setErr(ps);

        // Get a Store object
        Store store = null;
        store = session.getStore("imaps");
        store.connect("imap.gmail.com", 993, "checkmuse", ""); // not the real password. unfortunately, the checkmuse a/c will get blocked by google.
        //           Folder folder = store.getFolder("[Gmail]/Sent Mail");
        //           int totalMessages = folder.getMessageCount();
        // System.err.println (totalMessages + " messages!");
        ps.close();
        String contents = Util.getFileContents(filename);
        System.out.println(contents);
        return new Pair<Boolean, String>(Boolean.TRUE, contents);
    } catch (AuthenticationFailedException e) {
        /* its ok if auth failed. we only want to check if IMAPS network route is blocked.
         when network is blocked, we'll get something like
        javax.mail.MessagingException: No route to host; 
        nested exception is: 
        java.net.NoRouteToHostException: No route to host 
        ...
        */
        log.info("Verification succeeded: " + Util.stackTrace(e));
        return new Pair<Boolean, String>(Boolean.TRUE, "");
    } catch (Exception e) {
        log.warn("Verification failed: " + Util.stackTrace(e));
        return new Pair<Boolean, String>(Boolean.FALSE, e.toString()); // stack track reveals too much about our code... Util.stackTrace(e));         
    } finally {
        System.setOut(savedOut);
        System.setIn(savedIn);
    }
}

From source file:net.sf.taverna.t2.workbench.models.graph.GraphColorManager.java

/**
 * Returns the colour associated with the Activity.
 *
 * For unknown activities Color.WHITE is returned.
 *
 * For {@link LocalworkerActivity} which have been user configured use the
 * BeanshellActivity colour/*w  w w.j  a v  a2  s. c  o m*/
 *
 * @return the colour associated with the Activity
 */
public static Color getFillColor(Activity activity, ColourManager colourManager) {
    try {
        if (activity.getType().equals(LOCALWORKER)) {
            // To avoid compile time dependency - read isAltered property as bean
            if (Boolean.TRUE.equals(PropertyUtils.getProperty(activity, "altered"))) {
                Color colour = colourManager.getPreferredColour(BEANSHELL);
                return colour;
            }
        }
    } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
    }
    Color colour = colourManager.getPreferredColour(activity.getType().toASCIIString());
    return colour;
}