public <O extends ObjectType> CompiledObjectCollectionView findObjectViewByViewName(Class<O> compileTimeClass, String viewName){ if (compileTimeClass == null || StringUtils.isEmpty(viewName)){ return null; } List<CompiledObjectCollectionView> objectViews = findAllApplicableObjectCollectionViews(compileTimeClass); if (objectViews == null) { return null; } for (CompiledObjectCollectionView view : objectViews){ if (viewName.equals(view.getViewIdentifier())){ return view; } } return null; }
/** * Find all views that are applicable for a particular object type. Returns views for all collections * and archetypes that are applicable for that type. Ideal to be used in costructing menus. */ @NotNull public <O extends ObjectType> List<CompiledObjectCollectionView> findAllApplicableObjectCollectionViews(Class<O> compileTimeClass) { return findAllApplicableObjectCollectionViews(ObjectTypes.getObjectType(compileTimeClass).getTypeQName()); }