Skip to content

Commit

Permalink
add UUID generator by time
Browse files Browse the repository at this point in the history
  • Loading branch information
mcastillob committed Mar 17, 2018
1 parent a81b22f commit e42967c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
8 changes: 8 additions & 0 deletions pivot4j-analytics/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,14 @@
<scope>test</scope>
<version>${version.jacoco}</version>
</dependency>

<dependency>
<groupId>com.fasterxml.uuid</groupId>
<artifactId>java-uuid-generator</artifactId>
<version>${version.java.uuid.generator}</version>
</dependency>


</dependencies>

<dependencyManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.fasterxml.uuid.Generators;

public class PivotComponentBuilder extends
AbstractRenderCallback<TableRenderContext> implements
TableRenderCallback {
Expand Down Expand Up @@ -278,8 +280,9 @@ public void startRow(TableRenderContext context) {
@Override
public void startCell(TableRenderContext context) {
this.column = new Column();
UUID uuid = UUID.randomUUID();
// String id = "col-" + column.hashCode(); se prodice error por duplicados

UUID uuid = Generators.timeBasedGenerator().generate();

String id = "col-" + uuid.toString();

column.setId(id);
Expand Down Expand Up @@ -532,9 +535,9 @@ public void renderContent(TableRenderContext context, String label,
column.getChildren().add(inplace);
} else {
HtmlOutputText text = new HtmlOutputText();
UUID uuid = UUID.randomUUID();

// String id = "txt-" + text.hashCode(); falla se duplican identificadores
UUID uuid = Generators.timeBasedGenerator().generate();
String id = "txt-" + uuid.toString();
text.setId(id);
text.setValue(labelText);
Expand Down
3 changes: 3 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ It aims to leverage mature but now discontinued JPivot project's codebase to mak
<version.plugin.source>2.2.1</version.plugin.source>
<version.plugin.war>2.4</version.plugin.war>
<version.plugin.xml>1.0</version.plugin.xml>
<version.java.uuid.generator>3.1.5</version.java.uuid.generator>



<version.extension.scm>1.9</version.extension.scm>
<version.extension.wagon>2.6</version.extension.wagon>
Expand Down

0 comments on commit e42967c

Please sign in to comment.