Skip to content

Commit

Permalink
hotfix/workaround to have unique root & included row IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
teosarca committed Jun 12, 2017
1 parent 473d359 commit be7056f
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions src/main/java/de/metas/ui/web/view/ViewRow.java
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ public static final class Builder
{
private final WindowId windowId;
private DocumentId rowId;
private DocumentId _rowIdEffective; // lazy
private DocumentId parentRowId;
private IViewRowType type;
private Boolean processed;
Expand All @@ -205,6 +206,7 @@ private DocumentPath getDocumentPath()
public Builder setRowId(final DocumentId rowId)
{
this.rowId = rowId;
_rowIdEffective = null;
return this;
}

Expand Down Expand Up @@ -244,16 +246,30 @@ else if (jsonRowIdObj instanceof JSONLookupValue)
/** @return view row ID; never null */
public DocumentId getRowId()
{
if (rowId == null)
if (_rowIdEffective == null)
{
throw new IllegalStateException("No rowId was provided for " + this);
if (rowId == null)
{
throw new IllegalStateException("No rowId was provided for " + this);
}

if (isRootRow())
{
_rowIdEffective = rowId;
}
else
{
_rowIdEffective = DocumentId.ofString("D" + rowId.toJson());
}
}
return rowId;

return _rowIdEffective;
}

public Builder setParentRowId(final DocumentId parentRowId)
{
this.parentRowId = parentRowId;
_rowIdEffective = null;
return this;
}

Expand Down

1 comment on commit be7056f

@teosarca
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

task #424

Please sign in to comment.