Subversion Repositories SmartDukaan

Rev

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

Rev 8865 Rev 8869
Line 60... Line 60...
60
import java.util.Set;
60
import java.util.Set;
61
import java.util.TreeMap;
61
import java.util.TreeMap;
62
 
62
 
63
import org.apache.commons.collections.CollectionUtils;
63
import org.apache.commons.collections.CollectionUtils;
64
import org.apache.commons.io.IOUtils;
64
import org.apache.commons.io.IOUtils;
-
 
65
import org.apache.commons.lang.ArrayUtils;
65
import org.apache.commons.lang.StringUtils;
66
import org.apache.commons.lang.StringUtils;
66
 
67
 
67
import com.google.gson.Gson;
68
import com.google.gson.Gson;
68
import com.google.gson.reflect.TypeToken;
69
import com.google.gson.reflect.TypeToken;
69
 
70
 
Line 102... Line 103...
102
		/*contentmigrator.touchEntityState(1008423l);
103
		/*contentmigrator.touchEntityState(1008423l);
103
		contentmigrator.touchEntityState(1008424l);
104
		contentmigrator.touchEntityState(1008424l);
104
		contentmigrator.touchEntityState(1008427l);
105
		contentmigrator.touchEntityState(1008427l);
105
		contentmigrator.touchEntityState(1008428l);*/
106
		contentmigrator.touchEntityState(1008428l);*/
106
 
107
 
107
		contentmigrator.migrateToMongo();
108
		//contentmigrator.migrateToMongo();
108
		//contentmigrator.getEditedEntities();
109
		//contentmigrator.getEditedEntities();
109
		/*contentmigrator.touchEntityState(1008706l);
110
		/*contentmigrator.touchEntityState(1008706l);
110
		contentmigrator.touchEntityState(1008707l);
111
		contentmigrator.touchEntityState(1008707l);
111
		contentmigrator.touchEntityState(1008708l);
112
		contentmigrator.touchEntityState(1008708l);
112
		contentmigrator.touchEntityState(1008709l);
113
		contentmigrator.touchEntityState(1008709l);
Line 114... Line 115...
114
		contentmigrator.touchEntityState(1008711l);
115
		contentmigrator.touchEntityState(1008711l);
115
		contentmigrator.touchEntityState(1008714l);
116
		contentmigrator.touchEntityState(1008714l);
116
		contentmigrator.touchEntityState(1008715l);
117
		contentmigrator.touchEntityState(1008715l);
117
		contentmigrator.touchEntityState(1005505l);
118
		contentmigrator.touchEntityState(1005505l);
118
		contentmigrator.touchEntityState(1006864l);*/
119
		contentmigrator.touchEntityState(1006864l);*/
-
 
120
		contentmigrator.getTablets();
119
	}
121
	}
120
	
122
	
121
	private void changeKeys() throws Exception {
123
	private void changeKeys() throws Exception {
122
		Map<Long, Entity>  e = CreationUtils.getEntities();
124
		Map<Long, Entity>  e = CreationUtils.getEntities();
123
		for (Map.Entry<Long, Entity> entry : e.entrySet()) {
125
		for (Map.Entry<Long, Entity> entry : e.entrySet()) {
Line 2553... Line 2555...
2553
				}
2555
				}
2554
			}
2556
			}
2555
		}
2557
		}
2556
	}
2558
	}
2557
	
2559
	
-
 
2560
	private void getTablets() throws Exception {
-
 
2561
		StringBuffer sb = new StringBuffer();
-
 
2562
		DefinitionsContainer defs = Catalog.getInstance().getDefinitionsContainer();
-
 
2563
		Map<Long,FeatureDefinition> allFeatureDefs  = defs.getFeatureDefinitions();
-
 
2564
		List<Long> tabletFds = defs.getFeatureDefinitionIDs(10010l);
-
 
2565
		
-
 
2566
		Collection<Entity> es = CreationUtils.getEntities(10010l);
-
 
2567
		String header[] = new String[tabletFds.size()];
-
 
2568
		int index = 0;
-
 
2569
		for(Long fd : tabletFds) {
-
 
2570
			header[index++] = allFeatureDefs.get(fd).getLabel();
-
 
2571
		}
-
 
2572
		sb.append(StringUtils.join(header, "\t")).append("\n");
-
 
2573
		for (Entity entity:es){
-
 
2574
			String as[] = new String[tabletFds.size()];
-
 
2575
			Map<Long, String> m = AmazonSCDataGenerator.extractFeatureValuesForEntity(entity);
-
 
2576
			for(Map.Entry<Long, String> entry : m.entrySet()) {
-
 
2577
				if(tabletFds.indexOf(entry.getKey())==-1){
-
 
2578
					continue;
-
 
2579
				}
-
 
2580
				as[tabletFds.indexOf(entry.getKey())] = entry.getValue(); 
-
 
2581
			}
-
 
2582
			sb.append(StringUtils.join(as, "\t")).append("\n");
-
 
2583
		}
-
 
2584
		System.out.println(sb);
-
 
2585
	}
-
 
2586
	
2558
}
2587
}
2559
 
2588