Java Code Examples for org.apache.commons.lang3.StringUtils#containsOnly()

The following examples show how to use org.apache.commons.lang3.StringUtils#containsOnly() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
public int prepareReport(String mailingIdsStr, @VelocityCheck int companyId, String targetsStr, String recipientType) throws Exception {
	int tempTableID = createTempTable();
       if (!StringUtils.containsOnly(mailingIdsStr, "1234567890,")) {
           logger.error("Wrong format of mailing-IDs string");
           return 0;
       }
       if (!StringUtils.containsOnly(targetsStr, "1234567890,")) {
           logger.error("Wrong format of targetGroup-IDs string");
           return 0;
       }
       List<LightTarget> targets = getTargets(targetsStr, companyId);
       if (targets == null) {
           targets = new ArrayList<>();
       }
       insertSendIntoTempTable(mailingIdsStr, tempTableID, companyId, targets, recipientType);
       insertDeliveredIntoTempTable(mailingIdsStr, tempTableID, companyId, targets, recipientType);
       insertOpensIntoTempTable(mailingIdsStr, tempTableID, companyId, targets, recipientType);
       insertClicksIntoTempTable(mailingIdsStr, tempTableID, companyId, targets, recipientType);
       insertOptOutsIntoTempTable(mailingIdsStr, tempTableID, companyId, targets, recipientType);
       insertBouncesIntoTempTable(mailingIdsStr, tempTableID, companyId, targets, recipientType);
       insertRevenueIntoTempTable(mailingIdsStr, tempTableID, companyId, targets, recipientType);
       insertMailingNames(mailingIdsStr, tempTableID, companyId);
       updateRates(mailingIdsStr, tempTableID, companyId, targets);
	return tempTableID;
}
 
Example 2
Source Project: uyuni   File: SessionSwap.java    License: GNU General Public License v2.0 5 votes vote down vote up
/** given an array of strings, compute the hex session swap, which
 * contains both the original data and the 'signature'.  so the
 * resulting string is encapsulated and can be passed around as
 * 'signed' data.
 *
 * @param in an array of strings, all of which must be valud hex
 * @return String of the signature, in the form "D1:D2:D3xHEX"
 *         where D1... are the input data and HEX is the hex signature.
 */
public static String encodeData(String[] in) {
    for (int i = 0; i < in.length; i++) {
        if (!StringUtils.containsOnly(in[i], HEX_CHARS)) {
            throw new IllegalArgumentException("encodeData input must be " +
                                               "lowercase hex, but wasn't: " + in[i]);
        }
    }

    String joined = StringUtils.join(in, ':');

    String[] components = new String[] { joined, generateSwapKey(joined) };

    return StringUtils.join(components, "x");
}
 
Example 3
/**
 * Constructs a new Version object from a version string.
 */
public Version(@NotNull String version) {
  if (version.isEmpty()) {
    throw new VersionFormatException("version string cannot be empty");
  } else if (version.charAt(0) != 'v') {
    throw new VersionFormatException("version string must start with a 'v'");
  } else if (!StringUtils.containsOnly(version.substring(1), "0123456789.")) {
    throw new VersionFormatException("version string can only contain digits and periods");
  }
  this.version = version;
}