This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'integration/master' into rhbz828629
- Loading branch information
Showing
60 changed files
with
2,872 additions
and
1,093 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
119 changes: 119 additions & 0 deletions
119
zanata-model/src/main/java/org/zanata/model/HDocumentUpload.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
/* | ||
* Copyright 2012, Red Hat, Inc. and individual contributors as indicated by the | ||
* @author tags. See the copyright.txt file in the distribution for a full | ||
* listing of individual contributors. | ||
* | ||
* This 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 software 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 software; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF | ||
* site: http://www.fsf.org. | ||
*/ | ||
package org.zanata.model; | ||
|
||
import java.io.Serializable; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import javax.persistence.CascadeType; | ||
import javax.persistence.Entity; | ||
import javax.persistence.EnumType; | ||
import javax.persistence.Enumerated; | ||
import javax.persistence.JoinColumn; | ||
import javax.persistence.ManyToOne; | ||
import javax.persistence.OneToMany; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
import org.hibernate.annotations.IndexColumn; | ||
import org.hibernate.validator.NotEmpty; | ||
import org.zanata.common.DocumentType; | ||
|
||
|
||
@Entity | ||
@Getter | ||
@Setter | ||
public class HDocumentUpload extends ModelEntityBase implements Serializable | ||
{ | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
|
||
private HProjectIteration projectIteration; | ||
private String docId; | ||
private DocumentType type; | ||
private HLocale locale; | ||
private String contentHash; | ||
private List<HDocumentUploadPart> parts; | ||
|
||
public HDocumentUpload() | ||
{ | ||
// hibernate requires this to be an ArrayList | ||
parts = new ArrayList<HDocumentUploadPart>(); | ||
} | ||
|
||
public void setId(Long id) | ||
{ | ||
super.setId(id); | ||
} | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "projectIterationid", nullable = false) | ||
public HProjectIteration getProjectIteration() | ||
{ | ||
return projectIteration; | ||
} | ||
|
||
@NotEmpty | ||
public String getDocId() | ||
{ | ||
return docId; | ||
} | ||
|
||
@Enumerated(EnumType.STRING) | ||
public DocumentType getType() | ||
{ | ||
return type; | ||
} | ||
|
||
// null for source document upload | ||
@ManyToOne | ||
@JoinColumn(name = "localeId", nullable = true) | ||
public HLocale getLocale() | ||
{ | ||
return locale; | ||
} | ||
|
||
@NotEmpty | ||
public String getContentHash() | ||
{ | ||
return contentHash; | ||
} | ||
|
||
@OneToMany(cascade = CascadeType.ALL) | ||
@JoinColumn(name = "documentUploadId", nullable = false) | ||
@IndexColumn(name = "partIndex", base = 0, nullable = false) | ||
public List<HDocumentUploadPart> getParts() | ||
{ | ||
return parts; | ||
} | ||
|
||
@Override | ||
public String toString() | ||
{ | ||
return getClass().getSimpleName() + "@" + Integer.toHexString(hashCode()) | ||
+ "[id=" + id + ",versionNum=" + versionNum | ||
+ ",contentHash=" + contentHash + "]"; | ||
} | ||
|
||
} |
80 changes: 80 additions & 0 deletions
80
zanata-model/src/main/java/org/zanata/model/HDocumentUploadPart.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
* Copyright 2012, Red Hat, Inc. and individual contributors as indicated by the | ||
* @author tags. See the copyright.txt file in the distribution for a full | ||
* listing of individual contributors. | ||
* | ||
* This 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 software 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 software; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF | ||
* site: http://www.fsf.org. | ||
*/ | ||
package org.zanata.model; | ||
|
||
import java.io.Serializable; | ||
import java.sql.Blob; | ||
|
||
import javax.persistence.Entity; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.Id; | ||
import javax.persistence.JoinColumn; | ||
import javax.persistence.Lob; | ||
import javax.persistence.ManyToOne; | ||
|
||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
|
||
import org.hibernate.validator.NotNull; | ||
|
||
@Entity | ||
@NoArgsConstructor // is this necessary? | ||
public class HDocumentUploadPart implements Serializable | ||
{ | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
@Setter | ||
private long id; | ||
@Setter | ||
private HDocumentUpload upload; | ||
@Setter | ||
private Blob content; | ||
|
||
@Id | ||
@GeneratedValue | ||
public Long getId() | ||
{ | ||
return id; | ||
} | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "documentUploadId", nullable = false, updatable = false, insertable = false) | ||
public HDocumentUpload getUpload() | ||
{ | ||
return upload; | ||
} | ||
|
||
@NotNull | ||
@Lob | ||
public Blob getContent() | ||
{ | ||
return content; | ||
} | ||
|
||
@Override | ||
public String toString() | ||
{ | ||
return getClass().getSimpleName() + "@" + Integer.toHexString(hashCode()) | ||
+ "[upload id=" + upload.getId() + "]"; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.