summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid A. Madore <david+git@madore.org>2014-10-12 19:03:33 (GMT)
committerDavid A. Madore <david+git@madore.org>2014-10-12 19:03:33 (GMT)
commit6c4cab0a9f5dbc019d81eeaeae46c8f17c7bdca7 (patch)
treedc5c645bc34c95feb9fd1b26cb670880e2a72dcf
parentaf3d007e78246144f2f50aaadc05f81bae000f84 (diff)
downloaddamlengine-6c4cab0a9f5dbc019d81eeaeae46c8f17c7bdca7.zip
damlengine-6c4cab0a9f5dbc019d81eeaeae46c8f17c7bdca7.tar.gz
damlengine-6c4cab0a9f5dbc019d81eeaeae46c8f17c7bdca7.tar.bz2
Rename the "do_single_page" database column to "special_name", and update Java variables accordingly.
The SQL command is: ALTER TABLE entries RENAME do_single_page TO special_name ;
-rw-r--r--org/madore/damlengine/Context.java6
-rw-r--r--org/madore/damlengine/TodoCategories.java2
-rw-r--r--org/madore/damlengine/TodoComments.java2
-rw-r--r--org/madore/damlengine/TodoCutHere.java2
-rw-r--r--org/madore/damlengine/TodoEntryElement.java10
-rw-r--r--org/madore/damlengine/TodoWeblogIndexSelectElement.java2
-rw-r--r--org/madore/damlengine/TodoWrefAttr.java4
-rw-r--r--org/madore/damlengine/WeblogLink.java8
-rw-r--r--org/madore/damlengine/WeblogPopulate.java18
-rw-r--r--org/madore/damlengine/WeblogRSS.java6
-rw-r--r--org/madore/damlengine/WeblogServlet.java10
-rw-r--r--org/madore/damlengine/WeblogSummary.java12
-rw-r--r--org/madore/damlengine/weblog-database.sql2
13 files changed, 42 insertions, 42 deletions
diff --git a/org/madore/damlengine/Context.java b/org/madore/damlengine/Context.java
index c1f0dce..70c684a 100644
--- a/org/madore/damlengine/Context.java
+++ b/org/madore/damlengine/Context.java
@@ -82,19 +82,19 @@ public class Context implements Cloneable {
public String date;
public String number;
public String dow;
- public String doSinglePage;
+ public String specialName;
public ArrayList<String> catList;
public Element headerNode;
public Element headlinkNode;
public Element mainDivNode;
public EntryContext(String year, String month, String day,
- String number, String dow, String doSinglePage,
+ String number, String dow, String specialName,
ArrayList<String> catList) {
this.year = year; this.month = month; this.day = day;
this.yandm = year+"-"+month;
this.date = yandm+"-"+day;
this.number = number; this.dow = dow;
- this.doSinglePage = doSinglePage;
+ this.specialName = specialName;
this.catList = catList;
}
}
diff --git a/org/madore/damlengine/TodoCategories.java b/org/madore/damlengine/TodoCategories.java
index 5d1a175..a3bd3ef 100644
--- a/org/madore/damlengine/TodoCategories.java
+++ b/org/madore/damlengine/TodoCategories.java
@@ -42,7 +42,7 @@ public final class TodoCategories extends TodoElement {
for ( String cat : ctx.ent.catList ) {
WeblogLink lk = new WeblogLink(ctx.ent.year, ctx.ent.month,
ctx.ent.day, ctx.ent.number, "",
- ctx.ent.doSinglePage);
+ ctx.ent.specialName);
lk.setTypeCat(cat);
String baseDir = ((ctx.gc.uriToTop==null)?"":(ctx.gc.uriToTop+"weblog/"));
p.appendChild(ctx.doc.createTextNode(" "));
diff --git a/org/madore/damlengine/TodoComments.java b/org/madore/damlengine/TodoComments.java
index 38b5c00..ab8a2e2 100644
--- a/org/madore/damlengine/TodoComments.java
+++ b/org/madore/damlengine/TodoComments.java
@@ -51,7 +51,7 @@ public final class TodoComments extends TodoElement {
final WeblogLink lknc = new WeblogLink(ctx.ent.year, ctx.ent.month,
ctx.ent.day, ctx.ent.number,
".numcomments",
- ctx.ent.doSinglePage);
+ ctx.ent.specialName);
span.setAttributeNS(null, "id", lknc.getFragment());
p.appendChild(span);
span.appendChild(ctx.doc.createComment(" EMPTY "));
diff --git a/org/madore/damlengine/TodoCutHere.java b/org/madore/damlengine/TodoCutHere.java
index f611adf..51935e7 100644
--- a/org/madore/damlengine/TodoCutHere.java
+++ b/org/madore/damlengine/TodoCutHere.java
@@ -28,7 +28,7 @@ public final class TodoCutHere extends TodoDefaultElement {
final WeblogLink lk
= new WeblogLink(ctx.ent.year, ctx.ent.month,
ctx.ent.day, ctx.ent.number,
- ".CUT", ctx.ent.doSinglePage);
+ ".CUT", ctx.ent.specialName);
lk.setTypeSingle();
if ( ctx.wsc == null
|| ctx.wsc instanceof Context.WeblogSingleSelectionContext ) {
diff --git a/org/madore/damlengine/TodoEntryElement.java b/org/madore/damlengine/TodoEntryElement.java
index 7a8c272..fa29ebe 100644
--- a/org/madore/damlengine/TodoEntryElement.java
+++ b/org/madore/damlengine/TodoEntryElement.java
@@ -62,9 +62,9 @@ public final class TodoEntryElement extends TodoDefaultElement {
}
}
final String entryCatStr = node.getAttributeNS(null, "cat");
- final String entryDoSinglePageStr
- = node.hasAttributeNS(null, "single-page")
- ? node.getAttributeNS(null, "single-page") : null;
+ final String entrySpecialNameStr
+ = node.hasAttributeNS(null, "special-name")
+ ? node.getAttributeNS(null, "special-name") : null;
final String entryCdateStr = node.getAttributeNS(null, "cdate");
final ArrayList<String> entryCatList;
if ( entryCatStr.equals("") ) {
@@ -80,7 +80,7 @@ public final class TodoEntryElement extends TodoDefaultElement {
final WeblogLink lk = new WeblogLink(entryYearStr, entryMonthStr,
entryDayStr, entryNumberStr, "",
- entryDoSinglePageStr);
+ entrySpecialNameStr);
lk.setTypeStandard();
String entryIdStr = lk.getFragment();
article.setAttributeNS(null, "id", entryIdStr);
@@ -133,7 +133,7 @@ public final class TodoEntryElement extends TodoDefaultElement {
ctx2.ent
= new Context.EntryContext(entryYearStr, entryMonthStr, entryDayStr,
entryNumberStr, entryDowStr,
- entryDoSinglePageStr,
+ entrySpecialNameStr,
entryCatList);
ctx2.ent.headerNode = header;
ctx2.ent.headlinkNode = headlink;
diff --git a/org/madore/damlengine/TodoWeblogIndexSelectElement.java b/org/madore/damlengine/TodoWeblogIndexSelectElement.java
index 9e1e9bc..cf326d8 100644
--- a/org/madore/damlengine/TodoWeblogIndexSelectElement.java
+++ b/org/madore/damlengine/TodoWeblogIndexSelectElement.java
@@ -59,7 +59,7 @@ public final class TodoWeblogIndexSelectElement extends TodoDefaultElement {
final String yandmStr = yearStr + "-" + monthStr;
final WeblogLink lk = new WeblogLink(yearStr, monthStr, dayStr,
numberStr, "",
- ent.doSinglePage);
+ ent.specialName);
if ( li0 == null || ul == null || ! yandmStr.equals(prevYandm) ) {
li0 = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "li");
ul0.appendChild(li0);
diff --git a/org/madore/damlengine/TodoWrefAttr.java b/org/madore/damlengine/TodoWrefAttr.java
index a2b67ac..9bde003 100644
--- a/org/madore/damlengine/TodoWrefAttr.java
+++ b/org/madore/damlengine/TodoWrefAttr.java
@@ -61,10 +61,10 @@ public class TodoWrefAttr extends TodoAttr {
}
// Prepare link object
final WeblogLink lk;
- if ( esum != null && esum.doSinglePage != null )
+ if ( esum != null && esum.specialName != null )
lk = new WeblogLink(wrefYearStr, wrefMonthStr, wrefDayStr,
wrefNumberStr, wrefSupplementStr,
- esum.doSinglePage);
+ esum.specialName);
else
lk = new WeblogLink(wrefYearStr, wrefMonthStr, wrefDayStr,
wrefNumberStr, wrefSupplementStr);
diff --git a/org/madore/damlengine/WeblogLink.java b/org/madore/damlengine/WeblogLink.java
index 9762e49..ac0b507 100644
--- a/org/madore/damlengine/WeblogLink.java
+++ b/org/madore/damlengine/WeblogLink.java
@@ -9,20 +9,20 @@ public final class WeblogLink {
public String dayStr;
public String numberStr;
public String supplementStr;
- public String singlePage; // May be null
+ public String specialName; // May be null
private Type t = Type.MONTH;
private String cat; // Only defined for type CAT
public WeblogLink(String yearStr, String monthStr, String dayStr,
String numberStr, String supplementStr,
- String singlePage) {
+ String specialName) {
this.yearStr = yearStr;
this.monthStr = monthStr;
this.dayStr = dayStr;
this.numberStr = numberStr;
this.supplementStr = supplementStr;
- this.singlePage = singlePage;
+ this.specialName = specialName;
}
public WeblogLink(String yearStr, String monthStr, String dayStr,
@@ -58,7 +58,7 @@ public final class WeblogLink {
case SINGLE:
return baseDir + "d." + yearStr + "-" + monthStr + "-" + dayStr
+ "." + numberStr
- + (singlePage==null ? "" : "." + singlePage) + ".html";
+ + (specialName==null ? "" : "." + specialName) + ".html";
default:
throw new AssertionError("unknown type");
}
diff --git a/org/madore/damlengine/WeblogPopulate.java b/org/madore/damlengine/WeblogPopulate.java
index bb3af48..7c29b03 100644
--- a/org/madore/damlengine/WeblogPopulate.java
+++ b/org/madore/damlengine/WeblogPopulate.java
@@ -46,13 +46,13 @@ public final class WeblogPopulate {
final PreparedStatement checkSt
= conn.prepareStatement("SELECT sha1 FROM entries WHERE id=?");
final PreparedStatement insertNSt
- = conn.prepareStatement("INSERT INTO entries(id,edate,lang,do_single_page,title,title_xml,content,sha1,has_cut) VALUES (?,?,?,?,?,?::xml,?::xml,?,?)");
+ = conn.prepareStatement("INSERT INTO entries(id,edate,lang,special_name,title,title_xml,content,sha1,has_cut) VALUES (?,?,?,?,?,?::xml,?::xml,?,?)");
final PreparedStatement insertCSt
- = conn.prepareStatement("INSERT INTO entries(id,edate,lang,do_single_page,title,title_xml,content,sha1,has_cut,cdate) VALUES (?,?,?,?,?,?::xml,?::xml,?,?,?::timestamptz)");
+ = conn.prepareStatement("INSERT INTO entries(id,edate,lang,special_name,title,title_xml,content,sha1,has_cut,cdate) VALUES (?,?,?,?,?,?::xml,?::xml,?,?,?::timestamptz)");
final PreparedStatement updateNSt
- = conn.prepareStatement("UPDATE entries SET (edate,mdate,lang,do_single_page,title,title_xml,content,sha1,has_cut)=(?,DEFAULT,?,?,?,?::xml,?::xml,?,?) WHERE id=?");
+ = conn.prepareStatement("UPDATE entries SET (edate,mdate,lang,special_name,title,title_xml,content,sha1,has_cut)=(?,DEFAULT,?,?,?,?::xml,?::xml,?,?) WHERE id=?");
final PreparedStatement updateCSt
- = conn.prepareStatement("UPDATE entries SET (edate,mdate,lang,do_single_page,title,title_xml,content,sha1,has_cut,cdate)=(?,DEFAULT,?,?,?,?::xml,?::xml,?,?,?::timestamptz) WHERE id=?");
+ = conn.prepareStatement("UPDATE entries SET (edate,mdate,lang,special_name,title,title_xml,content,sha1,has_cut,cdate)=(?,DEFAULT,?,?,?,?::xml,?::xml,?,?,?::timestamptz) WHERE id=?");
final PreparedStatement checkDateSt
= conn.prepareStatement("SELECT to_char(cdate,'YYYY-MM-DD\"T\"HH24:MI:SS\"Z\"') FROM entries WHERE id=?");
final PreparedStatement clearCatSt
@@ -86,9 +86,9 @@ public final class WeblogPopulate {
cdate = null;
String catStr = ent.getAttributeNS(null, "cat");
String[] catList = catStr.split("\\s+");
- String doSinglePage = ent.getAttributeNS(null, "single-page");
- if ( doSinglePage.equals("") )
- doSinglePage = null;
+ String specialName = ent.getAttributeNS(null, "special-name");
+ if ( specialName.equals("") )
+ specialName = null;
String lang = LangHelper.getLangRec(ent);
String content = ser.writeToString(ent);
sha1.reset();
@@ -113,7 +113,7 @@ public final class WeblogPopulate {
updateSt = updateCSt;
updateSt.setString(1, date);
updateSt.setString(2, lang);
- updateSt.setString(3, doSinglePage);
+ updateSt.setString(3, specialName);
updateSt.setString(4, titleTxt);
updateSt.setString(5, titleXml);
updateSt.setString(6, content);
@@ -136,7 +136,7 @@ public final class WeblogPopulate {
insertSt.setInt(1, id);
insertSt.setString(2, date);
insertSt.setString(3, lang);
- insertSt.setString(4, doSinglePage);
+ insertSt.setString(4, specialName);
insertSt.setString(5, titleTxt);
insertSt.setString(6, titleXml);
insertSt.setString(7, content);
diff --git a/org/madore/damlengine/WeblogRSS.java b/org/madore/damlengine/WeblogRSS.java
index 85d9fc0..30ff5ca 100644
--- a/org/madore/damlengine/WeblogRSS.java
+++ b/org/madore/damlengine/WeblogRSS.java
@@ -27,7 +27,7 @@ public final class WeblogRSS {
final Connection conn = WeblogDatabaseConnection.getConnection();
final PreparedStatement selSt
- = conn.prepareStatement("SELECT id , edate , to_char(cdate,'YYYY-MM-DD\"T\"HH24:MI:SS\"Z\"') , lang , do_single_page , title , content FROM entries ORDER BY id DESC LIMIT 25");
+ = conn.prepareStatement("SELECT id , edate , to_char(cdate,'YYYY-MM-DD\"T\"HH24:MI:SS\"Z\"') , lang , special_name , title , content FROM entries ORDER BY id DESC LIMIT 25");
final ResultSet selRes = selSt.executeQuery();
@@ -97,7 +97,7 @@ public final class WeblogRSS {
final String date = selRes.getString(2);
final String cdate = selRes.getString(3);
final String lang = selRes.getString(4);
- final String doSinglePage = selRes.getString(5);
+ final String specialName = selRes.getString(5);
final String title = selRes.getString(6);
final String contentXml = selRes.getString(7);
final Matcher matcher = Pattern.compile("^(\\d{4})-(\\d{2})-(\\d{2})$").matcher(date);
@@ -109,7 +109,7 @@ public final class WeblogRSS {
final String numberStr = String.format("%04d",id);
final WeblogLink lk = new WeblogLink(yearStr, monthStr, dayStr,
numberStr, "",
- doSinglePage);
+ specialName);
lk.setTypeStandard();
final String aboutUri = weblogBaseURI + "#" + lk.getFragment();
final String linkUri = lk.getTarget(weblogBaseURI);
diff --git a/org/madore/damlengine/WeblogServlet.java b/org/madore/damlengine/WeblogServlet.java
index 2ceb448..0f7341c 100644
--- a/org/madore/damlengine/WeblogServlet.java
+++ b/org/madore/damlengine/WeblogServlet.java
@@ -34,7 +34,7 @@ import javax.servlet.http.HttpServletResponse;
public class WeblogServlet extends HttpServlet {
- private static final long serialVersionUID = 2014101203L;
+ private static final long serialVersionUID = 2014101204L;
@Override
public void init(ServletConfig cfg)
@@ -79,17 +79,17 @@ public class WeblogServlet extends HttpServlet {
try {
final Connection conn = WeblogDatabaseConnection.getConnection();
final PreparedStatement selSt
- = conn.prepareStatement("SELECT id , extract(epoch from mdate) , do_single_page FROM entries WHERE edate=? AND id=?");
+ = conn.prepareStatement("SELECT id , extract(epoch from mdate) , special_name FROM entries WHERE edate=? AND id=?");
selSt.setString(1,date);
selSt.setInt(2,number);
final ResultSet selRes = selSt.executeQuery();
if ( selRes.next() ) {
int id = selRes.getInt(1);
double mdate = selRes.getDouble(2);
- String doSinglePage = selRes.getString(3);
+ String specialName = selRes.getString(3);
if ( id != number )
throw new ServletException("this cannot happen");
- if ( extra != null && ! extra.equals(doSinglePage) )
+ if ( extra != null && ! extra.equals(specialName) )
return new NoSuchPath();
long lastModified = (long)(mdate*1000);
long thisLastModified;
@@ -120,7 +120,7 @@ public class WeblogServlet extends HttpServlet {
try {
final Connection conn = WeblogDatabaseConnection.getConnection();
final PreparedStatement selSt
- = conn.prepareStatement("SELECT id FROM entries WHERE edate=? AND do_single_page=?");
+ = conn.prepareStatement("SELECT id FROM entries WHERE edate=? AND special_name=?");
selSt.setString(1,date);
selSt.setString(2,extra);
final ResultSet selRes = selSt.executeQuery();
diff --git a/org/madore/damlengine/WeblogSummary.java b/org/madore/damlengine/WeblogSummary.java
index 662c1d2..6c2dc4c 100644
--- a/org/madore/damlengine/WeblogSummary.java
+++ b/org/madore/damlengine/WeblogSummary.java
@@ -14,18 +14,18 @@ public final class WeblogSummary {
String date;
String lang;
String title; String titleXml;
- String doSinglePage;
+ String specialName;
boolean hasCut;
HashSet<String> catSet;
public EntrySummary(int id, String date, String lang,
String title, String titleXml,
- String doSinglePage, boolean hasCut) {
+ String specialName, boolean hasCut) {
this.id = id;
this.date = date;
this.lang = lang;
this.title = title;
this.titleXml = titleXml;
- this.doSinglePage = doSinglePage;
+ this.specialName = specialName;
this.hasCut = hasCut;
this.catSet = null;
}
@@ -51,7 +51,7 @@ public final class WeblogSummary {
singleton.obtainedTime = System.currentTimeMillis();
final Connection conn = WeblogDatabaseConnection.getConnection();
final PreparedStatement selSt
- = conn.prepareStatement("SELECT id , edate , lang , title , title_xml , do_single_page , has_cut FROM entries");
+ = conn.prepareStatement("SELECT id , edate , lang , title , title_xml , special_name , has_cut FROM entries");
final ResultSet selRes = selSt.executeQuery();
while ( selRes.next() ) {
int id = selRes.getInt(1);
@@ -59,9 +59,9 @@ public final class WeblogSummary {
String lang = selRes.getString(3);
String title = selRes.getString(4);
String titleXml = selRes.getString(5);
- String doSinglePage = selRes.getString(6);
+ String specialName = selRes.getString(6);
boolean hasCut = selRes.getBoolean(7);
- singleton.entries.put(id, new EntrySummary(id, date, lang, title, titleXml, doSinglePage, hasCut));
+ singleton.entries.put(id, new EntrySummary(id, date, lang, title, titleXml, specialName, hasCut));
}
final PreparedStatement catSt
= conn.prepareStatement("SELECT id , code FROM incat");
diff --git a/org/madore/damlengine/weblog-database.sql b/org/madore/damlengine/weblog-database.sql
index f5ec56d..7fbb7d7 100644
--- a/org/madore/damlengine/weblog-database.sql
+++ b/org/madore/damlengine/weblog-database.sql
@@ -9,7 +9,7 @@ CREATE TABLE entries (
title_xml xml ,
content xml NOT NULL ,
sha1 text NOT NULL ,
- do_single_page text ,
+ special_name text ,
has_cut boolean NOT NULL DEFAULT FALSE
) ;
CREATE INDEX entries_edate_key ON entries ( edate ) ;