Skip to content
Snippets Groups Projects
Commit 86cb0626 authored by Eike Cochu's avatar Eike Cochu
Browse files

added linked iface + generic service impl

added log files to gitignore
added log file appender to cmd log4j config
set proper context root for rest project via maven
added linked interface for rest model classes
added generic request service for rest project that sets base uri automatically
renamed topic to topicdefinition in rest project
added motd to vm bootstrap for login info
removed mongod.conf configuration
added ui topic routes and template stubs
parent 133acea2
No related branches found
No related tags found
No related merge requests found
{{outlet}}
<h2>Found topics</h2>
\ No newline at end of file
import { moduleForModel, test } from 'ember-qunit';
moduleForModel('topic', 'Unit | Model | topic', {
// Specify the other units that are required for this test.
needs: []
});
test('it exists', function(assert) {
let model = this.subject();
// let store = this.store();
assert.ok(!!model);
});
import { moduleFor, test } from 'ember-qunit';
moduleFor('route:topics', 'Unit | Route | topics', {
// Specify the other units that are required for this test.
// needs: ['controller:foo']
});
test('it exists', function(assert) {
let route = this.subject();
assert.ok(route);
});
package de.vipra.util.model;
import java.io.File;
import java.io.IOException;
import org.bson.Document;
public class Topic extends Model {
@Override
public void fromDocument(Document document) {
// TODO Auto-generated method stub
}
@Override
public Document toDocument() {
// TODO Auto-generated method stub
return null;
}
@Override
public void fromFile(File file) throws IOException {
// TODO Auto-generated method stub
}
@Override
public String toFileString() {
// TODO Auto-generated method stub
return null;
}
}
......@@ -12,7 +12,7 @@ import de.vipra.util.ex.NotImplementedException;
public class TopicDefinition extends Model {
private int index;
private List<String> names;
private String name;
private List<TopicWord> words;
public TopicDefinition() {}
......@@ -29,12 +29,12 @@ public class TopicDefinition extends Model {
this.index = index;
}
public List<String> getNames() {
return names;
public String getName() {
return name;
}
public void setNames(List<String> names) {
this.names = names;
public void setName(String name) {
this.name = name;
}
public List<TopicWord> getWords() {
......@@ -48,6 +48,7 @@ public class TopicDefinition extends Model {
@SuppressWarnings("unchecked")
@Override
public void fromDocument(Document document) {
setName(document.getString("name"));
setIndex(document.getInteger("index", 0));
if (document.containsKey("words")) {
List<Document> topicWords = (List<Document>) document.get("words");
......@@ -61,12 +62,15 @@ public class TopicDefinition extends Model {
@Override
public Document toDocument() {
Document document = new Document();
document.append("name", getName());
document.append("index", getIndex());
List<Document> topicWords = new ArrayList<>(words.size());
for (TopicWord word : words) {
topicWords.add(word.toDocument());
if (getWords() != null) {
List<Document> topicWords = new ArrayList<>(words.size());
for (TopicWord word : words) {
topicWords.add(word.toDocument());
}
document.put("words", topicWords);
}
document.put("words", topicWords);
return document;
}
......
......@@ -4,6 +4,7 @@ import static de.vipra.util.MongoUtils.getSorts;
import static de.vipra.util.MongoUtils.objectId;
import java.util.ArrayList;
import java.util.List;
import org.bson.Document;
import org.slf4j.Logger;
......@@ -54,10 +55,10 @@ public class DatabaseService<T extends Model> implements Service<T, DatabaseExce
}
}
public ArrayList<T> getMultiple(int skip, int limit, String sortBy) {
ArrayList<Document> documents = collection.find().skip(skip).limit(limit).sort(getSorts(sortBy))
public List<T> getMultiple(int skip, int limit, String sortBy) {
List<Document> documents = collection.find().skip(skip).limit(limit).sort(getSorts(sortBy))
.into(new ArrayList<Document>());
ArrayList<T> items = new ArrayList<>(documents.size());
List<T> items = new ArrayList<>(documents.size());
for (Document document : documents) {
items.add(newT(document));
......
......@@ -95,6 +95,7 @@ ufw disable
# set environment
cat $CONFIG/environment >> /etc/environment
cat $CONFIG/motd > /etc/motd
# -----------------------------------------------------------------------------
# cleanup
......
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# Where and how to store data.
storage:
dbPath: /var/lib/mongodb
journal:
enabled: true
# engine:
# mmapv1:
# wiredTiger:
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
# network interfaces
net:
port: 27017
bindIp: 0.0.0.0
#processManagement:
#security:
#operationProfiling:
#replication:
#sharding:
## Enterprise-Only Options:
#auditLog:
#snmp:
====================
Vipra Development VM
====================
Start database and web server manually:
> service mongod restart
> service tomcat restart
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment