setExtension(extension);
ev.setExtension(format);
/** * 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; }
/** * 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; }
view.setExtension( RequestUtils.findAndHandleFormat(req, res, Formats.JSON) ); entityBatchHandler.handleBatch(view, req, res); } else { view.setExtension( format );
view.setExtension( RequestUtils.findAndHandleFormat(req, res, Formats.JSON) ); entityBatchHandler.handleBatch(view, req, res); } else { view.setExtension( format );