simpleArticleOperationsMap = new HashMap();\r
\r
addSimpleArticleOperation(new ChangeArticleFieldOperation("newswire", "to_article_type", "0", "1", false));\r
- addSimpleArticleOperation(new SetArticleFieldOperation("unhide", "is_published", "1", false));\r
- addSimpleArticleOperation(new SetArticleFieldOperation("hide", "is_published", "0", false));\r
+ addSimpleArticleOperation(new ModifyArticleFieldOperation("unhide", "is_published", "1", false));\r
+ addSimpleArticleOperation(new ModifyArticleFieldOperation("hide", "is_published", "0", false));\r
\r
- addSimpleCommentOperation(new SetCommentFieldOperation("unhide", "is_published", "1"));\r
- addSimpleCommentOperation(new SetCommentFieldOperation("hide", "is_published", "0"));\r
+ addSimpleCommentOperation(new ModifyCommentFieldOperation("unhide", "is_published", "1"));\r
+ addSimpleCommentOperation(new ModifyCommentFieldOperation("hide", "is_published", "0"));\r
}\r
\r
public List simpleCommentOperations() {\r
anEntity.setValueForProperty("is_produced", "0");\r
\r
if (logOperation) {\r
- StringBuffer comment = new StringBuffer(anEntity.getValue("comment"));\r
+ StringBuffer comment = new StringBuffer();\r
+ try {\r
+ comment.append(StringRoutines.interpretAsString(anEntity.getValue("comment")));\r
+ }\r
+ catch (Throwable t) {\r
+ }\r
if (comment.length()>0 && comment.charAt(comment.length()-1)!='\n') {\r
comment.append('\n');\r
}\r
}\r
\r
protected boolean isAvailable(EntityComment aComment) {\r
+ return true;\r
+ }\r
+\r
+ protected void performModification(EntityAdapter aUser, EntityComment aComment) throws StorageObjectException {\r
+ aComment.setValueForProperty(field, value);\r
+ }\r
+ }\r
+\r
+ protected static class ModifyCommentFieldOperation extends CommentModifyingOperation {\r
+ private String field;\r
+ private String value;\r
+\r
+ public ModifyCommentFieldOperation(String aName, String aField, String aValue) {\r
+ super(aName);\r
+\r
+ field = aField;\r
+ value = aValue;\r
+ }\r
+\r
+ protected boolean isAvailable(EntityComment aComment) {\r
return aComment.getValue(field) == null || !aComment.getValue(field).equals(value);\r
}\r
\r
}\r
\r
protected boolean isAvailable(EntityContent anArticle) {\r
+ return true;\r
+ }\r
+\r
+ protected void performModification(EntityAdapter aUser, EntityContent anArticle) throws StorageObjectException {\r
+ anArticle.setValueForProperty(field, value);\r
+ }\r
+ }\r
+\r
+ protected static class ModifyArticleFieldOperation extends ArticleModifyingOperation {\r
+ private String field;\r
+ private String value;\r
+\r
+ public ModifyArticleFieldOperation(String aName, String aField, String aValue, boolean aLogOperation) {\r
+ super(aName, aLogOperation);\r
+\r
+ field = aField;\r
+ value = aValue;\r
+ }\r
+\r
+ protected boolean isAvailable(EntityContent anArticle) {\r
return anArticle.getValue(field) == null || !anArticle.getValue(field).equals(value);\r
}\r
\r
anArticle.setValueForProperty(field, newValue);\r
}\r
}\r
-}
\ No newline at end of file
+}\r