/sbm4mylyn/branches/V2009R2-maintenance/META-INF/MANIFEST.MF |
---|
8,17 → 8,16 |
org.eclipse.core.runtime, |
org.eclipse.jface.text, |
org.eclipse.ui.forms, |
org.eclipse.mylyn;bundle-version="3.2.3", |
org.eclipse.mylyn.commons.core;bundle-version="3.2.3", |
org.eclipse.mylyn;bundle-version="3.2.0", |
org.eclipse.mylyn.commons.core;bundle-version="3.2.0", |
org.eclipse.mylyn.commons.net;bundle-version="3.2.0", |
org.eclipse.mylyn.commons.ui;bundle-version="3.2.3", |
org.eclipse.mylyn.compatibility;bundle-version="3.2.3", |
org.eclipse.mylyn.context.core;bundle-version="3.2.3", |
org.eclipse.mylyn.discovery.core;bundle-version="3.2.3", |
org.eclipse.mylyn.discovery.ui;bundle-version="3.2.3", |
org.eclipse.mylyn.monitor.core;bundle-version="3.2.3", |
org.eclipse.mylyn.monitor.ui;bundle-version="3.2.3", |
org.eclipse.mylyn.tasks.core;bundle-version="3.2.3", |
org.eclipse.mylyn.tasks.ui;bundle-version="3.2.3" |
org.eclipse.mylyn.commons.ui;bundle-version="3.2.0", |
org.eclipse.mylyn.context.core;bundle-version="3.2.0", |
org.eclipse.mylyn.discovery.core;bundle-version="3.2.0", |
org.eclipse.mylyn.discovery.ui;bundle-version="3.2.0", |
org.eclipse.mylyn.monitor.core;bundle-version="3.2.0", |
org.eclipse.mylyn.monitor.ui;bundle-version="3.2.0", |
org.eclipse.mylyn.tasks.core;bundle-version="3.2.0", |
org.eclipse.mylyn.tasks.ui;bundle-version="3.2.0" |
Bundle-ActivationPolicy: lazy |
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 |
/sbm4mylyn/branches/V2009R2-maintenance/schema/org.eclipse.mylyn.tasks.ui.repositories.exsd |
---|
0,0 → 1,84 |
<?xml version='1.0' encoding='UTF-8'?> |
<!-- Schema file written by PDE --> |
<schema targetNamespace="net.brutex.mylyn.sbmconnector" xmlns="http://www.w3.org/2001/XMLSchema"> |
<annotation> |
<appinfo> |
<meta.schema plugin="net.brutex.mylyn.sbmconnector" id="org.eclipse.mylyn.tasks.ui.repositories" name="SBMRepositoryConnector"/> |
</appinfo> |
<documentation> |
[Enter description of this extension point.] |
</documentation> |
</annotation> |
<element name="extension"> |
<annotation> |
<appinfo> |
<meta.element /> |
</appinfo> |
</annotation> |
<complexType> |
<attribute name="point" type="string" use="required"> |
<annotation> |
<documentation> |
</documentation> |
</annotation> |
</attribute> |
<attribute name="id" type="string"> |
<annotation> |
<documentation> |
</documentation> |
</annotation> |
</attribute> |
<attribute name="name" type="string"> |
<annotation> |
<documentation> |
</documentation> |
<appinfo> |
<meta.attribute translatable="true"/> |
</appinfo> |
</annotation> |
</attribute> |
</complexType> |
</element> |
<annotation> |
<appinfo> |
<meta.section type="since"/> |
</appinfo> |
<documentation> |
[Enter the first release in which this extension point appears.] |
</documentation> |
</annotation> |
<annotation> |
<appinfo> |
<meta.section type="examples"/> |
</appinfo> |
<documentation> |
[Enter extension point usage example here.] |
</documentation> |
</annotation> |
<annotation> |
<appinfo> |
<meta.section type="apiinfo"/> |
</appinfo> |
<documentation> |
[Enter API information here.] |
</documentation> |
</annotation> |
<annotation> |
<appinfo> |
<meta.section type="implementation"/> |
</appinfo> |
<documentation> |
[Enter information about supplied implementation of this extension point.] |
</documentation> |
</annotation> |
</schema> |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/sbm4mylyn/branches/V2009R2-maintenance/doc/SBM4Mylyn_Installation_Guide.odt |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/sbm4mylyn/branches/V2009R2-maintenance/src/net/brutex/mylyn/sbmconnector/core/SBMClient.java |
---|
24,8 → 24,10 |
import java.net.URL; |
import java.util.ArrayList; |
import java.util.Date; |
import java.util.HashMap; |
import java.util.Iterator; |
import java.util.List; |
import java.util.Map; |
import java.util.StringTokenizer; |
import javax.xml.namespace.QName; |
45,6 → 47,11 |
import net.brutex.sbm.wsclient.NameValue; |
import net.brutex.sbm.wsclient.Note; |
import net.brutex.sbm.wsclient.ObjectFactory; |
import net.brutex.sbm.wsclient.ReportCategory; |
import net.brutex.sbm.wsclient.ReportInfo; |
import net.brutex.sbm.wsclient.ReportResult; |
import net.brutex.sbm.wsclient.ReportsFilter; |
import net.brutex.sbm.wsclient.RunReportResult; |
import net.brutex.sbm.wsclient.TTItem; |
import net.brutex.sbm.wsclient.TableData; |
import net.brutex.sbm.wsclient.TableType; |
63,7 → 70,15 |
private TaskRepository repository; |
private ObjectFactory of; |
private List<TableData> tables = new ArrayList<TableData>(); |
private Map<String, List<SBMFieldValue>> validsets = new HashMap<String, List<SBMFieldValue>>(); |
/** |
* Instantiates a new SBM client. |
* Creates new instance of the aewebservices71 {@link net.brutex.sbm.wsclient.ObjectFactory} and |
* initializes web service endpoint from repository url. |
* |
* @param repository the repository |
*/ |
public SBMClient(TaskRepository repository) { |
this.repository = repository; |
this.of = new ObjectFactory(); |
77,6 → 92,13 |
repository.getRepositoryUrl()); |
} |
/** |
* Can authenticate checks if this SBMClient instance has proper authentication details |
* set in its related repository. The check is done by invoking the GetUser web service. |
* |
* @return true, if successful |
* @throws CoreException the core exception |
*/ |
public boolean canAuthenticate() throws CoreException { |
try { |
port.getUser(getAuth(), repository.getCredentials(AuthenticationType.REPOSITORY).getUserName()); |
89,7 → 111,22 |
} |
public List<TTItem> getTTItemsByTable(String tablename, String sql_where) throws CoreException { |
return getTTItemsByTable(tablename, sql_where, false); |
} |
/** |
* Gets the SBM items from a table. The result size is limited to 500 and the sorting is done |
* by TS_ID descending. |
* |
* @param tablename the tablename |
* @param sql_where the sql_where |
* @return the tT items by table |
* @throws CoreException the core exception |
*/ |
public List<TTItem> getTTItemsByTable(String tablename, String sql_where, boolean getFullData) throws CoreException { |
List<TTItem> list = new ArrayList<TTItem>(); |
String sections = "SECTION:FIXED"; |
if(getFullData) sections = "SECTION:ALL"; |
if(sql_where==null || sql_where.isEmpty()) sql_where = "TS_ID>0"; |
try { |
list = port.getItemsByQueryWithName( |
96,17 → 133,86 |
getAuth(), |
tablename, |
"("+sql_where+")", |
"TS_SUBMITDATE desc", |
BigInteger.valueOf(500l), null); |
"TS_ID desc", |
null, |
sections); |
} catch (AEWebservicesFaultFault e) { |
new CoreException( |
throw new CoreException( |
RepositoryStatus.createInternalError( |
SBMConnectorPlugin.PLUGIN_ID, e.getFaultInfo(), e)); |
SBMConnectorPlugin.PLUGIN_ID, e.getMessage(), e)); |
} |
return list; |
} |
public List<TTItem> getTTItemsByReport(String reportuuid) throws CoreException { |
List<TTItem> list = new ArrayList<TTItem>(); |
try { |
RunReportResult result = port.runReport( |
getAuth(), of.createQueryRange(), reportuuid, null, null, null, null, null, null, |
null, null, null, null, null); |
List<ReportResult> resultlist = result.getResult(); |
for(ReportResult r : resultlist) { |
list.add(port.getItem( getAuth(), r.getItemId().getValue(), null)); |
} |
} catch (AEWebservicesFaultFault e) { |
throw new CoreException( |
RepositoryStatus.createInternalError( |
SBMConnectorPlugin.PLUGIN_ID, e.getMessage(), e)); |
} |
return list; |
} |
public List<ReportInfo> getReportList(String solutionname) throws CoreException { |
ReportsFilter filter = of.createReportsFilter(); |
List<ReportInfo> reportlist = new ArrayList<ReportInfo>(); |
filter.setSolutionName(of.createSolutionDataName(solutionname)); |
filter.setReportCategory(ReportCategory.USERREPORTS); //Limit this for now, because we execute by uuid only |
try { |
reportlist = port.getReports(getAuth(), null, filter).getReport(); |
} catch (AEWebservicesFaultFault e) { |
throw new CoreException( |
RepositoryStatus.createInternalError( |
SBMConnectorPlugin.PLUGIN_ID, e.getMessage(), e)); |
} |
return reportlist; |
} |
public List<String> getResultCount(String tablename, String sql) throws CoreException { |
List<TTItem> list = new ArrayList<TTItem>(); |
List<String> idlist = new ArrayList<String>(); |
try { |
list = port.getItemsByQueryWithName( |
getAuth(), |
tablename, |
"("+sql+")", |
"TS_ID desc", |
null, |
"SECTION:NONE"); |
} catch (AEWebservicesFaultFault e) { |
throw new CoreException( |
RepositoryStatus.createInternalError( |
SBMConnectorPlugin.PLUGIN_ID, e.getMessage(), e)); |
} |
for (TTItem item : list) { |
idlist.add(item.getGenericItem().getValue().getItemID().getValue()); |
} |
return idlist; |
} |
/** |
* Gets a SBM item specified by its internal identifier ([tableid:recordid]) |
* |
* @param itemid the itemid |
* @return the tT item |
*/ |
public TTItem getTTItem(String itemid) { |
int pos1; |
int pos2; |
pos1 = itemid.lastIndexOf("[")+1; |
pos2 = itemid.lastIndexOf("]"); |
itemid = itemid.substring(pos1, pos2); |
TTItem item = of.createTTItem(); |
try { |
item = port.getItem(getAuth(), itemid, null); |
162,7 → 268,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 ""; |
242,6 → 349,14 |
return "UNKNOWN"; |
} |
/** |
* Gets the field label. The SBM item is used to determine the table id of |
* the table where this field is in. |
* |
* @param ttitem the ttitem |
* @param fieldname the fieldname |
* @return the field label |
*/ |
public String getFieldLabel(TTItem ttitem, String fieldname) { |
refreshTables(); |
String itemid = ttitem.getGenericItem().getValue().getItemID().getValue(); |
258,7 → 373,7 |
break; |
} |
} |
return "label_UNKNOWN"; |
return fieldname; //field has not been found |
} |
/** |
279,6 → 394,12 |
return null; |
} |
/** |
* Gets the notes attached to a SBM item. |
* |
* @param ttitem the ttitem |
* @return the notes |
*/ |
public List<SBMNote> getNotes(TTItem ttitem) { |
List<SBMNote> notes = new ArrayList<SBMNote>(); |
Iterator<Note> iter = ttitem.getNoteList().iterator(); |
408,4 → 529,23 |
} |
return values; |
} |
public List<SBMFieldValue> getValidSet(String tablename, String fieldname) { |
if(validsets.containsKey(tablename+":"+fieldname)) return validsets.get(tablename+":"+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)); |
} |
validsets.put(tablename+":"+fieldname, list); |
return list; |
} |
} |
/sbm4mylyn/branches/V2009R2-maintenance/src/net/brutex/mylyn/sbmconnector/core/SBMTicketAttribute.java |
---|
37,7 → 37,7 |
SBMFieldTypes.TEXT, |
TaskAttribute.DESCRIPTION, |
TaskAttribute.TYPE_LONG_RICH_TEXT, |
SBMTicketAttribute.HIDDEN), //hidden because has extra part |
false), //hidden because has extra part |
ID( |
SBMStaticFields.ID.getValue(), |
"ts_id", |
44,7 → 44,7 |
SBMFieldTypes.SYSTEM, |
TaskAttribute.TASK_KEY, |
TaskAttribute.TYPE_SHORT_TEXT, |
SBMTicketAttribute.HIDDEN), |
false), |
UUID( |
SBMStaticFields.UUID.getValue(), |
"ts_uuid", |
51,7 → 51,7 |
SBMFieldTypes.SYSTEM, |
TaskAttribute.KIND_DEFAULT, |
TaskAttribute.TYPE_SHORT_TEXT, |
SBMTicketAttribute.HIDDEN), |
false), |
PROJECT( |
SBMStaticFields.PROJECTID.getValue(), |
"label_project", |
64,13 → 64,14 |
SBMFieldTypes.SYSTEM, |
TaskAttribute.STATUS, |
TaskAttribute.TYPE_SHORT_TEXT, |
SBMTicketAttribute.HIDDEN), //hidden because has extra part |
false), //hidden because has extra part |
SUBMITTER( |
SBMStaticFields.SUBMITTER.getValue(), |
"label_submitter", |
SBMFieldTypes.USER, |
TaskAttribute.USER_REPORTER, |
TaskAttribute.TYPE_PERSON), |
TaskAttribute.TYPE_PERSON, |
false), //hidden because has extra part |
SUBMITDATE( |
SBMStaticFields.SUBMITDATE.getValue(), |
"label_submitdate", |
88,6 → 89,13 |
"label_modifieddate", |
SBMFieldTypes.DATETIME, |
TaskAttribute.DATE_MODIFICATION, |
TaskAttribute.TYPE_DATETIME, |
false), //hidden because has extra part |
CLOSEDATE( |
SBMStaticFields.CLOSEDATE.getValue(), |
"label_closedate", |
SBMFieldTypes.DATETIME, |
TaskAttribute.DATE_DUE, |
TaskAttribute.TYPE_DATETIME), |
ITEMURL( |
SBMStaticFields.ITEMURL.getValue(), |
95,7 → 103,7 |
SBMFieldTypes.SYSTEM, |
TaskAttribute.TASK_URL, |
TaskAttribute.TYPE_URL, |
SBMTicketAttribute.HIDDEN), |
false), |
TITLE( |
"TITLE", |
"label_title", |
102,7 → 110,7 |
SBMFieldTypes.TEXT, |
TaskAttribute.SUMMARY, |
TaskAttribute.TYPE_SHORT_TEXT, |
SBMTicketAttribute.HIDDEN), //hidden because has extra part |
false), //hidden because has extra part |
ACTIVEINACTIVE( |
SBMStaticFields.ACTIVEINACTIVE.getValue(), |
"label_activeinactive", |
177,4 → 185,13 |
} |
return null; |
} |
public static boolean hasSBMField(String fieldname) { |
for (SBMTicketAttribute attribute : values()) { |
if (attribute.getSBMName().equals(fieldname)) { |
return true; |
} |
} |
return false; |
} |
} |
/sbm4mylyn/branches/V2009R2-maintenance/src/net/brutex/mylyn/sbmconnector/core/SBMRepositoryConnector.java |
---|
26,6 → 26,9 |
import net.brutex.mylyn.sbmconnector.SBMConnectorPlugin; |
import net.brutex.mylyn.sbmconnector.core.model.SBMStaticFields; |
import net.brutex.mylyn.sbmconnector.ui.SBMQueryComposite; |
import net.brutex.mylyn.sbmconnector.ui.SBMRepositoryQueryPage; |
import net.brutex.mylyn.sbmconnector.ui.SBMRepositorySettingsPage; |
import net.brutex.sbm.wsclient.TTItem; |
import org.eclipse.core.runtime.CoreException; |
100,7 → 103,7 |
try { |
SBMClient client = getClient(taskRepository); |
TTItem item = client.getTTItem(taskId); |
data = datahandler.convert(taskRepository, item, monitor); |
data = datahandler.convert(taskRepository, item, monitor, null); |
} finally { |
monitor.done(); |
117,7 → 120,7 |
@Override |
public String getTaskUrl(String repositoryUrl, String taskId) { |
// TODO Auto-generated method stub |
return null; |
return "http://something/I/havent/implemented/yet?"+taskId; |
} |
@Override |
142,23 → 145,71 |
public IStatus performQuery(TaskRepository repository, |
IRepositoryQuery query, TaskDataCollector collector, |
ISynchronizationSession session, IProgressMonitor monitor) { |
SBMClient client = new SBMClient(repository); |
// do we use a report or a query? |
if (query.getAttribute(SBMRepositoryQueryPage.SQL_QUERY_NAME).equals( |
query.getAttribute(SBMRepositoryQueryPage.REPORT_OR_QUERY))) { |
monitor.subTask("Calculating query result size ..."); |
try { |
monitor.beginTask("Lade Daten", IProgressMonitor.UNKNOWN); |
SBMClient client = new SBMClient(repository); |
List<TTItem> list = client.getTTItemsByTable(query |
.getAttribute("table"), query.getAttribute("sql_where")); |
for (TTItem ttitem : list) { |
TaskData data = datahandler |
.convert(repository, ttitem, monitor); |
List<String> idlist = client.getResultCount( |
getQueryTable(repository), |
query.getAttribute("sql_where")); |
int countItem = idlist.size(); |
monitor.beginTask("", countItem); |
monitor.subTask("Loading " + countItem + " items ..."); |
// List<TTItem> list = client.getTTItemsByTable( |
// getQueryTable(repository), query.getAttribute("sql_where"), |
// true); |
monitor.worked(1); |
int i = 1; |
for (String id : idlist) { |
if (id != null) { |
monitor.subTask("Loading item " + i + "/" + countItem |
+ " ..."); |
TTItem ttitem = client.getTTItem("[" + id + "]"); |
TaskData data = datahandler.convert(repository, ttitem, |
monitor, query); |
collector.accept(data); |
} |
monitor.worked(1); |
if (monitor.isCanceled()) |
return Status.CANCEL_STATUS; |
i++; |
} |
} catch (CoreException e) { |
return new Status(IStatus.ERROR, SBMConnectorPlugin.PLUGIN_ID, |
"Query fehlgeschlagen.", e); |
IStatus status = new Status(IStatus.ERROR, |
SBMConnectorPlugin.PLUGIN_ID, e.getMessage(), e); |
// StatusManager.getManager().handle(status, |
// StatusManager.BLOCK); |
return status; |
} finally { |
monitor.done(); |
} |
} else { |
// use report |
monitor.beginTask("Loading Report", 0); |
try { |
List<TTItem> list = client.getTTItemsByReport(query |
.getAttribute(SBMRepositoryQueryPage.REPORT)); |
for(TTItem i:list) { |
TaskData data = datahandler.convert(repository, i, |
monitor, query); |
collector.accept(data); |
} |
} catch (CoreException e) { |
IStatus status = new Status(IStatus.ERROR, |
SBMConnectorPlugin.PLUGIN_ID, e.getMessage(), e); |
// StatusManager.getManager().handle(status, |
// StatusManager.BLOCK); |
return status; |
} finally { |
monitor.done(); |
} |
} |
return Status.OK_STATUS; |
} |
185,10 → 236,10 |
return datahandler; |
} |
@Override |
public boolean canDeleteTask(TaskRepository repository, ITask task) { |
return false; |
} |
@Override |
public boolean hasRepositoryDueDate(TaskRepository taskRepository, |
ITask task, TaskData taskData) { |
196,5 → 247,10 |
return false; |
} |
private String getQueryTable(TaskRepository repository) { |
return repository |
.getProperty(SBMRepositorySettingsPage.STRING_SOLUTIONTABLE); |
} |
} |
/sbm4mylyn/branches/V2009R2-maintenance/src/net/brutex/mylyn/sbmconnector/core/SBMTicketDataHandler.java |
---|
19,9 → 19,15 |
*/ |
package net.brutex.mylyn.sbmconnector.core; |
import java.util.Date; |
import java.util.GregorianCalendar; |
import java.util.List; |
import java.util.Set; |
import javax.xml.datatype.DatatypeConfigurationException; |
import javax.xml.datatype.DatatypeFactory; |
import javax.xml.datatype.XMLGregorianCalendar; |
import net.brutex.mylyn.sbmconnector.SBMConnectorPlugin; |
import net.brutex.mylyn.sbmconnector.core.model.SBMField; |
import net.brutex.mylyn.sbmconnector.core.model.SBMFieldAttributes; |
29,10 → 35,13 |
import net.brutex.mylyn.sbmconnector.core.model.SBMFieldValue; |
import net.brutex.mylyn.sbmconnector.core.model.SBMNote; |
import net.brutex.mylyn.sbmconnector.core.model.SBMStaticFields; |
import net.brutex.mylyn.sbmconnector.core.model.SBMSystemFields; |
import net.brutex.mylyn.sbmconnector.ui.SBMRepositorySettingsPage; |
import net.brutex.sbm.wsclient.TTItem; |
import org.eclipse.core.runtime.CoreException; |
import org.eclipse.core.runtime.IProgressMonitor; |
import org.eclipse.mylyn.tasks.core.IRepositoryQuery; |
import org.eclipse.mylyn.tasks.core.ITaskMapping; |
import org.eclipse.mylyn.tasks.core.RepositoryResponse; |
import org.eclipse.mylyn.tasks.core.TaskRepository; |
53,14 → 62,19 |
/** |
* Instantiates a new SBM ticket data handler. |
* |
* @param connector the connector |
* @param connector |
* the connector |
*/ |
public SBMTicketDataHandler(SBMRepositoryConnector connector) { |
this.connector = connector; |
} |
/* (non-Javadoc) |
* @see org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler#getAttributeMapper(org.eclipse.mylyn.tasks.core.TaskRepository) |
/* |
* (non-Javadoc) |
* |
* @see |
* org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler#getAttributeMapper |
* (org.eclipse.mylyn.tasks.core.TaskRepository) |
*/ |
@Override |
public TaskAttributeMapper getAttributeMapper(TaskRepository taskRepository) { |
67,45 → 81,33 |
return new SBMTicketAttributeMapper(taskRepository); |
} |
/* (non-Javadoc) |
* @see org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler#initializeTaskData(org.eclipse.mylyn.tasks.core.TaskRepository, org.eclipse.mylyn.tasks.core.data.TaskData, org.eclipse.mylyn.tasks.core.ITaskMapping, org.eclipse.core.runtime.IProgressMonitor) |
/* |
* (non-Javadoc) |
* |
* @see |
* org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler#initializeTaskData |
* (org.eclipse.mylyn.tasks.core.TaskRepository, |
* org.eclipse.mylyn.tasks.core.data.TaskData, |
* org.eclipse.mylyn.tasks.core.ITaskMapping, |
* org.eclipse.core.runtime.IProgressMonitor) |
*/ |
@Override |
public boolean initializeTaskData(TaskRepository repository, TaskData taskData, |
ITaskMapping initializationData, IProgressMonitor monitor) |
throws CoreException { |
/*TaskAttribute attribute = taskData.getRoot().createAttribute(SBMStaticFields.TITLE); |
attribute.getMetaData().setReadOnly(false).setType(TaskAttribute.TYPE_SHORT_TEXT).setLabel("Summary:"); |
/*attribute = taskData.getRoot().createAttribute(SBMStaticFields.DESCRIPTION); |
attribute.getMetaData().setReadOnly(false).setType(TaskAttribute.TYPE_LONG_TEXT).setLabel("Description:"); |
attribute = taskData.getRoot().createAttribute(SBMStaticFields.SUBMITDATE); |
attribute.getMetaData().setReadOnly(false).setType(TaskAttribute.TYPE_DATETIME).setLabel("Create Date:"); |
if (!taskData.isNew()) { |
attribute = taskData.getRoot().createAttribute(TaskAttribute.TASK_URL); |
attribute.getMetaData().setReadOnly(true).setKind(TaskAttribute.KIND_DEFAULT).setType( |
TaskAttribute.TYPE_URL).setLabel("Location:"); |
File file = client.getTask(taskData.getTaskId(), monitor); |
try { |
attribute.setValue(file.toURI().toURL().toString()); |
} catch (MalformedURLException e) { |
} |
} |
attribute = taskData.getRoot().createAttribute(TaskAttribute.PRODUCT); |
attribute.getMetaData().setReadOnly(false).setKind(TaskAttribute.KIND_DEFAULT).setType( |
TaskAttribute.TYPE_SINGLE_SELECT).setLabel("Project"); |
*/ |
public boolean initializeTaskData(TaskRepository repository, |
TaskData taskData, ITaskMapping initializationData, |
IProgressMonitor monitor) throws CoreException { |
monitor.subTask("Initialising task ..."); |
taskData.setPartial(true); |
return true; |
} |
/* (non-Javadoc) |
* @see org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler#postTaskData(org.eclipse.mylyn.tasks.core.TaskRepository, org.eclipse.mylyn.tasks.core.data.TaskData, java.util.Set, org.eclipse.core.runtime.IProgressMonitor) |
/* |
* (non-Javadoc) |
* |
* @see |
* org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler#postTaskData |
* (org.eclipse.mylyn.tasks.core.TaskRepository, |
* org.eclipse.mylyn.tasks.core.data.TaskData, java.util.Set, |
* org.eclipse.core.runtime.IProgressMonitor) |
*/ |
@Override |
public RepositoryResponse postTaskData(TaskRepository repository, |
119,75 → 121,163 |
* Convert. |
* |
* @param repository the repository |
* @param ttitem the ttitem |
* @param monitor the monitor |
* @param ttitem |
* the ttitem |
* @param monitor |
* the monitor |
* @return the task data |
* @throws CoreException the core exception |
* @throws CoreException |
* the core exception |
*/ |
public TaskData convert(TaskRepository repository, TTItem ttitem, IProgressMonitor monitor) |
public TaskData convert(TaskRepository repository, TTItem ttitem, |
IProgressMonitor monitor, IRepositoryQuery query) |
throws CoreException { |
SBMClient client = SBMRepositoryConnector.getClient(repository); |
TaskData data = new TaskData(new SBMTicketAttributeMapper(repository), |
SBMConnectorPlugin.CONNECTOR_KIND, |
repository.getRepositoryUrl(), |
ttitem.getGenericItem().getValue().getItemID().getValue()); |
SBMConnectorPlugin.CONNECTOR_KIND, repository |
.getRepositoryUrl(), ttitem.getGenericItem().getValue() |
.getItemName().getValue() |
+ " [" |
+ ttitem.getGenericItem().getValue().getItemID() |
.getValue() + "]"); |
initializeTaskData(repository, data, null, monitor); |
String fieldlist = ""; |
if (repository |
.hasProperty(SBMRepositorySettingsPage.STRING_TABLEFIELDLIST)) { |
fieldlist = repository |
.getProperty(SBMRepositorySettingsPage.STRING_TABLEFIELDLIST); |
} |
// Create Fields for all the generic SBM (system) fields |
for (SBMTicketAttribute f : SBMTicketAttribute.values()) { |
TaskAttribute attr; |
monitor.subTask("Creating generic SBM fields..."); |
for (SBMSystemFields sysfield : SBMSystemFields.values()) { |
if(!sysfield.hasTaskAttribute()) { |
// skip the field here, because we do not have a |
// matching task attribute to map. The field |
// will be processed in the custom field section |
continue; |
} |
if (!fieldlist.contains("," + sysfield.getValue() + ",")) { |
// do not process custom field when it has not |
// been selected by user in repository settings page |
continue; |
} |
// try to initialize the SBM attribute |
SBMTicketAttribute f = null; |
TaskAttribute attr = null; |
try { |
f = SBMTicketAttribute.valueOf(sysfield.getValue()); |
} catch (IllegalArgumentException e) { |
// the field is a valid sbm system field and is set up to |
// have an equivalent in the task attributes. It must have an |
// entry in the SBMTicketAttribute class ! |
continue; // we just skip the field |
} |
if(f.getTaskName()!=null) { |
attr = data.getRoot().createMappedAttribute(f.getTaskName()); |
} else { |
attr = data.getRoot().createAttribute(f.getSBMName()); |
// again the field is set up to have an task attribute |
// equivalent, but it is not set up in SBMAttributes correctly |
continue; |
} |
try { |
SBMStaticFields.valueOf(f.getSBMName()); //check if in static field list |
attr.getMetaData().setReadOnly(true); |
} catch (IllegalArgumentException e) { |
attr.getMetaData().setReadOnly(false); |
} |
attr.getMetaData().setType(f.getTaskType()); |
attr.getMetaData().setLabel(client.getFieldLabel(ttitem, f.getSBMName())); |
attr.getMetaData().setReadOnly(true); //we do not support writing yet |
attr.getMetaData().setType(f.getTaskType()); // set the mapped field type |
attr.getMetaData().setLabel(client.getFieldLabel(ttitem, f.getSBMName())); // get and set the field label |
if(f.isVisible()) { |
// field is not hidden, display it by setting KIND_DEFAULT |
attr.getMetaData().setKind(TaskAttribute.KIND_DEFAULT); |
} else { |
// field is hidden |
attr.getMetaData().setKind(null); |
} |
attr.setValue(client.getStaticFieldValue(ttitem, f.getSBMName())); |
attr.setValue(client.getStaticFieldValue(ttitem, f.getSBMName())); // get and set the field value |
} |
monitor.worked(1); |
//-------------- |
//Custom fields |
List<SBMField> customfields = client.getFields(client.getTableName(ttitem)); |
//-------------- |
List<SBMField> customfields = client.getFields(client |
.getTableName(ttitem)); |
for(SBMField f : customfields) { |
if(SBMTicketAttribute.getSBMAttributeBySBMName(f.getName())!=null) { |
if (!fieldlist.contains("," + f.getName() + ",")) { |
// do not process custom field when it has not |
// been selected by user in repository settings page |
continue; |
} |
try { |
SBMSystemFields sysfield = SBMSystemFields.valueOf(f.getName()); |
if( sysfield.hasTaskAttribute()) { |
// the field has an equivalent in the task attribute |
// mappings and therefore it can be skipped in the custom |
// fields section |
continue; |
} |
} catch (IllegalArgumentException e) { |
//field is not a system field, do nothing |
} |
monitor.subTask("Read custom field [" + f.getName() + "]"); |
TaskAttribute custom = data.getRoot().createAttribute(f.getName()); |
custom.getMetaData().setType( |
new SBMTicketAttributeMapper(repository).mapToTaskKey(f.getType())); |
new SBMTicketAttributeMapper(repository).mapToTaskKey(f |
.getType())); |
custom.getMetaData().setLabel(f.getLabel()); |
custom.getMetaData().setKind(TaskAttribute.KIND_DEFAULT); |
custom.getMetaData().setReadOnly(true); |
if(f.getType()==SBMFieldTypes.SELECTION && |
client.getFieldValue(ttitem, f.getName())!=null) { |
String val = client.getFieldValue(ttitem, f.getName()).getValue(); |
custom.putOption(val, val); |
//set value/ values depending on field type |
// single selection |
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.setValue(val); |
// Multi-Type fields |
} else if(f.getType()==SBMFieldTypes.MULTIPLE_SELECTION |
|| f.getType()==SBMFieldTypes.MULTIPLE_RELATIONAL |
|| f.getType()==SBMFieldTypes.MULTIPLE_GROUP |
|| f.getType()==SBMFieldTypes.MULTIPLE_USERGROUP) { |
List<SBMFieldValue> values = client.getFieldValues(ttitem, f.getName()); |
List<SBMFieldValue> values = client.getFieldValues(ttitem, f |
.getName()); |
for(SBMFieldValue val : values) { |
custom.putOption(val.getInternalValue(), val.getValue()); |
custom.addValue(val.getValue()); |
} |
//Date fields |
} else if (f.getType() == SBMFieldTypes.DATETIME) { |
String datestring = client.getFieldValue(ttitem, f.getName()).getValue(); |
long timestamp; |
try { |
timestamp = DatatypeFactory.newInstance().newXMLGregorianCalendar(datestring).toGregorianCalendar().getTimeInMillis(); |
custom.setValue(String.valueOf(timestamp)); |
} catch (DatatypeConfigurationException e) { |
// TODO Auto-generated catch block |
e.printStackTrace(); |
} catch (IllegalArgumentException e) { |
//date field is probably empty |
custom.setValue(""); |
} |
// any other field type |
} else if(client.getFieldValue(ttitem, f.getName())!=null) { |
custom.setValue(client.getFieldValue(ttitem, f.getName()).getValue()); |
custom.setValue(client.getFieldValue(ttitem, f.getName()) |
.getValue()); |
} |
} |
monitor.worked(1); |
// ---------- |
//Notes |
// ---------- |
monitor.subTask("Read notes."); |
for(SBMNote n : client.getNotes(ttitem)) { |
TaskCommentMapper mapper = new TaskCommentMapper(); |
mapper.setCommentId(n.getId()); |
195,9 → 285,11 |
mapper.setText(n.getText()); |
mapper.setCreationDate(n.getCreation()); |
TaskAttribute a = data.getRoot().createAttribute("NOTE"+n.getId()); |
TaskAttribute a = data.getRoot() |
.createAttribute("NOTE" + n.getId()); |
mapper.applyTo(a); |
} |
monitor.worked(1); |
data.setPartial(false); |
return data; |
/sbm4mylyn/branches/V2009R2-maintenance/src/net/brutex/mylyn/sbmconnector/core/model/SBMSystemFields.java |
---|
0,0 → 1,120 |
/* |
* Mylyn Connector for Serena Business Mashups |
* Copyright 2010 Brian Rosenberger (Brutex Network) |
* |
* Licensed under the Apache License, Version 2.0 (the "License"); |
* you may not use this file except in compliance with the License. |
* You may obtain a copy of the License at |
* |
* http://www.apache.org/licenses/LICENSE-2.0 |
* |
* Unless required by applicable law or agreed to in writing, software |
* distributed under the License is distributed on an "AS IS" BASIS, |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
* See the License for the specific language governing permissions and |
* limitations under the License. |
* |
* Serena, TeamTrack and Serena Business Mashup are |
* registered trademarks of SERENA Software Inc. |
*/ |
package net.brutex.mylyn.sbmconnector.core.model; |
/** |
* System DBFieldnames for SBM/ TeamTrack. |
* |
* @author Brian Rosenberger |
*/ |
public enum SBMSystemFields { |
/** The internal item id in [tableid:recordid] format. */ |
ID("ID", true), |
/** The internal uuid. */ |
UUID("UUID", false), |
/** Whether the item is active or inactive in its current state */ |
ACTIVEINACTIVE("ACTIVEINACTIVE", false), |
/** The date that the item was closed */ |
CLOSEDATE("CLOSEDATE", true), |
/** Used for Partner Access to CRs They Submit */ |
COMPANY("COMPANY", false), |
/** Used for Partner Access to CRs They Submit */ |
CONTACT("CONTACT", false), |
/** Detailed information about the item */ |
DESCRIPTION("DESCRIPTION", true), |
/** The displayed identifier of the item */ |
ISSUEID("ISSUEID", true), |
/** The type of the item */ |
ISSUETYPE("ISSUETYPE", true), |
/** The last time the item's data was changed */ |
LASTMODIFIEDDATE("LASTMODIFIEDDATE", true), |
/** The last person to change the data in this item */ |
LASTMODIFIER("LASTMODIFIER", true), |
/** The last time the state of this item was changed */ |
LASTSTATECHANGEDATE("LASTSTATECHANGEDATE", false), |
/** The last person to change the state of this item */ |
LASTSTATECHANGER("LASTSTATECHANGER", false), |
/** The primary person who currently owns the item */ |
OWNER("OWNER", false), |
/** The project in which this item resides */ |
PROJECTID("PROJECTID", false), |
/** Detailed information about the resolution */ |
RESOLUTIONDESC("RESOLUTIONDESC", false), |
/** Summary description of the resolution */ |
RESOLUTIONSUMMARY("RESOLUTIONSUMMARY", false), |
/** The secondary people who currently own the item */ |
SECONDARYOWNER("SECONDARYOWNER", false), |
/** The current state of the item */ |
STATE("STATE", true), |
/** The date that the item was created/submitted */ |
SUBMITDATE("SUBMITDATE", true), |
/** The person who created/submitted the item */ |
SUBMITTER("SUBMITTER", true), |
/** Summary description of the item */ |
TITLE("TITLE", true); |
private final String value; |
private final boolean hasTaskAttribute; |
SBMSystemFields(String v, boolean hasTaskAttribute) { |
value = v; |
this.hasTaskAttribute = hasTaskAttribute; |
} |
public String getValue() { |
return value; |
} |
public boolean hasTaskAttribute() { |
return this.hasTaskAttribute; |
} |
public static SBMSystemFields fromValue(String v) { |
for (SBMSystemFields c: SBMSystemFields.values()) { |
if (c.value.equals(v)) { |
return c; |
} |
} |
throw new IllegalArgumentException(v); |
} |
} |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/sbm4mylyn/branches/V2009R2-maintenance/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/branches/V2009R2-maintenance/src/net/brutex/mylyn/sbmconnector/ui/SBMRepositorySettingsPage.java |
---|
19,30 → 19,171 |
*/ |
package net.brutex.mylyn.sbmconnector.ui; |
import java.util.List; |
import net.brutex.mylyn.sbmconnector.SBMConnectorPlugin; |
import net.brutex.mylyn.sbmconnector.core.SBMClient; |
import net.brutex.mylyn.sbmconnector.core.SBMRepositoryConnector; |
import net.brutex.mylyn.sbmconnector.core.model.SBMField; |
import net.brutex.mylyn.sbmconnector.core.model.SBMSystemFields; |
import org.eclipse.core.runtime.CoreException; |
import org.eclipse.core.runtime.IProgressMonitor; |
import org.eclipse.jface.dialogs.IMessageProvider; |
import org.eclipse.mylyn.tasks.core.TaskRepository; |
import org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositorySettingsPage; |
import org.eclipse.swt.SWT; |
import org.eclipse.swt.layout.GridData; |
import org.eclipse.swt.layout.GridLayout; |
import org.eclipse.swt.widgets.Combo; |
import org.eclipse.swt.widgets.Composite; |
import org.eclipse.swt.widgets.Event; |
import org.eclipse.swt.widgets.Label; |
import org.eclipse.swt.widgets.Listener; |
import org.eclipse.swt.widgets.Table; |
import org.eclipse.swt.widgets.TableColumn; |
import org.eclipse.swt.widgets.TableItem; |
import org.eclipse.ui.forms.widgets.ExpandableComposite; |
import org.eclipse.ui.forms.widgets.FormToolkit; |
public class SBMRepositorySettingsPage extends AbstractRepositorySettingsPage { |
private Combo table; |
private Table list; |
private String solutionTable = ""; |
private String solutionTableList = ""; |
private String tableFieldList = ""; |
private String tableFullFieldList = ""; |
public static final String STRING_SOLUTIONTABLE = "solutionTable"; |
public static final String STRING_SOLUTIONTABLELIST = "solutionTableList"; |
public static final String STRING_TABLEFIELDLIST = "tableFieldList"; |
public static final String STRING_TABLEFULLFIELDLIST = "tableFullFieldList"; |
public SBMRepositorySettingsPage(String title, String description, |
TaskRepository taskRepository) { |
super(title, description, taskRepository); |
// TODO Auto-generated constructor stub |
setNeedsAdvanced(false); |
setNeedsValidation(true); |
setNeedsEncoding(false); |
// initialize table and table list if not null |
if (taskRepository.hasProperty(STRING_SOLUTIONTABLE)) { |
this.solutionTable = taskRepository |
.getProperty(STRING_SOLUTIONTABLE); |
} |
if (taskRepository.hasProperty(STRING_SOLUTIONTABLELIST)) { |
this.solutionTableList = taskRepository |
.getProperty(STRING_SOLUTIONTABLELIST); |
} |
if (taskRepository.hasProperty(STRING_TABLEFIELDLIST)) { |
this.tableFieldList = taskRepository |
.getProperty(STRING_TABLEFIELDLIST); |
} |
if (taskRepository.hasProperty(STRING_TABLEFULLFIELDLIST)) { |
this.tableFullFieldList = taskRepository |
.getProperty(STRING_TABLEFULLFIELDLIST); |
} |
} |
@Override |
protected void createAdditionalControls(Composite parent) { |
// TODO Auto-generated method stub |
public void applyTo(TaskRepository repository) { |
super.applyTo(repository); |
if (!solutionTable.isEmpty()) { |
repository.setProperty(STRING_SOLUTIONTABLE, solutionTable); |
repository.setProperty(STRING_SOLUTIONTABLELIST, solutionTableList); |
String fieldlist = ","; |
String fullfieldlist = ","; |
for (TableItem t : list.getItems()) { |
if (t.getChecked()) |
fieldlist = fieldlist + t.getText(2) + ","; |
fullfieldlist = fullfieldlist + t.getText(2) + ","; |
} |
repository.setProperty(STRING_TABLEFIELDLIST, fieldlist); |
repository.setProperty(STRING_TABLEFULLFIELDLIST, fullfieldlist); |
} |
} |
@Override |
public boolean isPageComplete() { |
if (table != null |
&& table.getText().length() > 4 |
&& getUserName() != null |
&& getUserName().length() > 0) { |
return true; |
} |
return false; |
} |
@Override |
protected void createContributionControls(Composite parentControl) { |
ExpandableComposite expander = createSection(parentControl, |
"Mashup application"); |
FormToolkit toolkit = new FormToolkit(parentControl.getDisplay()); |
Composite control = toolkit.createComposite(expander, SWT.NONE); |
GridLayout gridLayout = new GridLayout(); |
gridLayout.numColumns = 2; |
gridLayout.verticalSpacing = 5; |
gridLayout.marginWidth = 0; |
control.setLayout(gridLayout); |
control.setBackground(parentControl.getBackground()); |
Label label = new Label(control, SWT.NONE); |
label.setText("Table:"); |
table = new Combo(control, SWT.SINGLE | SWT.BORDER); |
Label label_list = new Label(control, SWT.NONE | SWT.TOP); |
label_list.setText("Fields:"); |
list = new Table(control, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL |
| SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.CHECK); |
list.setLinesVisible(true); |
list.setHeaderVisible(true); |
GridData data = new GridData(SWT.FILL, SWT.FILL, true, true); |
data.heightHint = 200; |
list.setLayoutData(data); |
String[] titles = { " ", "Display Name", "DBName", "Type" }; |
for (int i = 0; i < titles.length; i++) { |
TableColumn column = new TableColumn(list, SWT.NONE); |
column.setText(titles[i]); |
} |
list.addListener(SWT.Selection, new Listener() { |
@Override |
public void handleEvent(Event event) { |
//avoid that a system field may be unchecked |
try { |
SBMSystemFields |
.valueOf(((TableItem) event.item).getText(2)); |
((TableItem) event.item).setChecked(true); |
} catch (IllegalArgumentException e) { |
// do nothing |
} |
} |
}); |
table.addListener(SWT.Selection, new Listener() { |
@Override |
public void handleEvent(Event arg0) { |
// when the table has been changed |
// try to re-read the field list |
tableFieldList = ""; |
tableFullFieldList = ""; |
try { |
SBMField[] fields = SBMRepositoryConnector.getClient( |
createTaskRepository()).getFields(table.getText()) |
.toArray(new SBMField[0]); |
fillList(list, fields); |
} catch (Exception e) { } |
if (getWizard() != null) { |
solutionTable = table.getText(); |
getWizard().getContainer().updateButtons(); |
} |
} |
}); |
regenerateTables(); |
expander.setClient(control); |
} |
@Override |
public String getConnectorKind() { |
return SBMConnectorPlugin.CONNECTOR_KIND; |
} |
54,7 → 195,8 |
@Override |
protected boolean isValidUrl(String url) { |
if(url.contains("<server>")) return false; |
if (url.contains("<server>")) |
return false; |
return true; |
} |
61,11 → 203,41 |
@Override |
protected void applyValidatorResult(Validator validator) { |
if (((SBMConnectionValidator) validator).getResult() != null) { |
getContainer().updateButtons(); |
setMessage("Validate first!", IMessageProvider.ERROR); |
setNeedsValidation(true); |
} else { |
regenerateTables(); |
} |
super.applyValidatorResult(validator); |
} |
private void regenerateTables() { |
try { |
List<String> tables = SBMRepositoryConnector.getClient( |
createTaskRepository()).getPrimaryTables(); |
for (String table_name : tables) { |
table.add(table_name); |
if (solutionTable.equals(table_name)) { |
table.setText(table_name); |
} |
} |
} catch (Exception e) { |
// it was not possible to read the list of tables |
// from the server, so just restore saved settings |
table.add(solutionTable); |
table.setText(solutionTable); |
} |
try { |
SBMField[] fields = SBMRepositoryConnector.getClient( |
createTaskRepository()).getFields(table.getText()).toArray( |
new SBMField[0]); |
fillList(list, fields); |
} catch (Exception e) { |
// it was not possible to read the fields for the given table |
// do nothing |
} |
} |
protected class SBMConnectionValidator extends Validator { |
private TaskRepository repository; |
private String result = null; |
76,16 → 248,53 |
@Override |
public void run(IProgressMonitor monitor) throws CoreException { |
monitor.beginTask("Prüfe Verbindung", IProgressMonitor.UNKNOWN); |
monitor.beginTask("Prüfe Verbindung", IProgressMonitor.UNKNOWN); |
SBMClient client = new SBMClient(repository); |
if(!client.canAuthenticate()) { |
result = "Verbindung fehlgeschlagen"; |
} else { |
result = null; |
} |
result = "Verbindung erfolgreich"; |
monitor.done(); |
} |
public String getResult() { return result; } |
public String getResult() { |
return result; |
} |
} |
private void fillList(Table list, SBMField[] fields) { |
list.removeAll(); |
for (int i = 0; i < fields.length; i++) { |
TableItem item = new TableItem(list, 0); |
item.setText(0, ""); |
item.setText(1, fields[i].getLabel()); |
item.setText(2, fields[i].getName()); |
item.setText(3, fields[i].getType().getValue().replaceFirst( |
"FLDTYPE-", "")); |
try { |
// auto-select all system fields |
SBMSystemFields.valueOf(fields[i].getName()); |
item.setChecked(true); |
} catch (IllegalArgumentException e) { |
// do nothing |
} |
if (tableFieldList.contains(","+fields[i].getName()+",")) { |
// item has been checked before |
// so check it |
item.setChecked(true); |
} |
} |
for (TableColumn c : list.getColumns()) { |
c.pack(); |
} |
} |
@Override |
protected void createAdditionalControls(Composite arg0) { |
// TODO Auto-generated method stub |
} |
} |
/sbm4mylyn/branches/V2009R2-maintenance/src/net/brutex/mylyn/sbmconnector/ui/SBMRepositoryQueryPage.java |
---|
19,7 → 19,13 |
*/ |
package net.brutex.mylyn.sbmconnector.ui; |
import java.awt.Color; |
import java.util.ArrayList; |
import net.brutex.mylyn.sbmconnector.core.SBMRepositoryConnector; |
import net.brutex.mylyn.sbmconnector.core.model.SBMField; |
import net.brutex.mylyn.sbmconnector.core.model.SBMSystemFields; |
import net.brutex.sbm.wsclient.ReportInfo; |
import org.eclipse.jface.dialogs.Dialog; |
import org.eclipse.jface.layout.GridDataFactory; |
27,19 → 33,37 |
import org.eclipse.mylyn.tasks.core.TaskRepository; |
import org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositoryQueryPage; |
import org.eclipse.swt.SWT; |
import org.eclipse.swt.events.SelectionEvent; |
import org.eclipse.swt.events.SelectionListener; |
import org.eclipse.swt.layout.GridData; |
import org.eclipse.swt.layout.GridLayout; |
import org.eclipse.swt.widgets.Combo; |
import org.eclipse.swt.widgets.Composite; |
import org.eclipse.swt.widgets.Display; |
import org.eclipse.swt.widgets.Event; |
import org.eclipse.swt.widgets.Label; |
import org.eclipse.swt.widgets.List; |
import org.eclipse.swt.widgets.Listener; |
import org.eclipse.swt.widgets.Table; |
import org.eclipse.swt.widgets.TableColumn; |
import org.eclipse.swt.widgets.TableItem; |
import org.eclipse.swt.widgets.Text; |
import org.eclipse.swt.widgets.Widget; |
import org.eclipse.ui.forms.widgets.ExpandableComposite; |
import org.eclipse.ui.forms.widgets.FormToolkit; |
public class SBMRepositoryQueryPage extends AbstractRepositoryQueryPage { |
private Combo table = null; |
private Text sql_where_clause = null; |
private Text query_title = null; |
private Combo reportcombo = null; |
private ReportInfo selectedReport = null; |
public static String SQL_QUERY = "sql_where"; |
public static String SQL_QUERY_NAME = "name"; |
public static String REPORT = "report"; |
public static String REPORT_OR_QUERY = "-- use query --"; |
public SBMRepositoryQueryPage(String pageName, TaskRepository repository, |
IRepositoryQuery query) { |
super(pageName, repository, query); |
52,15 → 76,15 |
if (getQueryTitle() != null) { |
query.setSummary(getQueryTitle()); |
} |
query.setAttribute("table", table.getText()); |
query.setAttribute("sql_where", sql_where_clause.getText()); |
query.setAttribute("name", query_title.getText()); |
query.setAttribute(SQL_QUERY, sql_where_clause.getText()); |
query.setAttribute(SQL_QUERY_NAME, query_title.getText()); |
query.setAttribute(REPORT, selectedReport.getReportUUID()); |
} |
@Override |
public String getQueryTitle() { |
if(query_title!=null && !query_title.getText().isEmpty()) return query_title.getText(); |
if (query_title != null && !query_title.getText().isEmpty()) |
return query_title.getText(); |
return "new query"; |
} |
68,38 → 92,93 |
public void createControl(Composite arg0) { |
Composite control = new Composite(arg0,SWT.BORDER); |
control.setLayout(new GridLayout(2, false)); |
Label report_label = new Label(control, SWT.NONE); |
reportcombo = new Combo(control, SWT.SINGLE | SWT.BORDER); |
new Label(control, SWT.NONE).setText(" OR "); |
new Label(control, SWT.SEPARATOR | SWT.HORIZONTAL); |
Label query_label = new Label(control, SWT.NONE); |
query_label.setText("Query Name:"); |
query_title = new Text(control, SWT.BORDER); |
if(getQuery()!=null) query_title.setText(getQuery().getAttribute("name")); |
Label label = new Label(control, SWT.NONE); |
label.setText("Table:"); |
report_label.setText("Report"); |
table = new Combo(control, SWT.SINGLE | SWT.BORDER); |
for(String table_name : SBMRepositoryConnector.getClient(getTaskRepository()).getPrimaryTables()) { |
table.add(table_name); |
if(getQuery()!=null && getQuery().getAttribute("table").equals(table_name)) { |
table.setText(table_name); |
String solutionname = getTaskRepository().getProperty( |
SBMRepositorySettingsPage.STRING_SOLUTIONTABLE); |
try { |
final java.util.List<ReportInfo> reportlist = SBMRepositoryConnector |
.getClient(getTaskRepository()).getReportList(solutionname); |
reportcombo.add(REPORT_OR_QUERY); |
reportcombo.select(0); |
for (ReportInfo report : reportlist) { |
reportcombo.add(report.getReportName()); |
} |
reportcombo.addListener(SWT.Selection, new Listener() { |
@Override |
public void handleEvent(Event arg0) { |
if (reportcombo.getSelectionIndex() == 0) { |
query_title.setEditable(true); |
query_title.setEnabled(true); |
sql_where_clause.setEditable(true); |
sql_where_clause.setEnabled(true); |
query_title.setText(""); |
} else { |
query_title.setEditable(false); |
query_title.setEnabled(false); |
sql_where_clause.setEditable(false); |
sql_where_clause.setEnabled(false); |
query_title.setText(reportcombo.getText()); |
selectedReport = reportlist.get(reportcombo |
.getSelectionIndex() - 1); |
} |
} |
}); |
} catch (Exception e) { |
} |
/* |
* |
* |
* table.addListener(SWT.Selection, new Listener() { |
* |
* @Override public void handleEvent(Event arg0) { // when the table has |
* been changed // try to re-read the field list tableFieldList = ""; |
* tableFullFieldList = ""; try { SBMField[] fields = |
* SBMRepositoryConnector.getClient( |
* createTaskRepository()).getFields(table.getText()) .toArray(new |
* SBMField[0]); fillList(list, fields); } catch (Exception e) { } if |
* (getWizard() != null) { solutionTable = table.getText(); |
* getWizard().getContainer().updateButtons(); } } |
* |
* }); regenerateTables(); expander.setClient(control); |
*/ |
query_title = new Text(control, SWT.BORDER); |
if (getQuery() != null) |
query_title.setText(getQuery().getAttribute("name")); |
sql_where_clause = new Text(control, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL | SWT.BORDER); |
GridData data = new GridData(SWT.FILL, SWT.FILL, true, true); |
data.heightHint = 200; |
Label label_sql = new Label(control, SWT.NONE); |
label_sql.setText("SQL where:"); |
sql_where_clause = new Text(control, SWT.MULTI | SWT.WRAP |
| SWT.V_SCROLL | SWT.BORDER); |
GridData gd = new GridData(300, 150); |
gd.horizontalSpan = 2; |
sql_where_clause.setLayoutData(gd); |
if(getQuery()!=null) sql_where_clause.setText(getQuery().getAttribute("sql_where")); |
if (getQuery() != null) |
sql_where_clause.setText(getQuery().getAttribute("sql_where")); |
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).applyTo(table); |
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).applyTo(query_title); |
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP) |
.applyTo(query_title); |
Dialog.applyDialogFont(control); |
setControl(control); |
} |
} |
/sbm4mylyn/branches/V2009R2-maintenance/src/net/brutex/mylyn/sbmconnector/SBMConnectorPlugin.java |
---|
22,11 → 22,32 |
import org.eclipse.core.runtime.Plugin; |
/** |
* The Class SBMConnectorPlugin provides the Mylyn connector for Serena Business |
* Mashups 2009 SBM2009) plugin. |
*/ |
public class SBMConnectorPlugin extends Plugin { |
private static SBMConnectorPlugin INSTANCE; |
/** Short SBM version string/ technical identifier. */ |
public final static String CONNECTOR_KIND = "SBM2009R2.00"; |
/** Full SBM name and version. */ |
public final static String DESCRIPTION = "Serena Business Mashups 2009 R2"; |
/** SBM name without version information */ |
public final static String LABEL = "Serena Business Mashups"; |
/** Full, descriptive identifier of this plugin. */ |
public final static String PLUGIN_ID = "Brutex Network - Mylyn Connector for SBM"; |
public SBMConnectorPlugin() { |
super(); |
INSTANCE = this; |
} |
public static SBMConnectorPlugin getDefault() { |
return INSTANCE; |
} |
} |
/sbm4mylyn/branches/V2009R2-maintenance/src/net/brutex/mylyn/sbmconnector/package.html |
---|
1,7 → 1,13 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
<html> |
<head></head> |
<head>Mylyn connector for Serena Business Mashups</head> |
<body> |
Provides... |
This eclipse plugin provides a connector for Serena Business Mashups 2009, so that it can be used |
in conjunction with Mylyn. Currently only SBM2009R1/ SBM2009R2 and Mylyn 3.3 on Eclipse 3.4 and |
Eclipse 3.5 are supported.<br></br> |
<i>Please note that Serena and Serena Business Mashups are registered trademarks of |
SERENA Software Inc.</i> |
<br></br> |
This project has not been initiated, lead or supported by Serena. |
</body> |
</html> |
/sbm4mylyn/branches/V2009R2-maintenance/plugin.xml |
---|
1,6 → 1,7 |
<?xml version="1.0" encoding="UTF-8"?> |
<?eclipse version="3.4"?> |
<plugin> |
<extension-point id="org.eclipse.mylyn.tasks.ui.repositories" name="SBMRepositoryConnector" schema="schema/org.eclipse.mylyn.tasks.ui.repositories.exsd"/> |
<extension |
point="org.eclipse.mylyn.tasks.ui.repositories"> |
<connectorCore |