List of usage examples for org.springframework.util StringUtils hasText
public static boolean hasText(@Nullable String str)
From source file:csns.web.editor.UserPropertyEditor.java
@Override public void setAsText(String text) throws IllegalArgumentException { if (StringUtils.hasText(text)) setValue(userDao.getUser(Long.valueOf(text))); }
From source file:org.openmrs.module.appointmentscheduling.web.TimeSlotEditor.java
/** * @should set using id// w ww . j ava2s. c o m * @should set using uuid */ public void setAsText(String text) throws IllegalArgumentException { AppointmentService as = Context.getService(AppointmentService.class); if (StringUtils.hasText(text)) { try { setValue(as.getTimeSlot(Integer.valueOf(text))); } catch (Exception ex) { TimeSlot ts = as.getTimeSlotByUuid(text); setValue(ts); if (ts == null) { log.error("Error setting text: " + text, ex); throw new IllegalArgumentException("TimeSlot not found: " + ex.getMessage()); } } } else { setValue(null); } }
From source file:org.web4thejob.orm.validation.CharsetValidator.java
@Override public boolean isValid(String value, ConstraintValidatorContext context) { if (!StringUtils.hasText(value)) return true; return java.nio.charset.Charset.isSupported(value); }
From source file:org.openmrs.module.appointmentscheduling.web.AppointmentEditor.java
/** * @should set using id//from w ww .j a v a2 s .co m * @should set using uuid */ public void setAsText(String text) throws IllegalArgumentException { AppointmentService as = Context.getService(AppointmentService.class); if (StringUtils.hasText(text)) { try { setValue(as.getAppointment(Integer.valueOf(text))); } catch (Exception ex) { Appointment ts = as.getAppointmentByUuid(text); setValue(ts); if (ts == null) { log.error("Error setting text: " + text, ex); throw new IllegalArgumentException("Appointment not found: " + ex.getMessage()); } } } else { setValue(null); } }
From source file:csns.web.editor.CoursePropertyEditor.java
@Override public void setAsText(String text) throws IllegalArgumentException { if (StringUtils.hasText(text)) setValue(courseDao.getCourse(Long.valueOf(text))); }
From source file:org.openmrs.module.appointmentscheduling.web.AppointmentTypeEditor.java
/** * @should set using id/*from ww w . ja va 2 s . c o m*/ * @should set using uuid */ public void setAsText(String text) throws IllegalArgumentException { AppointmentService as = Context.getService(AppointmentService.class); if (StringUtils.hasText(text)) { try { setValue(as.getAppointmentType(Integer.valueOf(text))); } catch (Exception ex) { AppointmentType ts = as.getAppointmentTypeByUuid(text); setValue(ts); if (ts == null) { log.error("Error setting text: " + text, ex); throw new IllegalArgumentException("AppointmentType not found: " + ex.getMessage()); } } } else { setValue(null); } }
From source file:org.xacml4j.spring.DecisionCombiningAlgorithmProvidersDefinitionParser.java
private static BeanDefinitionBuilder parseComponent(Element element) { BeanDefinitionBuilder component = BeanDefinitionBuilder .rootBeanDefinition(DecisionCombiningAlgorithmProviderBean.class); String clazz = element.getAttribute("class"); if (StringUtils.hasText(clazz)) { component.addPropertyValue("class", clazz); }/* w w w . j a va 2 s. c o m*/ String ref = element.getAttribute("ref"); if (StringUtils.hasText(ref)) { component.addPropertyReference("ref", ref); } return component; }
From source file:org.openmrs.module.appointmentscheduling.web.AppointmentBlockEditor.java
/** * @should set using id//from www . ja v a 2 s . co m * @should set using uuid */ public void setAsText(String text) throws IllegalArgumentException { AppointmentService as = Context.getService(AppointmentService.class); if (StringUtils.hasText(text)) { try { setValue(as.getAppointmentBlock(Integer.valueOf(text))); } catch (Exception ex) { AppointmentBlock ab = as.getAppointmentBlockByUuid(text); setValue(ab); if (ab == null) { log.error("Error setting text: " + text, ex); throw new IllegalArgumentException("AppointmentBlock not found: " + ex.getMessage()); } } } else { setValue(null); } }
From source file:csns.web.editor.RubricPropertyEditor.java
@Override public void setAsText(String text) throws IllegalArgumentException { if (StringUtils.hasText(text)) setValue(rubricDao.getRubric(Long.valueOf(text))); }