예제 #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 String getLongName(final ScalarModel scalarModel) {
   final ObjectAdapterMemento adapterMemento = scalarModel.getObjectAdapterMemento();
   if (adapterMemento == null) {
     // shouldn't happen
     return null;
   }
   ObjectSpecId objectSpecId = adapterMemento.getObjectSpecId();
   final String specShortName =
       SpecUtils.getSpecificationFor(objectSpecId).getShortIdentifier();
   final String parmId =
       scalarModel
           .getParameterMemento()
           .getActionParameter()
           .getIdentifier()
           .toNameIdentityString();
   return specShortName + "-" + parmId + "-" + scalarModel.getParameterMemento().getNumber();
 }
예제 #3
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;
   }
 }
예제 #4
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);
 }
예제 #5
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);
 }
예제 #6
0
 @Override
 public String parseAndValidate(
     final ScalarModel scalarModel, final String proposedPojoAsStr) {
   final ObjectActionParameter parameter =
       scalarModel.getParameterMemento().getActionParameter();
   ParseableFacet parseableFacet = parameter.getFacet(ParseableFacet.class);
   if (parseableFacet == null) {
     parseableFacet = parameter.getSpecification().getFacet(ParseableFacet.class);
   }
   try {
     final ObjectAdapter parentAdapter =
         scalarModel.parentObjectAdapterMemento.getObjectAdapter(ConcurrencyChecking.CHECK);
     Localization localization = IsisContext.getLocalization();
     final String invalidReasonIfAny =
         parameter.isValid(parentAdapter, proposedPojoAsStr, localization);
     return invalidReasonIfAny;
   } catch (final Exception ex) {
     return ex.getLocalizedMessage();
   }
 }
예제 #7
0
 @Override
 public String getDescribedAs(final ScalarModel scalarModel) {
   final ActionParameterMemento parameterMemento = scalarModel.getParameterMemento();
   final ObjectActionParameter actionParameter = parameterMemento.getActionParameter();
   return actionParameter.getDescription();
 }
예제 #8
0
 @Override
 public boolean hasAutoComplete(final ScalarModel scalarModel) {
   final ActionParameterMemento parameterMemento = scalarModel.getParameterMemento();
   final ObjectActionParameter actionParameter = parameterMemento.getActionParameter();
   return actionParameter.hasAutoComplete();
 }
예제 #9
0
 @Override
 public <T extends Facet> T getFacet(final ScalarModel scalarModel, final Class<T> facetType) {
   final FacetHolder facetHolder = scalarModel.getParameterMemento().getActionParameter();
   return facetHolder.getFacet(facetType);
 }
예제 #10
0
 @Override
 public boolean isRequired(final ScalarModel scalarModel) {
   final FacetHolder facetHolder = scalarModel.getParameterMemento().getActionParameter();
   return isRequired(facetHolder);
 }
예제 #11
0
 @Override
 public String getIdentifier(final ScalarModel scalarModel) {
   return "" + scalarModel.getParameterMemento().getNumber();
 }
예제 #12
0
 @Override
 public ObjectSpecification getScalarTypeSpec(final ScalarModel scalarModel) {
   return scalarModel.getParameterMemento().getSpecification();
 }
예제 #13
0
 @Override
 public String getName(final ScalarModel scalarModel) {
   return scalarModel.getParameterMemento().getActionParameter().getName();
 }