├── enterprise-granny-core
├── .gitignore
├── src
│ ├── main
│ │ └── java
│ │ │ └── com
│ │ │ └── sap
│ │ │ └── hana
│ │ │ └── cloud
│ │ │ └── samples
│ │ │ └── granny
│ │ │ ├── model
│ │ │ ├── package-info.java
│ │ │ ├── Title.java
│ │ │ ├── AddressType.java
│ │ │ ├── CommunicationType.java
│ │ │ ├── Salutation.java
│ │ │ ├── PhoneNumber.java
│ │ │ ├── EmailAddress.java
│ │ │ ├── ValidationError.java
│ │ │ ├── Address.java
│ │ │ ├── Contact.java
│ │ │ ├── StatusMessage.java
│ │ │ └── BaseObject.java
│ │ │ ├── srv
│ │ │ ├── DataValidationException.java
│ │ │ ├── ServiceException.java
│ │ │ └── ContactService.java
│ │ │ └── api
│ │ │ └── ContactFacade.java
│ └── test
│ │ └── resources
│ │ └── json
│ │ └── donald.duck.json
└── pom.xml
├── enterprise-granny-service
├── src
│ ├── main
│ │ ├── webapp
│ │ │ ├── .gitignore
│ │ │ ├── resources
│ │ │ │ ├── css
│ │ │ │ │ └── contact-srv.css
│ │ │ │ └── img
│ │ │ │ │ ├── favicon.ico
│ │ │ │ │ ├── icon_9727.png
│ │ │ │ │ ├── ensw_granny_logo_114.png
│ │ │ │ │ ├── ensw_granny_logo_144.png
│ │ │ │ │ ├── ensw_granny_logo_57.png
│ │ │ │ │ ├── ensw_granny_logo_72.png
│ │ │ │ │ ├── ensw_granny_logo_web.png
│ │ │ │ │ └── icon_9727.svg
│ │ │ ├── WEB-INF
│ │ │ │ ├── lib
│ │ │ │ │ └── .gitignore
│ │ │ │ └── web.xml
│ │ │ ├── META-INF
│ │ │ │ └── MANIFEST.MF
│ │ │ ├── index.html
│ │ │ ├── css
│ │ │ │ └── style.css
│ │ │ └── admin
│ │ │ │ └── index.html
│ │ ├── resources
│ │ │ ├── META-INF
│ │ │ │ ├── enunciate
│ │ │ │ │ ├── .gitignore
│ │ │ │ │ ├── docs-base.zip
│ │ │ │ │ └── enunciate.xml
│ │ │ │ ├── persistence.xml
│ │ │ │ └── spring
│ │ │ │ │ └── spring-persistence-config.xml
│ │ │ ├── sql
│ │ │ │ └── dropSchema.sql
│ │ │ ├── destinations
│ │ │ │ └── destination.properties
│ │ │ ├── db
│ │ │ │ ├── db.changelog.xml
│ │ │ │ └── multitenancy.changelog.xml
│ │ │ ├── i18n
│ │ │ │ └── messages.properties
│ │ │ └── log4j.xml
│ │ └── java
│ │ │ └── com
│ │ │ ├── sap
│ │ │ └── hana
│ │ │ │ └── cloud
│ │ │ │ └── samples
│ │ │ │ └── granny
│ │ │ │ ├── api
│ │ │ │ └── impl
│ │ │ │ │ ├── package-info.java
│ │ │ │ │ └── BaseFacade.java
│ │ │ │ ├── dao
│ │ │ │ ├── PhoneNumberValidationDAO.java
│ │ │ │ ├── ContactDAO.java
│ │ │ │ ├── PhoneNumberValidationResult.java
│ │ │ │ ├── ContactRepository.java
│ │ │ │ └── ContactDAOImpl.java
│ │ │ │ ├── xcc
│ │ │ │ ├── validations
│ │ │ │ │ ├── ValidPhoneNumber.java
│ │ │ │ │ └── ValidPhoneNumberValidator.java
│ │ │ │ ├── LoggingAspect.java
│ │ │ │ └── DataValidationAspect.java
│ │ │ │ ├── srv
│ │ │ │ ├── BaseService.java
│ │ │ │ └── ContactServiceImpl.java
│ │ │ │ ├── util
│ │ │ │ ├── CustomObjectMapper.java
│ │ │ │ └── LocaleUtils.java
│ │ │ │ └── web
│ │ │ │ └── util
│ │ │ │ ├── ServiceExceptionMapper.java
│ │ │ │ ├── ParserExceptionMapper.java
│ │ │ │ ├── CustomJAXRSBeanValidationInInterceptor.java
│ │ │ │ ├── JsonMappingExceptionMapper.java
│ │ │ │ ├── EnvironmentContextInitializer.java
│ │ │ │ ├── CustomJAXRSParameterNameProvider.java
│ │ │ │ └── ValidationExceptionMapper.java
│ │ │ └── osintegrators
│ │ │ └── example
│ │ │ ├── AddressRepository.java
│ │ │ ├── AddressService.java
│ │ │ ├── AddressServiceImpl.java
│ │ │ ├── Address.java
│ │ │ └── HomeController.java
│ └── test
│ │ ├── resources
│ │ ├── com
│ │ │ └── osintegrators
│ │ │ │ └── example
│ │ │ │ └── TestAddressService-context.xml
│ │ └── log4j.xml
│ │ └── java
│ │ └── com
│ │ ├── osintegrators
│ │ └── example
│ │ │ └── TestAddressService.java
│ │ └── sap
│ │ └── hana
│ │ └── cloud
│ │ └── samples
│ │ └── granny
│ │ └── dao
│ │ ├── ValidPhoneNumberValidatorTest.java
│ │ └── TestContactService.java
├── .gitignore
└── manifest.yml
├── enterprise-granny-client
├── .gitignore
├── src
│ └── main
│ │ ├── webapp
│ │ ├── WEB-INF
│ │ │ ├── views
│ │ │ │ ├── tiles
│ │ │ │ │ ├── footer.jsp
│ │ │ │ │ ├── js.jsp
│ │ │ │ │ ├── meta.jsp
│ │ │ │ │ ├── stylesheets.jsp
│ │ │ │ │ └── navbar.jsp
│ │ │ │ └── about.jsp
│ │ │ ├── layouts
│ │ │ │ ├── pjax.jsp
│ │ │ │ └── default.jsp
│ │ │ ├── tiles-defs.xml
│ │ │ ├── web.xml
│ │ │ ├── tags
│ │ │ │ └── input.tag
│ │ │ └── spring
│ │ │ │ ├── root-context.xml
│ │ │ │ └── appServlet
│ │ │ │ └── servlet-context.xml
│ │ └── resources
│ │ │ ├── img
│ │ │ ├── favicon.ico
│ │ │ ├── icon_9727.png
│ │ │ ├── ensw_granny_logo_57.png
│ │ │ ├── ensw_granny_logo_72.png
│ │ │ ├── ensw_granny_logo_114.png
│ │ │ ├── ensw_granny_logo_144.png
│ │ │ ├── ensw_granny_logo_web.png
│ │ │ └── icon_9727.svg
│ │ │ ├── js
│ │ │ ├── xbreadcrumbs.js
│ │ │ ├── html5shiv.js
│ │ │ └── respond.min.js
│ │ │ ├── fonts
│ │ │ ├── glyphicons-halflings-regular.eot
│ │ │ ├── glyphicons-halflings-regular.ttf
│ │ │ └── glyphicons-halflings-regular.woff
│ │ │ └── css
│ │ │ ├── sticky-footer-navbar.css
│ │ │ └── granny.css
│ │ ├── resources
│ │ ├── destinations
│ │ │ └── destination.properties
│ │ ├── i18n
│ │ │ └── messages.properties
│ │ └── log4j.xml
│ │ └── java
│ │ └── com
│ │ └── sap
│ │ └── hana
│ │ └── cloud
│ │ └── samples
│ │ ├── granny
│ │ └── client
│ │ │ ├── web
│ │ │ ├── formatter
│ │ │ │ ├── TitleFormatter.java
│ │ │ │ ├── SalutationFormatter.java
│ │ │ │ └── CommunicationTypeFormatter.java
│ │ │ ├── PJAXViewPreparer.java
│ │ │ └── JPAXFilter.java
│ │ │ └── AddressbookServiceFactory.java
│ │ └── grannyv
│ │ └── client
│ │ └── web
│ │ └── util
│ │ ├── ServiceExceptionMapper.java
│ │ ├── LocaleUtils.java
│ │ └── ValidationExceptionMapper.java
└── manifest.yml
├── enterprise-granny-phonelib
└── src
│ └── main
│ ├── webapp
│ ├── .gitignore
│ ├── META-INF
│ │ └── MANIFEST.MF
│ ├── index.html
│ └── WEB-INF
│ │ ├── web.xml
│ │ └── spring
│ │ ├── spring-context.xml
│ │ └── spring-context.xml.bak
│ ├── resources
│ └── META-INF
│ │ └── enunciate
│ │ ├── .gitignore
│ │ ├── docs-base.zip
│ │ └── enunciate.xml
│ └── java
│ └── com
│ └── sap
│ └── hana
│ └── cloud
│ └── samples
│ └── granny
│ └── libphonenumber
│ ├── PhoneNumberValidationResult.java
│ └── LibPhonenumberService.java
├── doc
├── 03_granny_pom.jpeg
├── 20a_12factor_app.jpg
├── 20a_DEV300_master.jpg
├── 20a_microservices.jpg
├── ensw_granny_logo_web.png
├── 08_ensw_granny8_after.png
├── 08_ensw_granny8_before.png
├── 20b_arch_blueprint_web.jpg
├── 09_granny_validation_postman.jpg
├── 05_enterprise-granny_domain_model.png
├── 09_programmable_web_growth_in_web_apis.jpg
├── 20a.md
└── 01.md
├── .gitignore
├── CREDITS
├── LICENSE
├── diagrams
└── enterprise-granny.xml
└── pom.xml
/enterprise-granny-core/.gitignore:
--------------------------------------------------------------------------------
1 | /target/
2 | /.settings/
3 |
--------------------------------------------------------------------------------
/enterprise-granny-service/src/main/webapp/.gitignore:
--------------------------------------------------------------------------------
1 | /docs
2 |
--------------------------------------------------------------------------------
/enterprise-granny-client/.gitignore:
--------------------------------------------------------------------------------
1 | /target/
2 | /.settings/
3 |
--------------------------------------------------------------------------------
/enterprise-granny-phonelib/src/main/webapp/.gitignore:
--------------------------------------------------------------------------------
1 | /docs/
2 |
--------------------------------------------------------------------------------
/enterprise-granny-service/src/main/webapp/resources/css/contact-srv.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/enterprise-granny-service/.gitignore:
--------------------------------------------------------------------------------
1 | /target/
2 | /.settings/
3 | /derby.log
4 |
--------------------------------------------------------------------------------
/enterprise-granny-service/src/main/webapp/WEB-INF/lib/.gitignore:
--------------------------------------------------------------------------------
1 | /ngdbc.jar
2 |
--------------------------------------------------------------------------------
/enterprise-granny-phonelib/src/main/resources/META-INF/enunciate/.gitignore:
--------------------------------------------------------------------------------
1 | /docs-base
2 |
--------------------------------------------------------------------------------
/enterprise-granny-service/src/main/resources/META-INF/enunciate/.gitignore:
--------------------------------------------------------------------------------
1 | /docs-base
2 |
--------------------------------------------------------------------------------
/enterprise-granny-service/src/main/webapp/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Class-Path:
3 |
4 |
--------------------------------------------------------------------------------
/doc/03_granny_pom.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SAP-archive/cloud-enterprise-granny/HEAD/doc/03_granny_pom.jpeg
--------------------------------------------------------------------------------
/enterprise-granny-client/src/main/webapp/WEB-INF/views/tiles/footer.jsp:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/enterprise-granny-phonelib/src/main/webapp/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Class-Path:
3 |
4 |
--------------------------------------------------------------------------------
/doc/20a_12factor_app.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SAP-archive/cloud-enterprise-granny/HEAD/doc/20a_12factor_app.jpg
--------------------------------------------------------------------------------
/doc/20a_DEV300_master.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SAP-archive/cloud-enterprise-granny/HEAD/doc/20a_DEV300_master.jpg
--------------------------------------------------------------------------------
/doc/20a_microservices.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SAP-archive/cloud-enterprise-granny/HEAD/doc/20a_microservices.jpg
--------------------------------------------------------------------------------
/doc/ensw_granny_logo_web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SAP-archive/cloud-enterprise-granny/HEAD/doc/ensw_granny_logo_web.png
--------------------------------------------------------------------------------
/doc/08_ensw_granny8_after.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SAP-archive/cloud-enterprise-granny/HEAD/doc/08_ensw_granny8_after.png
--------------------------------------------------------------------------------
/doc/08_ensw_granny8_before.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SAP-archive/cloud-enterprise-granny/HEAD/doc/08_ensw_granny8_before.png
--------------------------------------------------------------------------------
/doc/20b_arch_blueprint_web.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SAP-archive/cloud-enterprise-granny/HEAD/doc/20b_arch_blueprint_web.jpg
--------------------------------------------------------------------------------
/doc/09_granny_validation_postman.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SAP-archive/cloud-enterprise-granny/HEAD/doc/09_granny_validation_postman.jpg
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /bin
2 | /war
3 | *.DS_Store
4 | /target
5 | /build
6 | .project
7 | .classpath
8 | /.settings
9 | /derby.log
10 | *.sw[o|p]
11 |
--------------------------------------------------------------------------------
/doc/05_enterprise-granny_domain_model.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SAP-archive/cloud-enterprise-granny/HEAD/doc/05_enterprise-granny_domain_model.png
--------------------------------------------------------------------------------
/doc/09_programmable_web_growth_in_web_apis.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SAP-archive/cloud-enterprise-granny/HEAD/doc/09_programmable_web_growth_in_web_apis.jpg
--------------------------------------------------------------------------------
/enterprise-granny-service/src/main/resources/sql/dropSchema.sql:
--------------------------------------------------------------------------------
1 | DROP TABLE "GRANNY_ADDRESS";
2 | DROP TABLE "GRANNY_EMAIL";
3 | DROP TABLE "GRANNY_PHONE";
4 | DROP TABLE "GRANNY_CONTACT";
--------------------------------------------------------------------------------
/enterprise-granny-client/src/main/webapp/resources/img/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SAP-archive/cloud-enterprise-granny/HEAD/enterprise-granny-client/src/main/webapp/resources/img/favicon.ico
--------------------------------------------------------------------------------
/enterprise-granny-client/src/main/webapp/resources/img/icon_9727.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SAP-archive/cloud-enterprise-granny/HEAD/enterprise-granny-client/src/main/webapp/resources/img/icon_9727.png
--------------------------------------------------------------------------------
/enterprise-granny-service/src/main/webapp/resources/img/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SAP-archive/cloud-enterprise-granny/HEAD/enterprise-granny-service/src/main/webapp/resources/img/favicon.ico
--------------------------------------------------------------------------------
/enterprise-granny-client/src/main/webapp/resources/js/xbreadcrumbs.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SAP-archive/cloud-enterprise-granny/HEAD/enterprise-granny-client/src/main/webapp/resources/js/xbreadcrumbs.js
--------------------------------------------------------------------------------
/enterprise-granny-service/src/main/webapp/resources/img/icon_9727.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SAP-archive/cloud-enterprise-granny/HEAD/enterprise-granny-service/src/main/webapp/resources/img/icon_9727.png
--------------------------------------------------------------------------------
/enterprise-granny-client/src/main/webapp/resources/img/ensw_granny_logo_57.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SAP-archive/cloud-enterprise-granny/HEAD/enterprise-granny-client/src/main/webapp/resources/img/ensw_granny_logo_57.png
--------------------------------------------------------------------------------
/enterprise-granny-client/src/main/webapp/resources/img/ensw_granny_logo_72.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SAP-archive/cloud-enterprise-granny/HEAD/enterprise-granny-client/src/main/webapp/resources/img/ensw_granny_logo_72.png
--------------------------------------------------------------------------------
/enterprise-granny-phonelib/src/main/resources/META-INF/enunciate/docs-base.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SAP-archive/cloud-enterprise-granny/HEAD/enterprise-granny-phonelib/src/main/resources/META-INF/enunciate/docs-base.zip
--------------------------------------------------------------------------------
/enterprise-granny-service/src/main/resources/META-INF/enunciate/docs-base.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SAP-archive/cloud-enterprise-granny/HEAD/enterprise-granny-service/src/main/resources/META-INF/enunciate/docs-base.zip
--------------------------------------------------------------------------------
/enterprise-granny-client/src/main/webapp/resources/img/ensw_granny_logo_114.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SAP-archive/cloud-enterprise-granny/HEAD/enterprise-granny-client/src/main/webapp/resources/img/ensw_granny_logo_114.png
--------------------------------------------------------------------------------
/enterprise-granny-client/src/main/webapp/resources/img/ensw_granny_logo_144.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SAP-archive/cloud-enterprise-granny/HEAD/enterprise-granny-client/src/main/webapp/resources/img/ensw_granny_logo_144.png
--------------------------------------------------------------------------------
/enterprise-granny-client/src/main/webapp/resources/img/ensw_granny_logo_web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SAP-archive/cloud-enterprise-granny/HEAD/enterprise-granny-client/src/main/webapp/resources/img/ensw_granny_logo_web.png
--------------------------------------------------------------------------------
/enterprise-granny-service/src/main/webapp/resources/img/ensw_granny_logo_114.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SAP-archive/cloud-enterprise-granny/HEAD/enterprise-granny-service/src/main/webapp/resources/img/ensw_granny_logo_114.png
--------------------------------------------------------------------------------
/enterprise-granny-service/src/main/webapp/resources/img/ensw_granny_logo_144.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SAP-archive/cloud-enterprise-granny/HEAD/enterprise-granny-service/src/main/webapp/resources/img/ensw_granny_logo_144.png
--------------------------------------------------------------------------------
/enterprise-granny-service/src/main/webapp/resources/img/ensw_granny_logo_57.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SAP-archive/cloud-enterprise-granny/HEAD/enterprise-granny-service/src/main/webapp/resources/img/ensw_granny_logo_57.png
--------------------------------------------------------------------------------
/enterprise-granny-service/src/main/webapp/resources/img/ensw_granny_logo_72.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SAP-archive/cloud-enterprise-granny/HEAD/enterprise-granny-service/src/main/webapp/resources/img/ensw_granny_logo_72.png
--------------------------------------------------------------------------------
/enterprise-granny-service/src/main/webapp/resources/img/ensw_granny_logo_web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SAP-archive/cloud-enterprise-granny/HEAD/enterprise-granny-service/src/main/webapp/resources/img/ensw_granny_logo_web.png
--------------------------------------------------------------------------------
/enterprise-granny-service/src/main/java/com/sap/hana/cloud/samples/granny/api/impl/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * We should really have something meaningful to say here...
3 | */
4 | package com.sap.hana.cloud.samples.granny.api.impl;
5 |
--------------------------------------------------------------------------------
/enterprise-granny-client/src/main/webapp/resources/fonts/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SAP-archive/cloud-enterprise-granny/HEAD/enterprise-granny-client/src/main/webapp/resources/fonts/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/enterprise-granny-client/src/main/webapp/resources/fonts/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SAP-archive/cloud-enterprise-granny/HEAD/enterprise-granny-client/src/main/webapp/resources/fonts/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/enterprise-granny-client/src/main/webapp/resources/fonts/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SAP-archive/cloud-enterprise-granny/HEAD/enterprise-granny-client/src/main/webapp/resources/fonts/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/enterprise-granny-client/src/main/resources/destinations/destination.properties:
--------------------------------------------------------------------------------
1 | Name=Addressbook-Service
2 | URL=http\://localhost\:8080/api/v1
3 | ProxyType=Internet
4 | Type=HTTP
5 | Authentication=NoAuthentication
6 | Description=The URL address of the Adressbook-Service
7 |
--------------------------------------------------------------------------------
/enterprise-granny-core/src/main/java/com/sap/hana/cloud/samples/granny/model/package-info.java:
--------------------------------------------------------------------------------
1 | @XmlSchema (namespace = "http://api.enterprise-granny.samples.cloud.sap.com/model")
2 | package com.sap.hana.cloud.samples.granny.model;
3 |
4 | import javax.xml.bind.annotation.XmlSchema;
--------------------------------------------------------------------------------
/enterprise-granny-client/src/main/webapp/WEB-INF/layouts/pjax.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
2 | <%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
3 |
4 |
5 |
--------------------------------------------------------------------------------
/enterprise-granny-phonelib/src/main/webapp/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Granny's Addressbook Service
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/enterprise-granny-service/src/main/java/com/sap/hana/cloud/samples/granny/api/impl/BaseFacade.java:
--------------------------------------------------------------------------------
1 | package com.sap.hana.cloud.samples.granny.api.impl;
2 |
3 | /**
4 | * Abstract base class for all facades.
5 | *
6 | */
7 | public abstract class BaseFacade
8 | {
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/enterprise-granny-service/src/main/webapp/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Granny's Addressbook Service
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/enterprise-granny-service/manifest.yml:
--------------------------------------------------------------------------------
1 | ---
2 | applications:
3 | - name: enterprise-granny-${random-word}
4 | memory: 512M
5 | instances: 1
6 | host: enterprise-granny
7 | path: target/ROOT.war
8 | services:
9 | - hana
10 | env:
11 | SPRING_PROFILES_DEFAULT: cloud
12 |
--------------------------------------------------------------------------------
/enterprise-granny-client/manifest.yml:
--------------------------------------------------------------------------------
1 | ---
2 | applications:
3 | - name: enterprise-granny-client-${random-word}
4 | memory: 512M
5 | instances: 1
6 | host: enterprise-granny-client
7 | path: target/client.war
8 | services:
9 | - hana
10 | env:
11 | SPRING_PROFILES_DEFAULT: cloud
12 |
--------------------------------------------------------------------------------
/enterprise-granny-service/src/main/resources/destinations/destination.properties:
--------------------------------------------------------------------------------
1 | Name=PhoneNumber-Service
2 | URL=http\://localhost\:8080/phonelib/api/v1/phone?phonenumber={phonenumber}®ion={region}
3 | ProxyType=Internet
4 | Type=HTTP
5 | Authentication=NoAuthentication
6 | Description=The URL address of the PhoneNumber-Service
7 |
--------------------------------------------------------------------------------
/enterprise-granny-service/src/main/resources/db/db.changelog.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/enterprise-granny-service/src/main/java/com/osintegrators/example/AddressRepository.java:
--------------------------------------------------------------------------------
1 | package com.osintegrators.example;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.data.repository.CrudRepository;
6 |
7 | /**
8 | * @deprecated please use {@link com.sap.hana.cloud.samples.granny.dao.ContactRepository} instead
9 | */
10 | public interface AddressRepository extends CrudRepository {
11 |
12 | List findAll();
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/enterprise-granny-service/src/test/resources/com/osintegrators/example/TestAddressService-context.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/enterprise-granny-client/src/main/webapp/WEB-INF/views/tiles/js.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1" %>
2 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
3 |
4 |
5 | ">
6 |
7 |
8 | ">
9 |
10 |
11 | ">
12 |
--------------------------------------------------------------------------------
/enterprise-granny-service/src/main/java/com/osintegrators/example/AddressService.java:
--------------------------------------------------------------------------------
1 | package com.osintegrators.example;
2 |
3 | import java.util.List;
4 |
5 | import com.osintegrators.example.Address;
6 |
7 | /**
8 | * @deprecated please use {@link com.sap.hana.cloud.samples.granny.srv.ContactService} instead
9 | */
10 | public interface AddressService {
11 |
12 | void createAddress(Address add);
13 |
14 | void deleteAddress(Address add);
15 |
16 | List getAllAddresses();
17 |
18 | Address getAddressById(Long id);
19 |
20 | void updateAddress(Address address);
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/enterprise-granny-service/src/main/java/com/sap/hana/cloud/samples/granny/dao/PhoneNumberValidationDAO.java:
--------------------------------------------------------------------------------
1 | package com.sap.hana.cloud.samples.granny.dao;
2 |
3 | /**
4 | * Service for validating & formatting phone numbers.
5 | */
6 | public interface PhoneNumberValidationDAO
7 | {
8 | /**
9 | * Validates the specified phone number taking into account the specified region code.
10 | *
11 | * @param phoneNumber The phone number to validate
12 | * @param region Region Code string using ISO 3166-1 two-letter country-code format in upper-case.
13 | * @return The validation result
14 | */
15 | public PhoneNumberValidationResult validatePhoneNumber(String phoneNumber, String region);
16 | }
17 |
--------------------------------------------------------------------------------
/enterprise-granny-core/src/test/resources/json/donald.duck.json:
--------------------------------------------------------------------------------
1 | {
2 | "salutation": "MR",
3 | "firstName": "Donald",
4 | "lastName": "Duck",
5 | "addresses": [
6 | {
7 | "street": "3111 World Dr",
8 | "street2":"c/o Walt Disney World",
9 | "city": "Orlando",
10 | "zipCode": "32830",
11 | "country": "US"
12 | }
13 | ],
14 | "phoneNumbers": [
15 | {
16 | "number": "+1 407 824-4321"
17 | }
18 | ],
19 | "emailAddresses": [
20 | {
21 | "email": "donald.duck@disney.com"
22 | }
23 | ]
24 | }
--------------------------------------------------------------------------------
/enterprise-granny-core/src/main/java/com/sap/hana/cloud/samples/granny/model/Title.java:
--------------------------------------------------------------------------------
1 | package com.sap.hana.cloud.samples.granny.model;
2 |
3 | /**
4 | * The title of a {@link Contact}.
5 | */
6 | public enum Title
7 | {
8 | DR("model.title.dr"),
9 | PROF("model.title.prof");
10 |
11 | /**
12 | * The I18N message key to be used.
13 | */
14 | private final String key;
15 |
16 | /**
17 | * Creates a new {@link Title} entity with the specified I18N key.
18 | *
19 | * @param key The I18N message key to be used
20 | */
21 | private Title(String key)
22 | {
23 | this.key = key;
24 | }
25 |
26 | /**
27 | * Returns the I18N key for this object.
28 | *
29 | * @return The I18N key for this object
30 | */
31 | public String getKey()
32 | {
33 | return this.key;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/enterprise-granny-service/src/main/java/com/sap/hana/cloud/samples/granny/xcc/validations/ValidPhoneNumber.java:
--------------------------------------------------------------------------------
1 | package com.sap.hana.cloud.samples.granny.xcc.validations;
2 |
3 | import java.lang.annotation.Documented;
4 | import java.lang.annotation.ElementType;
5 | import java.lang.annotation.Retention;
6 | import java.lang.annotation.RetentionPolicy;
7 | import java.lang.annotation.Target;
8 |
9 | import javax.validation.Constraint;
10 | import javax.validation.Payload;
11 |
12 | @Target({ElementType.FIELD, ElementType.ANNOTATION_TYPE})
13 | @Constraint(validatedBy = ValidPhoneNumberValidator.class)
14 | @Retention(RetentionPolicy.RUNTIME)
15 | @Documented
16 | public @interface ValidPhoneNumber
17 | {
18 | String message() default "phone_numer.number.validity.error";
19 |
20 | Class>[] groups() default {};
21 |
22 | Class extends Payload>[] payload() default {};
23 | }
24 |
--------------------------------------------------------------------------------
/enterprise-granny-core/src/main/java/com/sap/hana/cloud/samples/granny/model/AddressType.java:
--------------------------------------------------------------------------------
1 | package com.sap.hana.cloud.samples.granny.model;
2 |
3 | /**
4 | * The type of the {@link Address}.
5 | */
6 | public enum AddressType
7 | {
8 | PRIVATE("model.address_type.private"),
9 | WORK("model.address_type.work");
10 |
11 | /**
12 | * The I18N message key to be used.
13 | */
14 | private final String key;
15 |
16 | /**
17 | * Creates a new {@link AddressType} entity with the specified I18N key.
18 | *
19 | * @param key The I18N message key to be used
20 | */
21 | private AddressType(String key)
22 | {
23 | this.key = key;
24 | }
25 |
26 | /**
27 | * Returns the I18N key for this object.
28 | *
29 | * @return The I18N key for this object
30 | */
31 | public String getKey()
32 | {
33 | return this.key;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/enterprise-granny-client/src/main/webapp/resources/css/sticky-footer-navbar.css:
--------------------------------------------------------------------------------
1 | /* Sticky footer styles
2 | -------------------------------------------------- */
3 | html {
4 | position: relative;
5 | min-height: 100%;
6 | }
7 | body {
8 | /* Margin bottom by footer height */
9 | margin-bottom: 60px;
10 | }
11 | #footer {
12 | position: absolute;
13 | bottom: 0;
14 | width: 100%;
15 | /* Set the fixed height of the footer here */
16 | height: 60px;
17 | background-color: #f5f5f5;
18 | }
19 |
20 |
21 | /* Custom page CSS
22 | -------------------------------------------------- */
23 | /* Not required for template or sticky footer method. */
24 |
25 | body > .container {
26 | padding: 60px 15px 0;
27 | }
28 | .container .text-muted {
29 | margin: 20px 0;
30 | }
31 |
32 | #footer > .container {
33 | padding-right: 15px;
34 | padding-left: 15px;
35 | }
36 |
37 | code {
38 | font-size: 80%;
39 | }
40 |
--------------------------------------------------------------------------------
/enterprise-granny-client/src/main/webapp/WEB-INF/layouts/default.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
2 | <%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
3 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
4 | <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/enterprise-granny-core/src/main/java/com/sap/hana/cloud/samples/granny/model/CommunicationType.java:
--------------------------------------------------------------------------------
1 | package com.sap.hana.cloud.samples.granny.model;
2 |
3 | /**
4 | * The communication type.
5 | */
6 | public enum CommunicationType
7 | {
8 | HOME("model.communication_type.home"),
9 | WORK("model.communication_type.work"),
10 | CELL("model.communication_type.cell");
11 |
12 | /**
13 | * The I18N message key to be used.
14 | */
15 | private final String key;
16 |
17 | /**
18 | * Creates a new {@link CommunicationType} entity with the specified I18N key.
19 | *
20 | * @param key The I18N message key to be used
21 | */
22 | private CommunicationType(String key)
23 | {
24 | this.key = key;
25 | }
26 |
27 | /**
28 | * Returns the I18N key for this object.
29 | *
30 | * @return The I18N key for this object
31 | */
32 | public String getKey()
33 | {
34 | return this.key;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/enterprise-granny-client/src/main/webapp/WEB-INF/views/tiles/meta.jsp:
--------------------------------------------------------------------------------
1 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | ">
10 | ">
11 | ">
12 | ">
13 | ">
14 |
15 |
--------------------------------------------------------------------------------
/enterprise-granny-client/src/main/java/com/sap/hana/cloud/samples/granny/client/web/formatter/TitleFormatter.java:
--------------------------------------------------------------------------------
1 | package com.sap.hana.cloud.samples.granny.client.web.formatter;
2 |
3 | import java.util.Locale;
4 |
5 | import javax.annotation.Resource;
6 |
7 | import org.springframework.context.MessageSource;
8 | import org.springframework.expression.ParseException;
9 | import org.springframework.format.Formatter;
10 |
11 | import com.sap.hana.cloud.samples.granny.model.Title;
12 |
13 |
14 | public class TitleFormatter implements Formatter
15 | {
16 |
17 | @Resource
18 | private MessageSource messageSource;
19 |
20 | @Override
21 | public String print(Title title, Locale locale)
22 | {
23 | return messageSource.getMessage(title.getKey(), null, title.name(), locale);
24 | }
25 |
26 | @Override
27 | public Title parse(String text, Locale locale) throws ParseException
28 | {
29 | return Title.valueOf(text.toUpperCase());
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/enterprise-granny-service/src/main/java/com/sap/hana/cloud/samples/granny/srv/BaseService.java:
--------------------------------------------------------------------------------
1 | package com.sap.hana.cloud.samples.granny.srv;
2 |
3 |
4 | /**
5 | * Abstract base class for all services.
6 | *
7 | */
8 | public abstract class BaseService
9 | {
10 | /**
11 | * Creates an enclosing {@link ServiceException} for the specified {@link Exception} or
12 | * propagates it directly if the specified {@link Exception} is an instance of
13 | * {@link ServiceException}.
14 | *
15 | * @param ex The {@link Exception} to handle
16 | * @throws ServiceException The {@link ServiceException}
17 | */
18 | protected void handleException(Exception ex) throws ServiceException
19 | {
20 |
21 | // final Logger logger = LoggerFactory.getLogger(this.getClass());
22 |
23 | if (ex instanceof ServiceException)
24 | {
25 | throw (ServiceException) ex;
26 | }
27 | else
28 | {
29 | ServiceException up = new ServiceException(ex);
30 | throw up;
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/enterprise-granny-client/src/main/webapp/WEB-INF/views/tiles/stylesheets.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1" %>
2 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
15 |
16 |
17 | " />
18 |
19 |
20 |
--------------------------------------------------------------------------------
/enterprise-granny-core/src/main/java/com/sap/hana/cloud/samples/granny/model/Salutation.java:
--------------------------------------------------------------------------------
1 | package com.sap.hana.cloud.samples.granny.model;
2 |
3 | /**
4 | * The salutation of a {@link Contact}.
5 | */
6 | public enum Salutation
7 | {
8 | // Ladies first! ;)
9 | MS("model.salutation.ms"),
10 | MISSES("model.salutation.misses"),
11 | MRS("model.salutation.mrs"),
12 | MR("model.salutation.mr"),
13 | FAMILY("model.salutation.family");
14 |
15 | /**
16 | * The I18N message key to be used.
17 | */
18 | private final String key;
19 |
20 | /**
21 | * Creates a new {@link Salutation} entity with the specified I18N key.
22 | *
23 | * @param key The I18N message key to be used
24 | */
25 | private Salutation(String key)
26 | {
27 | this.key = key;
28 | }
29 |
30 | /**
31 | * Returns the I18N key for this object.
32 | *
33 | * @return The I18N key for this object
34 | */
35 | public String getKey()
36 | {
37 | return this.key;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/enterprise-granny-client/src/main/java/com/sap/hana/cloud/samples/granny/client/web/formatter/SalutationFormatter.java:
--------------------------------------------------------------------------------
1 | package com.sap.hana.cloud.samples.granny.client.web.formatter;
2 |
3 | import java.util.Locale;
4 |
5 | import javax.annotation.Resource;
6 |
7 | import org.springframework.context.MessageSource;
8 | import org.springframework.expression.ParseException;
9 | import org.springframework.format.Formatter;
10 |
11 | import com.sap.hana.cloud.samples.granny.model.Salutation;
12 |
13 |
14 | public class SalutationFormatter implements Formatter
15 | {
16 |
17 | @Resource
18 | private MessageSource messageSource;
19 |
20 | @Override
21 | public String print(Salutation salutation, Locale locale)
22 | {
23 | return messageSource.getMessage(salutation.getKey(), null, salutation.name(), locale);
24 | }
25 |
26 | @Override
27 | public Salutation parse(String text, Locale locale) throws ParseException
28 | {
29 | return Salutation.valueOf(text.toUpperCase());
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/enterprise-granny-service/src/main/java/com/sap/hana/cloud/samples/granny/dao/ContactDAO.java:
--------------------------------------------------------------------------------
1 | package com.sap.hana.cloud.samples.granny.dao;
2 |
3 | import java.util.List;
4 |
5 | import com.sap.hana.cloud.samples.granny.model.Contact;
6 |
7 | /**
8 | * Interface describing the life-cycle operations (e.g. CRUD operations) for {@link Contact} objects.
9 | */
10 | public interface ContactDAO
11 | {
12 |
13 | public List findAll();
14 |
15 | public Contact save(Contact entity);
16 |
17 | public Iterable save(Iterable extends Contact> entities);
18 |
19 | public Contact findOne(String id);
20 |
21 |
22 | public boolean exists(String id);
23 |
24 |
25 | public long count();
26 |
27 |
28 | public void delete(String id);
29 |
30 |
31 | public void delete(Contact entity);
32 |
33 |
34 | public void delete(Iterable extends Contact> entities);
35 |
36 |
37 | public void deleteAll();
38 |
39 | public List findByAddressesCountry(String country);
40 | }
41 |
--------------------------------------------------------------------------------
/enterprise-granny-service/src/main/resources/db/multitenancy.changelog.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/enterprise-granny-client/src/main/java/com/sap/hana/cloud/samples/granny/client/web/PJAXViewPreparer.java:
--------------------------------------------------------------------------------
1 | package com.sap.hana.cloud.samples.granny.client.web;
2 |
3 | import org.apache.tiles.Attribute;
4 | import org.apache.tiles.AttributeContext;
5 | import org.apache.tiles.context.TilesRequestContext;
6 | import org.apache.tiles.preparer.PreparerException;
7 | import org.apache.tiles.preparer.ViewPreparer;
8 |
9 | public class PJAXViewPreparer implements ViewPreparer
10 | {
11 |
12 | public void execute(TilesRequestContext tilesContext, AttributeContext attributeContext) throws PreparerException
13 | {
14 | if (tilesContext.getHeader().containsKey("x-pjax"))
15 | {
16 | Attribute template = attributeContext.getTemplateAttribute();
17 |
18 | String templatePath = (String) template.getValue();
19 | templatePath = templatePath.replace("default", "pjax");
20 |
21 | template.setValue(templatePath);
22 |
23 | attributeContext.setTemplateAttribute(template);
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/enterprise-granny-client/src/main/resources/i18n/messages.properties:
--------------------------------------------------------------------------------
1 | model.address_type.private = Private
2 | model.address_type.work = Work
3 |
4 | model.communication_type.home = Home
5 | model.communication_type.work = Work
6 | model.communication_type.cell = Mobile
7 |
8 | model.salutation.ms = Ms.
9 | model.salutation.misses = Misses
10 | model.salutation.mrs = Mrs.
11 | model.salutation.mr = Mr.
12 | model.salutation.family = Family
13 |
14 | model.title.dr = Dr.
15 | model.title.prof = Prof.
16 |
17 | # generic domain model object attributes
18 | model.object.id.not_null.error = ID may not be NULL!
19 |
20 | # email
21 | model.email_address.email.pattern.error = This does not seem to be a valid email address! Typo?
22 |
23 | # phone number
24 | model.phone_numer.number.validity.error = Seems to be an invalid phone number!
25 |
26 | # validation messages
27 | phone_numer.number.validity.error = Seems to be an invalid phone number!
28 |
29 | api.data_validation.max_length.error = The maximum length is {max} characters!
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/enterprise-granny-service/src/main/java/com/sap/hana/cloud/samples/granny/dao/PhoneNumberValidationResult.java:
--------------------------------------------------------------------------------
1 | package com.sap.hana.cloud.samples.granny.dao;
2 |
3 | import java.io.Serializable;
4 |
5 | public class PhoneNumberValidationResult implements Serializable
6 | {
7 |
8 | private static final long serialVersionUID = 1L;
9 |
10 | boolean valid = false;
11 |
12 | String type = null;
13 | String number = null;
14 | String carrier = null;
15 |
16 | public boolean isValid()
17 | {
18 | return valid;
19 | }
20 | public void setValid(boolean valid)
21 | {
22 | this.valid = valid;
23 | }
24 | public String getType()
25 | {
26 | return type;
27 | }
28 | public void setType(String type)
29 | {
30 | this.type = type;
31 | }
32 | public String getNumber()
33 | {
34 | return number;
35 | }
36 | public void setNumber(String number)
37 | {
38 | this.number = number;
39 | }
40 | public String getCarrier()
41 | {
42 | return carrier;
43 | }
44 | public void setCarrier(String carrier)
45 | {
46 | this.carrier = carrier;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/enterprise-granny-service/src/main/resources/i18n/messages.properties:
--------------------------------------------------------------------------------
1 | model.address_type.private = Private
2 | model.address_type.work = Work
3 |
4 | model.communication_type.home = Home
5 | model.communication_type.work = Work
6 | model.communication_type.cell = Mobile
7 |
8 | model.salutation.ms = Ms.
9 | model.salutation.misses = Misses
10 | model.salutation.mrs = Mrs.
11 | model.salutation.mr = Mr.
12 | model.salutation.family = Family
13 |
14 | model.title.dr = Dr.
15 | model.title.prof = Prof.
16 |
17 | # generic domain model object attributes
18 | model.object.id.not_null.error = ID may not be NULL!
19 |
20 | # email
21 | model.email_address.email.pattern.error = This does not seem to be a valid email address! Typo?
22 |
23 | # phone number
24 | model.phone_numer.number.validity.error = Seems to be an invalid phone number!
25 |
26 | # validation messages
27 | phone_numer.number.validity.error = Seems to be an invalid phone number!
28 |
29 | api.data_validation.max_length.error = The maximum length is {max} characters!
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/enterprise-granny-client/src/main/java/com/sap/hana/cloud/samples/granny/client/web/formatter/CommunicationTypeFormatter.java:
--------------------------------------------------------------------------------
1 | package com.sap.hana.cloud.samples.granny.client.web.formatter;
2 |
3 | import java.util.Locale;
4 |
5 | import javax.annotation.Resource;
6 |
7 | import org.springframework.context.MessageSource;
8 | import org.springframework.expression.ParseException;
9 | import org.springframework.format.Formatter;
10 |
11 | import com.sap.hana.cloud.samples.granny.model.CommunicationType;
12 |
13 | public class CommunicationTypeFormatter implements Formatter
14 | {
15 |
16 | @Resource
17 | private MessageSource messageSource;
18 |
19 | @Override
20 | public String print(CommunicationType commType, Locale locale)
21 | {
22 | return messageSource.getMessage(commType.getKey(), null, commType.name(), locale);
23 | }
24 |
25 | @Override
26 | public CommunicationType parse(String text, Locale locale) throws ParseException
27 | {
28 | return CommunicationType.valueOf(text.toUpperCase());
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/enterprise-granny-phonelib/src/main/java/com/sap/hana/cloud/samples/granny/libphonenumber/PhoneNumberValidationResult.java:
--------------------------------------------------------------------------------
1 | package com.sap.hana.cloud.samples.granny.libphonenumber;
2 |
3 | import java.io.Serializable;
4 |
5 | public class PhoneNumberValidationResult implements Serializable
6 | {
7 |
8 | private static final long serialVersionUID = 1L;
9 |
10 | boolean valid = false;
11 |
12 | String type = null;
13 | String number = null;
14 | String carrier = null;
15 |
16 | public boolean isValid()
17 | {
18 | return valid;
19 | }
20 | public void setValid(boolean valid)
21 | {
22 | this.valid = valid;
23 | }
24 | public String getType()
25 | {
26 | return type;
27 | }
28 | public void setType(String type)
29 | {
30 | this.type = type;
31 | }
32 | public String getNumber()
33 | {
34 | return number;
35 | }
36 | public void setNumber(String number)
37 | {
38 | this.number = number;
39 | }
40 | public String getCarrier()
41 | {
42 | return carrier;
43 | }
44 | public void setCarrier(String carrier)
45 | {
46 | this.carrier = carrier;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/enterprise-granny-service/src/main/java/com/osintegrators/example/AddressServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.osintegrators.example;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.stereotype.Service;
7 |
8 | import com.osintegrators.example.Address;
9 |
10 | /**
11 | * @deprecated please use {@link com.sap.hana.cloud.samples.granny.srv.ContactServiceImpl} instead
12 | */
13 | @Service
14 | public class AddressServiceImpl implements AddressService {
15 |
16 | @Autowired
17 | AddressRepository addressRepository;
18 |
19 | public void createAddress(Address address) {
20 | addressRepository.save(address);
21 | }
22 |
23 | public List getAllAddresses() {
24 | return addressRepository.findAll();
25 |
26 | }
27 |
28 | public void deleteAddress(Address address) {
29 | addressRepository.delete(address);
30 | }
31 |
32 | public Address getAddressById(Long id) {
33 | return addressRepository.findOne(id);
34 | }
35 |
36 | public void updateAddress(Address address) {
37 | addressRepository.save(address);
38 |
39 | }
40 |
41 | }
--------------------------------------------------------------------------------
/enterprise-granny-client/src/main/webapp/resources/css/granny.css:
--------------------------------------------------------------------------------
1 |
2 | /*
3 | * navbar
4 | */
5 | body
6 | {
7 | padding-top: 15px;
8 | }
9 |
10 | .navbar
11 | {
12 | margin-bottom: 15px;
13 | }
14 |
15 | @media (min-width: 768px)
16 | {
17 | body
18 | {
19 | padding-top: 30px;
20 | }
21 |
22 | .navbar
23 | {
24 | margin-bottom: 30px;
25 | }
26 |
27 | .navbar-nav>li>a
28 | {
29 | padding-top: 20px;
30 | padding-bottom: 15px;
31 | }
32 |
33 | }
34 |
35 | h1,
36 | .h1 {
37 | font-size: 20px;
38 | }
39 |
40 | h2,
41 | .h2 {
42 | font-size: 18px;
43 | }
44 |
45 | h3,
46 | .h3 {
47 | font-size: 16px;
48 | }
49 |
50 | h4,
51 | .h4 {
52 | font-size: 14px;
53 | }
54 |
55 | h5,
56 | .h5 {
57 | font-size: 12px;
58 | }
59 |
60 | h6,
61 | .h6 {
62 | font-size: 10px;
63 | }
64 |
65 | .navbar-brand
66 | {
67 | font-family: 'Pacifico', cursive;
68 | font-weight: 200;
69 | font-size: 200%;
70 | }
71 |
72 | @media(max-width:767px)
73 | {
74 | .navbar-brand
75 | {
76 | font-family: 'Pacifico', cursive;
77 | font-weight: 200;
78 | font-size: 150%;
79 | }
80 | }
--------------------------------------------------------------------------------
/enterprise-granny-service/src/main/resources/META-INF/persistence.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 | org.eclipse.persistence.jpa.PersistenceProvider
9 |
10 | com.sap.hana.cloud.samples.granny.model.BaseObject
11 | com.sap.hana.cloud.samples.granny.model.Address
12 | com.sap.hana.cloud.samples.granny.model.Contact
13 | com.sap.hana.cloud.samples.granny.model.EmailAddress
14 | com.sap.hana.cloud.samples.granny.model.PhoneNumber
15 |
16 | true
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/enterprise-granny-core/src/main/java/com/sap/hana/cloud/samples/granny/srv/DataValidationException.java:
--------------------------------------------------------------------------------
1 | package com.sap.hana.cloud.samples.granny.srv;
2 |
3 | import java.util.Arrays;
4 |
5 | import javax.validation.ConstraintViolationException;
6 |
7 | import com.sap.hana.cloud.samples.granny.model.StatusMessage;
8 | import com.sap.hana.cloud.samples.granny.model.ValidationError;
9 | import com.sap.hana.cloud.samples.granny.util.ConstraintViolationMapper;
10 |
11 | /**
12 | * {@link RuntimeException} used by the service layer.
13 | */
14 | public class DataValidationException extends ServiceException
15 | {
16 |
17 | /**
18 | * The serialVersionUID of this class.
19 | */
20 | private static final long serialVersionUID = 1L;
21 |
22 | public DataValidationException(ConstraintViolationException arg0)
23 | {
24 | super(arg0);
25 | this.msg = ConstraintViolationMapper.getDefaultStatusMessage();
26 | }
27 |
28 | public DataValidationException(ValidationError... errors)
29 | {
30 | super();
31 | this.msg = ConstraintViolationMapper.getDefaultStatusMessage();
32 | this.msg.setErrors(Arrays.asList(errors));
33 | }
34 |
35 |
36 | public StatusMessage getStatusMessage()
37 | {
38 | return this.msg;
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/enterprise-granny-service/src/test/resources/log4j.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/enterprise-granny-client/src/main/webapp/WEB-INF/views/tiles/navbar.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
2 | <%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %>
3 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
4 |
5 |
6 |
14 |
15 |
16 | - " data-pjax>About
17 |
18 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/enterprise-granny-core/src/main/java/com/sap/hana/cloud/samples/granny/srv/ServiceException.java:
--------------------------------------------------------------------------------
1 | package com.sap.hana.cloud.samples.granny.srv;
2 |
3 | import com.sap.hana.cloud.samples.granny.model.StatusMessage;
4 |
5 | /**
6 | * {@link RuntimeException} used by the service layer.
7 | */
8 | public class ServiceException extends RuntimeException
9 | {
10 |
11 | /**
12 | * The serialVersionUID of this class.
13 | */
14 | private static final long serialVersionUID = 1L;
15 |
16 | StatusMessage msg = null;
17 |
18 | public ServiceException()
19 | {
20 | super();
21 | msg = new StatusMessage();
22 | }
23 |
24 | public ServiceException(String arg0)
25 | {
26 | super(arg0);
27 | msg = new StatusMessage();
28 | msg.setMessage(arg0);
29 | }
30 |
31 | public ServiceException(Throwable arg0)
32 | {
33 | super(arg0);
34 | msg = new StatusMessage();
35 | msg.setDescription(arg0.getMessage());
36 | }
37 |
38 | public ServiceException(String arg0, Throwable arg1)
39 | {
40 | super(arg0, arg1);
41 | msg = new StatusMessage();
42 | msg.setMessage(arg0);
43 | }
44 |
45 | public ServiceException(StatusMessage msg)
46 | {
47 | super();
48 | this.msg = msg;
49 | }
50 |
51 | public StatusMessage getStatusMessage()
52 | {
53 | return this.msg;
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/enterprise-granny-client/src/main/resources/log4j.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/enterprise-granny-core/src/main/java/com/sap/hana/cloud/samples/granny/model/PhoneNumber.java:
--------------------------------------------------------------------------------
1 | package com.sap.hana.cloud.samples.granny.model;
2 |
3 | import java.io.Serializable;
4 |
5 | import javax.validation.constraints.Size;
6 |
7 | import org.apache.commons.lang3.builder.ToStringBuilder;
8 |
9 | /**
10 | * The phone number of a {@link Contact}.
11 | */
12 | public class PhoneNumber extends BaseObject implements Serializable
13 | {
14 | /**
15 | * The serialVersionUID of the class.
16 | */
17 | private static final long serialVersionUID = 1L;
18 |
19 | protected CommunicationType type = null;
20 |
21 | @Size(max = 30, message = "{api.data_validation.max_length.error}")
22 | //@ValidPhoneNumber(message = "{model.phone_numer.number.validity.error}")
23 | protected String number = null;
24 |
25 | public CommunicationType getType()
26 | {
27 | return type;
28 | }
29 |
30 | public void setType(CommunicationType type)
31 | {
32 | this.type = type;
33 | }
34 |
35 | public String getNumber()
36 | {
37 | return number;
38 | }
39 |
40 | public void setNumber(String number)
41 | {
42 | this.number = number;
43 | }
44 |
45 | /**
46 | * @see java.lang.Object#toString()
47 | */
48 | public String toString()
49 | {
50 | return new ToStringBuilder(this).appendSuper(super.toString()).append("type", this.type).append("number", this.number).toString();
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/enterprise-granny-service/src/main/java/com/sap/hana/cloud/samples/granny/util/CustomObjectMapper.java:
--------------------------------------------------------------------------------
1 | package com.sap.hana.cloud.samples.granny.util;
2 |
3 | import org.codehaus.jackson.map.AnnotationIntrospector;
4 | import org.codehaus.jackson.map.DeserializationConfig;
5 | import org.codehaus.jackson.map.ObjectMapper;
6 | import org.codehaus.jackson.map.SerializationConfig;
7 | import org.codehaus.jackson.map.annotate.JsonSerialize;
8 | import org.codehaus.jackson.xc.JaxbAnnotationIntrospector;
9 |
10 | /**
11 | *
12 | *
13 | * @see ObjectMapper
14 | */
15 | public class CustomObjectMapper extends ObjectMapper
16 | {
17 | /**
18 | * {@inheritDoc}
19 | */
20 | public CustomObjectMapper()
21 | {
22 | super();
23 | this.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
24 | this.configure(SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS, false);
25 | this.configure(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS, false);
26 |
27 | this.setSerializationInclusion(JsonSerialize.Inclusion.NON_DEFAULT);
28 | this.setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL);
29 | this.setSerializationInclusion(JsonSerialize.Inclusion.NON_EMPTY);
30 |
31 | final AnnotationIntrospector introspector = new JaxbAnnotationIntrospector();
32 |
33 | // make deserializer use JAXB annotations (only)
34 | this.setAnnotationIntrospector(introspector);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/enterprise-granny-phonelib/src/main/webapp/WEB-INF/web.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 | contextConfigLocation
9 | /WEB-INF/spring/spring-context.xml
10 |
11 |
12 | org.springframework.web.context.ContextLoaderListener
13 |
14 |
15 | CXFServlet
16 | org.apache.cxf.transport.servlet.CXFServlet
17 | 1
18 |
19 |
20 | CXFServlet
21 | /api/*
22 |
23 |
24 | RequestContextFilter
25 | org.springframework.web.filter.RequestContextFilter
26 |
27 |
28 | RequestContextFilter
29 | /api/*
30 |
31 |
32 | index.html
33 |
34 |
35 |
--------------------------------------------------------------------------------
/enterprise-granny-core/src/main/java/com/sap/hana/cloud/samples/granny/model/EmailAddress.java:
--------------------------------------------------------------------------------
1 | package com.sap.hana.cloud.samples.granny.model;
2 |
3 | import java.io.Serializable;
4 |
5 | import javax.validation.constraints.Size;
6 |
7 | import org.apache.commons.lang3.builder.ToStringBuilder;
8 |
9 | /**
10 | * EmailAddress address of a {@link Contact}.
11 | */
12 | public class EmailAddress extends BaseObject implements Serializable
13 | {
14 | /**
15 | * The serialVersionUID of the class.
16 | */
17 | private static final long serialVersionUID = 1L;
18 |
19 | protected AddressType type = null;
20 |
21 | @Size(max = 70, message = "{api.data_validation.max_length.error}")
22 | //@Pattern(regexp="^[\\w-\\.]+@([\\w-]+\\.)+[\\w-]{2,4}$", message = "{model.email_address.email.pattern.error}" )
23 | protected String email = null;
24 |
25 | public AddressType getType()
26 | {
27 | return type;
28 | }
29 |
30 | public void setType(AddressType type)
31 | {
32 | this.type = type;
33 | }
34 |
35 | public String getEmail()
36 | {
37 | return email;
38 | }
39 |
40 | public void setEmail(String email)
41 | {
42 | this.email = email;
43 | }
44 |
45 | /**
46 | * @see java.lang.Object#toString()
47 | */
48 | public String toString()
49 | {
50 | return new ToStringBuilder(this).appendSuper(super.toString()).append("type", this.type).append("email", this.email).toString();
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/enterprise-granny-client/src/main/java/com/sap/hana/cloud/samples/grannyv/client/web/util/ServiceExceptionMapper.java:
--------------------------------------------------------------------------------
1 | package com.sap.hana.cloud.samples.grannyv.client.web.util;
2 |
3 | import javax.inject.Inject;
4 | import javax.ws.rs.core.MediaType;
5 | import javax.ws.rs.core.Response;
6 | import javax.ws.rs.ext.ExceptionMapper;
7 |
8 | import org.codehaus.jackson.map.ObjectMapper;
9 |
10 | import com.sap.hana.cloud.samples.granny.model.StatusMessage;
11 | import com.sap.hana.cloud.samples.granny.srv.ServiceException;
12 |
13 | /**
14 | *
15 | * @see http://cxf.apache.org/docs/jax-rs-basics.html#JAX-RSBasics-Exceptionhandling
16 | * @see http://fusesource.com/docs/esb/4.2/rest/RESTExceptionMapper.html
17 | *
18 | */
19 | public class ServiceExceptionMapper implements ExceptionMapper
20 | {
21 |
22 | /**
23 | * The {@link ObjectMapper} to be used.
24 | *
25 | * @see CustomObjectMapper
26 | */
27 | @Inject
28 | ObjectMapper objectMapper = null;
29 |
30 |
31 | /**
32 | * TODO
33 | *
34 | * @param exception The caught {@link ServiceException}
35 | * @return The corresponding {@link Response} containing a {@link StatusMessage}
36 | */
37 | @Override
38 | public Response toResponse(ServiceException exception)
39 | {
40 | StatusMessage message = exception.getStatusMessage();
41 | return Response.status(message.getCode()).entity(message).type(MediaType.APPLICATION_JSON).build();
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/enterprise-granny-service/src/main/java/com/sap/hana/cloud/samples/granny/dao/ContactRepository.java:
--------------------------------------------------------------------------------
1 | package com.sap.hana.cloud.samples.granny.dao;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.data.jpa.repository.Query;
6 | import org.springframework.data.repository.CrudRepository;
7 |
8 | import com.sap.hana.cloud.samples.granny.model.Address;
9 | import com.sap.hana.cloud.samples.granny.model.Contact;
10 |
11 | /**
12 | * Interface describing the life-cycle operations (e.g. CRUD operations) for {@link Contact} objects.
13 | */
14 | public interface ContactRepository extends CrudRepository
15 | {
16 | /**
17 | * Returns a {@link List} of all {@link Contact} objects.
18 | *
19 | * @return A {@link List} of all {@link Contact} objects
20 | */
21 | @Query("SELECT DISTINCT c from Contact c JOIN FETCH c.addresses JOIN FETCH c.phoneNumbers JOIN FETCH c.emailAddresses ORDER BY c.lastName, c.firstName ASC")
22 | public List queryAll();
23 |
24 | /**
25 | * Returns a {@link List} of all {@link Contact} objects with an {@link Address}
26 | * matching the specified 2-letter country code.
27 | *
28 | * @param country The country to search for
29 | * @return {@link List} of all {@link Contact} objects with an {@link Address} matching the specified 2-letter country code
30 | *
31 | * @see http://www.davros.org/misc/iso3166.txt
32 | */
33 | public List findByAddressesCountry(String country);
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/enterprise-granny-service/src/main/java/com/sap/hana/cloud/samples/granny/web/util/ServiceExceptionMapper.java:
--------------------------------------------------------------------------------
1 | package com.sap.hana.cloud.samples.granny.web.util;
2 |
3 | import javax.inject.Inject;
4 | import javax.ws.rs.core.MediaType;
5 | import javax.ws.rs.core.Response;
6 | import javax.ws.rs.ext.ExceptionMapper;
7 |
8 | import org.codehaus.jackson.map.ObjectMapper;
9 |
10 | import com.sap.hana.cloud.samples.granny.model.StatusMessage;
11 | import com.sap.hana.cloud.samples.granny.srv.ServiceException;
12 | import com.sap.hana.cloud.samples.granny.util.CustomObjectMapper;
13 |
14 | /**
15 | *
16 | * @see http://cxf.apache.org/docs/jax-rs-basics.html#JAX-RSBasics-Exceptionhandling
17 | * @see http://fusesource.com/docs/esb/4.2/rest/RESTExceptionMapper.html
18 | *
19 | */
20 | public class ServiceExceptionMapper implements ExceptionMapper
21 | {
22 |
23 | /**
24 | * The {@link ObjectMapper} to be used.
25 | *
26 | * @see CustomObjectMapper
27 | */
28 | @Inject
29 | ObjectMapper objectMapper = null;
30 |
31 |
32 | /**
33 | * TODO
34 | *
35 | * @param exception The caught {@link ServiceException}
36 | * @return The corresponding {@link Response} containing a {@link StatusMessage}
37 | */
38 | @Override
39 | public Response toResponse(ServiceException exception)
40 | {
41 | StatusMessage message = exception.getStatusMessage();
42 | return Response.status(message.getCode()).entity(message).type(MediaType.APPLICATION_JSON).build();
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/enterprise-granny-client/src/main/webapp/WEB-INF/tiles-defs.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/enterprise-granny-core/src/main/java/com/sap/hana/cloud/samples/granny/api/ContactFacade.java:
--------------------------------------------------------------------------------
1 | package com.sap.hana.cloud.samples.granny.api;
2 |
3 |
4 | import java.util.List;
5 |
6 | import javax.validation.Valid;
7 | import javax.ws.rs.Consumes;
8 | import javax.ws.rs.DELETE;
9 | import javax.ws.rs.GET;
10 | import javax.ws.rs.POST;
11 | import javax.ws.rs.PUT;
12 | import javax.ws.rs.Path;
13 | import javax.ws.rs.PathParam;
14 | import javax.ws.rs.Produces;
15 | import javax.ws.rs.core.MediaType;
16 |
17 | import com.sap.hana.cloud.samples.granny.model.Contact;
18 | import com.sap.hana.cloud.samples.granny.srv.ServiceException;
19 |
20 | @Path("/contacts")
21 | public interface ContactFacade
22 | {
23 | @Produces("application/json")
24 | @GET
25 | public List findAll() throws ServiceException;
26 |
27 | @Path("/{id}")
28 | @Produces("application/json")
29 | @GET
30 | public Contact findOne(@PathParam("id") String id) throws ServiceException;
31 |
32 | @Consumes("application/json")
33 | @Produces("application/json")
34 | @POST
35 | public Contact create(@Valid Contact contact) throws ServiceException;
36 |
37 | @Path("/{id}")
38 | @Consumes("application/json")
39 | @Produces("application/json")
40 | @PUT
41 | public Contact update(@PathParam("id") String id, @Valid Contact contact) throws ServiceException;
42 |
43 | @Path("/{id}")
44 | @Consumes({MediaType.WILDCARD})
45 | @Produces({MediaType.WILDCARD})
46 | @DELETE
47 | public void delete(@PathParam("id") String id) throws ServiceException;
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/enterprise-granny-phonelib/src/main/webapp/WEB-INF/spring/spring-context.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/enterprise-granny-phonelib/src/main/resources/META-INF/enunciate/enunciate.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 | googlei18n/libphonenumber
6 | Provides a microservice for Google's libphonenumber library.
7 | Apache License, Version 2.0
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/enterprise-granny-client/src/main/webapp/WEB-INF/web.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Addressbook-Service
5 | com.sap.core.connectivity.api.http.HttpDestination
6 |
7 |
8 | contextConfigLocation
9 | /WEB-INF/spring/root-context.xml
10 |
11 |
12 | org.springframework.web.context.ContextLoaderListener
13 |
14 |
15 | appServlet
16 | org.springframework.web.servlet.DispatcherServlet
17 |
18 | contextConfigLocation
19 | /WEB-INF/spring/appServlet/servlet-context.xml
20 |
21 | 1
22 |
23 |
24 | appServlet
25 | /
26 |
27 |
28 | JPAXFilter
29 | JPAXFilter
30 | com.sap.hana.cloud.samples.granny.client.web.JPAXFilter
31 |
32 |
33 | JPAXFilter
34 | /*
35 |
36 |
--------------------------------------------------------------------------------
/CREDITS:
--------------------------------------------------------------------------------
1 | This program references/bundles the following third party open source or other free download components.
2 | The third party licensors of these components may provide additional license rights,
3 | terms and conditions and/or require certain notices as described below.
4 |
5 | jQuery (http://jquery.com/)
6 | Licensed under MIT - https://github.com/jquery/jquery/blob/master/MIT-LICENSE.txt
7 |
8 | jquery-pjax (https://github.com/defunkt/jquery-pjax)
9 | Licensed under MIT - https://github.com/defunkt/jquery-pjax/blob/master/LICENSE
10 |
11 | Twitter Bootstrap (http://twitter.github.com/bootstrap/)
12 | Licensed under Apache License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | html5shiv (https://code.google.com/p/html5shiv/)
15 | Licensed under MIT - http://www.opensource.org/licenses/mit-license.php
16 |
17 | Respond.js (https://github.com/scottjehl/Respond)
18 | Licensed under MIT - http://www.opensource.org/licenses/mit-license.php
19 |
20 | GLYPHICONS Halflings (http://glyphicons.com/)
21 | Licensed as part of Bootstrap from Twitter, http://glyphicons.com/license/
22 |
23 | -------
24 |
25 | Elderly Woman designed by Peacock Dream from the Noun Project (http://thenounproject.com/term/elderly-woman/9727/)
26 | Licensed under Creative Commons – Attribution (CC BY 3.0) - http://creativecommons.org/licenses/by/3.0/us/
27 |
28 | Bebas Neue Font by Ryoichi Tsunekawa (http://dharmatype.com/post/84312257192/bebas-neue)
29 | Licensed under SIL Open Font License - http://en.wikipedia.org/wiki/SIL_Open_Font_License
30 |
31 | Pacifico Font by Vernon Adams (http://code.newtypography.co.uk/pacifico-opentype-features/)
32 | Licensed under SIL Open Font License - http://www.fontsquirrel.com/license/pacifico
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/enterprise-granny-client/src/main/java/com/sap/hana/cloud/samples/granny/client/web/JPAXFilter.java:
--------------------------------------------------------------------------------
1 | package com.sap.hana.cloud.samples.granny.client.web;
2 |
3 | import java.io.IOException;
4 |
5 | import javax.servlet.Filter;
6 | import javax.servlet.FilterChain;
7 | import javax.servlet.FilterConfig;
8 | import javax.servlet.ServletException;
9 | import javax.servlet.ServletRequest;
10 | import javax.servlet.ServletResponse;
11 | import javax.servlet.http.HttpServletRequest;
12 | import javax.servlet.http.HttpServletResponse;
13 |
14 | /**
15 | * Servlet Filter implementation class JPAXFilter
16 | */
17 | public class JPAXFilter implements Filter
18 | {
19 |
20 | /**
21 | * Default constructor.
22 | */
23 | public JPAXFilter()
24 | {
25 | // TODO Auto-generated constructor stub
26 | }
27 |
28 | /**
29 | * @see Filter#destroy()
30 | */
31 | public void destroy()
32 | {
33 | // TODO Auto-generated method stub
34 | }
35 |
36 | /**
37 | * @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain)
38 | */
39 | public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException
40 | {
41 | HttpServletRequest req = (HttpServletRequest) request;
42 | HttpServletResponse resp = (HttpServletResponse) response;
43 |
44 | // pass the request along the filter chain
45 | chain.doFilter(request, response);
46 |
47 | if (req.getHeader("x-pjax") != null)
48 | {
49 | //resp.getWriter().println("JPAX enabled!");
50 | resp.setContentType("text/html");
51 | }
52 |
53 | }
54 |
55 | /**
56 | * @see Filter#init(FilterConfig)
57 | */
58 | public void init(FilterConfig fConfig) throws ServletException
59 | {
60 | // TODO Auto-generated method stub
61 | }
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/enterprise-granny-service/src/test/java/com/osintegrators/example/TestAddressService.java:
--------------------------------------------------------------------------------
1 | package com.osintegrators.example;
2 |
3 | import static org.junit.Assert.assertEquals;
4 |
5 | import org.junit.After;
6 | import org.junit.Before;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 |
9 | /**
10 | * @author dmistry
11 | * @deprecated In favor of {@link com.sap.hana.cloud.samples.granny.dao.TestContactDAO}
12 | */
13 | //@ContextConfiguration
14 | //@RunWith(SpringJUnit4ClassRunner.class)
15 | public class TestAddressService {
16 |
17 | @Autowired
18 | AddressService addressService;
19 |
20 | /**
21 | * @throws java.lang.Exception
22 | */
23 | @Before
24 | public void setUp() throws Exception {
25 | }
26 |
27 | /**
28 | * @throws java.lang.Exception
29 | */
30 | @After
31 | public void tearDown() throws Exception {
32 | }
33 |
34 | //@Test
35 | public void testCreateAddress() {
36 | String expectedName = "John Doe";
37 | String expectedAddress = "345 West Main St\nDurham, NC";
38 | String expectedPhone = "+1.919.321.0119";
39 | String expectedEmail = "spam@osintegrators.com";
40 | Address address = createAddressObject(expectedName, expectedAddress,
41 | expectedPhone, expectedEmail);
42 | addressService.createAddress(address);
43 | Address result = addressService.getAddressById(1L);
44 |
45 | assertEquals(expectedName, address.getName());
46 | assertEquals(expectedAddress, address.getAddress());
47 | assertEquals(expectedPhone, address.getPhone());
48 | assertEquals(expectedEmail, address.getEmail());
49 | }
50 |
51 | private Address createAddressObject(String name, String address, String phone, String email) {
52 | Address address1 = new Address(name, address, phone, email);
53 | return address1;
54 | }
55 | }
--------------------------------------------------------------------------------
/enterprise-granny-client/src/main/webapp/WEB-INF/tags/input.tag:
--------------------------------------------------------------------------------
1 | <%@tag description="Extended input tag to allow for sophisticated errors" pageEncoding="UTF-8"%>
2 | <%@taglib prefix="spring" uri="http://www.springframework.org/tags" %>
3 | <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
4 | <%@taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
5 | <%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
6 |
7 | <%@attribute name="path" required="true" type="java.lang.String"%>
8 | <%@attribute name="labelClass" required="false" type="java.lang.String"%>
9 | <%@attribute name="controlClass" required="false" type="java.lang.String"%>
10 | <%@attribute name="label" required="false" type="java.lang.String"%>
11 | <%@attribute name="required" required="false" type="java.lang.Boolean"%>
12 | <%@attribute name="placeholder" required="false" type="java.lang.String"%>
13 | <%@attribute name="type" required="false" type="java.lang.String"%>
14 |
15 |
16 |
17 |
18 |
19 |
20 |
29 |
--------------------------------------------------------------------------------
/enterprise-granny-service/src/main/java/com/sap/hana/cloud/samples/granny/web/util/ParserExceptionMapper.java:
--------------------------------------------------------------------------------
1 | package com.sap.hana.cloud.samples.granny.web.util;
2 |
3 | import javax.inject.Inject;
4 | import javax.ws.rs.core.MediaType;
5 | import javax.ws.rs.core.Response;
6 | import javax.ws.rs.ext.ExceptionMapper;
7 |
8 | import org.codehaus.jackson.JsonParseException;
9 | import org.codehaus.jackson.map.ObjectMapper;
10 |
11 | import com.sap.hana.cloud.samples.granny.model.StatusMessage;
12 | import com.sap.hana.cloud.samples.granny.util.CustomObjectMapper;
13 |
14 | /**
15 | *
16 | * @see http://cxf.apache.org/docs/jax-rs-basics.html#JAX-RSBasics-Exceptionhandling
17 | * @see http://fusesource.com/docs/esb/4.2/rest/RESTExceptionMapper.html
18 | *
19 | */
20 | public class ParserExceptionMapper implements ExceptionMapper
21 | {
22 |
23 | /**
24 | * The {@link ObjectMapper} to be used.
25 | *
26 | * @see CustomObjectMapper
27 | */
28 | @Inject
29 | ObjectMapper objectMapper = null;
30 |
31 |
32 | /**
33 | * TODO
34 | *
35 | * @param exception The caught {@link JsonParseException}
36 | * @return The corresponding {@link Response} containing a {@link StatusMessage}
37 | */
38 | @Override
39 | public Response toResponse(JsonParseException exception)
40 | {
41 | final String PATTERN = "\\n at \\[Source: org.apache.cxf.transport.http.AbstractHTTPDestination\\$.{1,12};\\s";
42 | final String REPLACE = " at location: [";
43 |
44 | StatusMessage message = new StatusMessage();
45 |
46 | message.setCode(400);
47 | message.setDescription(exception.getMessage().replaceAll(PATTERN, REPLACE));
48 | message.setError("Parsing error");
49 |
50 | return Response.status(message.getCode()).entity(message).type(MediaType.APPLICATION_JSON).build();
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/enterprise-granny-service/src/main/java/com/sap/hana/cloud/samples/granny/xcc/validations/ValidPhoneNumberValidator.java:
--------------------------------------------------------------------------------
1 | package com.sap.hana.cloud.samples.granny.xcc.validations;
2 |
3 | import java.util.Locale;
4 |
5 | import javax.validation.ConstraintValidator;
6 | import javax.validation.ConstraintValidatorContext;
7 |
8 | import org.springframework.context.MessageSource;
9 | import org.springframework.context.MessageSourceAware;
10 |
11 | import com.google.i18n.phonenumbers.NumberParseException;
12 | import com.google.i18n.phonenumbers.PhoneNumberUtil;
13 | import com.sap.hana.cloud.samples.granny.model.PhoneNumber;
14 |
15 |
16 | public class ValidPhoneNumberValidator implements ConstraintValidator, MessageSourceAware
17 | {
18 | MessageSource messageSource;
19 |
20 | /**
21 | * The {@link PhoneNumberUtil} instance used to validate {@link PhoneNumber}s.
22 | */
23 | private final static PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance();
24 |
25 | @Override
26 | public void initialize(ValidPhoneNumber constraintAnnotation)
27 | {
28 | }
29 |
30 | @Override
31 | public boolean isValid(String value, ConstraintValidatorContext context)
32 | {
33 |
34 | com.google.i18n.phonenumbers.Phonenumber.PhoneNumber no = null;
35 |
36 | try
37 | {
38 | no = phoneUtil.parse(value, Locale.getDefault().getCountry());
39 | }
40 | catch (NumberParseException e)
41 | {
42 | // TODO Auto-generated catch block
43 | e.printStackTrace();
44 | }
45 |
46 | boolean valid = phoneUtil.isValidNumber(no);
47 |
48 |
49 | return valid;
50 | }
51 |
52 | @Override
53 | public void setMessageSource(MessageSource messageSource)
54 | {
55 | this.messageSource = messageSource;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/enterprise-granny-service/src/main/resources/META-INF/enunciate/enunciate.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 | Granny's Addressbook - Contact Management Service
6 | Provides REST endpoints to manage address data.
7 | SAP SE
8 |
9 | Apache License, Version 2.0
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/enterprise-granny-service/src/main/resources/log4j.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/enterprise-granny-service/src/main/webapp/WEB-INF/web.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | jdbc/DefaultDB
8 | javax.sql.DataSource
9 |
10 |
11 | PhoneNumber-Service
12 | com.sap.core.connectivity.api.http.HttpDestination
13 |
14 |
15 | contextConfigLocation
16 | /WEB-INF/spring/spring-context.xml
17 |
18 |
19 | contextInitializerClasses
20 | com.sap.hana.cloud.samples.granny.web.util.EnvironmentContextInitializer
21 |
22 |
23 |
24 | org.springframework.web.context.ContextLoaderListener
25 |
26 |
27 | CXFServlet
28 | org.apache.cxf.transport.servlet.CXFServlet
29 | 1
30 |
31 |
32 | CXFServlet
33 | /api/*
34 |
35 |
36 | RequestContextFilter
37 | org.springframework.web.filter.RequestContextFilter
38 |
39 |
40 | RequestContextFilter
41 | /api/*
42 |
43 |
44 | index.html
45 |
46 |
47 |
--------------------------------------------------------------------------------
/enterprise-granny-client/src/main/webapp/WEB-INF/spring/root-context.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 | i18n/messages
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 | ${messageResourceBundleName}
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/enterprise-granny-service/src/main/java/com/sap/hana/cloud/samples/granny/web/util/CustomJAXRSBeanValidationInInterceptor.java:
--------------------------------------------------------------------------------
1 | package com.sap.hana.cloud.samples.granny.web.util;
2 |
3 | import java.lang.reflect.Method;
4 | import java.util.List;
5 |
6 | import org.apache.cxf.jaxrs.validation.JAXRSBeanValidationInInterceptor;
7 | import org.apache.cxf.message.Message;
8 | import org.apache.cxf.validation.BeanValidationProvider;
9 |
10 | /**
11 | * Custom implementation of {@link JAXRSBeanValidationInInterceptor} to overwrite the standard behavior of
12 | * calling {@link BeanValidationProvider#validateParameters(Object, Method, Object[])} in favor of calling
13 | * {@link BeanValidationProvider#validateBean(Object)}.
14 | *
15 | * The issue with the standard implementation is that it includes the method name as part of the
16 | * {@link javax.validation.ConstraintViolation#getPropertyPath()}.
17 | *
18 | * @see BeanValidationInInterceptor#handleValidation(Message, Object, Method, List