Package org.exoplatform.services.jcr.impl.backup.rdbms

Examples of org.exoplatform.services.jcr.impl.backup.rdbms.RestoreTableRule


         // ITEM table
         String dstTableName = "JCR_" + (multiDb ? "M" : "S") + "ITEM";
         String srcTableName = "JCR_" + (srcMultiDb ? "M" : "S") + "ITEM";

         RestoreTableRule restoreTableRule = new RestoreTableRule();
         restoreTableRule.setSrcContainerName(srcContainerName);
         restoreTableRule.setSrcMultiDb(srcMultiDb);
         restoreTableRule.setDstContainerName(containerName);
         restoreTableRule.setDstMultiDb(multiDb);
         restoreTableRule.setSrcTableName(srcTableName);

         if (multiDb)
         {
            if (!srcMultiDb)
            {
               // CONTAINER_NAME column index
               restoreTableRule.setDeleteColumnIndex(4);

               // ID and PARENT_ID column indexes
               Set<Integer> convertColumnIndex = new HashSet<Integer>();
               convertColumnIndex.add(0);
               convertColumnIndex.add(1);
               restoreTableRule.setConvertColumnIndex(convertColumnIndex);
            }
         }
         else
         {
            if (srcMultiDb)
            {
               // CONTAINER_NAME column index
               restoreTableRule.setNewColumnIndex(4);
               restoreTableRule.setNewColumnName("CONTAINER_NAME");
               restoreTableRule.setNewColumnType(Types.VARCHAR);

               // ID and PARENT_ID column indexes
               Set<Integer> convertColumnIndex = new HashSet<Integer>();
               convertColumnIndex.add(0);
               convertColumnIndex.add(1);
               restoreTableRule.setConvertColumnIndex(convertColumnIndex);
            }
            else
            {
               // ID and PARENT_ID and CONTAINER_NAME column indexes
               Set<Integer> convertColumnIndex = new HashSet<Integer>();
               convertColumnIndex.add(0);
               convertColumnIndex.add(1);
               convertColumnIndex.add(4);
               restoreTableRule.setConvertColumnIndex(convertColumnIndex);
            }
         }
         tables.put(dstTableName, restoreTableRule);

         // VALUE table
         dstTableName = "JCR_" + (multiDb ? "M" : "S") + "VALUE";
         srcTableName = "JCR_" + (srcMultiDb ? "M" : "S") + "VALUE";

         restoreTableRule = new RestoreTableRule();
         restoreTableRule.setSrcContainerName(srcContainerName);
         restoreTableRule.setSrcMultiDb(srcMultiDb);
         restoreTableRule.setDstContainerName(containerName);
         restoreTableRule.setDstMultiDb(multiDb);
         restoreTableRule.setSrcTableName(srcTableName);

         // auto increment ID column
         restoreTableRule.setSkipColumnIndex(0);

         if (!multiDb || !srcMultiDb)
         {
            // PROPERTY_ID column index
            Set<Integer> convertColumnIndex = new HashSet<Integer>();
            convertColumnIndex.add(3);
            restoreTableRule.setConvertColumnIndex(convertColumnIndex);
         }
         tables.put(dstTableName, restoreTableRule);

         // REF tables
         dstTableName = "JCR_" + (multiDb ? "M" : "S") + "REF";
         srcTableName = "JCR_" + (srcMultiDb ? "M" : "S") + "REF";

         restoreTableRule = new RestoreTableRule();
         restoreTableRule.setSrcContainerName(srcContainerName);
         restoreTableRule.setSrcMultiDb(srcMultiDb);
         restoreTableRule.setDstContainerName(containerName);
         restoreTableRule.setDstMultiDb(multiDb);
         restoreTableRule.setSrcTableName(srcTableName);

         if (!multiDb || !srcMultiDb)
         {
            // NODE_ID and PROPERTY_ID column indexes
            Set<Integer> convertColumnIndex = new HashSet<Integer>();
            convertColumnIndex.add(0);
            convertColumnIndex.add(1);
            restoreTableRule.setConvertColumnIndex(convertColumnIndex);
         }
         tables.put(dstTableName, restoreTableRule);

         DBCleaner dbCleaner = null;
         if (context.getObject(DataRestoreContext.DB_CLEANER) != null)
