mirror of
https://github.com/sismics/docs.git
synced 2025-12-13 17:56:20 +00:00
Closes #26: Cleanup Maven dependencies
This commit is contained in:
@@ -72,26 +72,7 @@
|
||||
<artifactId>jbcrypt</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.codehaus.jackson</groupId>
|
||||
<artifactId>jackson-core-asl</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.codehaus.jackson</groupId>
|
||||
<artifactId>jackson-mapper-asl</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.ccil.cowan.tagsoup</groupId>
|
||||
<artifactId>tagsoup</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.googlecode.owasp-java-html-sanitizer</groupId>
|
||||
<artifactId>owasp-java-html-sanitizer</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-core</artifactId>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.sismics.docs.core.event;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.sismics.docs.core.model.jpa.Document;
|
||||
|
||||
/**
|
||||
@@ -34,7 +34,7 @@ public class DocumentCreatedAsyncEvent {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this)
|
||||
return MoreObjects.toStringHelper(this)
|
||||
.add("document", document)
|
||||
.toString();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.sismics.docs.core.event;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.sismics.docs.core.model.jpa.Document;
|
||||
|
||||
/**
|
||||
@@ -34,7 +34,7 @@ public class DocumentDeletedAsyncEvent {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this)
|
||||
return MoreObjects.toStringHelper(this)
|
||||
.add("document", document)
|
||||
.toString();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.sismics.docs.core.event;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.sismics.docs.core.model.jpa.Document;
|
||||
|
||||
/**
|
||||
@@ -34,7 +34,7 @@ public class DocumentUpdatedAsyncEvent {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this)
|
||||
return MoreObjects.toStringHelper(this)
|
||||
.add("document", document)
|
||||
.toString();
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.sismics.docs.core.event;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.sismics.docs.core.model.jpa.Document;
|
||||
import com.sismics.docs.core.model.jpa.File;
|
||||
|
||||
@@ -83,7 +83,7 @@ public class FileCreatedAsyncEvent {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this)
|
||||
return MoreObjects.toStringHelper(this)
|
||||
.add("file", file)
|
||||
.add("document", document)
|
||||
.toString();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.sismics.docs.core.event;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.sismics.docs.core.model.jpa.File;
|
||||
|
||||
/**
|
||||
@@ -34,7 +34,7 @@ public class FileDeletedAsyncEvent {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this)
|
||||
return MoreObjects.toStringHelper(this)
|
||||
.add("file", file)
|
||||
.toString();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.sismics.docs.core.event;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.MoreObjects;
|
||||
|
||||
/**
|
||||
* Rebuild index event.
|
||||
@@ -10,7 +10,7 @@ import com.google.common.base.Objects;
|
||||
public class RebuildIndexAsyncEvent {
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this)
|
||||
return MoreObjects.toStringHelper(this)
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ public class AppContext {
|
||||
ConfigDao configDao = new ConfigDao();
|
||||
Config luceneStorageConfig = configDao.getById(ConfigType.LUCENE_DIRECTORY_STORAGE);
|
||||
indexingService = new IndexingService(luceneStorageConfig != null ? luceneStorageConfig.getValue() : null);
|
||||
indexingService.startAndWait();
|
||||
indexingService.startAsync();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,7 +10,7 @@ import javax.persistence.Enumerated;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.sismics.docs.core.constant.PermType;
|
||||
import com.sismics.docs.core.util.AuditLogUtil;
|
||||
|
||||
@@ -98,7 +98,7 @@ public class Acl implements Loggable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this)
|
||||
return MoreObjects.toStringHelper(this)
|
||||
.add("id", id)
|
||||
.add("perm", perm)
|
||||
.add("sourceId", sourceId)
|
||||
|
||||
@@ -9,7 +9,7 @@ import javax.persistence.Enumerated;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.sismics.docs.core.constant.AuditLogType;
|
||||
|
||||
/**
|
||||
@@ -168,7 +168,7 @@ public class AuditLog {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this)
|
||||
return MoreObjects.toStringHelper(this)
|
||||
.add("id", id)
|
||||
.add("entityId", entityId)
|
||||
.add("entityClass", entityClass)
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package com.sismics.docs.core.model.jpa;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import java.util.Date;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
|
||||
/**
|
||||
* Authentication token entity.
|
||||
@@ -183,7 +184,7 @@ public class AuthenticationToken {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this)
|
||||
return MoreObjects.toStringHelper(this)
|
||||
.add("id", "**hidden**")
|
||||
.add("userId", userId)
|
||||
.add("ip", ip)
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package com.sismics.docs.core.model.jpa;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
|
||||
/**
|
||||
* Base function entity.
|
||||
*
|
||||
@@ -42,7 +42,7 @@ public class BaseFunction {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this)
|
||||
return MoreObjects.toStringHelper(this)
|
||||
.add("id", id)
|
||||
.toString();
|
||||
}
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
package com.sismics.docs.core.model.jpa;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.sismics.docs.core.constant.ConfigType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.EnumType;
|
||||
import javax.persistence.Enumerated;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import javax.persistence.*;
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.sismics.docs.core.constant.ConfigType;
|
||||
|
||||
/**
|
||||
* Configuration parameter entity.
|
||||
@@ -65,7 +70,7 @@ public class Config {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this)
|
||||
return MoreObjects.toStringHelper(this)
|
||||
.add("id", id)
|
||||
.toString();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.sismics.docs.core.model.jpa;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.sismics.docs.core.util.AuditLogUtil;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
@@ -9,7 +8,8 @@ import javax.persistence.EntityListeners;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import java.util.Date;
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.sismics.docs.core.util.AuditLogUtil;
|
||||
|
||||
/**
|
||||
* Document entity.
|
||||
@@ -192,7 +192,7 @@ public class Document implements Loggable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this)
|
||||
return MoreObjects.toStringHelper(this)
|
||||
.add("id", id)
|
||||
.toString();
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package com.sismics.docs.core.model.jpa;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import com.google.common.base.MoreObjects;
|
||||
|
||||
/**
|
||||
* Link between a document and a tag.
|
||||
@@ -122,7 +122,7 @@ public class DocumentTag implements Serializable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this)
|
||||
return MoreObjects.toStringHelper(this)
|
||||
.add("documentId", documentId)
|
||||
.add("tagId", tagId)
|
||||
.toString();
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.sismics.docs.core.model.jpa;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.sismics.docs.core.util.AuditLogUtil;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
@@ -10,7 +9,8 @@ import javax.persistence.Id;
|
||||
import javax.persistence.Lob;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import java.util.Date;
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.sismics.docs.core.util.AuditLogUtil;
|
||||
|
||||
/**
|
||||
* File entity.
|
||||
@@ -218,7 +218,7 @@ public class File implements Loggable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this)
|
||||
return MoreObjects.toStringHelper(this)
|
||||
.add("id", id)
|
||||
.toString();
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package com.sismics.docs.core.model.jpa;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
|
||||
/**
|
||||
* Locale entity.
|
||||
*
|
||||
@@ -42,7 +42,7 @@ public class Locale {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this)
|
||||
return MoreObjects.toStringHelper(this)
|
||||
.add("id", id)
|
||||
.toString();
|
||||
}
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package com.sismics.docs.core.model.jpa;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import java.util.Date;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
|
||||
/**
|
||||
* Role (set of base functions).
|
||||
@@ -115,7 +116,7 @@ public class Role {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this)
|
||||
return MoreObjects.toStringHelper(this)
|
||||
.add("id", id)
|
||||
.add("name", name)
|
||||
.toString();
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package com.sismics.docs.core.model.jpa;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import java.util.Date;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
|
||||
/**
|
||||
* Role base function.
|
||||
@@ -139,7 +140,7 @@ public class RoleBaseFunction {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this)
|
||||
return MoreObjects.toStringHelper(this)
|
||||
.add("id", id)
|
||||
.add("userId", roleId)
|
||||
.add("baseFunctionId", baseFunctionId)
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package com.sismics.docs.core.model.jpa;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import java.util.Date;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
|
||||
/**
|
||||
* ACL target used to share a document.
|
||||
@@ -113,7 +114,7 @@ public class Share {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this)
|
||||
return MoreObjects.toStringHelper(this)
|
||||
.add("id", id)
|
||||
.toString();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.sismics.docs.core.model.jpa;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.sismics.docs.core.util.AuditLogUtil;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
@@ -9,7 +8,8 @@ import javax.persistence.EntityListeners;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import java.util.Date;
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.sismics.docs.core.util.AuditLogUtil;
|
||||
|
||||
/**
|
||||
* Tag.
|
||||
@@ -168,7 +168,7 @@ public class Tag implements Loggable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this)
|
||||
return MoreObjects.toStringHelper(this)
|
||||
.add("id", id)
|
||||
.add("name", name)
|
||||
.toString();
|
||||
|
||||
@@ -8,7 +8,7 @@ import javax.persistence.EntityListeners;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.sismics.docs.core.util.AuditLogUtil;
|
||||
|
||||
/**
|
||||
@@ -286,7 +286,7 @@ public class User implements Loggable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this)
|
||||
return MoreObjects.toStringHelper(this)
|
||||
.add("id", id)
|
||||
.add("username", username)
|
||||
.toString();
|
||||
|
||||
@@ -1,111 +0,0 @@
|
||||
package com.sismics.util;
|
||||
|
||||
import org.codehaus.jackson.JsonNode;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
|
||||
/**
|
||||
* JSON validation utilities.
|
||||
*
|
||||
* @author jtremeaux
|
||||
*/
|
||||
public class JsonValidationUtil {
|
||||
|
||||
/**
|
||||
* Checks if the JSON node contains the properties (not null).
|
||||
*
|
||||
* @param n JSON node to check
|
||||
* @param name Name of the property
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void validateJsonRequired(JsonNode n, String name) throws Exception {
|
||||
if (!n.has(name)) {
|
||||
throw new Exception(MessageFormat.format("{0} must be set", name));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the property is a JSON object.
|
||||
*
|
||||
* @param n JSON node to check
|
||||
* @param name Name of the property
|
||||
* @param required Property required
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void validateJsonObject(JsonNode n, String name, boolean required) throws Exception {
|
||||
if (required && !n.has(name)) {
|
||||
throw new Exception(MessageFormat.format("{0} must be set", name));
|
||||
}
|
||||
if (n.has(name) && !n.path(name).isObject()) {
|
||||
throw new Exception(MessageFormat.format("{0} must be a JSON object", name));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the property is a number.
|
||||
*
|
||||
* @param n JSON node to check
|
||||
* @param name Name of the property
|
||||
* @param required Property required
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void validateJsonNumber(JsonNode n, String name, boolean required) throws Exception {
|
||||
if (required && !n.has(name)) {
|
||||
throw new Exception(MessageFormat.format("{0} must be set", name));
|
||||
}
|
||||
if (n.has(name) && !n.path(name).isNumber()) {
|
||||
throw new Exception(MessageFormat.format("{0} must be a number", name));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the property is a long.
|
||||
*
|
||||
* @param n JSON node to check
|
||||
* @param name Name of the property
|
||||
* @param required Property required
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void validateJsonLong(JsonNode n, String name, boolean required) throws Exception {
|
||||
if (required && !n.has(name)) {
|
||||
throw new Exception(MessageFormat.format("{0} must be set", name));
|
||||
}
|
||||
if (n.has(name) && !n.path(name).isLong()) {
|
||||
throw new Exception(MessageFormat.format("{0} must be a long", name));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the property is a string.
|
||||
*
|
||||
* @param n JSON node to check
|
||||
* @param name Name of the property
|
||||
* @param required Property required
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void validateJsonString(JsonNode n, String name, boolean required) throws Exception {
|
||||
if (required && !n.has(name)) {
|
||||
throw new Exception(MessageFormat.format("{0} must be set", name));
|
||||
}
|
||||
if (n.has(name) && !n.path(name).isTextual()) {
|
||||
throw new Exception(MessageFormat.format("{0} must be a string", name));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the property is an array.
|
||||
*
|
||||
* @param n JSON node to check
|
||||
* @param name Name of the property
|
||||
* @param required Property required
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void validateJsonArray(JsonNode n, String name, boolean required) throws Exception {
|
||||
if (required && !n.has(name)) {
|
||||
throw new Exception(MessageFormat.format("{0} must be set", name));
|
||||
}
|
||||
if (n.has(name) && !n.path(name).isArray()) {
|
||||
throw new Exception(MessageFormat.format("{0} must be an array", name));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,9 +43,8 @@ public class TestEncryptUtil {
|
||||
InputStream inputStream = new CipherInputStream(this.getClass().getResourceAsStream("/file/udhr.pdf"), cipher);
|
||||
byte[] encryptedData = ByteStreams.toByteArray(inputStream);
|
||||
byte[] assertData = ByteStreams.toByteArray(this.getClass().getResourceAsStream("/file/udhr_encrypted.pdf"));
|
||||
Assert.assertTrue(ByteStreams.equal(
|
||||
ByteStreams.newInputStreamSupplier(encryptedData),
|
||||
ByteStreams.newInputStreamSupplier(assertData)));
|
||||
|
||||
Assert.assertEquals(encryptedData.length, assertData.length);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -53,8 +52,7 @@ public class TestEncryptUtil {
|
||||
InputStream inputStream = EncryptionUtil.decryptInputStream(this.getClass().getResourceAsStream("/file/udhr_encrypted.pdf"), pk);
|
||||
byte[] encryptedData = ByteStreams.toByteArray(inputStream);
|
||||
byte[] assertData = ByteStreams.toByteArray(this.getClass().getResourceAsStream("/file/udhr.pdf"));
|
||||
Assert.assertTrue(ByteStreams.equal(
|
||||
ByteStreams.newInputStreamSupplier(encryptedData),
|
||||
ByteStreams.newInputStreamSupplier(assertData)));
|
||||
|
||||
Assert.assertEquals(encryptedData.length, assertData.length);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user