예제 #1
0
 @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;
 }
예제 #2
0
 @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;
   }
 }
예제 #3
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);
 }
예제 #4
0
 @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);
 }
예제 #5
0
  /**
   * 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);
  }
예제 #6
0
 @Override
 public String getDescribedAs(final ScalarModel scalarModel) {
   final ActionParameterMemento parameterMemento = scalarModel.getParameterMemento();
   final ObjectActionParameter actionParameter = parameterMemento.getActionParameter();
   return actionParameter.getDescription();
 }
예제 #7
0
 @Override
 public boolean hasAutoComplete(final ScalarModel scalarModel) {
   final ActionParameterMemento parameterMemento = scalarModel.getParameterMemento();
   final ObjectActionParameter actionParameter = parameterMemento.getActionParameter();
   return actionParameter.hasAutoComplete();
 }