Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
target/
.vscode/
24 changes: 6 additions & 18 deletions samples/ExternalLibGeoSample/adsGeoLibrary/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<version>2401.0.4</version>
</parent>

<groupId>ads.samples</groupId>
<artifactId>adsGeoLibrary</artifactId>
<description>External library providing geo localization facilities</description>

Expand All @@ -25,18 +24,6 @@
</pluginManagement>

<plugins>
<plugin>
<groupId>com.ibm.decision</groupId>
<artifactId>build-maven-plugin</artifactId>
<version>${ads-mojo.version}</version>
<configuration>
<deployments>
<deployment>
<name>adsGeoLibrary</name>
</deployment>
</deployments>
</configuration>
</plugin>
<plugin>
<groupId>com.ibm.decision</groupId>
<artifactId>build-maven-plugin</artifactId>
Expand Down Expand Up @@ -70,17 +57,18 @@
<!-- Optional, by default: en_US -->
<locales>
<locale>en_US</locale>

</locales>
<!-- Optional, by default: true -->
<importMethods>true</importMethods>
<!-- Optional, by default: all classes from dependencies -->

<filter>
<!-- <filter>
<includes>
<include>ads.samples.externalLibrary</include>
<include>ads.samples.geolibrary</include>
</includes>
</filter>
<excludes>
<exclude>**</exclude>
</excludes>
</filter> -->
<referenceFolder>reference</referenceFolder>
</configuration>
<goals>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@

ads.samples.geoLibrary.Location#concept.documentation = a city described with a name, a longitude and a latitude
ads.samples.geoLibrary.Country#concept.documentation = a country described with a name and its capital
ads.samples.geolibrary.Location#concept.documentation = a city described with a name, a longitude and a latitude
ads.samples.geolibrary.Country#concept.documentation = a country described with a name and its capital

# ads.samples.geoLibrary.Location
ads.samples.geoLibrary.Location.getDistance(ads.samples.geoLibrary.Location)#phrase.navigation = the distance between {this} and {0}
# ads.samples.geolibrary.Location
ads.samples.geolibrary.Location.getDistance(ads.samples.geolibrary.Location)#phrase.navigation = the distance between {this} and {0}

# ads.samples.geoLibrary.LocationsUtilities
ads.samples.geoLibrary.LocationsUtilities.getDistance(java.lang.String,java.lang.String)#phrase.navigation = the distance between {0} and {1}
ads.samples.geoLibrary.LocationsUtilities.knownCity(java.lang.String)#phrase.navigation = {0} is a known city
ads.samples.geoLibrary.LocationsUtilities.unknownCity(java.lang.String)#phrase.navigation = {0} is not a known city
ads.samples.geoLibrary.LocationsUtilities.knownCountry(java.lang.String)#phrase.navigation = {0} is a known country
ads.samples.geoLibrary.LocationsUtilities.unknownCountry(java.lang.String)#phrase.navigation = {0} is not a known country
ads.samples.geoLibrary.LocationsUtilities.getCountry(java.lang.String)#phrase.navigation = {country} named {0}
ads.samples.geoLibrary.LocationsUtilities.getCountry(java.lang.String)#phrase.navigation.documentation = Finds the country with the given name
ads.samples.geoLibrary.LocationsUtilities.getLocation(java.lang.String)#phrase.navigation = {location} named {0}
ads.samples.geoLibrary.LocationsUtilities.getLocation(java.lang.String)#phrase.navigation.documentation = Finds the city with the given name
# ads.samples.geolibrary.LocationsUtilities
ads.samples.geolibrary.LocationsUtilities.getDistance(java.lang.String,java.lang.String)#phrase.navigation = the distance between {0} and {1}
ads.samples.geolibrary.LocationsUtilities.knownCity(java.lang.String)#phrase.navigation = {0} is a known city
ads.samples.geolibrary.LocationsUtilities.unknownCity(java.lang.String)#phrase.navigation = {0} is not a known city
ads.samples.geolibrary.LocationsUtilities.knownCountry(java.lang.String)#phrase.navigation = {0} is a known country
ads.samples.geolibrary.LocationsUtilities.unknownCountry(java.lang.String)#phrase.navigation = {0} is not a known country
ads.samples.geolibrary.LocationsUtilities.getCountry(java.lang.String)#phrase.navigation = {country} named {0}
ads.samples.geolibrary.LocationsUtilities.getCountry(java.lang.String)#phrase.navigation.documentation = Finds the country with the given name
ads.samples.geolibrary.LocationsUtilities.getLocation(java.lang.String)#phrase.navigation = {location} named {0}
ads.samples.geolibrary.LocationsUtilities.getLocation(java.lang.String)#phrase.navigation.documentation = Finds the city with the given name
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Use, duplication or disclosure restricted by GSA ADP Schedule
* Contract with IBM Corp.
*/
package ads.samples.geoLibrary;
package ads.samples.geolibrary;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
Expand All @@ -15,11 +15,13 @@

