public static StringBuffer generateFileRevisionsRequest( StringBuffer buffer, long startRevision, long endRevision, String path) { buffer = buffer == null ? new StringBuffer() : buffer; buffer.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>"); buffer.append("<S:file-revs-report xmlns:S=\"svn:\">"); if (startRevision >= 0) { buffer.append("<S:start-revision>" + startRevision + "</S:start-revision>"); } if (endRevision >= 0) { buffer.append("<S:end-revision>" + endRevision + "</S:end-revision>"); } buffer.append("<S:path>" + SVNEncodingUtil.xmlEncodeCDATA(path) + "</S:path>"); buffer.append("</S:file-revs-report>"); return buffer; }
public static DAVLock convertSVNLockToDAVLock(FSLock lock, boolean hideAuthUser, boolean exists) { String authUser = null; StringBuffer owner = null; if (lock.getComment() != null) { owner = new StringBuffer(); if (!lock.isDAVComment()) { List namespaces = new ArrayList(1); namespaces.add(DAVElement.DAV_NAMESPACE); owner = DAVXMLUtil.openNamespaceDeclarationTag( SVNXMLUtil.DAV_NAMESPACE_PREFIX, DAVElement.LOCK_OWNER.getName(), namespaces, null, owner, false, false); owner.append(SVNEncodingUtil.xmlEncodeCDATA(lock.getComment(), true)); owner = SVNXMLUtil.addXMLFooter( SVNXMLUtil.DAV_NAMESPACE_PREFIX, DAVElement.LOCK_OWNER.getName(), owner); } else { owner.append(lock.getComment()); } } if (!hideAuthUser) { authUser = lock.getOwner(); } return new DAVLock( authUser, DAVDepth.DEPTH_ZERO, exists, lock.getID(), owner != null ? owner.toString() : null, DAVLockRecType.DIRECT, DAVLockScope.EXCLUSIVE, DAVLockType.WRITE, lock.getExpirationDate()); }