Update of
/var/cvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/util
In directory
james.mmbase.org:/tmp/cvs-serv24485/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/util
Modified Files:
NewsletterUtil.java CloneUtil.java DateUtil.java
NewsletterBounceUtil.java NewsletterSubscriptionUtil.java
POConvertUtils.java NewsletterPublicationUtil.java
NewsletterTermUtil.java
Log Message:
CMSC-1091 improve code style.
See also:
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/util
See also: http://www.mmbase.org/jira/browse/CMSC-1091
Index: NewsletterUtil.java
===================================================================
RCS file:
/var/cvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/util/NewsletterUtil.java,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -b -r1.40 -r1.41
--- NewsletterUtil.java 1 Aug 2008 02:16:58 -0000 1.40
+++ NewsletterUtil.java 14 Oct 2008 11:22:44 -0000 1.41
@@ -160,7 +160,7 @@
return (null);
}
- public static List<ContentElement> getArticlesByNewsletter(int
itemNumber,String termNumbers, int offset, int elementsPerPage, String orderBy,
String direction) {
+ public static List<ContentElement> getArticlesByNewsletter(int itemNumber,
String termNumbers, int offset, int elementsPerPage, String orderBy, String
direction) {
String[] numbers = termNumbers.split(",");
SortedSet<Integer> sort = new TreeSet<Integer>();
@@ -170,7 +170,7 @@
if (sort.size() == 0) {
return (null);
}
- return getArticles(itemNumber,offset, elementsPerPage, orderBy,
direction, sort);
+ return getArticles(itemNumber, offset, elementsPerPage, orderBy,
direction, sort);
}
public static List<ContentElement> getArticlesByNewsletter(int
newsletterNumber, int offset, int elementsPerPage, String orderBy, String
direction) {
@@ -209,22 +209,21 @@
}
- public static List<ContentElement> getArticles(int newsletterNumber,int
offset, int elementsPerPage, String orderBy, String direction,
SortedSet<Integer> sort) {
+ public static List<ContentElement> getArticles(int newsletterNumber, int
offset, int elementsPerPage, String orderBy, String direction,
SortedSet<Integer> sort) {
List<ContentElement> articles = new ArrayList<ContentElement>();
- List<Node> relatedArticles =
getArticles(newsletterNumber,sort,orderBy,direction);
- if(relatedArticles == null) {
+ List<Node> relatedArticles = getArticles(newsletterNumber, sort,
orderBy, direction);
+ if (relatedArticles == null) {
return null;
}
- if(relatedArticles.size() > offset) {
- int totalCount = 0 ;
- if(offset+elementsPerPage >= relatedArticles.size()) {
+ if (relatedArticles.size() > offset) {
+ int totalCount = 0;
+ if (offset + elementsPerPage >= relatedArticles.size()) {
totalCount = relatedArticles.size();
+ } else {
+ totalCount = offset + elementsPerPage;
}
- else {
- totalCount = offset+elementsPerPage;
- }
- for(int i = offset ; i < totalCount ; i++) {
+ for (int i = offset; i < totalCount; i++) {
Node articleNode = relatedArticles.get(i);
ContentElement element = MMBaseNodeMapper.copyNode(articleNode,
ContentElement.class);
articles.add(element);
@@ -233,13 +232,14 @@
return (articles);
}
- public static int countArticles(int newsletterNumber,SortedSet<Integer>
sort) {
- List<Node> articles = getArticles(newsletterNumber,sort,null,null);
- return articles == null?0:articles.size();
+ public static int countArticles(int newsletterNumber, SortedSet<Integer>
sort) {
+
+ List<Node> articles = getArticles(newsletterNumber, sort, null, null);
+ return articles == null ? 0 : articles.size();
}
- public static List<Node> getArticles(int
newsletterNumber,SortedSet<Integer> sort,String orderBy, String direction){
+ public static List<Node> getArticles(int newsletterNumber,
SortedSet<Integer> sort, String orderBy, String direction) {
Cloud cloud = CloudProviderFactory.getCloudProvider().getCloud();
NodeManager articleNodeManager = cloud.getNodeManager("article");
@@ -266,15 +266,15 @@
List<Node> articles = new ArrayList<Node>();
- if(articleNodes != null ){
- for(int i = 0 ; i < articleNodes.size() ; i++) {
+ if (articleNodes != null) {
+ for (int i = 0; i < articleNodes.size(); i++) {
Node article = articleNodes.getNode(i);
- if(termRelatedArticles == null){
+ if (termRelatedArticles == null) {
return null;
}
- for(int j = 0 ; j < termRelatedArticles.size() ; j++) {
+ for (int j = 0; j < termRelatedArticles.size(); j++) {
Node termRelatedArticle = termRelatedArticles.getNode(j);
- if(termRelatedArticle.getNumber() == article.getNumber()) {
+ if (termRelatedArticle.getNumber() == article.getNumber()) {
articles.add(article);
break;
}
@@ -289,11 +289,12 @@
Cloud cloud = CloudProviderFactory.getCloudProvider().getCloud();
NodeManager articleNodeManager = cloud.getNodeManager("article");
Node newsletterNode = cloud.getNode(number);
- int count =
newsletterNode.countRelatedNodes(articleNodeManager,"newslettercontent",
"source");
+ int count = newsletterNode.countRelatedNodes(articleNodeManager,
"newslettercontent", "source");
return count;
}
- public static int countArticlesByNewsletter(int itemNumber,String
termNumbers) {
+
+ public static int countArticlesByNewsletter(int itemNumber, String
termNumbers) {
String[] numbers = termNumbers.split(",");
SortedSet<Integer> sort = new TreeSet<Integer>();
@@ -303,7 +304,7 @@
if (sort.size() == 0) {
return (0);
}
- return countArticles(itemNumber,sort);
+ return countArticles(itemNumber, sort);
}
public static int countArticlesByNewsletter(int newsletterNumber) {
@@ -490,34 +491,33 @@
public static void addScheduleForNewsletter(Node newsletterNode) {
NodeManager scheduleNodeManager =
newsletterNode.getCloud().getNodeManager("schedule");
- NodeList schedules
=SearchUtil.findRelatedOrderedNodeList(newsletterNode, "schedule", "posrel",
"createdatetime","DOWN");
- if(schedules.size() == 0) {
- addScheduleNode(newsletterNode,scheduleNodeManager);
- }
- else {
+ NodeList schedules =
SearchUtil.findRelatedOrderedNodeList(newsletterNode, "schedule", "posrel",
"createdatetime", "DOWN");
+ if (schedules.size() == 0) {
+ addScheduleNode(newsletterNode, scheduleNodeManager);
+ } else {
Node firstScheduleNode = schedules.getNode(0);
-
if(firstScheduleNode.getStringValue("expression").equals(newsletterNode.getStringValue("schedule"))){
+ if
(firstScheduleNode.getStringValue("expression").equals(newsletterNode.getStringValue("schedule")))
{
return;
}
- for(int i = 0; i < schedules.size(); i ++) {
+ for (int i = 0; i < schedules.size(); i++) {
Node scheduleNode = schedules.getNode(i);
-
if(scheduleNode.getStringValue("expression").equals(newsletterNode.getStringValue("schedule")))
{
+ if
(scheduleNode.getStringValue("expression").equals(newsletterNode.getStringValue("schedule")))
{
scheduleNode.setLongValue("createdatetime",
System.currentTimeMillis());
scheduleNode.commit();
return;
}
}
- addScheduleNode(newsletterNode,scheduleNodeManager);
+ addScheduleNode(newsletterNode, scheduleNodeManager);
}
}
public static void addScheduleNode(Node newsletterNode, NodeManager
scheduleNodeManager) {
- if(StringUtils.isEmpty(newsletterNode.getStringValue("schedule"))) {
+ if (StringUtils.isEmpty(newsletterNode.getStringValue("schedule"))) {
return;
}
Node scheduleNode = scheduleNodeManager.createNode();
-
scheduleNode.setStringValue("expression",newsletterNode.getStringValue("schedule"));
- scheduleNode.setLongValue("createdatetime",System.currentTimeMillis());
+ scheduleNode.setStringValue("expression",
newsletterNode.getStringValue("schedule"));
+ scheduleNode.setLongValue("createdatetime", System.currentTimeMillis());
scheduleNode.commit();
RelationUtil.createRelation(newsletterNode, scheduleNode, "posrel");
}
@@ -526,8 +526,8 @@
List<Schedule> schedules = new ArrayList<Schedule>();
Cloud cloud = CloudProviderFactory.getCloudProvider().getCloud();
Node newsletterNode = cloud.getNode(id);
- NodeList scheduleList
=SearchUtil.findRelatedOrderedNodeList(newsletterNode, "schedule", "posrel",
"createdatetime","DOWN");
- for(int i = 1 ; i < scheduleList.size() ;i++) {
+ NodeList scheduleList =
SearchUtil.findRelatedOrderedNodeList(newsletterNode, "schedule", "posrel",
"createdatetime", "DOWN");
+ for (int i = 1; i < scheduleList.size(); i++) {
Node scheduleNode = scheduleList.getNode(i);
Schedule schedule = new Schedule();
schedule.setId(scheduleNode.getIntValue("number"));
@@ -537,40 +537,37 @@
}
return schedules;
}
- public static String getScheduleMessageByExpression(String expression){
- if(StringUtils.isEmpty(expression)) {
+
+ public static String getScheduleMessageByExpression(String expression) {
+ if (StringUtils.isEmpty(expression)) {
return "";
}
StringBuilder scheduleMessage = null;
ResourceBundle rb = ResourceBundle.getBundle("cmsc-calendar");
String[] expressions = expression.split("\\|");
String type;
- if(expressions == null || expressions.length ==0) {
+ if (expressions == null || expressions.length == 0) {
return null;
}
scheduleMessage = new StringBuilder();
type = expressions[0];
- if(type.equals("1")) {
- scheduleMessage.append(rb.getString("calendar.once")+",");
+ if (type.equals("1")) {
+ scheduleMessage.append(rb.getString("calendar.once") + ",");
scheduleMessage.append(rb.getString("calendar.start.datetime"));
scheduleMessage.append(expressions[1]).append("
").append(expressions[2]).append(":").append(expressions[3]);
- }
- else if(type.equals("2")) {
- scheduleMessage.append(rb.getString("calendar.daily")+",");
+ } else if (type.equals("2")) {
+ scheduleMessage.append(rb.getString("calendar.daily") + ",");
scheduleMessage.append(rb.getString("calendar.start.datetime"));
scheduleMessage.append(expressions[1]).append("
").append(expressions[2]).append(":").append(expressions[3]);
scheduleMessage.append("<br/>");
- if(expressions[4].equals("0")) {
+ if (expressions[4].equals("0")) {
scheduleMessage.append(rb.getString("calendar.approach.interval.pre")).append(rb.getString("calendar.approach.interval.day"));
- }
- else if(expressions[4].equals("1")){
+ } else if (expressions[4].equals("1")) {
scheduleMessage.append(rb.getString("calendar.approach.interval.pre")).append(rb.getString("calendar.approach.weekday"));
- }
- else if(expressions[4].equals("2")) {
+ } else if (expressions[4].equals("2")) {
scheduleMessage.append(rb.getString("calendar.approach.interval.pre")).append("
").append(expressions[5]).append("
").append(rb.getString("calendar.approach.interval.day"));
}
- }
- else if(type.equals("3")) {
+ } else if (type.equals("3")) {
scheduleMessage.append(rb.getString("calendar.weekly")).append(",").append(rb.getString("calendar.start.datetime"));
scheduleMessage.append(expressions[1]).append(":").append(expressions[2]);
scheduleMessage.append("<br/>").append(rb.getString("calendar.approach.interval.pre")).append(expressions[3]).append(rb.getString("calendar.approach.interval.week"));
@@ -594,105 +591,82 @@
tempWeek += rb.getString("calendar.week.sunday") + ",";
}
}
- if(StringUtils.isNotEmpty(tempWeek)){
- if(tempWeek.endsWith(",")){
- tempWeek = tempWeek.substring(0,tempWeek.length()-1) ;
+ if (StringUtils.isNotEmpty(tempWeek)) {
+ if (tempWeek.endsWith(",")) {
+ tempWeek = tempWeek.substring(0, tempWeek.length() - 1);
}
}
scheduleMessage.append("<br/>").append(rb.getString("calendar.approach.interval.week")).append(":").append(tempWeek);
- }
- else {
+ } else {
scheduleMessage.append(rb.getString("calendar.monthly")).append(",").append(rb.getString("calendar.start.datetime")).append(expressions[1]).append(":").append(expressions[2]);
String months = "";
- if(expressions[3].equals("0")) {
+ if (expressions[3].equals("0")) {
scheduleMessage.append("<br/>").append(rb.getString("calendar.approach.interval.pre")).append("
").append(expressions[4]).append("
").append(rb.getString("calendar.approach.interval.day"));
months = expressions[5];
- }
- else if(expressions[3].equals("1")) {
+ } else if (expressions[3].equals("1")) {
scheduleMessage.append("<br/>").append(rb.getString("calendar.week"));
- if(expressions[4].equals("1")) {
+ if (expressions[4].equals("1")) {
scheduleMessage.append("
").append(rb.getString("calendar.which.week.first")).append("
").append(rb.getString("calendar.approach.interval.week")).append(",");
- }
- else if (expressions[4].equals("2")) {
+ } else if (expressions[4].equals("2")) {
scheduleMessage.append("
").append(rb.getString("calendar.which.week.second")).append("
").append(rb.getString("calendar.approach.interval.week")).append(",");
- }
- else if (expressions[4].equals("3")) {
+ } else if (expressions[4].equals("3")) {
scheduleMessage.append("
").append(rb.getString("calendar.which.week.third")).append("
").append(rb.getString("calendar.approach.interval.week")).append(",");
- }
- else if (expressions[4].equals("4")) {
+ } else if (expressions[4].equals("4")) {
scheduleMessage.append("
").append(rb.getString("calendar.which.week.forth")).append("
").append(rb.getString("calendar.approach.interval.week")).append(",");
- }
- else if (expressions[4].equals("5")) {
+ } else if (expressions[4].equals("5")) {
scheduleMessage.append("
").append(rb.getString("calendar.which.week.last")).append("
").append(rb.getString("calendar.approach.interval.week")).append(",");
}
- if(expressions[5].equals("1")) {
+ if (expressions[5].equals("1")) {
scheduleMessage.append("
").append(rb.getString("calendar.week.monday")).append(".");
- }
- else if (expressions[5].equals("2")) {
+ } else if (expressions[5].equals("2")) {
scheduleMessage.append("
").append(rb.getString("calendar.week.tuesday")).append(".");
- }
- else if (expressions[5].equals("3")) {
+ } else if (expressions[5].equals("3")) {
scheduleMessage.append("
").append(rb.getString("calendar.week.wednesday")).append(".");
- }
- else if (expressions[5].equals("4")) {
+ } else if (expressions[5].equals("4")) {
scheduleMessage.append("
").append(rb.getString("calendar.week.thursday")).append(".");
- }
- else if (expressions[5].equals("5")) {
+ } else if (expressions[5].equals("5")) {
scheduleMessage.append("
").append(rb.getString("calendar.week.friday")).append(".");
- }
- else if (expressions[5].equals("6")) {
+ } else if (expressions[5].equals("6")) {
scheduleMessage.append("
").append(rb.getString("calendar.week.saturday")).append(".");
- }
- else if (expressions[5].equals("7")) {
+ } else if (expressions[5].equals("7")) {
scheduleMessage.append("
").append(rb.getString("calendar.week.sunday")).append(".");
}
months = expressions[6];
}
String temp = "";
- for(int i = 0 ; i < months.length();i++) {
- String month = months.substring(i,i+1);
- if(month.equals("0")) {
- temp += rb.getString("calendar.month.january")+",";
- }
- else if(month.equals("1")) {
- temp += rb.getString("calendar.month.february")+",";
- }
- else if(month.equals("2")) {
- temp += rb.getString("calendar.month.march")+",";
- }
- else if(month.equals("3")) {
- temp += rb.getString("calendar.month.april")+",";
- }
- else if(month.equals("4")) {
- temp += rb.getString("calendar.month.may")+",";
- }
- else if(month.equals("5")) {
- temp += rb.getString("calendar.month.june")+",";
- }
- else if(month.equals("6")) {
- temp += rb.getString("calendar.month.july")+",";
- }
- else if(month.equals("7")) {
- temp += rb.getString("calendar.month.august")+",";
- }
- else if(month.equals("8")) {
- temp += rb.getString("calendar.month.september")+",";
- }
- else if(month.equals("9")) {
- temp += rb.getString("calendar.month.october")+",";
- }
- else if(month.equals("a")) {
- temp += rb.getString("calendar.month.november")+",";
- }
- else if(month.equals("b")) {
- temp += rb.getString("calendar.month.december")+",";
+ for (int i = 0; i < months.length(); i++) {
+ String month = months.substring(i, i + 1);
+ if (month.equals("0")) {
+ temp += rb.getString("calendar.month.january") + ",";
+ } else if (month.equals("1")) {
+ temp += rb.getString("calendar.month.february") + ",";
+ } else if (month.equals("2")) {
+ temp += rb.getString("calendar.month.march") + ",";
+ } else if (month.equals("3")) {
+ temp += rb.getString("calendar.month.april") + ",";
+ } else if (month.equals("4")) {
+ temp += rb.getString("calendar.month.may") + ",";
+ } else if (month.equals("5")) {
+ temp += rb.getString("calendar.month.june") + ",";
+ } else if (month.equals("6")) {
+ temp += rb.getString("calendar.month.july") + ",";
+ } else if (month.equals("7")) {
+ temp += rb.getString("calendar.month.august") + ",";
+ } else if (month.equals("8")) {
+ temp += rb.getString("calendar.month.september") + ",";
+ } else if (month.equals("9")) {
+ temp += rb.getString("calendar.month.october") + ",";
+ } else if (month.equals("a")) {
+ temp += rb.getString("calendar.month.november") + ",";
+ } else if (month.equals("b")) {
+ temp += rb.getString("calendar.month.december") + ",";
}
}
- if(StringUtils.isNotEmpty(temp)){
- if(temp.endsWith(",")){
- temp = temp.substring(0,temp.length()-1) ;
+ if (StringUtils.isNotEmpty(temp)) {
+ if (temp.endsWith(",")) {
+ temp = temp.substring(0, temp.length() - 1);
}
}
scheduleMessage.append("<br/>").append(rb.getString("calendar.month")).append("
").append(temp);
@@ -711,7 +685,7 @@
Cloud cloud = CloudProviderFactory.getCloudProvider().getCloud();
Node scheduleNode = cloud.getNode(scheduleId);
Node newsletterNode = SearchUtil.findRelatedNode(scheduleNode,
"newsletter", "posrel");
- if(newsletterNode != null) {
+ if (newsletterNode != null) {
newsletterNode.setStringValue("schedule",
scheduleNode.getStringValue("expression"));
newsletterNode.setStringValue("scheduledescription",
getScheduleMessageByExpression(scheduleNode.getStringValue("expression")));
newsletterNode.commit();
Index: CloneUtil.java
===================================================================
RCS file:
/var/cvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/util/CloneUtil.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- CloneUtil.java 4 May 2008 12:02:12 -0000 1.2
+++ CloneUtil.java 14 Oct 2008 11:22:44 -0000 1.3
@@ -23,7 +23,9 @@
public class CloneUtil {
- /** MMbase logging system */
+ /**
+ * MMbase logging system
+ */
private static Logger log =
Logging.getLoggerInstance(CloneUtil.class.getName());
public static void cloneAliasses(Node localNode, Node destNode) {
@@ -37,8 +39,7 @@
* Clone a node to a cloud, including any fields without keeping
* administrative information
*
- * @param localNode
- * the node to clone
+ * @param localNode the node to clone
* @return the newly created node in the other cloud
*/
public static Node cloneNode(Node localNode) {
@@ -96,12 +97,9 @@
/**
* cloneNodeField copies node fields from one node to an other
*
- * @param sourceNode
- * the source node
- * @param destinationNode
- * destination node
- * @param field
- * the field to clone
+ * @param sourceNode the source node
+ * @param destinationNode destination node
+ * @param field the field to clone
*/
public static void cloneNodeField(Node sourceNode, Node destinationNode,
Field field) {
String fieldName = field.getName();
@@ -145,8 +143,7 @@
/**
* Clone a node with all relations
*
- * @param localNode
- * the node to be cloned
+ * @param localNode the node to be cloned
* @return the cloned copy of localNode
*/
public static Node cloneNodeWithRelations(Node localNode) {
@@ -248,8 +245,7 @@
Relation rel = ri.nextRelation();
if (rel.getSource().getNumber() == localNode.getNumber()) {
cloneRelation(rel, newNode, rel.getDestination());
- }
- else {
+ } else {
if (rel.getDestination().getNumber() == localNode.getNumber()) {
cloneRelation(rel, rel.getSource(), newNode);
}
@@ -260,8 +256,7 @@
/**
* quick test to see if node is a relation by testing fieldnames
*
- * @param node
- * Possible relation
+ * @param node Possible relation
* @return <code>true</code> when relation fields present
*/
protected static boolean isRelation(Node node) {
Index: DateUtil.java
===================================================================
RCS file:
/var/cvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/util/DateUtil.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- DateUtil.java 22 Sep 2008 07:53:42 -0000 1.5
+++ DateUtil.java 14 Oct 2008 11:22:44 -0000 1.6
@@ -10,7 +10,6 @@
/**
* date Util class
- *
*/
public class DateUtil {
private static Log log = LogFactory.getLog(DateUtil.class);
@@ -20,7 +19,6 @@
*
* @param raw string object
* @return Date object
- *
*/
public static Date parser(String raw) {
Date date = null;
@@ -41,7 +39,6 @@
*
* @param date Date ojbect
* @return a String object
- *
*/
public static String parser(Date date) {
@@ -56,7 +53,6 @@
* @param value the value used to operate at
* @param mode m = month;w=week of year;d=date;
* @return a Date object
- *
*/
public static Date calculateDateByDuration(Date date, int value, String
mode) {
Calendar calender = new GregorianCalendar();
@@ -76,10 +72,9 @@
return calender.getTime();
}
+
/**
- *
* get current datetime by millins type
- *
*/
public static Date getCurrent() {
return new Date(System.currentTimeMillis());
Index: NewsletterBounceUtil.java
===================================================================
RCS file:
/var/cvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/util/NewsletterBounceUtil.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- NewsletterBounceUtil.java 4 Aug 2008 03:09:21 -0000 1.3
+++ NewsletterBounceUtil.java 14 Oct 2008 11:22:44 -0000 1.4
@@ -22,7 +22,7 @@
private static Log log = LogFactory.getLog(NewsletterBounceUtil.class);
- public static List<NewsletterBounce> getBounceRecord(int offset,int
pageSize){
+ public static List<NewsletterBounce> getBounceRecord(int offset, int
pageSize) {
List<NewsletterBounce> bounces = new ArrayList<NewsletterBounce>();
Cloud cloud = CloudProviderFactory.getCloudProvider().getCloud();
NodeManager bounceManager = cloud.getNodeManager("newsletterbounce");
@@ -37,43 +37,43 @@
public static int getTotalCount() {
Cloud cloud = CloudProviderFactory.getCloudProvider().getCloud();
NodeList bounces = SearchUtil.findNodeList(cloud, "newsletterbounce");
- if(bounces != null) {
+ if (bounces != null) {
return bounces.size();
}
return (0);
}
public static List<NewsletterBounce> convertNodeListToList(NodeList
bounceNodes) {
- if(bounceNodes == null || bounceNodes.size() <1){
+ if (bounceNodes == null || bounceNodes.size() < 1) {
return null;
}
List<NewsletterBounce> bounces = new ArrayList<NewsletterBounce>();
- for(int i = 0 ; i < bounceNodes.size() ; i++) {
+ for (int i = 0; i < bounceNodes.size(); i++) {
Node bounceNode = bounceNodes.getNode(i);
- if(bounceNode == null){
+ if (bounceNode == null) {
continue;
}
NewsletterBounce bounce = new NewsletterBounce();
- copyProperties(bounceNode,bounce);
+ copyProperties(bounceNode, bounce);
bounces.add(bounce);
}
return bounces;
}
- public static void copyProperties(Node srcBounceNode,NewsletterBounce
desBounce){
+ public static void copyProperties(Node srcBounceNode, NewsletterBounce
desBounce) {
Cloud cloud = CloudProviderFactory.getCloudProvider().getCloud();
desBounce.setId(srcBounceNode.getNumber());
desBounce.setNewsletterId(srcBounceNode.getIntValue("newsletter"));
desBounce.setUserId(srcBounceNode.getIntValue("userid"));
- if(srcBounceNode.getIntValue("newsletter") > 0){
+ if (srcBounceNode.getIntValue("newsletter") > 0) {
Node publicationNode =
cloud.getNode(srcBounceNode.getIntValue("newsletter"));
desBounce.setNewsLetterTitle(publicationNode.getStringValue("title"));
}
- if(srcBounceNode.getIntValue("userid") > 0 ){
+ if (srcBounceNode.getIntValue("userid") > 0) {
String userName =
CommunityModuleAdapter.getUserNameByAuthenticationId(srcBounceNode.getIntValue("userid"));
- if(userName != null){
+ if (userName != null) {
desBounce.setUserName(userName);
}
}
@@ -83,11 +83,11 @@
}
- public static NewsletterBounce getNewsletterBounce(int number){
+ public static NewsletterBounce getNewsletterBounce(int number) {
Cloud cloud = CloudProviderFactory.getCloudProvider().getCloud();
Node bounceNode = cloud.getNode(number);
NewsletterBounce bounce = new NewsletterBounce();
- copyProperties(bounceNode,bounce);
+ copyProperties(bounceNode, bounce);
return bounce;
}
}
Index: NewsletterSubscriptionUtil.java
===================================================================
RCS file:
/var/cvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/util/NewsletterSubscriptionUtil.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- NewsletterSubscriptionUtil.java 21 Jul 2008 09:48:02 -0000 1.29
+++ NewsletterSubscriptionUtil.java 14 Oct 2008 11:22:44 -0000 1.30
@@ -38,7 +38,7 @@
return (users);
}
- public static List<Integer > getStatusOptions() {
+ public static List<Integer> getStatusOptions() {
return (statusOptions);
}
Index: POConvertUtils.java
===================================================================
RCS file:
/var/cvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/util/POConvertUtils.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- POConvertUtils.java 29 Apr 2008 01:37:04 -0000 1.6
+++ POConvertUtils.java 14 Oct 2008 11:22:44 -0000 1.7
@@ -17,16 +17,16 @@
for (Method method : targetFields) {
String name = method.getName();
- if("setId".equals(name)){
+ if ("setId".equals(name)) {
BeanUtils.setProperty(target, "id", node.getNumber());
}
if (null != getNodeValue(node, name)) {
- String propertyName =
name.substring(3,4).toLowerCase()+name.substring(4, name.length());
+ String propertyName = name.substring(3, 4).toLowerCase() +
name.substring(4, name.length());
BeanUtils.setProperty(target, propertyName, getNodeValue(node,
name));
}
}
} catch (Exception e) {
- log.error("Error when convert node to pojo",e);
+ log.error("Error when convert node to pojo", e);
}
@@ -52,7 +52,7 @@
private String[] getPropertieNames(String methodName) {
methodName = methodName.substring(3, methodName.length());
- String[] names = new String[]{methodName.toLowerCase(),""};
+ String[] names = new String[]{methodName.toLowerCase(), ""};
StringBuffer buffer = new StringBuffer();
Index: NewsletterPublicationUtil.java
===================================================================
RCS file:
/var/cvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/util/NewsletterPublicationUtil.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- NewsletterPublicationUtil.java 6 May 2008 06:11:12 -0000 1.26
+++ NewsletterPublicationUtil.java 14 Oct 2008 11:22:44 -0000 1.27
@@ -15,14 +15,14 @@
public abstract class NewsletterPublicationUtil {
- private static void copyOtherRelations(Node newsletterNode, Node
publicationNode,boolean copyContent) {
- copyPageRelations(newsletterNode, publicationNode,copyContent);
+ private static void copyOtherRelations(Node newsletterNode, Node
publicationNode, boolean copyContent) {
+ copyPageRelations(newsletterNode, publicationNode, copyContent);
copyImageAndAttachmentRelations(newsletterNode, publicationNode);
}
- public static Node copyPageRelations(Node sourcePage, Node newPage,boolean
copyContent) {
+ public static Node copyPageRelations(Node sourcePage, Node newPage, boolean
copyContent) {
CloneUtil.cloneRelations(sourcePage, newPage, PagesUtil.LAYOUTREL,
PagesUtil.LAYOUT);
- if(copyContent) {
+ if (copyContent) {
PortletUtil.copyPortlets(sourcePage, newPage);
}
Node popupinfo = PagesUtil.getPopupinfo(sourcePage);
@@ -34,8 +34,8 @@
}
private static void copyImageAndAttachmentRelations(Node newsletterNode,
Node publicationNode) {
-
CloneUtil.cloneRelations(newsletterNode,publicationNode,"namedrel","images");
-
CloneUtil.cloneRelations(newsletterNode,publicationNode,"posrel","attachments");
+ CloneUtil.cloneRelations(newsletterNode, publicationNode, "namedrel",
"images");
+ CloneUtil.cloneRelations(newsletterNode, publicationNode, "posrel",
"attachments");
}
public static Node getNewsletterByPublicationNumber(int publicationNumber) {
@@ -53,12 +53,12 @@
if (publicationNode != null) {
String urlFragment = String.valueOf(publicationNode.getNumber());
publicationNode.setStringValue("urlfragment", urlFragment);
- publicationNode.setStringValue("publishdate","null");
+ publicationNode.setStringValue("publishdate", "null");
publicationNode.setStringValue("status",
Publication.STATUS.INITIAL.toString());
publicationNode.commit();
// copyContent(newsletterNode, publicationNode);
- copyOtherRelations(newsletterNode, publicationNode,copyContent);
+ copyOtherRelations(newsletterNode, publicationNode, copyContent);
NavigationUtil.appendChild(newsletterNode, publicationNode);
Node layoutNode = PagesUtil.getLayout(publicationNode);
if (copyContent == true) {
@@ -72,7 +72,7 @@
public static void createDefaultTerm(Node newsletterNode) {
- if(!hasDefaultTerm(newsletterNode)) {
+ if (!hasDefaultTerm(newsletterNode)) {
Node defaultTerm =
newsletterNode.getCloud().getNodeManager("term").createNode();
defaultTerm.setStringValue("name", "default");
defaultTerm.setStringValue("subject",
newsletterNode.getStringValue("title"));
@@ -85,9 +85,9 @@
NodeManager termNodeManager =
newsletterNode.getCloud().getNodeManager("term");
NodeList terms = newsletterNode.getRelatedNodes(termNodeManager);
boolean hasDefaultTerm = false;
- for(int i = 0 ; i < terms.size() ; i++) {
+ for (int i = 0; i < terms.size(); i++) {
Node term = terms.getNode(i);
- if(term.getStringValue("name") != null &&
term.getStringValue("name").equals("default")) {
+ if (term.getStringValue("name") != null &&
term.getStringValue("name").equals("default")) {
hasDefaultTerm = true;
break;
}
Index: NewsletterTermUtil.java
===================================================================
RCS file:
/var/cvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/util/NewsletterTermUtil.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- NewsletterTermUtil.java 22 Sep 2008 07:53:42 -0000 1.3
+++ NewsletterTermUtil.java 14 Oct 2008 11:22:44 -0000 1.4
@@ -26,7 +26,6 @@
* delete a term by it's number.
*
* @param termNumber term number
- *
*/
public static void deleteTerm(int termNumber) {
if (!getCloud().hasNode(termNumber)) {
@@ -45,7 +44,6 @@
* add a new term
*
* @param name new term name
- *
*/
public static void addTerm(String name) {
NodeManager termNodeManager = getCloud().getNodeManager("term");
@@ -80,6 +78,7 @@
termNode.setStringValue("name", name);
termNode.commit();
}
+
/**
* get a term node by it's number.
*
@@ -92,6 +91,7 @@
}
return getCloud().getNode(termNumber);
}
+
/**
* get results of term paging list
*
@@ -112,12 +112,12 @@
query.setOffset(offset);
return query.getList();
}
+
/**
- *
* calculate the count of terms by term's name.
+ *
* @param name term name
* @return the terms's count
- *
*/
public static int countTotalTerms(String name) {
int size = 0;
@@ -132,11 +132,12 @@
}
return size;
}
+
/**
* get cloud object
+ *
* @param no
* @return cloud object
- *
*/
public static Cloud getCloud() {
return CloudProviderFactory.getCloudProvider().getCloud();
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs