projects
/
mir.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
1.3 jvm compatibility fixes
[mir.git]
/
source
/
mircoders
/
entity
/
EntityContent.java
diff --git
a/source/mircoders/entity/EntityContent.java
b/source/mircoders/entity/EntityContent.java
index
09fc32e
..
96ab2dc
100755
(executable)
--- a/
source/mircoders/entity/EntityContent.java
+++ b/
source/mircoders/entity/EntityContent.java
@@
-30,40
+30,31
@@
package mircoders.entity;
package mircoders.entity;
-import mir.entity.AbstractEntity;
-import mir.log.LoggerWrapper;
-import mir.storage.StorageObjectFailure;
-import mircoders.storage.DatabaseContentToMedia;
-
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Map;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Map;
+import mir.entity.AbstractEntity;
+import mir.log.LoggerWrapper;
+import mir.storage.DatabaseFailure;
+import mircoders.storage.DatabaseContentToMedia;
+
/**
* this class implements mapping of one line of the database table content
* to a java object
*
/**
* this class implements mapping of one line of the database table content
* to a java object
*
- * @version $Id: EntityContent.java,v 1.19.2.
8 2005/01/09 20:37:10
zapata Exp $
+ * @version $Id: EntityContent.java,v 1.19.2.
12 2005/10/30 00:46:58
zapata Exp $
* @author mir-coders group
*
*/
public class EntityContent extends AbstractEntity {
* @author mir-coders group
*
*/
public class EntityContent extends AbstractEntity {
- // constructors
-
- public EntityContent()
- {
- super();
-
- logger = new LoggerWrapper("Entity.Content");
- }
-
/**
* set is_produced flag for the article
*/
/**
* set is_produced flag for the article
*/
- public void setProduced(boolean yesno) throws
StorageObject
Failure
+ public void setProduced(boolean yesno) throws
Database
Failure
{
String value = (yesno) ? "1":"0";
if (value.equals( getFieldValue("is_produced") )) return;
{
String value = (yesno) ? "1":"0";
if (value.equals( getFieldValue("is_produced") )) return;
@@
-71,19
+62,19
@@
public class EntityContent extends AbstractEntity {
Connection con=null;Statement stmt=null;
String sql = "update content set is_produced='" + value + "' where id='" + getId()+"'";
try {
Connection con=null;Statement stmt=null;
String sql = "update content set is_produced='" + value + "' where id='" + getId()+"'";
try {
- con =
storageObject
.obtainConnection();
+ con =
database
.obtainConnection();
/** todo should be preparedStatement: faster!! */
stmt = con.createStatement();
/** todo should be preparedStatement: faster!! */
stmt = con.createStatement();
-
storageObject
.executeUpdate(stmt,sql);
+
database
.executeUpdate(stmt,sql);
}
}
- catch (
StorageObject
Failure e) {
+ catch (
Database
Failure e) {
throw e;
}
catch (SQLException e) {
throw e;
}
catch (SQLException e) {
- throw new
StorageObject
Failure(e);
+ throw new
Database
Failure(e);
}
finally {
}
finally {
-
storageObject
.freeConnection(con,stmt);
+
database
.freeConnection(con,stmt);
}
}
}
}
@@
-92,9
+83,9
@@
public class EntityContent extends AbstractEntity {
*
* @param anArticleId
* @param aMediaId
*
* @param anArticleId
* @param aMediaId
- * @throws
StorageObject
Failure
+ * @throws
Database
Failure
*/
*/
- public void dettach(String anArticleId, String aMediaId) throws
StorageObject
Failure
+ public void dettach(String anArticleId, String aMediaId) throws
Database
Failure
{
if (aMediaId!=null){
DatabaseContentToMedia.getInstance().delete(anArticleId, aMediaId);
{
if (aMediaId!=null){
DatabaseContentToMedia.getInstance().delete(anArticleId, aMediaId);
@@
-107,14
+98,14
@@
public class EntityContent extends AbstractEntity {
* Attaches media to the article
*/
* Attaches media to the article
*/
- public void attach(String aMediaId) throws
StorageObject
Failure
+ public void attach(String aMediaId) throws
Database
Failure
{
if (aMediaId!=null) {
DatabaseContentToMedia.getInstance().addMedia(getId(),aMediaId);
setProduced(false);
}
else {
{
if (aMediaId!=null) {
DatabaseContentToMedia.getInstance().addMedia(getId(),aMediaId);
setProduced(false);
}
else {
-
logger
.error("EntityContent: attach without mid");
+
getLogger()
.error("EntityContent: attach without mid");
}
}
}
}