diff --git a/ccm-core/src/main/java/org/libreccm/core/Permission.java b/ccm-core/src/main/java/org/libreccm/core/Permission.java index c68da6921..746a1a285 100644 --- a/ccm-core/src/main/java/org/libreccm/core/Permission.java +++ b/ccm-core/src/main/java/org/libreccm/core/Permission.java @@ -107,7 +107,7 @@ public class Permission implements Serializable { /** * The {@link Subject} (a {@link User} or a {@link Group}) to which the - * permission is granted. If the permission is granted to a {@link Group} a + * permission is granted. If the permission is granted to a {@link Group} all * {@link User}s in that have the permission. */ @ManyToOne diff --git a/ccm-docrepo/src/main/java/org/libreccm/docrepo/BlobObject.java b/ccm-docrepo/src/main/java/org/libreccm/docrepo/BlobObject.java new file mode 100644 index 000000000..eaa56325e --- /dev/null +++ b/ccm-docrepo/src/main/java/org/libreccm/docrepo/BlobObject.java @@ -0,0 +1,114 @@ +/* + * Copyright (C) 2015 LibreCCM Foundation. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ +package org.libreccm.docrepo; + + +import org.hibernate.validator.constraints.NotEmpty; + +import javax.persistence.*; +import java.io.Serializable; +import java.sql.Blob; +import java.util.Objects; + +/** + * + * @author Tobias Osmers + */ +@Entity +@Table(schema = "ccm-docrepo", name = "blob_objects") +public class BlobObject implements Serializable { + private static final long serialVersionUID = -7468014879548796218L; + + /** + * The ID/primary key for the {@code BlobObject}. Please note that it is not + * necessary to define an additional ID on classes which extend this class. + */ + @Id + @Column(name = "blob_object_id") + @GeneratedValue(strategy = GenerationType.AUTO) + private long blobObjectId; + + /** + * The Content of the blob-object. + */ + @Column(name = "content") + @NotEmpty + private Blob content; + + //> Begin GETTER & SETTER + + public long getBlobObjectId() { + return blobObjectId; + } + + public void setBlobObjectId(long blobObjectId) { + this.blobObjectId = blobObjectId; + } + + public Blob getContent() { + return content; + } + + public void setContent(Blob content) { + this.content = content; + } + + //< End GETTER & SETTER + + @Override + public int hashCode() { + int hash = 5; + hash = 61 * hash + (int) (blobObjectId ^ (blobObjectId >>> 32)); + hash = 61 * hash + Objects.hashCode(content); + return hash; + } + + @Override + public boolean equals(final Object obj) { + if (obj == null) { + return false; + } + if (!(obj instanceof BlobObject)) { + return false; + } + + final BlobObject other = (BlobObject) obj; + if (!other.canEqual(this)) { + return false; + } + + return blobObjectId == other.getBlobObjectId() && + Objects.equals(content, other.getContent()); + } + + public boolean canEqual(final Object obj) { + return obj instanceof BlobObject; + } + + @Override + public String toString() { + return String.format("%s{ " + + "blobObjectId = %d, " + + "content = %s, " + + " }", + super.toString(), + blobObjectId, + content.toString()); + } +} diff --git a/ccm-docrepo/src/main/java/org/libreccm/docrepo/File.java b/ccm-docrepo/src/main/java/org/libreccm/docrepo/File.java new file mode 100644 index 000000000..bfc411772 --- /dev/null +++ b/ccm-docrepo/src/main/java/org/libreccm/docrepo/File.java @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2015 LibreCCM Foundation. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ +package org.libreccm.docrepo; + +import javax.persistence.Entity; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.Table; + +/** + * + * @author Tobias Osmers + */ +@Entity +@Table(schema = "ccm-docrepo", name = "files") +@NamedQueries({ + @NamedQuery(name = "getFileRevisionBlob", + query = "") +}) +public class File extends ResourceImpl { + private static final long serialVersionUID = -504220783419811504L; + + public File() { + super(); + } + +} diff --git a/ccm-docrepo/src/main/java/org/libreccm/docrepo/Folder.java b/ccm-docrepo/src/main/java/org/libreccm/docrepo/Folder.java new file mode 100644 index 000000000..9d5125213 --- /dev/null +++ b/ccm-docrepo/src/main/java/org/libreccm/docrepo/Folder.java @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2015 LibreCCM Foundation. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ +package org.libreccm.docrepo; + +import javax.persistence.Entity; +import javax.persistence.Table; + +/** + * + * @author Tobias Osmers + */ +@Entity +@Table(schema = "ccm-docrepo", name = "folders") +public class Folder extends ResourceImpl { + private static final long serialVersionUID = 1561466556458872622L; + + public Folder() { + super(); + } +} diff --git a/ccm-docrepo/src/main/java/org/libreccm/docrepo/RecentUpdatedDocsPortlet.java b/ccm-docrepo/src/main/java/org/libreccm/docrepo/RecentUpdatedDocsPortlet.java new file mode 100644 index 000000000..ca36c2a56 --- /dev/null +++ b/ccm-docrepo/src/main/java/org/libreccm/docrepo/RecentUpdatedDocsPortlet.java @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2015 LibreCCM Foundation. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ +package org.libreccm.docrepo; + +import org.libreccm.portal.Portlet; + +import javax.persistence.Entity; +import javax.persistence.Table; + +/** + * + * @author Tobias Osmers + */ +@Entity +@Table(schema = "ccm-docrepo", name = "recent_updated_docs_portlets") +public class RecentUpdatedDocsPortlet extends Portlet { + private static final long serialVersionUID = -4091024367070127101L; + + public RecentUpdatedDocsPortlet() { + super(); + } +} diff --git a/ccm-docrepo/src/main/java/org/libreccm/docrepo/Repository.java b/ccm-docrepo/src/main/java/org/libreccm/docrepo/Repository.java new file mode 100644 index 000000000..db2546ec2 --- /dev/null +++ b/ccm-docrepo/src/main/java/org/libreccm/docrepo/Repository.java @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2015 LibreCCM Foundation. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ +package org.libreccm.docrepo; + +import org.libreccm.web.Application; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.Table; + +/** + * + * @author Tobias Osmers + */ +@Entity +@Table(schema = "ccm-docrepo", name = "repositories") +@NamedQueries({ + @NamedQuery(name = "getRepositoryRoots", + query = "") +}) +public class Repository extends Application { + private static final long serialVersionUID = 6673243021462798036L; + + @Column(name = "root_id") + private long rootId; + + @Column(name = "owner_id") + private long ownerId; + + public Repository() { + super(); + } + + //> Begin GETTER & SETTER + + public long getRootId() { + return rootId; + } + + public void setRootId(long rootId) { + this.rootId = rootId; + } + + public long getOwnerId() { + return ownerId; + } + + public void setOwnerId(long ownerId) { + this.ownerId = ownerId; + } + + //< End GETTER & SETTER + + +} diff --git a/ccm-docrepo/src/main/java/org/libreccm/docrepo/ResourceImpl.java b/ccm-docrepo/src/main/java/org/libreccm/docrepo/ResourceImpl.java new file mode 100644 index 000000000..be16c6925 --- /dev/null +++ b/ccm-docrepo/src/main/java/org/libreccm/docrepo/ResourceImpl.java @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2015 LibreCCM Foundation. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ +package org.libreccm.docrepo; + +import java.io.Serializable; + +/** + * + * @author Tobias Osmers + */ +public class ResourceImpl implements Serializable{ + private static final long serialVersionUID = -910317798106611214L; +}