@Override public boolean isCollection(final ScalarModel scalarModel) { final ActionParameterMemento parameterMemento = scalarModel.getParameterMemento(); final ObjectActionParameter actionParameter = parameterMemento.getActionParameter(scalarModel.getSpecificationLoader()); return actionParameter.getFeatureType() == FeatureType.ACTION_PARAMETER_COLLECTION; } };
@Override public boolean isCollection(final ScalarModel scalarModel) { final ActionParameterMemento parameterMemento = scalarModel.getParameterMemento(); final ObjectActionParameter actionParameter = parameterMemento.getActionParameter(scalarModel.getSpecificationLoader()); return actionParameter.getFeatureType() == FeatureType.ACTION_PARAMETER_COLLECTION; }
@Override public ObjectAdapter load(final ScalarModel scalarModel) { final ActionParameterMemento parameterMemento = scalarModel.getParameterMemento(); final ObjectActionParameter actionParameter = parameterMemento .getActionParameter(scalarModel.getSpecificationLoader()); final ObjectAdapter objectAdapter = scalarModel.loadFromSuper(); if(objectAdapter != null) { return objectAdapter; } if(actionParameter.getFeatureType() == FeatureType.ACTION_PARAMETER_SCALAR) { return objectAdapter; } // hmmm... I think we should simply return null, as an indicator that there is no "pending" (see ScalarModelWithMultiPending) // // return an empty collection // // TODO: this should probably move down into OneToManyActionParameter impl // final OneToManyActionParameter otmap = (OneToManyActionParameter) actionParameter; // final CollectionSemantics collectionSemantics = otmap.getCollectionSemantics(); // final TypeOfFacet typeOfFacet = actionParameter.getFacet(TypeOfFacet.class); // final Class<?> elementType = typeOfFacet.value(); // final Object emptyCollection = collectionSemantics.emptyCollectionOf(elementType); // return scalarModel.getCurrentSession().getPersistenceSession().adapterFor(emptyCollection); return objectAdapter; }
@Override public ObjectAdapter load(final ScalarModel scalarModel) { final ActionParameterMemento parameterMemento = scalarModel.getParameterMemento(); final ObjectActionParameter actionParameter = parameterMemento .getActionParameter(scalarModel.getSpecificationLoader()); final ObjectAdapter objectAdapter = scalarModel.loadFromSuper(); if(objectAdapter != null) { return objectAdapter; } if(actionParameter.getFeatureType() == FeatureType.ACTION_PARAMETER_SCALAR) { return objectAdapter; } // hmmm... I think we should simply return null, as an indicator that there is no "pending" (see ScalarModelWithMultiPending) // // return an empty collection // // TODO: this should probably move down into OneToManyActionParameter impl // final OneToManyActionParameter otmap = (OneToManyActionParameter) actionParameter; // final CollectionSemantics collectionSemantics = otmap.getCollectionSemantics(); // final TypeOfFacet typeOfFacet = actionParameter.getFacet(TypeOfFacet.class); // final Class<?> elementType = typeOfFacet.value(); // final Object emptyCollection = collectionSemantics.emptyCollectionOf(elementType); // return scalarModel.getCurrentSession().getPersistenceSession().adapterFor(emptyCollection); return objectAdapter; }