Subversion Repositories XServices

Compare Revisions

Ignore whitespace Rev 33 → Rev 34

/sbm4mylyn/trunk/src/net/brutex/mylyn/sbmconnector/core/SBMClient.java
191,7 → 191,8
return ttitem.getState().getValue();
}
if(fieldname.equals(SBMStaticFields.ID.getValue())) {
return ttitem.getGenericItem().getValue().getItemID().getValue();
return ttitem.getGenericItem().getValue().getItemName().getValue()+
" ["+ttitem.getGenericItem().getValue().getItemID().getValue()+"]";
}
if(fieldname.equals(SBMStaticFields.PROJECTID.getValue())) {
if(ttitem.getClassification() ==null || ttitem.getClassification().isNil()) return "";
451,4 → 452,22
}
return values;
}
 
public List<SBMFieldValue> getValidSet(String tablename, String fieldname) {
List<SBMFieldValue> list = new ArrayList<SBMFieldValue>();
List<TTItem> ttlist = new ArrayList<TTItem>();
String sql = "TS_ID in (select max(TS_ID) from "+tablename+" group by ts_"+fieldname+")";
try {
ttlist = getTTItemsByTable(tablename, sql);
} catch (CoreException e) {
new CoreException(
RepositoryStatus.createInternalError(
SBMConnectorPlugin.PLUGIN_ID, e.getMessage(), e));
}
for(TTItem ttitem : ttlist) {
list.add(getFieldValue(ttitem, fieldname));
}
return list;
}
}
/sbm4mylyn/trunk/src/net/brutex/mylyn/sbmconnector/core/model/SBMFieldValue.java
1,5 → 1,7
package net.brutex.mylyn.sbmconnector.core.model;
 
import org.eclipse.core.runtime.Assert;
 
public class SBMFieldValue {
private String internalValue;
private String value;
6,6 → 8,8
public SBMFieldValue(String internalValue, String value) {
Assert.isNotNull(internalValue);
Assert.isNotNull(value);
this.internalValue = internalValue;
this.value = value;
}
/sbm4mylyn/trunk/src/net/brutex/mylyn/sbmconnector/core/SBMTicketDataHandler.java
130,7 → 130,8
TaskData data = new TaskData(new SBMTicketAttributeMapper(repository),
SBMConnectorPlugin.CONNECTOR_KIND,
repository.getRepositoryUrl(),
ttitem.getGenericItem().getValue().getItemID().getValue());
ttitem.getGenericItem().getValue().getItemName().getValue()+" ["+
ttitem.getGenericItem().getValue().getItemID().getValue()+"]");
initializeTaskData(repository, data, null, monitor);
// Create Fields for all the generic SBM (system) fields
for (SBMTicketAttribute f : SBMTicketAttribute.values()) {
153,7 → 154,17
} else {
attr.getMetaData().setKind(null);
}
/*
if(f.getTaskType()==TaskAttribute.TYPE_SINGLE_SELECT) {
List<SBMFieldValue> options =
client.getValidSet(client.getTableName(ttitem), f.getSBMName());
for( SBMFieldValue optionvalue: options) {
attr.putOption(optionvalue.getValue(), optionvalue.getValue());
}
}
*/
attr.setValue(client.getStaticFieldValue(ttitem, f.getSBMName()));
}
//Custom fields
167,11 → 178,15
new SBMTicketAttributeMapper(repository).mapToTaskKey(f.getType()));
custom.getMetaData().setLabel(f.getLabel());
custom.getMetaData().setKind(TaskAttribute.KIND_DEFAULT);
custom.getMetaData().setReadOnly(true);
custom.getMetaData().setReadOnly(false);
if(f.getType()==SBMFieldTypes.SELECTION &&
client.getFieldValue(ttitem, f.getName())!=null) {
List<SBMFieldValue> options =
client.getValidSet(client.getTableName(ttitem), f.getName());
for( SBMFieldValue optionvalue: options) {
custom.putOption(optionvalue.getInternalValue(), optionvalue.getValue());
}
String val = client.getFieldValue(ttitem, f.getName()).getValue();
custom.putOption(val, val);
custom.setValue(val);
} else if(f.getType()==SBMFieldTypes.MULTIPLE_SELECTION
|| f.getType()==SBMFieldTypes.MULTIPLE_RELATIONAL