Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ target/
.project
.settings/
.classpath
.DS_Store
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#Sun May 30 17:51:26 CEST 2010
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
Expand Down
4 changes: 2 additions & 2 deletions net.sf.redmine_mylyn.api/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: net.sf.redmine_mylyn.api;singleton:=true
Bundle-Version: 0.4.0.qualifier
Bundle-Version: 0.4.1.qualifier
Bundle-Vendor: %Bundle-Vendor
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.5.0",
net.sf.redmine_mylyn.common;bundle-version="0.4.0",
net.sf.redmine_mylyn.common;bundle-version="0.4.1",
org.json;bundle-version="1.0.0",
org.eclipse.mylyn.commons.net;bundle-version="3.5.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Expand Down
2 changes: 1 addition & 1 deletion net.sf.redmine_mylyn.api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>net.sf.redmine_mylyn</groupId>
<artifactId>net.sf.redmine_mylyn.parent</artifactId>
<version>0.4.0-SNAPSHOT</version>
<version>0.4.1-SNAPSHOT</version>
</parent>

<artifactId>net.sf.redmine_mylyn.api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,25 @@ public interface IRedmineApiClient {
public Configuration getConfiguration();

public RedmineServerVersion detectServerVersion(IProgressMonitor monitor) throws RedmineApiErrorException;

public void updateConfiguration(IProgressMonitor monitor) throws RedmineApiErrorException;

public int[] getUpdatedIssueIds(int[] issues, Date updatedSince, IProgressMonitor monitor) throws RedmineApiErrorException;

public Issue getIssue(int id, IProgressMonitor monitor) throws RedmineApiErrorException;

public Issue[] getIssues(IProgressMonitor monitor, int... issueIds) throws RedmineApiErrorException;

public Issue[] query(Query query, IProgressMonitor monitor) throws RedmineApiErrorException;

public Issue createIssue(Issue issue, IRedmineApiErrorCollector errorCollector, IProgressMonitor monitor) throws RedmineApiInvalidDataException, RedmineApiErrorException;

public void updateIssue(Issue issue, String comment, TimeEntry timeEntry, IRedmineApiErrorCollector errorCollector, IProgressMonitor monitor) throws RedmineApiInvalidDataException, RedmineApiErrorException;
public void updateIssue(Issue issue, String comment, Date lastModified, TimeEntry timeEntry, IRedmineApiErrorCollector errorCollector, IProgressMonitor monitor) throws RedmineApiInvalidDataException, RedmineApiErrorException;

public void updateIssue(int issueId, Map<RedmineApiIssueProperty, String> issueValues, String comment, TimeEntry timeEntry, IRedmineApiErrorCollector errorCollector, IProgressMonitor monitor) throws RedmineApiInvalidDataException, RedmineApiErrorException;

public InputStream getAttachmentContent(int attachmentId, String fileName, IProgressMonitor monitor) throws RedmineApiErrorException;

public void uploadAttachment(int issueId, Attachment attachment, InputStream content, String comment, IRedmineApiErrorCollector errorCollector, IProgressMonitor monitor) throws RedmineApiInvalidDataException, RedmineApiErrorException;

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,150 +15,153 @@

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name="customField", propOrder={
"type",
"fieldFormat",
"minLength",
"maxLength",
"regexp",
"possibleValues",
"defaultValue",
"isRequired",
"isFilter",
"isForAll"})
"type",
"fieldFormat",
"minLength",
"maxLength",
"regexp",
"possibleValues",
"defaultValue",
"isRequired",
"isFilter",
"isForAll",
"isMultiple"})
public class CustomField extends Property implements IQueryField {

private static final long serialVersionUID = 1L;

public enum Type {IssueCustomField, TimeEntryCustomField};

public enum Format {
@XmlEnumValue("string")
STRING,
STRING,
@XmlEnumValue("text")
TEXT,
TEXT,
@XmlEnumValue("int")
INT,
INT,
@XmlEnumValue("float")
FLOAT,
FLOAT,
@XmlEnumValue("list")
LIST,
LIST,
@XmlEnumValue("date")
DATE,
DATE,
@XmlEnumValue("bool")
BOOL,
@XmlEnumValue("version")
VERSION,
@XmlEnumValue("user")
USER;

public String getLabel() {
return name().toLowerCase();
}

public boolean isListType() {
return this==LIST || this==VERSION || this==USER;
}
};

private Type type;

private Format fieldFormat;

@XmlElementWrapper(name="possibleValues")
@XmlElement(name="possibleValue")
private List<String> possibleValues;

private String regexp;

private int minLength;

private int maxLength;

private boolean isRequired;

private boolean isForAll;

private boolean isFilter;

private String defaultValue;

private boolean isMultiple;

public Type getType() {
return type;
}

public void setType(Type type) {
public void setType(final Type type) {
this.type = type;
}

public Format getFieldFormat() {
return fieldFormat;
}

public void setFieldFormat(Format fieldFormat) {
public void setFieldFormat(final Format fieldFormat) {
this.fieldFormat = fieldFormat;
}

public List<String> getPossibleValues() {
return possibleValues;
}

public void setPossibleValues(List<String> possibleValues) {
public void setPossibleValues(final List<String> possibleValues) {
this.possibleValues = possibleValues;
}

public String getRegexp() {
return regexp;
}

public void setRegexp(String regexp) {
public void setRegexp(final String regexp) {
this.regexp = regexp;
}

public int getMinLength() {
return minLength;
}

public void setMinLength(int minLength) {
public void setMinLength(final int minLength) {
this.minLength = minLength;
}

public int getMaxLength() {
return maxLength;
}

public void setMaxLength(int maxLength) {
public void setMaxLength(final int maxLength) {
this.maxLength = maxLength;
}

public boolean isRequired() {
return isRequired;
}

public void setRequired(boolean isRequired) {
public void setRequired(final boolean isRequired) {
this.isRequired = isRequired;
}

public boolean isForAll() {
return isForAll;
}

public void setForAll(boolean isForAll) {
public void setForAll(final boolean isForAll) {
this.isForAll = isForAll;
}

public boolean isFilter() {
return isFilter && getFieldFormat()!=Format.USER && getFieldFormat()!=Format.VERSION;
}

public void setFilter(boolean isFilter) {
public void setFilter(final boolean isFilter) {
this.isFilter = isFilter;
}

public String getDefaultValue() {
return defaultValue;
}

public void setDefaultValue(String defaultValue) {
public void setDefaultValue(final String defaultValue) {
this.defaultValue = defaultValue;
}

Expand All @@ -176,7 +179,7 @@ public String getLabel() {
public boolean isCrossProjectUsable() {
return isForAll;
}

public QueryField getQueryField() {
if(isFilter()) {
switch (getFieldFormat()) {
Expand All @@ -187,10 +190,14 @@ public QueryField getQueryField() {
case TEXT: return QueryField.TEXT_TYPE;
case INT: return QueryField.INT_TYPE;
case FLOAT: return QueryField.FLOAT_TYPE;

default: return null;
}
}
return null;
}

public boolean isMultiple() {
return isMultiple;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,52 +11,69 @@

import net.sf.redmine_mylyn.api.model.CustomValue;

import org.json.JSONArray;
import org.json.JSONException;

@XmlType(name="customValues")
@XmlAccessorType(XmlAccessType.NONE)
public class CustomValues extends AbstractTypedContainer<CustomValue> {

private List<CustomValue> customValues;

private HashMap<Integer, CustomValue> byCustomFieldId;

@Override
@XmlElement(name="customValue")
protected List<CustomValue> getModifiableList() {
if(customValues==null) {
byCustomFieldId = new HashMap<Integer, CustomValue>();

customValues = new ArrayList<CustomValue>() {
private static final long serialVersionUID = 1L;

public boolean add(CustomValue e) {

@Override
public boolean add(final CustomValue e) {
if(super.add(e)) {
byCustomFieldId.put(Integer.valueOf(e.getCustomFieldId()), e);
return true;
}
return false;
};

};
}
return customValues;
}
public CustomValue getByCustomFieldId(int customFieldId) {

public CustomValue getByCustomFieldId(final int customFieldId) {
if(byCustomFieldId!=null) {
return byCustomFieldId.get(Integer.valueOf(customFieldId));
}
return null;
}
public void setCustomValue(int customFieldId, String value) {

public void setCustomValue(final int customFieldId, final String value) {
CustomValue customValue= getByCustomFieldId(Integer.valueOf(customFieldId));
if(customValue==null) {
customValue = new CustomValue();
customValue.setCustomFieldId(customFieldId);
customValue.setValue(value);
getModifiableList().add(customValue);
} else {
customValue.setValue(value);
final String existingValue = customValue.getValue();
if (existingValue == null || existingValue.isEmpty()) {
customValue.setValue(value);
} else {
JSONArray array;
try {
array = new JSONArray(existingValue);
} catch (final JSONException e) {
array = new JSONArray();
array.put(existingValue);
}
array.put(value);
customValue.setValue(array.toString());
}
}
}

Expand Down
Loading