Skip to content

Commit

Permalink
source clean
Browse files Browse the repository at this point in the history
  • Loading branch information
nicol authored and nicol committed Sep 5, 2024
1 parent 0aa8c0e commit 8b34c1f
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 104 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@

import org.magic.api.interfaces.MTGServer;
import org.magic.api.interfaces.abstracts.extra.AbstractEmbeddedCacheProvider;
import org.magic.services.ReportNotificationManager;
import org.magic.services.ReportsService;

import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.RemovalNotification;

public abstract class AbstractMTGServer extends AbstractMTGPlugin implements MTGServer {

protected ReportNotificationManager notifFormater;
protected ReportsService notifFormater;
private AbstractEmbeddedCacheProvider<String, Object> cache;


Expand Down Expand Up @@ -46,7 +46,7 @@ public void clearCache() {


protected AbstractMTGServer() {
notifFormater = new ReportNotificationManager();
notifFormater = new ReportsService();
}

@Override
Expand Down

This file was deleted.

4 changes: 2 additions & 2 deletions src/main/java/org/magic/servers/impl/JSONHttpServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
import org.magic.services.MTGControler;
import org.magic.services.MTGDeckManager;
import org.magic.services.PluginRegistry;
import org.magic.services.ReportNotificationManager;
import org.magic.services.ReportsService;
import org.magic.services.TransactionService;
import org.magic.services.VersionChecker;
import org.magic.services.keywords.AbstractKeyWordsManager;
Expand Down Expand Up @@ -989,7 +989,7 @@ private void initAnnounces()

get("/share/announce/:id",URLTools.HEADER_HTML,(request,response) -> {
response.type(URLTools.HEADER_HTML);
var report = new ReportNotificationManager();
var report = new ReportsService();
var announce = MTG.getEnabledPlugin(MTGDao.class).getAnnounceById(Integer.parseInt(request.params(":id")));
return report.generate(FORMAT_NOTIFICATION.HTML, announce, "share");
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
import freemarker.template.DefaultObjectWrapperBuilder;
import freemarker.template.TemplateExceptionHandler;

public class ReportNotificationManager {
public class ReportsService {
private Configuration cfg;
private Logger logger = MTGLogger.getLogger(this.getClass());
private boolean errorLoading=false;

public ReportNotificationManager() {
public ReportsService() {
cfg = new Configuration(MTGConstants.FREEMARKER_VERSION);
try {
cfg.setClassForTemplateLoading(ReportNotificationManager.class, MTGConstants.MTG_REPORTS_DIR);
cfg.setClassForTemplateLoading(ReportsService.class, MTGConstants.MTG_REPORTS_DIR);
cfg.setDefaultEncoding(MTGConstants.DEFAULT_ENCODING.displayName());
cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
cfg.setObjectWrapper(new DefaultObjectWrapperBuilder(MTGConstants.FREEMARKER_VERSION).build());
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/magic/services/TransactionService.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public static int createContact(Contact c) throws IOException

var plug = (EmailNotifier)MTG.getPlugin(MTGConstants.EMAIL_NOTIFIER_NAME, MTGNotifier.class);
try {
var not = new MTGNotification("["+MTGControler.getInstance().getWebshopService().getWebConfig().getSiteTitle()+ "] Email verification", new ReportNotificationManager().generate(plug.getFormat(), c, "ContactValidation"), MTGNotification.MESSAGE_TYPE.INFO);
var not = new MTGNotification("["+MTGControler.getInstance().getWebshopService().getWebConfig().getSiteTitle()+ "] Email verification", new ReportsService().generate(plug.getFormat(), c, "ContactValidation"), MTGNotification.MESSAGE_TYPE.INFO);
plug.send(c.getEmail(),not);
}
catch(Exception e)
Expand Down Expand Up @@ -108,7 +108,7 @@ public static void sendMail(Transaction t,String template,String msg)
if(t.getContact().isEmailAccept())
{
try {
var not = new MTGNotification("["+t.getConfig().getSiteTitle()+ "] Order #"+t.getId() + ":" + msg , new ReportNotificationManager().generate(plug.getFormat(), t, template), MTGNotification.MESSAGE_TYPE.INFO);
var not = new MTGNotification("["+t.getConfig().getSiteTitle()+ "] Order #"+t.getId() + ":" + msg , new ReportsService().generate(plug.getFormat(), t, template), MTGNotification.MESSAGE_TYPE.INFO);
plug.send(t.getContact().getEmail(),not);
}

Expand Down Expand Up @@ -321,7 +321,7 @@ public static void storeInvoice(Transaction t) throws SQLException {


var entry = new GedEntry<Transaction>();
entry.setContent(new ReportNotificationManager().generate(FORMAT_NOTIFICATION.HTML, t, "Invoice").getBytes());
entry.setContent(new ReportsService().generate(FORMAT_NOTIFICATION.HTML, t, "Invoice").getBytes());
entry.setId(t.getId().toString());
entry.setName(fileName);
entry.setClasse(Transaction.class);
Expand Down
4 changes: 0 additions & 4 deletions src/main/resources/data/default-conf.xml
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,6 @@
</shopper>
</shoppers>
<dashlets>
<dashlet>
<class>org.magic.gui.dashlet.AlertedCardsTrendingDashlet</class>
<enable>true</enable>
</dashlet>
<dashlet>
<class>org.magic.gui.dashlet.BestCardsDashlet</class>
<enable>true</enable>
Expand Down

0 comments on commit 8b34c1f

Please sign in to comment.