mirror of
https://github.com/sismics/docs.git
synced 2024-12-22 11:23:48 +01:00
Edit document, add files, display files
This commit is contained in:
parent
9b74bd8194
commit
3a2ffec497
@ -1,7 +1,6 @@
|
||||
package com.sismics.util.mime;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.PushbackInputStream;
|
||||
|
||||
/**
|
||||
* Utility to check MIME types.
|
||||
@ -18,9 +17,9 @@ public class MimeTypeUtil {
|
||||
*/
|
||||
public static String guessMimeType(InputStream is) throws Exception {
|
||||
byte[] headerBytes = new byte[64];
|
||||
PushbackInputStream pb = new PushbackInputStream(is, headerBytes.length);
|
||||
int readCount = pb.read(headerBytes);
|
||||
pb.unread(headerBytes);
|
||||
is.mark(headerBytes.length);
|
||||
int readCount = is.read(headerBytes);
|
||||
is.reset();
|
||||
|
||||
if (readCount <= 0) {
|
||||
throw new Exception("Cannot read input file");
|
||||
|
@ -46,9 +46,10 @@ public class DocumentResource extends BaseResource {
|
||||
* @throws JSONException
|
||||
*/
|
||||
@GET
|
||||
@Path("{id: [a-z0-9\\-]+}")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public Response get(
|
||||
@QueryParam("id") String id) throws JSONException {
|
||||
@PathParam("id") String id) throws JSONException {
|
||||
if (!authenticate()) {
|
||||
throw new ForbiddenClientException();
|
||||
}
|
||||
@ -190,7 +191,7 @@ public class DocumentResource extends BaseResource {
|
||||
|
||||
// Always return ok
|
||||
JSONObject response = new JSONObject();
|
||||
response.put("status", "ok");
|
||||
response.put("id", id);
|
||||
return Response.ok().entity(response).build();
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,11 @@
|
||||
package com.sismics.docs.rest.resource;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FilenameFilter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.text.MessageFormat;
|
||||
@ -18,10 +23,12 @@ import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.QueryParam;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.StreamingOutput;
|
||||
|
||||
import org.codehaus.jettison.json.JSONException;
|
||||
import org.codehaus.jettison.json.JSONObject;
|
||||
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.sismics.docs.core.dao.jpa.DocumentDao;
|
||||
import com.sismics.docs.core.dao.jpa.FileDao;
|
||||
import com.sismics.docs.core.model.jpa.Document;
|
||||
@ -42,61 +49,6 @@ import com.sun.jersey.multipart.FormDataParam;
|
||||
*/
|
||||
@Path("/file")
|
||||
public class FileResource extends BaseResource {
|
||||
/**
|
||||
* Add a file to a document.
|
||||
*
|
||||
* @param id Document ID
|
||||
* @param fileBodyPart File to add
|
||||
* @return Response
|
||||
* @throws JSONException
|
||||
*/
|
||||
@PUT
|
||||
@Consumes("multipart/form-data")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public Response add(
|
||||
@FormDataParam("id") String documentId,
|
||||
@FormDataParam("file") FormDataBodyPart fileBodyPart) throws JSONException {
|
||||
if (!authenticate()) {
|
||||
throw new ForbiddenClientException();
|
||||
}
|
||||
|
||||
// Validate input data
|
||||
ValidationUtil.validateRequired(documentId, "id");
|
||||
ValidationUtil.validateRequired(fileBodyPart, "file");
|
||||
|
||||
// Get the document
|
||||
DocumentDao documentDao = new DocumentDao();
|
||||
Document document = null;
|
||||
try {
|
||||
document = documentDao.getDocument(documentId, principal.getId());
|
||||
} catch (NoResultException e) {
|
||||
throw new ClientException("DocumentNotFound", MessageFormat.format("Document not found: {0}", documentId));
|
||||
}
|
||||
|
||||
|
||||
FileDao fileDao = new FileDao();
|
||||
|
||||
InputStream is = fileBodyPart.getValueAs(InputStream.class);
|
||||
try {
|
||||
// Create the file
|
||||
File file = new File();
|
||||
file.setDocumentId(document.getId());
|
||||
file.setMimeType(MimeTypeUtil.guessMimeType(is));
|
||||
String fileId = fileDao.create(file);
|
||||
|
||||
// Copy the incoming stream content into the storage directory
|
||||
Files.copy(is, Paths.get(DirectoryUtil.getStorageDirectory().getPath(), fileId));
|
||||
|
||||
// Always return ok
|
||||
JSONObject response = new JSONObject();
|
||||
response.put("status", "ok");
|
||||
response.put("id", fileId);
|
||||
return Response.ok().entity(response).build();
|
||||
} catch (Exception e) {
|
||||
throw new ServerException("FileError", "Error adding a file", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a file.
|
||||
*
|
||||
@ -129,6 +81,71 @@ public class FileResource extends BaseResource {
|
||||
return Response.ok().entity(file).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a file to a document.
|
||||
*
|
||||
* @param id Document ID
|
||||
* @param fileBodyPart File to add
|
||||
* @return Response
|
||||
* @throws JSONException
|
||||
*/
|
||||
@PUT
|
||||
@Consumes("multipart/form-data")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public Response add(
|
||||
@FormDataParam("id") String documentId,
|
||||
@FormDataParam("file") FormDataBodyPart fileBodyPart) throws JSONException {
|
||||
if (!authenticate()) {
|
||||
throw new ForbiddenClientException();
|
||||
}
|
||||
|
||||
// Validate input data
|
||||
ValidationUtil.validateRequired(documentId, "id");
|
||||
ValidationUtil.validateRequired(fileBodyPart, "file");
|
||||
|
||||
// Get the document
|
||||
DocumentDao documentDao = new DocumentDao();
|
||||
Document document = null;
|
||||
try {
|
||||
document = documentDao.getDocument(documentId, principal.getId());
|
||||
} catch (NoResultException e) {
|
||||
throw new ClientException("DocumentNotFound", MessageFormat.format("Document not found: {0}", documentId));
|
||||
}
|
||||
|
||||
FileDao fileDao = new FileDao();
|
||||
|
||||
// Validate mime type
|
||||
InputStream is = new BufferedInputStream(fileBodyPart.getValueAs(InputStream.class));
|
||||
String mimeType = null;
|
||||
try {
|
||||
mimeType = MimeTypeUtil.guessMimeType(is);
|
||||
} catch (Exception e) {
|
||||
throw new ServerException("ErrorGuessMime", "Error guessing mime type", e);
|
||||
}
|
||||
if (mimeType == null) {
|
||||
throw new ClientException("InvalidFileType", "File type not recognized");
|
||||
}
|
||||
|
||||
try {
|
||||
// Create the file
|
||||
File file = new File();
|
||||
file.setDocumentId(document.getId());
|
||||
file.setMimeType(mimeType);
|
||||
String fileId = fileDao.create(file);
|
||||
|
||||
// Copy the incoming stream content into the storage directory
|
||||
Files.copy(is, Paths.get(DirectoryUtil.getStorageDirectory().getPath(), fileId));
|
||||
|
||||
// Always return ok
|
||||
JSONObject response = new JSONObject();
|
||||
response.put("status", "ok");
|
||||
response.put("id", fileId);
|
||||
return Response.ok().entity(response).build();
|
||||
} catch (Exception e) {
|
||||
throw new ServerException("FileError", "Error adding a file", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns files linked to a document.
|
||||
*
|
||||
@ -197,4 +214,42 @@ public class FileResource extends BaseResource {
|
||||
response.put("status", "ok");
|
||||
return Response.ok().entity(response).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a file.
|
||||
*
|
||||
* @param id File ID
|
||||
* @return Response
|
||||
* @throws JSONException
|
||||
*/
|
||||
@GET
|
||||
@Path("{id: [a-z0-9\\-]+}/data")
|
||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
public Response data(
|
||||
@PathParam("id") final String id) throws JSONException {
|
||||
if (!authenticate()) {
|
||||
throw new ForbiddenClientException();
|
||||
}
|
||||
|
||||
// Get the file
|
||||
java.io.File storageDirectory = DirectoryUtil.getStorageDirectory();
|
||||
java.io.File[] matchingFiles = storageDirectory.listFiles(new FilenameFilter() {
|
||||
@Override
|
||||
public boolean accept(java.io.File dir, String name) {
|
||||
return name.startsWith(id);
|
||||
}
|
||||
});
|
||||
final java.io.File storageFile = matchingFiles[0];
|
||||
|
||||
// Stream the file to the response
|
||||
StreamingOutput stream = new StreamingOutput() {
|
||||
@Override
|
||||
public void write(OutputStream os) throws IOException {
|
||||
ByteStreams.copy(new FileInputStream(storageFile), os);
|
||||
}
|
||||
};
|
||||
return Response.ok(stream)
|
||||
.header("Content-Disposition", MessageFormat.format("attachment; filename=\"{0}\"", storageFile.getName()))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
1
docs-web/src/main/webapp/.gitignore
vendored
Normal file
1
docs-web/src/main/webapp/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/sismicsdocs
|
@ -18,16 +18,21 @@
|
||||
<script src="lib/less.js" type="text/javascript"></script>
|
||||
<script src="lib/underscore.js" type="text/javascript"></script>
|
||||
<script src="lib/angular/angular.js" type="text/javascript"></script>
|
||||
<script src="lib/angular/angular-sanitize.js" type="text/javascript"></script>
|
||||
<script src="lib/angular.ui-router.js" type="text/javascript"></script>
|
||||
<script src="lib/angular.ui-bootstrap.js" type="text/javascript"></script>
|
||||
<script src="lib/angular.ui-utils.js" type="text/javascript"></script>
|
||||
<script src="lib/angular.restangular.js" type="text/javascript"></script>
|
||||
<script src="js/app.js" type="text/javascript"></script>
|
||||
<script src="js/controller/Main.js" type="text/javascript"></script>
|
||||
<script src="js/controller/Document.js" type="text/javascript"></script>
|
||||
<script src="js/controller/DocumentEdit.js" type="text/javascript"></script>
|
||||
<script src="js/controller/DocumentView.js" type="text/javascript"></script>
|
||||
<script src="js/controller/FileView.js" type="text/javascript"></script>
|
||||
<script src="js/controller/Login.js" type="text/javascript"></script>
|
||||
<script src="js/service/User.js" type="text/javascript"></script>
|
||||
<script src="js/filter/Newline.js" type="text/javascript"></script>
|
||||
<script src="js/directive/File.js" type="text/javascript"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="navbar">
|
||||
|
@ -3,7 +3,7 @@
|
||||
/**
|
||||
* Trackino application.
|
||||
*/
|
||||
var App = angular.module('docs', ['ui.state', 'ui.bootstrap', 'restangular'])
|
||||
var App = angular.module('docs', ['ui.state', 'ui.bootstrap', 'ui.keypress', 'restangular', 'ngSanitize'])
|
||||
|
||||
/**
|
||||
* Configuring modules.
|
||||
@ -22,6 +22,7 @@ var App = angular.module('docs', ['ui.state', 'ui.bootstrap', 'restangular'])
|
||||
})
|
||||
.state('document', {
|
||||
url: '/document',
|
||||
abstract: true,
|
||||
views: {
|
||||
'page': {
|
||||
templateUrl: 'partial/document.html',
|
||||
@ -29,6 +30,14 @@ var App = angular.module('docs', ['ui.state', 'ui.bootstrap', 'restangular'])
|
||||
}
|
||||
}
|
||||
})
|
||||
.state('document.default', {
|
||||
url: '',
|
||||
views: {
|
||||
'document': {
|
||||
templateUrl: 'partial/document.default.html'
|
||||
}
|
||||
}
|
||||
})
|
||||
.state('document.add', {
|
||||
url: '/add',
|
||||
views: {
|
||||
@ -56,6 +65,18 @@ var App = angular.module('docs', ['ui.state', 'ui.bootstrap', 'restangular'])
|
||||
}
|
||||
}
|
||||
})
|
||||
.state('document.view.file', {
|
||||
url: '/file/:fileId',
|
||||
onEnter: function($stateParams, $state, $dialog) {
|
||||
$dialog.dialog({
|
||||
keyboard: true,
|
||||
templateUrl: 'partial/file.view.html',
|
||||
controller: 'FileView'
|
||||
}).open().then(function(result) {
|
||||
$state.transitionTo('document.view', { id: $stateParams.id });
|
||||
});
|
||||
}
|
||||
})
|
||||
.state('login', {
|
||||
url: '/login',
|
||||
views: {
|
||||
|
@ -5,19 +5,61 @@
|
||||
*/
|
||||
App.controller('Document', function($scope, $state, Restangular) {
|
||||
/**
|
||||
* Load documents.
|
||||
* Documents table sort status.
|
||||
*/
|
||||
$scope.loadDocuments = function() {
|
||||
$scope.sortColumn = 3;
|
||||
$scope.asc = false;
|
||||
$scope.offset = 0;
|
||||
$scope.currentPage = 1;
|
||||
$scope.limit = 10;
|
||||
|
||||
/**
|
||||
* Load new documents page.
|
||||
*/
|
||||
$scope.pageDocuments = function() {
|
||||
Restangular.one('document')
|
||||
.getList('list', {
|
||||
offset: 0,
|
||||
limit: 30
|
||||
offset: $scope.offset,
|
||||
limit: $scope.limit,
|
||||
sort_column: $scope.sortColumn,
|
||||
asc: $scope.asc
|
||||
})
|
||||
.then(function(data) {
|
||||
$scope.documents = data.documents;
|
||||
$scope.documents = data;
|
||||
$scope.numPages = Math.ceil(data.total / $scope.limit);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Reload documents.
|
||||
*/
|
||||
$scope.loadDocuments = function() {
|
||||
$scope.offset = 0;
|
||||
$scope.currentPage = 1;
|
||||
$scope.pageDocuments();
|
||||
};
|
||||
|
||||
/**
|
||||
* Watch for current page change.
|
||||
*/
|
||||
$scope.$watch('currentPage', function() {
|
||||
$scope.offset = ($scope.currentPage - 1) * $scope.limit;
|
||||
$scope.pageDocuments();
|
||||
});
|
||||
|
||||
/**
|
||||
* Sort documents.
|
||||
*/
|
||||
$scope.sortDocuments = function(sortColumn) {
|
||||
if (sortColumn == $scope.sortColumn) {
|
||||
$scope.asc = !$scope.asc;
|
||||
} else {
|
||||
$scope.asc = true;
|
||||
}
|
||||
$scope.sortColumn = sortColumn;
|
||||
$scope.loadDocuments();
|
||||
};
|
||||
|
||||
/**
|
||||
* Go to add document form.
|
||||
*/
|
||||
@ -25,10 +67,17 @@ App.controller('Document', function($scope, $state, Restangular) {
|
||||
$state.transitionTo('document.add');
|
||||
};
|
||||
|
||||
/**
|
||||
* Go to edit document form.
|
||||
*/
|
||||
$scope.editDocument = function(id) {
|
||||
$state.transitionTo('document.edit', { id: id });
|
||||
};
|
||||
|
||||
/**
|
||||
* Display a document.
|
||||
*/
|
||||
$scope.viewDocument = function(id) {
|
||||
$state.transitionTo('document.view', { id: id });
|
||||
};
|
||||
|
||||
// Initial documents loading
|
||||
$scope.loadDocuments();
|
||||
});
|
@ -3,7 +3,7 @@
|
||||
/**
|
||||
* Document edition controller.
|
||||
*/
|
||||
App.controller('DocumentEdit', function($scope, $state, $stateParams, Restangular) {
|
||||
App.controller('DocumentEdit', function($scope, $http, $state, $stateParams, Restangular) {
|
||||
/**
|
||||
* Returns true if in edit mode (false in add mode).
|
||||
*/
|
||||
@ -11,27 +11,65 @@ App.controller('DocumentEdit', function($scope, $state, $stateParams, Restangula
|
||||
return $stateParams.id;
|
||||
};
|
||||
|
||||
/**
|
||||
* In edit mode, load the current document.
|
||||
*/
|
||||
if ($scope.isEdit()) {
|
||||
Restangular.one('document', $stateParams.id).get().then(function(data) {
|
||||
$scope.document = data;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit a document.
|
||||
*/
|
||||
$scope.edit = function() {
|
||||
var promise = null;
|
||||
|
||||
if ($scope.isEdit()) {
|
||||
// TODO
|
||||
promise = Restangular
|
||||
.one('document', $stateParams.id)
|
||||
.post('', $scope.document);
|
||||
promise.then(function(data) {
|
||||
$scope.loadDocuments();
|
||||
$state.transitionTo('document.view', { id: $stateParams.id });
|
||||
})
|
||||
} else {
|
||||
Restangular
|
||||
promise = Restangular
|
||||
.one('document')
|
||||
.put($scope.document)
|
||||
.then(function() {
|
||||
.put($scope.document);
|
||||
promise.then(function(data) {
|
||||
$scope.document = {};
|
||||
$scope.loadDocuments();
|
||||
});
|
||||
}
|
||||
|
||||
// Upload files after edition
|
||||
// TODO Handle file upload progression and errors
|
||||
promise.then(function(data) {
|
||||
_.each($scope.files, function(file) {
|
||||
var formData = new FormData();
|
||||
formData.append('id', data.id);
|
||||
formData.append('file', file);
|
||||
$.ajax({
|
||||
url: 'api/file',
|
||||
type: 'PUT',
|
||||
data: formData,
|
||||
processData: false,
|
||||
contentType: false
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Cancel edition.
|
||||
*/
|
||||
$scope.cancel = function() {
|
||||
$state.transitionTo('document');
|
||||
if ($scope.isEdit()) {
|
||||
$state.transitionTo('document.view', { id: $stateParams.id });
|
||||
} else {
|
||||
$state.transitionTo('document.default');
|
||||
}
|
||||
};
|
||||
});
|
@ -3,5 +3,17 @@
|
||||
/**
|
||||
* Document view controller.
|
||||
*/
|
||||
App.controller('DocumentView', function($scope, Restangular) {
|
||||
App.controller('DocumentView', function($rootScope, $scope, $state, $stateParams, Restangular) {
|
||||
// Load data from server
|
||||
$scope.document = Restangular.one('document', $stateParams.id).get();
|
||||
Restangular.one('file').getList('list', { id: $stateParams.id }).then(function(data) {
|
||||
$rootScope.files = data.files;
|
||||
});
|
||||
|
||||
/**
|
||||
* Navigate to the selected file.
|
||||
*/
|
||||
$scope.openFile = function(file) {
|
||||
$state.transitionTo('document.view.file', { id: $stateParams.id, fileId: file.id })
|
||||
}
|
||||
});
|
36
docs-web/src/main/webapp/js/controller/FileView.js
Normal file
36
docs-web/src/main/webapp/js/controller/FileView.js
Normal file
@ -0,0 +1,36 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* File view controller.
|
||||
*/
|
||||
App.controller('FileView', function($rootScope, $state, $scope, $stateParams) {
|
||||
$scope.id = $stateParams.fileId;
|
||||
|
||||
/**
|
||||
* Navigate to the next file.
|
||||
*/
|
||||
$scope.nextFile = function() {
|
||||
_.each($rootScope.files, function(value, key, list) {
|
||||
if (value.id == $scope.id) {
|
||||
var next = $rootScope.files[key + 1];
|
||||
if (next) {
|
||||
$state.transitionTo('document.view.file', { id: $stateParams.id, fileId: next.id });
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Navigate to the previous file.
|
||||
*/
|
||||
$scope.previousFile = function() {
|
||||
_.each($rootScope.files, function(value, key, list) {
|
||||
if (value.id == $scope.id) {
|
||||
var previous = $rootScope.files[key - 1];
|
||||
if (previous) {
|
||||
$state.transitionTo('document.view.file', { id: $stateParams.id, fileId: previous.id });
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
@ -6,7 +6,7 @@
|
||||
App.controller('Login', function($scope, $state, $dialog, User) {
|
||||
$scope.login = function() {
|
||||
User.login($scope.user).then(function() {
|
||||
$state.transitionTo('browse');
|
||||
$state.transitionTo('document.default');
|
||||
}, function() {
|
||||
var title = 'Login failed';
|
||||
var msg = 'Username or password invalid';
|
||||
|
@ -8,7 +8,7 @@ App.controller('Main', function($scope, $state, User) {
|
||||
if (data.anonymous) {
|
||||
$state.transitionTo('login');
|
||||
} else {
|
||||
$state.transitionTo('document');
|
||||
$state.transitionTo('document.default');
|
||||
}
|
||||
});
|
||||
});
|
21
docs-web/src/main/webapp/js/directive/File.js
Normal file
21
docs-web/src/main/webapp/js/directive/File.js
Normal file
@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* File upload directive.
|
||||
*/
|
||||
App.directive('file', function() {
|
||||
return {
|
||||
restrict: 'E',
|
||||
template: '<input type="file" />',
|
||||
replace: true,
|
||||
require: 'ngModel',
|
||||
link: function(scope, element, attr, ctrl) {
|
||||
var listener = function() {
|
||||
scope.$apply(function() {
|
||||
attr.multiple ? ctrl.$setViewValue(element[0].files) : ctrl.$setViewValue(element[0].files[0]);
|
||||
});
|
||||
}
|
||||
element.bind('change', listener);
|
||||
}
|
||||
}
|
||||
});
|
13
docs-web/src/main/webapp/js/filter/Newline.js
Normal file
13
docs-web/src/main/webapp/js/filter/Newline.js
Normal file
@ -0,0 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Filter converting new lines in <br />
|
||||
*/
|
||||
App.filter('newline', function() {
|
||||
return function(text) {
|
||||
if (!text) {
|
||||
return '';
|
||||
}
|
||||
return text.replace(/\n/g, '<br/>');
|
||||
}
|
||||
})
|
1261
docs-web/src/main/webapp/lib/angular.ui-utils.js
Normal file
1261
docs-web/src/main/webapp/lib/angular.ui-utils.js
Normal file
File diff suppressed because it is too large
Load Diff
8
docs-web/src/main/webapp/partial/document.default.html
Normal file
8
docs-web/src/main/webapp/partial/document.default.html
Normal file
@ -0,0 +1,8 @@
|
||||
<p class="lead">
|
||||
{{ documents.total }} document{{ documents.total > 1 ? 's' : '' }} in the database
|
||||
</p>
|
||||
|
||||
<blockquote class="pull-right">
|
||||
<p>There seems to be a kind of order in the universe, in the movement of the stars and the turning of the earth and the changing of the seasons, and even in the cycle of human life. But human life itself is almost pure chaos. Everyone takes his stance, asserts his own rights and feelings, mistaking the motives of others, and his own.</p>
|
||||
<small>Katherine Anne Porter</small>
|
||||
</blockquote>
|
@ -1,18 +1,24 @@
|
||||
<form class="form-horizontal">
|
||||
<div class="control-group">
|
||||
<form class="form-horizontal" name="documentForm">
|
||||
<div class="control-group" ng-class="{ error: !documentForm.title.$valid }">
|
||||
<label class="control-label" for="inputTitle">Title</label>
|
||||
<div class="controls">
|
||||
<input class="input-block-level" type="text" id="inputTitle" placeholder="Title" ng-model="document.title" />
|
||||
<input required ng-maxlength="100" class="input-block-level" type="text" id="inputTitle" placeholder="Title" name="title" ng-model="document.title" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group" ng-class="{ error: !documentForm.description.$valid }">
|
||||
<label class="control-label" for="inputDescription">Description</label>
|
||||
<div class="controls">
|
||||
<textarea ng-maxlength="4000" class="input-block-level" rows="5" id="inputDescription" name="description" ng-model="document.description"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="inputDescription">Description</label>
|
||||
<label class="control-label" for="inputFiles">New files</label>
|
||||
<div class="controls">
|
||||
<textarea class="input-block-level" rows="5" id="inputDescription" ng-model="document.description"></textarea>
|
||||
<file class="input-block-level" id="inputFiles" multiple="multiple" ng-model="files" accept="image/png,image/jpg,image/jpeg,image/gif" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<button type="submit" class="btn btn-primary" ng-click="edit()">{{ isEdit() ? 'Edit' : 'Add' }}</button>
|
||||
<button type="submit" class="btn btn-primary" ng-disabled="!documentForm.$valid" ng-click="edit()">{{ isEdit() ? 'Edit' : 'Add' }}</button>
|
||||
<button type="submit" class="btn" ng-click="cancel()">Cancel</button>
|
||||
</div>
|
||||
</form>
|
@ -1,25 +1,28 @@
|
||||
<div class="container-fluid">
|
||||
<div class="row-fluid">
|
||||
<div class="span5 well">
|
||||
<div class="span4 well">
|
||||
<p class="text-center">
|
||||
<button class="btn btn-primary" type="button" ng-click="addDocument()">Add a document</button>
|
||||
</p>
|
||||
<table class="table table-striped table-hover">
|
||||
<table class="table table-striped table-hover table-documents">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Title</th>
|
||||
<th>Creation date</th>
|
||||
<th ng-click="sortDocuments(1)"><span class="icon-chevron-{{ sortColumn == 1 ? (asc ? 'down' : 'up') : '' }}"></span> Title</th>
|
||||
<th ng-click="sortDocuments(3)"><span class="icon-chevron-{{ sortColumn == 3 ? (asc ? 'down' : 'up') : '' }}"></span> Creation date</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-click="viewDocument(document.id)" ng-repeat="document in documents">
|
||||
<tr ng-click="viewDocument(document.id)" ng-repeat="document in documents.documents">
|
||||
<td>{{ document.title }}</td>
|
||||
<td>{{ document.create_date | date: 'short' }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="text-center">
|
||||
<pagination num-pages="numPages" max-size="5" current-page="currentPage"></pagination>
|
||||
</div>
|
||||
</div>
|
||||
<div class="span7 well">
|
||||
<div class="span8 well">
|
||||
<div ui-view="document"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1 +1,26 @@
|
||||
View doc
|
||||
<div class="text-right">
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-primary" ng-click="editDocument(document.id)"><span class="icon-pencil icon-white"></span> Edit</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-header">
|
||||
<h1>{{ document.title }} <small>{{ document.create_date | date: 'short' }}</small></h1>
|
||||
</div>
|
||||
|
||||
<p ng-bind-html="document.description | newline"></p>
|
||||
|
||||
<ul class="thumbnails" ng-show="files.length > 0">
|
||||
<li class="span2" ng-repeat="file in files" ng-style="{ 'margin-left': $index % 6 == 0 ? '0' : '' }">
|
||||
<div class="thumbnail">
|
||||
<a ng-click="openFile(file)">
|
||||
<img ng-src="api/file/{{ file.id }}/data" tooltip="{{ file.mimetype }}" tooltip-placement="top" />
|
||||
</a>
|
||||
<div class="caption">
|
||||
<p class="text-right">
|
||||
<button class="btn btn-danger" ng-click="deleteFile(file.id)"><span class="icon-trash icon-white"></span></button>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
7
docs-web/src/main/webapp/partial/file.view.html
Normal file
7
docs-web/src/main/webapp/partial/file.view.html
Normal file
@ -0,0 +1,7 @@
|
||||
<div class="text-center">
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn" ng-click="previousFile()">Previous</button>
|
||||
<button type="button" class="btn" ng-click="nextFile()">Next</button>
|
||||
</div>
|
||||
</div>
|
||||
<img ng-src="api/file/{{ id }}/data" />
|
@ -1,6 +1,5 @@
|
||||
<div class="row-fluid">
|
||||
<div class="span4 offset4">
|
||||
<h1 class="text-center">Sismics Docs</h1>
|
||||
<form class="form-horizontal">
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="inputUsername">Username</label>
|
||||
|
@ -1,310 +0,0 @@
|
||||
27 Jul 2013 13:37:48,704 INFO com.sismics.util.jpa.EMF.getEntityManagerProperties(EMF.java:69) Configuring EntityManager from hibernate.properties
|
||||
27 Jul 2013 13:37:49,155 INFO com.sismics.util.jpa.DbOpenHelper.open(DbOpenHelper.java:67) Opening database and executing incremental updates
|
||||
27 Jul 2013 13:37:49,157 INFO com.sismics.util.jpa.DbOpenHelper.open(DbOpenHelper.java:95) Unable to get database version: Table T_CONFIG not found
|
||||
27 Jul 2013 13:37:49,157 INFO com.sismics.util.jpa.DbOpenHelper.open(DbOpenHelper.java:109) Executing initial schema creation script
|
||||
27 Jul 2013 13:37:49,159 ERROR com.sismics.util.jpa.DbOpenHelper.open(DbOpenHelper.java:122) Unable to complete schema update
|
||||
java.lang.UnsupportedOperationException: Cannot list files for URL file:/C:/Users/Ben/workspace/bgd/docs/trunk/docs-core/target/classes/com/sismics/util/jpa/EMF$1.class
|
||||
at com.sismics.util.ResourceUtil.list(ResourceUtil.java:86)
|
||||
at com.sismics.util.jpa.DbOpenHelper.executeAllScript(DbOpenHelper.java:152)
|
||||
at com.sismics.util.jpa.EMF$1.onCreate(EMF.java:45)
|
||||
at com.sismics.util.jpa.DbOpenHelper.open(DbOpenHelper.java:110)
|
||||
at com.sismics.util.jpa.EMF.<clinit>(EMF.java:55)
|
||||
at com.sismics.docs.core.util.TransactionUtil.handle(TransactionUtil.java:38)
|
||||
at com.sismics.util.filter.RequestContextFilter.init(RequestContextFilter.java:76)
|
||||
at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:114)
|
||||
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
|
||||
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:754)
|
||||
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:258)
|
||||
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1221)
|
||||
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:699)
|
||||
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:454)
|
||||
at org.mortbay.jetty.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:256)
|
||||
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
|
||||
at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:224)
|
||||
at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:167)
|
||||
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
|
||||
at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:224)
|
||||
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
|
||||
at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:90)
|
||||
at org.eclipse.jetty.server.Server.doStart(Server.java:263)
|
||||
at org.mortbay.jetty.plugin.JettyServer.doStart(JettyServer.java:65)
|
||||
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
|
||||
at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:511)
|
||||
at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:364)
|
||||
at org.mortbay.jetty.plugin.JettyRunMojo.execute(JettyRunMojo.java:516)
|
||||
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
|
||||
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
|
||||
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
|
||||
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
|
||||
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
|
||||
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
|
||||
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
|
||||
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
|
||||
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
|
||||
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
|
||||
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
|
||||
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
|
||||
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
|
||||
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
||||
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
|
||||
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
||||
at java.lang.reflect.Method.invoke(Method.java:601)
|
||||
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
|
||||
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
|
||||
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
|
||||
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
|
||||
27 Jul 2013 13:37:49,162 INFO com.sismics.util.jpa.EMF.getEntityManagerProperties(EMF.java:69) Configuring EntityManager from hibernate.properties
|
||||
27 Jul 2013 13:37:49,244 ERROR com.sismics.util.jpa.EMF.<clinit>(EMF.java:60) Error creating EMF
|
||||
javax.persistence.PersistenceException: No Persistence provider for EntityManager named transactions-optional
|
||||
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:69)
|
||||
at com.sismics.util.jpa.EMF.<clinit>(EMF.java:57)
|
||||
at com.sismics.docs.core.util.TransactionUtil.handle(TransactionUtil.java:38)
|
||||
at com.sismics.util.filter.RequestContextFilter.init(RequestContextFilter.java:76)
|
||||
at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:114)
|
||||
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
|
||||
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:754)
|
||||
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:258)
|
||||
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1221)
|
||||
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:699)
|
||||
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:454)
|
||||
at org.mortbay.jetty.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:256)
|
||||
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
|
||||
at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:224)
|
||||
at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:167)
|
||||
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
|
||||
at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:224)
|
||||
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
|
||||
at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:90)
|
||||
at org.eclipse.jetty.server.Server.doStart(Server.java:263)
|
||||
at org.mortbay.jetty.plugin.JettyServer.doStart(JettyServer.java:65)
|
||||
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
|
||||
at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:511)
|
||||
at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:364)
|
||||
at org.mortbay.jetty.plugin.JettyRunMojo.execute(JettyRunMojo.java:516)
|
||||
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
|
||||
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
|
||||
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
|
||||
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
|
||||
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
|
||||
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
|
||||
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
|
||||
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
|
||||
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
|
||||
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
|
||||
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
|
||||
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
|
||||
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
|
||||
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
||||
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
|
||||
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
||||
at java.lang.reflect.Method.invoke(Method.java:601)
|
||||
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
|
||||
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
|
||||
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
|
||||
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
|
||||
27 Jul 2013 13:37:49,245 ERROR com.sismics.docs.core.util.TransactionUtil.handle(TransactionUtil.java:40) Cannot create entity manager
|
||||
java.lang.NullPointerException
|
||||
at com.sismics.docs.core.util.TransactionUtil.handle(TransactionUtil.java:38)
|
||||
at com.sismics.util.filter.RequestContextFilter.init(RequestContextFilter.java:76)
|
||||
at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:114)
|
||||
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
|
||||
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:754)
|
||||
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:258)
|
||||
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1221)
|
||||
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:699)
|
||||
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:454)
|
||||
at org.mortbay.jetty.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:256)
|
||||
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
|
||||
at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:224)
|
||||
at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:167)
|
||||
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
|
||||
at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:224)
|
||||
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
|
||||
at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:90)
|
||||
at org.eclipse.jetty.server.Server.doStart(Server.java:263)
|
||||
at org.mortbay.jetty.plugin.JettyServer.doStart(JettyServer.java:65)
|
||||
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
|
||||
at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:511)
|
||||
at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:364)
|
||||
at org.mortbay.jetty.plugin.JettyRunMojo.execute(JettyRunMojo.java:516)
|
||||
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
|
||||
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
|
||||
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
|
||||
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
|
||||
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
|
||||
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
|
||||
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
|
||||
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
|
||||
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
|
||||
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
|
||||
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
|
||||
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
|
||||
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
|
||||
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
||||
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
|
||||
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
||||
at java.lang.reflect.Method.invoke(Method.java:601)
|
||||
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
|
||||
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
|
||||
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
|
||||
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
|
||||
27 Jul 2013 13:43:02,167 INFO com.sismics.util.jpa.EMF.getEntityManagerProperties(EMF.java:69) Configuring EntityManager from hibernate.properties
|
||||
27 Jul 2013 13:43:02,621 INFO com.sismics.util.jpa.DbOpenHelper.open(DbOpenHelper.java:67) Opening database and executing incremental updates
|
||||
27 Jul 2013 13:43:02,623 INFO com.sismics.util.jpa.DbOpenHelper.open(DbOpenHelper.java:95) Unable to get database version: Table T_CONFIG not found
|
||||
27 Jul 2013 13:43:02,624 INFO com.sismics.util.jpa.DbOpenHelper.open(DbOpenHelper.java:109) Executing initial schema creation script
|
||||
27 Jul 2013 13:44:01,672 ERROR com.sismics.util.jpa.DbOpenHelper.open(DbOpenHelper.java:122) Unable to complete schema update
|
||||
java.lang.UnsupportedOperationException: Cannot list files for URL file:/C:/Users/Ben/workspace/bgd/docs/trunk/docs-core/target/classes/com/sismics/util/jpa/EMF$1.class
|
||||
at com.sismics.util.ResourceUtil.list(ResourceUtil.java:86)
|
||||
at com.sismics.util.jpa.DbOpenHelper.executeAllScript(DbOpenHelper.java:152)
|
||||
at com.sismics.util.jpa.EMF$1.onCreate(EMF.java:45)
|
||||
at com.sismics.util.jpa.DbOpenHelper.open(DbOpenHelper.java:110)
|
||||
at com.sismics.util.jpa.EMF.<clinit>(EMF.java:55)
|
||||
at com.sismics.docs.core.util.TransactionUtil.handle(TransactionUtil.java:38)
|
||||
at com.sismics.util.filter.RequestContextFilter.init(RequestContextFilter.java:76)
|
||||
at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:114)
|
||||
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
|
||||
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:754)
|
||||
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:258)
|
||||
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1221)
|
||||
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:699)
|
||||
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:454)
|
||||
at org.mortbay.jetty.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:256)
|
||||
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
|
||||
at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:224)
|
||||
at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:167)
|
||||
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
|
||||
at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:224)
|
||||
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
|
||||
at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:90)
|
||||
at org.eclipse.jetty.server.Server.doStart(Server.java:263)
|
||||
at org.mortbay.jetty.plugin.JettyServer.doStart(JettyServer.java:65)
|
||||
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
|
||||
at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:511)
|
||||
at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:364)
|
||||
at org.mortbay.jetty.plugin.JettyRunMojo.execute(JettyRunMojo.java:516)
|
||||
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
|
||||
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
|
||||
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
|
||||
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
|
||||
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
|
||||
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
|
||||
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
|
||||
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
|
||||
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
|
||||
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
|
||||
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
|
||||
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
|
||||
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
|
||||
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
||||
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
|
||||
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
||||
at java.lang.reflect.Method.invoke(Method.java:601)
|
||||
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
|
||||
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
|
||||
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
|
||||
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
|
||||
27 Jul 2013 13:44:01,677 INFO com.sismics.util.jpa.EMF.getEntityManagerProperties(EMF.java:69) Configuring EntityManager from hibernate.properties
|
||||
27 Jul 2013 13:44:01,769 ERROR com.sismics.util.jpa.EMF.<clinit>(EMF.java:60) Error creating EMF
|
||||
javax.persistence.PersistenceException: No Persistence provider for EntityManager named transactions-optional
|
||||
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:69)
|
||||
at com.sismics.util.jpa.EMF.<clinit>(EMF.java:57)
|
||||
at com.sismics.docs.core.util.TransactionUtil.handle(TransactionUtil.java:38)
|
||||
at com.sismics.util.filter.RequestContextFilter.init(RequestContextFilter.java:76)
|
||||
at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:114)
|
||||
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
|
||||
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:754)
|
||||
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:258)
|
||||
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1221)
|
||||
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:699)
|
||||
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:454)
|
||||
at org.mortbay.jetty.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:256)
|
||||
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
|
||||
at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:224)
|
||||
at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:167)
|
||||
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
|
||||
at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:224)
|
||||
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
|
||||
at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:90)
|
||||
at org.eclipse.jetty.server.Server.doStart(Server.java:263)
|
||||
at org.mortbay.jetty.plugin.JettyServer.doStart(JettyServer.java:65)
|
||||
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
|
||||
at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:511)
|
||||
at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:364)
|
||||
at org.mortbay.jetty.plugin.JettyRunMojo.execute(JettyRunMojo.java:516)
|
||||
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
|
||||
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
|
||||
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
|
||||
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
|
||||
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
|
||||
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
|
||||
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
|
||||
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
|
||||
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
|
||||
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
|
||||
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
|
||||
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
|
||||
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
|
||||
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
||||
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
|
||||
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
||||
at java.lang.reflect.Method.invoke(Method.java:601)
|
||||
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
|
||||
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
|
||||
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
|
||||
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
|
||||
27 Jul 2013 13:44:01,770 ERROR com.sismics.docs.core.util.TransactionUtil.handle(TransactionUtil.java:40) Cannot create entity manager
|
||||
java.lang.NullPointerException
|
||||
at com.sismics.docs.core.util.TransactionUtil.handle(TransactionUtil.java:38)
|
||||
at com.sismics.util.filter.RequestContextFilter.init(RequestContextFilter.java:76)
|
||||
at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:114)
|
||||
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
|
||||
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:754)
|
||||
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:258)
|
||||
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1221)
|
||||
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:699)
|
||||
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:454)
|
||||
at org.mortbay.jetty.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:256)
|
||||
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
|
||||
at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:224)
|
||||
at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:167)
|
||||
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
|
||||
at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:224)
|
||||
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
|
||||
at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:90)
|
||||
at org.eclipse.jetty.server.Server.doStart(Server.java:263)
|
||||
at org.mortbay.jetty.plugin.JettyServer.doStart(JettyServer.java:65)
|
||||
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
|
||||
at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:511)
|
||||
at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:364)
|
||||
at org.mortbay.jetty.plugin.JettyRunMojo.execute(JettyRunMojo.java:516)
|
||||
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
|
||||
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
|
||||
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
|
||||
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
|
||||
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
|
||||
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
|
||||
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
|
||||
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
|
||||
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
|
||||
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
|
||||
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
|
||||
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
|
||||
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
|
||||
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
||||
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
|
||||
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
||||
at java.lang.reflect.Method.invoke(Method.java:601)
|
||||
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
|
||||
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
|
||||
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
|
||||
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
|
||||
27 Jul 2013 13:51:34,136 INFO com.sismics.util.jpa.EMF.getEntityManagerProperties(EMF.java:69) Configuring EntityManager from hibernate.properties
|
||||
27 Jul 2013 13:51:34,600 INFO com.sismics.util.jpa.DbOpenHelper.open(DbOpenHelper.java:67) Opening database and executing incremental updates
|
||||
27 Jul 2013 13:51:34,602 INFO com.sismics.util.jpa.DbOpenHelper.open(DbOpenHelper.java:95) Unable to get database version: Table T_CONFIG not found
|
||||
27 Jul 2013 13:51:34,602 INFO com.sismics.util.jpa.DbOpenHelper.open(DbOpenHelper.java:109) Executing initial schema creation script
|
||||
27 Jul 2013 13:51:48,941 INFO com.sismics.util.jpa.DbOpenHelper.executeAllScript(DbOpenHelper.java:163) Executing script: dbupdate-000-0.sql
|
||||
27 Jul 2013 13:51:48,984 INFO com.sismics.util.jpa.DbOpenHelper.executeAllScript(DbOpenHelper.java:163) Executing script: dbupdate-000-1.sql
|
||||
27 Jul 2013 13:51:48,987 INFO com.sismics.util.jpa.DbOpenHelper.open(DbOpenHelper.java:117) Found database version 0, new version is 1, executing database incremental update scripts
|
||||
27 Jul 2013 13:51:50,951 INFO com.sismics.util.jpa.DbOpenHelper.open(DbOpenHelper.java:119) Database upgrade complete
|
||||
27 Jul 2013 13:51:50,951 INFO com.sismics.util.jpa.EMF.getEntityManagerProperties(EMF.java:69) Configuring EntityManager from hibernate.properties
|
||||
27 Jul 2013 13:51:51,824 INFO com.sismics.docs.core.service.IndexingService.startUp(IndexingService.java:53) Using file Lucene storage: C:\Users\Ben\workspace\bgd\docs\trunk\docs-web\src\main\webapp\sismicsdocs\lucene
|
@ -0,0 +1,144 @@
|
||||
.table-documents {
|
||||
thead th {
|
||||
cursor: pointer;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
tbody tr {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.touchpanview-wrap {
|
||||
position:relative;
|
||||
display:block;
|
||||
overflow:hidden;
|
||||
border:1px solid black;
|
||||
}
|
||||
|
||||
|
||||
.touchpanview-pan {
|
||||
position:absolute;
|
||||
top:0;
|
||||
left:0;
|
||||
display:block;
|
||||
overflow:hidden;
|
||||
}
|
||||
|
||||
.touchpanview-pan img {
|
||||
position:absolute;
|
||||
top:0;
|
||||
left:0;
|
||||
display:block;
|
||||
}
|
||||
|
||||
.touchpanview-pin {
|
||||
position:absolute;
|
||||
top:0;
|
||||
left:0;
|
||||
|
||||
display:block;
|
||||
width: 36px;
|
||||
height:36px;
|
||||
|
||||
background: url(touchpanview-pin.png) no-repeat;
|
||||
text-indent: -99999px;
|
||||
|
||||
cursor:pointer;
|
||||
|
||||
-webkit-animation-fill-mode: both;
|
||||
-moz-animation-fill-mode: both;
|
||||
-ms-animation-fill-mode: both;
|
||||
-o-animation-fill-mode: both;
|
||||
animation-fill-mode: both;
|
||||
-webkit-animation: 1s ease;
|
||||
-moz-animation: 1s ease;
|
||||
-ms-animation: 1s ease;
|
||||
-o-animation: 1s ease;
|
||||
animation: 1s ease;
|
||||
|
||||
-webkit-animation-name: touchpanviewPinBounceIn;
|
||||
-moz-animation-name: touchpanviewPinBounceIn;
|
||||
-ms-animation-name: touchpanviewPinBounceIn;
|
||||
-o-animation-name: touchpanviewPinBounceIn;
|
||||
animation-name: touchpanviewPinBounceIn;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@-webkit-keyframes touchpanviewPinBounceIn {
|
||||
0% { opacity: 0; -webkit-transform: translateY(-2000px); }
|
||||
60% { opacity: 1; -webkit-transform: translateY(30px); }
|
||||
80% { -webkit-transform: translateY(-10px); }
|
||||
100% { -webkit-transform: translateY(0); }
|
||||
}
|
||||
|
||||
@-moz-keyframes touchpanviewPinBounceIn {
|
||||
0% { opacity: 0; -moz-transform: translateY(-2000px); }
|
||||
60% { opacity: 1; -moz-transform: translateY(30px); }
|
||||
80% { -moz-transform: translateY(-10px); }
|
||||
100% { -moz-transform: translateY(0); }
|
||||
}
|
||||
|
||||
@-ms-keyframes touchpanviewPinBounceIn {
|
||||
0% { opacity: 0; -ms-transform: translateY(-2000px); }
|
||||
60% { opacity: 1; -ms-transform: translateY(30px); }
|
||||
80% { -ms-transform: translateY(-10px); }
|
||||
100% { -ms-transform: translateY(0); }
|
||||
}
|
||||
|
||||
@-o-keyframes touchpanviewPinBounceIn {
|
||||
0% { opacity: 0; -o-transform: translateY(-2000px); }
|
||||
60% { opacity: 1; -o-transform: translateY(30px); }
|
||||
80% { -o-transform: translateY(-10px); }
|
||||
100% { -o-transform: translateY(0); }
|
||||
}
|
||||
|
||||
@keyframes touchpanviewPinBounceIn {
|
||||
0% { opacity: 0; transform: translateY(-2000px); }
|
||||
60% { opacity: 1; transform: translateY(30px); }
|
||||
80% { transform: translateY(-10px); }
|
||||
100% { transform: translateY(0); }
|
||||
}
|
||||
|
||||
|
||||
|
||||
.touchpanview-pin-center { border:1px solid red; }
|
||||
.touchpanview-pin-topLeft {
|
||||
border-top:1px solid red;
|
||||
border-left:1px solid red;
|
||||
}
|
||||
.touchpanview-pin-topRight {
|
||||
border-top:1px solid red;
|
||||
border-right:1px solid red;
|
||||
}
|
||||
.touchpanview-pin-bottomLeft {
|
||||
border-bottom:1px solid red;
|
||||
border-left:1px solid red;
|
||||
}
|
||||
.touchpanview-pin-bottomRight {
|
||||
border-bottom:1px solid red;
|
||||
border-right:1px solid red;
|
||||
}
|
@ -55,11 +55,9 @@ public class TestDocumentResource extends BaseJerseyTest {
|
||||
Assert.assertEquals(document1Id, documents.getJSONObject(0).getString("id"));
|
||||
|
||||
// Get a document
|
||||
documentResource = resource().path("/document");
|
||||
documentResource = resource().path("/document/" + document1Id);
|
||||
documentResource.addFilter(new CookieAuthenticationFilter(adminAuthenticationToken));
|
||||
getParams = new MultivaluedMapImpl();
|
||||
getParams.putSingle("id", document1Id);
|
||||
response = documentResource.queryParams(getParams).get(ClientResponse.class);
|
||||
response = documentResource.get(ClientResponse.class);
|
||||
json = response.getEntity(JSONObject.class);
|
||||
Assert.assertEquals(Status.OK, Status.fromStatusCode(response.getStatus()));
|
||||
Assert.assertEquals(document1Id, json.getString("id"));
|
||||
@ -76,11 +74,9 @@ public class TestDocumentResource extends BaseJerseyTest {
|
||||
Assert.assertEquals("ok", json.getString("status"));
|
||||
|
||||
// Get a document
|
||||
documentResource = resource().path("/document");
|
||||
documentResource = resource().path("/document/" + document1Id);
|
||||
documentResource.addFilter(new CookieAuthenticationFilter(adminAuthenticationToken));
|
||||
getParams = new MultivaluedMapImpl();
|
||||
getParams.putSingle("id", document1Id);
|
||||
response = documentResource.queryParams(getParams).get(ClientResponse.class);
|
||||
response = documentResource.get(ClientResponse.class);
|
||||
json = response.getEntity(JSONObject.class);
|
||||
Assert.assertEquals(Status.OK, Status.fromStatusCode(response.getStatus()));
|
||||
Assert.assertTrue(json.getString("title").contains("new"));
|
||||
@ -95,11 +91,9 @@ public class TestDocumentResource extends BaseJerseyTest {
|
||||
Assert.assertEquals("ok", json.getString("status"));
|
||||
|
||||
// Get a document (KO)
|
||||
documentResource = resource().path("/document");
|
||||
documentResource = resource().path("/document/" + document1Id);
|
||||
documentResource.addFilter(new CookieAuthenticationFilter(adminAuthenticationToken));
|
||||
getParams = new MultivaluedMapImpl();
|
||||
getParams.putSingle("id", document1Id);
|
||||
response = documentResource.queryParams(getParams).get(ClientResponse.class);
|
||||
response = documentResource.get(ClientResponse.class);
|
||||
json = response.getEntity(JSONObject.class);
|
||||
Assert.assertEquals(Status.BAD_REQUEST, Status.fromStatusCode(response.getStatus()));
|
||||
}
|
||||
|
@ -93,13 +93,15 @@ public class TestFileResource extends BaseJerseyTest {
|
||||
json = response.getEntity(JSONObject.class);
|
||||
Assert.assertEquals("ok", json.getString("status"));
|
||||
|
||||
// Get a file (KO)
|
||||
documentResource = resource().path("/file");
|
||||
documentResource.addFilter(new CookieAuthenticationFilter(adminAuthenticationToken));
|
||||
// Get all files from a document
|
||||
fileResource = resource().path("/file/list");
|
||||
fileResource.addFilter(new CookieAuthenticationFilter(adminAuthenticationToken));
|
||||
getParams = new MultivaluedMapImpl();
|
||||
getParams.putSingle("id", file1Id);
|
||||
response = documentResource.queryParams(getParams).get(ClientResponse.class);
|
||||
getParams.putSingle("id", document1Id);
|
||||
response = fileResource.queryParams(getParams).get(ClientResponse.class);
|
||||
json = response.getEntity(JSONObject.class);
|
||||
Assert.assertEquals(Status.BAD_REQUEST, Status.fromStatusCode(response.getStatus()));
|
||||
Assert.assertEquals(Status.OK, Status.fromStatusCode(response.getStatus()));
|
||||
files = json.getJSONArray("files");
|
||||
Assert.assertEquals(0, files.length());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user