Exemplo n.º 1
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);
 }
 private Object choicesFor(final ObjectActionParameter param) {
   final ObjectAdapter[] choiceAdapters = param.getChoices(objectAdapter);
   if (choiceAdapters == null || choiceAdapters.length == 0) {
     return null;
   }
   final List<Object> list = Lists.newArrayList();
   for (final ObjectAdapter choiceAdapter : choiceAdapters) {
     // REVIEW: previously was using the spec of the parameter, but think instead it should be the
     // spec of the adapter itself
     // final ObjectSpecification choiceSpec = param.getSpecification();
     final ObjectSpecification choiceSpec = choiceAdapter.getSpecification();
     list.add(DomainObjectReprRenderer.valueOrRef(rendererContext, choiceAdapter, choiceSpec));
   }
   return list;
 }