@Override public Integer getScale(ScalarModel scalarModel) { final ActionParameterMemento parameterMemento = scalarModel.getParameterMemento(); final ObjectActionParameter actionParameter = parameterMemento.getActionParameter(); final BigDecimalValueFacet facet = actionParameter.getFacet(BigDecimalValueFacet.class); return facet != null ? facet.getScale() : null; }
@Override public int getAutoCompleteOrChoicesMinLength(ScalarModel scalarModel) { if (scalarModel.hasAutoComplete()) { final ActionParameterMemento parameterMemento = scalarModel.getParameterMemento(); final ObjectActionParameter actionParameter = parameterMemento.getActionParameter(); return actionParameter.getAutoCompleteMinLength(); } else { return 0; } }
@Override public List<ObjectAdapter> getChoices( final ScalarModel scalarModel, final ObjectAdapter[] argumentsIfAvailable) { final ActionParameterMemento parameterMemento = scalarModel.getParameterMemento(); final ObjectActionParameter actionParameter = parameterMemento.getActionParameter(); final ObjectAdapter[] choices = actionParameter.getChoices( scalarModel.parentObjectAdapterMemento.getObjectAdapter(ConcurrencyChecking.CHECK), argumentsIfAvailable); return choicesAsList(choices); }
@Override public List<ObjectAdapter> getAutoComplete( final ScalarModel scalarModel, final String searchArg) { final ActionParameterMemento parameterMemento = scalarModel.getParameterMemento(); final ObjectActionParameter actionParameter = parameterMemento.getActionParameter(); final ObjectAdapter[] choices = actionParameter.getAutoComplete( scalarModel.parentObjectAdapterMemento.getObjectAdapter( ConcurrencyChecking.NO_CHECK), searchArg); return choicesAsList(choices); }
/** * Creates a model representing an action parameter of an action of a parent object, with the * {@link #getObject() value of this model} to be default value (if any) of that action parameter. */ public ScalarModel( final ObjectAdapterMemento parentObjectAdapterMemento, final ActionParameterMemento apm) { this.kind = Kind.PARAMETER; this.parentObjectAdapterMemento = parentObjectAdapterMemento; this.parameterMemento = apm; final ObjectActionParameter actionParameter = parameterMemento.getActionParameter(); // REVIEW: is no checking ok here? final ObjectAdapter defaultAdapter = actionParameter.getDefault( parentObjectAdapterMemento.getObjectAdapter(ConcurrencyChecking.NO_CHECK)); setObject(defaultAdapter); setMode(Mode.EDIT); }
@Override public String getDescribedAs(final ScalarModel scalarModel) { final ActionParameterMemento parameterMemento = scalarModel.getParameterMemento(); final ObjectActionParameter actionParameter = parameterMemento.getActionParameter(); return actionParameter.getDescription(); }
@Override public boolean hasAutoComplete(final ScalarModel scalarModel) { final ActionParameterMemento parameterMemento = scalarModel.getParameterMemento(); final ObjectActionParameter actionParameter = parameterMemento.getActionParameter(); return actionParameter.hasAutoComplete(); }