Subversion Repositories SmartDukaan

Rev

Rev 7507 | Rev 7917 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7507 Rev 7590
Line 3... Line 3...
3
import in.shop2020.metamodel.core.Bullet;
3
import in.shop2020.metamodel.core.Bullet;
4
import in.shop2020.metamodel.core.Entity;
4
import in.shop2020.metamodel.core.Entity;
5
import in.shop2020.metamodel.core.EntityState;
5
import in.shop2020.metamodel.core.EntityState;
6
import in.shop2020.metamodel.core.EntityStatus;
6
import in.shop2020.metamodel.core.EntityStatus;
7
import in.shop2020.metamodel.core.EnumDataObject;
7
import in.shop2020.metamodel.core.EnumDataObject;
-
 
8
import in.shop2020.metamodel.core.ExpertReview;
8
import in.shop2020.metamodel.core.Feature;
9
import in.shop2020.metamodel.core.Feature;
9
import in.shop2020.metamodel.core.FreeformContent;
10
import in.shop2020.metamodel.core.FreeformContent;
10
import in.shop2020.metamodel.core.Media;
11
import in.shop2020.metamodel.core.Media;
11
import in.shop2020.metamodel.core.Media.Type;
12
import in.shop2020.metamodel.core.Media.Type;
12
import in.shop2020.metamodel.core.PrimitiveDataObject;
13
import in.shop2020.metamodel.core.PrimitiveDataObject;
Line 80... Line 81...
80
		// destinationDbPath = args[1];
81
		// destinationDbPath = args[1];
81
		// dryRun = args[2];
82
		// dryRun = args[2];
82
		// }
83
		// }
83
		//
84
		//
84
		ContentMigrator contentmigrator = new ContentMigrator(sourceDbPath,destinationDbPath);
85
		ContentMigrator contentmigrator = new ContentMigrator(sourceDbPath,destinationDbPath);
85
		List<Long> entityId = Arrays.asList(1001674l,1002575l,1005331l,1005165l,1005164l,1005111l,1005109l,1004952l,1004940l,1004871l,1004701l,1004429l,1004197l,1006174l,1006077l,1005901l,1005757l,1005754l,1005724l,1005704l,1005598l,1005576l,1005558l,1007394l,1007230l,1007226l,1007218l,1007089l,1006925l,1006822l,1006814l,1006175l);
86
		/*List<Long> entityId = Arrays.asList(1001674l,1002575l,1005331l,1005165l,1005164l,1005111l,1005109l,1004952l,1004940l,1004871l,1004701l,1004429l,1004197l,1006174l,1006077l,1005901l,1005757l,1005754l,1005724l,1005704l,1005598l,1005576l,1005558l,1007394l,1007230l,1007226l,1007218l,1007089l,1006925l,1006822l,1006814l,1006175l);
86
		for (Long eId : entityId){
87
		for (Long eId : entityId){
87
			contentmigrator.touchEntityState(eId);
88
			contentmigrator.touchEntityState(eId);
88
		}
89
		}*/
-
 
90
		contentmigrator.updateSources();
89
 
91
 
90
	}
92
	}
91
	
93
	
-
 
94
	private void updateSources() throws Exception{
-
 
95
		Map<Long,List<ExpertReview>> erMap = CreationUtils.getExpertReviews();
-
 
96
		for(Map.Entry<Long, List<ExpertReview>> erEntry : erMap.entrySet()){
-
 
97
			List<ExpertReview> erList = erEntry.getValue();
-
 
98
			Iterator<ExpertReview> iter = erList.iterator();
-
 
99
			while (iter.hasNext()){
-
 
100
				ExpertReview er = iter.next();
-
 
101
				if (er.getSource().equals("iGyan")){
-
 
102
					er.setSource("iGyaan");
-
 
103
					System.out.println("changed to iGyaan in entity : " + erEntry.getKey());
-
 
104
				}else if(er.getSource().equals("TheMobileIndian")){
-
 
105
					er.setSource("The Mobile Indian");
-
 
106
					System.out.println("changed to The Mobile Indian in entity : " + erEntry.getKey());
-
 
107
				}
-
 
108
			}
-
 
109
			CreationUtils.storeExpertReview(erEntry.getKey(), erList);
-
 
110
		}
92
	
111
	}
93
	private void touchEntityState(Long eId) throws Exception {
112
	private void touchEntityState(Long eId) throws Exception {
94
		EntityState es = CreationUtils.getEntityState(eId);
113
		EntityState es = CreationUtils.getEntityState(eId);
95
		es.setMerkedReadyOn(new Date());
114
		es.setMerkedReadyOn(new Date());
96
		CreationUtils.updateEntityState(es);
115
		CreationUtils.updateEntityState(es);
97
		System.out.println("Touched " + eId + " successfully!");
116
		System.out.println("Touched " + eId + " successfully!");