Skip to content

Commit

Permalink
Merge branch 'master' into query-param-doc-id
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Eng committed Jul 17, 2017
2 parents ba2abeb + d91ea88 commit 9933d5b
Show file tree
Hide file tree
Showing 91 changed files with 2,580 additions and 1,333 deletions.
6 changes: 5 additions & 1 deletion .gitattributes
Expand Up @@ -5,7 +5,7 @@
# converted to the OS's native line endings.
* text

# Explicitly declare text files we want to always be normalized and converted
# Explicitly declare text files we want to always be normalized and converted
# to native line endings on checkout.
*.c text
*.css text
Expand All @@ -29,6 +29,10 @@
# Declare files that will always have CRLF line endings on checkout.
*.sln text eol=crlf

# Declare files that will always have LF line endings on checkout.
build text eol=lf
mvnw text eol=lf

# Denote all files that are truly binary and should not be modified.
*.gif binary
*.jar binary
Expand Down
502 changes: 0 additions & 502 deletions LICENSE.LESSER.txt

This file was deleted.

339 changes: 0 additions & 339 deletions LICENSE.txt

This file was deleted.

Expand Up @@ -20,13 +20,24 @@
*/
package org.zanata.common;

import com.webcohesion.enunciate.metadata.Label;

import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlType;

