public class BoliviaProducerLocalizer extends MirBasicProducerLocalizer {
- protected void setupContentFactory(CompositeProducerNode aNode) {
- }
-
- protected void setupStartPageFactory(CompositeProducerNode aNode) {
- }
-
- protected void setupSynchronizationFactory(CompositeProducerNode aNode) {
- }
-
- protected void setupStaticFactory(CompositeProducerNode aNode) {
- }
-
- protected void setupTopicsFactory(CompositeProducerNode aNode) {
- }
-
-/* protected void setupContentFactory(CompositeProducerFactory aContentFactory) {
-
+ protected void setupContentFactory(CompositeProducerNode aProducerNode) {
EntityEnumeratingProducerNode contentNode = null;
+ aProducerNode.clear();
try {
contentNode =
new EntityEnumeratingProducerNode( "content", DatabaseContent.getInstance(), ContentAdapterDefinition.getInstance(),
new CompositeProducerNode( new ProducerNode[] {
new EntityEnumeratingProducerNode( "language", DatabaseLanguage.getInstance(), LanguageAdapterDefinition.getInstance(), "", "",
- new ResourceBundleProducerNode("lang", "producer_${language.code}",
- new GeneratingProducerNode(
- "/producer/bolivia.indymedia.org/article.template",
- "${config.storageRoot}/${language.code}/articles/${content.date.year}/${content.date.month}/${content.id}.shtml"
- )
+ new ResourceBundleProducerNode("lang", "bundles.producer_${language.code}",
+ new CompositeProducerNode( new ProducerNode[] {
+ new GeneratingProducerNode(
+ "/producer/bolivia.indymedia.org/article.template",
+ "${config.storageRoot}/${language.code}/${content.date.formatted.yyyy}/${content.date.formatted.MM}/${content.id}.shtml"
+ ),
+ new FileDateSettingProducerNode(
+ "${config.storageRoot}/${language.code}/${content.date.formatted.yyyy}/${content.date.formatted.MM}/${content.id}.shtml",
+ "content.date.date"
+ )
+ } )
)
- )
+ ),
+ new ContentMarkingProducerNode( "content")
} )
);
}
contentNode.addVerb( "all", "is_published='1'", "" );
contentNode.addVerb( "new", "is_published='1' and is_produced='f'", "" );
- aContentFactory.addFactory( new NodedProducerFactory( contentNode ) );
-
+ aProducerNode.addSubNode( contentNode );
+ }
-// public EntityEnumeratingProducerNode(String aKey, StorageObject aStorage, EntityAdapterDefinition aDefinition, ProducerNode aSubNode) {
+ protected void setupStartPageFactory(CompositeProducerNode aProducerNode) {
+ aProducerNode.clear();
+ try {
+ aProducerNode.addSubNode(
+ new EntityListProducerNode("newswire", DatabaseContent.getInstance(), ContentAdapterDefinition.getInstance(),
+ "is_published='1' and to_article_type = ${articletype.newswire}", "date desc, webdb_create desc", 40, 0,
+ new EntityListProducerNode("languages", DatabaseLanguage.getInstance(), LanguageAdapterDefinition.getInstance(),
+ "", "code", 10, 0,
+ new EntityListProducerNode("startspecial", DatabaseContent.getInstance(), ContentAdapterDefinition.getInstance(),
+ "is_published='1' and to_article_type = ${articletype.startspecial}", "date desc, webdb_create desc", 1, 0,
+ new EntityListProducerNode("features", DatabaseContent.getInstance(), ContentAdapterDefinition.getInstance(),
+ "is_published='1' and to_article_type = ${articletype.feature}", "date desc, webdb_create desc", 10, 0,
+ new EntityListProducerNode("breaking", DatabaseBreaking.getInstance(), BreakingAdapterDefinition.getInstance(),
+ "", "webdb_create desc", 5, 0,
+ new EntityEnumeratingProducerNode( "language", DatabaseLanguage.getInstance(), LanguageAdapterDefinition.getInstance(), "", "",
+ new ResourceBundleProducerNode("lang", "bundles.producer_${language.code}",
+ new GeneratingProducerNode(
+ "/producer/bolivia.indymedia.org/startpage.template",
+ "${config.storageRoot}/${language.code}/index.shtml"
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ );
+
+ aProducerNode.addSubNode(
+ new EntityEnumeratingProducerNode( "city", DatabaseTopics.getInstance(), TopicsAdapterDefinition.getInstance(), "main_url='c'", "",
+ new EntityListProducerNode("newswire", DatabaseContent.getInstance(), ContentAdapterDefinition.getInstance(),
+ "is_published='1' and to_article_type = ${articletype.newswire} and exists(select * from content_x_topic where content_id=id and topic_id=${city.id})", "date desc, webdb_create desc", 40, 0,
+ new EntityListProducerNode("languages", DatabaseLanguage.getInstance(), LanguageAdapterDefinition.getInstance(),
+ "", "code", 10, 0,
+ new EntityListProducerNode("startspecial", DatabaseContent.getInstance(), ContentAdapterDefinition.getInstance(),
+ "is_published='1' and to_article_type = ${articletype.startspecial} and "+
+ "exists(select * from content_x_topic where content_id=id and topic_id=${city.id})", "date desc, webdb_create desc", 1, 0,
+ new EntityListProducerNode("features", DatabaseContent.getInstance(), ContentAdapterDefinition.getInstance(),
+ "is_published='1' and to_article_type = ${articletype.feature} and exists(select * from content_x_topic where content_id=id and topic_id=${city.id})", "date desc, webdb_create desc", 10, 0,
+ new EntityListProducerNode("breaking", DatabaseBreaking.getInstance(), BreakingAdapterDefinition.getInstance(),
+ "", "webdb_create desc", 5, 0,
+ new EntityEnumeratingProducerNode( "language", DatabaseLanguage.getInstance(), LanguageAdapterDefinition.getInstance(), "", "",
+ new ResourceBundleProducerNode("lang", "bundles.producer_${language.code}",
+ new GeneratingProducerNode(
+ "/producer/bolivia.indymedia.org/startpage.template",
+ "${config.storageRoot}/${language.code}/${city.filename}/index.shtml"
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ );
+ }
+ catch (Throwable t) {
+ }
+ }
-// aContentFactory.addFactory(
-// new ContentProducerFactory(
-// "producer/content.template",
-// "bundles.admin",
-// MirGlobal.getConfigProperty("Producer.StorageRoot") + "/content/${contentyear}/${contentmonth}/${contentid}.inc",
-// Integer.parseInt(MirGlobal.getConfigProperty("Producer.Content.Batchsize"))));
+ protected void setupStaticFactory(CompositeProducerNode aProducerNode) {
+ aProducerNode.clear();
-// aContentFactory.addFactory(
-// new ContentProducerFactory(
-// "producer/article.template",
-// "bundles.admin",
-// MirGlobal.getConfigProperty("Producer.StorageRoot") + "/nl/${contentyear}/${contentmonth}/${contentid}.shtml",
-// Integer.parseInt(MirGlobal.getConfigProperty("Producer.Content.Batchsize"))));
+ try {
+ aProducerNode.addSubNode(
+ new EntityListProducerNode("languages", DatabaseLanguage.getInstance(), LanguageAdapterDefinition.getInstance(),
+ "", "code", 10, 0,
+ new EntityEnumeratingProducerNode( "language", DatabaseLanguage.getInstance(), LanguageAdapterDefinition.getInstance(), "", "",
+ new ResourceBundleProducerNode("lang", "bundles.producer_${language.code}",
+ new GeneratingProducerNode(
+ "/producer/bolivia.indymedia.org/navigation.template",
+ "${config.storageRoot}/${language.code}/navigation.inc"
+ )
+ )
+ )
+ )
+ );
+ }
+ catch (Throwable t) {
+ }
}
- protected void setupStartPageFactory(CompositeProducerFactory aStartPageFactory) {
- ProducerNode topicNode = null;
+ protected void setupTopicsFactory(CompositeProducerNode aProducerNode) {
+ aProducerNode.clear();
+
+ EntityBatchingProducerNode topicPageNode = null;
try {
- topicNode =
- new EntityBatchingProducerNode( "articles", "batch", DatabaseContent.getInstance(), ContentAdapterDefinition.getInstance()
- "is_published='1' and to_article_type = 2", "date desc, webdb_create desc", 20, 10, 0,
+// topic pages:
+ topicPageNode =
+ new EntityBatchingProducerNode( "articles", "batch", DatabaseContent.getInstance(), ContentAdapterDefinition.getInstance(),
+ "is_published='1' and to_article_type = ${articletype.newswire} and id in (select content_id from content_x_topic where topic_id = ${topic.id})", "date asc, webdb_create asc", 6, 5, 0,
new EntityListProducerNode("languages", DatabaseLanguage.getInstance(), LanguageAdapterDefinition.getInstance(),
"", "code", 10, 0,
new EntityEnumeratingProducerNode( "language", DatabaseLanguage.getInstance(), LanguageAdapterDefinition.getInstance(), "", "",
new ResourceBundleProducerNode("lang", "producer_${language.code}",
new GeneratingProducerNode(
- "/producer/bolivia.indymedia.org/startpage.template",
- "${config.storageRoot}/${language.code}/index.shtml"
+ "/producer/bolivia.indymedia.org/topic.template",
+ "${config.storageRoot}/${language.code}/${topic.filename}/${topic.filename}${batch.current.identifier}.shtml"
+ )
+ )
+ )
+ ),
+ new EntityListProducerNode("languages", DatabaseLanguage.getInstance(), LanguageAdapterDefinition.getInstance(),
+ "", "code", 10, 0,
+ new EntityEnumeratingProducerNode( "language", DatabaseLanguage.getInstance(), LanguageAdapterDefinition.getInstance(), "", "",
+ new ResourceBundleProducerNode("lang", "producer_${language.code}",
+ new GeneratingProducerNode(
+ "/producer/bolivia.indymedia.org/topicnavigation.template",
+ "${config.storageRoot}/${language.code}/${topic.filename}/${topic.filename}navigation.inc"
+ )
+ )
+ )
+ )
+ );
+ topicPageNode.addVerb("all", -1);
+ topicPageNode.addVerb("new", 3);
+
+ aProducerNode.addSubNode(
+ new EntityEnumeratingProducerNode( "topic", DatabaseTopics.getInstance(), TopicsAdapterDefinition.getInstance(), "", "",
+ new EntityListProducerNode("topicspecial", DatabaseContent.getInstance(), ContentAdapterDefinition.getInstance(),
+ "is_published='1' and to_article_type = ${articletype.topicspecial} and id in (select content_id from content_x_topic where topic_id = ${topic.id})", "date, webdb_create", 1, 0,
+ topicPageNode
+ )
+ )
+ );
+
+// topic pages per city:
+ topicPageNode =
+ new EntityBatchingProducerNode( "articles", "batch", DatabaseContent.getInstance(), ContentAdapterDefinition.getInstance(),
+ "is_published='1' and to_article_type = ${articletype.newswire} and " +
+ "id in (select content_id from content_x_topic where topic_id = ${topic.id}) and " +
+ "id in (select content_id from content_x_topic where topic_id = ${city.id})", "date asc, webdb_create asc", 6, 5, 0,
+ new EntityListProducerNode("languages", DatabaseLanguage.getInstance(), LanguageAdapterDefinition.getInstance(),
+ "", "code", 10, 0,
+ new EntityEnumeratingProducerNode( "language", DatabaseLanguage.getInstance(), LanguageAdapterDefinition.getInstance(), "", "",
+ new ResourceBundleProducerNode("lang", "producer_${language.code}",
+ new GeneratingProducerNode(
+ "/producer/bolivia.indymedia.org/topic.template",
+ "${config.storageRoot}/${language.code}/${city.filename}/${topic.filename}/${topic.filename}${batch.current.identifier}.shtml"
+ )
+ )
+ )
+ ),
+ new EntityListProducerNode("languages", DatabaseLanguage.getInstance(), LanguageAdapterDefinition.getInstance(),
+ "", "code", 10, 0,
+ new EntityEnumeratingProducerNode( "language", DatabaseLanguage.getInstance(), LanguageAdapterDefinition.getInstance(), "", "",
+ new ResourceBundleProducerNode("lang", "producer_${language.code}",
+ new GeneratingProducerNode(
+ "/producer/bolivia.indymedia.org/topicnavigation.template",
+ "${config.storageRoot}/${language.code}/${city.filename}/${topic.filename}/${topic.filename}navigation.inc"
)
)
)
)
);
- topicNode.addVerb("all", -1);
- topicNode.addVerb("new", 3);
+ topicPageNode.addVerb("all", -1);
+ topicPageNode.addVerb("new", 3);
+
+ aProducerNode.addSubNode(
+ new EntityEnumeratingProducerNode( "city", DatabaseTopics.getInstance(), TopicsAdapterDefinition.getInstance(), "main_url='c'", "",
+ new EntityEnumeratingProducerNode( "topic", DatabaseTopics.getInstance(), TopicsAdapterDefinition.getInstance(), "((main_url is null) or main_url<>'c')", "",
+ new EntityListProducerNode("topicspecial", DatabaseContent.getInstance(), ContentAdapterDefinition.getInstance(),
+ "is_published='1' and to_article_type = ${articletype.topicspecial} and "+
+ "id in (select content_id from content_x_topic where topic_id = ${topic.id}) and"+
+ "id in (select content_id from content_x_topic where topic_id = ${city.id})", "date, webdb_create", 1, 0,
+ topicPageNode
+ )
+ )
+ )
+ );
}
catch (Throwable t) {
}
- aStartPageFactory.addFactory( new NodedProducerFactory( startPageNode ) );
-
-
-
- aStartPageFactory.addFactory(
- new TopicStartPageProducerFactory(
- "producer/citystart.template",
- "bundles.admin",
- MirGlobal.getConfigProperty("Producer.StorageRoot") + "/nl/start${filename}.shtml",
- MirGlobal.getConfigIntegerProperty("Producer.StartPage.Items"),
- 0));
-
- aStartPageFactory.addFactory(
- new TopicStartPageProducerFactory(
- "producer/newswire.template",
- "bundles.admin",
- MirGlobal.getConfigProperty("Producer.StorageRoot") + "/nl/newswire${filename}.inc",
- 0,
- MirGlobal.getConfigIntegerProperty("Producer.StartPage.Newswire")));
-
- aStartPageFactory.addFactory(
- new StartPageProducerFactory(
- "producer/start.template",
- "bundles.admin",
- MirGlobal.getConfigProperty("Producer.StorageRoot") + "/nl/start.shtml",
- MirGlobal.getConfigIntegerProperty("Producer.StartPage.Items"),
- 0));
-
- aStartPageFactory.addFactory(
- new StartPageProducerFactory(
- "producer/newswire.template",
- "bundles.admin",
- MirGlobal.getConfigProperty("Producer.StorageRoot") + "/nl/newswire.inc",
- 0,
- MirGlobal.getConfigIntegerProperty("Producer.StartPage.Newswire")));
-
-
}
-
- protected void setupStaticFactory(CompositeProducerFactory aStaticFactory) {
- aStaticFactory.addFactory(
- new StaticProducerFactory(
- "producer/nav.template",
- "bundles.admin",
- MirGlobal.getConfigProperty("Producer.StorageRoot") + "/nl/nav.inc"));
-
- aStaticFactory.addFactory(
- new StaticProducerFactory(
- "producer/top.template",
- "bundles.admin",
- MirGlobal.getConfigProperty("Producer.StorageRoot") + "/nl/top.inc"));
-
- aStaticFactory.addFactory(
- new StaticProducerFactory(
- "producer/bottom.template",
- "bundles.admin",
- MirGlobal.getConfigProperty("Producer.StorageRoot") + "/nl/bottom.inc"));
-
- aStaticFactory.addFactory(
- new StaticProducerFactory(
- "producer/style.template",
- "bundles.admin",
- MirGlobal.getConfigProperty("Producer.StorageRoot") + "/nl/style.css"));
-
- aStaticFactory.addFactory(
- new StaticProducerFactory(
- "producer/articlepre.template",
- "bundles.admin",
- MirGlobal.getConfigProperty("Producer.StorageRoot") + "/nl/articlepre.shtml"));
-
- aStaticFactory.addFactory(
- new StaticProducerFactory(
- "producer/articlepost.template",
- "bundles.admin",
- MirGlobal.getConfigProperty("Producer.StorageRoot") + "/nl/articlepost.shtml"));
- }
-*/
-
}