1 package mircoders.producer;
7 import freemarker.template.*;
14 import mircoders.module.*;
15 import mircoders.entity.*;
16 import mircoders.storage.*;
19 public class ProducerAll extends Producer{
21 private boolean rsync;
23 public static void main(String argv[])
25 try { new ProducerAll().handle(new PrintWriter(System.out), null, false,false); }
26 catch(Exception e) { System.err.println(e.toString()); }
30 public void handle(PrintWriter htmlout, EntityUsers user, boolean force,boolean sync)
32 printHTML(htmlout, "Producer.All: started");
34 long sessionConnectTime = 0;
35 long startTime = (new java.util.Date()).getTime();
38 //new ProducerImages().handle(htmlout, user, force,sync);
39 new ProducerMedia().handle(htmlout, user, force,sync);
40 } catch (Exception e) {
41 logHTML(htmlout, "Producer.All <font color=\"red\">ERROR:</font>"
42 +" in Producer.Media continuing "+ e.toString());
45 new ProducerStartPage().handle(htmlout, user, force,sync);
46 } catch (Exception e) {
47 logHTML(htmlout, "Producer.All <font color=\"red\">ERROR:</font>"
48 +" in Producer.StartPage continuing "+ e.toString());
51 new ProducerContent().handle(htmlout, user, force,sync);
52 } catch (Exception e) {
53 logHTML(htmlout, "Producer.All <font color=\"red\">ERROR:</font>"
54 +" in Producer.Content continuing "+ e.toString());
57 new ProducerOpenPosting().handle(htmlout, user, force,sync);
58 } catch (Exception e) {
59 logHTML(htmlout, "Producer.All <font color=\"red\">ERROR:</font>"
60 +" in Producer.OpenPosting continuing "+ e.toString());
63 new ProducerTopics().handle(htmlout, user, force,sync);
64 } catch (Exception e) {
65 logHTML(htmlout, "Producer.All <font color=\"red\">ERROR:</font>"
66 +" in Producer.Topics continuing "+ e.toString());
69 new ProducerNavigation().handle(htmlout, user, force,sync);
70 } catch (Exception e) {
71 logHTML(htmlout, "Producer.All <font color=\"red\">ERROR:</font>"
72 +" in Producer.Navigation continuing "+ e.toString());
76 sessionConnectTime = new java.util.Date().getTime() - startTime;
77 logHTML(htmlout, "Producer.All finished: " + sessionConnectTime + " ms.");
79 // do we have to rsync the site
81 sessionConnectTime = 0;
82 if (Helper.rsync()!=0){
83 sessionConnectTime = new java.util.Date().getTime() - startTime;
84 logHTML(htmlout, "Rsync failed: " + sessionConnectTime + " ms.");
86 sessionConnectTime = new java.util.Date().getTime() - startTime;
87 logHTML(htmlout, "Rsync succeded: " + sessionConnectTime + " ms.");
93 public void handle2(PrintWriter htmlout, EntityUsers user, boolean force,boolean sync)
94 throws StorageObjectException, ModuleException {
95 printHTML(htmlout, "Producer.All: started");
97 long sessionConnectTime = 0;
98 long startTime = (new java.util.Date()).getTime();
99 EntityContent currentContent;
101 //get all new unproduced content-entities
102 String whereClause="is_produced='0' && to_article_type>0";
103 String orderBy="date desc";
104 EntityList entityList = contentModule.getContent(whereClause,orderBy,0,-1,null);
107 while (entityList != null) {
108 for(int i=0;i<entityList.size();i++) {
109 currentContent = (EntityContent)entityList.elementAt(i);
110 EntityList topicEntityList = DatabaseContentToTopics.getInstance().getTopics(currentContent);
111 SimpleHash topicHash = HTMLTemplateProcessor.makeSimpleHash(topicEntityList);
114 //check if this content item is related to a topic
115 if(currentContent.getId().equals(topicHash.get("content_id"))){
116 // produce the ToicsList
117 new ProducerTopics().handle(htmlout, user, force,sync,topicHash.get("topic_id").toString());
119 } catch (TemplateModelException e) {
120 logHTML(htmlout, e.toString());
125 new ProducerContent().handle(htmlout, user, force,sync);
126 new ProducerOpenPosting().handle(htmlout, user, force,sync);
127 new ProducerStartPage().handle(htmlout, user, force,sync);
128 new ProducerTopics().handle(htmlout, user, force,sync);
131 sessionConnectTime = new java.util.Date().getTime() - startTime;
132 logHTML(htmlout, "Producer.All finished: " + sessionConnectTime + " ms.");