{
return;
}
super.start();
jResultSet jrs = null;
String strSQL = null;
try
{
//---------------------------------------------create rank
strSQL =
"SELECT vc_uuid,vc_name,vc_description "
+ " FROM "
+ getSchemaContext().getTableName(SchemaContext.SCHEMA_RANK);
jrs = jStatement.executeQuery(getStore(), strSQL);
int sizeRank = jrs.getRowCount();
for (int i = 1; i <= sizeRank; ++i)
{
jrs.absolute(i);
ranks.put(
jrs.getString("vc_uuid"),
new WorkflowRankImpl(
jrs.getString("vc_uuid"),
jrs.getString("vc_name"),
jrs.getString("vc_description")));
}
jrs.release();
//---------------------------------------------create category
strSQL =
"SELECT vc_uuid,vc_name,vc_description "
+ " FROM "
+ getSchemaContext().getTableName(SchemaContext.SCHEMA_CATEGORY);
jrs = jStatement.executeQuery(getStore(), strSQL);
int sizeCategory = jrs.getRowCount();
for (int i = 1; i <= sizeCategory; ++i)
{
jrs.absolute(i);
categories.put(
jrs.getString("vc_uuid"),
new WorkflowCategoryImpl(
jrs.getString("vc_uuid"),
jrs.getString("vc_name"),
jrs.getString("vc_description")));
}
jrs.release();
//---------------------------------------------create role
strSQL =
"SELECT vc_uuid,vc_name,vc_description "
+ " FROM "
+ getSchemaContext().getTableName(SchemaContext.SCHEMA_ROLE);
jrs = jStatement.executeQuery(getStore(), strSQL);
int sizeRole = jrs.getRowCount();
for (int i = 1; i <= sizeRole; ++i)
{
jrs.absolute(i);
createRole(
jrs.getString("vc_uuid"),
jrs.getString("vc_name"),
jrs.getString("vc_description"));
}
jrs.release();
//---------------------------------------------create users
strSQL =
"SELECT vc_uuid,vc_name,vc_password,vc_fullname,vc_description,vc_rankid "
+ " "
+ " FROM "
+ getSchemaContext().getTableName(SchemaContext.SCHEMA_USER);
jrs = jStatement.executeQuery(getStore(), strSQL);
int sizeUser = jrs.getRowCount();
WorkflowParticipant participant = null;
for (int i = 1; i <= sizeUser; ++i)
{
jrs.absolute(i);
participant =
createParticipant(
jrs.getString("vc_uuid"),
jrs.getString("vc_name"),
jrs.getString("vc_password"),
jrs.getString("vc_fullname"),
jrs.getString("vc_description"));
participant.setRank((WorkflowRank) ranks.get(jrs.getString("vc_rankid")));
}
jrs.release();
//---------------------------------------------set user administrator
strSQL =
"SELECT vc_userid,vc_packageId "
+ " "
+ " FROM "+ getSchemaContext().getTableName(SchemaContext.SCHEMA_ADMIN);
jrs = jStatement.executeQuery(getStore(), strSQL);
int sizeAdmin = jrs.getRowCount();
for (int i = 1; i <= sizeAdmin; ++i)
{
jrs.absolute(i);
WorkflowParticipantImpl participantImpl=(WorkflowParticipantImpl)this.findParticipant(jrs.getString("vc_userid"));
if("all".equalsIgnoreCase(jrs.getString("vc_packageId")))
{
participantImpl.setSuperAdministrator(true);
}
else
{
participantImpl.addPackage(jrs.getString("vc_packageId"));
}
}
jrs.release();
//---------------------------------------------create departments
genDepartmentTree(null);
//---------------------------------------------create groups
genGroupTree(null);
//---------------------------------------------create user group relation
strSQL =
"SELECT vc_userid,vc_groupid FROM "
+ getSchemaContext().getTableName(SchemaContext.SCHEMA_USER_GROUP);
jrs = jStatement.executeQuery(getStore(), strSQL);
int sizeUserGroup = jrs.getRowCount();
for (int i = 1; i <= sizeUserGroup; ++i)
{
jrs.absolute(i);
String groupid = jrs.getString("vc_groupid");
String userid = jrs.getString("vc_userid");
WorkflowGroup workflowGroup = findGroup(groupid);
WorkflowParticipant workflowUser = findParticipant(userid);
workflowGroup.addPaticipant(workflowUser);
}
jrs.release();
//---------------------------------------------create user department relation
strSQL =
"SELECT vc_userid,vc_departmenetid FROM "
+ getSchemaContext().getTableName(SchemaContext.SCHEMA_USER_DEPARTMENT);
jrs = jStatement.executeQuery(getStore(), strSQL);
int sizeUserDept = jrs.getRowCount();
for (int i = 1; i <= sizeUserDept; ++i)
{
jrs.absolute(i);
String deptid = jrs.getString("vc_departmenetid");
String userid = jrs.getString("vc_userid");
WorkflowDepartment workflowDept = findDepartment(deptid);
WorkflowParticipant workflowUser = findParticipant(userid);
workflowDept.addPaticipant(workflowUser);
}
jrs.release();
//---------------------------------------------create user role relation
strSQL =
"SELECT vc_userid,vc_roleid FROM "
+ getSchemaContext().getTableName(SchemaContext.SCHEMA_USER_ROLE);
jrs = jStatement.executeQuery(getStore(), strSQL);
int sizeUserRole = jrs.getRowCount();
for (int i = 1; i <= sizeUserRole; ++i)
{
jrs.absolute(i);
String roleid = jrs.getString("vc_roleid");
String userid = jrs.getString("vc_userid");
WorkflowRole workflowRole = findRole(roleid);
WorkflowParticipant workflowUser = findParticipant(userid);
workflowRole.addPaticipant(workflowUser);
}
jrs.release();
}
catch (SQLException sqlex)
{
throw new WorkflowException(sqlex);