Skip to content

Commit

Permalink
Merge pull request #4521 from inception-project/bugfix/4518-Wrong-fea…
Browse files Browse the repository at this point in the history
…ture-type-shown-in-dropdown-when-scope-is-set-in-concept-feature-settings

#4518 - Wrong feature type shown in dropdown when scope is set in concept feature settings
  • Loading branch information
reckart authored Feb 16, 2024
2 parents d8ae85d + 560dd19 commit b2126ec
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@

import java.io.Serializable;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

public class FeatureType
implements Serializable
{
Expand Down Expand Up @@ -71,6 +74,15 @@ public boolean isInternal()
return internal;
}

@Override
public String toString()
{
return new ToStringBuilder(this, ToStringStyle.JSON_STYLE) //
.append("name", name) //
.append("featureSupportId", featureSupportId) //
.toString();
}

@Override
public int hashCode()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,15 @@ public Optional<FeatureType> getFeatureType(AnnotationFeature aFeature)
return Optional.empty();
}

return Optional.of(new FeatureType(aFeature.getType(),
aFeature.getType().substring(PREFIX.length()), featureSupportId));
var traits = readTraits(aFeature);
traits.getAllowedValueType();

var uiName = "KB: " + traits.getAllowedValueType();
if (!TYPE_ANY_OBJECT.equals(aFeature.getType())) {
uiName += " (" + aFeature.getType().substring(PREFIX.length()) + ")";
}

return Optional.of(new FeatureType(aFeature.getType(), uiName, featureSupportId));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ protected void onModelChanged()
else {
featureType.setEnabled(false);
featureType.setChoices(
() -> featureSupportRegistry.getAllTypes(getModelObject().getLayer()));
asList(featureSupportRegistry.getFeatureType(getModelObject())));
}
}));
featureType.add(new AjaxFormComponentUpdatingBehavior("change")
Expand Down

0 comments on commit b2126ec

Please sign in to comment.