Skip to content

Commit

Permalink
Merge pull request #91 from protegeproject/142-changes-to-the-web-api
Browse files Browse the repository at this point in the history
refactored LinearizationDefinition
  • Loading branch information
alexsilaghi authored Jan 6, 2025
2 parents c269668 + 20bfc7b commit 1ff1222
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void startPortlet(PortletUi portletUi, WebProtegeEventBus eventBus) {

dispatch.execute(GetLinearizationDefinitionsAction.create(), result -> {
for (LinearizationDefinition definition : result.getDefinitionList()) {
this.definitionMap.put(definition.getWhoficEntityIri(), definition);
this.definitionMap.put(definition.getLinearizationUri(), definition);
}
view.setLinearizationDefinitonMap(this.definitionMap);
handleSetEntity(getSelectedEntity());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public class LinearizationPortletViewImpl extends Composite implements Lineariza
private final TableRefresh tableRefresh = (linearizationTableRow) -> {
flexTable.removeAllRows();
this.tableRowList = this.tableRowList.stream().map(row -> {
if (row.getLinearizationDefinition().getWhoficEntityIri().equalsIgnoreCase(linearizationTableRow.getLinearizationDefinition().getWhoficEntityIri())) {
if (row.getLinearizationDefinition().getLinearizationUri().equalsIgnoreCase(linearizationTableRow.getLinearizationDefinition().getLinearizationUri())) {
return linearizationTableRow;
}
return row;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ private void populateEditableLinearizationParent() {
public void populateDerivedLinearizationParents(List<LinearizationTableRow> rows) {
if (isDerived()) {
LinearizationTableRow mainRow = rows.stream()
.filter(linearizationRow -> linearizationRow.linearizationDefinition.getId().equalsIgnoreCase(this.linearizationDefinition.getCoreLinId()))
.filter(linearizationRow -> linearizationRow.linearizationDefinition.getLinearizationId().equalsIgnoreCase(this.linearizationDefinition.getCoreLinId()))
.findFirst()
.orElseThrow(() -> {
logger.info("Couldn't find parent with id " + linearizationDefinition.getCoreLinId());
Expand Down Expand Up @@ -183,7 +183,7 @@ public LinearizationSpecification asLinearizationSpecification() {
this.isPartOfCheckbox.getValue().getValue(),
this.parentIri,
this.linearizationDefinition.getSortingCode(),
this.linearizationDefinition.getWhoficEntityIri(),
this.linearizationDefinition.getLinearizationUri(),
this.commentsWidget.getText()
);
return response;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ remove the orElseGet() and add back the orElseThrow() when we have proper labels
dispatch.execute(GetLinearizationDefinitionsAction.create(), definitionsResult -> {
Map<String, LinearizationDefinition> definitionMap = new HashMap<>();
for (LinearizationDefinition definition : definitionsResult.getDefinitionList()) {
definitionMap.put(definition.getWhoficEntityIri(), definition);
definitionMap.put(definition.getLinearizationUri(), definition);
}
view.setLinearizationDefinitonMap(definitionMap);
view.initializeTable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ private Optional<WhoficEntityPostCoordinationSpecification> createEditedSpec() {
WhoficEntityPostCoordinationSpecification specification = new WhoficEntityPostCoordinationSpecification(entityIri, "ICD", new ArrayList<>());
boolean somethingChanged = false;
for (PostCoordinationTableRow tableRow : this.tableRows) {
PostCoordinationSpecification postCoordinationSpecification = new PostCoordinationSpecification(tableRow.getLinearizationDefinition().getWhoficEntityIri(),
PostCoordinationSpecification postCoordinationSpecification = new PostCoordinationSpecification(tableRow.getLinearizationDefinition().getLinearizationUri(),
new ArrayList<>(),
new ArrayList<>(),
new ArrayList<>(),
Expand Down Expand Up @@ -260,7 +260,7 @@ private void bindCellsToParentCells(){
for(PostCoordinationTableRow row : this.tableRows) {
if(!row.isDerived()) {
for(PostCoordinationTableRow childRow : this.tableRows) {
if(childRow.isDerived() && childRow.getLinearizationDefinition().getCoreLinId().equalsIgnoreCase(row.getLinearizationDefinition().getId())) {
if(childRow.isDerived() && childRow.getLinearizationDefinition().getCoreLinId().equalsIgnoreCase(row.getLinearizationDefinition().getLinearizationId())) {
for(PostCoordinationTableCell parentCell: row.getCellList()) {
for(PostCoordinationTableCell childCell: childRow.getCellList()) {
if(parentCell.getAxisLabel().getPostCoordinationAxis().equalsIgnoreCase(childCell.getAxisLabel().getPostCoordinationAxis())) {
Expand Down Expand Up @@ -340,7 +340,7 @@ public void setTableData(WhoficEntityPostCoordinationSpecification whoficSpecifi
for (PostCoordinationTableCell cell : row.getCellList()) {
PostCoordinationSpecification specification = whoficSpecification.getPostCoordinationSpecifications().stream()
.filter(spec -> spec.getLinearizationView()
.equalsIgnoreCase(cell.getLinearizationDefinition().getWhoficEntityIri()))
.equalsIgnoreCase(cell.getLinearizationDefinition().getLinearizationUri()))
.findFirst()
.orElse(null);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

@GwtCompatible(serializable = true)
public class LinearizationDefinition implements IsSerializable, Serializable {
private String id;
private String linearizationId;

private String whoficEntityIri;
private String linearizationUri;

private String linearizationMode;

Expand All @@ -30,28 +30,28 @@ private LinearizationDefinition() {
}

@JsonCreator
public LinearizationDefinition(@JsonProperty("Id") String id,
@JsonProperty("whoficEntityIri") String whoficEntityIri,
public LinearizationDefinition(@JsonProperty("linearizationId") String linearizationId,
@JsonProperty("linearizationUri") String linearizationUri,
@JsonProperty("linearizationMode") String linearizationMode,
@JsonProperty("rootId") String rootId,
@JsonProperty("DisplayLabel") String displayLabel,
@JsonProperty("displayLabel") String displayLabel,
@JsonProperty("coreLinId") String coreLinId,
@JsonProperty("sortingCode") String sortingCode) {
this.id = id;
this.whoficEntityIri = whoficEntityIri;
this.linearizationId = linearizationId;
this.linearizationUri = linearizationUri;
this.linearizationMode = linearizationMode;
this.rootId = rootId;
this.coreLinId = coreLinId;
this.sortingCode = sortingCode;
this.displayLabel = displayLabel;
}

public String getId() {
return id;
public String getLinearizationId() {
return linearizationId;
}

public String getWhoficEntityIri() {
return whoficEntityIri;
public String getLinearizationUri() {
return linearizationUri;
}

public String getLinearizationMode() {
Expand All @@ -77,8 +77,8 @@ public String getDisplayLabel() {
@Override
public String toString() {
return "LinearizationDefinition{" +
"id='" + id + '\'' +
", whoficEntityIri='" + whoficEntityIri + '\'' +
"linearizationId='" + linearizationId + '\'' +
", linearizationUri='" + linearizationUri + '\'' +
", linearizationMode='" + linearizationMode + '\'' +
", rootId='" + rootId + '\'' +
", coreLinId='" + coreLinId + '\'' +
Expand Down

0 comments on commit 1ff1222

Please sign in to comment.