Project

General

Profile

1
//version compatibility: 1.0.0-SNAPSHOT
2

    
3
use openaire_admin
4

    
5
var drop = false;
6
if(drop) {
7
	db.dropDatabase()
8
}
9

    
10
if(db.stats().collections == 0) {
11

    
12
	db.createCollection("community")
13
	db.createCollection("divHelpContent")
14
	db.createCollection("divId")
15
	db.createCollection("entity")
16
	db.createCollection("page")
17
	db.createCollection("pageHelpContent")
18
	db.createCollection("statistics")
19

    
20
	db.entity.save({"pid" : "publication", "name" : "Publication"})
21
	db.entity.save({"pid" : "dataset", "name" : "Research Data"})
22
	db.entity.save({"pid" : "software", "name" : "Software"})
23
	db.entity.save({"pid" : "project", "name" : "Project"})
24
	db.entity.save({"pid" : "organization", "name" : "Organization"})
25
	db.entity.save({"pid" : "datasource", "name" : "Content Provider"})
26

    
27

    
28
	publicationId = db.entity.find( { pid: "publication" }).map( function(entity) { return entity._id.str; } ).toString()
29
	datasetId = db.entity.find( { pid: "dataset" }).map( function(entity) { return entity._id.str; } ).toString()
30
	softwareId = db.entity.find( { pid: "software" }).map( function(entity) { return entity._id.str; } ).toString()
31
	projectId = db.entity.find( { pid: "project" }).map( function(entity) { return entity._id.str; } ).toString()
32
	organizationId = db.entity.find( { pid: "organization" }).map( function(entity) { return entity._id.str; } ).toString()
33
	datasourceId = db.entity.find( { pid: "datasource" }).map( function(entity) { return entity._id.str; } ).toString()
34

    
35
	db.page.save({"name" : "Publication Landing", "route" : "/search/publication", "type" : "search", "entities" : [publicationId]})
36
	db.page.save({"name" : "Research Data Landing", "route" : "/search/dataset", "type" : "search", "entities" : [datasetId]})
37
	db.page.save({"name" : "Software Landing", "route" : "/search/software", "type" : "search", "entities" : [softwareId]})
38
	db.page.save({"name" : "Project Landing", "route" : "/search/project", "type" : "search", "entities" : [projectId]})
39
	db.page.save({"name" : "Organization Landing", "route" : "/search/organization", "type" : "search", "entities" : [organizationId]})
40
	db.page.save({"name" : "Content Provider Landing", "route" : "/search/dataprovider", "type" : "search", "entities" : [datasourceId]})
41
	db.page.save({"name" : "Project Report", "route" : "/project-report", "type" : "search", "entities" : [projectId]})
42

    
43
	db.page.save({"name" : "Search Find", "type" : "search", "entities" : [publicationId, datasetId, softwareId, projectId, organizationId, datasourceId], "route" : "/search/find"})
44

    
45
	db.page.save({"name" : "Search Publications", "route" : "/search/find/publications", "type" : "search", "entities" : [publicationId]})
46
	db.page.save({"name" : "Search Research Data ", "route" : "/search/find/datasets", "type" : "search", "entities" : [datasetId]})
47
	db.page.save({"name" : "Search Software", "route" : "/search/find/software", "type" : "search", "entities" : [softwareId]})
48
	db.page.save({"name" : "Search Projects", "route" : "/search/find/projects", "type" : "search", "entities" : [projectId]})
49
	db.page.save({"name" : "Search Organizations", "route" : "/search/find/organizations", "type" : "search", "entities" : [organizationId]})
50
	db.page.save({"name" : "Search Content Providers", "route" : "/search/find/dataproviders", "type" : "search", "entities" : [datasourceId]})
51

    
52
	db.page.save({"name" : "Advanced Search Publications", "route" : "/search/advanced/publications", "type" : "search", "entities" : [publicationId]})
53
	db.page.save({"name" : "Advanced Search Research Data ", "route" : "/search/advanced/datasets", "type" : "search", "entities" : [datasetId]})
54
	db.page.save({"name" : "Advanced Search Software", "route" : "/search/advanced/software", "type" : "search", "entities" : [softwareId]})
55
	db.page.save({"name" : "Advanced Search Projects", "route" : "/search/advanced/projects", "type" : "search", "entities" : [projectId]})
56
	db.page.save({"name" : "Advanced Search Organizations", "route" : "/search/advanced/organizations", "type" : "search", "entities" : [organizationId]})
57
	db.page.save({"name" : "Advanced Search Content Providers", "route" : "/search/advanced/dataproviders", "type" : "search", "entities" : [datasourceId]})
58

    
59
	db.page.save({"name" : "Search Journals", "route" : "/search/journals", "type" : "search", "entities" : [datasourceId]})
60
	db.page.save({"name" : "Search Entity Registries", "route" : "/search/entity-registries", "type" : "search", "entities" : [datasourceId]})
61
	db.page.save({"name" : "Search Compatible Content Providers", "route" : "/search/content-providers", "type" : "search", "entities" : [datasourceId]})
62
	db.page.save({"name" : "Search Journals - Table view ", "route" : "/search/journals-table", "type" : "search", "entities" : [datasourceId]})
63
	db.page.save({"name" : "Search Entity Registries - Table view", "route" : "/search/entity-registries-table", "type" : "search", "entities" : [datasourceId]})
64
	db.page.save({"name" : "Search Compatible Content Providers -Table view", "route" : "/search/content-providers-table", "type" : "search", "entities" : [datasourceId]})
65

    
66
	db.page.save({"name" : "Deposit Publications", "route" : "/participate/deposit-publications", "type" : "share", "entities" : [publicationId]})
67
	db.page.save({"name" : "Deposit Research Data", "route" : "/participate/deposit-datasets", "type" : "share", "entities" : [datasetId]})
68
	db.page.save({"name" : "Deposit Publications Results", "route" : "/participate/deposit-publications-result", "type" : "share", "entities" : [publicationId]})
69
	db.page.save({"name" : "Deposit Research Data Results", "route" : "/participate/deposit-datasets-result", "type" : "share","entities" : [datasetId]})
70
	db.page.save({"name" : "Deposit Research Data subject result", "route" : "/participate/deposit-subject-result", "type" : "share", "entities" : [datasetId]})
71

    
72
	db.page.save({"name" : "Link", "route" : "/participate/claim", "type" : "link", "entities" : [projectId]})
73
	db.page.save({"name" : "Direct Link", "route" : "/participate/direct-claim", "type" : "link", "entities" : []})
74
	db.page.save({"name" : "My claims", "route" : "/myclaims", "type" : "link", "entities" : []})
75
	db.page.save({"name" : "Administrator claims", "route" : "/claims", "type" : "link", "entities" : []})
76
	db.page.save({"name" : "Claims Project Manager", "route" : "/claims-project-manager", "type" : "link", "entities" : []})
77

    
78
	publicationLanding = db.page.find( { route: "/search/publication" }).map( function(page) { return page._id.str; } ).toString()
79
	datasetLanding = db.page.find( { route: "/search/dataset" }).map( function(page) { return page._id.str; } ).toString()
80
	softwareLanding = db.page.find( { route: "/search/software" }).map( function(page) { return page._id.str; } ).toString()
81
	projectLanding = db.page.find( { route: "/search/project" }).map( function(page) { return page._id.str; } ).toString()
82
	organizationLanding = db.page.find( { route: "/search/organization" }).map( function(page) { return page._id.str; } ).toString()
83
	dataproviderLanding = db.page.find( { route: "/search/dataprovider" }).map( function(page) { return page._id.str; } ).toString()
84
	projectReport = db.page.find( { route: "/project-report" }).map( function(page) { return page._id.str; } ).toString()
85

    
86
	searchFind = db.page.find( { route: "/search/find" }).map( function(page) { return page._id.str; } ).toString()
87

    
88
	searchPublications = db.page.find( { route: "/search/find/publications" }).map( function(page) { return page._id.str; } ).toString()
89
	searchDatasets = db.page.find( { route: "/search/find/datasets" }).map( function(page) { return page._id.str; } ).toString()
90
	searchSoftware = db.page.find( { route: "/search/find/software" }).map( function(page) { return page._id.str; } ).toString()
91
	searchProject = db.page.find( { route: "/search/find/projects" }).map( function(page) { return page._id.str; } ).toString()
92
	searchOrganization = db.page.find( { route: "/search/find/organizations" }).map( function(page) { return page._id.str; } ).toString()
93
	searchDataprovider = db.page.find( { route: "/search/find/dataproviders" }).map( function(page) { return page._id.str; } ).toString()
94

    
95
	advancedSearchPublications = db.page.find( { route: "/search/advanced/publications" }).map( function(page) { return page._id.str; } ).toString()
96
	advancedSearchDatasets = db.page.find( { route: "/search/advanced/datasets" }).map( function(page) { return page._id.str; } ).toString()
97
	advancedSearchSoftware = db.page.find( { route: "/search/advanced/software" }).map( function(page) { return page._id.str; } ).toString()
98
	advancedSearchProject = db.page.find( { route: "/search/advanced/projects" }).map( function(page) { return page._id.str; } ).toString()
99
	advancedSearchOrganization = db.page.find( { route: "/search/advanced/organizations" }).map( function(page) { return page._id.str; } ).toString()
100
	advancedSearchDataprovider = db.page.find( { route: "/search/advanced/dataproviders" }).map( function(page) { return page._id.str; } ).toString()
101

    
102
	searchJournals = db.page.find( { route: "/search/journals" }).map( function(page) { return page._id.str; } ).toString()
103
	searchEntityRegistries = db.page.find( { route: "/search/entity-registries" }).map( function(page) { return page._id.str; } ).toString()
104
	searchContentProviders = db.page.find( { route: "/search/content-providers" }).map( function(page) { return page._id.str; } ).toString()
105
	searchJournalsTable = db.page.find( { route: "/search/journals-table" }).map( function(page) { return page._id.str; } ).toString()
106
	searchEntityRegistriesTable = db.page.find( { route: "/search/entity-registries-table" }).map( function(page) { return page._id.str; } ).toString()
107
	searchContentProvidersTable = db.page.find( { route: "/search/content-providers-table" }).map( function(page) { return page._id.str; } ).toString()
108

    
109
	depositPublications = db.page.find( { route: "/participate/deposit-publications" }).map( function(page) { return page._id.str; } ).toString()
110
	depositDatasets = db.page.find( { route: "/participate/deposit-datasets" }).map( function(page) { return page._id.str; } ).toString()
111
	depositPublicationsResults = db.page.find( { route: "/participate/deposit-publications-result" }).map( function(page) { return page._id.str; } ).toString()
112
	depositDatasetsResults = db.page.find( { route: "/participate/deposit-datasets-result" }).map( function(page) { return page._id.str; } ).toString()
113
	depositDatasetSybjectResults = db.page.find( { route: "/participate/deposit-subject-result" }).map( function(page) { return page._id.str; } ).toString()
114

    
115
	link = db.page.find( { route: "/participate/claim" }).map( function(page) { return page._id.str; } ).toString()
116
	directLink = db.page.find( { route: "/participate/direct-claim" }).map( function(page) { return page._id.str; } ).toString()
117
	myClaims = db.page.find( { route: "/myclaims" }).map( function(page) { return page._id.str; } ).toString()
118
	administratorClaims = db.page.find( { route: "/claims" }).map( function(page) { return page._id.str; } ).toString()
119
	claimsProjectManager = db.page.find( { route: "/claims-project-manager" }).map( function(page) { return page._id.str; } ).toString()
120

    
121
	var community_pages = {}
122
	community_pages[publicationLanding] = true;
123
	community_pages[datasetLanding] = true;
124
	community_pages[softwareLanding] = true;
125
	community_pages[projectLanding] = true;
126
	community_pages[organizationLanding] = true;
127
	community_pages[dataproviderLanding] = true;
128
	community_pages[projectReport] = true;
129
	community_pages[searchFind] = true;
130
	community_pages[searchPublications] = true;
131
	community_pages[searchDatasets] = true;
132
	community_pages[searchSoftware] = true;
133
	community_pages[searchProject] = true;
134
	community_pages[searchOrganization] = true;	
135
	community_pages[searchDataprovider] = true;
136
	community_pages[advancedSearchPublications] = true;
137
	community_pages[advancedSearchDatasets] = true; 
138
	community_pages[advancedSearchSoftware] = true;
139
	community_pages[advancedSearchProject] = true;
140
	community_pages[advancedSearchOrganization] = true;
141
	community_pages[advancedSearchDataprovider] = true;
142
	community_pages[searchJournals] = true;
143
	community_pages[searchEntityRegistries] = true; 
144
	community_pages[searchContentProviders] = true;
145
	community_pages[searchJournalsTable] = true;
146
	community_pages[searchEntityRegistriesTable] = true;
147
	community_pages[searchContentProvidersTable] = true; 
148
	community_pages[depositPublications] = true;	
149
	community_pages[depositDatasets] = true;
150
	community_pages[depositPublicationsResults] = true;
151
	community_pages[depositDatasetsResults] = true;
152
	community_pages[depositDatasetSybjectResults] = true;
153
	community_pages[link] = true;
154
	community_pages[directLink] = true;
155
	community_pages[myClaims] = true;
156
	community_pages[administratorClaims] = true;
157
	community_pages[claimsProjectManager] = true;
158

    
159
	var community_entities = {}
160
	community_entities[publicationId] = true;
161
	community_entities[datasetId] = true;
162
	community_entities[softwareId] = true;
163
	community_entities[projectId] = true;
164
	community_entities[organizationId] = true;
165
	community_entities[datasourceId] = true;
166
    var communityPid="test";
167
	db.community.save({	"name" : "OpenAIRE", "pid" : communityPid, "pages" : community_pages, "entities" : community_entities})
168

    
169
	openaireCommunity = db.community.find( { pid: communityPid }).map( function(community) { return community._id.str; } ).toString()
170

    
171
	db.divId.save({ "name" : "link-context-form", "pages" : [link, directLink], "community" : openaireCommunity})
172
	db.divId.save({ "name" : "link-project-form", "pages" : [link, directLink], "community" : openaireCommunity})
173
	db.divId.save({ "name" : "link-result-form", "pages" : [link, directLink], "community" : openaireCommunity})
174
	db.divId.save({ "name" : "link-result-bulk", "pages" : [link], "community" : openaireCommunity})
175
	db.divId.save({ "name" : "link-metadata", "pages" : [link, directLink], "community" : openaireCommunity})
176

    
177
 	var charts_map = {};
178
	charts_map["total"] = { "showInDashboard" : true, "showInDashboard" : false };
179
	charts_map["project"] = { "showInDashboard" : true, "showInDashboard" : false };
180
	charts_map["open"] = { "showInDashboard" : true, "showInDashboard" : false };
181
	charts_map["closed"] = { "showInDashboard" : true, "showInDashboard" : false };
182
	charts_map["embargo"] = { "showInDashboard" : true, "showInDashboard" : false };
183

    
184
	var charts = {"map":charts_map};
185
	var numbers_map = {};
186
    	numbers_map["timeline"] = { "showInDashboard" : true, "showInDashboard" : false };
187
    	numbers_map["graph"] = { "showInDashboard" : true, "showInDashboard" : false };
188
    	numbers_map["projectTable"] = { "showInDashboard" : true, "showInDashboard" : false };
189
    	numbers_map["projectColumn"] = { "showInDashboard" : true, "showInDashboard" : false };
190
    	numbers_map["projectPie"] = { "showInDashboard" : true, "showInDashboard" : false };
191

    
192
	var numbers = {"map":numbers_map};
193
	var statistics_entities = {"charts":charts,"numbers":numbers}
194
	var entities = {};
195
	entities["publication"]=statistics_entities;
196
	entities["dataset"]=statistics_entities;
197
	entities["sofware"]=statistics_entities;
198
	var statistics = {"pid" : communityPid, "entities" : entities};
199

    
200
    db.statistics.save(statistics);
201

    
202
    var subscribers = [];
203
    db.communitySubscribers.save({ "pid" : communityPid, "subscribers" : subscribers})
204

    
205
}
(1-1/3)