forked from Archives/Athou_commafeed
added mailing class
This commit is contained in:
@@ -11,7 +11,6 @@ import javax.inject.Inject;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import com.commafeed.backend.dao.ApplicationSettingsDAO;
|
|
||||||
import com.commafeed.backend.dao.FeedCategoryDAO;
|
import com.commafeed.backend.dao.FeedCategoryDAO;
|
||||||
import com.commafeed.backend.dao.FeedDAO;
|
import com.commafeed.backend.dao.FeedDAO;
|
||||||
import com.commafeed.backend.dao.FeedSubscriptionDAO;
|
import com.commafeed.backend.dao.FeedSubscriptionDAO;
|
||||||
@@ -23,6 +22,7 @@ import com.commafeed.backend.model.FeedCategory;
|
|||||||
import com.commafeed.backend.model.FeedSubscription;
|
import com.commafeed.backend.model.FeedSubscription;
|
||||||
import com.commafeed.backend.model.User;
|
import com.commafeed.backend.model.User;
|
||||||
import com.commafeed.backend.model.UserRole.Role;
|
import com.commafeed.backend.model.UserRole.Role;
|
||||||
|
import com.commafeed.backend.services.ApplicationSettingsService;
|
||||||
import com.commafeed.backend.services.UserService;
|
import com.commafeed.backend.services.UserService;
|
||||||
|
|
||||||
@Startup
|
@Startup
|
||||||
@@ -48,7 +48,7 @@ public class StartupBean {
|
|||||||
UserService userService;
|
UserService userService;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
ApplicationSettingsDAO applicationSettingsDAO;
|
ApplicationSettingsService applicationSettingsService;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
FeedRefreshWorker worker;
|
FeedRefreshWorker worker;
|
||||||
@@ -62,7 +62,7 @@ public class StartupBean {
|
|||||||
initialData();
|
initialData();
|
||||||
}
|
}
|
||||||
|
|
||||||
ApplicationSettings settings = applicationSettingsDAO.get();
|
ApplicationSettings settings = applicationSettingsService.get();
|
||||||
for (int i = 0; i < settings.getBackgroundThreads(); i++) {
|
for (int i = 0; i < settings.getBackgroundThreads(); i++) {
|
||||||
worker.start();
|
worker.start();
|
||||||
}
|
}
|
||||||
@@ -72,7 +72,7 @@ public class StartupBean {
|
|||||||
private void initialData() {
|
private void initialData() {
|
||||||
log.info("Populating database with default values");
|
log.info("Populating database with default values");
|
||||||
|
|
||||||
applicationSettingsDAO.save(new ApplicationSettings());
|
applicationSettingsService.save(new ApplicationSettings());
|
||||||
|
|
||||||
User user = userService.register(ADMIN_NAME, "admin",
|
User user = userService.register(ADMIN_NAME, "admin",
|
||||||
Arrays.asList(Role.ADMIN, Role.USER));
|
Arrays.asList(Role.ADMIN, Role.USER));
|
||||||
|
|||||||
@@ -1,34 +1,11 @@
|
|||||||
package com.commafeed.backend.dao;
|
package com.commafeed.backend.dao;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.ejb.Stateless;
|
import javax.ejb.Stateless;
|
||||||
import javax.persistence.EntityManager;
|
|
||||||
import javax.persistence.PersistenceContext;
|
|
||||||
|
|
||||||
import com.commafeed.backend.model.ApplicationSettings;
|
import com.commafeed.backend.model.ApplicationSettings;
|
||||||
import com.google.common.collect.Iterables;
|
|
||||||
import com.uaihebert.factory.EasyCriteriaFactory;
|
|
||||||
import com.uaihebert.model.EasyCriteria;
|
|
||||||
|
|
||||||
|
@SuppressWarnings("serial")
|
||||||
@Stateless
|
@Stateless
|
||||||
public class ApplicationSettingsDAO {
|
public class ApplicationSettingsDAO extends GenericDAO<ApplicationSettings> {
|
||||||
|
|
||||||
@PersistenceContext
|
|
||||||
protected EntityManager em;
|
|
||||||
|
|
||||||
public void save(ApplicationSettings settings) {
|
|
||||||
if (settings.getId() == null) {
|
|
||||||
em.persist(settings);
|
|
||||||
} else {
|
|
||||||
em.merge(settings);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ApplicationSettings get() {
|
|
||||||
EasyCriteria<ApplicationSettings> criteria = EasyCriteriaFactory
|
|
||||||
.createQueryCriteria(em, ApplicationSettings.class);
|
|
||||||
List<ApplicationSettings> list = criteria.getResultList();
|
|
||||||
return Iterables.getFirst(list, null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,12 @@ public class ApplicationSettings extends AbstractModel {
|
|||||||
private String googleClientSecret;
|
private String googleClientSecret;
|
||||||
private int backgroundThreads = 3;
|
private int backgroundThreads = 3;
|
||||||
|
|
||||||
|
private String smtpHost;
|
||||||
|
private int smtpPort;
|
||||||
|
private boolean smtpTls;
|
||||||
|
private String smtpUserName;
|
||||||
|
private String smtpPassword;
|
||||||
|
|
||||||
public String getPublicUrl() {
|
public String getPublicUrl() {
|
||||||
return publicUrl;
|
return publicUrl;
|
||||||
}
|
}
|
||||||
@@ -54,4 +60,44 @@ public class ApplicationSettings extends AbstractModel {
|
|||||||
this.backgroundThreads = backgroundThreads;
|
this.backgroundThreads = backgroundThreads;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getSmtpHost() {
|
||||||
|
return smtpHost;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSmtpHost(String smtpHost) {
|
||||||
|
this.smtpHost = smtpHost;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSmtpPort() {
|
||||||
|
return smtpPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSmtpPort(int smtpPort) {
|
||||||
|
this.smtpPort = smtpPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSmtpTls() {
|
||||||
|
return smtpTls;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSmtpTls(boolean smtpTls) {
|
||||||
|
this.smtpTls = smtpTls;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSmtpUserName() {
|
||||||
|
return smtpUserName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSmtpUserName(String smtpUserName) {
|
||||||
|
this.smtpUserName = smtpUserName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSmtpPassword() {
|
||||||
|
return smtpPassword;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSmtpPassword(String smtpPassword) {
|
||||||
|
this.smtpPassword = smtpPassword;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.commafeed.backend.services;
|
||||||
|
|
||||||
|
import javax.ejb.Stateless;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import com.commafeed.backend.dao.ApplicationSettingsDAO;
|
||||||
|
import com.commafeed.backend.model.ApplicationSettings;
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
|
|
||||||
|
@Stateless
|
||||||
|
public class ApplicationSettingsService {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
ApplicationSettingsDAO applicationSettingsDAO;
|
||||||
|
|
||||||
|
public void save(ApplicationSettings settings) {
|
||||||
|
applicationSettingsDAO.saveOrUpdate(settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApplicationSettings get() {
|
||||||
|
return Iterables.getFirst(applicationSettingsDAO.findAll(), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package com.commafeed.backend.services;
|
||||||
|
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.mail.Message;
|
||||||
|
import javax.mail.PasswordAuthentication;
|
||||||
|
import javax.mail.Session;
|
||||||
|
import javax.mail.Transport;
|
||||||
|
import javax.mail.internet.InternetAddress;
|
||||||
|
import javax.mail.internet.MimeMessage;
|
||||||
|
|
||||||
|
import com.commafeed.backend.model.ApplicationSettings;
|
||||||
|
import com.commafeed.backend.model.User;
|
||||||
|
|
||||||
|
public class MailService {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
ApplicationSettingsService applicationSettingsService;
|
||||||
|
|
||||||
|
public void sendMail(User user, String subject, String content) throws Exception {
|
||||||
|
|
||||||
|
ApplicationSettings settings = applicationSettingsService.get();
|
||||||
|
|
||||||
|
final String username = settings.getSmtpUserName();
|
||||||
|
final String password = settings.getSmtpPassword();
|
||||||
|
|
||||||
|
String dest = user.getEmail();
|
||||||
|
|
||||||
|
Properties props = new Properties();
|
||||||
|
props.put("mail.smtp.auth", "true");
|
||||||
|
props.put("mail.smtp.starttls.enable", settings.isSmtpTls());
|
||||||
|
props.put("mail.smtp.host", settings.getSmtpHost());
|
||||||
|
props.put("mail.smtp.port", settings.getSmtpPort());
|
||||||
|
|
||||||
|
Session session = Session.getInstance(props,
|
||||||
|
new javax.mail.Authenticator() {
|
||||||
|
protected PasswordAuthentication getPasswordAuthentication() {
|
||||||
|
return new PasswordAuthentication(username, password);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Message message = new MimeMessage(session);
|
||||||
|
message.setFrom(new InternetAddress(username, "CommaFeed"));
|
||||||
|
message.setRecipients(Message.RecipientType.TO,
|
||||||
|
InternetAddress.parse(dest));
|
||||||
|
message.setSubject("CommaFeed - " + subject);
|
||||||
|
message.setText(content);
|
||||||
|
|
||||||
|
Transport.send(message);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,10 +10,10 @@ import org.apache.wicket.request.UrlRenderer;
|
|||||||
import org.apache.wicket.request.cycle.RequestCycle;
|
import org.apache.wicket.request.cycle.RequestCycle;
|
||||||
import org.apache.wicket.request.mapper.parameter.PageParameters;
|
import org.apache.wicket.request.mapper.parameter.PageParameters;
|
||||||
|
|
||||||
import com.commafeed.backend.dao.ApplicationSettingsDAO;
|
|
||||||
import com.commafeed.backend.dao.UserDAO;
|
import com.commafeed.backend.dao.UserDAO;
|
||||||
import com.commafeed.backend.feeds.OPMLImporter;
|
import com.commafeed.backend.feeds.OPMLImporter;
|
||||||
import com.commafeed.backend.model.ApplicationSettings;
|
import com.commafeed.backend.model.ApplicationSettings;
|
||||||
|
import com.commafeed.backend.services.ApplicationSettingsService;
|
||||||
import com.commafeed.frontend.utils.WicketUtils;
|
import com.commafeed.frontend.utils.WicketUtils;
|
||||||
import com.commafeed.frontend.utils.exception.DisplayException;
|
import com.commafeed.frontend.utils.exception.DisplayException;
|
||||||
import com.google.api.client.auth.oauth2.AuthorizationCodeResponseUrl;
|
import com.google.api.client.auth.oauth2.AuthorizationCodeResponseUrl;
|
||||||
@@ -33,7 +33,7 @@ public class GoogleImportCallbackPage extends WebPage {
|
|||||||
private static final String EXPORT_URL = "https://www.google.com/reader/subscriptions/export";
|
private static final String EXPORT_URL = "https://www.google.com/reader/subscriptions/export";
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
ApplicationSettingsDAO applicationSettingsDAO;
|
ApplicationSettingsService applicationSettingsService;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
OPMLImporter importer;
|
OPMLImporter importer;
|
||||||
@@ -65,7 +65,7 @@ public class GoogleImportCallbackPage extends WebPage {
|
|||||||
} else if (code == null) {
|
} else if (code == null) {
|
||||||
throw new DisplayException("Missing authorization code");
|
throw new DisplayException("Missing authorization code");
|
||||||
} else {
|
} else {
|
||||||
ApplicationSettings settings = applicationSettingsDAO.get();
|
ApplicationSettings settings = applicationSettingsService.get();
|
||||||
String redirectUri = getCallbackUrl();
|
String redirectUri = getCallbackUrl();
|
||||||
String clientId = settings.getGoogleClientId();
|
String clientId = settings.getGoogleClientId();
|
||||||
String clientSecret = settings.getGoogleClientSecret();
|
String clientSecret = settings.getGoogleClientSecret();
|
||||||
@@ -90,8 +90,7 @@ public class GoogleImportCallbackPage extends WebPage {
|
|||||||
httpRequest, accessToken);
|
httpRequest, accessToken);
|
||||||
String opml = httpRequest.execute().parseAsString();
|
String opml = httpRequest.execute().parseAsString();
|
||||||
String state = responseUrl.getState();
|
String state = responseUrl.getState();
|
||||||
importer.importOpml(userDAO.findById(Long.valueOf(state)),
|
importer.importOpml(userDAO.findById(Long.valueOf(state)), opml);
|
||||||
opml);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new DisplayException(e);
|
throw new DisplayException(e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ import org.apache.wicket.markup.html.WebPage;
|
|||||||
import org.apache.wicket.request.flow.RedirectToUrlException;
|
import org.apache.wicket.request.flow.RedirectToUrlException;
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
|
|
||||||
import com.commafeed.backend.dao.ApplicationSettingsDAO;
|
|
||||||
import com.commafeed.backend.model.ApplicationSettings;
|
import com.commafeed.backend.model.ApplicationSettings;
|
||||||
|
import com.commafeed.backend.services.ApplicationSettingsService;
|
||||||
import com.commafeed.frontend.CommaFeedSession;
|
import com.commafeed.frontend.CommaFeedSession;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
@@ -23,11 +23,11 @@ public class GoogleImportRedirectPage extends WebPage {
|
|||||||
private static final String AUTH_URL = "https://accounts.google.com/o/oauth2/auth";
|
private static final String AUTH_URL = "https://accounts.google.com/o/oauth2/auth";
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
ApplicationSettingsDAO applicationSettingsDAO;
|
ApplicationSettingsService applicationSettingsService;
|
||||||
|
|
||||||
public GoogleImportRedirectPage() {
|
public GoogleImportRedirectPage() {
|
||||||
|
|
||||||
ApplicationSettings settings = applicationSettingsDAO.get();
|
ApplicationSettings settings = applicationSettingsService.get();
|
||||||
|
|
||||||
String clientId = settings.getGoogleClientId();
|
String clientId = settings.getGoogleClientId();
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import javax.inject.Inject;
|
|||||||
import org.apache.wicket.markup.head.IHeaderResponse;
|
import org.apache.wicket.markup.head.IHeaderResponse;
|
||||||
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
|
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
|
||||||
|
|
||||||
import com.commafeed.backend.dao.ApplicationSettingsDAO;
|
import com.commafeed.backend.services.ApplicationSettingsService;
|
||||||
import com.commafeed.frontend.pages.components.LoginPanel;
|
import com.commafeed.frontend.pages.components.LoginPanel;
|
||||||
import com.commafeed.frontend.pages.components.RegisterPanel;
|
import com.commafeed.frontend.pages.components.RegisterPanel;
|
||||||
import com.commafeed.frontend.utils.WicketUtils;
|
import com.commafeed.frontend.utils.WicketUtils;
|
||||||
@@ -14,7 +14,7 @@ import com.commafeed.frontend.utils.WicketUtils;
|
|||||||
public class WelcomePage extends BasePage {
|
public class WelcomePage extends BasePage {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
ApplicationSettingsDAO applicationSettingsDAO;
|
ApplicationSettingsService applicationSettingsService;
|
||||||
|
|
||||||
public WelcomePage() {
|
public WelcomePage() {
|
||||||
add(new BookmarkablePageLink<Void>("logo-link", getApplication()
|
add(new BookmarkablePageLink<Void>("logo-link", getApplication()
|
||||||
@@ -24,7 +24,7 @@ public class WelcomePage extends BasePage {
|
|||||||
@Override
|
@Override
|
||||||
protected void onConfigure() {
|
protected void onConfigure() {
|
||||||
super.onConfigure();
|
super.onConfigure();
|
||||||
setVisibilityAllowed(applicationSettingsDAO.get()
|
setVisibilityAllowed(applicationSettingsService.get()
|
||||||
.isAllowRegistrations());
|
.isAllowRegistrations());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -20,10 +20,10 @@ import org.apache.wicket.validation.IValidator;
|
|||||||
import org.apache.wicket.validation.ValidationError;
|
import org.apache.wicket.validation.ValidationError;
|
||||||
import org.apache.wicket.validation.validator.StringValidator;
|
import org.apache.wicket.validation.validator.StringValidator;
|
||||||
|
|
||||||
import com.commafeed.backend.dao.ApplicationSettingsDAO;
|
|
||||||
import com.commafeed.backend.dao.UserDAO;
|
import com.commafeed.backend.dao.UserDAO;
|
||||||
import com.commafeed.backend.model.User;
|
import com.commafeed.backend.model.User;
|
||||||
import com.commafeed.backend.model.UserRole.Role;
|
import com.commafeed.backend.model.UserRole.Role;
|
||||||
|
import com.commafeed.backend.services.ApplicationSettingsService;
|
||||||
import com.commafeed.backend.services.UserService;
|
import com.commafeed.backend.services.UserService;
|
||||||
import com.commafeed.frontend.CommaFeedSession;
|
import com.commafeed.frontend.CommaFeedSession;
|
||||||
import com.commafeed.frontend.model.RegistrationRequest;
|
import com.commafeed.frontend.model.RegistrationRequest;
|
||||||
@@ -40,7 +40,7 @@ public class RegisterPanel extends Panel {
|
|||||||
UserService userService;
|
UserService userService;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
ApplicationSettingsDAO applicationSettingsDAO;
|
ApplicationSettingsService applicationSettingsService;
|
||||||
|
|
||||||
public RegisterPanel(String markupId) {
|
public RegisterPanel(String markupId) {
|
||||||
super(markupId);
|
super(markupId);
|
||||||
@@ -51,7 +51,7 @@ public class RegisterPanel extends Panel {
|
|||||||
"form", model) {
|
"form", model) {
|
||||||
@Override
|
@Override
|
||||||
protected void onSubmit() {
|
protected void onSubmit() {
|
||||||
if (applicationSettingsDAO.get().isAllowRegistrations()) {
|
if (applicationSettingsService.get().isAllowRegistrations()) {
|
||||||
RegistrationRequest req = getModelObject();
|
RegistrationRequest req = getModelObject();
|
||||||
userService.register(req.getName(), req.getPassword(),
|
userService.register(req.getName(), req.getPassword(),
|
||||||
Arrays.asList(Role.USER));
|
Arrays.asList(Role.USER));
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import javax.ws.rs.POST;
|
|||||||
import javax.ws.rs.Path;
|
import javax.ws.rs.Path;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
|
|
||||||
import com.commafeed.backend.dao.ApplicationSettingsDAO;
|
|
||||||
import com.commafeed.backend.model.ApplicationSettings;
|
import com.commafeed.backend.model.ApplicationSettings;
|
||||||
import com.commafeed.backend.model.UserRole.Role;
|
import com.commafeed.backend.model.UserRole.Role;
|
||||||
|
import com.commafeed.backend.services.ApplicationSettingsService;
|
||||||
import com.commafeed.frontend.SecurityCheck;
|
import com.commafeed.frontend.SecurityCheck;
|
||||||
|
|
||||||
@SecurityCheck(Role.ADMIN)
|
@SecurityCheck(Role.ADMIN)
|
||||||
@@ -16,18 +16,18 @@ import com.commafeed.frontend.SecurityCheck;
|
|||||||
public class AdminSettingsREST {
|
public class AdminSettingsREST {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
ApplicationSettingsDAO applicationSettingsDAO;
|
ApplicationSettingsService applicationSettingsService;
|
||||||
|
|
||||||
@Path("get")
|
@Path("get")
|
||||||
@GET
|
@GET
|
||||||
public ApplicationSettings get() {
|
public ApplicationSettings get() {
|
||||||
return applicationSettingsDAO.get();
|
return applicationSettingsService.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Path("save")
|
@Path("save")
|
||||||
@POST
|
@POST
|
||||||
public Response save(ApplicationSettings settings) {
|
public Response save(ApplicationSettings settings) {
|
||||||
applicationSettingsDAO.save(settings);
|
applicationSettingsService.save(settings);
|
||||||
return Response.ok().build();
|
return Response.ok().build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,15 +74,15 @@ public class EntriesREST extends AbstractREST {
|
|||||||
if (ALL.equals(id)) {
|
if (ALL.equals(id)) {
|
||||||
entries.setName("All");
|
entries.setName("All");
|
||||||
List<FeedEntryStatus> unreadEntries = feedEntryStatusDAO
|
List<FeedEntryStatus> unreadEntries = feedEntryStatusDAO
|
||||||
.findAll(getUser(), unreadOnly, offset, limit,
|
.findAll(getUser(), unreadOnly, offset, limit, order,
|
||||||
order, true);
|
true);
|
||||||
for (FeedEntryStatus status : unreadEntries) {
|
for (FeedEntryStatus status : unreadEntries) {
|
||||||
entries.getEntries().add(buildEntry(status));
|
entries.getEntries().add(buildEntry(status));
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
FeedCategory feedCategory = feedCategoryDAO.findById(
|
FeedCategory feedCategory = feedCategoryDAO.findById(getUser(),
|
||||||
getUser(), Long.valueOf(id));
|
Long.valueOf(id));
|
||||||
if (feedCategory != null) {
|
if (feedCategory != null) {
|
||||||
List<FeedCategory> childrenCategories = feedCategoryDAO
|
List<FeedCategory> childrenCategories = feedCategoryDAO
|
||||||
.findAllChildrenCategories(getUser(), feedCategory);
|
.findAllChildrenCategories(getUser(), feedCategory);
|
||||||
@@ -142,8 +142,8 @@ public class EntriesREST extends AbstractREST {
|
|||||||
feedEntryStatusDAO.update(status);
|
feedEntryStatusDAO.update(status);
|
||||||
} else if (type == Type.feed) {
|
} else if (type == Type.feed) {
|
||||||
if (read) {
|
if (read) {
|
||||||
FeedSubscription subscription = feedSubscriptionDAO
|
FeedSubscription subscription = feedSubscriptionDAO.findById(
|
||||||
.findById(getUser(), Long.valueOf(id));
|
getUser(), Long.valueOf(id));
|
||||||
feedEntryStatusDAO.markFeedEntries(getUser(),
|
feedEntryStatusDAO.markFeedEntries(getUser(),
|
||||||
subscription.getFeed(), olderThan);
|
subscription.getFeed(), olderThan);
|
||||||
} else {
|
} else {
|
||||||
@@ -156,7 +156,8 @@ public class EntriesREST extends AbstractREST {
|
|||||||
feedEntryStatusDAO.markAllEntries(getUser(), olderThan);
|
feedEntryStatusDAO.markAllEntries(getUser(), olderThan);
|
||||||
} else {
|
} else {
|
||||||
List<FeedCategory> categories = feedCategoryDAO
|
List<FeedCategory> categories = feedCategoryDAO
|
||||||
.findAllChildrenCategories(getUser(),
|
.findAllChildrenCategories(
|
||||||
|
getUser(),
|
||||||
feedCategoryDAO.findById(getUser(),
|
feedCategoryDAO.findById(getUser(),
|
||||||
Long.valueOf(id)));
|
Long.valueOf(id)));
|
||||||
feedEntryStatusDAO.markCategoryEntries(getUser(),
|
feedEntryStatusDAO.markCategoryEntries(getUser(),
|
||||||
|
|||||||
Reference in New Issue
Block a user