Example usage for org.apache.commons.lang RandomStringUtils randomNumeric

List of usage examples for org.apache.commons.lang RandomStringUtils randomNumeric

Introduction

In this page you can find the example usage for org.apache.commons.lang RandomStringUtils randomNumeric.

Prototype

public static String randomNumeric(int count) 

Source Link

Document

Creates a random string whose length is the number of characters specified.

Characters will be chosen from the set of numeric characters.

Usage

From source file:com.flexive.tests.embedded.persistence.StructureTest.java

@Test(groups = { "ejb", "structure" })
public void assignmentGroupProperty() throws Exception {
    Context c = EJBLookup.getInitialContext();
    UserTransaction ut = (UserTransaction) c.lookup("java:comp/UserTransaction");
    ut.begin();//www .  j av  a 2s. com
    FxString desc = new FxString("group description...");
    desc.setTranslation(2, "gruppen beschreibung");
    final String GROUPNAME = "GROUPTEST" + RandomStringUtils.randomNumeric(5);
    FxGroupEdit ge = FxGroupEdit.createNew(GROUPNAME, desc, new FxString("hint..."), true,
            FxMultiplicity.of(0, FxMultiplicity.N));
    ae.createGroup(ge, "/");
    ge.setName("subgroup");
    ae.createGroup(ge, "/" + GROUPNAME);
    ge.setName("subgroup2");
    ae.createGroup(ge, "/" + GROUPNAME + "/SUBGROUP");
    desc.setTranslation(1, "property description...");
    desc.setTranslation(2, "attribut beschreibung...");
    FxPropertyEdit pe = FxPropertyEdit.createNew("testproperty", desc, new FxString("property hint"), true,
            FxMultiplicity.of(1, 1), true, env().getACL(1), FxDataType.Number, new FxString("123"), true, null,
            null, null);
    ae.createProperty(pe, "/" + GROUPNAME + "/SUBGROUP");
    FxGroupAssignment ga = (FxGroupAssignment) env().getAssignment("ROOT/" + GROUPNAME);
    FxGroupAssignmentEdit gae = FxGroupAssignmentEdit.createNew(ga, env().getType("ROOT"), "GTEST", "/");
    ae.save(gae, true);
    ut.rollback();
}

From source file:edu.sampleu.demo.kitchensink.UifComponentsTestForm.java

