Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 056F420049D for ; Wed, 9 Aug 2017 15:01:53 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 03DAB169183; Wed, 9 Aug 2017 13:01:53 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 49374169181 for ; Wed, 9 Aug 2017 15:01:52 +0200 (CEST) Received: (qmail 57158 invoked by uid 500); 9 Aug 2017 13:01:51 -0000 Mailing-List: contact issues-help@fineract.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@fineract.apache.org Delivered-To: mailing list issues@fineract.apache.org Received: (qmail 57149 invoked by uid 99); 9 Aug 2017 13:01:51 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Aug 2017 13:01:51 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 44C38DFA3B; Wed, 9 Aug 2017 13:01:51 +0000 (UTC) From: nazeer1100126 To: issues@fineract.apache.org Reply-To: issues@fineract.apache.org References: In-Reply-To: Subject: [GitHub] fineract pull request #401: Extend-mifos-data-import-tool-office populate & ... Content-Type: text/plain Message-Id: <20170809130151.44C38DFA3B@git1-us-west.apache.org> Date: Wed, 9 Aug 2017 13:01:51 +0000 (UTC) archived-at: Wed, 09 Aug 2017 13:01:53 -0000 Github user nazeer1100126 commented on a diff in the pull request: https://github.com/apache/fineract/pull/401#discussion_r132176127 --- Diff: fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/service/BulkImportWorkbookPopulatorServiceImpl.java --- @@ -0,0 +1,108 @@ +/** + * 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.infrastructure.bulkimport.service; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.ResponseBuilder; + +import org.apache.fineract.infrastructure.bulkimport.populator.WorkbookPopulator; +import org.apache.fineract.infrastructure.bulkimport.populator.office.OfficeWorkbookPopulator; +import org.apache.fineract.infrastructure.core.exception.GeneralPlatformDomainRuleException; +import org.apache.fineract.infrastructure.core.service.DateUtils; +import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext; +import org.apache.fineract.organisation.office.api.OfficeApiConstants; +import org.apache.fineract.organisation.office.data.OfficeData; +import org.apache.fineract.organisation.office.service.OfficeReadPlatformService; + +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.Workbook; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class BulkImportWorkbookPopulatorServiceImpl implements BulkImportWorkbookPopulatorService { + + private final PlatformSecurityContext context; + private final OfficeReadPlatformService officeReadPlatformService; + + @Autowired + public BulkImportWorkbookPopulatorServiceImpl(final PlatformSecurityContext context, + final OfficeReadPlatformService officeReadPlatformService) { + this.context = context; + this.officeReadPlatformService = officeReadPlatformService; + } + + @Override + public Response getTemplate(final String entityType, final Long officeId, final Long staffId,final Long centerId, + final Long clientId,final Long groupId, final Long productId,final Long fundId, + final Long paymentTypeId,final String code,final Long glAccountId) { + + WorkbookPopulator populator = null; + final Workbook workbook = new HSSFWorkbook(); + if (entityType.trim().equalsIgnoreCase(OfficeApiConstants.OFFICE_RESOURCE_NAME)) { + populator = populateOfficeWorkbook(officeId); + } else + throw new GeneralPlatformDomainRuleException("error.msg.unable.to.find.resource", --- End diff -- if you are throwing exception here then what is the use of code after that? --- 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 infrastructure@apache.org or file a JIRA ticket with INFRA. ---