if (EntityView.VIEW_DELETE.equals(ev.getViewKey())) { method = Method.DELETE; } else if (EntityView.VIEW_EDIT.equals(ev.getViewKey())) { method = Method.PUT; } else if (EntityView.VIEW_NEW.equals(ev.getViewKey())) { method = Method.POST; } else {
if (EntityView.VIEW_DELETE.equals(ev.getViewKey())) { method = Method.DELETE; } else if (EntityView.VIEW_EDIT.equals(ev.getViewKey())) { method = Method.PUT; } else if (EntityView.VIEW_NEW.equals(ev.getViewKey())) { method = Method.POST; } else {
if (EntityView.VIEW_LIST.equals(view.getViewKey()) || ref.getId() == null) { String title = view.getViewKey() + ":" + ref; encoded = XML_HEADER + XHTML_HEADER.replace("{title}", title) + encoded + XHTML_FOOTER; } else if (Formats.XML.equals(format)) {
if (EntityView.VIEW_LIST.equals(view.getViewKey()) || ref.getId() == null) { String title = view.getViewKey() + ":" + ref; encoded = XML_HEADER + XHTML_HEADER.replace("{title}", title) + encoded + XHTML_FOOTER; } else if (Formats.XML.equals(format)) {
boolean updateable = entityProviderManager.getProviderByPrefixAndCapability(prefix, Updateable.class) != null; boolean deleteable = entityProviderManager.getProviderByPrefixAndCapability(prefix, Deleteable.class) != null; String viewKey = view.getViewKey(); if (EntityView.VIEW_NEW.equals(viewKey) && createable) { handle = true;
boolean updateable = entityProviderManager.getProviderByPrefixAndCapability(prefix, Updateable.class) != null; boolean deleteable = entityProviderManager.getProviderByPrefixAndCapability(prefix, Deleteable.class) != null; String viewKey = view.getViewKey(); if (EntityView.VIEW_NEW.equals(viewKey) && createable) { handle = true;
if (entityViewKeys != null && ! ReflectUtils.contains(entityViewKeys, view.getViewKey()) ) { throw new EntityException("Access provider for " + view.getEntityReference().getPrefix() + " will not handle this view ("+view.getViewKey()+"): " + view, view.getEntityReference()+"", HttpServletResponse.SC_BAD_REQUEST);
if (entityViewKeys != null && ! ReflectUtils.contains(entityViewKeys, view.getViewKey()) ) { throw new EntityException("Access provider for " + view.getEntityReference().getPrefix() + " will not handle this view ("+view.getViewKey()+"): " + view, view.getEntityReference()+"", HttpServletResponse.SC_BAD_REQUEST);
/** * Makes a copy of an EntityView which can be changed independently * @param ev any EntityView * @return the copy * @throws IllegalArgumentException if the input is null OR not completely constructed */ public static EntityView copy(EntityView ev) { if (ev == null) { throw new IllegalArgumentException("input entity view must not be null"); } if (ev.viewKey == null || ev.entityReference == null) { throw new IllegalArgumentException("input entity view must be completely constructed"); } EntityView togo = new EntityView(); EntityReference ref = ev.getEntityReference(); togo.setEntityReference( new EntityReference(ref.getPrefix(), ref.getId() == null ? "" : ref.getId()) ); togo.preloadParseTemplates( ev.getAnazlyzedTemplates() ); togo.setExtension( ev.getExtension() ); togo.setViewKey( ev.getViewKey() ); return togo; }
if ( EntityView.VIEW_DELETE.equals(view.getViewKey()) && view.getEntityReference().getId() == null) { throw new EntityException("Unable to handle entity ("+view.getEntityReference()+") delete request without entity id, url="
&& ! view.getViewKey().equals(customAction.viewKey)) { throw new EntityException( "Cannot execute custom action ("+customAction.action+") for request method " + req.getMethod() + ", The custom action view key ("+customAction.viewKey+") must match the request view key ("+view.getViewKey()+")", view.getEntityReference()+"", HttpServletResponse.SC_BAD_REQUEST ); if (output) { String viewKey = view.getViewKey(); if (EntityView.VIEW_NEW.equals(viewKey) || EntityView.VIEW_EDIT.equals(viewKey) if (EntityView.VIEW_DELETE.equals(view.getViewKey())) { if (EntityView.VIEW_NEW.equals(view.getViewKey())) { Createable createable = entityProviderManager.getProviderByPrefixAndCapability(prefix, Createable.class); if (createable == null) { } else if (EntityView.VIEW_EDIT.equals(view.getViewKey())) { Updateable updateable = entityProviderManager.getProviderByPrefixAndCapability(prefix, Updateable.class); if (updateable == null) { "action was not understood: " + view.getViewKey(), view.getEntityReference()+"", HttpServletResponse.SC_BAD_REQUEST); + ") and view ("+view.getViewKey()+") when there is no " + "access provider to handle the request for prefix (" + view.getEntityReference().getPrefix() + ")"; throw new EntityException( message, view.toString(), HttpServletResponse.SC_METHOD_NOT_ALLOWED );
&& ! view.getViewKey().equals(customAction.viewKey)) { throw new EntityException( "Cannot execute custom action ("+customAction.action+") for request method " + req.getMethod() + ", The custom action view key ("+customAction.viewKey+") must match the request view key ("+view.getViewKey()+")", view.getEntityReference()+"", HttpServletResponse.SC_BAD_REQUEST ); if (output) { String viewKey = view.getViewKey(); if (EntityView.VIEW_NEW.equals(viewKey) || EntityView.VIEW_EDIT.equals(viewKey) if (EntityView.VIEW_DELETE.equals(view.getViewKey())) { if (EntityView.VIEW_NEW.equals(view.getViewKey())) { Createable createable = entityProviderManager.getProviderByPrefixAndCapability(prefix, Createable.class); if (createable == null) { } else if (EntityView.VIEW_EDIT.equals(view.getViewKey())) { Updateable updateable = entityProviderManager.getProviderByPrefixAndCapability(prefix, Updateable.class); if (updateable == null) { "action was not understood: " + view.getViewKey(), view.getEntityReference()+"", HttpServletResponse.SC_BAD_REQUEST); + ") and view ("+view.getViewKey()+") when there is no " + "access provider to handle the request for prefix (" + view.getEntityReference().getPrefix() + ")"; throw new EntityException( message, view.toString(), HttpServletResponse.SC_METHOD_NOT_ALLOWED );