@Test public void testGetUrlFromDocumentView() { DocumentIdCodec codec = new DocumentIdCodec(); DocumentLocation docLoc = new DocumentLocationImpl("demo", new IdRef("dbefd5a0-35ee-4ed2-a023-6817714f32cf")); Map<String, String> params = new HashMap<>(); params.put("tabId", "TAB_CONTENT"); DocumentView docView = new DocumentViewImpl(docLoc, "view_documents", params); String url = "nxdoc/demo/dbefd5a0-35ee-4ed2-a023-6817714f32cf/view_documents?tabId=TAB_CONTENT"; assertEquals(url, codec.getUrlFromDocumentView(docView)); }
@Override public String getUrlFromDocumentView(DocumentView docView) { DocumentLocation docLoc = docView.getDocumentLocation(); if (docLoc != null) { List<String> items = new ArrayList<>(); items.add(getPrefix()); items.add(docLoc.getServerName()); IdRef docRef = docLoc.getIdRef(); if (docRef == null) { return null; } items.add(docRef.toString()); String viewId = docView.getViewId(); if (viewId != null) { items.add(viewId); } String uri = String.join("/", items); return URIUtils.addParametersToURIQuery(uri, docView.getParameters()); } return null; }
DocumentIdCodec extends AbstractDocumentViewCodec { @Override public String getUrlFromDocumentView(DocumentView docView) { DocumentLocation docLoc = docView.getDocumentLocation(); if (docLoc != null) { List<String> items = new ArrayList<>(); items.add(getPrefix()); items.add(docLoc.getServerName()); IdRef docRef = docLoc.getIdRef(); if (docRef == null) { return null; } items.add(docRef.toString()); String viewId = docView.getViewId(); if (viewId != null) { items.add(viewId); } String uri = String.join("/", items); return URIUtils.addParametersToURIQuery(uri, docView.getParameters()); } return null; } }
DocumentIdCodec extends AbstractDocumentViewCodec { @Override public String getUrlFromDocumentView(DocumentView docView) { DocumentLocation docLoc = docView.getDocumentLocation(); if (docLoc != null) { List<String> items = new ArrayList<>(); items.add(getPrefix()); items.add(docLoc.getServerName()); IdRef docRef = docLoc.getIdRef(); if (docRef == null) { return null; } items.add(docRef.toString()); String viewId = docView.getViewId(); if (viewId != null) { items.add(viewId); } String uri = String.join("/", items); return URIUtils.addParametersToURIQuery(uri, docView.getParameters()); } return null; } DocumentIdCodec();  DocumentIdCodec(String prefix); }
DocumentIdCodec extends AbstractDocumentViewCodec { @Override public String getUrlFromDocumentView(DocumentView docView) { DocumentLocation docLoc = docView.getDocumentLocation(); if (docLoc != null) { List<String> items = new ArrayList<>(); items.add(getPrefix()); items.add(docLoc.getServerName()); IdRef docRef = docLoc.getIdRef(); if (docRef == null) { return null; } items.add(docRef.toString()); String viewId = docView.getViewId(); if (viewId != null) { items.add(viewId); } String uri = String.join("/", items); return URIUtils.addParametersToURIQuery(uri, docView.getParameters()); } return null; } DocumentIdCodec();  DocumentIdCodec(String prefix); @Override String getPrefix(); @Override String getUrlFromDocumentView(DocumentView docView); @Override DocumentView getDocumentViewFromUrl(String url); }
DocumentIdCodec extends AbstractDocumentViewCodec { @Override public String getUrlFromDocumentView(DocumentView docView) { DocumentLocation docLoc = docView.getDocumentLocation(); if (docLoc != null) { List<String> items = new ArrayList<>(); items.add(getPrefix()); items.add(docLoc.getServerName()); IdRef docRef = docLoc.getIdRef(); if (docRef == null) { return null; } items.add(docRef.toString()); String viewId = docView.getViewId(); if (viewId != null) { items.add(viewId); } String uri = String.join("/", items); return URIUtils.addParametersToURIQuery(uri, docView.getParameters()); } return null; } DocumentIdCodec();  DocumentIdCodec(String prefix); @Override String getPrefix(); @Override String getUrlFromDocumentView(DocumentView docView); @Override DocumentView getDocumentViewFromUrl(String url); static final String PREFIX; static final String URLPattern; }