View Full Code Here


         // ITEM table
         String dstTableName = "JCR_" + (multiDb ? "M" : "S") + "ITEM";
         String srcTableName = "JCR_" + (srcMultiDb ? "M" : "S") + "ITEM";

         RestoreTableRule restoreTableRule = new RestoreTableRule();
         restoreTableRule.setSrcContainerName(srcContainerName);
         restoreTableRule.setSrcMultiDb(srcMultiDb);
         restoreTableRule.setDstContainerName(containerName);
         restoreTableRule.setDstMultiDb(multiDb);
         restoreTableRule.setContentFile(new File(storageDir, srcTableName + DBBackup.CONTENT_FILE_SUFFIX));
         restoreTableRule.setContentLenFile(new File(storageDir, srcTableName + DBBackup.CONTENT_LEN_FILE_SUFFIX));

         if (multiDb)
         {
            if (!srcMultiDb)
            {
               // CONTAINER_NAME column index
               restoreTableRule.setDeleteColumnIndex(4);

               // ID and PARENT_ID column indexes
               Set<Integer> convertColumnIndex = new HashSet<Integer>();
               convertColumnIndex.add(0);
               convertColumnIndex.add(1);
               restoreTableRule.setConvertColumnIndex(convertColumnIndex);
            }
         }
         else
         {
            if (srcMultiDb)
            {
               // CONTAINER_NAME column index
               restoreTableRule.setNewColumnIndex(4);
               restoreTableRule.setNewColumnName("CONTAINER_NAME");
               restoreTableRule.setNewColumnType(Types.VARCHAR);

               // ID and PARENT_ID column indexes
               Set<Integer> convertColumnIndex = new HashSet<Integer>();
               convertColumnIndex.add(0);
               convertColumnIndex.add(1);
               restoreTableRule.setConvertColumnIndex(convertColumnIndex);
            }
            else
            {
               // ID and PARENT_ID and CONTAINER_NAME column indexes
               Set<Integer> convertColumnIndex = new HashSet<Integer>();
               convertColumnIndex.add(0);
               convertColumnIndex.add(1);
               convertColumnIndex.add(4);
               restoreTableRule.setConvertColumnIndex(convertColumnIndex);
            }
         }
         tables.put(dstTableName, restoreTableRule);

         // VALUE table
         dstTableName = "JCR_" + (multiDb ? "M" : "S") + "VALUE";
         srcTableName = "JCR_" + (srcMultiDb ? "M" : "S") + "VALUE";

         restoreTableRule = new RestoreTableRule();
         restoreTableRule.setSrcContainerName(srcContainerName);
         restoreTableRule.setSrcMultiDb(srcMultiDb);
         restoreTableRule.setDstContainerName(containerName);
         restoreTableRule.setDstMultiDb(multiDb);
         restoreTableRule.setContentFile(new File(storageDir, srcTableName + DBBackup.CONTENT_FILE_SUFFIX));
         restoreTableRule.setContentLenFile(new File(storageDir, srcTableName + DBBackup.CONTENT_LEN_FILE_SUFFIX));

         // auto increment ID column
         restoreTableRule.setSkipColumnIndex(0);

         if (!multiDb || !srcMultiDb)
         {
            // PROPERTY_ID column index
            Set<Integer> convertColumnIndex = new HashSet<Integer>();
            convertColumnIndex.add(3);
            restoreTableRule.setConvertColumnIndex(convertColumnIndex);
         }
         tables.put(dstTableName, restoreTableRule);

         // REF tables
         dstTableName = "JCR_" + (multiDb ? "M" : "S") + "REF";
         srcTableName = "JCR_" + (srcMultiDb ? "M" : "S") + "REF";

         restoreTableRule = new RestoreTableRule();
         restoreTableRule.setSrcContainerName(srcContainerName);
         restoreTableRule.setSrcMultiDb(srcMultiDb);
         restoreTableRule.setDstContainerName(containerName);
         restoreTableRule.setDstMultiDb(multiDb);
         restoreTableRule.setContentFile(new File(storageDir, srcTableName + DBBackup.CONTENT_FILE_SUFFIX));
         restoreTableRule.setContentLenFile(new File(storageDir, srcTableName + DBBackup.CONTENT_LEN_FILE_SUFFIX));

         if (!multiDb || !srcMultiDb)
         {
            // NODE_ID and PROPERTY_ID column indexes
            Set<Integer> convertColumnIndex = new HashSet<Integer>();
            convertColumnIndex.add(0);
            convertColumnIndex.add(1);
            restoreTableRule.setConvertColumnIndex(convertColumnIndex);
         }
         tables.put(dstTableName, restoreTableRule);

         restorers.add(new DBRestore(storageDir, jdbcConn, tables, wsConfig, swapCleaner));
