setEntityReference(ref); this.pathSegments = new HashMap<String, String>(); this.pathSegments.put(PREFIX, ref.getPrefix());
/** * Reduce code duplication and ensure custom templates are used */ public EntityView makeEntityView(EntityReference ref, String viewKey, String extension) { if (ref == null) { throw new IllegalArgumentException("ref cannot be null"); } EntityView view = new EntityView(); EntityViewUrlCustomizable custom = (EntityViewUrlCustomizable) entityProviderManager .getProviderByPrefixAndCapability(ref.getPrefix(), EntityViewUrlCustomizable.class); if (custom != null) { // use the custom parsing templates view.loadParseTemplates( custom.getParseTemplates() ); } view.setEntityReference(ref); if (viewKey != null) { view.setViewKey(viewKey); } if (extension != null) { view.setExtension(extension); } return view; }
ev.setEntityReference( ref ); if (viewKey != null && ! "".equals(viewKey)) {
view.setEntityReference( new EntityReference(prefix, entityData.getEntityId()) );
ev.setEntityReference( ref ); if (viewKey != null && ! "".equals(viewKey)) {
view.setEntityReference( new EntityReference(prefix, entityData.getEntityId()) );
/** * 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; }
views.put(ref.getPrefix(), view); view.setEntityReference(ref); String partialURL = view.getEntityURL(); String fullURL = makeFullURL( partialURL );
view.setEntityReference( new EntityReference(prefix, "") ); EntityData ed = entities.get(0); ref = new EntityReference(ed.getEntityRef().getPrefix(), ""); view.setEntityReference( ref ); view.setViewKey(EntityView.VIEW_LIST); ref = new EntityReference(ref.getPrefix(), customAction.action); view.setEntityReference( ref ); view.setViewKey(EntityView.VIEW_SHOW); throw new IllegalStateException("Could not get the createdId from the newly created entity for ("+view+"), please ensure the provider is returning a non-null and non-empty value from the create method, if the item was not created then an exception should have been thrown"); view.setEntityReference( new EntityReference(prefix, createdId) ); // update the entity view res.setHeader(EntityRequestHandler.HEADER_ENTITY_ID, createdId); res.setStatus(HttpServletResponse.SC_CREATED);
view.setEntityReference( new EntityReference(prefix, "") ); EntityData ed = entities.get(0); ref = new EntityReference(ed.getEntityRef().getPrefix(), ""); view.setEntityReference( ref ); view.setViewKey(EntityView.VIEW_LIST); ref = new EntityReference(ref.getPrefix(), customAction.action); view.setEntityReference( ref ); view.setViewKey(EntityView.VIEW_SHOW); throw new IllegalStateException("Could not get the createdId from the newly created entity for ("+view+"), please ensure the provider is returning a non-null and non-empty value from the create method, if the item was not created then an exception should have been thrown"); view.setEntityReference( new EntityReference(prefix, createdId) ); // update the entity view res.setHeader(EntityRequestHandler.HEADER_ENTITY_ID, createdId); res.setStatus(HttpServletResponse.SC_CREATED);