use of com.alibaba.cobar.manager.dataobject.xml.UserDO in project cobar by alibaba.
the class ForbiddenScreen method handleRequestInternal.
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
UserDO user = (UserDO) request.getSession().getAttribute("user");
String lastUrl = request.getHeader("Referer");
return new ModelAndView("forbidden", new FluenceHashMap<String, Object>().putKeyValue("user", user).putKeyValue("lastUrl", lastUrl));
}
use of com.alibaba.cobar.manager.dataobject.xml.UserDO in project cobar by alibaba.
the class MClusterListScreen method handleRequestInternal.
@SuppressWarnings("unchecked")
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
UserDO user = (UserDO) request.getSession().getAttribute("user");
List<ClusterDO> list = xmlAccesser.getClusterDAO().listAllCluster();
List<Map<String, Object>> clusterList = new ArrayList<Map<String, Object>>();
ListSortUtil.sortClusterBySortId(list);
PropertyUtilsBean util = new PropertyUtilsBean();
for (ClusterDO e : list) {
int count = xmlAccesser.getCobarDAO().getCobarList(e.getId(), ConstantDefine.ACTIVE).size();
count += xmlAccesser.getCobarDAO().getCobarList(e.getId(), ConstantDefine.IN_ACTIVE).size();
Map<String, Object> map;
try {
map = util.describe(e);
} catch (Exception ex) {
throw new RuntimeException(ex);
}
map.remove("class");
map.remove("name");
map.remove("deployDesc");
map.put("name", CobarStringUtil.htmlEscapedString(e.getName()));
map.put("deployContact", CobarStringUtil.htmlEscapedString(e.getDeployContact()));
map.put("cobarNum", count);
clusterList.add(map);
}
return new ModelAndView("m_clusterList", new FluenceHashMap<String, Object>().putKeyValue("clusterList", clusterList).putKeyValue("user", user));
}
use of com.alibaba.cobar.manager.dataobject.xml.UserDO in project cobar by alibaba.
the class MPropertyListScreen method handleRequestInternal.
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
UserDO user = (UserDO) request.getSession().getAttribute("user");
List<Integer> pList = xmlAccesser.getPropertyDAO().getProperty().getStopTimes();
return new ModelAndView("m_propertyList", new FluenceHashMap<String, Object>().putKeyValue("user", user).putKeyValue("pList", pList));
}
use of com.alibaba.cobar.manager.dataobject.xml.UserDO in project cobar by alibaba.
the class UserDAOImple method read.
private boolean read() {
FileInputStream is = null;
lock.lock();
try {
map.clear();
is = new FileInputStream(xmlPath);
xpp.setInput(is, "UTF-8");
while (!(xpp.getEventType() == XmlPullParser.END_TAG && "users".equals(xpp.getName()))) {
if (xpp.getEventType() == XmlPullParser.START_TAG && "user".equals(xpp.getName())) {
UserDO user = read(xpp);
if (null == user) {
throw new XmlPullParserException("User read error");
}
maxId = (maxId < user.getId()) ? user.getId() : maxId;
map.put(user.getId(), user);
}
xpp.next();
}
is.close();
return true;
} catch (FileNotFoundException e) {
logger.error(e.getMessage(), e);
} catch (XmlPullParserException e) {
logger.error(e.getMessage(), e);
} catch (IOException e) {
logger.error(e.getMessage(), e);
} finally {
maxId = maxId < 0 ? 0 : maxId;
lock.unlock();
}
if (null != is) {
try {
is.close();
} catch (IOException e) {
logger.error(e.getMessage(), e);
}
}
return false;
}
use of com.alibaba.cobar.manager.dataobject.xml.UserDO in project cobar by alibaba.
the class UserDAOImple method checkName.
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public boolean checkName(String username) {
Iterator it = map.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<Long, UserDO> entry = (Entry<Long, UserDO>) it.next();
UserDO user = entry.getValue();
if (username.equals(user.getUsername())) {
return false;
}
}
return true;
}
Aggregations