public class Country {
private String name;
private ads.samples.geoLibrary.Location capital;
private ads.samples.geolibrary.Location capital;

public Country(){}

@BeanConstructor
@JsonCreator
public Country(@JsonProperty("name")String name, @JsonProperty("capital")ads.samples.geoLibrary.Location capital) {
public Country(@JsonProperty("name")String name, @JsonProperty("capital")ads.samples.geolibrary.Location capital) {
this.name = name;
this.capital = capital;
capital.setCountry(this);
Expand All @@ -37,7 +39,7 @@ public void setName(String name) {
this.name = name;
}

public void setCapital(ads.samples.geoLibrary.Location capital) {
public void setCapital(ads.samples.geolibrary.Location capital) {
this.capital = capital;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Contract with IBM Corp.
*/

package ads.samples.geoLibrary;
package ads.samples.geolibrary;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
Expand All @@ -27,6 +27,8 @@ public class Location {
private double longitude;
private double latitude;

public Location(){}

@BeanConstructor
@JsonCreator
public Location(@JsonProperty("name") String name, @JsonProperty("longitude") double longitude,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Contract with IBM Corp.
*/

package ads.samples.geoLibrary;
package ads.samples.geolibrary;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Contract with IBM Corp.
*/

package ads.samples.geoLibrary;
package ads.samples.geolibrary;
import com.ibm.rules.engine.annotations.PureFunction;
import ilog.rules.bom.annotations.NotBusiness;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
* Contract with IBM Corp.
*/

package ads.samples.geoLibrary;
package ads.samples.geolibrary;

import ads.samples.geolibrary.Country;
import ads.samples.geolibrary.Locations;
import ads.samples.geolibrary.LocationsUtilities;
import junit.framework.TestCase;

public class LocationTest extends TestCase {
Expand All @@ -19,19 +22,19 @@ public class LocationTest extends TestCase {
private static final float WASHINGTON_PARIS = (float)6164.81;

public void testDistanceParisNice() {
ads.samples.geoLibrary.Location paris = new ads.samples.geoLibrary.Location("Paris", PARIS_LONGITUDE, PARIS_LATITUDE);
ads.samples.geoLibrary.Location nice = new ads.samples.geoLibrary.Location("Nice", 7.2661, 43.7031);
ads.samples.geoLibrary.Location washington = new ads.samples.geoLibrary.Location("Washington", WASHINGTON_LONGITUDE, WASHINGTON_LATITUDE);
ads.samples.geolibrary.Location paris = new ads.samples.geolibrary.Location("Paris", PARIS_LONGITUDE, PARIS_LATITUDE);
ads.samples.geolibrary.Location nice = new ads.samples.geolibrary.Location("Nice", 7.2661, 43.7031);
ads.samples.geolibrary.Location washington = new ads.samples.geolibrary.Location("Washington", WASHINGTON_LONGITUDE, WASHINGTON_LATITUDE);
assertEquals((float)685.953, paris.getDistance(nice));
assertEquals(WASHINGTON_PARIS, paris.getDistance(washington));
}

public void testReadCsv() {
Locations locations = new Locations("cities.csv");
ads.samples.geoLibrary.Location paris = locations.getLocation("Paris");
ads.samples.geolibrary.Location paris = locations.getLocation("Paris");
assertEquals(paris.getLatitude(), PARIS_LATITUDE);
assertEquals(paris.getLongitude(), PARIS_LONGITUDE);
ads.samples.geoLibrary.Location washington = locations.getLocation("Washington");
ads.samples.geolibrary.Location washington = locations.getLocation("Washington");
assertEquals(washington.getLatitude(), WASHINGTON_LATITUDE);
assertEquals(washington.getLongitude(), WASHINGTON_LONGITUDE);
}
Expand Down
1 change: 1 addition & 0 deletions samples/ExternalLibGeoSample/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<ads-annotations.version>2.0.13</ads-annotations.version>
<ads-sample.version>2401.0.4</ads-sample.version>
<jackson.version>2.15.2</jackson.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<groupId>ads.samples</groupId>
Expand Down
17 changes: 0 additions & 17 deletions samples/ExternalLibGeoSample/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@
<name>Maven release mirror</name>
<url>%MAVEN_RELEASES-REPOSITORY_TO_BE_SET%</url>
</mirror>
<mirror>
<id>ads-maven</id> <!-- match server definition -->
<mirrorOf>ads-maven</mirrorOf> <!-- match repository definition -->
<name>ADS Maven repository mirror</name>
<url>%ADS_MAVEN_REPOSITORY_TO_BE_SET%</url>
</mirror>
</mirrors>
<profiles>
<profile>
Expand Down Expand Up @@ -47,16 +41,5 @@
<username>USER TO BE SET</username>
<password>PASSWORD TO BE SET</password>
</server>
<server>
<id>ads-maven</id>
<configuration>
<httpHeaders>
<property>
<name>Authorization</name>
<value>ZenApiKey %YOUR_API_KEY_TO_BE_SET%</value>
</property>
</httpHeaders>
</configuration>
</server>
</servers>
</settings>