View Full Code Here

         // ITEM table
         String dstTableName = "JCR_" + (multiDb ? "M" : "S") + "ITEM";
         String srcTableName = "JCR_" + (srcMultiDb ? "M" : "S") + "ITEM";

         RestoreTableRule restoreTableRule = new RestoreTableRule();
         restoreTableRule.setSrcContainerName(srcContainerName);
         restoreTableRule.setSrcMultiDb(srcMultiDb);
         restoreTableRule.setDstContainerName(containerName);
         restoreTableRule.setDstMultiDb(multiDb);
         restoreTableRule.setSrcTableName(srcTableName);

         if (multiDb)
         {
            if (!srcMultiDb)
            {
               // CONTAINER_NAME column index
               restoreTableRule.setDeleteColumnIndex(4);

               // ID and PARENT_ID column indexes
               Set<Integer> convertColumnIndex = new HashSet<Integer>();
               convertColumnIndex.add(0);
               convertColumnIndex.add(1);
               restoreTableRule.setConvertColumnIndex(convertColumnIndex);
            }
         }
         else
         {
            if (srcMultiDb)
            {
               // CONTAINER_NAME column index
               restoreTableRule.setNewColumnIndex(4);
               restoreTableRule.setNewColumnName("CONTAINER_NAME");
               restoreTableRule.setNewColumnType(Types.VARCHAR);

               // ID and PARENT_ID column indexes
               Set<Integer> convertColumnIndex = new HashSet<Integer>();
               convertColumnIndex.add(0);
               convertColumnIndex.add(1);
               restoreTableRule.setConvertColumnIndex(convertColumnIndex);
            }
            else
            {
               // ID and PARENT_ID and CONTAINER_NAME column indexes
               Set<Integer> convertColumnIndex = new HashSet<Integer>();
               convertColumnIndex.add(0);
               convertColumnIndex.add(1);
               convertColumnIndex.add(4);
               restoreTableRule.setConvertColumnIndex(convertColumnIndex);
            }
         }
         tables.put(dstTableName, restoreTableRule);

         // VALUE table
         dstTableName = "JCR_" + (multiDb ? "M" : "S") + "VALUE";
         srcTableName = "JCR_" + (srcMultiDb ? "M" : "S") + "VALUE";

         restoreTableRule = new RestoreTableRule();
         restoreTableRule.setSrcContainerName(srcContainerName);
         restoreTableRule.setSrcMultiDb(srcMultiDb);
         restoreTableRule.setDstContainerName(containerName);
         restoreTableRule.setDstMultiDb(multiDb);
         restoreTableRule.setSrcTableName(srcTableName);

         // auto increment ID column
         restoreTableRule.setSkipColumnIndex(0);

         if (!multiDb || !srcMultiDb)
         {
            // PROPERTY_ID column index
            Set<Integer> convertColumnIndex = new HashSet<Integer>();
            convertColumnIndex.add(3);
            restoreTableRule.setConvertColumnIndex(convertColumnIndex);
         }
         tables.put(dstTableName, restoreTableRule);

         // REF tables
         dstTableName = "JCR_" + (multiDb ? "M" : "S") + "REF";
         srcTableName = "JCR_" + (srcMultiDb ? "M" : "S") + "REF";

         restoreTableRule = new RestoreTableRule();
         restoreTableRule.setSrcContainerName(srcContainerName);
         restoreTableRule.setSrcMultiDb(srcMultiDb);
         restoreTableRule.setDstContainerName(containerName);
         restoreTableRule.setDstMultiDb(multiDb);
         restoreTableRule.setSrcTableName(srcTableName);

         if (!multiDb || !srcMultiDb)
         {
            // NODE_ID and PROPERTY_ID column indexes
            Set<Integer> convertColumnIndex = new HashSet<Integer>();
            convertColumnIndex.add(0);
            convertColumnIndex.add(1);
            restoreTableRule.setConvertColumnIndex(convertColumnIndex);
         }
         tables.put(dstTableName, restoreTableRule);

         DBCleaner dbCleaner = null;
         if (context.getObject(DataRestoreContext.DB_CLEANER) != null)
