- try {
- con = theStorageObject.getPooledCon();
- /** @todo should be preparedStatement: faster!! */
- stmt = con.createStatement();
- theStorageObject.executeUpdate(stmt,sql);
- } catch (StorageObjectException e) {
- throwStorageObjectException(e, "\n -- set produced failed");
- } catch (SQLException e) {
- throwStorageObjectException(e, "\n -- set produced failed");
- } finally {
- theStorageObject.freeConnection(con,stmt);
- }
- }
-
-
- /**
- * make openposting to newswire
- */
-
- public void newswire() throws StorageObjectException
- {
- String sql = "update content set to_article_type='1', is_produced='0' where id='" + getId()+"'";
- try {
- theStorageObject.executeUpdate(sql);
- } catch (StorageObjectException e) {
- throwStorageObjectException(e, "\n -- newswire failed");
- } catch (SQLException e) {
- throwStorageObjectException(e, "\n -- newswire failed");
- }
- }
-
-
- /**
- * dettach from media
- */
- public void dettach(String cid,String mid) throws StorageObjectException
- {
- if (mid!=null){
- try{
- DatabaseContentToMedia.getInstance().delete(cid,mid);
- } catch (Exception e){
- throwStorageObjectException(e, "\n -- failed to get instance");
- }
- //set Content to unproduced
- setProduced(false);
- }
- }
-
- /**
- * attach to media
- */
-
- public void attach(String mid) throws StorageObjectException
- {
- if (mid!=null) {
- //write media-id mid and content-id in table content_x_media
- try{
- DatabaseContentToMedia.getInstance().addMedia(getId(),mid);
- } catch(StorageObjectException e){
- throwStorageObjectException(e, "attach: could not get the instance");
- }
- //set Content to unproduced
- setProduced(false);
- } else {
- theLog.printError("EntityContent: attach without mid");
- }
- }
-
- /**
- * overridden method getValue to include formatted date into every
- * entityContent
- */
-
- public String getValue(String field)
- {
- String returnField = null;
- if (field!=null)
- {
- if (field.equals("date_formatted") || field.equals("webdb_create_short") )
- {
- if (hasValueForField("date"))
- returnField = StringUtil.webdbDate2readableDate(getValue("webdb_create"));
- }
- else if (field.equals("description_parsed"))
- returnField = getDescriptionParsed();
- else if (field.equals("description_sentence"))
- returnField = getDescriptionSentence();
- else if (field.equals("content_data_parsed"))
- returnField = getContentDataParsed();
- else
- return super.getValue(field);