Subversion Repositories SmartDukaan

Rev

Rev 1226 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1226 Rev 8749
Line 51... Line 51...
51
		
51
		
52
		
52
		
53
		//StorageManager.getStorageManager().close();
53
		//StorageManager.getStorageManager().close();
54
		
54
		
55
		ContentMigratorToBDB contentmigrator = new ContentMigratorToBDB(sourceDbPath, destinationDbPath);
55
		ContentMigratorToBDB contentmigrator = new ContentMigratorToBDB(sourceDbPath, destinationDbPath);
-
 
56
		contentmigrator.migrateEntityState();
56
		//boolean result = contentmigrator.addMedia();
57
		//boolean result = contentmigrator.addMedia();
57
		//boolean result = contentmigrator.addLearnedFields();
58
		//boolean result = contentmigrator.addLearnedFields();
58
		//boolean result = contentmigrator.migrate();
59
		//boolean result = contentmigrator.migrate();
59
		//System.out.println("Content migration status:  "+ result);
60
		//System.out.println("Content migration status:  "+ result);
60
		
61
		
61
		//boolean result = contentmigrator.migrateEntityState();
62
		//boolean result = contentmigrator.migrateEntityState();
62
		boolean result = contentmigrator.migrateRemoveBorrowedCategoryIdFromSlide();
63
		//boolean result = contentmigrator.migrateRemoveBorrowedCategoryIdFromSlide();
63
		//System.out.println(CreationUtils.getEntity(1000471).getSlide(130011));
64
		//System.out.println(CreationUtils.getEntity(1000471).getSlide(130011));
64
		//System.out.println(CreationUtils.getFacetValues());
65
		//System.out.println(CreationUtils.getFacetValues());
65
		
66
		
66
	}
67
	}
67
 
68
 
68
	public ContentMigratorToBDB(String sourceDbPath, String destinationDbPath) {
69
	public ContentMigratorToBDB(String sourceDbPath, String destinationDbPath) {
69
		this.sourceDbPath = sourceDbPath;
70
		this.sourceDbPath = sourceDbPath;
70
		this.destinationDbPath = destinationDbPath;
71
		this.destinationDbPath = destinationDbPath;
71
	}
72
	}
72
	
73
	
73
	public boolean migrateRemoveBorrowedCategoryIdFromSlide() throws Exception{
-
 
74
		DefinitionsContainer dfc = Catalog.getInstance().getDefinitionsContainer();
-
 
75
		Map<Long, Entity> entities =  CreationUtils.getEntities();
-
 
76
		for(Long entityId: entities.keySet()){
-
 
77
			Entity entity = entities.get(entityId);
-
 
78
			if(entity.getSlides()!=null){
-
 
79
				for(Slide slide:entity.getSlides()){
-
 
80
					if(CreationUtils.isBorrowedSlide(slide.getSlideDefinitionID(), entity.getCategoryID())){
-
 
81
						System.out.println(entity.getID() + "\t" + slide.getSlideDefinitionID() + "\t"+ dfc.getCategory(entity.getCategoryID()).getLabel() + "\t" + dfc.getSlideDefinition(slide.getSlideDefinitionID()).getLabel() + "\t" + dfc.getCategory(CreationUtils.getBorrowedCategoryID(slide.getSlideDefinitionID(), entity.getCategoryID())).getLabel() );
-
 
82
					}
-
 
83
				}
-
 
84
			}
-
 
85
		}
-
 
86
		return true;
-
 
87
	}
-
 
88
	
74
	
89
	public boolean migrateEntityState() throws Exception{
75
	public boolean migrateEntityState() throws Exception{
90
		Map<Long, Entity> entities =  CreationUtils.getEntities();
76
		Map<Long, Entity> entities =  CreationUtils.getEntities();
91
		for(Long entityId: entities.keySet()){
77
		for(Long entityId: entities.keySet()){
92
			Entity entity = entities.get(entityId);
78
			Entity entity = entities.get(entityId);