public UifComponentsTestForm() {
    super();//  w  w  w .ja va2  s.c om

    uiTestObject = new UITestObject("Foo", "FooBar", "FooBear", "FooRacket");

    sourceCodeField = "<bean parent=\"Uif-PrimaryActionButton\" p:actionLabel=\"Save\" p:methodToCall=\"performSave\">\n"
            + "  <property name=\"actionImage\">\n"
            + "    <bean parent=\"Uif-Image\"\n"
            + "      p:source=\"@{#ConfigProperties['krad.externalizable.images.url']}searchicon.png\"\n"
            + "      p:actionImageLocation=\"RIGHT\"/>\n"
            + "  </property>\n" + "</bean>";

    list1.add(new UITestObject("5", "6", "7", "8", new UITestObject("1", "1", "1", "1")));
    UITestObject obj1 = new UITestObject("1", "2", "3", "4", new UITestObject("1", "1", "1", "1"));
    obj1.setStringList(null);
    list1.add(obj1);
    UITestObject obj2 = new UITestObject("9", "10", "11", "12", new UITestObject("1", "1", "1", "1"));
    obj2.setStringList(new ArrayList<String>());
    list1.add(obj2);
    list1.add(new UITestObject("13", "14", "15", "16", new UITestObject("1", "1", "1", "1")));
    list1.add(new UITestObject("17", "18", "19", "20", new UITestObject("1", "1", "1", "1")));
    list1.add(new UITestObject("52", "6", "7", "8", new UITestObject("1", "1", "1", "1")));
    list1.add(new UITestObject("12", "2", "3", "4", new UITestObject("1", "1", "1", "1")));
    list1.add(new UITestObject("92", "10", "11", "12", new UITestObject("1", "1", "1", "1")));
    list1.add(new UITestObject("132", "14", "15", "16", new UITestObject("1", "1", "1", "1")));
    list1.add(new UITestObject("2132", "143", "151", "126", new UITestObject("1", "1", "1", "1")));
    list1.add(new UITestObject("1332", "144", "155", "156", new UITestObject("1", "1", "1", "1")));
    list1.add(new UITestObject("2132", "143", "151", "126", new UITestObject("1", "1", "1", "1")));
    list1.add(new UITestObject("1332", "144", "155", "156", new UITestObject("1", "1", "1", "1")));

    list2.add(new UITestObject("A", "B", "C", "D"));
    list2.add(new UITestObject("1", "2", "3", "4"));
    list2.add(new UITestObject("W", "X", "Y", "Z"));
    list2.add(new UITestObject("a", "b", "c", "d"));
    list2.add(new UITestObject("a", "s", "d", "f"));

    list3.add(new UITestObject("A", "B", "C", "D"));
    list3.get(0).getSubList().add(new UITestObject("A", "B", "C", "D"));
    list3.get(0).getSubList().add(new UITestObject("1", "2", "3", "4"));
    list3.get(0).getSubList().add(new UITestObject("W", "X", "Y", "Z"));
    list3.add(new UITestObject("1", "2", "3", "4"));
    list3.get(1).getSubList().add(new UITestObject("A", "B", "C", "D"));
    list3.get(1).getSubList().add(new UITestObject("1", "2", "3", "4"));
    list3.add(new UITestObject("W", "X", "Y", "Z"));
    list3.get(2).getSubList().add(new UITestObject("W", "X", "Y", "Z"));

    list4.add(new UITestObject("A", "B", "C", "D"));
    list4.get(0).getSubList().add(new UITestObject("1", "B", "C", "D", new UITestObject("1", "1", "1", "1")));
    list4.get(0).getSubList().add(new UITestObject("2", "2", "3", "4", new UITestObject("1", "1", "1", "1")));
    list4.get(0).getSubList().add(new UITestObject("3", "X", "Y", "Z", new UITestObject("1", "1", "1", "1")));
    list4.add(new UITestObject("1", "2", "3", "4"));
    list4.get(1).getSubList()
            .add(new UITestObject("4", "b", "C", "D", new UITestObject("$50.00", "1", "1", "1")));
    /*list4.get(1).getSubList().add(new UITestObject("5", "s", "D", "F", new UITestObject("1","1","1","1")));*/

    //triple nesting
    list5.add(new UITestObject("a", "a", "a", "a"));
    list5.get(0).getSubList().add(new UITestObject("A", "B", "C", "D"));
    list5.get(0).getSubList().get(0).getSubList().add(new UITestObject("a3", "3", "3", "3"));
    list5.get(0).getSubList().get(0).getSubList().add(new UITestObject("a3", "3", "3", "3"));
    list5.get(0).getSubList().add(new UITestObject("1", "2", "3", "4"));
    list5.get(0).getSubList().get(1).getSubList().add(new UITestObject("b3", "3", "3", "3"));
    list5.get(0).getSubList().get(1).getSubList().add(new UITestObject("b3", "3", "3", "3"));
    list5.get(0).getSubList().get(1).getSubList().add(new UITestObject("b3", "3", "3", "3"));
    list5.add(new UITestObject("b", "b", "b", "b"));
    list5.get(1).getSubList().add(new UITestObject("a", "b", "C", "D"));
    list5.get(1).getSubList().get(0).getSubList().add(new UITestObject("a23", "3", "3", "3"));
    list5.get(1).getSubList().get(0).getSubList().add(new UITestObject("a23", "3", "3", "3"));
    list5.get(1).getSubList().add(new UITestObject("a", "s", "D", "F"));
    list5.get(1).getSubList().get(1).getSubList().add(new UITestObject("b23", "3", "3", "3"));
    list5.get(1).getSubList().get(1).getSubList().add(new UITestObject("b23", "3", "3", "3"));

    groupedList1.add(new UITestObject("A", "100", "200", "300"));
    groupedList1.add(new UITestObject("A", "101", "200", "300"));
    groupedList1.add(new UITestObject("A", "102", "200", "300"));
    groupedList1.add(new UITestObject("A", "103", "200", "300"));
    groupedList1.add(new UITestObject("A", "104", "200", "300"));

    groupedList1.add(new UITestObject("B", "100", "200", "300"));
    groupedList1.add(new UITestObject("B", "101", "200", "300"));
    groupedList1.add(new UITestObject("B", "102", "200", "300"));

    groupedList1.add(new UITestObject("C", "100", "200", "300"));
    groupedList1.add(new UITestObject("C", "101", "200", "300"));
    groupedList1.add(new UITestObject("C", "102", "200", "300"));
    groupedList1.add(new UITestObject("C", "103", "200", "300"));

    groupedList1.add(new UITestObject("D", "100", "200", "300"));
    groupedList1.add(new UITestObject("D", "101", "200", "300"));
    groupedList1.add(new UITestObject("D", "102", "200", "300"));
    groupedList1.add(new UITestObject("D", "103", "200", "300"));
    groupedList1.add(new UITestObject("D", "100", "200", "300"));
    groupedList1.add(new UITestObject("D", "101", "200", "300"));
    groupedList1.add(new UITestObject("D", "102", "200", "300"));
    groupedList1.add(new UITestObject("D", "103", "200", "300"));
    groupedList1.add(new UITestObject("D", "100", "200", "300"));
    groupedList1.add(new UITestObject("D", "101", "200", "300"));
    groupedList1.add(new UITestObject("D", "102", "200", "300"));
    groupedList1.add(new UITestObject("D", "103", "200", "300"));
    groupedList1.add(new UITestObject("D", "100", "200", "300"));
    groupedList1.add(new UITestObject("D", "101", "200", "300"));
    groupedList1.add(new UITestObject("D", "102", "200", "300"));
    groupedList1.add(new UITestObject("D", "103", "200", "300"));
    groupedList1.add(new UITestObject("D", "100", "200", "300"));
    groupedList1.add(new UITestObject("D", "101", "200", "300"));
    groupedList1.add(new UITestObject("D", "102", "200", "300"));
    groupedList1.add(new UITestObject("D", "103", "200", "300"));
    groupedList1.add(new UITestObject("D", "100", "200", "300"));
    groupedList1.add(new UITestObject("D", "101", "200", "300"));
    groupedList1.add(new UITestObject("D", "102", "200", "300"));
    groupedList1.add(new UITestObject("D", "103", "200", "300"));

    groupedList2.addAll(groupedList1);
    groupedList3.addAll(groupedList1);

    doubleGroupedList.add(new UITestObject("Fall", "2001", "AAA123", "2"));
    doubleGroupedList.add(new UITestObject("Fall", "2001", "BBB123", "3"));
    doubleGroupedList.add(new UITestObject("Fall", "2001", "CCC123", "4"));
    doubleGroupedList.add(new UITestObject("Fall", "2001", "DDD123", "3"));

    doubleGroupedList.add(new UITestObject("Fall", "2002", "AAA123", "3"));
    doubleGroupedList.add(new UITestObject("Fall", "2002", "BBB123", "2"));
    doubleGroupedList.add(new UITestObject("Fall", "2002", "CCC123", "3"));

    doubleGroupedList.add(new UITestObject("Fall", "2003", "AAA123", "3"));
    doubleGroupedList.add(new UITestObject("Fall", "2003", "CCC123", "3"));

    doubleGroupedList.add(new UITestObject("Spring", "2001", "AAA123", "3"));
    doubleGroupedList.add(new UITestObject("Spring", "2001", "BBB123", "3"));
    doubleGroupedList.add(new UITestObject("Spring", "2001", "CCC123", "3"));

    doubleGroupedList.add(new UITestObject("Spring", "2002", "AAA123", "4"));
    doubleGroupedList.add(new UITestObject("Spring", "2002", "BBB123", "4"));
    doubleGroupedList.add(new UITestObject("Spring", "2002", "CCC123", "2"));

    doubleGroupedList.add(new UITestObject("Spring", "2003", "AAA123", "4"));
    doubleGroupedList.add(new UITestObject("Spring", "2003", "BBB123", "3"));
    doubleGroupedList.add(new UITestObject("Spring", "2003", "CCC123", "3"));
    doubleGroupedList.add(new UITestObject("Spring", "2003", "DDD123", "2"));

    for (int i = 0; i < 22; i++) {
        UITestObject newObj = new UITestObject(RandomStringUtils.randomAlphanumeric(6),
                RandomStringUtils.randomAlphanumeric(6), RandomStringUtils.randomAlphanumeric(6),
                RandomStringUtils.randomNumeric(1));
        if (i % 2 == 0) {
            newObj.setBfield(true);
        }
        list6.add(newObj);
    }

    { // scope for name hiding purposes
        Node<String, String> item1 = new Node<String, String>("Item 1", "Item 1");
        item1.addChild(new Node<String, String>("SubItem A", "SubItem A"));
        item1.addChild(new Node<String, String>("SubItem B", "SubItem B"));

        Node<String, String> item2 = new Node<String, String>("Item 2", "Item 2");
        item2.addChild(new Node<String, String>("SubItem A", "SubItem A"));
        Node<String, String> sub2B = new Node<String, String>("SubItem B", "SubItem B");
        sub2B.addChild(new Node<String, String>("Item B-1", "Item B-1"));
        sub2B.addChild(new Node<String, String>("Item B-2", "Item B-2"));
        sub2B.addChild(new Node<String, String>("Item B-3", "Item B-3"));
        item2.addChild(sub2B);
        item2.addChild(new Node<String, String>("SubItem C", "SubItem C"));

        Node<String, String> item3 = new Node<String, String>("Item 3", "Item 3");
        item3.addChild(new Node<String, String>("SubItem A", "SubItem A"));
        item3.addChild(new Node<String, String>("SubItem B", "SubItem B"));
        item3.addChild(new Node<String, String>("SubItem C", "SubItem C"));
        item3.addChild(new Node<String, String>("SubItem D", "SubItem D"));

        Node<String, String> root = new Node<String, String>("Root", "Root");
        root.addChild(item1);
        root.addChild(item2);
        root.addChild(item3);

        tree1.setRootElement(root);
    }

    { // scope for name hiding purposes
        Node<UITestObject, String> item1 = new Node<UITestObject, String>(
                new UITestObject("1-A", "1-B", "1-C", "1-D"), "Item 1");
        item1.addChild(new Node<UITestObject, String>(new UITestObject("1SA-A", "1SA-B", "1SA-C", "1SA-D"),
                "SubItem A"));
        item1.addChild(new Node<UITestObject, String>(new UITestObject("1SB-A", "1SB-B", "1SB-C", "1SB-D"),
                "SubItem B"));

        Node<UITestObject, String> item2 = new Node<UITestObject, String>(
                new UITestObject("2-A", "2-B", "2-C", "2-D"), "Item 2");
        item2.addChild(
                new Node<UITestObject, String>(new UITestObject("SA-a", "SA-b", "SA-c", "SA-d"), "SubItem A"));
        Node<UITestObject, String> sub2B = new Node<UITestObject, String>(
                new UITestObject("SB-a", "SB-b", "SB-c", "SB-d"), "SubItem B");
        sub2B.addChild(new Node<UITestObject, String>(new UITestObject("AA", "BB", "CC", "DD"), "Item B-1"));
        sub2B.addChild(new Node<UITestObject, String>(new UITestObject("Aa", "Bb", "Cc", "Dd"), "Item B-2"));
        sub2B.addChild(new Node<UITestObject, String>(new UITestObject("aA", "bB", "cC", "dD"), "Item B-3"));
        item2.addChild(sub2B);
        item2.addChild(
                new Node<UITestObject, String>(new UITestObject("SC-a", "SC-b", "SC-c", "SC-d"), "SubItem C"));

        Node<UITestObject, String> item3 = new Node<UITestObject, String>(
                new UITestObject("3-A", "3-B", "3-C", "3-D"), "Item 3");
        item3.addChild(new Node<UITestObject, String>(new UITestObject("A", "B", "C", "D"), "SubItem A"));
        item3.addChild(new Node<UITestObject, String>(new UITestObject("1", "2", "3", "4"), "SubItem B"));
        item3.addChild(new Node<UITestObject, String>(new UITestObject("w", "x", "y", "z"), "SubItem C"));
        item3.addChild(new Node<UITestObject, String>(new UITestObject("!", "@", "#", "$"), "SubItem D"));

        Node<UITestObject, String> root = new Node<UITestObject, String>(
                new UITestObject("foo", "bar", "baz", "roo"), "Root");
        root.addChild(item1);
        root.addChild(item2);
        root.addChild(item3);

        tree2.setRootElement(root);
    }

    remoteFieldValuesMap = new HashMap<String, Object>();
    remoteFieldValuesMap.put("remoteField1", "Apple");
    remoteFieldValuesMap.put("remoteField2", "Banana");
    remoteFieldValuesMap.put("remoteField3", true);
    remoteFieldValuesMap.put("remoteField4", "Fruit");

    remoteFieldValuesMap2 = new HashMap<String, Object>();
    remoteFieldValuesMap2.put("remoteField1", "Apple");
    remoteFieldValuesMap2.put("remoteField2", "Banana");
    remoteFieldValuesMap2.put("remoteField3", true);
    remoteFieldValuesMap2.put("remoteField4", "Fruit");

    field88 = "Fruits";
    field91 = "Read only value";
    field92 = "Value 92";

    field131 = new Integer(0);

    DateFormat dateFormat = SimpleDateFormat.getDateInstance(SimpleDateFormat.SHORT);
    dateList = new ArrayList<Date>();
    try {
        dateList.add(dateFormat.parse("01/01/1990"));
        dateList.add(dateFormat.parse("10/31/2001"));
        dateList.add(dateFormat.parse("11/05/2005"));
        dateList.add(dateFormat.parse("02/13/2011"));
    } catch (Exception e) {

    }

    emptyList.clear();
}

