* @param root
* @param createUser
*/
public FlowImpl(org.w3c.dom.Node root,String createUser){
this.createUser = createUser;
DataAccessFactory daf = DataAccessFactory.getInstance();
Node flowNode = XMLUtil.getSingleNode(root, "flow");
this.id = daf.createUUID(XMLUtil.getSingleNodeTextContent(flowNode, "id"));
this.name = XMLUtil.getSingleNodeTextContent(flowNode, "name");
List<org.w3c.dom.Node> statNodeList = XMLUtil.getNodes(flowNode, "stats/stat");
for(org.w3c.dom.Node statNode : statNodeList){
UUID statId = daf.createUUID(XMLUtil.getSingleNodeTextContent(statNode, "id"));
String statName = XMLUtil.getSingleNodeTextContent(statNode, "name");
StatImpl statImpl = new StatImpl(statId, this.id);
statImpl.setName(statName);
this.statMap.put(statId, statImpl);
}
List<org.w3c.dom.Node> actionNodeList = XMLUtil.getNodes(flowNode, "actions/action");
for(org.w3c.dom.Node actionNode : actionNodeList){
UUID actionId = daf.createUUID(XMLUtil.getSingleNodeTextContent(actionNode, "id"));
String actionName = XMLUtil.getSingleNodeTextContent(actionNode, "name");
UUID beginStatId = daf.createUUID(XMLUtil.getSingleNodeTextContent(actionNode, "startStatId"));
UUID endStatId = daf.createUUID(XMLUtil.getSingleNodeTextContent(actionNode, "endStatId"));
ActionImpl actionImpl = new ActionImpl(actionId, this.id);
actionImpl.setName(actionName);
actionImpl.setBeginStatId(beginStatId);
actionImpl.setEndStatId(endStatId);
this.actionMap.put(actionId, actionImpl);
}
List<org.w3c.dom.Node> roleNodeList = XMLUtil.getNodes(flowNode, "roles/role");
for(org.w3c.dom.Node roleNode : roleNodeList){
UUID roleId = daf.createUUID(XMLUtil.getSingleNodeTextContent(roleNode, "id"));
String roleName = XMLUtil.getSingleNodeTextContent(roleNode, "name");
RoleImpl roleImpl = new RoleImpl(roleId, this.id);
roleImpl.setName(roleName);
this.roleMap.put(roleId, roleImpl);
}
List<org.w3c.dom.Node> actionRoleNodeList = XMLUtil.getNodes(flowNode, "actionRoles/actionRole");
for(org.w3c.dom.Node actionRoleNode : actionRoleNodeList){
UUID actionId = daf.createUUID(XMLUtil.getSingleNodeTextContent(actionRoleNode, "actionId"));
UUID roleId = daf.createUUID(XMLUtil.getSingleNodeTextContent(actionRoleNode, "roleId"));
this.actionRoleSet.add(new ActionRole(actionId, roleId));
}
List<org.w3c.dom.Node> rightNodeList = XMLUtil.getNodes(flowNode, "rights/right");
for(org.w3c.dom.Node rightNode : rightNodeList){
String username = XMLUtil.getSingleNodeTextContent(rightNode, "username");
UUID roleId = daf.createUUID(XMLUtil.getSingleNodeTextContent(rightNode, "roleId"));
UUID templateId = daf.createUUID(XMLUtil.getSingleNodeTextContent(rightNode, "templateId"));
if (templateId == null) {
continue;
}
this.rightSet.add(new Right(username, templateId, roleId));
}