Project

General

Profile

« Previous | Next » 

Revision 44736

freeze the final store for portal access

View differences:

modules/dnet-isti/trunk/src/main/java/eu/dnetlib/data/mdstore/plugins/FreezeMDStorePlugin.java
1
package eu.dnetlib.data.mdstore.plugins;
2

  
3
import java.util.Map;
4

  
5
import org.bson.Document;
6

  
7
import com.mongodb.BasicDBObject;
8
import com.mongodb.DBObject;
9
import com.mongodb.client.MongoCollection;
10

  
11
import eu.dnetlib.rmi.data.MDStoreServiceException;
12

  
13
public class FreezeMDStorePlugin extends AbstractIstiMDStorePlugin {
14

  
15
	@Override
16
	protected void process(final Map<String, String> params) throws MDStoreServiceException {
17

  
18
		final MongoCollection<Document> freezeColl = getDao().getDb().getCollection(params.get("collection"));;
19

  
20
		freezeColl.drop();
21

  
22
		for (final DBObject obj : resolveStore(params, "mdId").getCollection().find()) {
23
			final Document doc = new Document();
24
			doc.append("id", obj.get("id"));
25
			doc.append("body", obj.get("body"));
26
			freezeColl.insertOne(doc);
27
		}
28

  
29
		freezeColl.createIndex(new BasicDBObject("id", 1));
30

  
31
	}
32

  
33
}
modules/dnet-isti/trunk/src/main/resources/eu/dnetlib/isti/applicationContext-isti.xml
27 27

  
28 28
	<bean id="enrichProjectsMDstorePlugin"
29 29
		class="eu.dnetlib.data.mdstore.plugins.EnrichProjectsPlugin" />
30
		
31
	<bean id="freezeMDStorePlugin"
32
		class="eu.dnetlib.data.mdstore.plugins.FreezeMDStorePlugin" />
30 33
	
31 34

  
32 35
</beans>
modules/dnet-isti/trunk/src/main/resources/eu/dnetlib/bootstrap/profiles/workflows/infospace/index.xml
113 113
						<PARAM name="feedingType" value="REFRESH" />
114 114
					</PARAMETERS>
115 115
					<ARCS>
116
						<ARC to="success" />
116
						<ARC to="freezeStore" />
117 117
					</ARCS>
118 118
				</NODE>
119
				
120
				<NODE name="freezeStore" type="RunMDStorePlugin">
121
					<DESCRIPTION>Enrich with projects</DESCRIPTION>
122
					<PARAMETERS>
123
						<PARAM name="pluginName" value="freezeMDStorePlugin"/>
124
						<PARAM name="parameters">
125
							<MAP>
126
								<ENTRY key="mdId" env="source_id" />
127
								<ENTRY key="collection" value="final_isti_store" />
128
							</MAP>
129
						</PARAM>
130
					</PARAMETERS>
131
					<ARCS>
132
						<ARC to="success"/>
133
					</ARCS>
134
				</NODE>
135
				
119 136
			</WORKFLOW>
120 137
		</CONFIGURATION>
121 138
	</BODY>

Also available in: Unified diff