Welcome to mirror list, hosted at ThFree Co, Russian Federation.

NoteLinksUtils.java « util « shared « notes « owncloud « niedermann « it « java « main « src « app - github.com/stefan-niedermann/nextcloud-notes.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 668d2746a159e60f92560c7fb47619943627fd3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package it.niedermann.owncloud.notes.shared.util;

import it.niedermann.owncloud.notes.shared.util.text.NoteLinksProcessor;

public class NoteLinksUtils {

    /**
     * Tests if the given link is a note-link (which was transformed in {@link it.niedermann.owncloud.notes.shared.util.text.NoteLinksProcessor}) or not
     *
     * @param link Link under test
     * @return true if the link is a note-link
     */
    public static boolean isNoteLink(String link) {
        return link.startsWith(NoteLinksProcessor.RELATIVE_LINK_WORKAROUND_PREFIX);
    }

    /**
     * Extracts the remoteId back from links that were transformed in {@link it.niedermann.owncloud.notes.shared.util.text.NoteLinksProcessor}.
     *
     * @param link Link that was transformed in {@link it.niedermann.owncloud.notes.shared.util.text.NoteLinksProcessor}
     * @return the remoteId of the linked note
     */
    public static long extractNoteRemoteId(String link) {
        return Long.parseLong(link.replace(NoteLinksProcessor.RELATIVE_LINK_WORKAROUND_PREFIX, ""));
    }
}