Subversion Repositories XServices

Compare Revisions

No changes between revisions

Ignore whitespace Rev 29 → Rev 30

/sbm4mylyn/trunk/src/net/brutex/mylyn/sbmconnector/core/model/SBMStaticFields.java
0,0 → 1,101
/*
* 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;
 
/**
* Static DBFieldnames for SBM/ TeamTrack system fields
* which are not intended to be changed by a user directly
* (auto-resolved by the system).
*
* @author Brian Rosenberger
*/
public enum SBMStaticFields {
/** The internal item id in [tableid:recordid] format. */
ID("ID"),
/** The internal uuid. */
UUID("UUID"),
/** The Constant ISSUEID. */
ISSUEID("ISSUEID"),
/** The project name (integer in DB, but name here).
* because this is driven by the sbm web service */
PROJECTID("PROJECTID"),
/** The project uuid (not found in primary table). */
PROJECTUUID("PROJECTUUID"),
/** The submitter (id reference, but user login name here). */
SUBMITTER("SUBMITTER"),
/** The submit date/time. */
SUBMITDATE("SUBMITDATE"),
 
/** The LASTMODIFIEDDATE date/time. */
LASTMODIFIEDDATE("LASTMODIFIEDDATE"),
/** The LASTMODIFIER. */
LASTMODIFIER("LASTMODIFIER"),
 
/** The ACTIVEINACTIVE flag.*/
ACTIVEINACTIVE("ACTIVEINACTIVE"),
/** The Constant STATE. */
STATE("STATE"),
/** The ITEMURL (not present in DB) */
ITEMURL("ITEMURL"),
/** The owner of an item (id reference, but name here). */
OWNER("OWNER"),
/** The LASTSTATECHANGEDATE. */
LASTSTATECHANGEDATE("LASTSTATECHANGEDATE"),
/** The LASTSTATECHANGER (id reference, but name here). */
LASTSTATECHANGER("LASTSTATECHANGER"),
/** The SECONDARYOWNER (id reference, but name here). */
SECONDARYOWNER("SECONDARYOWNER"),
/** The CLOSEDATE. */
CLOSEDATE("CLOSEDATE");
private final String value;
 
SBMStaticFields(String v) {
value = v;
}
public String getValue() {
return value;
}
 
public static SBMStaticFields fromValue(String v) {
for (SBMStaticFields c: SBMStaticFields.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/trunk/src/net/brutex/mylyn/sbmconnector/core/model/SBMNote.java
0,0 → 1,69
/*
* 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;
 
import java.util.Date;
 
public class SBMNote {
 
private String author;
private String text;
private Date creation;
private String id;
public SBMNote(String author, String text, Date creation, String id) {
this.author = author;
this.text = text;
this.creation = creation;
this.id = id;
}
 
public String getAuthor() {
return author;
}
 
public void setAuthor(String author) {
this.author = author;
}
 
public String getText() {
return text;
}
 
public void setText(String text) {
this.text = text;
}
 
public Date getCreation() {
return creation;
}
 
public void setCreation(Date creation) {
this.creation = creation;
}
 
public String getId() {
return id;
}
 
public void setId(String id) {
this.id = id;
}
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/sbm4mylyn/trunk/src/net/brutex/mylyn/sbmconnector/core/model/SBMFieldTypes.java
0,0 → 1,63
/*
* 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;
 
public enum SBMFieldTypes {
UNKNOWN("UNKNOWN"),
NUMERIC("NUMERIC"),
TEXT("TEXT"),
DATETIME("DATETIME"),
SELECTION("SELECTION"),
BINARY("BINARY"),
STATE("STATE"),
USER("USER"),
PROJECT("PROJECT"),
SUMMATION("SUMMATION"),
MULTIPLE_SELECTION("MULTIPLE-SELECTION"),
CONTACT("CONTACT"),
INCIDENT("INCIDENT"),
FOLDER("FOLDER"),
RELATIONAL("RELATIONAL"),
SUBRELATIONAL("SUBRELATIONAL"),
SYSTEM("SYSTEM"),
MULTIPLE_RELATIONAL("MULTIPLE-RELATIONAL"),
MULTIPLE_GROUP("MULTIPLE-GROUP"),
MULTIPLE_USERGROUP("MULTIPLE-USERGROUP");
 
private final String value;
 
SBMFieldTypes(String v) {
value = v;
}
public String getValue() {
return value;
}
 
public static SBMFieldTypes fromValue(String v) {
for (SBMFieldTypes c: SBMFieldTypes.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/trunk/src/net/brutex/mylyn/sbmconnector/core/model/SBMFieldAttributes.java
0,0 → 1,46
/*
* 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;
 
public enum SBMFieldAttributes {
READ_ONLY("read-only"),
REQUIRED("required"),
HIDDEN("hidden");
private final String value;
 
SBMFieldAttributes(String v) {
value = v;
}
public String getValue() {
return value;
}
 
public static SBMFieldAttributes fromValue(String v) {
for (SBMFieldAttributes c: SBMFieldAttributes.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/trunk/src/net/brutex/mylyn/sbmconnector/core/model/package.html
0,0 → 1,7
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head></head>
<body>
Provides...
</body>
</html>
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/sbm4mylyn/trunk/src/net/brutex/mylyn/sbmconnector/core/SBMClient.java
0,0 → 1,293
/*
* 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;
 
import java.math.BigInteger;
import java.net.URL;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.StringTokenizer;
 
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
 
import net.brutex.mylyn.sbmconnector.SBMConnectorPlugin;
import net.brutex.mylyn.sbmconnector.core.model.SBMNote;
import net.brutex.mylyn.sbmconnector.core.model.SBMStaticFields;
import net.brutex.sbm.wsclient.AEWebservicesFaultFault;
import net.brutex.sbm.wsclient.Aewebservices71;
import net.brutex.sbm.wsclient.Aewebservices71PortType;
import net.brutex.sbm.wsclient.Auth;
import net.brutex.sbm.wsclient.Field;
import net.brutex.sbm.wsclient.NameValue;
import net.brutex.sbm.wsclient.Note;
import net.brutex.sbm.wsclient.ObjectFactory;
import net.brutex.sbm.wsclient.TTItem;
import net.brutex.sbm.wsclient.TableData;
import net.brutex.sbm.wsclient.TableType;
 
import org.eclipse.core.runtime.CoreException;
import org.eclipse.mylyn.commons.net.AuthenticationCredentials;
import org.eclipse.mylyn.commons.net.AuthenticationType;
import org.eclipse.mylyn.tasks.core.RepositoryStatus;
import org.eclipse.mylyn.tasks.core.TaskRepository;
 
public class SBMClient {
 
private Aewebservices71PortType port;
private static final QName SERVICE_NAME = new QName("http://localhost:80/gsoap/aewebservices71.wsdl", "aewebservices71");
private TaskRepository repository;
private ObjectFactory of;
private List<TableData> tables = new ArrayList<TableData>();
public SBMClient(TaskRepository repository) {
this.repository = repository;
this.of = new ObjectFactory();
URL wsdlURL = Aewebservices71.WSDL_LOCATION;
wsdlURL = this.getClass().getResource("/META-INF/aewebservices71.wsdl");
Aewebservices71 ss = new Aewebservices71(wsdlURL, SERVICE_NAME);
port = ss.getAewebservices71();
((BindingProvider)port).getRequestContext().put(
BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
repository.getRepositoryUrl());
}
public boolean canAuthenticate() throws CoreException {
try {
port.getUser(getAuth(), repository.getCredentials(AuthenticationType.REPOSITORY).getUserName());
} catch (AEWebservicesFaultFault e) {
new CoreException(RepositoryStatus.createLoginError(
repository.getRepositoryUrl(), SBMConnectorPlugin.PLUGIN_ID));
return false;
}
return true;
}
public List<TTItem> getTTItemsByTable(String tablename, String sql_where) throws CoreException {
List<TTItem> list = new ArrayList<TTItem>();
if(sql_where==null || sql_where.isEmpty()) sql_where = "TS_ID>0";
try {
list = port.getItemsByQueryWithName(
getAuth(),
tablename,
"("+sql_where+")",
"TS_SUBMITDATE desc",
BigInteger.valueOf(500l), null);
} catch (AEWebservicesFaultFault e) {
new CoreException(
RepositoryStatus.createInternalError(
SBMConnectorPlugin.PLUGIN_ID, e.getFaultInfo(), e));
}
return list;
}
public TTItem getTTItem(String itemid) {
TTItem item = of.createTTItem();
try {
item = port.getItem(getAuth(), itemid, null);
} catch (AEWebservicesFaultFault e) {
new CoreException(
RepositoryStatus.createInternalError(
SBMConnectorPlugin.PLUGIN_ID, e.getFaultInfo(), e));
}
return item;
}
 
private Auth getAuth() {
Auth auth = of.createAuth();
AuthenticationCredentials credentials = repository.getCredentials(AuthenticationType.REPOSITORY);
auth.setUserId(of.createAuthUserId(credentials.getUserName()));
auth.setPassword(of.createAuthPassword(credentials.getPassword()));
return auth;
}
 
public String getFieldValue(TTItem ttitem, String fieldname) {
if(fieldname.equals(SBMStaticFields.SUBMITDATE.getValue())) {
Date date = ttitem.getCreateDate().getValue().toGregorianCalendar().getTime();
return String.valueOf(date.getTime());
}
if(fieldname.equals(SBMStaticFields.LASTMODIFIEDDATE.getValue())) {
return String.valueOf(ttitem.getModifiedDate().getValue().toGregorianCalendar().getTimeInMillis());
}
if(fieldname.equals("TITLE")) {
if(ttitem.getTitle()==null || ttitem.getTitle().isNil()) return "";
return ttitem.getTitle().getValue();
}
if(fieldname.equals(SBMStaticFields.ISSUEID.getValue())) {
if(ttitem.getGenericItem()==null || ttitem.getGenericItem().getValue().getItemName()==null) {
return "";
}
return ttitem.getGenericItem().getValue().getItemName().getValue();
}
if(fieldname.equals("ISSUETYPE")) {
if(ttitem.getItemType()==null || ttitem.getItemType().isNil()) return "";
return ttitem.getItemType().getValue();
}
if(fieldname.equals(SBMStaticFields.STATE.getValue())) {
if(ttitem.getState()==null || ttitem.getState().isNil()) return "";
return ttitem.getState().getValue();
}
if(fieldname.equals(SBMStaticFields.ID.getValue())) {
return ttitem.getGenericItem().getValue().getItemID().getValue();
}
if(fieldname.equals(SBMStaticFields.PROJECTID.getValue())) {
if(ttitem.getClassification() ==null || ttitem.getClassification().isNil()) return "";
return ttitem.getClassification().getValue();
}
if(fieldname.equals(SBMStaticFields.PROJECTUUID.getValue())) {
if(ttitem.getClassificationUUID()==null || ttitem.getClassificationUUID().isNil()) return "";
return ttitem.getClassificationUUID().getValue();
}
if(fieldname.equals("DESCRIPTION")) {
if(ttitem.getDescription() == null || ttitem.getDescription().isNil()) return "";
return ttitem.getDescription().getValue();
}
if(fieldname.equals(SBMStaticFields.SUBMITTER.getValue())) {
if(ttitem.getCreatedBy()==null || ttitem.getCreatedBy().isNil()) return "";
return ttitem.getCreatedBy().getValue();
}
if(fieldname.equals(SBMStaticFields.SUBMITDATE.getValue())) {
return String.valueOf(ttitem.getCreateDate().getValue().toGregorianCalendar().getTimeInMillis());
}
if(fieldname.equals(SBMStaticFields.LASTMODIFIER.getValue())) {
if(ttitem.getModifiedBy()==null || ttitem.getModifiedBy().isNil()) return "";
return ttitem.getModifiedBy().getValue();
}
if(fieldname.equals(SBMStaticFields.LASTMODIFIEDDATE.getValue())) {
return String.valueOf(ttitem.getModifiedDate().getValue().toGregorianCalendar().getTimeInMillis());
}
if(fieldname.equals(SBMStaticFields.ACTIVEINACTIVE.getValue())) {
return ttitem.getActiveInactive().getValue();
}
if(fieldname.equals(SBMStaticFields.OWNER.getValue())) {
return ttitem.getOwner().getValue();
}
if(fieldname.equals(SBMStaticFields.ITEMURL.getValue())) {
return ttitem.getUrl().getValue();
}
if(fieldname.equals(SBMStaticFields.UUID.getValue())) {
return ttitem.getGenericItem().getValue().getItemUUID().getValue();
}
if(fieldname.equals(SBMStaticFields.CLOSEDATE.getValue())) {
Iterator<NameValue> list = ttitem.getExtendedFieldList().iterator();
while (list.hasNext()) {
NameValue field = list.next();
if(field.getName().getValue().equals("CLOSEDATE")) {
return field.getValue().getValue().getInternalValue().getValue();
}
}
}
if(fieldname.equals(SBMStaticFields.LASTSTATECHANGEDATE.getValue())) {
Iterator<NameValue> list = ttitem.getExtendedFieldList().iterator();
while (list.hasNext()) {
NameValue field = list.next();
if(field.getName().getValue().equals("LASTSTATECHANGEDATE")) {
return field.getValue().getValue().getInternalValue().getValue();
}
}
}
if(fieldname.equals(SBMStaticFields.SECONDARYOWNER.getValue())) {
Iterator<NameValue> list = ttitem.getExtendedFieldList().iterator();
while (list.hasNext()) {
NameValue field = list.next();
if(field.getName().getValue().equals("SECONDARYOWNER")) {
return field.getValue().getValue().getInternalValue().getValue();
}
}
}
if(fieldname.equals(SBMStaticFields.LASTSTATECHANGER.getValue())) {
Iterator<NameValue> list = ttitem.getExtendedFieldList().iterator();
while (list.hasNext()) {
NameValue field = list.next();
if(field.getName().getValue().equals("LASTSTATECHANGER")) {
return field.getValue().getValue().getDisplayValue().getValue();
}
}
}
 
return "UNKNOWN";
}
//Todo caching
public String getFieldLabel(TTItem ttitem, String fieldname) {
String itemid = ttitem.getGenericItem().getValue().getItemID().getValue();
String tableid = new StringTokenizer(itemid, ":").nextToken();
if (tables.isEmpty()) {
try {
tables = port.getTables(getAuth(), null, TableType.PRIMARY_TABLE);
} catch (AEWebservicesFaultFault e) {
new CoreException(
RepositoryStatus.createInternalError(
SBMConnectorPlugin.PLUGIN_ID, e.getFaultInfo(), e));
}
}
for (TableData table : tables) {
if (String.valueOf(table.getTableID().intValue()).equals(tableid)) {
Iterator<Field> iter = table.getFieldList().iterator();
while(iter.hasNext()) {
Field f = iter.next();
if(f.getName().getValue().equals(fieldname)) {
return f.getDisplayName().getValue();
}
}
break;
}
}
return "label_UNKNOWN";
}
public List<SBMNote> getNotes(TTItem ttitem) {
List<SBMNote> notes = new ArrayList<SBMNote>();
Iterator<Note> iter = ttitem.getNoteList().iterator();
while(iter.hasNext()) {
Note n = iter.next();
SBMNote note = new SBMNote("sbm_user",
n.getTitle().getValue()+"\n"+n.getNote().getValue(),
n.getModificationDateTime().toGregorianCalendar().getTime(),
n.getId().toString());
notes.add(note);
}
return notes;
}
 
public List<String> getPrimaryTables() {
List<String> table_names = new ArrayList<String>();
if (tables.isEmpty()) {
try {
tables = port.getTables(getAuth(), null, TableType.PRIMARY_TABLE);
} catch (AEWebservicesFaultFault e) {
new CoreException(
RepositoryStatus.createInternalError(
SBMConnectorPlugin.PLUGIN_ID, e.getFaultInfo(), e));
}
}
for (TableData table : tables) {
table_names.add(table.getName().getValue());
}
return table_names;
}
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/sbm4mylyn/trunk/src/net/brutex/mylyn/sbmconnector/core/SBMTaskDataCollector.java
0,0 → 1,53
/*
* 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;
 
import java.util.HashSet;
import java.util.Set;
 
import org.eclipse.mylyn.tasks.core.data.TaskData;
import org.eclipse.mylyn.tasks.core.data.TaskDataCollector;
 
public class SBMTaskDataCollector extends TaskDataCollector {
 
 
final Set<TaskData> taskDataCollected = new HashSet<TaskData>();
 
String queryTimestamp = null;
 
@Override
public void accept(TaskData taskData) {
taskDataCollected.add(taskData);
}
 
public Set<TaskData> getTaskData() {
return taskDataCollected;
}
 
public String getQueryTimestamp() {
return queryTimestamp;
}
 
public void setQueryTimestamp(String queryTimestamp) {
this.queryTimestamp = queryTimestamp;
}
}
 
 
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/sbm4mylyn/trunk/src/net/brutex/mylyn/sbmconnector/core/SBMTicket.java
0,0 → 1,35
/*
* 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;
 
 
import org.eclipse.mylyn.tasks.core.data.TaskData;
import org.eclipse.mylyn.tasks.core.data.TaskMapper;
 
 
 
public class SBMTicket extends TaskMapper {
 
 
public SBMTicket(TaskData taskData) {
super(taskData);
 
}
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/sbm4mylyn/trunk/src/net/brutex/mylyn/sbmconnector/core/SBMTicketAttribute.java
0,0 → 1,180
/*
* 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;
 
import net.brutex.mylyn.sbmconnector.core.model.SBMFieldTypes;
import net.brutex.mylyn.sbmconnector.core.model.SBMStaticFields;
 
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
 
 
/**
* Map the Mylyn TaskAttributes to SBMTicket Attributes and vice versa.
* @author Brian Rosenberger
*
*/
public enum SBMTicketAttribute {
DESCRIPTION(
"DESCRIPTION",
"label_description",
SBMFieldTypes.TEXT,
TaskAttribute.DESCRIPTION,
TaskAttribute.TYPE_LONG_RICH_TEXT,
SBMTicketAttribute.HIDDEN), //hidden because has extra part
ID(
SBMStaticFields.ID.getValue(),
"ts_id",
SBMFieldTypes.SYSTEM,
TaskAttribute.TASK_KEY,
TaskAttribute.TYPE_SHORT_TEXT,
SBMTicketAttribute.HIDDEN),
UUID(
SBMStaticFields.UUID.getValue(),
"ts_uuid",
SBMFieldTypes.SYSTEM,
TaskAttribute.KIND_DEFAULT,
TaskAttribute.TYPE_SHORT_TEXT,
SBMTicketAttribute.HIDDEN),
PROJECT(
SBMStaticFields.PROJECTID.getValue(),
"label_project",
SBMFieldTypes.SYSTEM,
TaskAttribute.PRODUCT,
TaskAttribute.TYPE_SHORT_TEXT),
STATE(
SBMStaticFields.STATE.getValue(),
"label_state",
SBMFieldTypes.SYSTEM,
TaskAttribute.STATUS,
TaskAttribute.TYPE_SHORT_TEXT,
SBMTicketAttribute.HIDDEN), //hidden because has extra part
SUBMITTER(
SBMStaticFields.SUBMITTER.getValue(),
"label_submitter",
SBMFieldTypes.USER,
TaskAttribute.USER_REPORTER,
TaskAttribute.TYPE_PERSON),
SUBMITDATE(
SBMStaticFields.SUBMITDATE.getValue(),
"label_submitdate",
SBMFieldTypes.DATETIME,
TaskAttribute.DATE_CREATION,
TaskAttribute.TYPE_DATETIME),
LASTMODIFIER(
SBMStaticFields.LASTMODIFIER.getValue(),
"label_last modifier",
SBMFieldTypes.USER,
TaskAttribute.PERSON_NAME,
TaskAttribute.TYPE_PERSON),
LASTMODIFIEDDATE(
SBMStaticFields.LASTMODIFIEDDATE.getValue(),
"label_modifieddate",
SBMFieldTypes.DATETIME,
TaskAttribute.DATE_MODIFICATION,
TaskAttribute.TYPE_DATETIME),
ITEMURL(
SBMStaticFields.ITEMURL.getValue(),
"Item Link:",
SBMFieldTypes.SYSTEM,
TaskAttribute.TASK_URL,
TaskAttribute.TYPE_URL,
SBMTicketAttribute.HIDDEN),
TITLE(
"TITLE",
"label_title",
SBMFieldTypes.TEXT,
TaskAttribute.SUMMARY,
TaskAttribute.TYPE_SHORT_TEXT,
SBMTicketAttribute.HIDDEN), //hidden because has extra part
ACTIVEINACTIVE(
SBMStaticFields.ACTIVEINACTIVE.getValue(),
"label_activeinactive",
SBMFieldTypes.BINARY,
null,
TaskAttribute.TYPE_BOOLEAN),
ISSUETYPE(
"ISSUETYPE",
"label_itemtype",
SBMFieldTypes.SELECTION,
TaskAttribute.TASK_KIND,
TaskAttribute.TYPE_SHORT_TEXT);
private String sbm_name;
private String task_name;
private String sbm_type;
private String sbm_label;
private String task_type;
private boolean visible;
public static final boolean VISIBLE = true;
public static final boolean HIDDEN = false;
private SBMTicketAttribute(String sbm_name, String sbm_label, SBMFieldTypes sbm_type, String task_name, String task_type) {
this(sbm_name,sbm_label,sbm_type,task_name,task_type, SBMTicketAttribute.VISIBLE);
}
private SBMTicketAttribute(String sbm_name, String sbm_label, SBMFieldTypes sbm_type,
String task_name, String task_type, boolean visible) {
this.sbm_name = sbm_name;
this.sbm_label = sbm_label;
this.sbm_type = sbm_type.getValue();
this.task_name = task_name;
this.task_type = task_type;
this.visible = visible;
}
public String getSBMName() {
return this.sbm_name;
}
public String getSBMLabel() {
return this.sbm_label;
}
public String getTaskName() {
return this.task_name;
}
public String getTaskType() {
return this.task_type;
}
public String getSBMType() {
return this.sbm_type;
}
public boolean isVisible() {
return this.visible;
}
public static SBMTicketAttribute getSBMAttributeByName(String sbm_fieldname) {
for (SBMTicketAttribute attribute : values()) {
if (sbm_fieldname.equals(attribute.getSBMName())) {
return attribute;
}
}
return null;
}
public static SBMTicketAttribute getSBMAttributeByTaskName(String task_fieldname) {
for (SBMTicketAttribute attribute : values()) {
if (task_fieldname.equals(attribute.getTaskName())) {
return attribute;
}
}
return null;
}
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/sbm4mylyn/trunk/src/net/brutex/mylyn/sbmconnector/core/SBMRepositoryConnector.java
0,0 → 1,194
/*
* 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;
 
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
import net.brutex.mylyn.sbmconnector.SBMConnectorPlugin;
import net.brutex.mylyn.sbmconnector.core.model.SBMStaticFields;
import net.brutex.sbm.wsclient.TTItem;
 
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler;
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
import org.eclipse.mylyn.tasks.core.data.TaskData;
import org.eclipse.mylyn.tasks.core.data.TaskDataCollector;
import org.eclipse.mylyn.tasks.core.data.TaskMapper;
import org.eclipse.mylyn.tasks.core.sync.ISynchronizationSession;
 
public class SBMRepositoryConnector extends AbstractRepositoryConnector {
 
private SBMTicketDataHandler datahandler;
private static Map<TaskRepository, SBMClient> clients = new HashMap<TaskRepository, SBMClient>();
 
public SBMRepositoryConnector() {
this.datahandler = new SBMTicketDataHandler(this);
}
 
public static synchronized SBMClient getClient(TaskRepository repository) {
SBMClient client = clients.get(repository);
if (client == null) {
client = new SBMClient(repository);
clients.put(repository, client);
}
return client;
}
 
@Override
public boolean canCreateNewTask(TaskRepository repository) {
return false;
}
 
@Override
public boolean canCreateTaskFromKey(TaskRepository repository) {
return false;
}
 
@Override
public boolean canSynchronizeTask(TaskRepository taskRepository, ITask task) {
return true;
}
@Override
public String getConnectorKind() {
return SBMConnectorPlugin.CONNECTOR_KIND;
}
 
@Override
public String getLabel() {
return SBMConnectorPlugin.LABEL;
}
 
@Override
public String getRepositoryUrlFromTaskUrl(String taskFullUrl) {
// TODO Auto-generated method stub
return null;
}
 
@Override
public TaskData getTaskData(TaskRepository taskRepository, String taskId,
IProgressMonitor monitor) throws CoreException {
monitor.beginTask("Loading SBM Ticket", IProgressMonitor.UNKNOWN);
TaskData data = null;
try {
SBMClient client = getClient(taskRepository);
TTItem item = client.getTTItem(taskId);
data = datahandler.convert(taskRepository, item, monitor);
 
} finally {
monitor.done();
}
return data;
}
 
@Override
public String getTaskIdFromTaskUrl(String taskFullUrl) {
// TODO Auto-generated method stub
return null;
}
 
@Override
public String getTaskUrl(String repositoryUrl, String taskId) {
// TODO Auto-generated method stub
return null;
}
 
@Override
public boolean hasTaskChanged(TaskRepository taskRepository, ITask task,
TaskData taskData) {
TaskAttribute attribute = taskData.getRoot().getAttribute(
SBMStaticFields.LASTMODIFIEDDATE.getValue());
if (attribute != null) {
Date dataModificationDate = taskData.getAttributeMapper()
.getDateValue(attribute);
if (dataModificationDate != null) {
Date taskModificationDate = task.getModificationDate();
if (taskModificationDate != null) {
return !taskModificationDate.equals(dataModificationDate);
}
}
}
return true;
}
 
@Override
public IStatus performQuery(TaskRepository repository,
IRepositoryQuery query, TaskDataCollector collector,
ISynchronizationSession session, IProgressMonitor monitor) {
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);
collector.accept(data);
}
} catch (CoreException e) {
return new Status(IStatus.ERROR, SBMConnectorPlugin.PLUGIN_ID,
"Query fehlgeschlagen.", e);
} finally {
monitor.done();
}
return Status.OK_STATUS;
}
 
@Override
public void updateRepositoryConfiguration(TaskRepository taskRepository,
IProgressMonitor monitor) throws CoreException {
// TODO Auto-generated method stub
 
}
 
@Override
public void updateTaskFromTaskData(TaskRepository taskRepository,
ITask task, TaskData taskData) {
getTaskMapping(taskData).applyTo(task);
}
 
@Override
public TaskMapper getTaskMapping(TaskData taskData) {
return new TaskMapper(taskData);
}
@Override
public AbstractTaskDataHandler getTaskDataHandler() {
return datahandler;
}
 
@Override
public boolean canDeleteTask(TaskRepository repository, ITask task) {
return false;
}
 
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/sbm4mylyn/trunk/src/net/brutex/mylyn/sbmconnector/core/SBMTicketDataHandler.java
0,0 → 1,175
/*
* 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;
 
import java.util.Set;
 
import net.brutex.mylyn.sbmconnector.SBMConnectorPlugin;
import net.brutex.mylyn.sbmconnector.core.model.SBMNote;
import net.brutex.mylyn.sbmconnector.core.model.SBMStaticFields;
import net.brutex.sbm.wsclient.TTItem;
 
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.mylyn.tasks.core.ITaskMapping;
import org.eclipse.mylyn.tasks.core.RepositoryResponse;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler;
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper;
import org.eclipse.mylyn.tasks.core.data.TaskCommentMapper;
import org.eclipse.mylyn.tasks.core.data.TaskData;
 
/**
* The Class SBMTicketDataHandler.
*/
public class SBMTicketDataHandler extends AbstractTaskDataHandler {
 
/** The connector. */
private final SBMRepositoryConnector connector;
/**
* Instantiates a new SBM ticket data handler.
*
* @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)
*/
@Override
public TaskAttributeMapper getAttributeMapper(TaskRepository taskRepository) {
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)
*/
@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");
*/
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)
*/
@Override
public RepositoryResponse postTaskData(TaskRepository repository,
TaskData taskData, Set<TaskAttribute> oldAttributes,
IProgressMonitor monitor) throws CoreException {
// TODO Auto-generated method stub
return null;
}
/**
* Convert.
*
* @param repository the repository
* @param ttitem the ttitem
* @param monitor the monitor
* @return the task data
* @throws CoreException the core exception
*/
public TaskData convert(TaskRepository repository, TTItem ttitem, IProgressMonitor monitor)
throws CoreException {
TaskData data = new TaskData(new SBMTicketAttributeMapper(repository),
SBMConnectorPlugin.CONNECTOR_KIND,
repository.getRepositoryUrl(),
ttitem.getGenericItem().getValue().getItemID().getValue());
initializeTaskData(repository, data, null, monitor);
// Create Fields for all the generic SBM (system) fields
for (SBMTicketAttribute f : SBMTicketAttribute.values()) {
TaskAttribute attr;
if(f.getTaskName()!=null) {
attr = data.getRoot().createMappedAttribute(f.getTaskName());
} else {
attr = data.getRoot().createAttribute(f.getSBMName());
}
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(SBMRepositoryConnector.getClient(repository).getFieldLabel(ttitem, f.getSBMName()));
if(f.isVisible()) {
attr.getMetaData().setKind(TaskAttribute.KIND_DEFAULT);
} else {
attr.getMetaData().setKind(null);
}
attr.setValue(SBMRepositoryConnector.getClient(repository).getFieldValue(ttitem, f.getSBMName()));
}
//Custom fields
TaskAttribute custom = data.getRoot().createAttribute("BLIBLABLUB");
custom.getMetaData().setType(TaskAttribute.TYPE_BOOLEAN);
custom.getMetaData().setLabel("BIILLALLLLLLLL");
custom.getMetaData().setKind(TaskAttribute.KIND_DEFAULT);
custom.setValue("roger");
//Notes
for(SBMNote n : SBMRepositoryConnector.getClient(repository).getNotes(ttitem)) {
TaskCommentMapper mapper = new TaskCommentMapper();
mapper.setCommentId(n.getId());
mapper.setNumber(Integer.valueOf(n.getId()));
mapper.setText(n.getText());
mapper.setCreationDate(n.getCreation());
TaskAttribute a = data.getRoot().createAttribute("NOTE"+n.getId());
mapper.applyTo(a);
}
data.setPartial(false);
return data;
}
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/sbm4mylyn/trunk/src/net/brutex/mylyn/sbmconnector/core/SBMTicketAttributeMapper.java
0,0 → 1,46
/*
* 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;
 
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper;
 
public class SBMTicketAttributeMapper extends TaskAttributeMapper {
 
public SBMTicketAttributeMapper(TaskRepository taskRepository) {
super(taskRepository);
}
@Override
public String mapToRepositoryKey(TaskAttribute parent, String key) {
SBMTicketAttribute attribute = SBMTicketAttribute.getSBMAttributeByTaskName(key);
if(attribute != null) {
return attribute.getSBMName();
}
return super.mapToRepositoryKey(parent, key); //just returns key
}
@Override
public TaskAttribute getAssoctiatedAttribute(TaskAttribute taskAttribute) {
// TODO Auto-generated method stub
return super.getAssoctiatedAttribute(taskAttribute);
}
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/sbm4mylyn/trunk/src/net/brutex/mylyn/sbmconnector/core/package.html
0,0 → 1,7
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head></head>
<body>
Provides...
</body>
</html>
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/sbm4mylyn/trunk/src/net/brutex/mylyn/sbmconnector/SBMConnectorPlugin.java
0,0 → 1,32
/*
* 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;
 
import org.eclipse.core.runtime.Plugin;
 
public class SBMConnectorPlugin extends Plugin {
public final static String CONNECTOR_KIND = "SBM2009R2.00";
public final static String DESCRIPTION = "Serena Business Mashups 2009 R2";
public final static String LABEL = "Serena Business Mashups";
public final static String PLUGIN_ID = "Brutex Network - Mylyn Connector for SBM";
 
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/sbm4mylyn/trunk/src/net/brutex/mylyn/sbmconnector/ui/SBMRepositorySettingsPage.java
0,0 → 1,91
/*
* 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.ui;
 
import net.brutex.mylyn.sbmconnector.SBMConnectorPlugin;
import net.brutex.mylyn.sbmconnector.core.SBMClient;
 
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositorySettingsPage;
import org.eclipse.swt.widgets.Composite;
 
public class SBMRepositorySettingsPage extends AbstractRepositorySettingsPage {
 
public SBMRepositorySettingsPage(String title, String description,
TaskRepository taskRepository) {
super(title, description, taskRepository);
// TODO Auto-generated constructor stub
}
 
@Override
protected void createAdditionalControls(Composite parent) {
// TODO Auto-generated method stub
 
}
 
@Override
public String getConnectorKind() {
return SBMConnectorPlugin.CONNECTOR_KIND;
}
 
@Override
protected Validator getValidator(TaskRepository repository) {
return new SBMConnectionValidator(repository);
}
 
@Override
protected boolean isValidUrl(String url) {
if(url.contains("<server>")) return false;
return true;
}
@Override
protected void applyValidatorResult(Validator validator) {
if (((SBMConnectionValidator) validator).getResult() != null) {
getContainer().updateButtons();
}
super.applyValidatorResult(validator);
}
protected class SBMConnectionValidator extends Validator {
private TaskRepository repository;
private String result = null;
protected SBMConnectionValidator(TaskRepository repository) {
this.repository = repository;
}
@Override
public void run(IProgressMonitor monitor) throws CoreException {
monitor.beginTask("Prüfe Verbindung", IProgressMonitor.UNKNOWN);
SBMClient client = new SBMClient(repository);
if(!client.canAuthenticate()) {
result = "Verbindung fehlgeschlagen";
}
result = "Verbindung erfolgreich";
monitor.done();
}
public String getResult() { return result; }
}
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/sbm4mylyn/trunk/src/net/brutex/mylyn/sbmconnector/ui/SBMTicketEditorPageFactory.java
0,0 → 1,72
/*
* 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.ui;
 
import net.brutex.mylyn.sbmconnector.SBMConnectorPlugin;
 
import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
import org.eclipse.mylyn.tasks.ui.TasksUiImages;
import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPageFactory;
import org.eclipse.mylyn.tasks.ui.editors.BrowserFormPage;
import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;
import org.eclipse.mylyn.tasks.ui.editors.TaskEditorInput;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.forms.editor.IFormPage;
 
public class SBMTicketEditorPageFactory extends AbstractTaskEditorPageFactory {
 
@Override
public boolean canCreatePageFor(TaskEditorInput input) {
if (input.getTask().getConnectorKind().equals(SBMConnectorPlugin.CONNECTOR_KIND)) {
return true;
}
return false;
}
 
@Override
public IFormPage createPage(TaskEditor parentEditor) {
TaskEditorInput input = parentEditor.getTaskEditorInput();
if (input.getTask().getConnectorKind().equals(SBMConnectorPlugin.CONNECTOR_KIND)) {
SBMTicketEditorPage sbmeditor = new SBMTicketEditorPage(parentEditor);
return sbmeditor;
} else {
return new BrowserFormPage(parentEditor, "Formular konnte nicht generiert werden");
}
}
 
@Override
public Image getPageImage() {
return CommonImages.getImage(TasksUiImages.REPOSITORY_SMALL);
}
 
 
@Override
public String getPageText() {
return SBMConnectorPlugin.LABEL;
}
@Override
public int getPriority() {
// be the first
return PRIORITY_TASK;
}
 
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/sbm4mylyn/trunk/src/net/brutex/mylyn/sbmconnector/ui/SBMRepositoryQueryPage.java
0,0 → 1,105
/*
* 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.ui;
 
import net.brutex.mylyn.sbmconnector.core.SBMRepositoryConnector;
 
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositoryQueryPage;
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.Label;
import org.eclipse.swt.widgets.Text;
 
public class SBMRepositoryQueryPage extends AbstractRepositoryQueryPage {
private Combo table = null;
private Text sql_where_clause = null;
private Text query_title = null;
public SBMRepositoryQueryPage(String pageName, TaskRepository repository,
IRepositoryQuery query) {
super(pageName, repository, query);
setTitle("SBM Query");
setDescription("Please specify table database name.");
}
 
@Override
public void applyTo(IRepositoryQuery query) {
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());
}
 
@Override
public String getQueryTitle() {
if(query_title!=null && !query_title.getText().isEmpty()) return query_title.getText();
return "new query";
}
 
@Override
public void createControl(Composite arg0) {
Composite control = new Composite(arg0,SWT.BORDER);
control.setLayout(new GridLayout(2, false));
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:");
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);
}
}
 
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"));
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).applyTo(table);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).applyTo(query_title);
Dialog.applyDialogFont(control);
setControl(control);
}
 
 
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/sbm4mylyn/trunk/src/net/brutex/mylyn/sbmconnector/ui/SBMTicketEditorPage.java
0,0 → 1,50
/*
* 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.ui;
 
import net.brutex.mylyn.sbmconnector.SBMConnectorPlugin;
 
import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPage;
import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;
 
public class SBMTicketEditorPage extends AbstractTaskEditorPage {
 
public SBMTicketEditorPage(TaskEditor editor) {
super(editor, SBMConnectorPlugin.CONNECTOR_KIND);
setNeedsPrivateSection(false);
setNeedsSubmitButton(false);
setNeedsSubmit(false);
setNeedsSubmit(false);
}
/*@Override
protected Set<TaskEditorPartDescriptor> createPartDescriptors() {
Set<TaskEditorPartDescriptor> descriptors = super.createPartDescriptors();
 
// remove unnecessary default editor parts
//for (TaskEditorPartDescriptor taskEditorPartDescriptor : descriptors) {
// if (taskEditorPartDescriptor.getId().equals(ID_PART_PEOPLE)) {
// descriptors.remove(taskEditorPartDescriptor);
// break;
// }
//}
return descriptors;
}*/
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/sbm4mylyn/trunk/src/net/brutex/mylyn/sbmconnector/ui/SBMQueryComposite.java
0,0 → 1,50
/*
* 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.ui;
 
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Text;
 
public class SBMQueryComposite extends Composite {
 
private Label label = null;
private Text table = null;
private Text textArea = null;
public SBMQueryComposite(Composite parent, int style) {
super(parent, style);
initialize();
}
 
private void initialize() {
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 2;
label = new Label(this, SWT.NONE);
label.setText("Table:");
table = new Text(this, SWT.BORDER);
textArea = new Text(this, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
this.setLayout(gridLayout);
setSize(new Point(300, 200));
}
 
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/sbm4mylyn/trunk/src/net/brutex/mylyn/sbmconnector/ui/SBMRepositoryConnectorUi.java
0,0 → 1,71
/*
* 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.ui;
 
import net.brutex.mylyn.sbmconnector.SBMConnectorPlugin;
 
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
import org.eclipse.mylyn.tasks.core.ITaskMapping;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
import org.eclipse.mylyn.tasks.ui.wizards.ITaskRepositoryPage;
import org.eclipse.mylyn.tasks.ui.wizards.RepositoryQueryWizard;
 
public class SBMRepositoryConnectorUi extends AbstractRepositoryConnectorUi {
 
@Override
public String getConnectorKind() {
return SBMConnectorPlugin.CONNECTOR_KIND;
}
 
@Override
public IWizard getNewTaskWizard(TaskRepository taskRepository,
ITaskMapping selection) {
// TODO Auto-generated method stub
return null;
}
 
@Override
public IWizard getQueryWizard(TaskRepository taskRepository,
IRepositoryQuery queryToEdit) {
RepositoryQueryWizard w = new RepositoryQueryWizard(taskRepository);
w.addPage(new SBMRepositoryQueryPage("Primary Table Specification", taskRepository, queryToEdit));
return w;
}
 
@Override
public ITaskRepositoryPage getSettingsPage(TaskRepository taskRepository) {
return new SBMRepositorySettingsPage(SBMConnectorPlugin.LABEL,
SBMConnectorPlugin.DESCRIPTION,
new TaskRepository(SBMConnectorPlugin.CONNECTOR_KIND,
"http://<server>:80/gsoap/gsoap_ssl.dll?aewebservices71"));
}
 
@Override
public boolean hasSearchPage() {
// TODO Auto-generated method stub
return false;
}
 
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/sbm4mylyn/trunk/src/net/brutex/mylyn/sbmconnector/ui/package.html
0,0 → 1,7
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head></head>
<body>
Provides...
</body>
</html>
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/sbm4mylyn/trunk/src/net/brutex/mylyn/sbmconnector/package.html
0,0 → 1,7
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head></head>
<body>
Provides...
</body>
</html>
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property