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 } catch (Exception e) {
40 logHTML(htmlout, "Producer.All <font color=\"red\">ERROR:</font>"
41 +" in ProducerImages continuing "+ e.toString());
44 new ProducerAudio().handle(htmlout, user, force,sync);
45 } catch (Exception e) {
46 logHTML(htmlout, "Producer.All <font color=\"red\">ERROR:</font>"
47 +" in ProducerAudio continuing "+ e.toString());
50 new ProducerVideo().handle(htmlout, user, force,sync);
51 } catch (Exception e) {
52 logHTML(htmlout, "Producer.All <font color=\"red\">ERROR:</font>"
53 +" in ProducerVideo continuing "+ e.toString());
56 new ProducerOther().handle(htmlout, user, force,sync);
57 } catch (Exception e) {
58 logHTML(htmlout, "Producer.All <font color=\"red\">ERROR:</font>"
59 +" in ProducerOther continuing "+ e.toString());
62 new ProducerStartPage().handle(htmlout, user, force,sync);
63 } catch (Exception e) {
64 logHTML(htmlout, "Producer.All <font color=\"red\">ERROR:</font>"
65 +" in Producer.StartPage continuing "+ e.toString());
68 new ProducerContent().handle(htmlout, user, force,sync);
69 } catch (Exception e) {
70 logHTML(htmlout, "Producer.All <font color=\"red\">ERROR:</font>"
71 +" in Producer.Content continuing "+ e.toString());
74 new ProducerOpenPosting().handle(htmlout, user, force,sync);
75 } catch (Exception e) {
76 logHTML(htmlout, "Producer.All <font color=\"red\">ERROR:</font>"
77 +" in Producer.OpenPosting continuing "+ e.toString());
80 new ProducerTopics().handle(htmlout, user, force,sync);
81 } catch (Exception e) {
82 logHTML(htmlout, "Producer.All <font color=\"red\">ERROR:</font>"
83 +" in Producer.Topics continuing "+ e.toString());
86 new ProducerNavigation().handle(htmlout, user, force,sync);
87 } catch (Exception e) {
88 logHTML(htmlout, "Producer.All <font color=\"red\">ERROR:</font>"
89 +" in Producer.Navigation continuing "+ e.toString());
93 sessionConnectTime = new java.util.Date().getTime() - startTime;
94 logHTML(htmlout, "Producer.All finished: " + sessionConnectTime + " ms.");
96 // do we have to rsync the site
98 sessionConnectTime = 0;
99 if (Helper.rsync()!=0){
100 sessionConnectTime = new java.util.Date().getTime() - startTime;
101 logHTML(htmlout, "Rsync failed: " + sessionConnectTime + " ms.");
103 sessionConnectTime = new java.util.Date().getTime() - startTime;
104 logHTML(htmlout, "Rsync succeded: " + sessionConnectTime + " ms.");
110 public void handle2(PrintWriter htmlout, EntityUsers user, boolean force,boolean sync)
111 throws StorageObjectException, ModuleException {
112 printHTML(htmlout, "Producer.All: started");
114 long sessionConnectTime = 0;
115 long startTime = (new java.util.Date()).getTime();
116 EntityContent currentContent;
118 //get all new unproduced content-entities
119 String whereClause="is_produced='0' && to_article_type>0";
120 String orderBy="date desc";
121 EntityList entityList = contentModule.getContent(whereClause,orderBy,0,-1,null);
124 while (entityList != null) {
125 for(int i=0;i<entityList.size();i++) {
126 currentContent = (EntityContent)entityList.elementAt(i);
127 EntityList topicEntityList = DatabaseContentToTopics.getInstance().getTopics(currentContent);
128 SimpleHash topicHash = HTMLTemplateProcessor.makeSimpleHash(topicEntityList);
131 //check if this content item is related to a topic
132 if(currentContent.getId().equals(topicHash.get("content_id"))){
133 // produce the ToicsList
134 new ProducerTopics().handle(htmlout, user, force,sync,topicHash.get("topic_id").toString());
136 } catch (TemplateModelException e) {
137 logHTML(htmlout, e.toString());
142 new ProducerContent().handle(htmlout, user, force,sync);
143 new ProducerOpenPosting().handle(htmlout, user, force,sync);
144 new ProducerStartPage().handle(htmlout, user, force,sync);
145 new ProducerTopics().handle(htmlout, user, force,sync);
148 sessionConnectTime = new java.util.Date().getTime() - startTime;
149 logHTML(htmlout, "Producer.All finished: " + sessionConnectTime + " ms.");