if (!FixAssetsProcessStatus.getRunning()) {
FixAssetsProcessStatus.startProgress();
FixAssetsProcessStatus.setDescription("task 8: check the working and live versions of tree entries for inconsistencies");
HibernateUtil.startTransaction();
try {
DotConnect db = new DotConnect();
//Tree Query (Child)
String query = fix2TreeQuery;
Logger.debug(CMSMaintenanceFactory.class, "Running query for tree: " + query);
db.setSQL(query);
List<Map<String, String>> treeChildren = db.getResults();
Logger.debug(CMSMaintenanceFactory.class, "Found " + treeChildren.size() + " Tree");
int total = treeChildren.size();
//Tree Query (Child)
query = fix3TreeQuery;
Logger.debug(CMSMaintenanceFactory.class,"Running query for tree: " + query);
db.setSQL(query);
List<HashMap<String, String>> treeParents = db.getResults();
Logger.debug(CMSMaintenanceFactory.class,"Found " + treeParents.size() + " Tree");
total += treeParents.size();
Logger.info(CMSMaintenanceFactory.class,"Total number of assets: " + total);
FixAssetsProcessStatus.setTotal(total);
long inodeInode;
long parentIdentifierInode;
String identifierInode;
List<HashMap<String, String>> versions;
HashMap<String, String> version;
String versionWorking;
String DbConnFalseBoolean = DbConnectionFactory.getDBFalse().trim().toLowerCase();
char DbConnFalseBooleanChar;
if (DbConnFalseBoolean.charAt(0) == '\'')
DbConnFalseBooleanChar = DbConnFalseBoolean.charAt(1);
else
DbConnFalseBooleanChar = DbConnFalseBoolean.charAt(0);
String inode;
//Check the tree entries that doesn't have a child o parent in the inode table
treeChildren.addAll(treeParents);
modifiedData=treeChildren;
getModifiedData();
Logger.info(CMSMaintenanceFactory.class,"Fixing " + treeChildren.size()+ " tree entries");
for (Map<String, String> tree : treeChildren)
{
Logger.debug(CMSMaintenanceFactory.class,"Running query: "+ fix4TreeQuery);
try
{
db.setSQL(fix4TreeQuery);
db.addParam(tree.get("child"));
db.addParam(tree.get("parent"));
db.addParam(tree.get("relation_type"));
db.getResults();
}
catch(Exception ex)
{
FixAssetsProcessStatus.addAError();
counter++;