-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1dd7058
commit 724ba42
Showing
7 changed files
with
200 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<artifactId>openerp-service</artifactId> | ||
<groupId>org.bahmni.openerp</groupId> | ||
<version>0.94-SNAPSHOT</version> | ||
</parent> | ||
<groupId>org.bahmni.openerp</groupId> | ||
<artifactId>odoo16-client</artifactId> | ||
<packaging>jar</packaging> | ||
<version>0.94-SNAPSHOT</version> | ||
<name>odoo16-client</name> | ||
<url>http://maven.apache.org</url> | ||
<properties> | ||
<release.version>${project.version}</release.version> | ||
</properties> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-webmvc</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-web</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.velocity</groupId> | ||
<artifactId>velocity</artifactId> | ||
<version>1.7</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.velocity</groupId> | ||
<artifactId>velocity-tools</artifactId> | ||
<version>2.0</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.httpcomponents</groupId> | ||
<artifactId>httpclient</artifactId> | ||
<version>${httpClient.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.aspectj</groupId> | ||
<artifactId>aspectjrt</artifactId> | ||
<version>1.6.12</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.xmlrpc</groupId> | ||
<artifactId>xmlrpc-client</artifactId> | ||
<version>3.1.3</version> | ||
<exclusions> | ||
<exclusion> | ||
<artifactId>xml-apis</artifactId> | ||
<groupId>xml-apis</groupId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>commons-beanutils</groupId> | ||
<artifactId>commons-beanutils</artifactId> | ||
<version>1.8.3</version> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>commons-logging</groupId> | ||
<artifactId>commons-logging</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.logging.log4j</groupId> | ||
<artifactId>log4j-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.logging.log4j</groupId> | ||
<artifactId>log4j-core</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>javax.servlet</groupId> | ||
<artifactId>javax.servlet-api</artifactId> | ||
<version>3.0.1</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-databind</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-lang3</artifactId> | ||
<version>3.0</version> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<finalName>odoo16-client</finalName> | ||
<plugins> | ||
</plugins> | ||
</build> | ||
</project> |
16 changes: 16 additions & 0 deletions
16
odoo16-client/src/main/java/org/bahmni/odoo/web/DemoApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.bahmni.odoo.web; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.bahmni.odoo.web.controller.OpenERPLogin; | ||
|
||
@SpringBootApplication | ||
public class DemoApplication { | ||
|
||
public static void main(String[] args) { | ||
// This is the main entry point for the Spring Boot application. | ||
OpenERPLogin openERPLogin = new OpenERPLogin(); | ||
openERPLogin.login("admin", "admin"); | ||
SpringApplication.run(DemoApplication.class, args); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
odoo16-client/src/main/java/org/bahmni/odoo/web/client/OpenERPLoginRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.bahmni.odoo.web.client; | ||
public class OpenERPLoginRequest { | ||
private String username; | ||
private String password; | ||
|
||
public String getUsername() { | ||
return username; | ||
} | ||
|
||
public void setUsername(String username) { | ||
this.username = username; | ||
} | ||
|
||
public String getPassword() { | ||
return password; | ||
} | ||
|
||
public void setPassword(String password) { | ||
this.password = password; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
odoo16-client/src/main/java/org/bahmni/odoo/web/controller/OpenERPLogin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package org.bahmni.odoo.web.controller; | ||
|
||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.http.HttpEntity; | ||
import org.springframework.http.HttpMethod; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.client.RestTemplate; | ||
public class OpenERPLogin { | ||
|
||
@Value("${external.api.url}") | ||
private String externalApiUrl; | ||
|
||
public ResponseEntity<String> login(String username, String password) { | ||
RestTemplate restTemplate = new RestTemplate(); | ||
String requestBody = "{\"username\":\"" + username + "\",\"password\":\"" + password + "\"}"; | ||
HttpEntity<String> requestEntity = new HttpEntity<>(requestBody); | ||
String requestUrl = externalApiUrl + "/api/login"; // Adjust the URL | ||
ResponseEntity<String> response = restTemplate.exchange(requestUrl, HttpMethod.POST, requestEntity, String.class); | ||
|
||
return response; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
external.api.url=http://localhost:8069 | ||
server: | ||
port: 8080 |
31 changes: 31 additions & 0 deletions
31
odoo16-client/src/main/resources/applicationContext-openerp-client.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<beans xmlns="http://www.springframework.org/schema/beans" | ||
xmlns:context="http://www.springframework.org/schema/context" | ||
xmlns:util="http://www.springframework.org/schema/util" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd | ||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd | ||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd"> | ||
|
||
<context:annotation-config/> | ||
|
||
<bean id="velocityConfig" class="org.springframework.web.servlet.view.velocity.VelocityConfigurer"> | ||
<property name="resourceLoaderPath" value="/WEB-INF/velocity/"/> | ||
<property name="velocityProperties"> | ||
<props> | ||
<prop key="input.encoding">UTF-8</prop> | ||
<prop key="output.encoding">UTF-8</prop> | ||
</props> | ||
</property> | ||
</bean> | ||
|
||
<bean id="restTemplate" class="org.springframework.web.client.RestTemplate"> | ||
</bean> | ||
|
||
<bean id="jsonConverter" | ||
class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"> | ||
<property name="supportedMediaTypes" value="application/json" /> | ||
</bean> | ||
|
||
<context:component-scan base-package="org.bahmni.openerp.web"/> | ||
</beans> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters