Skip to content

Commit

Permalink
Make mutable table suffix shorter
Browse files Browse the repository at this point in the history
Pull request: #214
  • Loading branch information
kokosing committed Mar 28, 2017
1 parent 5251efb commit 80e82f8
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,19 @@

package com.teradata.tempto.internal.fulfillment.table;

import java.util.UUID;
import static org.apache.commons.lang3.RandomStringUtils.random;

public class TableNameGenerator
{
private static final String MUTABLE_TABLE_NAME_PREFIX = "tempto_mut_";

public String generateMutableTableNameInDatabase(String baseTableName)
{
String tableSuffix = randomUUID().replace("-", "");
return MUTABLE_TABLE_NAME_PREFIX + baseTableName + "_" + tableSuffix;
return MUTABLE_TABLE_NAME_PREFIX + baseTableName + "_" + random(8);
}

public boolean isMutableTableName(String tableNameInDatabase)
{
return tableNameInDatabase.startsWith(MUTABLE_TABLE_NAME_PREFIX);
}

private String randomUUID()
{
return UUID.randomUUID().toString();
}
}

0 comments on commit 80e82f8

Please sign in to comment.