AW: AW: [opencms-dev] NewsHack Source Code
Mark Miller
mark.miller at hema.ch
Tue Nov 18 11:58:01 CET 2003
This may be better ... have included the method source so you can see
what it does (is in class NewsContentDefinition)
public static Vector getSortedList(String str) {
Vector list = new Vector();
Connection con = null;
PreparedStatement statement = null;
ResultSet res = null;
if(str == null || str == " ") { str = ""; }
str.trim();
str.toLowerCase();
//System.err.println("[NewsContentDefinition.getSortedList()] Start -
str: " +str);
try {
con = DriverManager.getConnection(c_pool);
statement = con.prepareStatement(C_ORDER);
if( str.equals("") ) {
statement.setString(1, "date");
}
else if( str.equals("id") ) {
statement.setString(1, "id");
}
else if(str.equals("headline") ||
str.equals("schlagzeile") ) {
statement.setString(1, "headline");
}
else if(str.equals("description") ||
str.equals("beschreibung")) {
statement.setString(1, "description");
}
else if(str.equals("text") ||
str.equals("inhalt")) {
statement.setString(1, "text");
}
else if(str.equals("author")) {
statement.setString(1, "author");
}
else if(str.equals("link")) {
statement.setString(1, "link");
}
else if(str.equals("date") ||
str.equals("Datum")) {
statement.setString(1, "date");
}
else if(str.equals("date_start")) {
statement.setString(1, "date_start");
}
else if(str.equals("date_end")) {
statement.setString(1, "date_end");
}
else if(str.equals("channel") ||
str.equals("kanal")) {
statement.setString(1, "channel");
}
else if(str.equals("long_abstract") ) {
statement.setString(1, "long_abstract");
}
else {
statement.setString(1, "date"); // all
other inputs!
}
res = statement.executeQuery();
while(res.next()){
// read the item from the resultset
// insert Element into list
list.addElement(new
NewsContentDefinition(res.getInt(1),
res.getString(2), // Headline
res.getString(3), // Descr.
res.getString(4), // Text
res.getString(5), // Author
res.getString(6), // link
res.getString(7), // linkText
res.getTimestamp(8), // Date
res.getInt(9), // Lockstate
res.getInt(10), // Channel
res.getString(11),// a_info
res.getString(12),// a_info
res.getString(13), // a_info
res.getTimestamp(14), // Date
res.getTimestamp(15), // Date
res.getString(16) // long_abstract
));
}
}catch(Exception e) {
System.err.println("[NewsContentDefinition.getSortedList() Exception1:]"
+ e.getMessage());
}finally{
try{
res.close();
}catch (Exception e) {
// ignore the exception
}
try{
statement.close();
}catch (Exception e) {
// ignore the exception
}
try{
con.close();
}catch (Exception e) {
// ignore the exception
}
}
return list;
}
-----Ursprüngliche Nachricht-----
Von: opencms-dev-admin at opencms.org
[mailto:opencms-dev-admin at opencms.org] Im Auftrag von Peter Glantschnig
Gesendet: 18 November 2003 11:44
An: opencms-dev at opencms.org
Betreff: Re: AW: [opencms-dev] NewsHack Source Code
Thank you...the little example you provided was even more interesting.
But I still have some problems to understand, how to get for example the
5
newest items form a specific channel? I think in your example you just
display
one item. Do you maybe have another hint for me?
Thanks,
Peter
> Here is the source ... although I don't really know why you would need
> to use it. I am also including a file on how to use the original class
> files to get news content from jsp pages.
>
> If you take a look at the news module api (javadoc) it should be
fairly
> clear how to use it.
>
> You can find the javadoc for both the news module and the beans at
> http://www.hema.ch/personal/mark.miller/opencms/index.html
>
> All the best,
>
> mark
>
>
> -----Ursprüngliche Nachricht-----
> Von: opencms-dev-admin at opencms.org
> [mailto:opencms-dev-admin at opencms.org] Im Auftrag von Peter
Glantschnig
> Gesendet: 18 November 2003 09:48
> An: opencms-dev at opencms.org
> Betreff: [opencms-dev] NewsHack Source Code
>
> Hello,
>
> I would like to get an idea about the functionality of OpenCMS and
right
> now
> I'm playing around with that news module. I think some of you might
know
> the
> NewsHack Java Beans from Rene Hinojosa. I would really like to take a
> look
> at the source code of this project. So far I just found the class
files.
>
>
> I know, the source file where already posted on this list, but I have
no
> idea, how to get the attachment from the opencms mail archive.
>
> Maybe some can post a link or post it again on this mailing list!
>
> Thanks,
> Peter
>
> --
> NEU FÜR ALLE - GMX MediaCenter - für Fotos, Musik, Dateien...
> Fotoalbum, File Sharing, MMS, Multimedia-Gruß, GMX FotoService
>
> Jetzt kostenlos anmelden unter http://www.gmx.net
>
> +++ GMX - die erste Adresse für Mail, Message, More! +++
>
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please
> visit
> http://mail.opencms.org/mailman/listinfo/opencms-dev
>
>
--
GMX Weihnachts-Special: Seychellen-Traumreise zu gewinnen!
Rentier entlaufen. Finden Sie Rudolph! Als Belohnung winken
tolle Preise. http://www.gmx.net/de/cgi/specialmail/
+++ GMX - die erste Adresse für Mail, Message, More! +++
_______________________________________________
This mail is send to you from the opencms-dev mailing list
To change your list options, or to unsubscribe from the list, please
visit
http://mail.opencms.org/mailman/listinfo/opencms-dev
More information about the opencms-dev
mailing list