Skip to content
Permalink
Browse files
improved the repositories and entities for the configurations
  • Loading branch information
ebenezergraham committed Jun 10, 2018
1 parent 9f886dd commit 71d5c3ed920006f6557279ec02054f8100b3f761
Showing 25 changed files with 515 additions and 39 deletions.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,162 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.fineract.cn.notification.api.v1.domain;

import org.apache.fineract.cn.lang.validation.constraints.ValidIdentifier;
import org.hibernate.validator.constraints.Length;

import java.util.Objects;

@SuppressWarnings({"WeakerAccess", "unused"})
public class EmailConfiguration {
@ValidIdentifier
private String identifier;
@Length(max = 512)
private String payload;
@Length(max = 512)
private String host;
@Length(max = 512)
private String port;
@Length(max = 512)
private String username;
@Length(max = 512)
private String app_id;
@Length(max = 512)
private String smtp_auth;
@Length(max = 512)
private String start_tls;
@Length(max = 512)
private String option;

public EmailConfiguration(){
super();
}

public static EmailConfiguration create (String identifier, String payload,
String host, String port,
String username, String app_id,
String smtp_auth, String start_tls,
String option) {
EmailConfiguration emailConfiguration = new EmailConfiguration();
emailConfiguration.setIdentifier(identifier);
emailConfiguration.setPayload(payload);
emailConfiguration.setHost(host);
emailConfiguration.setPort(port);
emailConfiguration.setUsername(username);
emailConfiguration.setApp_id(app_id);
emailConfiguration.setSmtp_auth(smtp_auth);
emailConfiguration.setStart_tls(start_tls);
emailConfiguration.setOption(option);
return emailConfiguration;
}

public String getIdentifier() {
return identifier;
}

public void setIdentifier(String identifier) {
this.identifier = identifier;
}

public String getPayload() {
return payload;
}

public void setPayload(String payload) {
this.payload = payload;
}

public String getHost() {
return host;
}

public void setHost(String host) {
this.host = host;
}

public String getPort() {
return port;
}

public void setPort(String port) {
this.port = port;
}

public String getUsername() {
return username;
}

public void setUsername(String username) {
this.username = username;
}

public String getApp_id() {
return app_id;
}

public void setApp_id(String app_id) {
this.app_id = app_id;
}

public String getSmtp_auth() {
return smtp_auth;
}

public void setSmtp_auth(String smtp_auth) {
this.smtp_auth = smtp_auth;
}

public String getStart_tls() {
return start_tls;
}

public void setStart_tls(String start_tls) {
this.start_tls = start_tls;
}

public String getOption() {
return option;
}

public void setOption(String option) {
this.option = option;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
EmailConfiguration that = (EmailConfiguration) o;
return Objects.equals(identifier, that.identifier) &&
Objects.equals(payload, that.payload) &&
Objects.equals(host, that.host) &&
Objects.equals(port, that.port) &&
Objects.equals(username, that.username) &&
Objects.equals(app_id, that.app_id) &&
Objects.equals(smtp_auth, that.smtp_auth) &&
Objects.equals(start_tls, that.start_tls) &&
Objects.equals(option, that.option);
}

@Override
public int hashCode() {
return Objects.hash(identifier, payload, host, port, username,
app_id, smtp_auth, start_tls, option);
}
}
@@ -0,0 +1,122 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.fineract.cn.notification.api.v1.domain;

import org.apache.fineract.cn.lang.validation.constraints.ValidIdentifier;
import org.hibernate.validator.constraints.Length;

import java.util.Objects;

