📄 messagepropsmanager.java
字号:
/*
* Copyright 2003-2006 the original author or authors.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.jdon.jivejdon.manager.message;
import java.util.ArrayList;
import java.util.Collection;
import org.apache.log4j.Logger;
import com.jdon.jivejdon.dao.util.ToolsUtil;
import com.jdon.jivejdon.model.Account;
import com.jdon.jivejdon.model.ForumMessage;
import com.jdon.jivejdon.model.Property;
/**
* Manage the properties of a ForumMessage
*
* @author banq(http://www.jdon.com)
*
*/
public class MessagePropsManager {
private final static Logger logger = Logger.getLogger(MessagePropsManager.class);
public void addPostIp(ForumMessage forumMessage){
Collection propertys = forumMessage.getPropertys();
Account poster = forumMessage.getAccount();
if (poster == null){
logger.error("poster is null" );
}
logger.debug("addPostIp IP=" + poster.getPostIP());
addProperty(propertys, ForumMessage.PROPERTY_IP, poster.getPostIP());
}
public void addModifier(ForumMessage forumMessage){
Collection propertys = forumMessage.getPropertys();
Account modifier = forumMessage.getAccount();
if (modifier == null){
logger.error("poster is null" );
}
logger.debug("addModifier MODIFIER=" + modifier.getRoleName());
long now = System.currentTimeMillis();
String saveDateTime = ToolsUtil.dateToMillis(now);
String displayDateTime = ToolsUtil.getDateTimeDisp(saveDateTime);
StringBuffer buffer = new StringBuffer();
buffer.append("[该贴被").append(modifier.getUsername());
buffer.append("于").append(displayDateTime).append("修改过]");
addProperty(propertys, ForumMessage.PROPERTY_MOD_DES, buffer.toString());
}
public void addProperty(Collection propertys, String propName, String propValue){
if (propertys == null){
propertys = new ArrayList();
}
logger.debug("propertys size=" + propertys.size());
Property property = new Property();
property.setName(propName);
property.setValue(propValue);
propertys.add(property);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -