Subversion Repositories XServices

Rev

Rev 31 | Rev 34 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 31 Rev 32
Line 62... Line 62...
62
	private static final QName SERVICE_NAME = new QName("http://localhost:80/gsoap/aewebservices71.wsdl", "aewebservices71");
62
	private static final QName SERVICE_NAME = new QName("http://localhost:80/gsoap/aewebservices71.wsdl", "aewebservices71");
63
	private TaskRepository repository;
63
	private TaskRepository repository;
64
	private ObjectFactory of;
64
	private ObjectFactory of;
65
	private List<TableData> tables = new ArrayList<TableData>();
65
	private List<TableData> tables = new ArrayList<TableData>();
Line -... Line 66...
-
 
66
	
-
 
67
	/**
-
 
68
	 * Instantiates a new SBM client.
-
 
69
	 * Creates new instance of the aewebservices71 {@link net.brutex.sbm.wsclient.ObjectFactory} and
-
 
70
	 * initializes web service endpoint from repository url.
-
 
71
	 *
-
 
72
	 * @param repository the repository
66
	
73
	 */
67
	public SBMClient(TaskRepository repository) {
74
	public SBMClient(TaskRepository repository) {
68
		this.repository = repository;
75
		this.repository = repository;
Line 69... Line 76...
69
		this.of = new ObjectFactory();
76
		this.of = new ObjectFactory();
Line 75... Line 82...
75
        ((BindingProvider)port).getRequestContext().put(
82
        ((BindingProvider)port).getRequestContext().put(
76
        		BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
83
        		BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
77
        		repository.getRepositoryUrl());
84
        		repository.getRepositoryUrl());
78
	}
85
	}
Line -... Line 86...
-
 
86
	
-
 
87
	/**
-
 
88
	 * Can authenticate checks if this SBMClient instance has proper authentication details
-
 
89
	 * set in its related repository. The check is done by invoking the GetUser web service.
-
 
90
	 *
-
 
91
	 * @return true, if successful
-
 
92
	 * @throws CoreException the core exception
79
	
93
	 */
80
	public boolean canAuthenticate() throws CoreException {
94
	public boolean canAuthenticate() throws CoreException {
81
		try {
95
		try {
82
			port.getUser(getAuth(), repository.getCredentials(AuthenticationType.REPOSITORY).getUserName());
96
			port.getUser(getAuth(), repository.getCredentials(AuthenticationType.REPOSITORY).getUserName());
83
		} catch (AEWebservicesFaultFault e) {
97
		} catch (AEWebservicesFaultFault e) {
Line 86... Line 100...
86
			return false;
100
			return false;
87
		}
101
		}
88
		return true;
102
		return true;
89
	}
103
	}
Line -... Line 104...
-
 
104
	
-
 
105
	/**
-
 
106
	 * Gets the SBM items from a table. The result size is limited to 500 and the sorting is done
-
 
107
	 * by submit date descending.
-
 
108
	 *
-
 
109
	 * @param tablename the tablename
-
 
110
	 * @param sql_where the sql_where
-
 
111
	 * @return the tT items by table
-
 
112
	 * @throws CoreException the core exception
90
	
113
	 */
91
	public List<TTItem> getTTItemsByTable(String tablename, String sql_where) throws CoreException {
114
	public List<TTItem> getTTItemsByTable(String tablename, String sql_where) throws CoreException {
92
		List<TTItem> list = new ArrayList<TTItem>();
115
		List<TTItem> list = new ArrayList<TTItem>();
93
		if(sql_where==null || sql_where.isEmpty()) sql_where = "TS_ID>0";
116
		if(sql_where==null || sql_where.isEmpty()) sql_where = "TS_ID>0";
94
		try {
117
		try {
Line 104... Line 127...
104
							SBMConnectorPlugin.PLUGIN_ID, e.getFaultInfo(), e));
127
							SBMConnectorPlugin.PLUGIN_ID, e.getFaultInfo(), e));
105
		}
128
		}
106
		return list;
129
		return list;
107
	}
130
	}
Line -... Line 131...
-
 
131
	
-
 
132
	/**
-
 
133
	 * Gets a SBM item specified by its internal identifier ([tableid:recordid])
-
 
134
	 *
-
 
135
	 * @param itemid the itemid
-
 
136
	 * @return the tT item
108
	
137
	 */
109
	public TTItem getTTItem(String itemid) {
138
	public TTItem getTTItem(String itemid) {
110
		TTItem item = of.createTTItem();
139
		TTItem item = of.createTTItem();
111
			try {
140
			try {
112
				item = port.getItem(getAuth(), itemid, null);
141
				item = port.getItem(getAuth(), itemid, null);
Line 240... Line 269...
240
		}
269
		}
Line 241... Line 270...
241
 
270
 
242
		return "UNKNOWN";
271
		return "UNKNOWN";
Line -... Line 272...
-
 
272
	}
-
 
273
	
-
 
274
	/**
-
 
275
	 * Gets the field label. The SBM item is used to determine the table id of 
-
 
276
	 * the table where this field is in.
-
 
277
	 *
-
 
278
	 * @param ttitem the ttitem
-
 
279
	 * @param fieldname the fieldname
243
	}
280
	 * @return the field label
244
	
281
	 */
245
	public String getFieldLabel(TTItem ttitem, String fieldname) {
282
	public String getFieldLabel(TTItem ttitem, String fieldname) {
246
		refreshTables();
283
		refreshTables();
247
		String itemid = ttitem.getGenericItem().getValue().getItemID().getValue();
284
		String itemid = ttitem.getGenericItem().getValue().getItemID().getValue();
Line 277... Line 314...
277
			}
314
			}
278
		}
315
		}
279
		return null;
316
		return null;
280
	}
317
	}
Line -... Line 318...
-
 
318
	
-
 
319
	/**
-
 
320
	 * Gets the notes attached to a SBM item.
-
 
321
	 *
-
 
322
	 * @param ttitem the ttitem
-
 
323
	 * @return the notes
281
	
324
	 */
282
	public List<SBMNote> getNotes(TTItem ttitem) {
325
	public List<SBMNote> getNotes(TTItem ttitem) {
283
		List<SBMNote> notes = new ArrayList<SBMNote>();
326
		List<SBMNote> notes = new ArrayList<SBMNote>();
284
		Iterator<Note> iter = ttitem.getNoteList().iterator();
327
		Iterator<Note> iter = ttitem.getNoteList().iterator();
285
		while(iter.hasNext()) {
328
		while(iter.hasNext()) {