Search in sources :

Example 1 with MNewsChannel

use of org.compiere.model.MNewsChannel in project adempiere by adempiere.

the class KIndexRerun method doIt.

//	prepare
/**
	 *  Perform process.
	 *  @return Message (clear text)
	 *  @throws Exception if not successful
	 */
protected String doIt() throws Exception {
    // ReIndex Container
    int[] containers = MContainer.getAllIDs("CM_Container", "CM_WebProject_ID=" + p_CM_WebProject_ID, get_TrxName());
    for (int i = 0; i < containers.length; i++) {
        MContainer thisContainer = new MContainer(getCtx(), containers[i], get_TrxName());
        thisContainer.reIndex(false);
    }
    // ReIndex News
    int[] newsChannels = MNewsChannel.getAllIDs("CM_NewsChannel", "CM_WebProject_ID=" + p_CM_WebProject_ID, get_TrxName());
    for (int i = 0; i < newsChannels.length; i++) {
        MNewsChannel thisChannel = new MNewsChannel(getCtx(), newsChannels[i], get_TrxName());
        thisChannel.reIndex(false);
        int[] newsItems = MNewsItem.getAllIDs("CM_NewsItem", "CM_NewsChannel_ID=" + newsChannels[i], get_TrxName());
        for (int k = 0; k < newsItems.length; k++) {
            MNewsItem thisItem = new MNewsItem(getCtx(), newsItems[k], get_TrxName());
            thisItem.reIndex(false);
        }
    }
    return "finished...";
}
Also used : MNewsChannel(org.compiere.model.MNewsChannel) MNewsItem(org.compiere.model.MNewsItem) MContainer(org.compiere.model.MContainer)

Example 2 with MNewsChannel

use of org.compiere.model.MNewsChannel in project adempiere by adempiere.

the class Generator method generateNewsFeed.

private void generateNewsFeed(Properties ctx) {
    xmlCode.append("<rss version=\"2.0\">");
    int[] theseChannels = X_CM_NewsChannel.getAllIDs("CM_NewsChannel", "CM_WebProject_ID=" + thisRequest.getWebProject().getCM_WebProject_ID(), "WevbCM");
    if (theseChannels != null && theseChannels.length > 0) {
        for (int i = 0; i < theseChannels.length; i++) {
            MNewsChannel thisChannel = new MNewsChannel(ctx, theseChannels[i], "WebCM");
            thisChannel.get_rss2ChannelCode(xmlCode, false);
        }
    }
    xmlCode.append("</rss>");
}
Also used : MNewsChannel(org.compiere.model.MNewsChannel)

Aggregations

MNewsChannel (org.compiere.model.MNewsChannel)2 MContainer (org.compiere.model.MContainer)1 MNewsItem (org.compiere.model.MNewsItem)1