From source file:jef.tools.StringUtils.java

/**
 * 8??
 * 
 * @return
 */
public static final String randomString() {
    return RandomStringUtils.randomNumeric(8);
}

From source file:com.bluexml.xforms.controller.alfresco.agents.MappingAgent.java

/**
 * Finds a new name for an uploaded content. The name includes the content type, the random path
 * and the original file name./*from   w ww  .  j  a va 2 s  .c  o m*/
 * <p/>
 * NOTE: uploadDir must have been set.
 * 
 * @param type
 *            the type
 * @param fileName
 *            the file name
 * 
 * @return the file
 */
private File findNewName(int depth, String type, String fileName) {
    String lFileName = fileName;
    if (lFileName.contains("\\")) {
        int lastIndexOf = StringUtils.lastIndexOf(lFileName, '\\');
        lFileName = StringUtils.substring(lFileName, lastIndexOf + 1);
    }
    String rootPath = currentUploadDir.getAbsolutePath() + File.separator + type;

    String randomPath = RandomStringUtils.randomNumeric(depth);
    for (int i = 0; i < depth; i++) {
        rootPath = rootPath + File.separator + randomPath.charAt(i);
    }

    File root = new File(rootPath);

    File result = new File(root, lFileName);
    if (result.exists()) {
        int dotPos = lFileName.lastIndexOf(".");

        String fileNameWihoutExtension = null;
        String fileNameExtension = null;

        if (dotPos == -1) {
            fileNameWihoutExtension = lFileName;
        } else {
            fileNameWihoutExtension = lFileName.substring(0, dotPos);
            fileNameExtension = lFileName.substring(dotPos + 1);
        }
        int i = 0;
        do {
            String newFileName = fileNameWihoutExtension + "-" + i;
            if (fileNameExtension != null) {
                newFileName = newFileName + "." + fileNameExtension;
            }
            result = new File(root, newFileName);
            i++;
        } while (result.exists());
    }
    result.getParentFile().mkdirs();
    return result;
}

