sorted methods alphabetically
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -137,30 +137,6 @@ public class Database {
|
||||
if (!sortFields.isEmpty()) sql.append(" ORDER BY ").append(String.join(", ",sortFields));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Request clone() {
|
||||
Request clone = new Request(new StringBuilder(sql));
|
||||
clone.where.putAll(where);
|
||||
clone.values.putAll(values);
|
||||
return clone;
|
||||
}
|
||||
|
||||
/**
|
||||
* finalize sql, save sql and arguments as compiled request
|
||||
* @return
|
||||
*/
|
||||
public CompiledRequest compile(Object ...additionalArgs){
|
||||
var args = new ArrayList<>();
|
||||
applyValues(args);
|
||||
applyConditions(args);
|
||||
applyGrouping();
|
||||
applySorting();
|
||||
if (additionalArgs != null) {
|
||||
for (Object arg : additionalArgs) args.add(arg);
|
||||
}
|
||||
return new CompiledRequest(sql.toString(),args);
|
||||
}
|
||||
|
||||
/**
|
||||
* apply values (for insert or update statements)
|
||||
* @param args
|
||||
@@ -193,6 +169,30 @@ public class Database {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Request clone() {
|
||||
Request clone = new Request(new StringBuilder(sql));
|
||||
clone.where.putAll(where);
|
||||
clone.values.putAll(values);
|
||||
return clone;
|
||||
}
|
||||
|
||||
/**
|
||||
* finalize sql, save sql and arguments as compiled request
|
||||
* @return
|
||||
*/
|
||||
public CompiledRequest compile(Object ...additionalArgs){
|
||||
var args = new ArrayList<>();
|
||||
applyValues(args);
|
||||
applyConditions(args);
|
||||
applyGrouping();
|
||||
applySorting();
|
||||
if (additionalArgs != null) {
|
||||
for (Object arg : additionalArgs) args.add(arg);
|
||||
}
|
||||
return new CompiledRequest(sql.toString(),args);
|
||||
}
|
||||
|
||||
public Request groupBy(String column) {
|
||||
groupBy = column;
|
||||
return this;
|
||||
|
||||
@@ -112,20 +112,6 @@ public class ListMember {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void sendConfirmationMail(ST template) throws SQLException, MessagingException {
|
||||
var subject = t("[{}] Subscription complete!",list.name());
|
||||
var data = new HashMap<String,Object>();
|
||||
data.put(USER,user.safeMap());
|
||||
data.put(LIST,list.minimalMap());
|
||||
data.put(URL,Configuration.instance().baseUrl()+"/web/index");
|
||||
if (list.isOpenForSubscribers()) data.put("open_list",true);
|
||||
var text = template.add("data",data).render();
|
||||
try {
|
||||
list.smtp().send(list.email(),list.name(),user.email(),subject,text);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
LOG.warn("Failed to send list subscription confirmation!",e);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Create a new list member entry in the database.
|
||||
* If the member has the state AWAITING_CONFIRMATION, a token is assigned with the member, too.
|
||||
@@ -374,6 +360,21 @@ public class ListMember {
|
||||
return this;
|
||||
}
|
||||
|
||||
public void sendConfirmationMail(ST template) throws SQLException, MessagingException {
|
||||
var subject = t("[{}] Subscription complete!",list.name());
|
||||
var data = new HashMap<String,Object>();
|
||||
data.put(USER,user.safeMap());
|
||||
data.put(LIST,list.minimalMap());
|
||||
data.put(URL,Configuration.instance().baseUrl()+"/web/index");
|
||||
if (list.isOpenForSubscribers()) data.put("open_list",true);
|
||||
var text = template.add("data",data).render();
|
||||
try {
|
||||
list.smtp().send(list.email(),list.name(),user.email(),subject,text);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
LOG.warn("Failed to send list subscription confirmation!",e);
|
||||
}
|
||||
}
|
||||
|
||||
public ListMember setState(int newState) throws SQLException {
|
||||
Database.open()
|
||||
.update(TABLE_NAME)
|
||||
|
||||
Reference in New Issue
Block a user