@SuppressWarnings({"WeakerAccess", "unused"})
public class SMSConfiguration {
@ValidIdentifier
private String identifier;
@Length(max = 512)
private String payload;
@Length(max = 512)
private String organisation;
@Length(max = 512)
private String auth_token;
@Length(max = 512)
private String accountid;
@Length(max = 256)
private String option;

public SMSConfiguration() {
super();
}

public static SMSConfiguration create(String identifier, String payload, String organisation, String auth_token, String accountid, String option) {
SMSConfiguration smsconfiguration = new SMSConfiguration();
smsconfiguration.setIdentifier(identifier);
smsconfiguration.setPayload(payload);
smsconfiguration.setOrganisation(organisation);
smsconfiguration.setAuth_token(auth_token);
smsconfiguration.setAccountid(accountid);
smsconfiguration.setOption(option);
return smsconfiguration;
}

public String getIdentifier() {
return identifier;
}

public void setIdentifier(String identifier) {
this.identifier = identifier;
}

public String getPayload() {
return payload;
}

public void setPayload(String payload) {
this.payload = payload;
}

public String getOrganisation() {
return organisation;
}

public void setOrganisation(String organisation) {
this.organisation = organisation;
}

public String getAuth_token() {
return auth_token;
}

public void setAuth_token(String auth_token) {
this.auth_token = auth_token;
}

public String getAccountid() {
return accountid;
}

public void setAccountid(String accountid) {
this.accountid = accountid;
}

public String getOption() {
return option;
}

public void setOption(String option) {
this.option = option;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
SMSConfiguration that = (SMSConfiguration) o;
return Objects.equals(identifier, that.identifier) &&
Objects.equals(payload, that.payload) &&
Objects.equals(organisation, that.organisation) &&
Objects.equals(auth_token, that.auth_token) &&
Objects.equals(accountid, that.accountid) &&
Objects.equals(option, that.option);
}

@Override
public int hashCode() {

return Objects.hash(identifier, payload, organisation, auth_token, accountid, option);
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -23,17 +23,6 @@ spring:
enabled: false
config:
enabled: false
mail:
host: smtp.gmail.com
port: 587
username: ebenezergraham69@gmail.com
password: fdzmzbhbmtkafzvq
properties:
mail:
smtpauth: true
smtp:
starttls:
enable: true

eureka:
client:
@@ -79,13 +68,6 @@ async:
flyway:
enabled: false

mfi:
senderNumber: +15109441898

smssender:
accountSID: AC1fde2c6f26f367b93231c5fdb944c908
authtoken: bc9a53e41745b8471e0ecafc859d86aa

fineract:
customer:
accountcreated:
@@ -24,6 +24,8 @@
import org.apache.fineract.cn.command.annotation.CommandHandler;
import org.apache.fineract.cn.command.annotation.CommandLogLevel;
import org.apache.fineract.cn.command.annotation.EventEmitter;
import org.apache.fineract.cn.notification.service.internal.repository.SampleJpaEntity;
import org.apache.fineract.cn.notification.service.internal.repository.SampleJpaEntityRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

@@ -0,0 +1,49 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.fineract.cn.notification.service.internal.mapper;

import org.apache.fineract.cn.notification.api.v1.domain.EmailConfiguration;
import org.apache.fineract.cn.notification.service.internal.repository.EmailGatewayConfiguration;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

public class EmailConfigurationMapper {

private EmailConfigurationMapper() {
super();
}

public static EmailConfiguration map(final EmailGatewayConfiguration emailGatewayConfiguration) {
final EmailConfiguration emailConfiguration = new EmailConfiguration();
emailConfiguration.setIdentifier(emailGatewayConfiguration.getIdentifier());
emailConfiguration.setHost(emailGatewayConfiguration.getHost());
emailConfiguration.setPort(emailGatewayConfiguration.getPort());
emailConfiguration.setUsername(emailGatewayConfiguration.getUsername());
emailConfiguration.setApp_id(emailGatewayConfiguration.getApp_id());
return emailConfiguration;
}

// public static List<EmailGatewayConfiguration> map(final List<EmailGatewayConfiguration> emailGatewayConfiguration) {
// final ArrayList<EmailGatewayConfiguration> entities = new ArrayList<>(emailGatewayConfiguration.size());
// entities.addAll(emailGatewayConfiguration.stream().map(EmailGatewayConfiguration::map).collect(Collectors.toList()));
// return entities;
// }
}

0 comments on commit 71d5c3e

Please sign in to comment.