/** * @return the entity URL of the internal reference based on the * internal viewKey and extension, defaults to {@link TemplateParseUtil#TEMPLATE_SHOW} or * the {@link TemplateParseUtil#TEMPLATE_LIST} one if there is no id, * example: /prefix if there is no id or /prefix/id if there is an id * @throws IllegalArgumentException if there is not enough information to generate a URL */ @Override public String toString() { return getEntityURL(); }
/** * @return the entity URL of the internal reference based on the * internal viewKey and extension, defaults to {@link TemplateParseUtil#TEMPLATE_SHOW} or * the {@link TemplateParseUtil#TEMPLATE_LIST} one if there is no id, * example: /prefix if there is no id or /prefix/id if there is an id * @throws IllegalArgumentException if there is not enough information to generate a URL */ public String getEntityURL() { String URL = getEntityURL(this.viewKey, this.extension); return URL; }
/** * @return the form view URLs which should be used with the forms */ protected String makeFormViewUrl(String contextUrl, String viewKey, EntityView view) { if (viewKey == null || "".equals(viewKey)) { viewKey = EntityView.VIEW_SHOW; } return contextUrl + BATCH_PREFIX + contextUrl + view.getEntityURL(viewKey, null); }
/** * @return the form view URLs which should be used with the forms */ protected String makeFormViewUrl(String contextUrl, String viewKey, EntityView view) { if (viewKey == null || "".equals(viewKey)) { viewKey = EntityView.VIEW_SHOW; } return contextUrl + BATCH_PREFIX + contextUrl + view.getEntityURL(viewKey, null); }
/** * @param ev entity view * @param viewType the type of view * @return a URL for triggering the entity action (without http://server/direct) */ protected String makeEntityURL(EntityView ev, String viewType) { if (viewType == null) { viewType = EntityView.VIEW_LIST; } if (! EntityView.VIEW_LIST.equals(viewType) && ! EntityView.VIEW_NEW.equals(viewType)) { viewType = EntityView.VIEW_SHOW; } else { viewType = EntityView.VIEW_LIST; } return ev.getEntityURL(viewType, null); }
/** * @param ev entity view * @param viewType the type of view * @return a URL for triggering the entity action (without http://server/direct) */ protected String makeEntityURL(EntityView ev, String viewType) { if (viewType == null) { viewType = EntityView.VIEW_LIST; } if (! EntityView.VIEW_LIST.equals(viewType) && ! EntityView.VIEW_NEW.equals(viewType)) { viewType = EntityView.VIEW_SHOW; } else { viewType = EntityView.VIEW_LIST; } return ev.getEntityURL(viewType, null); }
/** * @param ev the entity view * @param customAction the custom action * @return a URL for triggering the custom action (without http://server/direct) */ protected String makeActionURL(EntityView ev, CustomAction customAction) { // switched to this since it is more correct String URL = EntityView.SEPARATOR + ev.getEntityReference().getPrefix() + EntityView.SEPARATOR + customAction.action; String viewKey = customAction.viewKey; if (viewKey != null && (EntityView.VIEW_SHOW.equals(viewKey) || EntityView.VIEW_EDIT.equals(viewKey) || EntityView.VIEW_DELETE.equals(viewKey))) { URL = ev.getEntityURL(EntityView.VIEW_SHOW, null) + EntityView.SEPARATOR + customAction.action; } return URL; }
/** * @param ev the entity view * @param customAction the custom action * @return a URL for triggering the custom action (without http://server/direct) */ protected String makeActionURL(EntityView ev, CustomAction customAction) { // switched to this since it is more correct String URL = EntityView.SEPARATOR + ev.getEntityReference().getPrefix() + EntityView.SEPARATOR + customAction.action; String viewKey = customAction.viewKey; if (viewKey != null && (EntityView.VIEW_SHOW.equals(viewKey) || EntityView.VIEW_EDIT.equals(viewKey) || EntityView.VIEW_DELETE.equals(viewKey))) { URL = ev.getEntityURL(EntityView.VIEW_SHOW, null) + EntityView.SEPARATOR + customAction.action; } return URL; }
/** * Get all the path segments for the encoded URL for this view<br/> * Example: /user/aaronz/promote/stuff.xml <br/> * segments = {"user","aaronz","promote","stuff"} * @return an array of path segments */ public String[] getPathSegments() { String url = getOriginalEntityUrl(); if (url == null) { url = getEntityURL(); } String[] segments = new String[0]; if (url != null) { url = TemplateParseUtil.findExtension(url)[1]; if (url.charAt(0) == SEPARATOR) { url = url.substring(1); } segments = url.split(SEPARATOR+""); } return segments; }
res.setHeader("x-entity-prefix", prefix); res.setHeader("x-entity-reference", view.getEntityReference().toString()); res.setHeader("x-entity-url", view.getEntityURL()); res.setHeader("x-entity-format", view.getFormat());
res.setHeader("x-entity-prefix", prefix); res.setHeader("x-entity-reference", view.getEntityReference().toString()); res.setHeader("x-entity-url", view.getEntityURL()); res.setHeader("x-entity-format", view.getFormat());
sb.append(" <collectionURL>" + ev.getEntityURL(EntityView.VIEW_LIST, null) + "</collectionURL>\n"); String viewDesc = getEntityDescription(prefix, VIEW_KEY_PREFIX + EntityView.VIEW_LIST, locale); if (viewDesc != null) { sb.append(" <createURL>" + ev.getEntityURL(EntityView.VIEW_NEW, null) + "</createURL>\n"); String viewDesc = getEntityDescription(prefix, VIEW_KEY_PREFIX + EntityView.VIEW_NEW, locale); if (viewDesc != null) { sb.append(" <showURL>" + ev.getEntityURL(EntityView.VIEW_SHOW, null) + "</showURL>\n"); String viewDesc = getEntityDescription(prefix, VIEW_KEY_PREFIX + EntityView.VIEW_SHOW, locale); if (viewDesc != null) { sb.append(" <updateURL>" + ev.getEntityURL(EntityView.VIEW_EDIT, null) + "</updateURL>\n"); String viewDesc = getEntityDescription(prefix, VIEW_KEY_PREFIX + EntityView.VIEW_EDIT, locale); if (viewDesc != null) { sb.append(" <deleteURL>" + ev.getEntityURL(EntityView.VIEW_DELETE, null) + "</deleteURL>\n"); String viewDesc = getEntityDescription(prefix, VIEW_KEY_PREFIX + EntityView.VIEW_DELETE, locale); if (viewDesc != null) {
sb.append(" <collectionURL>" + ev.getEntityURL(EntityView.VIEW_LIST, null) + "</collectionURL>\n"); String viewDesc = getEntityDescription(prefix, VIEW_KEY_PREFIX + EntityView.VIEW_LIST, locale); if (viewDesc != null) { sb.append(" <createURL>" + ev.getEntityURL(EntityView.VIEW_NEW, null) + "</createURL>\n"); String viewDesc = getEntityDescription(prefix, VIEW_KEY_PREFIX + EntityView.VIEW_NEW, locale); if (viewDesc != null) { sb.append(" <showURL>" + ev.getEntityURL(EntityView.VIEW_SHOW, null) + "</showURL>\n"); String viewDesc = getEntityDescription(prefix, VIEW_KEY_PREFIX + EntityView.VIEW_SHOW, locale); if (viewDesc != null) { sb.append(" <updateURL>" + ev.getEntityURL(EntityView.VIEW_EDIT, null) + "</updateURL>\n"); String viewDesc = getEntityDescription(prefix, VIEW_KEY_PREFIX + EntityView.VIEW_EDIT, locale); if (viewDesc != null) { sb.append(" <deleteURL>" + ev.getEntityURL(EntityView.VIEW_DELETE, null) + "</deleteURL>\n"); String viewDesc = getEntityDescription(prefix, VIEW_KEY_PREFIX + EntityView.VIEW_DELETE, locale); if (viewDesc != null) {
&& ! EntityView.VIEW_NEW.equals(viewKey)) { sb.append(" (<a href='" + prefixUrl + view.getEntityURL(EntityView.VIEW_NEW, Formats.FORM) + "'>NEW</a>) ");
&& ! EntityView.VIEW_NEW.equals(viewKey)) { sb.append(" (<a href='" + prefixUrl + view.getEntityURL(EntityView.VIEW_NEW, Formats.FORM) + "'>NEW</a>) ");
String partialURL = view.getEntityURL(); String fullURL = makeFullURL( partialURL ); entityData.setEntityURL( fullURL );
res.setHeader(EntityRequestHandler.HEADER_ENTITY_URL, view.getEntityURL() ); res.setHeader(EntityRequestHandler.HEADER_ENTITY_REFERENCE, view.getEntityReference().toString() ); handled = true;
res.setHeader(EntityRequestHandler.HEADER_ENTITY_URL, view.getEntityURL() ); res.setHeader(EntityRequestHandler.HEADER_ENTITY_REFERENCE, view.getEntityReference().toString() ); handled = true;