/** * Returns the numeric page id of the revised page. For any given MediaWiki * site, pages are uniquely identified by their page id. MediaWiki will try * to preserve the page id even across title changes (moves). * * @return integer page id */ @Override public int getPageId() { return raw.getLocalId(); }
/** * Returns the numeric id of the current revision. For any given MediaWiki * site, revisions are uniquely identified by their revision id. In * particular, two distinct revisions can never have the same id, even if * they belong to different pages. * * @return long revision id */ @Override public long getRevisionId() { return raw.getRevisionId(); }
private LocalLink cloneLinkWithLocation(LocalLink ll, int location) { return new LocalLink( ll.getLanguage(), ll.getAnchorText(), ll.getSourceId(), ll.getDestId(), ll.isOutlink(), location, ll.isParseable(), ll.getLocType() ); }
@Override public void save(LocalPage page) throws DaoException { insert( page.getLanguage().getId(), page.getLocalId(), page.getTitle().getCanonicalTitle(), page.getNameSpace().getArbitraryId(), page.isRedirect(), page.isDisambig() ); }
/** * TODO: make multi lingual * @param lp * @return */ private boolean isList(LocalPage lp) { return lp.getTitle().getCanonicalTitle().toLowerCase().startsWith("list"); }
/** * * @return A Title: the title of this page */ public Title getTitle(Language lang){ return new Title(title, lang); } /**
@Override public boolean equals(Object o) { if (o instanceof UniversalPage) { UniversalPage other = (UniversalPage) o; return (this.getUnivId() == other.getUnivId() && this.getAlgorithmId() == other.getAlgorithmId()); } else { return false; } }
/** * Returns a plain text output of the body of this RawPage * @return */ public String getPlainText() { return getPlainText(false); } /**
/** * Gets the part of the title after the first colon. If there is no * colon, returns the whole title. * @return */ public String getTitleStringWithoutNamespace(){ return getTitleStringWithoutNamespace(canonicalTitle); }
@Override public int compare(LocalLink o1, LocalLink o2) { return o1.getLocation() - o2.getLocation(); } });
public LocalPage asLocalPage(){ return new LocalPage( language, id, null, null ); }
/** * Gets the "Category:" or equivalent * @return */ public String getNamespaceString(){ return getNamespaceString(this.canonicalTitle); }
/** * Returns a namespace based on the arbitrary ID determined by the getArbitraryId method * You probably don't want to use this. Use getNameSpaceByValue instead. * * @param id the arbitrary ID of the namespace * @return the namespace */ public static NameSpace getNameSpaceByArbitraryId(int id) { return NameSpace.values()[id]; }
/** * * @param wpId * @return */ public int[] getCategoryPages(int wpId) { int parentIndex = catIdToIndex(wpId); if (parentIndex < 0) { return new int[0]; } return catPages[parentIndex]; }
/** * Returns a short ID for the NameSpace. * The ID is determined arbitrarily by this Enum, and should not be referenced to * anything else. It is unrelated to NameSpace.getValue(). * @return */ public short getArbitraryId() { return (short) ordinal(); }
/** * Creates a new page in the main namespace that is NOT a redirect or disambig. * @param language * @param localId * @param title */ public LocalPage(Language language, int localId, String title) { this(language, localId, new Title(title, language), NameSpace.ARTICLE); }
/** * Returns the numeric page id of the revised page. For any given MediaWiki * site, pages are uniquely identified by their page id. MediaWiki will try * to preserve the page id even across title changes (moves). * * @return integer page id */ @Override public int getPageId() { return raw.getLocalId(); }
@Override public int compare(LocalLink l1, LocalLink l2) { return l1.getLocation() - l2.getLocation(); } });
/** * Returns the numeric id of the current revision. For any given MediaWiki * site, revisions are uniquely identified by their revision id. In * particular, two distinct revisions can never have the same id, even if * they belong to different pages. * * @return long revision id */ @Override public long getRevisionId() { return raw.getRevisionId(); }