/**
* The possible state of various entities in the system.
*/
@XmlType(name = "entityStatusType")
@XmlEnum(String.class)
@Label("Status")
public enum EntityStatus {
ACTIVE("jsf.Active"), READONLY("jsf.ReadOnly"), OBSOLETE("jsf.Obsolete");
/** Regular state for most entities. Means it is readable and writeable */
ACTIVE("jsf.Active"),
/** Same as active, but cannot be modified */
READONLY("jsf.ReadOnly"),
/** Removed from the system. An object in this state cannot be accessed. */
OBSOLETE("jsf.Obsolete");

public static EntityStatus valueOf(char initial) {
switch (initial) {
Expand Down
Expand Up @@ -20,6 +20,9 @@
*/
package org.zanata.rest.dto;

import com.webcohesion.enunciate.metadata.DocumentationExample;
import com.webcohesion.enunciate.metadata.Label;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
Expand All @@ -32,12 +35,17 @@
*/
@XmlRootElement(name = "copyTransStatus")
@XmlType(name = "copyTransStatusType")
@Label("Copy Trans Status")
public class CopyTransStatus {
private int percentageComplete;

private boolean inProgress;

/**
* An estimated percentage of completion for the copy trans run.
*/
@XmlElement(required = true)
@DocumentationExample("80")
public int getPercentageComplete() {
return percentageComplete;
}
Expand All @@ -46,6 +54,9 @@ public void setPercentageComplete(int percentageComplete) {
this.percentageComplete = percentageComplete;
}

/**
* True if the process is still running. False otherwise
*/
@XmlElement(required = true)
public boolean isInProgress() {
return inProgress;
Expand Down
Expand Up @@ -30,6 +30,8 @@
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

import com.webcohesion.enunciate.metadata.DocumentationExample;
import com.webcohesion.enunciate.metadata.Label;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.annotate.JsonPropertyOrder;
Expand All @@ -39,7 +41,8 @@
import org.zanata.rest.MediaTypes;

/**
*
* A single glossary entry representing a single translated term in multiple
* locales.
* @author Alex Eng <a href="mailto:aeng@redhat.com">aeng@redhat.com</a>
*
**/
Expand All @@ -48,6 +51,7 @@
"description", "sourceReference", "glossaryTerms", "termsCount", "qualifiedName" })
@JsonPropertyOrder({ "id", "pos", "description", "srcLang", "sourceReference", "glossaryTerms", "termsCount", "qualifiedName" })
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
@Label("Glossary Entry")
public class GlossaryEntry implements Serializable, HasMediaType {
/**
*
Expand Down Expand Up @@ -78,8 +82,12 @@ public GlossaryEntry(Long id) {
this.id = id;
}

/**
* Unique identifier
*/
@XmlElement(name = "id", namespace = Namespaces.ZANATA_OLD)
@JsonProperty("id")
@DocumentationExample(value = "444555", value2 = "444556")
public Long getId() {
return id;
}
Expand All @@ -88,8 +96,12 @@ public void setId(Long id) {
this.id = id;
}

/**
* Glossary entry's part of speech
*/
@XmlElement(name = "pos", namespace = Namespaces.ZANATA_OLD)
@JsonProperty("pos")
@DocumentationExample(value = "verb", value2 = "noun")
public String getPos() {
return pos;
}
Expand All @@ -108,8 +120,13 @@ public void setDescription(String description) {
this.description = description;
}

/**
* Number of translated terms. A term is the glossary entry's representation
* for a specific locale
*/
@XmlElement(name = "termsCount", namespace = Namespaces.ZANATA_API)
@JsonProperty("termsCount")
@DocumentationExample("2")
public int getTermsCount() {
return termsCount;
}
Expand All @@ -118,6 +135,9 @@ public void setTermsCount(int termsCount) {
this.termsCount = termsCount;
}

/**
* The full list of glossary terms
*/
@XmlElement(name = "glossary-term", namespace = Namespaces.ZANATA_OLD)
@JsonProperty("glossaryTerms")
public List<GlossaryTerm> getGlossaryTerms() {
Expand All @@ -131,9 +151,13 @@ public void setGlossaryTerms(List<GlossaryTerm> glossaryTerms) {
this.glossaryTerms = glossaryTerms;
}

/**
* The source locale for this specific entry
*/
@XmlAttribute(name = "src-lang")
@XmlJavaTypeAdapter(type = LocaleId.class, value = LocaleIdAdapter.class)
@JsonProperty("srcLang")
@DocumentationExample("en-US")
public LocaleId getSrcLang() {
return srcLang;
}
Expand Down
Expand Up @@ -7,19 +7,22 @@
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

import com.webcohesion.enunciate.metadata.Label;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.codehaus.jackson.annotate.JsonPropertyOrder;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.zanata.common.Namespaces;

/**
* Information about a specific Glossary.
* @author Alex Eng <a href="mailto:aeng@redhat.com">aeng@redhat.com</a>
*/
@XmlRootElement(name = "glossaryInfo")
@XmlType(name = "glossaryInfoType", propOrder = { "srcLocale", "transLocale"})
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonPropertyOrder({ "srcLocale", "transLocale"})
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
@Label("Glossary Info")
public class GlossaryInfo implements Serializable {
private static final long serialVersionUID = -5688873815049369490L;
private GlossaryLocaleInfo srcLocale;
Expand All @@ -35,6 +38,9 @@ public GlossaryInfo(GlossaryLocaleInfo srcLocale,
this.transLocale = transLocale;
}

/**
* The glossary's source locale
*/
@XmlElement(name = "srcLocale", required = false,
namespace = Namespaces.ZANATA_API)
public GlossaryLocaleInfo getSrcLocale() {
Expand All @@ -45,6 +51,9 @@ public void setSrcLocale(GlossaryLocaleInfo srcLocale) {
this.srcLocale = srcLocale;
}

/**
* The list of translated locale's available for the glossary
*/
@XmlElement(name = "transLocale", required = false,
namespace = Namespaces.ZANATA_API)
public List<GlossaryLocaleInfo> getTransLocale() {
Expand Down
Expand Up @@ -5,6 +5,8 @@
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

import com.webcohesion.enunciate.metadata.DocumentationExample;
import com.webcohesion.enunciate.metadata.Label;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.codehaus.jackson.annotate.JsonPropertyOrder;
import org.codehaus.jackson.map.annotate.JsonSerialize;
Expand All @@ -18,6 +20,7 @@
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonPropertyOrder({ "locale", "numberOfTerms"})
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
@Label("Glossary Locale Info")
public class GlossaryLocaleInfo implements Serializable {
private static final long serialVersionUID = 7486128063191358182L;
private LocaleDetails locale;
Expand All @@ -42,8 +45,12 @@ public void setLocale(LocaleDetails locale) {
this.locale = locale;
}

/**
* Number of terms available for the glossary in this locale
*/
@XmlElement(name = "numberOfTerms", required = false,
namespace = Namespaces.ZANATA_API)
@DocumentationExample("2")
public int getNumberOfTerms() {
return numberOfTerms;
}
Expand Down
Expand Up @@ -10,15 +10,16 @@
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

import com.webcohesion.enunciate.metadata.Label;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.annotate.JsonPropertyOrder;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.zanata.common.Namespaces;

/**
* Wrapper for list of HGlossaryEntry/GlossaryEntry and list of warning message after
* saving/update
* Wrapper for list of Glossary entries and a list of warning messages after
* saving/updating
*
* @author Alex Eng <a href="mailto:aeng@redhat.com">aeng@redhat.com</a>
*/
Expand All @@ -27,6 +28,7 @@
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
@XmlType(name = "glossaryResults", propOrder = {"glossaryEntries", "warnings"})
@Label("Glossary Results")
public class GlossaryResults implements Serializable {
private static final long serialVersionUID = 7100495681284134288L;
private List<GlossaryEntry> glossaryEntries;
Expand All @@ -40,6 +42,9 @@ public GlossaryResults(List<GlossaryEntry> glossaryEntries, List<String> warning
this.warnings = warnings;
}

/**
* The list of created / updated glossary entries
*/
@JsonProperty("glossaryEntries")
@XmlElementWrapper(name = "glossaryEntries", namespace = Namespaces.ZANATA_API)
@XmlElementRef(namespace = Namespaces.ZANATA_API)
Expand All @@ -50,6 +55,9 @@ public List<GlossaryEntry> getGlossaryEntries() {
return glossaryEntries;
}

/**
* A list of warnings generated when performing the operation
*/
@JsonProperty("warnings")
@XmlElementWrapper(name = "warnings", namespace = Namespaces.ZANATA_API)
public List<String> getWarnings() {
Expand Down
Expand Up @@ -29,6 +29,8 @@
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

import com.webcohesion.enunciate.metadata.DocumentationExample;
import com.webcohesion.enunciate.metadata.Label;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.annotate.JsonPropertyOrder;
Expand All @@ -37,15 +39,15 @@
import org.zanata.common.Namespaces;

/**
*
* A single glossary term for a single locale
* @author Alex Eng <a href="mailto:aeng@redhat.com">aeng@redhat.com</a>
*
**/

*/
@XmlType(name = "glossaryTermType", propOrder = {"comment", "content", "locale", "lastModifiedDate", "lastModifiedBy"})
@JsonPropertyOrder({ "content", "comment", "locale", "lastModifiedDate", "lastModifiedBy" })
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
@Label("Glossary Term")
public class GlossaryTerm implements Serializable {
/**
*
Expand All @@ -66,9 +68,13 @@ public class GlossaryTerm implements Serializable {
public GlossaryTerm() {
}

/**
* Term's locale
*/
@XmlAttribute(name = "lang", namespace = Namespaces.XML)
@XmlJavaTypeAdapter(type = LocaleId.class, value = LocaleIdAdapter.class)
@JsonProperty("locale")
@DocumentationExample(value = "es-ES", value2 = "ja")
public LocaleId getLocale() {
return locale;
}
Expand All @@ -77,9 +83,13 @@ public void setLocale(LocaleId locale) {
this.locale = locale;
}

/**
* The term's translation in the given locale
*/
@XmlElement(name = "content", required = false,
namespace = Namespaces.ZANATA_OLD)
@JsonProperty("content")
@DocumentationExample(value = "Una casa", value2 = "家")
public String getContent() {
return content;
}
Expand All @@ -98,9 +108,13 @@ public void setComment(String comment) {
this.comment = comment;
}

/**
* A string which identifies the user who last modififed this entry
*/
@XmlElement(name = "lastModifiedBy", required = false,
namespace = Namespaces.ZANATA_API)
@JsonProperty("lastModifiedBy")
@DocumentationExample("homer")
public String getLastModifiedBy() {
return lastModifiedBy;
}
Expand All @@ -109,6 +123,9 @@ public void setLastModifiedBy(String lastModifiedBy) {
this.lastModifiedBy = lastModifiedBy;
}

/**
* A timestamp indicating the last modification date for this entry
*/
@XmlElement(name = "lastModifiedDate", required = false,
namespace = Namespaces.ZANATA_API)
@JsonProperty("lastModifiedDate")
Expand Down

0 comments on commit 9933d5b

Please sign in to comment.