View Full Code Here

         // ITEM table
         String dstTableName = "JCR_" + (multiDb ? "M" : "S") + "ITEM";
         String srcTableName = "JCR_" + (srcMultiDb ? "M" : "S") + "ITEM";

         RestoreTableRule restoreTableRule = new RestoreTableRule();
         restoreTableRule.setSrcContainerName(srcContainerName);
         restoreTableRule.setSrcMultiDb(srcMultiDb);
         restoreTableRule.setDstContainerName(containerName);
         restoreTableRule.setDstMultiDb(multiDb);
         restoreTableRule.setContentFile(new File(storageDir, srcTableName + DBBackup.CONTENT_FILE_SUFFIX));
         restoreTableRule.setContentLenFile(new File(storageDir, srcTableName + DBBackup.CONTENT_LEN_FILE_SUFFIX));

         if (multiDb)
         {
            if (!srcMultiDb)
            {
               // CONTAINER_NAME column index
               restoreTableRule.setDeleteColumnIndex(4);

               // ID and PARENT_ID column indexes
               Set<Integer> convertColumnIndex = new HashSet<Integer>();
               convertColumnIndex.add(0);
               convertColumnIndex.add(1);
               restoreTableRule.setConvertColumnIndex(convertColumnIndex);
            }
         }
         else
         {
            if (srcMultiDb)
            {
               // CONTAINER_NAME column index
               restoreTableRule.setNewColumnIndex(4);
               restoreTableRule.setNewColumnName("CONTAINER_NAME");
               restoreTableRule.setNewColumnType(Types.VARCHAR);

               // ID and PARENT_ID column indexes
               Set<Integer> convertColumnIndex = new HashSet<Integer>();
               convertColumnIndex.add(0);
               convertColumnIndex.add(1);
               restoreTableRule.setConvertColumnIndex(convertColumnIndex);
            }
            else
            {
               // ID and PARENT_ID and CONTAINER_NAME column indexes
               Set<Integer> convertColumnIndex = new HashSet<Integer>();
               convertColumnIndex.add(0);
               convertColumnIndex.add(1);
               convertColumnIndex.add(4);
               restoreTableRule.setConvertColumnIndex(convertColumnIndex);
            }
         }
         tables.put(dstTableName, restoreTableRule);

         // VALUE table
         dstTableName = "JCR_" + (multiDb ? "M" : "S") + "VALUE";
         srcTableName = "JCR_" + (srcMultiDb ? "M" : "S") + "VALUE";

         restoreTableRule = new RestoreTableRule();
         restoreTableRule.setSrcContainerName(srcContainerName);
         restoreTableRule.setSrcMultiDb(srcMultiDb);
         restoreTableRule.setDstContainerName(containerName);
         restoreTableRule.setDstMultiDb(multiDb);
         restoreTableRule.setContentFile(new File(storageDir, srcTableName + DBBackup.CONTENT_FILE_SUFFIX));
         restoreTableRule.setContentLenFile(new File(storageDir, srcTableName + DBBackup.CONTENT_LEN_FILE_SUFFIX));

         // auto increment ID column
         restoreTableRule.setSkipColumnIndex(0);

         if (!multiDb || !srcMultiDb)
         {
            // PROPERTY_ID column index
            Set<Integer> convertColumnIndex = new HashSet<Integer>();
            convertColumnIndex.add(3);
            restoreTableRule.setConvertColumnIndex(convertColumnIndex);
         }
         tables.put(dstTableName, restoreTableRule);

         // REF tables
         dstTableName = "JCR_" + (multiDb ? "M" : "S") + "REF";
         srcTableName = "JCR_" + (srcMultiDb ? "M" : "S") + "REF";

         restoreTableRule = new RestoreTableRule();
         restoreTableRule.setSrcContainerName(srcContainerName);
         restoreTableRule.setSrcMultiDb(srcMultiDb);
         restoreTableRule.setDstContainerName(containerName);
         restoreTableRule.setDstMultiDb(multiDb);
         restoreTableRule.setContentFile(new File(storageDir, srcTableName + DBBackup.CONTENT_FILE_SUFFIX));
         restoreTableRule.setContentLenFile(new File(storageDir, srcTableName + DBBackup.CONTENT_LEN_FILE_SUFFIX));

         if (!multiDb || !srcMultiDb)
         {
            // NODE_ID and PROPERTY_ID column indexes
            Set<Integer> convertColumnIndex = new HashSet<Integer>();
            convertColumnIndex.add(0);
            convertColumnIndex.add(1);
            restoreTableRule.setConvertColumnIndex(convertColumnIndex);
         }
         tables.put(dstTableName, restoreTableRule);

         if (dbDialect == DBConstants.DB_DIALECT_SYBASE)
         {
View Full Code Here

         // ITEM table
         String dstTableName = "JCR_" + (multiDb ? "M" : "S") + "ITEM";
         String srcTableName = "JCR_" + (srcMultiDb ? "M" : "S") + "ITEM";

         RestoreTableRule restoreTableRule = new RestoreTableRule();
         restoreTableRule.setSrcContainerName(srcContainerName);
         restoreTableRule.setSrcMultiDb(srcMultiDb);
         restoreTableRule.setDstContainerName(containerName);
         restoreTableRule.setDstMultiDb(multiDb);
         restoreTableRule.setContentFile(new File(storageDir, srcTableName + DBBackup.CONTENT_FILE_SUFFIX));
         restoreTableRule.setContentLenFile(new File(storageDir, srcTableName + DBBackup.CONTENT_LEN_FILE_SUFFIX));

         if (multiDb)
         {
            if (!srcMultiDb)
            {
               // CONTAINER_NAME column index
               restoreTableRule.setDeleteColumnIndex(4);

               // ID and PARENT_ID column indexes
               Set<Integer> convertColumnIndex = new HashSet<Integer>();
               convertColumnIndex.add(0);
               convertColumnIndex.add(1);
               restoreTableRule.setConvertColumnIndex(convertColumnIndex);
            }
         }
         else
         {
            if (srcMultiDb)
            {
               // CONTAINER_NAME column index
               restoreTableRule.setNewColumnIndex(4);
               restoreTableRule.setNewColumnName("CONTAINER_NAME");
               restoreTableRule.setNewColumnType(Types.VARCHAR);

               // ID and PARENT_ID column indexes
               Set<Integer> convertColumnIndex = new HashSet<Integer>();
               convertColumnIndex.add(0);
               convertColumnIndex.add(1);
               restoreTableRule.setConvertColumnIndex(convertColumnIndex);
            }
            else
            {
               // ID and PARENT_ID and CONTAINER_NAME column indexes
               Set<Integer> convertColumnIndex = new HashSet<Integer>();
               convertColumnIndex.add(0);
               convertColumnIndex.add(1);
               convertColumnIndex.add(4);
               restoreTableRule.setConvertColumnIndex(convertColumnIndex);
            }
         }
         tables.put(dstTableName, restoreTableRule);

         // VALUE table
         dstTableName = "JCR_" + (multiDb ? "M" : "S") + "VALUE";
         srcTableName = "JCR_" + (srcMultiDb ? "M" : "S") + "VALUE";

         restoreTableRule = new RestoreTableRule();
         restoreTableRule.setSrcContainerName(srcContainerName);
         restoreTableRule.setSrcMultiDb(srcMultiDb);
         restoreTableRule.setDstContainerName(containerName);
         restoreTableRule.setDstMultiDb(multiDb);
         restoreTableRule.setContentFile(new File(storageDir, srcTableName + DBBackup.CONTENT_FILE_SUFFIX));
         restoreTableRule.setContentLenFile(new File(storageDir, srcTableName + DBBackup.CONTENT_LEN_FILE_SUFFIX));

         // auto increment ID column
         restoreTableRule.setSkipColumnIndex(0);

         if (!multiDb || !srcMultiDb)
         {
            // PROPERTY_ID column index
            Set<Integer> convertColumnIndex = new HashSet<Integer>();
            convertColumnIndex.add(3);
            restoreTableRule.setConvertColumnIndex(convertColumnIndex);
         }
         tables.put(dstTableName, restoreTableRule);

         // REF tables
         dstTableName = "JCR_" + (multiDb ? "M" : "S") + "REF";
         srcTableName = "JCR_" + (srcMultiDb ? "M" : "S") + "REF";

         restoreTableRule = new RestoreTableRule();
         restoreTableRule.setSrcContainerName(srcContainerName);
         restoreTableRule.setSrcMultiDb(srcMultiDb);
         restoreTableRule.setDstContainerName(containerName);
         restoreTableRule.setDstMultiDb(multiDb);
         restoreTableRule.setContentFile(new File(storageDir, srcTableName + DBBackup.CONTENT_FILE_SUFFIX));
         restoreTableRule.setContentLenFile(new File(storageDir, srcTableName + DBBackup.CONTENT_LEN_FILE_SUFFIX));

         if (!multiDb || !srcMultiDb)
         {
            // NODE_ID and PROPERTY_ID column indexes
            Set<Integer> convertColumnIndex = new HashSet<Integer>();
            convertColumnIndex.add(0);
            convertColumnIndex.add(1);
            restoreTableRule.setConvertColumnIndex(convertColumnIndex);
         }
         tables.put(dstTableName, restoreTableRule);

         restorers.add(new DBRestore(storageDir, jdbcConn, tables, wsConfig, swapCleaner));
View Full Code Here

         // ITEM table
         String dstTableName = "JCR_" + (multiDb ? "M" : "S") + "ITEM";
         String srcTableName = "JCR_" + (srcMultiDb ? "M" : "S") + "ITEM";

         RestoreTableRule restoreTableRule = new RestoreTableRule();
         restoreTableRule.setSrcContainerName(srcContainerName);
         restoreTableRule.setSrcMultiDb(srcMultiDb);
         restoreTableRule.setDstContainerName(containerName);
         restoreTableRule.setDstMultiDb(multiDb);
         restoreTableRule.setSrcTableName(srcTableName);

         if (multiDb)
         {
            if (!srcMultiDb)
            {
               // CONTAINER_NAME column index
               restoreTableRule.setDeleteColumnIndex(4);

               // ID and PARENT_ID column indexes
               Set<Integer> convertColumnIndex = new HashSet<Integer>();
               convertColumnIndex.add(0);
               convertColumnIndex.add(1);
               restoreTableRule.setConvertColumnIndex(convertColumnIndex);
            }
         }
         else
         {
            if (srcMultiDb)
            {
               // CONTAINER_NAME column index
               restoreTableRule.setNewColumnIndex(4);
               restoreTableRule.setNewColumnName("CONTAINER_NAME");
               restoreTableRule.setNewColumnType(Types.VARCHAR);

               // ID and PARENT_ID column indexes
               Set<Integer> convertColumnIndex = new HashSet<Integer>();
               convertColumnIndex.add(0);
               convertColumnIndex.add(1);
               restoreTableRule.setConvertColumnIndex(convertColumnIndex);
            }
            else
            {
               // ID and PARENT_ID and CONTAINER_NAME column indexes
               Set<Integer> convertColumnIndex = new HashSet<Integer>();
               convertColumnIndex.add(0);
               convertColumnIndex.add(1);
               convertColumnIndex.add(4);
               restoreTableRule.setConvertColumnIndex(convertColumnIndex);
            }
         }
         tables.put(dstTableName, restoreTableRule);

         // VALUE table
         dstTableName = "JCR_" + (multiDb ? "M" : "S") + "VALUE";
         srcTableName = "JCR_" + (srcMultiDb ? "M" : "S") + "VALUE";

         restoreTableRule = new RestoreTableRule();
         restoreTableRule.setSrcContainerName(srcContainerName);
         restoreTableRule.setSrcMultiDb(srcMultiDb);
         restoreTableRule.setDstContainerName(containerName);
         restoreTableRule.setDstMultiDb(multiDb);
         restoreTableRule.setSrcTableName(srcTableName);

         // auto increment ID column
         restoreTableRule.setSkipColumnIndex(0);

         if (!multiDb || !srcMultiDb)
         {
            // PROPERTY_ID column index
            Set<Integer> convertColumnIndex = new HashSet<Integer>();
            convertColumnIndex.add(3);
            restoreTableRule.setConvertColumnIndex(convertColumnIndex);
         }
         tables.put(dstTableName, restoreTableRule);

         // REF tables
         dstTableName = "JCR_" + (multiDb ? "M" : "S") + "REF";
         srcTableName = "JCR_" + (srcMultiDb ? "M" : "S") + "REF";

         restoreTableRule = new RestoreTableRule();
         restoreTableRule.setSrcContainerName(srcContainerName);
         restoreTableRule.setSrcMultiDb(srcMultiDb);
         restoreTableRule.setDstContainerName(containerName);
         restoreTableRule.setDstMultiDb(multiDb);
         restoreTableRule.setSrcTableName(srcTableName);

         if (!multiDb || !srcMultiDb)
         {
            // NODE_ID and PROPERTY_ID column indexes
            Set<Integer> convertColumnIndex = new HashSet<Integer>();
            convertColumnIndex.add(0);
            convertColumnIndex.add(1);
            restoreTableRule.setConvertColumnIndex(convertColumnIndex);
         }
         tables.put(dstTableName, restoreTableRule);

         DBCleaner dbCleaner = null;
         if (context.getObject(DataRestoreContext.DB_CLEANER) != null)
View Full Code Here

         // ITEM table
         String dstTableName = "JCR_" + (multiDb ? "M" : "S") + "ITEM";
         String srcTableName = "JCR_" + (srcMultiDb ? "M" : "S") + "ITEM";

         RestoreTableRule restoreTableRule = new RestoreTableRule();
         restoreTableRule.setSrcContainerName(srcContainerName);
         restoreTableRule.setSrcMultiDb(srcMultiDb);
         restoreTableRule.setDstContainerName(containerName);
         restoreTableRule.setDstMultiDb(multiDb);
         restoreTableRule.setSrcTableName(srcTableName);

         if (multiDb)
         {
            if (!srcMultiDb)
            {
               // CONTAINER_NAME column index
               restoreTableRule.setDeleteColumnIndex(4);

               // ID and PARENT_ID column indexes
               Set<Integer> convertColumnIndex = new HashSet<Integer>();
               convertColumnIndex.add(0);
               convertColumnIndex.add(1);
               restoreTableRule.setConvertColumnIndex(convertColumnIndex);
            }
         }
         else
         {
            if (srcMultiDb)
            {
               // CONTAINER_NAME column index
               restoreTableRule.setNewColumnIndex(4);
               restoreTableRule.setNewColumnName("CONTAINER_NAME");
               restoreTableRule.setNewColumnType(Types.VARCHAR);

               // ID and PARENT_ID column indexes
               Set<Integer> convertColumnIndex = new HashSet<Integer>();
               convertColumnIndex.add(0);
               convertColumnIndex.add(1);
               restoreTableRule.setConvertColumnIndex(convertColumnIndex);
            }
            else
            {
               // ID and PARENT_ID and CONTAINER_NAME column indexes
               Set<Integer> convertColumnIndex = new HashSet<Integer>();
               convertColumnIndex.add(0);
               convertColumnIndex.add(1);
               convertColumnIndex.add(4);
               restoreTableRule.setConvertColumnIndex(convertColumnIndex);
            }
         }
         tables.put(dstTableName, restoreTableRule);

         // VALUE table
         dstTableName = "JCR_" + (multiDb ? "M" : "S") + "VALUE";
         srcTableName = "JCR_" + (srcMultiDb ? "M" : "S") + "VALUE";

         restoreTableRule = new RestoreTableRule();
         restoreTableRule.setSrcContainerName(srcContainerName);
         restoreTableRule.setSrcMultiDb(srcMultiDb);
         restoreTableRule.setDstContainerName(containerName);
         restoreTableRule.setDstMultiDb(multiDb);
         restoreTableRule.setSrcTableName(srcTableName);

         // auto increment ID column
         restoreTableRule.setSkipColumnIndex(0);

         if (!multiDb || !srcMultiDb)
         {
            // PROPERTY_ID column index
            Set<Integer> convertColumnIndex = new HashSet<Integer>();
            convertColumnIndex.add(3);
            restoreTableRule.setConvertColumnIndex(convertColumnIndex);
         }
         tables.put(dstTableName, restoreTableRule);

         // REF tables
         dstTableName = "JCR_" + (multiDb ? "M" : "S") + "REF";
         srcTableName = "JCR_" + (srcMultiDb ? "M" : "S") + "REF";

         restoreTableRule = new RestoreTableRule();
         restoreTableRule.setSrcContainerName(srcContainerName);
         restoreTableRule.setSrcMultiDb(srcMultiDb);
         restoreTableRule.setDstContainerName(containerName);
         restoreTableRule.setDstMultiDb(multiDb);
         restoreTableRule.setSrcTableName(srcTableName);

         if (!multiDb || !srcMultiDb)
         {
            // NODE_ID and PROPERTY_ID column indexes
            Set<Integer> convertColumnIndex = new HashSet<Integer>();
            convertColumnIndex.add(0);
            convertColumnIndex.add(1);
            restoreTableRule.setConvertColumnIndex(convertColumnIndex);
         }
         tables.put(dstTableName, restoreTableRule);

         DBCleaner dbCleaner = null;
         if (context.getObject(DataRestoreContext.DB_CLEANER) != null)
View Full Code Here

         // ITEM table
         String dstTableName = "JCR_" + (multiDb ? "M" : "S") + "ITEM";
         String srcTableName = "JCR_" + (srcMultiDb ? "M" : "S") + "ITEM";

         RestoreTableRule restoreTableRule = new RestoreTableRule();
         restoreTableRule.setSrcContainerName(srcContainerName);
         restoreTableRule.setSrcMultiDb(srcMultiDb);
         restoreTableRule.setDstContainerName(containerName);
         restoreTableRule.setDstMultiDb(multiDb);
         restoreTableRule.setContentFile(new File(storageDir, srcTableName + DBBackup.CONTENT_FILE_SUFFIX));
         restoreTableRule.setContentLenFile(new File(storageDir, srcTableName + DBBackup.CONTENT_LEN_FILE_SUFFIX));

         if (multiDb)
         {
            if (!srcMultiDb)
            {
               // CONTAINER_NAME column index
               restoreTableRule.setDeleteColumnIndex(4);

               // ID and PARENT_ID column indexes
               Set<Integer> convertColumnIndex = new HashSet<Integer>();
               convertColumnIndex.add(0);
               convertColumnIndex.add(1);
               restoreTableRule.setConvertColumnIndex(convertColumnIndex);
            }
         }
         else
         {
            if (srcMultiDb)
            {
               // CONTAINER_NAME column index
               restoreTableRule.setNewColumnIndex(4);
               restoreTableRule.setNewColumnName("CONTAINER_NAME");
               restoreTableRule.setNewColumnType(Types.VARCHAR);

               // ID and PARENT_ID column indexes
               Set<Integer> convertColumnIndex = new HashSet<Integer>();
               convertColumnIndex.add(0);
               convertColumnIndex.add(1);
               restoreTableRule.setConvertColumnIndex(convertColumnIndex);
            }
            else
            {
               // ID and PARENT_ID and CONTAINER_NAME column indexes
               Set<Integer> convertColumnIndex = new HashSet<Integer>();
               convertColumnIndex.add(0);
               convertColumnIndex.add(1);
               convertColumnIndex.add(4);
               restoreTableRule.setConvertColumnIndex(convertColumnIndex);
            }
         }
         tables.put(dstTableName, restoreTableRule);

         // VALUE table
         dstTableName = "JCR_" + (multiDb ? "M" : "S") + "VALUE";
         srcTableName = "JCR_" + (srcMultiDb ? "M" : "S") + "VALUE";

         restoreTableRule = new RestoreTableRule();
         restoreTableRule.setSrcContainerName(srcContainerName);
         restoreTableRule.setSrcMultiDb(srcMultiDb);
         restoreTableRule.setDstContainerName(containerName);
         restoreTableRule.setDstMultiDb(multiDb);
         restoreTableRule.setContentFile(new File(storageDir, srcTableName + DBBackup.CONTENT_FILE_SUFFIX));
         restoreTableRule.setContentLenFile(new File(storageDir, srcTableName + DBBackup.CONTENT_LEN_FILE_SUFFIX));

         // auto increment ID column
         restoreTableRule.setSkipColumnIndex(0);

         if (!multiDb || !srcMultiDb)
         {
            // PROPERTY_ID column index
            Set<Integer> convertColumnIndex = new HashSet<Integer>();
            convertColumnIndex.add(3);
            restoreTableRule.setConvertColumnIndex(convertColumnIndex);
         }
         tables.put(dstTableName, restoreTableRule);

         // REF tables
         dstTableName = "JCR_" + (multiDb ? "M" : "S") + "REF";
         srcTableName = "JCR_" + (srcMultiDb ? "M" : "S") + "REF";

         restoreTableRule = new RestoreTableRule();
         restoreTableRule.setSrcContainerName(srcContainerName);
         restoreTableRule.setSrcMultiDb(srcMultiDb);
         restoreTableRule.setDstContainerName(containerName);
         restoreTableRule.setDstMultiDb(multiDb);
         restoreTableRule.setContentFile(new File(storageDir, srcTableName + DBBackup.CONTENT_FILE_SUFFIX));
         restoreTableRule.setContentLenFile(new File(storageDir, srcTableName + DBBackup.CONTENT_LEN_FILE_SUFFIX));

         if (!multiDb || !srcMultiDb)
         {
            // NODE_ID and PROPERTY_ID column indexes
            Set<Integer> convertColumnIndex = new HashSet<Integer>();
            convertColumnIndex.add(0);
            convertColumnIndex.add(1);
            restoreTableRule.setConvertColumnIndex(convertColumnIndex);
         }
         tables.put(dstTableName, restoreTableRule);

         if (dbDialect == DBConstants.DB_DIALECT_SYBASE)
         {
View Full Code Here

         // ITEM table
         String dstTableName = "JCR_" + (multiDb ? "M" : "S") + "ITEM";
         String srcTableName = "JCR_" + (srcMultiDb ? "M" : "S") + "ITEM";

         RestoreTableRule restoreTableRule = new RestoreTableRule();
         restoreTableRule.setSrcContainerName(srcContainerName);
         restoreTableRule.setSrcMultiDb(srcMultiDb);
         restoreTableRule.setDstContainerName(containerName);
         restoreTableRule.setDstMultiDb(multiDb);
         restoreTableRule.setSrcTableName(srcTableName);

         if (multiDb)
         {
            if (!srcMultiDb)
            {
               // CONTAINER_NAME column index
               restoreTableRule.setDeleteColumnIndex(4);

               // ID and PARENT_ID column indexes
               Set<Integer> convertColumnIndex = new HashSet<Integer>();
               convertColumnIndex.add(0);
               convertColumnIndex.add(1);
               restoreTableRule.setConvertColumnIndex(convertColumnIndex);
            }
         }
         else
         {
            if (srcMultiDb)
            {
               // CONTAINER_NAME column index
               restoreTableRule.setNewColumnIndex(4);
               restoreTableRule.setNewColumnName("CONTAINER_NAME");
               restoreTableRule.setNewColumnType(Types.VARCHAR);

               // ID and PARENT_ID column indexes
               Set<Integer> convertColumnIndex = new HashSet<Integer>();
               convertColumnIndex.add(0);
               convertColumnIndex.add(1);
               restoreTableRule.setConvertColumnIndex(convertColumnIndex);
            }
            else
            {
               // ID and PARENT_ID and CONTAINER_NAME column indexes
               Set<Integer> convertColumnIndex = new HashSet<Integer>();
               convertColumnIndex.add(0);
               convertColumnIndex.add(1);
               convertColumnIndex.add(4);
               restoreTableRule.setConvertColumnIndex(convertColumnIndex);
            }
         }
         tables.put(dstTableName, restoreTableRule);

         // VALUE table
         dstTableName = "JCR_" + (multiDb ? "M" : "S") + "VALUE";
         srcTableName = "JCR_" + (srcMultiDb ? "M" : "S") + "VALUE";

         restoreTableRule = new RestoreTableRule();
         restoreTableRule.setSrcContainerName(srcContainerName);
         restoreTableRule.setSrcMultiDb(srcMultiDb);
         restoreTableRule.setDstContainerName(containerName);
         restoreTableRule.setDstMultiDb(multiDb);
         restoreTableRule.setSrcTableName(srcTableName);

         // auto increment ID column
         restoreTableRule.setSkipColumnIndex(0);

         if (!multiDb || !srcMultiDb)
         {
            // PROPERTY_ID column index
            Set<Integer> convertColumnIndex = new HashSet<Integer>();
            convertColumnIndex.add(3);
            restoreTableRule.setConvertColumnIndex(convertColumnIndex);
         }
         tables.put(dstTableName, restoreTableRule);

         // REF tables
         dstTableName = "JCR_" + (multiDb ? "M" : "S") + "REF";
         srcTableName = "JCR_" + (srcMultiDb ? "M" : "S") + "REF";

         restoreTableRule = new RestoreTableRule();
         restoreTableRule.setSrcContainerName(srcContainerName);
         restoreTableRule.setSrcMultiDb(srcMultiDb);
         restoreTableRule.setDstContainerName(containerName);
         restoreTableRule.setDstMultiDb(multiDb);
         restoreTableRule.setSrcTableName(srcTableName);

         if (!multiDb || !srcMultiDb)
         {
            // NODE_ID and PROPERTY_ID column indexes
            Set<Integer> convertColumnIndex = new HashSet<Integer>();
            convertColumnIndex.add(0);
            convertColumnIndex.add(1);
            restoreTableRule.setConvertColumnIndex(convertColumnIndex);
         }
         tables.put(dstTableName, restoreTableRule);

         DBCleaner dbCleaner = null;
         if (context.getObject(DataRestoreContext.DB_CLEANER) != null)
View Full Code Here

         // ITEM table
         String dstTableName = "JCR_" + (multiDb ? "M" : "S") + "ITEM";
         String srcTableName = "JCR_" + (srcMultiDb ? "M" : "S") + "ITEM";

         RestoreTableRule restoreTableRule = new RestoreTableRule();
         restoreTableRule.setSrcContainerName(srcContainerName);
         restoreTableRule.setSrcMultiDb(srcMultiDb);
         restoreTableRule.setDstContainerName(containerName);
         restoreTableRule.setDstMultiDb(multiDb);
         restoreTableRule.setSrcTableName(srcTableName);

         if (multiDb)
         {
            if (!srcMultiDb)
            {
               // CONTAINER_NAME column index
               restoreTableRule.setDeleteColumnIndex(4);

               // ID and PARENT_ID column indexes
               Set<Integer> convertColumnIndex = new HashSet<Integer>();
               convertColumnIndex.add(0);
               convertColumnIndex.add(1);
               restoreTableRule.setConvertColumnIndex(convertColumnIndex);
            }
         }
         else
         {
            if (srcMultiDb)
            {
               // CONTAINER_NAME column index
               restoreTableRule.setNewColumnIndex(4);
               restoreTableRule.setNewColumnName("CONTAINER_NAME");
               restoreTableRule.setNewColumnType(Types.VARCHAR);

               // ID and PARENT_ID column indexes
               Set<Integer> convertColumnIndex = new HashSet<Integer>();
               convertColumnIndex.add(0);
               convertColumnIndex.add(1);
               restoreTableRule.setConvertColumnIndex(convertColumnIndex);
            }
            else
            {
               // ID and PARENT_ID and CONTAINER_NAME column indexes
               Set<Integer> convertColumnIndex = new HashSet<Integer>();
               convertColumnIndex.add(0);
               convertColumnIndex.add(1);
               convertColumnIndex.add(4);
               restoreTableRule.setConvertColumnIndex(convertColumnIndex);
            }
         }
         tables.put(dstTableName, restoreTableRule);

         // VALUE table
         dstTableName = "JCR_" + (multiDb ? "M" : "S") + "VALUE";
         srcTableName = "JCR_" + (srcMultiDb ? "M" : "S") + "VALUE";

         restoreTableRule = new RestoreTableRule();
         restoreTableRule.setSrcContainerName(srcContainerName);
         restoreTableRule.setSrcMultiDb(srcMultiDb);
         restoreTableRule.setDstContainerName(containerName);
         restoreTableRule.setDstMultiDb(multiDb);
         restoreTableRule.setSrcTableName(srcTableName);

         // auto increment ID column
         restoreTableRule.setSkipColumnIndex(0);

         if (!multiDb || !srcMultiDb)
         {
            // PROPERTY_ID column index
            Set<Integer> convertColumnIndex = new HashSet<Integer>();
            convertColumnIndex.add(3);
            restoreTableRule.setConvertColumnIndex(convertColumnIndex);
         }
         tables.put(dstTableName, restoreTableRule);

         // REF tables
         dstTableName = "JCR_" + (multiDb ? "M" : "S") + "REF";
         srcTableName = "JCR_" + (srcMultiDb ? "M" : "S") + "REF";

         restoreTableRule = new RestoreTableRule();
         restoreTableRule.setSrcContainerName(srcContainerName);
         restoreTableRule.setSrcMultiDb(srcMultiDb);
         restoreTableRule.setDstContainerName(containerName);
         restoreTableRule.setDstMultiDb(multiDb);
         restoreTableRule.setSrcTableName(srcTableName);

         if (!multiDb || !srcMultiDb)
         {
            // NODE_ID and PROPERTY_ID column indexes
            Set<Integer> convertColumnIndex = new HashSet<Integer>();
            convertColumnIndex.add(0);
            convertColumnIndex.add(1);
            restoreTableRule.setConvertColumnIndex(convertColumnIndex);
         }
         tables.put(dstTableName, restoreTableRule);

         DBCleaner dbCleaner = null;
         if (context.getObject(DataRestoreContext.DB_CLEANER) != null)
View Full Code Here

TOP

Related Classes of org.exoplatform.services.jcr.impl.backup.rdbms.RestoreTableRule

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.