From source file:edu.samplu.common.WebDriverLegacyITBase.java

protected void testLocationPostBlanketApprove() throws Exception {
    selectFrameIframePortlet();/*from  w ww.  j a va  2s  .  c  om*/
    waitAndCreateNew();
    String docId = waitForDocId();
    waitAndTypeByXpath(DOC_DESCRIPTION_XPATH, "Validation Test Postal Code");
    assertBlanketApproveButtonsPresent();
    String countryLookUp = "//input[@name='methodToCall.performLookup.(!!org.kuali.rice.location.impl.country.CountryBo!!).(((code:document.newMaintainableObject.countryCode,))).((`document.newMaintainableObject.countryCode:code,`)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;"
            + getBaseUrlString() + "/kr/lookup.do;::::).anchor4']";
    waitAndClickByXpath(countryLookUp);
    waitAndTypeByName("code", "US");
    waitAndClickSearch();
    waitAndClickReturnValue();
    String code = RandomStringUtils.randomNumeric(5);
    waitAndTypeByXpath(DOC_CODE_XPATH, code);
    String stateLookUp = "//input[@name='methodToCall.performLookup.(!!org.kuali.rice.location.impl.state.StateBo!!).(((countryCode:document.newMaintainableObject.countryCode,code:document.newMaintainableObject.stateCode,))).((`document.newMaintainableObject.countryCode:countryCode,document.newMaintainableObject.stateCode:code,`)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;"
            + getBaseUrlString() + "/kr/lookup.do;::::).anchor4']";
    waitAndClickByXpath(stateLookUp);
    waitAndClickSearch();
    waitAndClickByXpath("//table[@id='row']/tbody/tr[4]/td[1]/a");
    String cityName = "Validation Test Postal Code " + code;
    waitAndTypeByXpath("//input[@id='document.newMaintainableObject.cityName']", cityName);
    blanketApproveTest();
    assertDocFinal(docId);
}

