[GitHub] incubator-fineract pull request #283: Notification Module

2017-02-27 Thread ad-os
Github user ad-os commented on a diff in the pull request:

https://github.com/apache/incubator-fineract/pull/283#discussion_r103218666
  
--- Diff: 
fineract-provider/src/main/java/org/apache/fineract/notification/eventandlistener/NotificationEvent.java
 ---
@@ -0,0 +1,50 @@
+/**
+ * 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.notification.eventandlistener;
+
+import org.apache.fineract.notification.data.NotificationData;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jms.core.JmsTemplate;
+import org.springframework.jms.core.MessageCreator;
+import org.springframework.stereotype.Service;
+
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.Session;
+
+@Service
+public class NotificationEvent {
--- End diff --

It is a service which broadcast the notification event to an external queue.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-fineract pull request #283: Notification Module

2017-02-27 Thread ad-os
Github user ad-os commented on a diff in the pull request:

https://github.com/apache/incubator-fineract/pull/283#discussion_r103217772
  
--- Diff: 
fineract-provider/src/main/java/org/apache/fineract/notification/service/NotificationMapperReadPlatformServiceImpl.java
 ---
@@ -0,0 +1,53 @@
+/**
+ * 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.notification.service;
+
+import org.apache.fineract.notification.domain.NotificationMapper;
+import 
org.apache.fineract.notification.domain.NotificationMapperRepository;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class NotificationMapperReadPlatformServiceImpl implements 
NotificationMapperReadPlatformService {
--- End diff --

I am trying it as repository wrapper. What name should this class be named? 
Would it be NotificationMapperReadRepositoryWrapper?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-fineract pull request #283: Notification Module

2017-02-27 Thread ad-os
Github user ad-os commented on a diff in the pull request:

https://github.com/apache/incubator-fineract/pull/283#discussion_r103213061
  
--- Diff: 
fineract-provider/src/main/java/org/apache/fineract/notification/service/NotificationGeneratorReadPlatformServiceImpl.java
 ---
@@ -0,0 +1,53 @@
+/**
+ * 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.notification.service;
+
+import org.apache.fineract.notification.domain.Notification;
+import org.apache.fineract.notification.domain.NotificationRepository;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class NotificationGeneratorReadPlatformServiceImpl implements 
NotificationGeneratorReadPlatformService {
--- End diff --

I am trying it as repository wrapper. What name should this class be named? 
Would it be NotificationGeneratorReadRepositoryWrapper?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-fineract pull request #283: Notification Module

2017-02-27 Thread ad-os
Github user ad-os commented on a diff in the pull request:

https://github.com/apache/incubator-fineract/pull/283#discussion_r103187242
  
--- Diff: 
fineract-provider/src/main/java/org/apache/fineract/notification/domain/Notification.java
 ---
@@ -0,0 +1,112 @@
+/**
+ * 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.notification.domain;
+
+import 
org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "notification_generator")
+public class Notification extends AbstractPersistableCustom {
+
+@Column(name = "object_type")
+private String objectType;
+
+@Column(name = "object_identifier")
+private Long objectIdentifier;
+
+@Column(name = "action")
+private String action;
+
+@Column(name = "actor")
+private Long actorId;
--- End diff --

Sorry about that, when the last time I changed the actorId to Long, I 
forgot to change it in the notification_generator definition. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-fineract pull request #283: Notification Module

2017-01-29 Thread ad-os
GitHub user ad-os opened a pull request:

https://github.com/apache/incubator-fineract/pull/283

Notification Module

This module will allow developers to integrate notifications with their 
functionality. Here are some wikis on which you can read more about this module.

1) [Notification Module 
Design](https://mifosforge.jira.com/wiki/pages/viewpage.action?pageId=133070890)
2) [Notification API Developer User 
Guide](https://mifosforge.jira.com/wiki/display/MDZ/Notification+API+Developer+User+Guide)
3) [Configure Notifications-End User 
guide](https://mifosforge.jira.com/wiki/display/docs/Configure+Notifications)

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/ad-os/incubator-fineract notification

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-fineract/pull/283.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #283


commit e97ecc4a687ace616175be9590110abb24df446b
Author: Adhyan 
Date:   2017-01-03T08:54:30Z

Added Notification Module

Added Notification Module

Added Notification Module

Added Notification Module

Added Notification Module

Added Notification Module

Added Notification Module




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-fineract pull request #270: Notification Module

2017-01-29 Thread ad-os
Github user ad-os closed the pull request at:

https://github.com/apache/incubator-fineract/pull/270


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-fineract pull request #270: Notification Module

2017-01-13 Thread ad-os
Github user ad-os commented on a diff in the pull request:

https://github.com/apache/incubator-fineract/pull/270#discussion_r96110571
  
--- Diff: 
fineract-provider/src/main/java/org/apache/fineract/notification/domain/NotificationGenerator.java
 ---
@@ -0,0 +1,178 @@
+/**
+ * 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.notification.domain;
+
+import 
org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "notification_generator")
+public class NotificationGenerator extends AbstractPersistableCustom 
{
+
+@Column(name = "object_type")
+private String objectType;
+
+@Column(name = "object_identifier")
+private Long objectIdentifier;
+
+@Column(name = "action")
+private String action;
+
+@Column(name = "actor")
+private String actor;
--- End diff --

Refactored actor  to an id :)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-fineract pull request #270: Notification Module

2017-01-13 Thread ad-os
Github user ad-os commented on a diff in the pull request:

https://github.com/apache/incubator-fineract/pull/270#discussion_r96107755
  
--- Diff: 
fineract-provider/src/main/java/org/apache/fineract/notification/eventandlistener/NotificationEventListener.java
 ---
@@ -0,0 +1,101 @@
+/**
+ * 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.notification.eventandlistener;
+
+import 
org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant;
+import 
org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
+import 
org.apache.fineract.infrastructure.security.service.BasicAuthTenantDetailsService;
+import org.apache.fineract.notification.data.NotificationData;
+import 
org.apache.fineract.notification.service.NotificationWritePlatformService;
+import org.apache.fineract.useradministration.domain.AppUser;
+import org.apache.fineract.useradministration.domain.AppUserRepository;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jms.listener.SessionAwareMessageListener;
+import org.springframework.stereotype.Service;
+
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.ObjectMessage;
+import javax.jms.Session;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+@Service
+public class NotificationEventListener implements 
SessionAwareMessageListener {
+
+private final BasicAuthTenantDetailsService 
basicAuthTenantDetailsService;
+
+private final NotificationWritePlatformService 
notificationWritePlatformService;
+
+private final AppUserRepository appUserRepository;
+
+@Autowired
+public NotificationEventListener(BasicAuthTenantDetailsService 
basicAuthTenantDetailsService,
+ NotificationWritePlatformService 
notificationWritePlatformService,
+ AppUserRepository appUserRepository) {
+this.basicAuthTenantDetailsService = basicAuthTenantDetailsService;
+this.notificationWritePlatformService = 
notificationWritePlatformService;
+this.appUserRepository = appUserRepository;
+}
+
+@Override
+public void onMessage(Message message, Session session) throws 
JMSException {
+if (message instanceof ObjectMessage) {
+NotificationData notificationData = (NotificationData) 
((ObjectMessage) message).getObject();
+
+final FineractPlatformTenant tenant = 
this.basicAuthTenantDetailsService
+
.loadTenantById(notificationData.getTenantIdentifier(), false);
+ThreadLocalContextUtil.setTenant(tenant);
+
+AppUser currentAppUser = 
appUserRepository.findAppUserByName(notificationData.getActor());
+
+List userIds;
+if (notificationData.getUserId() == null) {
+userIds = notificationData.getUserIds();
+} else {
+userIds = new ArrayList<>();
--- End diff --

I have used two different variables, one for when the notification is sent 
to only one user and another variable when notification is sent to more than 
one users. I will refactor it to use only one variable :)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-fineract pull request #270: Notification Module

2017-01-13 Thread ad-os
Github user ad-os commented on a diff in the pull request:

https://github.com/apache/incubator-fineract/pull/270#discussion_r96020630
  
--- Diff: 
fineract-provider/src/main/java/org/apache/fineract/notification/domain/NotificationMapper.java
 ---
@@ -0,0 +1,121 @@
+/**
+ * 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.notification.domain;
+
+
+import 
org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
+import org.apache.fineract.useradministration.domain.AppUser;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name = "notification_mapper")
+public class NotificationMapper extends AbstractPersistableCustom {
+
+@ManyToOne
+@JoinColumn(name = "notification_id")
+private NotificationGenerator notificationGenerator;
+
+@ManyToOne
+@JoinColumn(name = "user_id")
+private AppUser userId;
+
+@Column(name = "is_read")
+private boolean isRead;
+
+@Column(name = "created_at")
+private String createdAt;
+
+public NotificationMapper() {}
+
+public NotificationMapper(NotificationMapperBuilder builder) {
+this.notificationGenerator = builder.notificationGenerator;
+this.userId = builder.userId;
+this.isRead = builder.isRead;
+this.createdAt = builder.createdAt;
+}
+
+@Override
+public String toString() {
+return "NotificationMapper{" +
+"id=" + getId() +
+", notificationGenerator=" + notificationGenerator +
+", userId=" + userId +
+", isRead=" + isRead +
+", createdAt=" + createdAt +
+'}';
+}
+
+public NotificationGenerator getNotificationGenerator() {
+return notificationGenerator;
+}
+
+public void setNotificationGenerator(NotificationGenerator 
notificationGenerator) {
+this.notificationGenerator = notificationGenerator;
+}
+
+public AppUser getUserId() {
+return userId;
+}
+
+public void setUserId(AppUser userId) {
+this.userId = userId;
+}
+
+public boolean isRead() {
+return isRead;
+}
+
+public void setRead(boolean read) {
+isRead = read;
+}
+
+public static class NotificationMapperBuilder {
--- End diff --

The use of this static class is only in NotificationData class. I have used 
this static inner class to implement a builder pattern. Is it advisable to move 
to another file?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-fineract pull request #270: Notification Module

2017-01-13 Thread ad-os
Github user ad-os commented on a diff in the pull request:

https://github.com/apache/incubator-fineract/pull/270#discussion_r96020577
  
--- Diff: 
fineract-provider/src/main/java/org/apache/fineract/notification/domain/NotificationGenerator.java
 ---
@@ -0,0 +1,178 @@
+/**
+ * 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.notification.domain;
+
+import 
org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "notification_generator")
+public class NotificationGenerator extends AbstractPersistableCustom 
{
+
+@Column(name = "object_type")
+private String objectType;
+
+@Column(name = "object_identifier")
+private Long objectIdentifier;
+
+@Column(name = "action")
+private String action;
+
+@Column(name = "actor")
+private String actor;
+
+@Column(name = "is_system_generated")
+private boolean isSystemGenerated;
+
+@Column(name = "notification_content")
+private String notificationContent;
+
+@Column(name = "created_at")
+private String createdAt;
+
+public NotificationGenerator() {}
+
+public NotificationGenerator(NotificationGeneratorBuilder builder) {
+this.objectType = builder.objectType;
+this.objectIdentifier = builder.objectIdentifier;
+this.action = builder.action;
+this.actor = builder.actor;
+this.isSystemGenerated = builder.isSystemGenerated;
+this.notificationContent = builder.notificationContent;
+this.createdAt = builder.createdAt;
+}
+
+public String getObjectType() {
+return objectType;
+}
+
+public void setObjectType(String objectType) {
+this.objectType = objectType;
+}
+
+public Long getObjectIdentifier() {
+return objectIdentifier;
+}
+
+public void setObjectIdentifier(Long objectIdentifier) {
+this.objectIdentifier = objectIdentifier;
+}
+
+public String getAction() {
+return action;
+}
+
+public void setAction(String action) {
+this.action = action;
+}
+
+public String getActor() {
+return actor;
+}
+
+public void setActor(String actor) {
+this.actor = actor;
+}
+
+public boolean isSystemGenerated() {
+return isSystemGenerated;
+}
+
+public void setSystemGenerated(boolean systemGenerated) {
+isSystemGenerated = systemGenerated;
+}
+
+public String getNotificationContent() {
+return notificationContent;
+}
+
+public void setNotificationContent(String notificationContent) {
+this.notificationContent = notificationContent;
+}
+
+
+@Override
+public String toString() {
+return "NotificationGenerator{" +
+"id=" + getId() +
+", objectType='" + objectType + '\'' +
+", objectIdentifier=" + objectIdentifier +
+", action='" + action + '\'' +
+", actor='" + actor + '\'' +
+", isSystemGenerated=" + isSystemGenerated +
+", notificationContent='" + notificationContent + '\'' +
+", createdAt=" + createdAt +
+'}';
+}
+
+public static class NotificationGeneratorBuilder {
--- End diff --

The use of this 

[GitHub] incubator-fineract pull request #270: Notification Module

2017-01-13 Thread ad-os
Github user ad-os commented on a diff in the pull request:

https://github.com/apache/incubator-fineract/pull/270#discussion_r96020429
  
--- Diff: 
fineract-provider/src/main/java/org/apache/fineract/notification/data/NotificationData.java
 ---
@@ -0,0 +1,220 @@
+/**
+ * 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.notification.data;
+
+import java.io.Serializable;
+import java.util.List;
+
+public class NotificationData implements Serializable {
+
+private Long id;
+private Long userId;
+private String objectType;
+private Long objectId;
+private String action;
+private String actor;
+private String content;
+private boolean isSystemGenerated;
+private String tenantIdentifier;
+private String createdAt;
+private Long officeId;
+private List userIds;
+
+public NotificationData() {
+
+}
+
+public NotificationData(NotificationBuilder builder) {
+this.userId = builder.userId;
+this.objectType = builder.objectType;
+this.objectId = builder.objectId;
+this.action = builder.action;
+this.actor = builder.actor;
+this.content = builder.notificationContent;
+this.isSystemGenerated = builder.isSystemGenerated;
+this.tenantIdentifier = builder.tenantIdentifier;
+this.userIds = builder.userIds;
+this.officeId = builder.officeId;
+}
+
+public Long getOfficeId() {
+return officeId;
+}
+
+public void setOfficeId(Long officeId) {
+this.officeId = officeId;
+}
+
+public List getUserIds() {
+return userIds;
+}
+
+public void setUserId(List userIds) {
+this.userIds = userIds;
+}
+
+public Long getId() {
+return id;
+}
+
+public void setId(Long id) {
+this.id = id;
+}
+
+public String getCreatedAt() {
+return createdAt;
+}
+
+public void setCreatedAt(String createdAt) {
+this.createdAt = createdAt;
+}
+
+public Long getUserId() {
+return userId;
+}
+
+public void setUserId(Long userId) {
+this.userId = userId;
+}
+
+public String getObjectType() {
+return objectType;
+}
+
+public void setObjectType(String objectType) {
+this.objectType = objectType;
+}
+
+public Long getObjectIdentfier() {
+return objectId;
+}
+
+public void entifier(Long objectIdentifier) {
+this.objectId = objectIdentifier;
+}
+
+public String getAction() {
+return action;
+}
+
+public void setAction(String action) {
+this.action = action;
+}
+
+public String getActor() {
+return actor;
+}
+
+public void setActor(String actor) {
+this.actor = actor;
+}
+
+public String getContent() {
+return content;
+}
+
+public void setContent(String content) {
+this.content = content;
+}
+
+public boolean isSystemGenerated() {
+return isSystemGenerated;
+}
+
+public void setSystemGenerated(boolean systemGenerated) {
+isSystemGenerated = systemGenerated;
+}
+
+public String getTenantIdentifier() {
+return tenantIdentifier;
+}
+
+public void setTenantIdentifier(String tenantIdentifier) {
+this.tenantIdentifier = tenantIdentifier;
+}
+
+public static class NotificationBuilder {
--- End diff --

Hi,
The use of this static class is only in `NotificationData` class. I have 
used this static inner class to implement a builder patt

[GitHub] incubator-fineract pull request #270: Notification Module

2017-01-13 Thread ad-os
Github user ad-os commented on a diff in the pull request:

https://github.com/apache/incubator-fineract/pull/270#discussion_r95986979
  
--- Diff: 
fineract-provider/src/main/java/org/apache/fineract/notification/domain/NotificationMapper.java
 ---
@@ -0,0 +1,121 @@
+/**
+ * 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.notification.domain;
+
+
+import 
org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
+import org.apache.fineract.useradministration.domain.AppUser;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name = "notification_mapper")
+public class NotificationMapper extends AbstractPersistableCustom {
+
+@ManyToOne
+@JoinColumn(name = "notification_id")
+private NotificationGenerator notificationGenerator;
+
+@ManyToOne
+@JoinColumn(name = "user_id")
+private AppUser userId;
+
+@Column(name = "is_read")
+private boolean isRead;
+
+@Column(name = "created_at")
+private String createdAt;
--- End diff --

hi,
I have stored a formatted string of date object in the database i.e why I 
used String here. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-fineract pull request #270: Notification Module

2017-01-12 Thread ad-os
Github user ad-os commented on a diff in the pull request:

https://github.com/apache/incubator-fineract/pull/270#discussion_r95950094
  
--- Diff: 
fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/NotificationApiTest.java
 ---
@@ -0,0 +1,57 @@
+package org.apache.fineract.integrationtests;
+
+/**
+ * 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.
+ */
+
+
+import com.jayway.restassured.builder.RequestSpecBuilder;
+import com.jayway.restassured.builder.ResponseSpecBuilder;
+import com.jayway.restassured.http.ContentType;
+import com.jayway.restassured.specification.RequestSpecification;
+import com.jayway.restassured.specification.ResponseSpecification;
+import org.apache.fineract.integrationtests.common.NotificationHelper;
+import org.apache.fineract.integrationtests.common.Utils;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.HashMap;
+
+public class NotificationApiTest {
+
+private ResponseSpecification responseSpec;
+private RequestSpecification requestSpec;
+
+@Before
+public void setUp() {
+Utils.initializeRESTAssured();
+this.requestSpec = new 
RequestSpecBuilder().setContentType(ContentType.JSON).build();
+this.requestSpec.header("Authorization", "Basic " + 
Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
+this.responseSpec = new 
ResponseSpecBuilder().expectStatusCode(200).build();
+}
+
+@Test
+@SuppressWarnings("unchecked")
+public void testNotificationRetrieval() {
+HashMap response = (HashMap) 
NotificationHelper.getNotifications(this.requestSpec,
--- End diff --

Hi,
I have included the test for sending and receiving of notifications in 
`test/java/org/apache/fineract/notification`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-fineract pull request #270: Notification Module

2017-01-03 Thread ad-os
GitHub user ad-os opened a pull request:

https://github.com/apache/incubator-fineract/pull/270

Notification Module

This module will allow developers to integrate notifications with their 
functionality. Here are some wikis on which you can read more about this module.

1) [Notification Module 
Design](https://mifosforge.jira.com/wiki/pages/viewpage.action?pageId=133070890)
2) [Notification API Developer User 
Guide](https://mifosforge.jira.com/wiki/display/MDZ/Notification+API+Developer+User+Guide)
3) [Configure Notifications-End User 
guide](https://mifosforge.jira.com/wiki/display/docs/Configure+Notifications)


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/ad-os/incubator-fineract notification

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-fineract/pull/270.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #270


commit dd3cdad1ee1569bc5a5a761d19b123f962a3a644
Author: Adhyan 
Date:   2017-01-03T08:54:30Z

Added Notification Module




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-fineract pull request #178: Added notification module

2017-01-02 Thread ad-os
Github user ad-os closed the pull request at:

https://github.com/apache/incubator-fineract/pull/178


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-fineract issue #178: Added notification module

2016-11-28 Thread ad-os
Github user ad-os commented on the issue:

https://github.com/apache/incubator-fineract/pull/178
  
Hi Nazeer,
What do you mean by 
>  API resourced should not have this changes ?
What I have currently refactored is like initiating the business events in 
the respective API resources and then listening to those business events. Is it 
good enough ?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-fineract issue #178: Added notification module

2016-11-22 Thread ad-os
Github user ad-os commented on the issue:

https://github.com/apache/incubator-fineract/pull/178
  
Okay, will do and get back to you :)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-fineract issue #178: Added notification module

2016-11-17 Thread ad-os
Github user ad-os commented on the issue:

https://github.com/apache/incubator-fineract/pull/178
  
I think I have followed the same design as the implementation of business 
events.

> You no need to modify all API resources

I have used only the publish method call from the API resources like 
`this.publisher.publishEvent(Event Object)` similar to what the business 
design uses i.e 
`this.businessEventNotifierService.notifyBusinessEventToBeExecuted(some 
parameters)`

Reasons why me and my mentor(Pranjal) decided  to use an external queue :-1 

1. if we don't use an external queue we can be at a disadvantage of loosing 
messages if the listener ceases to stop working. 
2. This design follows pub-sub pattern which is nowadays generally used to 
design notification module.

I think the only difference is that business event design uses a Map to 
store the list of published events and my implementation uses an external queue.
So, should I refactor like the one suggested by you or proceed with my 
implementation ?
Thanks.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-fineract issue #178: Added notification module

2016-11-17 Thread ad-os
Github user ad-os commented on the issue:

https://github.com/apache/incubator-fineract/pull/178
  
I have used jms to publish the generated notifications to a 
queue(implmented via ActiveMq) and then used the jmslistener to subscribe to 
that queue and listen for any new notification. More specifically, jms with 
ActiveMq has been used to make the generation and reception of messages to be 
asynchronous.
And Thanks for the review :smile: I will work on it.  


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-fineract pull request #178: Added notification module

2016-07-19 Thread ad-os
GitHub user ad-os opened a pull request:

https://github.com/apache/incubator-fineract/pull/178

Added notification module

This module will allow developers to integrate notifications with their 
functionality. Here are some wikis on which you can read more about this module.

1) [Notification Module 
Design](https://mifosforge.jira.com/wiki/pages/viewpage.action?pageId=133070890)
2) [Notification API Developer User 
Guide](https://mifosforge.jira.com/wiki/display/MDZ/Notification+API+Developer+User+Guide)

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/ad-os/incubator-fineract notification

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-fineract/pull/178.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #178


commit c62961b6398913f31ad6a72c256a5c224c09e440
Author: Adhyan 
Date:   2016-07-19T14:30:54Z

Added notification module

Added notification module
Added Notification Module

Refactored Code

Refactored Code

Refactored Code




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---