/** * @param value string * @return URL */ private String replaceURL(final String value) { if (value == null) { return null; } else if (target == null || FileUtils.isAbsolutePath(value) || value.contains(COLON_DOUBLE_SLASH) || value.startsWith(SHARP)) { return value; } else { final String source = FileUtils.resolve(fileDir, target).getPath(); final String urltarget = FileUtils.resolveTopic(fileDir, value); return FileUtils.getRelativeUnixPath(source, urltarget); } }
/** * @param target target * @param pushcontent content * @param type push type */ private void addtoPushTable(URI target, final DocumentFragment pushcontent, final String type) { if (target.getFragment() == null) { // if there is no '#' in target string, report error logger.error(MessageUtils.getInstance().getMessage("DOTJ041E", target.toString()).toString()); return; } if (target.getPath().isEmpty()) { // means conref the file itself target = toURI(parsefilename.getPath() + target); } final File key = toFile(FileUtils.resolve(fileDir, target)); Hashtable<MoveKey, DocumentFragment> table = null; if (pushtable.containsKey(key)) { // if there is something else push to the same file table = pushtable.get(key); } else { // if there is nothing else push to the same file table = new Hashtable<>(); pushtable.put(key, table); } final MoveKey moveKey = new MoveKey(SHARP + target.getFragment(), type); if (table.containsKey(moveKey)) { // if there is something else push to the same target // append content if type is 'pushbefore' or 'pushafter' // report error if type is 'replace' if (ATTR_CONACTION_VALUE_PUSHREPLACE.equals(type)) { logger.error( MessageUtils.getInstance().getMessage("DOTJ042E", target.toString()).toString()); } else { table.put(moveKey, appendPushContent(pushcontent, table.get(moveKey))); } } else { // if there is nothing else push to the same target table.put(moveKey, appendPushContent(pushcontent, null)); } }