From source file:net.tzolov.geode.jmx.util.JmxTransformerDynamic.java

private void scheduleJob(Server server) throws ParseException, SchedulerException {

    String name = server.getHost() + ":" + server.getPort() + "-" + System.currentTimeMillis() + "-"
            + RandomStringUtils.randomNumeric(10);
    JobDetail jd = new JobDetail(name, "ServerJob", ServerJob.class);

    JobDataMap map = new JobDataMap();
    map.put(Server.class.getName(), server);
    jd.setJobDataMap(map);/*w w w . j  a va  2 s. c om*/

    Trigger trigger;

    if ((server.getCronExpression() != null) && CronExpression.isValidExpression(server.getCronExpression())) {
        trigger = new CronTrigger();
        ((CronTrigger) trigger).setCronExpression(server.getCronExpression());
        trigger.setName(
                server.getHost() + ":" + server.getPort() + "-" + Long.toString(System.currentTimeMillis()));
        trigger.setStartTime(computeSpreadStartDate(configuration.getRunPeriod()));
    } else {
        int runPeriod = configuration.getRunPeriod();
        if (server.getRunPeriodSeconds() != null)
            runPeriod = server.getRunPeriodSeconds();
        Trigger minuteTrigger = TriggerUtils.makeSecondlyTrigger(runPeriod);
        minuteTrigger.setName(
                server.getHost() + ":" + server.getPort() + "-" + Long.toString(System.currentTimeMillis()));
        minuteTrigger.setStartTime(computeSpreadStartDate(runPeriod));

        trigger = minuteTrigger;

        // TODO replace Quartz with a ScheduledExecutorService
    }

    serverScheduler.scheduleJob(jd, trigger);
    if (log.isDebugEnabled()) {
        log.debug("Scheduled job: " + jd.getName() + " for server: " + server);
    }
}

