Commit 70299bde authored by mobreza's avatar mobreza

geneses-client-api updated, resolving issues

parent 0c78af81
......@@ -231,7 +231,7 @@ public class SettingsDialog extends Dialog {
try {
String res = genesysClient.me();
System.err.println("/me: " + res);
oauthSettings.setAccessToken(genesysClient.getAccessToken().getToken());
oauthSettings.setAccessToken(genesysClient.getTokens().getAccessToken());
SwtUtil.showMessageBox(getParent(), "OAuth", "Tokens are up to date.");
......@@ -241,7 +241,7 @@ public class SettingsDialog extends Dialog {
+ oauthSettings.getServerUrl() + "\n\n" + e.getMessage());
} catch (OAuthAuthenticationException e) {
_log.warn(e.getMessage());
String authorizationUrl = genesysClient.getAuthorizationUrl(null);
String authorizationUrl = genesysClient.getAuthorizationUrl();
VerifierDialog vd = new VerifierDialog(getParent(), SWT.NONE);
String verifierCode = vd.open(authorizationUrl);
......@@ -250,8 +250,8 @@ public class SettingsDialog extends Dialog {
_log.info("Got verifier code: " + verifierCode);
try {
genesysClient.authenticate(verifierCode);
oauthSettings.setAccessToken(genesysClient.getAccessToken().getToken());
oauthSettings.setRefreshToken(genesysClient.getRefreshToken().getToken());
oauthSettings.setAccessToken(genesysClient.getTokens().getAccessToken());
oauthSettings.setRefreshToken(genesysClient.getTokens().getRefreshToken());
} catch (Throwable e1) {
_log.error(e1.getMessage(), e1);
SwtUtil.showMessageBox(getParent(), "OAuth error", e1.getMessage());
......
......@@ -102,7 +102,8 @@ public class SheetDisplay extends Composite {
@Autowired
private ColumnDefs columnDefs;
private static final ObjectMapper mapper = new ObjectMapper();
@Autowired
private ObjectMapper mapper;
private static class ContentProvider implements IStructuredContentProvider {
@Override
......
......@@ -18,6 +18,7 @@ import org.genesys2.anno.parser.XlsxDataSourceParser;
import org.genesys2.anno.reader.JDBCRowReader;
import org.genesys2.anno.util.ConnectionUtils;
import org.genesys2.client.oauth.GenesysClient;
import org.genesys2.client.oauth.GenesysTokens;
import org.genesys2.client.oauth.api.GenesysApi;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
......@@ -30,6 +31,8 @@ import org.springframework.context.annotation.Scope;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import com.fasterxml.jackson.databind.ObjectMapper;
/**
* Main Spring configuration
*
......@@ -91,8 +94,9 @@ public class SpringConfig {
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public SheetDisplay sheetDisplay(IDataSource dataSource,IDataSourceSheet dataSourceSheet, Composite parent, TreeViewer treeViewer, int style) {
return new SheetDisplay(dataSource,dataSourceSheet, parent, treeViewer, style);
public SheetDisplay sheetDisplay(IDataSource dataSource, IDataSourceSheet dataSourceSheet, Composite parent,
TreeViewer treeViewer, int style) {
return new SheetDisplay(dataSource, dataSourceSheet, parent, treeViewer, style);
}
@Bean
......@@ -152,13 +156,19 @@ public class SpringConfig {
return extraClassLoader;
}
@Bean
public ObjectMapper objectMapper() {
return new ObjectMapper();
}
@Bean
public static PropertyPlaceholderConfigurer propertyPlaceholderConfigurer() {
final PropertyPlaceholderConfigurer propertyPlaceholderConfigurer = new PropertyPlaceholderConfigurer();
// Need to ignore "genesys.properties" if not found
propertyPlaceholderConfigurer.setIgnoreResourceNotFound(true);
propertyPlaceholderConfigurer.setLocations(new Resource[] { new ClassPathResource("genesys.properties"), new ClassPathResource("local.properties") });
propertyPlaceholderConfigurer.setLocations(new Resource[] { new ClassPathResource("genesys.properties"),
new ClassPathResource("local.properties") });
return propertyPlaceholderConfigurer;
}
......@@ -168,8 +178,10 @@ public class SpringConfig {
GenesysClient genesysClient = new GenesysClient();
genesysClient.setGenesysApi(new GenesysApi());
genesysClient.setBaseUrl(oauthSettings.getServerUrl());
genesysClient.setAccessToken(oauthSettings.getAccessToken());
genesysClient.setRefreshToken(oauthSettings.getRefreshToken());
GenesysTokens genesysTokens = new GenesysTokens();
genesysTokens.setAccessToken(oauthSettings.getAccessToken());
genesysTokens.setRefreshToken(oauthSettings.getRefreshToken());
genesysClient.setTokens(genesysTokens);
genesysClient.connect(oauthSettings.getClientKey(), oauthSettings.getClientSecret(), "oob");
return genesysClient;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment