List of usage examples for org.apache.commons.lang3 BooleanUtils isTrue
public static boolean isTrue(final Boolean bool)
Checks if a Boolean value is true , handling null by returning false .
BooleanUtils.isTrue(Boolean.TRUE) = true BooleanUtils.isTrue(Boolean.FALSE) = false BooleanUtils.isTrue(null) = false
From source file:io.sevenluck.chat.mapper.ChatRoomMapper.java
public static ChatRoom toEntity(ChatRoom chatroom, ChatRoomDTO value) { ChatRoom result = new ChatRoom(); result.setInserted(new Date()); if (null != chatroom) { result = SerializationUtils.clone(chatroom); }//from ww w . j a v a2 s .co m result.setName(value.getName()); result.setDescription(value.getDescription()); if (BooleanUtils.isTrue(value.isPublicChat())) { result.setPublicChat(true); result.setPasswordKey(MD5Util.getMD5(value.getPassword())); } else { result.setPublicChat(false); result.setPasswordKey(null); } if (StringUtils.isEmpty(value.getDescription())) { result.setDescription("default"); } return result; }
From source file:com.haulmont.cuba.web.widgets.renderers.CubaCheckBoxRenderer.java
@Override public JsonValue encode(Boolean value) { return super.encode(BooleanUtils.isTrue(value)); }
From source file:com.haulmont.cuba.web.gui.components.converters.YesNoIconConverter.java
@Override public String convertToPresentation(Boolean value, Class<? extends String> targetType, Locale locale) throws ConversionException { if (BooleanUtils.isTrue(value)) { return getHtmlString(getTrueString()); } else {/*from www . ja v a 2s . com*/ return getHtmlString(getFalseString()); } }
From source file:com.inkubator.hrm.service.impl.NotificationBroadcastAnnouncementMessagesListener.java
@Override public void onMessage(Message message) { try {//from w ww . j a v a 2s. c om String json = ((TextMessage) message).getText(); Gson gson = JsonUtil.getHibernateEntityGsonBuilder().create(); AnnouncementJsonModel model = gson.fromJson(json, AnnouncementJsonModel.class); /** proses untuk menggenerate log, sekaligus mengirim email per Announcement*/ if (BooleanUtils.isTrue(model.getIsGeneratingAnnouncementLog())) { //creating announcement log (synchronous) JobParameters jobParameters = new JobParametersBuilder() .addLong("announcementId", model.getAnnouncementId()) .addDate("planExecutionDate", model.getPlanExecutionDate()) .addDate("createdOn", new Timestamp(new Date().getTime())).toJobParameters(); jobLauncher.run(jobAnnouncementLog, jobParameters); //broadcast email announcement (asynchronous / fire and forget) if (model.getViewModel() == HRMConstant.ANNOUNCEMENT_VIEW_MAIL) { jobParameters = new JobParametersBuilder().addLong("announcementId", model.getAnnouncementId()) .addDate("planExecutionDate", model.getPlanExecutionDate()) .addDate("createdOn", new Timestamp(new Date().getTime())).toJobParameters(); jobLauncherAsync.run(jobEmailingAnnouncement, jobParameters); } } /** proses untuk mengirim email semua Announcement, yang memang belum dikirim */ if (BooleanUtils.isTrue(model.getIsSendingAllEmailNotSent())) { JobParameters jobParameters = new JobParametersBuilder() .addDate("createdOn", new Timestamp(new Date().getTime())).toJobParameters(); jobLauncherAsync.run(jobEmailingAnnouncementNotSent, jobParameters); } } catch (Exception ex) { LOGGER.error("Error", ex); } }
From source file:com.joyent.manta.config.IntegrationTestConfigContext.java
/** * Populate configuration from defaults, environment variables, system * properties and an addition context passed in. Assigns hard-coded * client-side encryption configuration settings. *//* w w w.ja v a 2 s .co m*/ public IntegrationTestConfigContext(Boolean usingEncryption) { super(enableTestEncryption(new StandardConfigContext(), (encryptionEnabled() && usingEncryption == null) || BooleanUtils.isTrue(usingEncryption), encryptionCipher())); }
From source file:com.hp.autonomy.frontend.find.idol.configuration.QueryManipulation.java
@Override public boolean isEnabled() { return BooleanUtils.isTrue(enabled); }
From source file:it.rockeat.source.soundcloud.ScTrack.java
public Track toTrack() { Track track = new Track(); track.setTitle(title);/*from ww w. j a va 2 s. co m*/ track.setAuthor(user.getUsername()); track.setId(id); if (BooleanUtils.isTrue(downloadable)) { track.setUrl(download_url); } else { track.setUrl(stream_url); } return track; }
From source file:com.joyent.manta.config.IntegrationTestConfigContext.java
/** * Populate configuration from defaults, environment variables, system * properties and an addition context passed in. Assigns hard-coded * client-side encryption configuration settings. *//* www.j ava 2 s . c o m*/ public IntegrationTestConfigContext(Boolean usingEncryption, String encryptionCipher) { super(enableTestEncryption(new StandardConfigContext(), (encryptionEnabled() && usingEncryption == null) || BooleanUtils.isTrue(usingEncryption), encryptionCipher)); }
From source file:de.knightsoftnet.validators.client.GwtpSpringSession.java
/** * read session data./*from w w w .j a v a 2 s . c om*/ */ @Override public void readSessionData() { this.dispatcher.execute(this.userService.isCurrentUserLoggedIn(), new AsyncCallback<Boolean>() { @Override public void onFailure(final Throwable pcaught) { GWT.log("Error checking if user is logged in", pcaught); } @Override public void onSuccess(final Boolean presult) { if (BooleanUtils.isTrue(presult)) { // we do have a logged in user, read it GwtpSpringSession.this.dispatcher.execute(GwtpSpringSession.this.userService.getCurrentUser(), new AsyncCallback<T>() { @Override public void onFailure(final Throwable pcaught) { GWT.log("Error reading session user", pcaught); } @Override public void onSuccess(final T presult) { GwtpSpringSession.this.setUser(presult); } }); } else { GwtpSpringSession.this.setUser(null); } } }); }
From source file:com.base2.kagura.core.report.connectors.ReportConnector.java
/** * Runs the report.// w ww .j ava 2s . c om * @param extra middleware provided values, such as date/time, system configuration, logged in user, permissions * and what ever else is of value to the user. */ public void run(Map<String, Object> extra) { if (getParameterConfig() != null) { Boolean parametersRequired = false; List<String> requiredParameters = new ArrayList<String>(); for (ParamConfig paramConfig : getParameterConfig()) { if (BooleanUtils.isTrue(paramConfig.getRequired())) { try { if (StringUtils .isBlank(ObjectUtils.toString(PropertyUtils.getProperty(paramConfig, "value")))) { parametersRequired = true; requiredParameters.add(paramConfig.getName()); } } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } } } if (parametersRequired) { errors.add("Some required parameters weren't filled in: " + StringUtils.join(requiredParameters, ", ") + "."); return; } } runReport(extra); }