From source file:nl.strohalm.cyclos.services.accounts.cards.CardServiceImpl.java

private String buildCardSecurityCode(final Integer length) {
    return RandomStringUtils.randomNumeric(length);
}

From source file:nl.strohalm.cyclos.services.elements.ElementServiceImpl.java

/**
 * Generate a member username/*from  ww  w .j a v  a  2 s .  c  om*/
 */
private String generateUsername(final int length) {
    String generated;
    boolean exists;
    do {
        // Generate a random number
        generated = RandomStringUtils.randomNumeric(length);
        if (generated.charAt(0) == '0') {
            // The first character cannot be zero
            generated = (new Random().nextInt(8) + 1) + generated.substring(1);
        }
        // Check if such username exists
        try {
            userDao.load(generated);
            exists = true;
        } catch (final EntityNotFoundException e) {
            exists = false;
        }
    } while (exists);
    return generated;
}

From source file:nz.co.senanque.performance.Factories.java

private void generateRows() {
    for (IndustryType industryType : IndustryType.values()) {
        //            Column column1 = new Column(industryType.value());
        Column column1 = new Column(industryType.name());
        for (int i = 0; i < TablePerformanceTest.MAX_LOOP2; i++) {
            String r = RandomStringUtils.randomNumeric(5);
            Column column2 = new Column(r);
            Column[] columns = new Column[2];
            columns[0] = column1;/*w w  w .  java2 s. com*/
            columns[1] = column2;
            Row row = new Row(columns);
            m_rows.add(row);
            m_choices.add(new ChoiceBase(r, r, m_messageSource));
        }
    }
    log.info("total rows in decision table: {}", m_rows.size());
}

From source file:org.alfresco.repo.security.authentication.NameBasedUserNameGenerator.java

/**
 * Returns a generated user name/*  w w w . j  a  va2 s  .  c o  m*/
 * 
 * @return the generated user name
 */
public String generateUserName(String firstName, String lastName, String emailAddress, int seed) {
    String userName;

    String pattern = namePattern;

    String initial = firstName.toLowerCase().substring(0, 1);

    userName = pattern.replace("%i%", initial).replace("%firstName%", cleanseName(firstName))
            .replace("%lastName%", cleanseName(lastName)).replace("%emailAddress%", emailAddress.toLowerCase());

    if (seed > 0) {
        if (userName.length() < userNameLength + 3) {
            userName = userName + RandomStringUtils.randomNumeric(3);
        } else {
            // truncate the user name and slap on 3 random characters
            userName = userName.substring(0, userNameLength - 3) + RandomStringUtils.randomNumeric(3);
        }
    }

    return userName;
}