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;
100 HashMap currentContentValues;
102 //get all new unproduced content-entities
103 String whereClause="is_produced='0' && to_article_type>0";
104 String orderBy="date desc";
105 EntityList entityList = contentModule.getContent(whereClause,orderBy,0,-1,null);
108 while (entityList != null) {
109 for(int i=0;i<entityList.size();i++) {
110 currentContent = (EntityContent)entityList.elementAt(i);
111 currentContentValues = currentContent.getValues();
112 EntityList topicEntityList = DatabaseContentToTopics.getInstance().getTopics(currentContent);
113 SimpleHash topicHash = HTMLTemplateProcessor.makeSimpleHash(topicEntityList);
116 //check if this content item is related to a topic
117 if(currentContent.getId().equals(topicHash.get("content_id"))){
118 // produce the ToicsList
119 new ProducerTopics().handle(htmlout, user, force,sync,topicHash.get("topic_id").toString());
121 } catch (TemplateModelException e) {
122 logHTML(htmlout, e.toString());
127 new ProducerContent().handle(htmlout, user, force,sync);
128 new ProducerOpenPosting().handle(htmlout, user, force,sync);
129 new ProducerStartPage().handle(htmlout, user, force,sync);
130 new ProducerTopics().handle(htmlout, user, force,sync);
133 sessionConnectTime = new java.util.Date().getTime() - startTime;
134 logHTML(htmlout, "Producer.All finished: " + sessionConnectTime + " ms.");