private int getEmailDaysCutoff() { String emailDaysCutoff = SysConfigManager.instance().getValue("emailDaysCutoff"); if (StringUtils.isEmpty(emailDaysCutoff)) { return 30; } else { return Integer.valueOf(emailDaysCutoff); } }
/** * Return the name of the property. The name of the property is derived by: * * <ol> * <li>looking at the attribute {@link Constants.PROPERTY_NAME} * <li>looking at the attribute {@link Constants.PROPERTY_NAME_REF} * <li>if the property is specified at a filed and the field is of type string the init value is * used. * </ol> * * @param property The property tag. * @param field The corresponding field if the property is a tag of a field. * @return The name of the property or the defaultName */ protected String getPropertyName(JavaTag tag, JavaField field) throws SCRDescriptorException { // check name property String name = tag.getNamedParameter(Constants.PROPERTY_NAME); if (StringUtils.isEmpty(name)) { // check name ref propery name = tag.getNamedParameter(Constants.PROPERTY_NAME_REF); if (!StringUtils.isEmpty(name)) { final JavaField refField = this.getReferencedField(tag, name); final String[] values = refField.getInitializationExpression(); if (values == null || values.length == 0) { throw new SCRDescriptorException( "Referenced field for " + name + " has no values for a property name.", tag); } if (values.length > 1) { throw new SCRDescriptorException( "Referenced field " + name + " has more than one value for a property name.", tag); } name = values[0]; } if (StringUtils.isEmpty(name)) { // check field name = null; if (field != null && "java.lang.String".equals(field.getType())) { final String[] initValues = field.getInitializationExpression(); if (initValues != null && initValues.length == 1) { name = initValues[0]; } } } } // final empty check if (StringUtils.isEmpty(name)) { name = null; } return name; }
/* Divide text to array of parts using serparator charaster */ public static String[] explode(String text, char separator) { if (StringUtils.isEmpty(text)) { return new String[0]; } Vector<String> tmp = new Vector<String>(); int start = 0; int end = text.indexOf(separator, start); while (end >= start) { tmp.addElement(text.substring(start, end)); start = end + 1; end = text.indexOf(separator, start); } tmp.addElement(text.substring(start)); String[] result = new String[tmp.size()]; tmp.copyInto(result); return result; }
private int getMaxMessageSize() { try { String config = SysConfigManager.instance().getValue("maxMessageSize"); if (StringUtils.isEmpty(config)) { return DEFAULT_MAXIMUM_MESSAGE_SIZE; } else { return Integer.parseInt(config); } } catch (Throwable t) { log.warn( String.format( "Unable to determined maximum message size, defaulting to %d", DEFAULT_MAXIMUM_MESSAGE_SIZE), t); return DEFAULT_MAXIMUM_MESSAGE_SIZE; } }
public CIJob getJob(ApplicationInfo appInfo, String jobName) throws PhrescoException { try { S_LOGGER.debug("Search for jobName => " + jobName); if (StringUtils.isEmpty(jobName)) { return null; } List<CIJob> jobs = getJobs(appInfo); if (CollectionUtils.isEmpty(jobs)) { S_LOGGER.debug("job list is empty!!!!!!!!"); return null; } S_LOGGER.debug("Job list found!!!!!"); for (CIJob job : jobs) { S_LOGGER.debug("job list job Names => " + job.getName()); if (job.getName().equals(jobName)) { return job; } } } catch (Exception e) { throw new PhrescoException(e); } return null; }