├── .gitignore
├── views
├── Callout.png
├── Thumbup.png
├── Ratesample.png
└── Thumbdown.png
├── src
└── main
│ ├── resources
│ ├── config.properties
│ ├── intuit-config.xml
│ └── log4j.properties
│ └── java
│ └── com
│ └── intuit
│ └── developer
│ └── sampleapp
│ └── crud
│ ├── helper
│ ├── Email.java
│ ├── Job.java
│ ├── TaxCodeInfo.java
│ ├── Address.java
│ ├── Telephone.java
│ ├── TermHelper.java
│ ├── ClassHelper.java
│ ├── InventoryAdjustmentHelper.java
│ ├── TransferHelper.java
│ ├── DepartmentHelper.java
│ ├── RecurringTransactionHelper.java
│ ├── TimeActivityHelper.java
│ └── VendorCreditHelper.java
│ ├── qbo
│ ├── DataServiceFactory.java
│ └── ReportServiceFactory.java
│ └── entities
│ ├── term
│ ├── TermCreate.java
│ ├── TermRead.java
│ ├── TermDelete.java
│ └── TermQuery.java
│ ├── item
│ ├── ItemCreate.java
│ ├── ItemRead.java
│ ├── ItemDelete.java
│ └── ItemQuery.java
│ ├── classentity
│ ├── ClassCreate.java
│ ├── ClassRead.java
│ └── ClassDelete.java
│ ├── deposit
│ ├── DepositCreate.java
│ ├── DepositRead.java
│ └── DepositDelete.java
│ ├── bill
│ ├── BillCreate.java
│ ├── BillRead.java
│ └── BillDelete.java
│ ├── taxpayment
│ ├── TaxPaymentRead.java
│ └── TaxPaymentQuery.java
│ ├── estimate
│ ├── EstimateCreate.java
│ ├── EstimateRead.java
│ └── EstimateDelete.java
│ ├── account
│ ├── AccountCreate.java
│ ├── AccountRead.java
│ └── AccountDelete.java
│ ├── transfer
│ ├── TransferCreate.java
│ ├── TransferRead.java
│ └── TransferDelete.java
│ ├── department
│ ├── DepartmentCreate.java
│ ├── DepartmentRead.java
│ └── DepartmentDelete.java
│ ├── creditmemo
│ ├── CreditMemoCreate.java
│ ├── CreditMemoRead.java
│ └── CreditMemoDelete.java
│ ├── taxcode
│ └── TaxCodeQuery.java
│ ├── taxrate
│ └── TaxRateQuery.java
│ ├── attachable
│ ├── AttachableCreate.java
│ ├── AttachableDelete.java
│ └── AttachableRead.java
│ ├── journalentry
│ ├── JournalEntryCreate.java
│ ├── JournalEntryRead.java
│ └── JournalEntryDelete.java
│ ├── paymentmethod
│ ├── PaymentMethodCreate.java
│ ├── PaymentMethodRead.java
│ └── PaymentMethodDelete.java
│ ├── vendorcredit
│ ├── VendorCreditCreate.java
│ ├── VendorCreditRead.java
│ └── VendorCreditDelete.java
│ ├── taxclassification
│ ├── TaxClassificationReadAll.java
│ ├── TaxClassificationReadById.java
│ ├── TaxClassificationReadByParentId.java
│ └── TaxClassificationReadByLevel.java
│ ├── billpayment
│ ├── BillPaymentCreate.java
│ ├── BillPaymentRead.java
│ ├── BillPaymentVoid.java
│ └── BillPaymentDelete.java
│ ├── invoice
│ ├── InvoiceCreate.java
│ ├── InvoiceDelete.java
│ ├── InvoiceVoid.java
│ └── InvoiceRead.java
│ ├── salesreceipt
│ ├── SalesReceiptCreate.java
│ ├── SalesReceiptDelete.java
│ ├── SalesReceiptVoid.java
│ ├── SalesReceiptSend.java
│ └── SalesReceiptRead.java
│ ├── purchaseorder
│ ├── PurchaseOrderCreate.java
│ ├── PurchaseOrderDelete.java
│ └── PurchaseOrderRead.java
│ ├── refundreceipt
│ ├── RefundReceiptCreate.java
│ ├── RefundReceiptDelete.java
│ └── RefundReceiptRead.java
│ ├── creditcardpayment
│ ├── CreditCardPaymentQuery.java
│ ├── CreditCardPaymentCreate.java
│ ├── CreditCardPaymentRead.java
│ └── CreditCardPaymentDelete.java
│ ├── timeactivity
│ ├── TimeActivityCreate.java
│ ├── TimeActivityDelete.java
│ └── TimeActivityRead.java
│ ├── purchase
│ ├── PurchaseCreate.java
│ ├── PurchaseRead.java
│ ├── PurchaseDelete.java
│ └── PurchaseVoid.java
│ ├── vendor
│ ├── VendorRead.java
│ ├── VendorDelete.java
│ └── VendorCreate.java
│ ├── payment
│ ├── PaymentCreate.java
│ ├── PaymentRead.java
│ ├── PaymentDelete.java
│ └── PaymentVoid.java
│ ├── inventoryadjustment
│ ├── InventoryAdjustmentCreate.java
│ ├── InventoryAdjustmentRead.java
│ └── InventoryAdjustmentDelete.java
│ ├── companyinfo
│ └── CompanyInfoQuery.java
│ ├── budget
│ └── BudgetQuery.java
│ ├── report
│ └── ReportQuery.java
│ ├── entitlements
│ └── EntitlementsRead.java
│ ├── preferences
│ └── PreferencesQuery.java
│ ├── customer
│ ├── CustomerRead.java
│ ├── CustomerDelete.java
│ └── CustomerCreate.java
│ ├── employee
│ ├── EmployeeRead.java
│ ├── EmployeeCreate.java
│ └── EmployeeDelete.java
│ ├── exchangerate
│ └── ExchangeRateQuery.java
│ ├── companycurrency
│ └── CompanyCurrencyQuery.java
│ ├── batch
│ └── Batch.java
│ └── reimbursecharge
│ └── ReimburseChargeQuery.java
├── NOTICE.txt
└── pom.xml
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea/*
2 | target/*
3 | /CRUD-SampleApp-Java.iml
4 |
--------------------------------------------------------------------------------
/views/Callout.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IntuitDeveloper/SampleApp-CRUD-Java/HEAD/views/Callout.png
--------------------------------------------------------------------------------
/views/Thumbup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IntuitDeveloper/SampleApp-CRUD-Java/HEAD/views/Thumbup.png
--------------------------------------------------------------------------------
/views/Ratesample.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IntuitDeveloper/SampleApp-CRUD-Java/HEAD/views/Ratesample.png
--------------------------------------------------------------------------------
/views/Thumbdown.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IntuitDeveloper/SampleApp-CRUD-Java/HEAD/views/Thumbdown.png
--------------------------------------------------------------------------------
/src/main/resources/config.properties:
--------------------------------------------------------------------------------
1 | #For OAuth2 app set oauth.type=2
2 | oauth.type=2
3 |
4 | #OAuth2 access token
5 | oauth2.accessToken=
6 |
7 | #company id or realmId
8 | company.id=
--------------------------------------------------------------------------------
/src/main/resources/intuit-config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | https://sandbox-quickbooks.api.intuit.com/v3/company
5 |
6 |
7 |
--------------------------------------------------------------------------------
/src/main/resources/log4j.properties:
--------------------------------------------------------------------------------
1 | log4j.rootLogger=DEBUG, STDOUT
2 |
3 | #This code sets SDK logger at level ERROR and overrides the rootLogger level.
4 | log4j.logger.com.intuit.platform=DEBUG
5 |
6 | #This appender will log messages to the console.
7 | log4j.appender.STDOUT=org.apache.log4j.ConsoleAppender
8 | log4j.appender.STDOUT.layout=org.apache.log4j.PatternLayout
9 | log4j.appender.STDOUT.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/helper/Email.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.helper;
2 |
3 | import com.intuit.ipp.data.EmailAddress;
4 |
5 | /**
6 | * @author dderose
7 | *
8 | */
9 | public final class Email {
10 |
11 | private Email() {
12 |
13 | }
14 |
15 | public static EmailAddress getEmailAddress() {
16 | EmailAddress emailAddr = new EmailAddress();
17 | emailAddr.setAddress("test@abc.com");
18 | return emailAddr;
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/NOTICE.txt:
--------------------------------------------------------------------------------
1 | Copyright 2016 Intuit, Inc.
2 |
3 | Licensed 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
4 |
5 | http://www.apache.org/licenses/LICENSE-2.0
6 |
7 | 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.
8 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/qbo/DataServiceFactory.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.qbo;
2 |
3 | import com.intuit.ipp.exception.FMSException;
4 | import com.intuit.ipp.services.DataService;
5 |
6 | /**
7 | *
8 | * @author dderose
9 | *
10 | */
11 |
12 | public class DataServiceFactory {
13 |
14 |
15 | /**
16 | * Initializes DataService for a given app/company profile
17 | *
18 | * @return
19 | * @throws FMSException
20 | */
21 | public static DataService getDataService() throws FMSException {
22 | //create dataservice
23 | return new DataService(ContextFactory.getContext());
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/qbo/ReportServiceFactory.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.qbo;
2 |
3 | import com.intuit.ipp.exception.FMSException;
4 | import com.intuit.ipp.services.ReportService;
5 |
6 | /**
7 | *
8 | * @author dderose
9 | *
10 | */
11 |
12 | public class ReportServiceFactory {
13 |
14 |
15 | /**
16 | * Initializes ReportService for a given app/company profile
17 | *
18 | * @return
19 | * @throws FMSException
20 | */
21 | public static ReportService getReportService() throws FMSException {
22 | //create reportservice
23 | return new ReportService(ContextFactory.getContext());
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/helper/Job.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.helper;
2 |
3 | import java.text.ParseException;
4 |
5 | import com.intuit.ipp.data.JobInfo;
6 | import com.intuit.ipp.data.JobStatusEnum;
7 | import com.intuit.ipp.util.DateUtils;
8 |
9 | /**
10 | * @author dderose
11 | *
12 | */
13 | public final class Job {
14 |
15 | private Job() {
16 |
17 | }
18 |
19 | public static JobInfo getJobInfo() throws ParseException {
20 | JobInfo jobInfo = new JobInfo();
21 | jobInfo.setDescription("In Progress");
22 | jobInfo.setStatus(JobStatusEnum.IN_PROGRESS);
23 | jobInfo.setStartDate(DateUtils.getDateWithPrevDays(2));
24 | jobInfo.setEndDate(DateUtils.getDateWithNextDays(5));
25 | jobInfo.setProjectedEndDate(DateUtils.getDateWithNextDays(5));
26 | return jobInfo;
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/helper/TaxCodeInfo.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.helper;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.ipp.data.ReferenceType;
6 | import com.intuit.ipp.data.TaxCode;
7 | import com.intuit.ipp.exception.FMSException;
8 | import com.intuit.ipp.services.DataService;
9 |
10 | /**
11 | * @author dderose
12 | *
13 | */
14 | public final class TaxCodeInfo {
15 |
16 | private TaxCodeInfo() {
17 |
18 | }
19 |
20 | public static TaxCode getTaxCode(DataService service) throws FMSException {
21 | List taxcodes = (List) service.findAll(new TaxCode());
22 | return taxcodes.get(0);
23 | }
24 |
25 | public static ReferenceType getTaxCodeRef(TaxCode taxcode) {
26 | ReferenceType taxcodeRef = new ReferenceType();
27 | taxcodeRef.setName(taxcode.getName());
28 | taxcodeRef.setValue(taxcode.getId());
29 | return taxcodeRef;
30 | }
31 |
32 | public static ReferenceType getTaxCodeRef(String taxcode) {
33 | ReferenceType taxcodeRef = new ReferenceType();
34 | taxcodeRef.setValue(taxcode);
35 | return taxcodeRef;
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/helper/Address.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.helper;
2 |
3 | import com.intuit.ipp.data.PhysicalAddress;
4 | import com.intuit.ipp.data.WebSiteAddress;
5 |
6 | /**
7 | * @author dderose
8 | *
9 | */
10 | public final class Address {
11 |
12 | private Address() {
13 |
14 | }
15 |
16 | public static PhysicalAddress getPhysicalAddress() {
17 | PhysicalAddress billingAdd = new PhysicalAddress();
18 | billingAdd.setLine1("123 Main St");
19 | billingAdd.setCity("Mountain View");
20 | billingAdd.setCountry("United States");
21 | billingAdd.setCountrySubDivisionCode("CA");
22 | billingAdd.setPostalCode("94043");
23 | return billingAdd;
24 | }
25 |
26 | public static WebSiteAddress getWebSiteAddress() {
27 | WebSiteAddress webSite = new WebSiteAddress();
28 | webSite.setURI("http://abccorp.com");
29 | webSite.setDefault(true);
30 | webSite.setTag("Business");
31 | return webSite;
32 | }
33 |
34 | public static PhysicalAddress getAddressForAST() {
35 | PhysicalAddress billingAdd = new PhysicalAddress();
36 | billingAdd.setLine1("2700 Coast Ave");
37 | billingAdd.setLine2("MountainView, CA 94043");
38 | return billingAdd;
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/helper/Telephone.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.helper;
2 |
3 | import com.intuit.ipp.data.TelephoneNumber;
4 |
5 | /**
6 | * @author dderose
7 | *
8 | */
9 | public final class Telephone {
10 |
11 | private Telephone() {
12 |
13 | }
14 |
15 | public static TelephoneNumber getPrimaryPhone() {
16 | TelephoneNumber primaryNum = new TelephoneNumber();
17 | primaryNum.setFreeFormNumber("(650)111-1111");
18 | primaryNum.setDefault(true);
19 | primaryNum.setTag("Business");
20 | return primaryNum;
21 | }
22 |
23 | public static TelephoneNumber getAlternatePhone() {
24 | TelephoneNumber alternativeNum = new TelephoneNumber();
25 | alternativeNum.setFreeFormNumber("(650)111-2222");
26 | alternativeNum.setDefault(false);
27 | alternativeNum.setTag("Business");
28 | return alternativeNum;
29 | }
30 |
31 | public static TelephoneNumber getMobilePhone() {
32 | TelephoneNumber mobile = new TelephoneNumber();
33 | mobile.setFreeFormNumber("(650)111-3333");
34 | mobile.setDefault(false);
35 | mobile.setTag("Home");
36 | return mobile;
37 | }
38 |
39 | public static TelephoneNumber getFax() {
40 | TelephoneNumber fax = new TelephoneNumber();
41 | fax.setFreeFormNumber("(650)111-1111");
42 | fax.setDefault(false);
43 | fax.setTag("Business");
44 | return fax;
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 4.0.0
3 | com.intuit.developer
4 | CRUD-SampleApp-Java
5 | 0.0.1-SNAPSHOT
6 |
7 |
8 | com.intuit.quickbooks-online
9 | ipp-v3-java-devkit
10 | 6.5.1
11 |
12 |
13 | com.intuit.quickbooks-online
14 | ipp-v3-java-data
15 | 6.5.1
16 |
17 |
18 |
19 | org.slf4j
20 | slf4j-log4j12
21 | 1.7.21
22 |
23 |
24 |
25 | CRUD-SampleApp-Java
26 |
27 |
28 | org.apache.maven.plugins
29 | maven-compiler-plugin
30 | 3.5.1
31 |
32 | 1.8
33 | 1.8
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/term/TermCreate.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.term;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.TermHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Error;
8 | import com.intuit.ipp.data.Term;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to create term
15 | *
16 | * @author dderose
17 | *
18 | */
19 | public class TermCreate {
20 |
21 | private static final org.slf4j.Logger LOG = Logger.getLogger();
22 |
23 | public static void main(String[] args) {
24 | try {
25 | createTerm();
26 | } catch (Exception e) {
27 | LOG.error("Error during CRUD", e.getCause());
28 | }
29 | }
30 |
31 | public static void createTerm() throws Exception {
32 |
33 | try {
34 |
35 | DataService service = DataServiceFactory.getDataService();
36 |
37 | // add term
38 | Term term = TermHelper.getTermFields();
39 | Term savedTerm = service.add(term);
40 | LOG.info("Term created: " + savedTerm.getId());
41 |
42 | } catch (FMSException e) {
43 | List list = e.getErrorList();
44 | list.forEach(error -> LOG.error("Error while calling entity add:: " + error.getMessage()));
45 | }
46 |
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/item/ItemCreate.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.item;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.ItemHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Error;
8 | import com.intuit.ipp.data.Item;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to create item
15 | *
16 | * @author dderose
17 | *
18 | */
19 | public class ItemCreate {
20 |
21 | private static final org.slf4j.Logger LOG = Logger.getLogger();
22 |
23 | public static void main(String[] args) {
24 | try {
25 | createItem();
26 | } catch (Exception e) {
27 | LOG.error("Error during CRUD", e.getCause());
28 | }
29 | }
30 |
31 | public static void createItem() throws Exception {
32 |
33 | try {
34 |
35 | DataService service = DataServiceFactory.getDataService();
36 |
37 | // add item
38 | Item item = ItemHelper.getItemFields(service);
39 | Item savedItem = service.add(item);
40 | LOG.info("Item created: " + savedItem.getId());
41 |
42 | } catch (FMSException e) {
43 | List list = e.getErrorList();
44 | list.forEach(error -> LOG.error("Error while calling entity add:: " + error.getMessage()));
45 | }
46 |
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/classentity/ClassCreate.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.classentity;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.ClassHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Class;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to create class
15 | *
16 | * @author dderose
17 | *
18 | */
19 | public class ClassCreate {
20 |
21 | private static final org.slf4j.Logger LOG = Logger.getLogger();
22 |
23 | public static void main(String[] args) {
24 | try {
25 | createClass();
26 | } catch (Exception e) {
27 | LOG.error("Error during CRUD", e.getCause());
28 | }
29 | }
30 |
31 | public static void createClass() throws Exception {
32 |
33 | try {
34 |
35 | DataService service = DataServiceFactory.getDataService();
36 |
37 | // add class
38 | Class classObj = ClassHelper.getClassFields();
39 | Class savedClass = service.add(classObj);
40 | LOG.info("Class created: " + savedClass.getId());
41 |
42 | } catch (FMSException e) {
43 | List list = e.getErrorList();
44 | list.forEach(error -> LOG.error("Error while calling entity add:: " + error.getMessage()));
45 | }
46 |
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/deposit/DepositCreate.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.deposit;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.DepositHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Deposit;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to create deposit
15 | *
16 | * @author dderose
17 | *
18 | */
19 | public class DepositCreate {
20 |
21 | private static final org.slf4j.Logger LOG = Logger.getLogger();
22 |
23 | public static void main(String[] args) {
24 | try {
25 | createDeposit();
26 | } catch (Exception e) {
27 | LOG.error("Error during CRUD", e.getCause());
28 | }
29 | }
30 |
31 | public static void createDeposit() throws Exception {
32 |
33 | try {
34 |
35 | DataService service = DataServiceFactory.getDataService();
36 |
37 | // add deposit
38 | Deposit deposit = DepositHelper.getDepositFields(service);
39 | Deposit savedDeposit = service.add(deposit);
40 | LOG.info("Deposit created: " + savedDeposit.getId());
41 |
42 | } catch (FMSException e) {
43 | List list = e.getErrorList();
44 | list.forEach(error -> LOG.error("Error while calling entity add:: " + error.getMessage()));
45 | }
46 |
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/bill/BillCreate.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.bill;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.BillHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Bill;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to create bill
15 | * 1. Using mandatory fields
16 | * 2. Using all fields
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class BillCreate {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | createBill();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void createBill() throws Exception {
34 |
35 | try {
36 |
37 | DataService service = DataServiceFactory.getDataService();
38 |
39 | // add bill
40 | Bill bill = BillHelper.getBillFields(service);
41 | Bill savedBill = service.add(bill);
42 | LOG.info("Bill created: " + savedBill.getId());
43 |
44 | } catch (FMSException e) {
45 | List list = e.getErrorList();
46 | list.forEach(error -> LOG.error("Error while calling entity add:: " + error.getMessage()));
47 | }
48 |
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/taxpayment/TaxPaymentRead.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.taxpayment;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
6 | import com.intuit.ipp.data.Error;
7 | import com.intuit.ipp.data.TaxPayment;
8 | import com.intuit.ipp.exception.FMSException;
9 | import com.intuit.ipp.services.DataService;
10 | import com.intuit.ipp.util.Logger;
11 |
12 | /**
13 | * Demonstrates methods to read TaxPayment data using TaxPayment id
14 | *
15 | * @author dderose
16 | *
17 | */
18 | public class TaxPaymentRead {
19 |
20 | private static final org.slf4j.Logger LOG = Logger.getLogger();
21 |
22 | public static void main(String[] args) {
23 | try {
24 | getTaxPayment();
25 | } catch (Exception e) {
26 | LOG.error("Error during CRUD", e.getCause());
27 | }
28 | }
29 |
30 | public static void getTaxPayment() throws FMSException {
31 |
32 | try {
33 |
34 | DataService service = DataServiceFactory.getDataService();
35 |
36 | TaxPayment taxPayment = new TaxPayment();
37 | taxPayment.setId(""); //Set the id
38 |
39 | TaxPayment taxPaymentOut = service.findById(taxPayment);
40 | LOG.info("TaxPayment Amount: " + taxPaymentOut.getPaymentAmount());
41 |
42 | } catch (FMSException e) {
43 | List list = e.getErrorList();
44 | list.forEach(error -> LOG.error("Error while calling entity findById:: " + error.getMessage()));
45 | }
46 |
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/helper/TermHelper.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.helper;
2 |
3 | import java.math.BigDecimal;
4 | import java.util.List;
5 |
6 | import org.apache.commons.lang3.RandomStringUtils;
7 |
8 | import com.intuit.ipp.data.ReferenceType;
9 | import com.intuit.ipp.data.Term;
10 | import com.intuit.ipp.exception.FMSException;
11 | import com.intuit.ipp.services.DataService;
12 |
13 | /**
14 | * @author dderose
15 | *
16 | */
17 | public final class TermHelper {
18 |
19 | private TermHelper() {
20 |
21 | }
22 |
23 | public static Term getTermFields() throws FMSException {
24 |
25 | Term term = new Term();
26 | term.setName("Term_" + RandomStringUtils.randomAlphanumeric(5));
27 | term.setActive(true);
28 | term.setType("STANDARD");
29 | term.setDiscountPercent(new BigDecimal("50.00"));
30 | term.setDueDays(50);
31 | return term;
32 | }
33 |
34 | public static Term getTerm(DataService service) throws FMSException {
35 | List terms = (List) service.findAll(new Term());
36 | if (!terms.isEmpty()) {
37 | return terms.get(0);
38 | }
39 | return createTerm(service);
40 | }
41 |
42 | private static Term createTerm(DataService service) throws FMSException {
43 | return service.add(getTermFields());
44 | }
45 |
46 | public static ReferenceType getTermRef(Term term) {
47 | ReferenceType termRef = new ReferenceType();
48 | termRef.setName(term.getName());
49 | termRef.setValue(term.getId());
50 | return termRef;
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/estimate/EstimateCreate.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.estimate;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.EstimateHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Error;
8 | import com.intuit.ipp.data.Estimate;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to create estimate
15 | *
16 | * @author dderose
17 | *
18 | */
19 | public class EstimateCreate {
20 |
21 | private static final org.slf4j.Logger LOG = Logger.getLogger();
22 |
23 | public static void main(String[] args) {
24 | try {
25 | createEstimate();
26 | } catch (Exception e) {
27 | LOG.error("Error during CRUD", e.getCause());
28 | }
29 | }
30 |
31 | public static void createEstimate() throws Exception {
32 |
33 | try {
34 |
35 | DataService service = DataServiceFactory.getDataService();
36 |
37 | // add estimate
38 | Estimate estimate = EstimateHelper.getEstimateFields(service);
39 | Estimate savedEstimate = service.add(estimate);
40 | LOG.info("Estimate created: " + savedEstimate.getId());
41 |
42 | } catch (FMSException e) {
43 | List list = e.getErrorList();
44 | list.forEach(error -> LOG.error("Error while calling entity add:: " + error.getMessage()));
45 | }
46 |
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/helper/ClassHelper.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.helper;
2 |
3 | import java.util.List;
4 |
5 | import org.apache.commons.lang3.RandomStringUtils;
6 |
7 | import com.intuit.ipp.data.Class;
8 | import com.intuit.ipp.data.ReferenceType;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 |
12 | /**
13 | * @author dderose
14 | *
15 | */
16 | public final class ClassHelper {
17 |
18 | private ClassHelper() {
19 |
20 | }
21 |
22 | public static Class getClassFields() throws FMSException {
23 |
24 | Class classObj = new Class();
25 | classObj.setName("Class_name_" + RandomStringUtils.randomAlphanumeric(5));
26 | classObj.setSubClass(false);
27 | classObj.setFullyQualifiedName("Class_name_" + RandomStringUtils.randomAlphanumeric(5));
28 | return classObj;
29 | }
30 |
31 | public static Class getClass(DataService service) throws FMSException {
32 | List classes = (List) service.findAll(new Class());
33 | if (!classes.isEmpty()) {
34 | return classes.get(0);
35 | }
36 | return createClass(service);
37 | }
38 |
39 | private static Class createClass(DataService service) throws FMSException {
40 | return service.add(getClassFields());
41 | }
42 |
43 | public static ReferenceType getClassRef(Class classObj) {
44 | ReferenceType classRef = new ReferenceType();
45 | classRef.setName(classObj.getName());
46 | classRef.setValue(classObj.getId());
47 | return classRef;
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/account/AccountCreate.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.account;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.AccountHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Account;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to create account
15 | *
16 | * @author dderose
17 | *
18 | */
19 | public class AccountCreate {
20 |
21 | private static final org.slf4j.Logger LOG = Logger.getLogger();
22 |
23 | public static void main(String[] args) {
24 | try {
25 | createAccount();
26 | } catch (Exception e) {
27 | LOG.error("Error during CRUD", e.getCause());
28 | }
29 | }
30 |
31 | public static void createAccount() throws Exception {
32 |
33 | try {
34 |
35 | DataService service = DataServiceFactory.getDataService();
36 |
37 | // add bank account
38 | Account account = AccountHelper.getBankAccountFields();
39 | Account savedAccount = service.add(account);
40 | LOG.info("Account created: " + savedAccount.getId());
41 |
42 | } catch (FMSException e) {
43 | List list = e.getErrorList();
44 | list.forEach(error -> LOG.error("Error while calling entity add:: " + error.getMessage()));
45 | }
46 |
47 | }
48 |
49 |
50 |
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/transfer/TransferCreate.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.transfer;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.TransferHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Error;
8 | import com.intuit.ipp.data.Transfer;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to create transfer
15 | *
16 | * @author dderose
17 | *
18 | */
19 | public class TransferCreate {
20 |
21 | private static final org.slf4j.Logger LOG = Logger.getLogger();
22 |
23 | public static void main(String[] args) {
24 | try {
25 | createTransfer();
26 | } catch (Exception e) {
27 | LOG.error("Error during CRUD", e.getCause());
28 | }
29 | }
30 |
31 | public static void createTransfer() throws Exception {
32 |
33 | try {
34 |
35 | DataService service = DataServiceFactory.getDataService();
36 |
37 | // add transfer
38 | Transfer transfer = TransferHelper.getTransferFields(service);
39 | Transfer savedTransfer = service.add(transfer);
40 | LOG.info("Transfer created: " + savedTransfer.getId());
41 |
42 | } catch (FMSException e) {
43 | List list = e.getErrorList();
44 | list.forEach(error -> LOG.error("Error while calling entity add:: " + error.getMessage()));
45 | }
46 |
47 | }
48 |
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/department/DepartmentCreate.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.department;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.DepartmentHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Department;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to create department
15 | *
16 | * @author dderose
17 | *
18 | */
19 | public class DepartmentCreate {
20 |
21 | private static final org.slf4j.Logger LOG = Logger.getLogger();
22 |
23 | public static void main(String[] args) {
24 | try {
25 | createDepartment();
26 | } catch (Exception e) {
27 | LOG.error("Error during CRUD", e.getCause());
28 | }
29 | }
30 |
31 | public static void createDepartment() throws Exception {
32 |
33 | try {
34 |
35 | DataService service = DataServiceFactory.getDataService();
36 |
37 | // add department
38 | Department department = DepartmentHelper.getDepartmentFields();
39 | Department savedDepartment = service.add(department);
40 | LOG.info("Department created: " + savedDepartment.getId());
41 |
42 | } catch (FMSException e) {
43 | List list = e.getErrorList();
44 | list.forEach(error -> LOG.error("Error while calling entity add:: " + error.getMessage()));
45 | }
46 |
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/helper/InventoryAdjustmentHelper.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.helper;
2 |
3 | import com.intuit.ipp.data.*;
4 | import com.intuit.ipp.exception.FMSException;
5 | import com.intuit.ipp.services.DataService;
6 |
7 | import java.math.BigDecimal;
8 | import java.util.ArrayList;
9 | import java.util.List;
10 |
11 | /**
12 | * @author sramadass
13 | *
14 | */
15 | public final class InventoryAdjustmentHelper {
16 |
17 | private InventoryAdjustmentHelper() {
18 |
19 | }
20 |
21 | public static InventoryAdjustment getInvAdjFields(DataService service) throws FMSException {
22 |
23 | InventoryAdjustment inventoryAdjustment = new InventoryAdjustment();
24 |
25 | Account account = AccountHelper.getAssetAccount(service);
26 | inventoryAdjustment.setAdjustAccountRef(AccountHelper.getAccountRef(account));
27 |
28 | inventoryAdjustment.setPrivateNote("Memo 1");
29 |
30 | List invLine = new ArrayList();
31 | Line line = new Line();
32 | line.setDetailType(LineDetailTypeEnum.ITEM_ADJUSTMENT_LINE_DETAIL);
33 |
34 | ItemAdjustmentLineDetail itemAdjustmentLineDetail = new ItemAdjustmentLineDetail();
35 | itemAdjustmentLineDetail.setQtyDiff(new BigDecimal(3));
36 |
37 | Item invItem = ItemHelper.getInventoryItem(service);
38 | itemAdjustmentLineDetail.setItemRef(ItemHelper.getItemRef(invItem));
39 | line.setItemAdjustmentLineDetail(itemAdjustmentLineDetail);
40 | invLine.add(line);
41 | inventoryAdjustment.setLine(invLine);
42 |
43 | return inventoryAdjustment;
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/creditmemo/CreditMemoCreate.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.creditmemo;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.CreditMemoHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.CreditMemo;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to create creditmemo
15 | *
16 | * @author dderose
17 | *
18 | */
19 | public class CreditMemoCreate {
20 |
21 | private static final org.slf4j.Logger LOG = Logger.getLogger();
22 |
23 | public static void main(String[] args) {
24 | try {
25 | createCreditMemo();
26 | } catch (Exception e) {
27 | LOG.error("Error during CRUD", e.getCause());
28 | }
29 | }
30 |
31 | public static void createCreditMemo() throws Exception {
32 |
33 | try {
34 |
35 | DataService service = DataServiceFactory.getDataService();
36 |
37 | // add creditmemo
38 | CreditMemo creditmemo = CreditMemoHelper.getCreditMemoFields(service);
39 | CreditMemo savedCreditMemo = service.add(creditmemo);
40 | LOG.info("CreditMemo created: " + savedCreditMemo.getId());
41 |
42 | } catch (FMSException e) {
43 | List list = e.getErrorList();
44 | list.forEach(error -> LOG.error("Error while calling entity add:: " + error.getMessage()));
45 | }
46 |
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/taxpayment/TaxPaymentQuery.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.taxpayment;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
6 | import com.intuit.ipp.data.Error;
7 | import com.intuit.ipp.exception.FMSException;
8 | import com.intuit.ipp.services.DataService;
9 | import com.intuit.ipp.services.QueryResult;
10 | import com.intuit.ipp.util.Logger;
11 |
12 | /**
13 | * Demonstrates methods to query TaxPayment data
14 | * 1. Query all records
15 | *
16 | * @author dderose
17 | *
18 | */
19 | public class TaxPaymentQuery {
20 |
21 | private static final org.slf4j.Logger LOG = Logger.getLogger();
22 |
23 | public static void main(String[] args) {
24 | try {
25 | queryTaxPayments();
26 | } catch (Exception e) {
27 | LOG.error("Error during CRUD", e.getCause());
28 | }
29 | }
30 |
31 | public static void queryTaxPayments() throws FMSException {
32 |
33 | try {
34 |
35 | DataService service = DataServiceFactory.getDataService();
36 |
37 | // get all taxpayments
38 | String sql = "SELECT * FROM TaxPayment";
39 | QueryResult queryResult = service.executeQuery(sql);
40 | int count = queryResult.getEntities().size();
41 |
42 | LOG.info("Total number of TaxPayments: " + count);
43 |
44 |
45 |
46 | } catch (FMSException e) {
47 | List list = e.getErrorList();
48 | list.forEach(error -> LOG.error("Error while calling executeQuery :: " + error.getMessage()));
49 | }
50 |
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/taxcode/TaxCodeQuery.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.taxcode;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Error;
8 | import com.intuit.ipp.exception.FMSException;
9 | import com.intuit.ipp.services.DataService;
10 | import com.intuit.ipp.services.QueryResult;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to query taxcode data
15 | * 1. Query all records
16 | *
17 | * @author dderose
18 | *
19 | */
20 | public class TaxCodeQuery {
21 |
22 | private static final org.slf4j.Logger LOG = Logger.getLogger();
23 |
24 | public static void main(String[] args) {
25 | try {
26 | queryTaxCodes();
27 | } catch (Exception e) {
28 | LOG.error("Error during CRUD", e.getCause());
29 | }
30 | }
31 |
32 | public static void queryTaxCodes() throws FMSException, ParseException {
33 |
34 | try {
35 |
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // get all taxcodes
39 | String sql = "select * from taxcode";
40 | QueryResult queryResult = service.executeQuery(sql);
41 | int count = queryResult.getEntities().size();
42 |
43 | LOG.info("Total number of taxcodes: " + count);
44 |
45 |
46 | } catch (FMSException e) {
47 | List list = e.getErrorList();
48 | list.forEach(error -> LOG.error("Error while calling executeQuery :: " + error.getMessage()));
49 | }
50 |
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/taxrate/TaxRateQuery.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.taxrate;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Error;
8 | import com.intuit.ipp.exception.FMSException;
9 | import com.intuit.ipp.services.DataService;
10 | import com.intuit.ipp.services.QueryResult;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to query taxrate data
15 | * 1. Query all records
16 | *
17 | * @author dderose
18 | *
19 | */
20 | public class TaxRateQuery {
21 |
22 | private static final org.slf4j.Logger LOG = Logger.getLogger();
23 |
24 | public static void main(String[] args) {
25 | try {
26 | queryTaxRates();
27 | } catch (Exception e) {
28 | LOG.error("Error during CRUD", e.getCause());
29 | }
30 | }
31 |
32 | public static void queryTaxRates() throws FMSException, ParseException {
33 |
34 | try {
35 |
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // get all taxrates
39 | String sql = "select * from taxrate";
40 | QueryResult queryResult = service.executeQuery(sql);
41 | int count = queryResult.getEntities().size();
42 |
43 | LOG.info("Total number of taxrates: " + count);
44 |
45 |
46 | } catch (FMSException e) {
47 | List list = e.getErrorList();
48 | list.forEach(error -> LOG.error("Error while calling executeQuery :: " + error.getMessage()));
49 | }
50 |
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/attachable/AttachableCreate.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.attachable;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.AttachableHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Attachable;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates method to create attachable
15 | *
16 | * @author dderose
17 | *
18 | */
19 | public class AttachableCreate {
20 |
21 | private static final org.slf4j.Logger LOG = Logger.getLogger();
22 |
23 | public static void main(String[] args) {
24 | try {
25 | createAttachable();
26 | } catch (Exception e) {
27 | LOG.error("Error during CRUD", e.getCause());
28 | }
29 | }
30 |
31 | public static void createAttachable() throws Exception {
32 |
33 | try {
34 |
35 | DataService service = DataServiceFactory.getDataService();
36 |
37 | // add attachable with minimum mandatory fields
38 | Attachable attachable = AttachableHelper.getAttachableFields(service);
39 | Attachable savedAttachable = service.add(attachable);
40 | LOG.info("Attachable created: " + savedAttachable.getId());
41 |
42 | } catch (FMSException e) {
43 | List list = e.getErrorList();
44 | list.forEach(error -> LOG.error("Error while calling entity add:: " + error.getMessage()));
45 | }
46 |
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/journalentry/JournalEntryCreate.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.journalentry;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.JournalEntryHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Error;
8 | import com.intuit.ipp.data.JournalEntry;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to create journalEntry
15 | *
16 | * @author dderose
17 | *
18 | */
19 | public class JournalEntryCreate {
20 |
21 | private static final org.slf4j.Logger LOG = Logger.getLogger();
22 |
23 | public static void main(String[] args) {
24 | try {
25 | createJournalEntry();
26 | } catch (Exception e) {
27 | LOG.error("Error during CRUD", e.getCause());
28 | }
29 | }
30 |
31 | public static void createJournalEntry() throws Exception {
32 |
33 | try {
34 |
35 | DataService service = DataServiceFactory.getDataService();
36 |
37 | // add journalentry
38 | JournalEntry journalentry = JournalEntryHelper.getJournalEntryFields(service);
39 | JournalEntry savedJournalEntry = service.add(journalentry);
40 | LOG.info("JournalEntry created: " + savedJournalEntry.getId());
41 |
42 | } catch (FMSException e) {
43 | List list = e.getErrorList();
44 | list.forEach(error -> LOG.error("Error while calling entity add:: " + error.getMessage()));
45 | }
46 |
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/paymentmethod/PaymentMethodCreate.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.paymentmethod;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.PaymentHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Error;
8 | import com.intuit.ipp.data.PaymentMethod;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to create payment method
15 | *
16 | * @author dderose
17 | *
18 | */
19 | public class PaymentMethodCreate {
20 |
21 | private static final org.slf4j.Logger LOG = Logger.getLogger();
22 |
23 | public static void main(String[] args) {
24 | try {
25 | createPaymentMethod();
26 | } catch (Exception e) {
27 | LOG.error("Error during CRUD", e.getCause());
28 | }
29 | }
30 |
31 | public static void createPaymentMethod() throws Exception {
32 |
33 | try {
34 |
35 | DataService service = DataServiceFactory.getDataService();
36 |
37 | // add paymentmethod
38 | PaymentMethod paymentmethod = PaymentHelper.getPaymentMethodFields();
39 | PaymentMethod savedPaymentMethod = service.add(paymentmethod);
40 | LOG.info("PaymentMethod created: " + savedPaymentMethod.getId());
41 |
42 | } catch (FMSException e) {
43 | List list = e.getErrorList();
44 | list.forEach(error -> LOG.error("Error while calling entity add:: " + error.getMessage()));
45 | }
46 |
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/vendorcredit/VendorCreditCreate.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.vendorcredit;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.VendorCreditHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Error;
8 | import com.intuit.ipp.data.VendorCredit;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to create vendorcredit
15 | *
16 | * @author dderose
17 | *
18 | */
19 | public class VendorCreditCreate {
20 |
21 | private static final org.slf4j.Logger LOG = Logger.getLogger();
22 |
23 | public static void main(String[] args) {
24 | try {
25 | createVendorCredit();
26 | } catch (Exception e) {
27 | LOG.error("Error during CRUD", e.getCause());
28 | }
29 | }
30 |
31 | public static void createVendorCredit() throws Exception {
32 |
33 | try {
34 |
35 | DataService service = DataServiceFactory.getDataService();
36 |
37 | // add vendorcredit
38 | VendorCredit vendorcredit = VendorCreditHelper.getVendorCreditFields(service);
39 | VendorCredit savedVendorCredit = service.add(vendorcredit);
40 | LOG.info("VendorCredit created: " + savedVendorCredit.getId());
41 |
42 | } catch (FMSException e) {
43 | List list = e.getErrorList();
44 | list.forEach(error -> LOG.error("Error while calling entity add:: " + error.getMessage()));
45 | }
46 |
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/taxclassification/TaxClassificationReadAll.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.taxclassification;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Error;
8 | import com.intuit.ipp.exception.FMSException;
9 | import com.intuit.ipp.services.DataService;
10 | import com.intuit.ipp.services.QueryResult;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to query all TaxClassification data
15 | *
16 | * @author dderose
17 | *
18 | */
19 | public class TaxClassificationReadAll {
20 |
21 | private static final org.slf4j.Logger LOG = Logger.getLogger();
22 |
23 | public static void main(String[] args) {
24 | try {
25 | queryAllTaxClassifications();
26 | } catch (Exception e) {
27 | LOG.error("Error during CRUD", e.getCause());
28 | }
29 | }
30 |
31 | public static void queryAllTaxClassifications() throws FMSException, ParseException {
32 |
33 | try {
34 |
35 | DataService service = DataServiceFactory.getDataService();
36 |
37 | // find all tax classification
38 | QueryResult queryResult = service.findAllTaxClassification();
39 | int count = queryResult.getEntities().size();
40 | LOG.info("Total number of taxclassification :: " + count);
41 |
42 | } catch (FMSException e) {
43 | List list = e.getErrorList();
44 | list.forEach(error -> LOG.error("Error while calling executeQuery :: " + error.getMessage()));
45 | }
46 |
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/helper/TransferHelper.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.helper;
2 |
3 | import java.math.BigDecimal;
4 | import java.text.ParseException;
5 |
6 | import com.intuit.ipp.data.Account;
7 | import com.intuit.ipp.data.Transfer;
8 | import com.intuit.ipp.exception.FMSException;
9 | import com.intuit.ipp.services.DataService;
10 | import com.intuit.ipp.util.DateUtils;
11 |
12 | /**
13 | * @author dderose
14 | *
15 | */
16 | public final class TransferHelper {
17 |
18 | private TransferHelper() {
19 |
20 | }
21 |
22 | public static Transfer getTransferFields(DataService service) throws FMSException {
23 | Transfer transfer = new Transfer();
24 | try {
25 | transfer.setTxnDate(DateUtils.getCurrentDateTime());
26 | } catch (ParseException e) {
27 | throw new FMSException("ParseException while getting current date.");
28 | }
29 |
30 | Account depositAccount = AccountHelper.getAssetAccount(service);
31 | transfer.setFromAccountRef(AccountHelper.getAccountRef(depositAccount));
32 |
33 | Account creditAccount = AccountHelper.getCreditCardBankAccount(service);
34 | transfer.setToAccountRef(AccountHelper.getAccountRef(creditAccount));
35 |
36 | transfer.setAmount(new BigDecimal("100.00"));
37 | transfer.setDomain("QBO");
38 | transfer.setPrivateNote("Transfer " + transfer.getAmount() + " from " + depositAccount.getFullyQualifiedName() + " to " + creditAccount.getFullyQualifiedName());
39 |
40 | return transfer;
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/billpayment/BillPaymentCreate.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.billpayment;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.BillHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.BillPayment;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to create billpayment
15 | *
16 | * @author dderose
17 | *
18 | */
19 | public class BillPaymentCreate {
20 |
21 | private static final org.slf4j.Logger LOG = Logger.getLogger();
22 |
23 | public static void main(String[] args) {
24 | try {
25 | createBillPayment();
26 | } catch (Exception e) {
27 | LOG.error("Error during CRUD", e.getCause());
28 | }
29 | }
30 |
31 | public static void createBillPayment() throws Exception {
32 |
33 | try {
34 |
35 | DataService service = DataServiceFactory.getDataService();
36 |
37 | // add billpayment with minimum mandatory fields
38 | BillPayment account = BillHelper.getBillPaymentFields(service);
39 | BillPayment savedBillPayment = service.add(account);
40 | LOG.info("BillPayment created: " + savedBillPayment.getId());
41 |
42 | } catch (FMSException e) {
43 | List list = e.getErrorList();
44 | list.forEach(error -> LOG.error("Error while calling entity add:: " + error.getMessage()));
45 | }
46 |
47 | }
48 |
49 |
50 |
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/invoice/InvoiceCreate.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.invoice;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.InvoiceHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Error;
8 | import com.intuit.ipp.data.Invoice;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to create invoice
15 | * 1. Using mandatory fields
16 | * 2. Using all fields
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class InvoiceCreate {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | createInvoice();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void createInvoice() throws Exception {
34 |
35 | try {
36 |
37 | DataService service = DataServiceFactory.getDataService();
38 |
39 | // add invoice
40 | Invoice invoice = InvoiceHelper.getInvoiceFields(service);
41 | Invoice savedInvoice = service.add(invoice);
42 | LOG.info("Invoice created: " + savedInvoice.getId() + " ::invoice doc num: " + savedInvoice.getDocNumber());
43 |
44 | } catch (FMSException e) {
45 | List list = e.getErrorList();
46 | list.forEach(error -> LOG.error("Error while calling entity add:: " + error.getMessage()));
47 | }
48 |
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/term/TermRead.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.term;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.TermHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Error;
8 | import com.intuit.ipp.data.Term;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to read term data using term id
15 | * Note: We'll create an entity first and then read the same
16 | *
17 | * @author dderose
18 | *
19 | */
20 | public class TermRead {
21 |
22 | private static final org.slf4j.Logger LOG = Logger.getLogger();
23 |
24 | public static void main(String[] args) {
25 | try {
26 | getTerm();
27 | } catch (Exception e) {
28 | LOG.error("Error during CRUD", e.getCause());
29 | }
30 | }
31 |
32 | public static void getTerm() throws FMSException {
33 |
34 | try {
35 |
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // add term
39 | Term term = TermHelper.getTermFields();
40 | Term savedTerm = service.add(term);
41 | LOG.info("Term created: " + savedTerm.getId());
42 |
43 | Term termOut = service.findById(savedTerm);
44 | LOG.info("Term name: " + termOut.getName());
45 |
46 | } catch (FMSException e) {
47 | List list = e.getErrorList();
48 | list.forEach(error -> LOG.error("Error while calling entity findById:: " + error.getMessage()));
49 | }
50 |
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/item/ItemRead.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.item;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.ItemHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Error;
8 | import com.intuit.ipp.data.Item;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to read item data using item id
15 | * Note: We'll create an entity first and then read the same
16 | *
17 | * @author dderose
18 | *
19 | */
20 | public class ItemRead {
21 |
22 | private static final org.slf4j.Logger LOG = Logger.getLogger();
23 |
24 | public static void main(String[] args) {
25 | try {
26 | getItem();
27 | } catch (Exception e) {
28 | LOG.error("Error during CRUD", e.getCause());
29 | }
30 | }
31 |
32 | public static void getItem() throws FMSException {
33 |
34 | try {
35 |
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // add item
39 | Item item = ItemHelper.getItemFields(service);
40 | Item savedItem = service.add(item);
41 | LOG.info("Item created: " + savedItem.getId());
42 |
43 | Item itemOut = service.findById(savedItem);
44 | LOG.info("Item name: " + itemOut.getName());
45 |
46 | } catch (FMSException e) {
47 | List list = e.getErrorList();
48 | list.forEach(error -> LOG.error("Error while calling entity findById:: " + error.getMessage()));
49 | }
50 |
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/salesreceipt/SalesReceiptCreate.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.salesreceipt;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.SalesReceiptHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Error;
8 | import com.intuit.ipp.data.SalesReceipt;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to create salesreceipt
15 | *
16 | * @author dderose
17 | *
18 | */
19 | public class SalesReceiptCreate {
20 |
21 | private static final org.slf4j.Logger LOG = Logger.getLogger();
22 |
23 | public static void main(String[] args) {
24 | try {
25 | createSalesReceipt();
26 | } catch (Exception e) {
27 | LOG.error("Error during CRUD", e.getCause());
28 | }
29 | }
30 |
31 | public static void createSalesReceipt() throws Exception {
32 |
33 | try {
34 |
35 | DataService service = DataServiceFactory.getDataService();
36 |
37 | // add salesreceipt
38 | SalesReceipt salesreceipt = SalesReceiptHelper.getSalesReceiptFields(service);
39 | SalesReceipt savedSalesReceipt = service.add(salesreceipt);
40 | LOG.info("SalesReceipt created: " + savedSalesReceipt.getId() + " ::salesreceipt doc num: " + savedSalesReceipt.getDocNumber());
41 |
42 | } catch (FMSException e) {
43 | List list = e.getErrorList();
44 | list.forEach(error -> LOG.error("Error while calling entity add:: " + error.getMessage()));
45 | }
46 |
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/purchaseorder/PurchaseOrderCreate.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.purchaseorder;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.PurchaseHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Error;
8 | import com.intuit.ipp.data.PurchaseOrder;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to create purchaseorder
15 | *
16 | * @author dderose
17 | *
18 | */
19 | public class PurchaseOrderCreate {
20 |
21 | private static final org.slf4j.Logger LOG = Logger.getLogger();
22 |
23 | public static void main(String[] args) {
24 | try {
25 | createPurchaseOrder();
26 | } catch (Exception e) {
27 | LOG.error("Error during CRUD", e.getCause());
28 | }
29 | }
30 |
31 | public static void createPurchaseOrder() throws Exception {
32 |
33 | try {
34 |
35 | DataService service = DataServiceFactory.getDataService();
36 |
37 | // add purchaseorder
38 | PurchaseOrder purchaseorder = PurchaseHelper.getPurchaseOrderFields(service);
39 | PurchaseOrder savedPurchaseOrder = service.add(purchaseorder);
40 | LOG.info("PurchaseOrder created: " + savedPurchaseOrder.getId() + " ::purchaseorder doc num: " + savedPurchaseOrder.getDocNumber());
41 |
42 | } catch (FMSException e) {
43 | List list = e.getErrorList();
44 | list.forEach(error -> LOG.error("Error while calling entity add:: " + error.getMessage()));
45 | }
46 |
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/helper/DepartmentHelper.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.helper;
2 |
3 | import java.util.List;
4 |
5 | import org.apache.commons.lang3.RandomStringUtils;
6 |
7 | import com.intuit.ipp.data.Department;
8 | import com.intuit.ipp.data.ReferenceType;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 |
12 | /**
13 | * @author dderose
14 | *
15 | */
16 | public final class DepartmentHelper {
17 |
18 | private DepartmentHelper() {
19 |
20 | }
21 |
22 | public static Department getDepartmentFields() throws FMSException {
23 |
24 | Department department = new Department();
25 | department.setName("departmentname_" + RandomStringUtils.randomAlphanumeric(5));
26 | department.setFullyQualifiedName("departmentname_" + RandomStringUtils.randomAlphanumeric(5));
27 | department.setSubDepartment(false);
28 | return department;
29 | }
30 |
31 | public static Department getDepartment(DataService service) throws FMSException {
32 | List departments = (List) service.findAll(new Department());
33 | if (!departments.isEmpty()) {
34 | return departments.get(0);
35 | }
36 | return createDepartment(service);
37 | }
38 |
39 | private static Department createDepartment(DataService service) throws FMSException {
40 | return service.add(getDepartmentFields());
41 | }
42 |
43 | public static ReferenceType getDepartmentRef(Department department) {
44 | ReferenceType departmentRef = new ReferenceType();
45 | departmentRef.setName(department.getName());
46 | departmentRef.setValue(department.getId());
47 | return departmentRef;
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/helper/RecurringTransactionHelper.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.helper;
2 |
3 | import com.intuit.ipp.core.IEntity;
4 | import com.intuit.ipp.data.*;
5 | import com.intuit.ipp.exception.FMSException;
6 | import com.intuit.ipp.services.DataService;
7 | import com.intuit.ipp.util.DateUtils;
8 | import org.apache.commons.lang3.RandomStringUtils;
9 |
10 | import javax.xml.bind.JAXBElement;
11 | import javax.xml.namespace.QName;
12 | import java.math.BigDecimal;
13 | import java.text.ParseException;
14 | import java.time.LocalTime;
15 | import java.util.ArrayList;
16 | import java.util.Calendar;
17 | import java.util.Date;
18 | import java.util.List;
19 |
20 | public class RecurringTransactionHelper {
21 |
22 | private RecurringTransactionHelper() {
23 |
24 | }
25 |
26 | public static RecurringInfo getRecurringTransactionFields(DataService service) throws FMSException, ParseException {
27 | RecurringInfo recurringInfo = new RecurringInfo();
28 | recurringInfo.setRecurType("Automated");
29 | recurringInfo.setName(RandomStringUtils.randomAlphabetic(6));
30 | recurringInfo.setActive(true);
31 |
32 |
33 | RecurringScheduleInfo scheduleInfo = new RecurringScheduleInfo();
34 | scheduleInfo.setStartDate(Calendar.getInstance().getTime());
35 | scheduleInfo.setMaxOccurrences(10);
36 | scheduleInfo.setIntervalType("Monthly");
37 | scheduleInfo.setNumInterval(1);
38 | scheduleInfo.setDayOfMonth(1);
39 | scheduleInfo.setDaysBefore(2);
40 |
41 | recurringInfo.setScheduleInfo(scheduleInfo);
42 | return recurringInfo;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/helper/TimeActivityHelper.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.helper;
2 |
3 | import java.text.ParseException;
4 |
5 | import org.apache.commons.lang3.RandomStringUtils;
6 |
7 | import com.intuit.ipp.data.Employee;
8 | import com.intuit.ipp.data.TimeActivity;
9 | import com.intuit.ipp.data.TimeActivityTypeEnum;
10 | import com.intuit.ipp.exception.FMSException;
11 | import com.intuit.ipp.services.DataService;
12 | import com.intuit.ipp.util.DateUtils;
13 |
14 | /**
15 | * @author dderose
16 | *
17 | */
18 | public final class TimeActivityHelper {
19 |
20 | private TimeActivityHelper() {
21 |
22 | }
23 |
24 | public static TimeActivity getTimeActivityFields(DataService service) throws FMSException, ParseException {
25 | TimeActivity timeActivity = new TimeActivity();
26 |
27 | timeActivity.setDescription("Time Activity " + RandomStringUtils.randomAlphanumeric(5));
28 |
29 | timeActivity.setNameOf(TimeActivityTypeEnum.EMPLOYEE);
30 |
31 | // add Employee Ref
32 | Employee employee = EmployeeHelper.getEmployee(service);
33 | timeActivity.setEmployeeRef(EmployeeHelper.getEmployeeRef(employee));
34 |
35 | try {
36 | timeActivity.setTxnDate(DateUtils.getCurrentDateTime());
37 | timeActivity.setStartTime(DateUtils.getCurrentDateTime());
38 | timeActivity.setEndTime(DateUtils.getDateWithNextDays(2));
39 |
40 | } catch (ParseException pe) {
41 | throw new FMSException("ParseException while setting date for Start and End of Activity");
42 | }
43 | timeActivity.setTimeZone("UTC");
44 | timeActivity.setTaxable(true);
45 | timeActivity.setDomain("QBO");
46 | return timeActivity;
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/refundreceipt/RefundReceiptCreate.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.refundreceipt;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.RefundReceiptHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Error;
8 | import com.intuit.ipp.data.RefundReceipt;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to create refundreceipt
15 | *
16 | * @author dderose
17 | *
18 | */
19 | public class RefundReceiptCreate {
20 |
21 | private static final org.slf4j.Logger LOG = Logger.getLogger();
22 |
23 | public static void main(String[] args) {
24 | try {
25 | createRefundReceipt();
26 | } catch (Exception e) {
27 | LOG.error("Error during CRUD", e.getCause());
28 | }
29 | }
30 |
31 | public static void createRefundReceipt() throws Exception {
32 |
33 | try {
34 |
35 | DataService service = DataServiceFactory.getDataService();
36 |
37 | // add refundreceipt
38 | RefundReceipt refundreceipt = RefundReceiptHelper.getRefundReceiptFields(service);
39 | RefundReceipt savedRefundReceipt = service.add(refundreceipt);
40 | LOG.info("RefundReceipt created: " + savedRefundReceipt.getId() + " ::refundreceipt doc num: " + savedRefundReceipt.getDocNumber());
41 |
42 | } catch (FMSException e) {
43 | List list = e.getErrorList();
44 | list.forEach(error -> LOG.error("Error while calling entity add:: " + error.getMessage()));
45 | }
46 |
47 | }
48 |
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/classentity/ClassRead.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.classentity;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.ClassHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Class;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to read class data using class id
15 | * Note: We'll create an entity first and then read the same
16 | *
17 | * @author dderose
18 | *
19 | */
20 | public class ClassRead {
21 |
22 | private static final org.slf4j.Logger LOG = Logger.getLogger();
23 |
24 | public static void main(String[] args) {
25 | try {
26 | getClassById();
27 | } catch (Exception e) {
28 | LOG.error("Error during CRUD", e.getCause());
29 | }
30 | }
31 |
32 | public static void getClassById() throws FMSException {
33 |
34 | try {
35 |
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // add class
39 | Class classObj = ClassHelper.getClassFields();
40 | Class savedClass = service.add(classObj);
41 | LOG.info("Class created: " + savedClass.getId());
42 |
43 | Class classOut = service.findById(savedClass);
44 | LOG.info("Class name: " + classOut.getFullyQualifiedName());
45 |
46 | } catch (FMSException e) {
47 | List list = e.getErrorList();
48 | list.forEach(error -> LOG.error("Error while calling entity findById:: " + error.getMessage()));
49 | }
50 |
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/bill/BillRead.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.bill;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.helper.BillHelper;
7 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
8 | import com.intuit.ipp.data.Bill;
9 | import com.intuit.ipp.data.Error;
10 | import com.intuit.ipp.exception.FMSException;
11 | import com.intuit.ipp.services.DataService;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to read bill data using bill id
16 | * Note: We'll create an entity first and then read the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class BillRead {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | getBill();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void getBill() throws FMSException, ParseException {
34 |
35 | try {
36 |
37 | DataService service = DataServiceFactory.getDataService();
38 |
39 | // add bill
40 | Bill bill = BillHelper.getBillFields(service);
41 | Bill savedBill = service.add(bill);
42 | LOG.info("Bill created: " + savedBill.getId());
43 |
44 | Bill billOut = service.findById(savedBill);
45 | LOG.info("Bill amount: " + billOut.getTotalAmt());
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while calling entity findById:: " + error.getMessage()));
50 | }
51 |
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/creditcardpayment/CreditCardPaymentQuery.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.creditcardpayment;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Error;
8 | import com.intuit.ipp.exception.FMSException;
9 | import com.intuit.ipp.services.DataService;
10 | import com.intuit.ipp.services.QueryResult;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to query creditCardPayment
15 | * 1. Query all records
16 | *
17 | * @author dderose
18 | *
19 | */
20 | public class CreditCardPaymentQuery {
21 |
22 | private static final org.slf4j.Logger LOG = Logger.getLogger();
23 |
24 | public static void main(String[] args) {
25 | try {
26 | queryCreditCardPayment();
27 | } catch (Exception e) {
28 | LOG.error("Error during CRUD", e.getCause());
29 | }
30 | }
31 |
32 | public static void queryCreditCardPayment() throws FMSException, ParseException {
33 |
34 | try {
35 |
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // get all creditCardPayments
39 | String sql = "select * from CreditCardPayment STARTPOSITION 1 MAXRESULTS 25";
40 | QueryResult queryResult = service.executeQuery(sql);
41 | int count = queryResult.getEntities().size();
42 |
43 | LOG.info("Total number of creditCardPayments: " + count);
44 |
45 |
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while calling executeQuery :: " + error.getMessage()));
50 | }
51 |
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/timeactivity/TimeActivityCreate.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.timeactivity;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.TimeActivityHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Error;
8 | import com.intuit.ipp.data.TimeActivity;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to create time activity
15 | *
16 | * @author dderose
17 | *
18 | */
19 | public class TimeActivityCreate {
20 |
21 | private static final org.slf4j.Logger LOG = Logger.getLogger();
22 |
23 | public static void main(String[] args) {
24 | try {
25 | createTimeActivity();
26 | } catch (Exception e) {
27 | LOG.error("Error during CRUD", e.getCause());
28 | }
29 | }
30 |
31 | public static void createTimeActivity() throws Exception {
32 |
33 | try {
34 |
35 | DataService service = DataServiceFactory.getDataService();
36 |
37 | // add time activity
38 | TimeActivity timeActivityIn = TimeActivityHelper.getTimeActivityFields(service);
39 | TimeActivity timeActivityOut = service.add(timeActivityIn);
40 | LOG.info("TimeActivity created: " + timeActivityOut.getId() + " ::TimeActivity starttime: " + timeActivityOut.getStartTime() + "::: " + timeActivityOut.getEndTime());
41 |
42 | } catch (FMSException e) {
43 | List list = e.getErrorList();
44 | list.forEach(error -> LOG.error("Error while calling entity add:: " + error.getMessage()));
45 | }
46 |
47 | }
48 |
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/bill/BillDelete.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.bill;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.helper.BillHelper;
7 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
8 | import com.intuit.ipp.data.Bill;
9 | import com.intuit.ipp.data.Error;
10 | import com.intuit.ipp.exception.FMSException;
11 | import com.intuit.ipp.services.DataService;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to delete bill data
16 | * Note: We'll create an entity first and then delete the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class BillDelete {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | deleteBill();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void deleteBill() throws FMSException, ParseException {
34 |
35 | try {
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // create bill
39 | Bill bill = BillHelper.getBillFields(service);
40 | Bill addBill = service.add(bill);
41 | LOG.info("Bill added : " + addBill.getId());
42 |
43 | //delete bill
44 | Bill deletedBill = service.delete(addBill);
45 | LOG.info("Bill deleted : " + deletedBill.getId() + " status ::: " + deletedBill.getStatus());
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while deleting entity :: " + error.getMessage()));
50 | }
51 |
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/transfer/TransferRead.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.transfer;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.TransferHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Error;
8 | import com.intuit.ipp.data.Transfer;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to read transfer data using transfer id
15 | * Note: We'll create an entity first and then read the same
16 | *
17 | * @author dderose
18 | *
19 | */
20 | public class TransferRead {
21 |
22 | private static final org.slf4j.Logger LOG = Logger.getLogger();
23 |
24 | public static void main(String[] args) {
25 | try {
26 | getTransfer();
27 | } catch (Exception e) {
28 | LOG.error("Error during CRUD", e.getCause());
29 | }
30 | }
31 |
32 | public static void getTransfer() throws FMSException {
33 |
34 | try {
35 |
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // add transfer
39 | Transfer transfer = TransferHelper.getTransferFields(service);
40 | Transfer savedTransfer = service.add(transfer);
41 | LOG.info("Transfer created: " + savedTransfer.getId());
42 |
43 | Transfer transferOut = service.findById(savedTransfer);
44 | LOG.info("Transfer amount: " + transferOut.getAmount());
45 |
46 | } catch (FMSException e) {
47 | List list = e.getErrorList();
48 | list.forEach(error -> LOG.error("Error while calling entity findById:: " + error.getMessage()));
49 | }
50 |
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/purchase/PurchaseCreate.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.purchase;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.PurchaseHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Error;
8 | import com.intuit.ipp.data.Purchase;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to create purchase
15 | *
16 | * @author dderose
17 | *
18 | */
19 | public class PurchaseCreate {
20 |
21 | private static final org.slf4j.Logger LOG = Logger.getLogger();
22 |
23 | public static void main(String[] args) {
24 | try {
25 | createPurchase();
26 | } catch (Exception e) {
27 | LOG.error("Error during CRUD", e.getCause());
28 | }
29 | }
30 |
31 | public static void createPurchase() throws Exception {
32 |
33 | try {
34 |
35 | DataService service = DataServiceFactory.getDataService();
36 |
37 | // add purchase
38 | Purchase purchase = PurchaseHelper.getCashPurchaseFields(service);
39 | Purchase savedPurchase = service.add(purchase);
40 | LOG.info("Purchase with cash fields created: " + savedPurchase.getId());
41 |
42 | purchase = PurchaseHelper.getPurchaseFields(service);
43 | savedPurchase = service.add(purchase);
44 | LOG.info("Purchase with all fields created: " + savedPurchase.getId());
45 |
46 | } catch (FMSException e) {
47 | List list = e.getErrorList();
48 | list.forEach(error -> LOG.error("Error while calling entity add:: " + error.getMessage()));
49 | }
50 |
51 | }
52 |
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/vendor/VendorRead.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.vendor;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.VendorHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Error;
8 | import com.intuit.ipp.data.Vendor;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to read vendor data using vendor id
15 | * Note: We'll create an entity first and then read the same
16 | *
17 | * @author dderose
18 | *
19 | */
20 | public class VendorRead {
21 |
22 | private static final org.slf4j.Logger LOG = Logger.getLogger();
23 |
24 | public static void main(String[] args) {
25 | try {
26 | getVendor();
27 | } catch (Exception e) {
28 | LOG.error("Error during CRUD", e.getCause());
29 | }
30 | }
31 |
32 | public static void getVendor() throws FMSException {
33 |
34 | try {
35 |
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // add vendor
39 | Vendor vendor = VendorHelper.getVendorWithMandatoryFields();
40 | Vendor savedVendor = service.add(vendor);
41 | LOG.info("Vendor created: " + savedVendor.getId() + " ::vendor name: " + savedVendor.getDisplayName());
42 |
43 | Vendor vendorOut = service.findById(savedVendor);
44 | LOG.info("Vendor Display name: " + vendorOut.getDisplayName());
45 |
46 | } catch (FMSException e) {
47 | List list = e.getErrorList();
48 | list.forEach(error -> LOG.error("Error while calling entity findById:: " + error.getMessage()));
49 | }
50 |
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/creditcardpayment/CreditCardPaymentCreate.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.creditcardpayment;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.CreditCardPaymentHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.CreditCardPaymentTxn;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to create creditCardPayment
15 | * 1. Using mandatory fields
16 | * 2. Using all fields
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class CreditCardPaymentCreate {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | createCreditCardPayment();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void createCreditCardPayment() throws Exception {
34 |
35 | try {
36 |
37 | DataService service = DataServiceFactory.getDataService();
38 |
39 | // add creditCardPayment
40 | CreditCardPaymentTxn creditCardPayment = CreditCardPaymentHelper.getCreditCardPaymentFields(service);
41 | CreditCardPaymentTxn savedCreditCardPayment = service.add(creditCardPayment);
42 | LOG.info("CreditCardPayment created: " + savedCreditCardPayment.getId() );
43 |
44 | } catch (FMSException e) {
45 | List list = e.getErrorList();
46 | list.forEach(error -> LOG.error("Error while calling entity add:: " + error.getMessage()));
47 | }
48 |
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/payment/PaymentCreate.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.payment;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.PaymentHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Error;
8 | import com.intuit.ipp.data.Payment;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to create payment
15 | *
16 | * @author dderose
17 | *
18 | */
19 | public class PaymentCreate {
20 |
21 | private static final org.slf4j.Logger LOG = Logger.getLogger();
22 |
23 | public static void main(String[] args) {
24 | try {
25 | createPayment();
26 | } catch (Exception e) {
27 | LOG.error("Error during CRUD", e.getCause());
28 | }
29 | }
30 |
31 | public static void createPayment() throws Exception {
32 |
33 | try {
34 |
35 | DataService service = DataServiceFactory.getDataService();
36 |
37 | // add payment with cash fields
38 | Payment payment = PaymentHelper.getCheckPaymentFields(service);
39 | Payment savedPayment = service.add(payment);
40 | LOG.info("Payment with cash fields created: " + savedPayment.getId());
41 |
42 | // add payment with all fields
43 | payment = PaymentHelper.getPaymentFields(service);
44 | savedPayment = service.add(payment);
45 | LOG.info("Payment with all fields created: " + savedPayment.getId());
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while calling entity add:: " + error.getMessage()));
50 | }
51 |
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/taxclassification/TaxClassificationReadById.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.taxclassification;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Error;
8 | import com.intuit.ipp.data.TaxClassification;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to read TaxClassification data using id
15 | *
16 | * @author dderose
17 | *
18 | */
19 | public class TaxClassificationReadById {
20 |
21 | private static final org.slf4j.Logger LOG = Logger.getLogger();
22 |
23 | public static void main(String[] args) {
24 | try {
25 | findTaxClassificationById();
26 | } catch (Exception e) {
27 | LOG.error("Error during CRUD", e.getCause());
28 | }
29 | }
30 |
31 | public static void findTaxClassificationById() throws FMSException, ParseException {
32 |
33 | try {
34 |
35 | DataService service = DataServiceFactory.getDataService();
36 |
37 | //read by id
38 | TaxClassification taxClassification = new TaxClassification();
39 | taxClassification.setId("EUC-04030101-V1-00060000");
40 |
41 | TaxClassification newTaxClassification = service.findById(taxClassification);
42 | LOG.info("TaxClassification name :: " + newTaxClassification.getName() + " id:: " + newTaxClassification.getId());
43 |
44 |
45 |
46 | } catch (FMSException e) {
47 | List list = e.getErrorList();
48 | list.forEach(error -> LOG.error("Error while calling executeQuery :: " + error.getMessage()));
49 | }
50 |
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/inventoryadjustment/InventoryAdjustmentCreate.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.inventoryadjustment;
2 |
3 | import com.intuit.developer.sampleapp.crud.helper.InventoryAdjustmentHelper;
4 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
5 | import com.intuit.ipp.data.Error;
6 | import com.intuit.ipp.data.InventoryAdjustment;
7 | import com.intuit.ipp.exception.FMSException;
8 | import com.intuit.ipp.services.DataService;
9 | import com.intuit.ipp.util.Logger;
10 |
11 | import java.util.List;
12 |
13 | /**
14 | * Demonstrates methods to create inventory adjustment
15 | * 1. Using mandatory fields
16 | * 2. Using all fields
17 | *
18 | * @author sramadass
19 | *
20 | */
21 | public class InventoryAdjustmentCreate {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | createInventoryAdjustment();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void createInventoryAdjustment() throws Exception {
34 |
35 | try {
36 |
37 | DataService service = DataServiceFactory.getDataService();
38 |
39 | // add Inventory Adjustment
40 | InventoryAdjustment inventoryAdjustment = InventoryAdjustmentHelper.getInvAdjFields(service);
41 | InventoryAdjustment savedInventoryAdjustment = service.add(inventoryAdjustment);
42 | LOG.info("Inventory Adjustment created: " + savedInventoryAdjustment.getId());
43 |
44 | } catch (FMSException e) {
45 | List list = e.getErrorList();
46 | list.forEach(error -> LOG.error("Error while calling entity add:: " + error.getMessage()));
47 | }
48 |
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/deposit/DepositRead.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.deposit;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.helper.DepositHelper;
7 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
8 | import com.intuit.ipp.data.Deposit;
9 | import com.intuit.ipp.data.Error;
10 | import com.intuit.ipp.exception.FMSException;
11 | import com.intuit.ipp.services.DataService;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to read deposit data using deposit id
16 | * Note: We'll create an entity first and then read the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class DepositRead {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | getDeposit();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void getDeposit() throws FMSException, ParseException {
34 |
35 | try {
36 |
37 | DataService service = DataServiceFactory.getDataService();
38 |
39 | // add deposit
40 | Deposit deposit = DepositHelper.getDepositFields(service);
41 | Deposit savedDeposit = service.add(deposit);
42 | LOG.info("Deposit with all fields created: " + savedDeposit.getId());
43 |
44 | Deposit depositOut = service.findById(savedDeposit);
45 | LOG.info("Deposit amount: " + depositOut.getTotalAmt());
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while calling entity findById:: " + error.getMessage()));
50 | }
51 |
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/department/DepartmentRead.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.department;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.DepartmentHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Department;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to read department data using department id
15 | * Note: We'll create an entity first and then read the same
16 | *
17 | * @author dderose
18 | *
19 | */
20 | public class DepartmentRead {
21 |
22 | private static final org.slf4j.Logger LOG = Logger.getLogger();
23 |
24 | public static void main(String[] args) {
25 | try {
26 | getDepartment();
27 | } catch (Exception e) {
28 | LOG.error("Error during CRUD", e.getCause());
29 | }
30 | }
31 |
32 | public static void getDepartment() throws FMSException {
33 |
34 | try {
35 |
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // add department
39 | Department department = DepartmentHelper.getDepartmentFields();
40 | Department savedDepartment = service.add(department);
41 | LOG.info("Department created: " + savedDepartment.getId());
42 |
43 | Department departmentOut = service.findById(savedDepartment);
44 | LOG.info("Department name: " + departmentOut.getFullyQualifiedName());
45 |
46 | } catch (FMSException e) {
47 | List list = e.getErrorList();
48 | list.forEach(error -> LOG.error("Error while calling entity findById:: " + error.getMessage()));
49 | }
50 |
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/account/AccountRead.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.account;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.AccountHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Account;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to read account data using account id
15 | * Note: We'll create an entity first and then read the same
16 | *
17 | * @author dderose
18 | *
19 | */
20 | public class AccountRead {
21 |
22 | private static final org.slf4j.Logger LOG = Logger.getLogger();
23 |
24 | public static void main(String[] args) {
25 | try {
26 | getAccount();
27 | } catch (Exception e) {
28 | LOG.error("Error during CRUD", e.getCause());
29 | }
30 | }
31 |
32 | public static void getAccount() throws FMSException {
33 |
34 | try {
35 |
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // add bank account with minimum mandatory fields
39 | Account account = AccountHelper.getBankAccountFields();
40 | Account savedAccount = service.add(account);
41 | LOG.info("Account with all fields created: " + savedAccount.getId());
42 |
43 | // read using id
44 | Account accountOut = service.findById(savedAccount);
45 | LOG.info("Account name: " + accountOut.getFullyQualifiedName());
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while calling entity findById:: " + error.getMessage()));
50 | }
51 |
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/companyinfo/CompanyInfoQuery.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.companyinfo;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.CompanyInfo;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.services.QueryResult;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to query companyinfo data
16 | * 1. Query all records
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class CompanyInfoQuery {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | queryCompanyInfo();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void queryCompanyInfo() throws FMSException, ParseException {
34 |
35 | try {
36 |
37 | DataService service = DataServiceFactory.getDataService();
38 |
39 | // get all companyinfo
40 | String sql = "select * from companyinfo";
41 | QueryResult queryResult = service.executeQuery(sql);
42 | if (!queryResult.getEntities().isEmpty() && queryResult.getEntities().size() > 0) {
43 | CompanyInfo companyInfo = (CompanyInfo) queryResult.getEntities().get(0);
44 | LOG.info("Companyinfo -> CompanyName: " + companyInfo.getCompanyName());
45 | }
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while calling executeQuery :: " + error.getMessage()));
50 | }
51 |
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/estimate/EstimateRead.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.estimate;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.helper.EstimateHelper;
7 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.data.Estimate;
10 | import com.intuit.ipp.exception.FMSException;
11 | import com.intuit.ipp.services.DataService;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to read estimate data using estimate id
16 | * Note: We'll create an entity first and then read the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class EstimateRead {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | getEstimate();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void getEstimate() throws FMSException, ParseException {
34 |
35 | try {
36 |
37 | DataService service = DataServiceFactory.getDataService();
38 |
39 | // add estimate
40 | Estimate estimate = EstimateHelper.getEstimateFields(service);
41 | Estimate savedEstimate = service.add(estimate);
42 | LOG.info("Estimate created: " + savedEstimate.getId());
43 |
44 | Estimate estimateOut = service.findById(savedEstimate);
45 | LOG.info("Estimate amount: " + estimateOut.getTotalAmt());
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while calling entity findById:: " + error.getMessage()));
50 | }
51 |
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/invoice/InvoiceDelete.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.invoice;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.helper.InvoiceHelper;
7 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.data.Invoice;
10 | import com.intuit.ipp.exception.FMSException;
11 | import com.intuit.ipp.services.DataService;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to delete invoice
16 | * Note: We'll create an entity first and then delete the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class InvoiceDelete {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | deleteInvoice();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void deleteInvoice() throws FMSException, ParseException {
34 |
35 | try {
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // create invoice
39 | Invoice invoice = InvoiceHelper.getInvoiceFields(service);
40 | Invoice addInvoice = service.add(invoice);
41 | LOG.info("Invoice added : " + addInvoice.getId());
42 |
43 | // delete invoice
44 | Invoice deletedInvoice = service.delete(addInvoice);
45 | LOG.info("Invoice deleted : " + deletedInvoice.getId() + " status ::: " + deletedInvoice.getStatus());
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while deleting entity :: " + error.getMessage()));
50 | }
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/payment/PaymentRead.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.payment;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.helper.PaymentHelper;
7 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.data.Payment;
10 | import com.intuit.ipp.exception.FMSException;
11 | import com.intuit.ipp.services.DataService;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to read payment data using payment id
16 | * Note: We'll create an entity first and then read the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class PaymentRead {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | getPayment();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void getPayment() throws FMSException, ParseException {
34 |
35 | try {
36 |
37 | DataService service = DataServiceFactory.getDataService();
38 |
39 | // add payment with cash fields
40 | Payment payment = PaymentHelper.getCheckPaymentFields(service);
41 | Payment savedPayment = service.add(payment);
42 | LOG.info("Payment with cash fields created: " + savedPayment.getId());
43 |
44 | Payment paymentOut = service.findById(savedPayment);
45 | LOG.info("Payment amount: " + paymentOut.getTotalAmt());
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while calling entity findById:: " + error.getMessage()));
50 | }
51 |
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/invoice/InvoiceVoid.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.invoice;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.helper.InvoiceHelper;
7 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.data.Invoice;
10 | import com.intuit.ipp.exception.FMSException;
11 | import com.intuit.ipp.services.DataService;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to void invoice
16 | * Note: We'll create an entity first and then void the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class InvoiceVoid {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | voidInvoice();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void voidInvoice() throws FMSException, ParseException {
34 |
35 | try {
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // create invoice
39 | Invoice invoice = InvoiceHelper.getInvoiceFields(service);
40 | Invoice addInvoice = service.add(invoice);
41 | LOG.info("Invoice added : " + addInvoice.getId());
42 |
43 | // void invoice
44 | Invoice voidedInvoice = service.voidRequest(addInvoice);
45 | LOG.info("Invoice voided : " + voidedInvoice.getId() + " status ::: " + voidedInvoice.getPrivateNote());
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while voiding entity :: " + error.getMessage()));
50 | }
51 | }
52 |
53 |
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/deposit/DepositDelete.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.deposit;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.helper.DepositHelper;
7 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
8 | import com.intuit.ipp.data.Deposit;
9 | import com.intuit.ipp.data.Error;
10 | import com.intuit.ipp.exception.FMSException;
11 | import com.intuit.ipp.services.DataService;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to delete deposit data
16 | * Note: We'll create an entity first and then delete the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class DepositDelete {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | deleteDeposit();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void deleteDeposit() throws FMSException, ParseException {
34 |
35 | try {
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // create deposit
39 | Deposit deposit = DepositHelper.getDepositFields(service);
40 | Deposit addDeposit = service.add(deposit);
41 | LOG.info("Deposit added : " + addDeposit.getId());
42 |
43 | //delete deposit
44 | Deposit deletedDeposit = service.delete(addDeposit);
45 | LOG.info("Deposit deleted : " + deletedDeposit.getId() + " status ::: " + deletedDeposit.getStatus());
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while deleting entity :: " + error.getMessage()));
50 | }
51 |
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/payment/PaymentDelete.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.payment;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.helper.PaymentHelper;
7 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
8 | import com.intuit.ipp.data.Payment;
9 | import com.intuit.ipp.data.Error;
10 | import com.intuit.ipp.exception.FMSException;
11 | import com.intuit.ipp.services.DataService;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to delete payment data
16 | * Note: We'll create an entity first and then delete the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class PaymentDelete {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | deletePayment();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void deletePayment() throws FMSException, ParseException {
34 |
35 | try {
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // create payment
39 | Payment payment = PaymentHelper.getCheckPaymentFields(service);
40 | Payment addPayment = service.add(payment);
41 | LOG.info("Payment added : " + addPayment.getId());
42 |
43 | //delete payment
44 | Payment deletedPayment = service.delete(addPayment);
45 | LOG.info("Payment deleted : " + deletedPayment.getId() + " status ::: " + deletedPayment.getStatus());
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while deleting entity :: " + error.getMessage()));
50 | }
51 |
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/payment/PaymentVoid.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.payment;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.helper.PaymentHelper;
7 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.data.Payment;
10 | import com.intuit.ipp.exception.FMSException;
11 | import com.intuit.ipp.services.DataService;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to void payment
16 | * Note: We'll create an entity first and then void the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class PaymentVoid {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | voidPayment();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void voidPayment() throws FMSException, ParseException {
34 |
35 | try {
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // create payment
39 | Payment payment = PaymentHelper.getCheckPaymentFields(service);
40 | Payment addPayment = service.add(payment);
41 | LOG.info("Payment added : " + addPayment.getId());
42 |
43 | // void payment
44 | Payment voidedPayment = service.voidRequest(addPayment);
45 | LOG.info("Payment voided : " + voidedPayment.getId() + " status ::: " + voidedPayment.getPrivateNote());
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while voiding entity :: " + error.getMessage()));
50 | }
51 | }
52 |
53 |
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/purchase/PurchaseRead.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.purchase;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.helper.PurchaseHelper;
7 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.data.Purchase;
10 | import com.intuit.ipp.exception.FMSException;
11 | import com.intuit.ipp.services.DataService;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to read purchase data using purchase id
16 | * Note: We'll create an entity first and then read the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class PurchaseRead {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | getPurchase();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void getPurchase() throws FMSException, ParseException {
34 |
35 | try {
36 |
37 | DataService service = DataServiceFactory.getDataService();
38 |
39 | // add purchase
40 | Purchase purchase = PurchaseHelper.getCashPurchaseFields(service);
41 | Purchase savedPurchase = service.add(purchase);
42 | LOG.info("Purchase with cash fields created: " + savedPurchase.getId());
43 |
44 | Purchase purchaseOut = service.findById(savedPurchase);
45 | LOG.info("Purchase amount: " + purchaseOut.getTotalAmt());
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while calling entity findById:: " + error.getMessage()));
50 | }
51 |
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/invoice/InvoiceRead.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.invoice;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.helper.InvoiceHelper;
7 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.data.Invoice;
10 | import com.intuit.ipp.exception.FMSException;
11 | import com.intuit.ipp.services.DataService;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to read invoice using invoice id
16 | * Note: We'll create an entity first and then read the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class InvoiceRead {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | getInvoice();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void getInvoice() throws FMSException, ParseException {
34 |
35 | try {
36 |
37 | DataService service = DataServiceFactory.getDataService();
38 |
39 | // add invoice
40 | Invoice invoice = InvoiceHelper.getInvoiceFields(service);
41 | Invoice savedInvoice = service.add(invoice);
42 | LOG.info("Invoice created: " + savedInvoice.getId() + " ::invoice doc num: " + savedInvoice.getDocNumber());
43 |
44 | Invoice invoiceOut = service.findById(savedInvoice);
45 | LOG.info("Invoice Doc num: " + invoiceOut.getDocNumber());
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while calling entity findById:: " + error.getMessage()));
50 | }
51 |
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/budget/BudgetQuery.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.budget;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Budget;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.services.QueryResult;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to query budget data
16 | * 1. Query all records
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class BudgetQuery {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | queryBudgets();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void queryBudgets() throws FMSException, ParseException {
34 |
35 | try {
36 |
37 | DataService service = DataServiceFactory.getDataService();
38 |
39 | // get all budgets
40 | String sql = "select * from budget";
41 | QueryResult queryResult = service.executeQuery(sql);
42 |
43 | if (!queryResult.getEntities().isEmpty() && queryResult.getEntities().size() > 0) {
44 | Budget budget = (Budget) queryResult.getEntities().get(0);
45 | LOG.info("Budget -> name: " + budget.getName());
46 | int count = queryResult.getEntities().size();
47 | LOG.info("Total number of budgets: " + count);
48 | }
49 |
50 | } catch (FMSException e) {
51 | List list = e.getErrorList();
52 | list.forEach(error -> LOG.error("Error while calling executeQuery :: " + error.getMessage()));
53 | }
54 |
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/estimate/EstimateDelete.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.estimate;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.helper.EstimateHelper;
7 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
8 | import com.intuit.ipp.data.Estimate;
9 | import com.intuit.ipp.data.Error;
10 | import com.intuit.ipp.exception.FMSException;
11 | import com.intuit.ipp.services.DataService;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to delete estimate data
16 | * Note: We'll create an entity first and then delete the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class EstimateDelete {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | deleteEstimate();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void deleteEstimate() throws FMSException, ParseException {
34 |
35 | try {
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // create estimate
39 | Estimate estimate = EstimateHelper.getEstimateFields(service);
40 | Estimate addEstimate = service.add(estimate);
41 | LOG.info("Estimate added : " + addEstimate.getId());
42 |
43 | //delete estimate
44 | Estimate deletedEstimate = service.delete(addEstimate);
45 | LOG.info("Estimate deleted : " + deletedEstimate.getId() + " status ::: " + deletedEstimate.getStatus());
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while deleting entity :: " + error.getMessage()));
50 | }
51 |
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/purchase/PurchaseDelete.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.purchase;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.helper.PurchaseHelper;
7 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
8 | import com.intuit.ipp.data.Purchase;
9 | import com.intuit.ipp.data.Error;
10 | import com.intuit.ipp.exception.FMSException;
11 | import com.intuit.ipp.services.DataService;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to delete purchase data
16 | * Note: We'll create an entity first and then delete the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class PurchaseDelete {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | deletePurchase();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void deletePurchase() throws FMSException, ParseException {
34 |
35 | try {
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // create purchase
39 | Purchase purchase = PurchaseHelper.getPurchaseFields(service);
40 | Purchase addPurchase = service.add(purchase);
41 | LOG.info("Purchase added : " + addPurchase.getId());
42 |
43 | //delete purchase
44 | Purchase deletedPurchase = service.delete(addPurchase);
45 | LOG.info("Purchase deleted : " + deletedPurchase.getId() + " status ::: " + deletedPurchase.getStatus());
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while deleting entity :: " + error.getMessage()));
50 | }
51 |
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/purchase/PurchaseVoid.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.purchase;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.helper.PurchaseHelper;
7 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.data.Purchase;
10 | import com.intuit.ipp.exception.FMSException;
11 | import com.intuit.ipp.services.DataService;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to void purchase
16 | * Note: We'll create an entity first and then void the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class PurchaseVoid {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | voidPurchase();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void voidPurchase() throws FMSException, ParseException {
34 |
35 | try {
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // create purchase
39 | Purchase purchase = PurchaseHelper.getPurchaseFields(service);
40 | Purchase addPurchase = service.add(purchase);
41 | LOG.info("Purchase added : " + addPurchase.getId());
42 |
43 | // void purchase
44 | Purchase voidedPurchase = service.voidRequest(addPurchase);
45 | LOG.info("Purchase voided : " + voidedPurchase.getId() + " status ::: " + voidedPurchase.getPrivateNote());
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while voiding entity :: " + error.getMessage()));
50 | }
51 | }
52 |
53 |
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/transfer/TransferDelete.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.transfer;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.helper.TransferHelper;
7 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
8 | import com.intuit.ipp.data.Transfer;
9 | import com.intuit.ipp.data.Error;
10 | import com.intuit.ipp.exception.FMSException;
11 | import com.intuit.ipp.services.DataService;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to delete transfer data
16 | * Note: We'll create an entity first and then delete the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class TransferDelete {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | deleteTransfer();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void deleteTransfer() throws FMSException, ParseException {
34 |
35 | try {
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // create transfer
39 | Transfer transfer = TransferHelper.getTransferFields(service);
40 | Transfer addTransfer = service.add(transfer);
41 | LOG.info("Transfer added : " + addTransfer.getId());
42 |
43 | //delete transfer
44 | Transfer deletedTransfer = service.delete(addTransfer);
45 | LOG.info("Transfer deleted : " + deletedTransfer.getId() + " status ::: " + deletedTransfer.getStatus());
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while deleting entity :: " + error.getMessage()));
50 | }
51 |
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/paymentmethod/PaymentMethodRead.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.paymentmethod;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.PaymentHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Error;
8 | import com.intuit.ipp.data.PaymentMethod;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to read paymentmethod data using paymentmethod id
15 | * Note: We'll create an entity first and then read the same
16 | *
17 | * @author dderose
18 | *
19 | */
20 | public class PaymentMethodRead {
21 |
22 | private static final org.slf4j.Logger LOG = Logger.getLogger();
23 |
24 | public static void main(String[] args) {
25 | try {
26 | getPaymentMethod();
27 | } catch (Exception e) {
28 | LOG.error("Error during CRUD", e.getCause());
29 | }
30 | }
31 |
32 | public static void getPaymentMethod() throws FMSException {
33 |
34 | try {
35 |
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // add paymentmethod
39 | PaymentMethod paymentmethod = PaymentHelper.getPaymentMethodFields();
40 | PaymentMethod savedPaymentMethod = service.add(paymentmethod);
41 | LOG.info("PaymentMethod created: " + savedPaymentMethod.getId());
42 |
43 | PaymentMethod paymentmethodOut = service.findById(savedPaymentMethod);
44 | LOG.info("PaymentMethod name: " + paymentmethodOut.getName());
45 |
46 | } catch (FMSException e) {
47 | List list = e.getErrorList();
48 | list.forEach(error -> LOG.error("Error while calling entity findById:: " + error.getMessage()));
49 | }
50 |
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/report/ReportQuery.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.report;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.qbo.ReportServiceFactory;
7 | import com.intuit.ipp.data.Error;
8 | import com.intuit.ipp.data.Report;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.ReportName;
11 | import com.intuit.ipp.services.ReportService;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | *
16 | *
17 | * @author dderose
18 | *
19 | */
20 | public class ReportQuery {
21 |
22 | private static final org.slf4j.Logger LOG = Logger.getLogger();
23 |
24 | public static void main(String[] args) {
25 | try {
26 | queryReport();
27 | } catch (Exception e) {
28 | LOG.error("Error during CRUD", e.getCause());
29 | }
30 | }
31 |
32 | public static void queryReport() throws FMSException, ParseException {
33 |
34 | try {
35 |
36 | //build ReportService
37 | ReportService service = ReportServiceFactory.getReportService();
38 |
39 | //call BalanceSheet report
40 | service.setStart_date("2018-01-01");
41 | service.setAccounting_method("Accrual");
42 | Report report = service.executeReport(ReportName.BALANCESHEET.toString());
43 | LOG.info("ReportName -> name: " + report.getHeader().getReportName().toLowerCase());
44 |
45 |
46 | //call P&L report
47 | report = service.executeReport(ReportName.PROFITANDLOSS.toString());
48 | LOG.info("ReportName -> name: " + report.getHeader().getReportName().toLowerCase());
49 |
50 |
51 | } catch (FMSException e) {
52 | List list = e.getErrorList();
53 | list.forEach(error -> LOG.error("Error while calling executeQuery :: " + error.getMessage()));
54 | }
55 |
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/entitlements/EntitlementsRead.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.entitlements;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
6 | import com.intuit.ipp.data.EntitlementsResponse;
7 | import com.intuit.ipp.data.Error;
8 | import com.intuit.ipp.exception.FMSException;
9 | import com.intuit.ipp.exception.InvalidTokenException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to query entitlements data
15 | *
16 | * @author dderose
17 | *
18 | */
19 | public class EntitlementsRead {
20 |
21 | private static final org.slf4j.Logger LOG = Logger.getLogger();
22 |
23 | public static void main(String[] args) {
24 | try {
25 | queryEntitlements();
26 | } catch (Exception e) {
27 | LOG.error("Error during CRUD", e.getCause());
28 | }
29 | }
30 |
31 | public static void queryEntitlements() throws FMSException {
32 |
33 | try {
34 |
35 | //Set the following url for companies connected via OAuth1
36 | //Config.setProperty(Config.BASE_URL_ENTITLEMENTSERVICE, "https://qbo.sbfinance.intuit.com/manage");
37 |
38 | DataService service = DataServiceFactory.getDataService();
39 | EntitlementsResponse response = service.getEntitlements();
40 | if (response != null) {
41 | LOG.info("Entitlements Response -> isQboCompany: " + response.isQboCompany());
42 | }
43 |
44 | }
45 | catch (InvalidTokenException e) {
46 | System.out.println("Error while calling Entitlements :: " + e.getMessage());
47 | }
48 | catch (FMSException e) {
49 | List list = e.getErrorList();
50 | list.forEach(error -> LOG.error("Error while calling Entitlements :: " + error.getMessage()));
51 | }
52 |
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/attachable/AttachableDelete.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.attachable;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.helper.AttachableHelper;
7 | /**
8 | * Demonstrates methods to delete attachable
9 | *
10 | * @author dderose
11 | *
12 | */
13 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
14 | import com.intuit.ipp.data.Attachable;
15 | import com.intuit.ipp.data.Error;
16 | import com.intuit.ipp.exception.FMSException;
17 | import com.intuit.ipp.services.DataService;
18 | import com.intuit.ipp.util.Logger;
19 |
20 | public class AttachableDelete {
21 |
22 | private static final org.slf4j.Logger LOG = Logger.getLogger();
23 |
24 | public static void main(String[] args) {
25 | try {
26 | deleteAttachable();
27 | } catch (Exception e) {
28 | LOG.error("Error during CRUD", e.getCause());
29 | }
30 | }
31 |
32 | public static void deleteAttachable() throws FMSException, ParseException {
33 |
34 | try {
35 | DataService service = DataServiceFactory.getDataService();
36 |
37 | // add attachable with minimum mandatory fields
38 | Attachable attachable = AttachableHelper.getAttachableFields(service);
39 | Attachable addAttachable = service.add(attachable);
40 | LOG.info("Attachable created: " + addAttachable.getId());
41 |
42 | // delete attachable
43 | Attachable deletedAttachable = service.delete(addAttachable);
44 | LOG.info("Attachable deleted : " + deletedAttachable.getId() + " status ::: " + deletedAttachable.getStatus());
45 |
46 | } catch (FMSException e) {
47 | List list = e.getErrorList();
48 | list.forEach(error -> LOG.error("Error while deleting entity :: " + error.getMessage()));
49 | }
50 |
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/preferences/PreferencesQuery.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.preferences;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Preferences;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.services.QueryResult;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to query preferences data
16 | * 1. Query all records
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class PreferencesQuery {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | queryPreferences();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void queryPreferences() throws FMSException, ParseException {
34 |
35 | try {
36 |
37 | DataService service = DataServiceFactory.getDataService();
38 |
39 | // get all preferences
40 | String sql = "select * from preferences";
41 | QueryResult queryResult = service.executeQuery(sql);
42 | if (!queryResult.getEntities().isEmpty() && queryResult.getEntities().size() > 0) {
43 | Preferences preferences = (Preferences) queryResult.getEntities().get(0);
44 | LOG.info("Preferences -> SalesFormsPrefs - > DefaultCustomerMessage: " + preferences.getSalesFormsPrefs().getDefaultCustomerMessage());
45 | }
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while calling executeQuery :: " + error.getMessage()));
50 | }
51 |
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/creditmemo/CreditMemoRead.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.creditmemo;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.helper.CreditMemoHelper;
7 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
8 | import com.intuit.ipp.data.CreditMemo;
9 | import com.intuit.ipp.data.Error;
10 | import com.intuit.ipp.exception.FMSException;
11 | import com.intuit.ipp.services.DataService;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to read creditmemo data using creditmemo id
16 | * Note: We'll create an entity first and then read the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class CreditMemoRead {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | getCreditMemo();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void getCreditMemo() throws FMSException, ParseException {
34 |
35 | try {
36 |
37 | DataService service = DataServiceFactory.getDataService();
38 |
39 | // add creditmemo
40 | CreditMemo creditmemo = CreditMemoHelper.getCreditMemoFields(service);
41 | CreditMemo savedCreditMemo = service.add(creditmemo);
42 | LOG.info("CreditMemo created: " + savedCreditMemo.getId());
43 |
44 | CreditMemo creditmemoOut = service.findById(savedCreditMemo);
45 | LOG.info("CreditMemo remaining credit: " + creditmemoOut.getRemainingCredit());
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while calling entity findById:: " + error.getMessage()));
50 | }
51 |
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/customer/CustomerRead.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.customer;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.CustomerHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Customer;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to read customer data using customer id
15 | * Note: We'll create an entity first and then read the same
16 | *
17 | * @author dderose
18 | *
19 | */
20 | public class CustomerRead {
21 |
22 | private static final org.slf4j.Logger LOG = Logger.getLogger();
23 |
24 | public static void main(String[] args) {
25 | try {
26 | getCustomer();
27 | } catch (Exception e) {
28 | LOG.error("Error during CRUD", e.getCause());
29 | }
30 | }
31 |
32 | public static void getCustomer() throws FMSException {
33 |
34 | try {
35 |
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // add customer with minimum mandatory fields
39 | Customer customer = CustomerHelper.getCustomerWithMandatoryFields();
40 | Customer savedCustomer = service.add(customer);
41 | LOG.info("Customer with mandatory fields created: " + savedCustomer.getId() + " ::customer name: " + savedCustomer.getDisplayName());
42 |
43 | Customer customerOut = service.findById(savedCustomer);
44 | LOG.info("Customer Display name: " + customerOut.getDisplayName());
45 |
46 | } catch (FMSException e) {
47 | List list = e.getErrorList();
48 | list.forEach(error -> LOG.error("Error while calling entity findById:: " + error.getMessage()));
49 | }
50 |
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/employee/EmployeeRead.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.employee;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.EmployeeHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Employee;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to read employee data using employee id
15 | * Note: We'll create an entity first and then read the same
16 | *
17 | * @author dderose
18 | *
19 | */
20 | public class EmployeeRead {
21 |
22 | private static final org.slf4j.Logger LOG = Logger.getLogger();
23 |
24 | public static void main(String[] args) {
25 | try {
26 | getEmployee();
27 | } catch (Exception e) {
28 | LOG.error("Error during CRUD", e.getCause());
29 | }
30 | }
31 |
32 | public static void getEmployee() throws FMSException {
33 |
34 | try {
35 |
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // add employee with minimum mandatory fields
39 | Employee employee = EmployeeHelper.getEmployeeWithMandatoryFields();
40 | Employee savedEmployee = service.add(employee);
41 | LOG.info("Employee with mandatory fields created: " + savedEmployee.getId() + " ::employee name: " + savedEmployee.getDisplayName());
42 |
43 | Employee employeeOut = service.findById(savedEmployee);
44 | LOG.info("Employee Display name: " + employeeOut.getDisplayName());
45 |
46 | } catch (FMSException e) {
47 | List list = e.getErrorList();
48 | list.forEach(error -> LOG.error("Error while calling entity findById:: " + error.getMessage()));
49 | }
50 |
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/term/TermDelete.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.term;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.TermHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Term;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to delete term data
15 | * Name-list resources can only be soft deleted meaning, marked as inactive
16 | * Note: We'll create an entity first and then delete the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class TermDelete {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | deleteTerm();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void deleteTerm() throws FMSException {
34 |
35 | try {
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // create term
39 | Term term = TermHelper.getTermFields();
40 | Term addTerm = service.add(term);
41 | LOG.info("Term added : " + addTerm.getId() + " active flag ::: " + addTerm.isActive());
42 |
43 | // set active flag as false to soft delete
44 | addTerm.setActive(false);
45 | Term deletedTerm = service.update(addTerm);
46 | LOG.info("Term deleted : " + deletedTerm.getId() + " active flag ::: " + deletedTerm.isActive());
47 |
48 | } catch (FMSException e) {
49 | List list = e.getErrorList();
50 | list.forEach(error -> LOG.error("Error while deleting entity :: " + error.getMessage()));
51 | }
52 |
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/attachable/AttachableRead.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.attachable;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.helper.AttachableHelper;
7 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
8 | import com.intuit.ipp.data.Attachable;
9 | import com.intuit.ipp.data.Error;
10 | import com.intuit.ipp.exception.FMSException;
11 | import com.intuit.ipp.services.DataService;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to read attachable data using attachable id
16 | * Note: We'll create an entity first and then read the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class AttachableRead {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | getAttachable();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void getAttachable() throws FMSException, ParseException {
34 |
35 | try {
36 |
37 | DataService service = DataServiceFactory.getDataService();
38 |
39 | // add attachable with minimum mandatory fields
40 | Attachable attachable = AttachableHelper.getAttachableFields(service);
41 | Attachable savedAttachable = service.add(attachable);
42 | LOG.info("Attachable created: " + savedAttachable.getId());
43 |
44 | Attachable attachableOut = service.findById(savedAttachable);
45 | LOG.info("Attachable note: " + attachableOut.getNote());
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while calling entity findById:: " + error.getMessage()));
50 | }
51 |
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/item/ItemDelete.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.item;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.ItemHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Item;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to delete item data
15 | * Name-list resources can only be soft deleted meaning, marked as inactive
16 | * Note: We'll create an entity first and then delete the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class ItemDelete {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | deleteItem();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void deleteItem() throws FMSException {
34 |
35 | try {
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // create item
39 | Item item = ItemHelper.getItemFields(service);
40 | Item addItem = service.add(item);
41 | LOG.info("Item added : " + addItem.getId() + " active flag ::: " + addItem.isActive());
42 |
43 | // set active flag as false to soft delete
44 | addItem.setActive(false);
45 | Item deletedItem = service.update(addItem);
46 | LOG.info("Item deleted : " + deletedItem.getId() + " active flag ::: " + deletedItem.isActive());
47 |
48 | } catch (FMSException e) {
49 | List list = e.getErrorList();
50 | list.forEach(error -> LOG.error("Error while deleting entity :: " + error.getMessage()));
51 | }
52 |
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/billpayment/BillPaymentRead.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.billpayment;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.helper.BillHelper;
7 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
8 | import com.intuit.ipp.data.BillPayment;
9 | import com.intuit.ipp.data.Error;
10 | import com.intuit.ipp.exception.FMSException;
11 | import com.intuit.ipp.services.DataService;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to read billpayment data using billpayment id
16 | * Note: We'll create an entity first and then read the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class BillPaymentRead {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | getBillPayment();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void getBillPayment() throws FMSException, ParseException {
34 |
35 | try {
36 |
37 | DataService service = DataServiceFactory.getDataService();
38 |
39 | // add billpayment with minimum mandatory fields
40 | BillPayment account = BillHelper.getBillPaymentFields(service);
41 | BillPayment savedBillPayment = service.add(account);
42 | LOG.info("BillPayment created: " + savedBillPayment.getId());
43 |
44 | BillPayment billpaymentOut = service.findById(savedBillPayment);
45 | LOG.info("BillPayment amount: " + billpaymentOut.getTotalAmt());
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while calling entity findById:: " + error.getMessage()));
50 | }
51 |
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/vendor/VendorDelete.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.vendor;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.VendorHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Error;
8 | import com.intuit.ipp.data.Vendor;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to delete vendor data
15 | * Name-list resources can only be soft deleted meaning, marked as inactive
16 | * VendorDelete.java
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class VendorDelete {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | deleteVendor();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void deleteVendor() throws FMSException {
34 |
35 | try {
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // create vendor
39 | Vendor vendor = VendorHelper.getVendorWithMandatoryFields();
40 | Vendor addVendor = service.add(vendor);
41 | LOG.info("Vendor added : " + addVendor.getId() + " active flag ::: " + addVendor.isActive());
42 |
43 | // set active flag as false to soft delete
44 | addVendor.setActive(false);
45 | Vendor deletedVendor = service.update(addVendor);
46 | LOG.info("Vendor deleted : " + deletedVendor.getId() + " active flag ::: " + deletedVendor.isActive());
47 |
48 | } catch (FMSException e) {
49 | List list = e.getErrorList();
50 | list.forEach(error -> LOG.error("Error while deleting entity :: " + error.getMessage()));
51 | }
52 |
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/creditmemo/CreditMemoDelete.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.creditmemo;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.helper.CreditMemoHelper;
7 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
8 | import com.intuit.ipp.data.CreditMemo;
9 | import com.intuit.ipp.data.Error;
10 | import com.intuit.ipp.exception.FMSException;
11 | import com.intuit.ipp.services.DataService;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to delete creditmemo data
16 | * Note: We'll create an entity first and then delete the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class CreditMemoDelete {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | deleteCreditMemo();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void deleteCreditMemo() throws FMSException, ParseException {
34 |
35 | try {
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // create creditmemo
39 | CreditMemo creditmemo = CreditMemoHelper.getCreditMemoFields(service);
40 | CreditMemo addCreditMemo = service.add(creditmemo);
41 | LOG.info("CreditMemo added : " + addCreditMemo.getId());
42 |
43 | //delete creditmemo
44 | CreditMemo deletedCreditMemo = service.delete(addCreditMemo);
45 | LOG.info("CreditMemo deleted : " + deletedCreditMemo.getId() + " status ::: " + deletedCreditMemo.getStatus());
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while deleting entity :: " + error.getMessage()));
50 | }
51 |
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/journalentry/JournalEntryRead.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.journalentry;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.helper.JournalEntryHelper;
7 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.data.JournalEntry;
10 | import com.intuit.ipp.exception.FMSException;
11 | import com.intuit.ipp.services.DataService;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to read journalentry data using journalentry id
16 | * Note: We'll create an entity first and then read the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class JournalEntryRead {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | getJournalEntry();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void getJournalEntry() throws FMSException, ParseException {
34 |
35 | try {
36 |
37 | DataService service = DataServiceFactory.getDataService();
38 |
39 | // add journalentry
40 | JournalEntry journalentry = JournalEntryHelper.getJournalEntryFields(service);
41 | JournalEntry savedJournalEntry = service.add(journalentry);
42 | LOG.info("JournalEntry created: " + savedJournalEntry.getId());
43 |
44 | JournalEntry journalentryOut = service.findById(savedJournalEntry);
45 | LOG.info("JournalEntry amount: " + journalentryOut.getTotalAmt());
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while calling entity findById:: " + error.getMessage()));
50 | }
51 |
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/vendorcredit/VendorCreditRead.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.vendorcredit;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.helper.VendorCreditHelper;
7 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.data.VendorCredit;
10 | import com.intuit.ipp.exception.FMSException;
11 | import com.intuit.ipp.services.DataService;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to read vendorcredit data using vendorcredit id
16 | * Note: We'll create an entity first and then read the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class VendorCreditRead {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | getVendorCredit();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void getVendorCredit() throws FMSException, ParseException {
34 |
35 | try {
36 |
37 | DataService service = DataServiceFactory.getDataService();
38 |
39 | // add vendorcredit
40 | VendorCredit vendorcredit = VendorCreditHelper.getVendorCreditFields(service);
41 | VendorCredit savedVendorCredit = service.add(vendorcredit);
42 | LOG.info("VendorCredit created: " + savedVendorCredit.getId());
43 |
44 | VendorCredit vendorcreditOut = service.findById(savedVendorCredit);
45 | LOG.info("VendorCredit amount: " + vendorcreditOut.getTotalAmt());
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while calling entity findById:: " + error.getMessage()));
50 | }
51 |
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/billpayment/BillPaymentVoid.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.billpayment;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.helper.BillHelper;
7 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.data.BillPayment;
10 | import com.intuit.ipp.exception.FMSException;
11 | import com.intuit.ipp.services.DataService;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to void billPayment
16 | * Note: We'll create an entity first and then void the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class BillPaymentVoid {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | voidBillPayment();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void voidBillPayment() throws FMSException, ParseException {
34 |
35 | try {
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // create billPayment
39 | BillPayment billPayment = BillHelper.getBillPaymentFields(service);
40 | BillPayment addBillPayment = service.add(billPayment);
41 | LOG.info("BillPayment added : " + addBillPayment.getId());
42 |
43 | // void billPayment
44 | BillPayment voidedBillPayment = service.voidRequest(addBillPayment);
45 | LOG.info("BillPayment voided : " + voidedBillPayment.getId() + " status ::: " + voidedBillPayment.getPrivateNote());
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while voiding entity :: " + error.getMessage()));
50 | }
51 | }
52 |
53 |
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/billpayment/BillPaymentDelete.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.billpayment;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.helper.BillHelper;
7 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
8 | import com.intuit.ipp.data.BillPayment;
9 | import com.intuit.ipp.data.Error;
10 | import com.intuit.ipp.exception.FMSException;
11 | import com.intuit.ipp.services.DataService;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to delete billpayment data
16 | * Note: We'll create an entity first and then delete the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class BillPaymentDelete {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | deleteBillPayment();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void deleteBillPayment() throws FMSException, ParseException {
34 |
35 | try {
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // create billpayment
39 | BillPayment billpayment = BillHelper.getBillPaymentFields(service);
40 | BillPayment addBillPayment = service.add(billpayment);
41 | LOG.info("BillPayment added : " + addBillPayment.getId());
42 |
43 | //delete billpayment
44 | BillPayment deletedBillPayment = service.delete(addBillPayment);
45 | LOG.info("BillPayment deleted : " + deletedBillPayment.getId() + " status ::: " + deletedBillPayment.getStatus());
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while deleting entity :: " + error.getMessage()));
50 | }
51 |
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/classentity/ClassDelete.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.classentity;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.ClassHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Class;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to delete class data
15 | * Name-list resources can only be soft deleted meaning, marked as inactive
16 | * Note: We'll create an entity first and then delete the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class ClassDelete {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | deleteClass();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void deleteClass() throws FMSException {
34 |
35 | try {
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // create class
39 | Class classObj = ClassHelper.getClassFields();
40 | Class addClass = service.add(classObj);
41 | LOG.info("Class added : " + addClass.getId() + " active flag ::: " + addClass.isActive());
42 |
43 | // set active flag as false to soft delete
44 | addClass.setActive(false);
45 | Class deletedClass = service.update(addClass);
46 | LOG.info("Class deleted : " + deletedClass.getId() + " active flag ::: " + deletedClass.isActive());
47 |
48 | } catch (FMSException e) {
49 | List list = e.getErrorList();
50 | list.forEach(error -> LOG.error("Error while deleting entity :: " + error.getMessage()));
51 | }
52 |
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/exchangerate/ExchangeRateQuery.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.exchangerate;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Error;
8 | import com.intuit.ipp.data.ExchangeRate;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.services.QueryResult;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to query ExchangeRate
16 | * 1. Query all records
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class ExchangeRateQuery {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | queryExchangeRate();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void queryExchangeRate() throws FMSException, ParseException {
34 |
35 | try {
36 |
37 | DataService service = DataServiceFactory.getDataService();
38 |
39 | // get all exchangerate
40 | String sql = "select * from exchangerate";
41 | QueryResult queryResult = service.executeQuery(sql);
42 |
43 | if (!queryResult.getEntities().isEmpty() && queryResult.getEntities().size() > 0) {
44 | ExchangeRate exchangerate = (ExchangeRate) queryResult.getEntities().get(0);
45 | LOG.info("ExchangeRate -> Rate: " + exchangerate.getRate());
46 | int count = queryResult.getEntities().size();
47 | LOG.info("Total number of exchangerate: " + count);
48 | }
49 |
50 |
51 | } catch (FMSException e) {
52 | List list = e.getErrorList();
53 | list.forEach(error -> LOG.error("Error while calling executeQuery :: " + error.getMessage()));
54 | }
55 |
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/journalentry/JournalEntryDelete.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.journalentry;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.helper.JournalEntryHelper;
7 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
8 | import com.intuit.ipp.data.JournalEntry;
9 | import com.intuit.ipp.data.Error;
10 | import com.intuit.ipp.exception.FMSException;
11 | import com.intuit.ipp.services.DataService;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to delete journalentry data
16 | * Note: We'll create an entity first and then delete the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class JournalEntryDelete {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | deleteJournalEntry();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void deleteJournalEntry() throws FMSException, ParseException {
34 |
35 | try {
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // create journalentry
39 | JournalEntry journalentry = JournalEntryHelper.getJournalEntryFields(service);
40 | JournalEntry addJournalEntry = service.add(journalentry);
41 | LOG.info("JournalEntry added : " + addJournalEntry.getId());
42 |
43 | //delete journalentry
44 | JournalEntry deletedJournalEntry = service.delete(addJournalEntry);
45 | LOG.info("JournalEntry deleted : " + deletedJournalEntry.getId() + " status ::: " + deletedJournalEntry.getStatus());
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while deleting entity :: " + error.getMessage()));
50 | }
51 |
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/salesreceipt/SalesReceiptDelete.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.salesreceipt;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.helper.SalesReceiptHelper;
7 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
8 | import com.intuit.ipp.data.SalesReceipt;
9 | import com.intuit.ipp.data.Error;
10 | import com.intuit.ipp.exception.FMSException;
11 | import com.intuit.ipp.services.DataService;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to delete salesreceipt data
16 | * Note: We'll create an entity first and then delete the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class SalesReceiptDelete {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | deleteSalesReceipt();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void deleteSalesReceipt() throws FMSException, ParseException {
34 |
35 | try {
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // create salesreceipt
39 | SalesReceipt salesreceipt = SalesReceiptHelper.getSalesReceiptFields(service);
40 | SalesReceipt addSalesReceipt = service.add(salesreceipt);
41 | LOG.info("SalesReceipt added : " + addSalesReceipt.getId());
42 |
43 | //delete salesreceipt
44 | SalesReceipt deletedSalesReceipt = service.delete(addSalesReceipt);
45 | LOG.info("SalesReceipt deleted : " + deletedSalesReceipt.getId() + " status ::: " + deletedSalesReceipt.getStatus());
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while deleting entity :: " + error.getMessage()));
50 | }
51 |
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/salesreceipt/SalesReceiptVoid.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.salesreceipt;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.helper.SalesReceiptHelper;
7 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.data.SalesReceipt;
10 | import com.intuit.ipp.exception.FMSException;
11 | import com.intuit.ipp.services.DataService;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to void salesreceipt
16 | * Note: We'll create an entity first and then void the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class SalesReceiptVoid {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | voidSalesReceipt();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void voidSalesReceipt() throws FMSException, ParseException {
34 |
35 | try {
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // create salesreceipt
39 | SalesReceipt salesreceipt = SalesReceiptHelper.getSalesReceiptFields(service);
40 | SalesReceipt addSalesReceipt = service.add(salesreceipt);
41 | LOG.info("SalesReceipt added : " + addSalesReceipt.getId());
42 |
43 | // void salesreceipt
44 | SalesReceipt voidedSalesReceipt = service.voidRequest(addSalesReceipt);
45 | LOG.info("SalesReceipt voided : " + voidedSalesReceipt.getId() + " status ::: " + voidedSalesReceipt.getPrivateNote());
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while voiding entity :: " + error.getMessage()));
50 | }
51 | }
52 |
53 |
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/timeactivity/TimeActivityDelete.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.timeactivity;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.helper.TimeActivityHelper;
7 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
8 | import com.intuit.ipp.data.TimeActivity;
9 | import com.intuit.ipp.data.Error;
10 | import com.intuit.ipp.exception.FMSException;
11 | import com.intuit.ipp.services.DataService;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to delete timeactivity data
16 | * Note: We'll create an entity first and then delete the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class TimeActivityDelete {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | deleteTimeActivity();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void deleteTimeActivity() throws FMSException, ParseException {
34 |
35 | try {
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // create timeactivity
39 | TimeActivity timeactivity = TimeActivityHelper.getTimeActivityFields(service);
40 | TimeActivity addTimeActivity = service.add(timeactivity);
41 | LOG.info("TimeActivity added : " + addTimeActivity.getId());
42 |
43 | //delete timeactivity
44 | TimeActivity deletedTimeActivity = service.delete(addTimeActivity);
45 | LOG.info("TimeActivity deleted : " + deletedTimeActivity.getId() + " status ::: " + deletedTimeActivity.getStatus());
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while deleting entity :: " + error.getMessage()));
50 | }
51 |
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/vendorcredit/VendorCreditDelete.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.vendorcredit;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.helper.VendorCreditHelper;
7 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
8 | import com.intuit.ipp.data.VendorCredit;
9 | import com.intuit.ipp.data.Error;
10 | import com.intuit.ipp.exception.FMSException;
11 | import com.intuit.ipp.services.DataService;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to delete vendorcredit data
16 | * Note: We'll create an entity first and then delete the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class VendorCreditDelete {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | deleteVendorCredit();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void deleteVendorCredit() throws FMSException, ParseException {
34 |
35 | try {
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // create vendorcredit
39 | VendorCredit vendorcredit = VendorCreditHelper.getVendorCreditFields(service);
40 | VendorCredit addVendorCredit = service.add(vendorcredit);
41 | LOG.info("VendorCredit added : " + addVendorCredit.getId());
42 |
43 | //delete vendorcredit
44 | VendorCredit deletedVendorCredit = service.delete(addVendorCredit);
45 | LOG.info("VendorCredit deleted : " + deletedVendorCredit.getId() + " status ::: " + deletedVendorCredit.getStatus());
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while deleting entity :: " + error.getMessage()));
50 | }
51 |
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/vendor/VendorCreate.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.vendor;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.VendorHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Error;
8 | import com.intuit.ipp.data.Vendor;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to create vendor
15 | * 1. Using mandatory fields
16 | * 2. Using all fields
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class VendorCreate {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | createVendor();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void createVendor() throws Exception {
34 |
35 | try {
36 |
37 | DataService service = DataServiceFactory.getDataService();
38 |
39 | // add vendor with minimum mandatory fields
40 | Vendor vendor = VendorHelper.getVendorWithMandatoryFields();
41 | Vendor savedVendor = service.add(vendor);
42 | LOG.info("Vendor with mandatory fields created: " + savedVendor.getId() + " ::vendor name: " + savedVendor.getDisplayName());
43 |
44 | // add vendor with all fields
45 | vendor = VendorHelper.getVendorWithAllFields(service);
46 | savedVendor = service.add(vendor);
47 | LOG.info("Vendor with all fields created: " + savedVendor.getId() + " ::vendor name: " + savedVendor.getDisplayName());
48 |
49 | } catch (FMSException e) {
50 | List list = e.getErrorList();
51 | list.forEach(error -> LOG.error("Error while calling entity add:: " + error.getMessage()));
52 | }
53 |
54 | }
55 |
56 |
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/salesreceipt/SalesReceiptSend.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.salesreceipt;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.helper.SalesReceiptHelper;
7 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.data.SalesReceipt;
10 | import com.intuit.ipp.exception.FMSException;
11 | import com.intuit.ipp.services.DataService;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to send salesreceipt email
16 | * Note: We'll create an entity first and then send the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class SalesReceiptSend {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | sendSalesReceipt();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void sendSalesReceipt() throws FMSException, ParseException {
34 |
35 | try {
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // create salesreceipt
39 | SalesReceipt salesreceipt = SalesReceiptHelper.getSalesReceiptFields(service);
40 | SalesReceipt addSalesReceipt = service.add(salesreceipt);
41 | LOG.info("SalesReceipt added : " + addSalesReceipt.getId());
42 |
43 | // void salesreceipt
44 | SalesReceipt sendSalesReceipt = service.sendEmail(addSalesReceipt, "abc@intuit.com");
45 | LOG.info("SalesReceipt sent : " + sendSalesReceipt.getId() + " status ::: " + sendSalesReceipt.getPrivateNote());
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while voiding entity :: " + error.getMessage()));
50 | }
51 | }
52 |
53 |
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/purchaseorder/PurchaseOrderDelete.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.purchaseorder;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.helper.PurchaseHelper;
7 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.data.PurchaseOrder;
10 | import com.intuit.ipp.exception.FMSException;
11 | import com.intuit.ipp.services.DataService;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to delete purchaseorder data
16 | * Note: We'll create an entity first and then delete the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class PurchaseOrderDelete {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | deletePurchaseOrder();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void deletePurchaseOrder() throws FMSException, ParseException {
34 |
35 | try {
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // create purchaseorder
39 | PurchaseOrder purchaseorder = PurchaseHelper.getPurchaseOrderFields(service);
40 | PurchaseOrder addPurchaseOrder = service.add(purchaseorder);
41 | LOG.info("PurchaseOrder added : " + addPurchaseOrder.getId());
42 |
43 | //delete purchaseorder
44 | PurchaseOrder deletedPurchaseOrder = service.delete(addPurchaseOrder);
45 | LOG.info("PurchaseOrder deleted : " + deletedPurchaseOrder.getId() + " status ::: " + deletedPurchaseOrder.getStatus());
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while deleting entity :: " + error.getMessage()));
50 | }
51 |
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/account/AccountDelete.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.account;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.AccountHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Account;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to delete account data
15 | * Name-list resources can only be soft deleted meaning, marked as inactive
16 | * Note: We'll create an entity first and then delete the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class AccountDelete {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | deleteAccount();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void deleteAccount() throws FMSException {
34 |
35 | try {
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // create account
39 | Account account = AccountHelper.getBankAccountFields();
40 | Account addAccount = service.add(account);
41 | LOG.info("Account added : " + addAccount.getId() + " active flag ::: " + addAccount.isActive());
42 |
43 | // set active flag as false to soft delete
44 | addAccount.setActive(false);
45 | Account deletedAccount = service.update(addAccount);
46 | LOG.info("Account deleted : " + deletedAccount.getId() + " active flag ::: " + deletedAccount.isActive());
47 |
48 |
49 | } catch (FMSException e) {
50 | List list = e.getErrorList();
51 | list.forEach(error -> LOG.error("Error while deleting entity :: " + error.getMessage()));
52 | }
53 |
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/salesreceipt/SalesReceiptRead.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.salesreceipt;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.helper.SalesReceiptHelper;
7 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.data.SalesReceipt;
10 | import com.intuit.ipp.exception.FMSException;
11 | import com.intuit.ipp.services.DataService;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to read salesreceipt data using salesreceipt id
16 | * Note: We'll create an entity first and then read the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class SalesReceiptRead {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | getSalesReceipt();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void getSalesReceipt() throws FMSException, ParseException {
34 |
35 | try {
36 |
37 | DataService service = DataServiceFactory.getDataService();
38 |
39 | // add salesreceipt
40 | SalesReceipt salesreceipt = SalesReceiptHelper.getSalesReceiptFields(service);
41 | SalesReceipt savedSalesReceipt = service.add(salesreceipt);
42 | LOG.info("SalesReceipt created: " + savedSalesReceipt.getId() + " ::salesreceipt doc num: " + savedSalesReceipt.getDocNumber());
43 |
44 | SalesReceipt salesreceiptOut = service.findById(savedSalesReceipt);
45 | LOG.info("SalesReceipt amount: " + salesreceiptOut.getTotalAmt());
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while calling entity findById:: " + error.getMessage()));
50 | }
51 |
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/refundreceipt/RefundReceiptDelete.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.refundreceipt;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.helper.RefundReceiptHelper;
7 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
8 | import com.intuit.ipp.data.RefundReceipt;
9 | import com.intuit.ipp.data.Error;
10 | import com.intuit.ipp.exception.FMSException;
11 | import com.intuit.ipp.services.DataService;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to delete refundreceipt data
16 | * Note: We'll create an entity first and then delete the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class RefundReceiptDelete {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | deleteRefundReceipt();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void deleteRefundReceipt() throws FMSException, ParseException {
34 |
35 | try {
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // create refundreceipt
39 | RefundReceipt refundreceipt = RefundReceiptHelper.getRefundReceiptFields(service);
40 | RefundReceipt addRefundReceipt = service.add(refundreceipt);
41 | LOG.info("RefundReceipt added : " + addRefundReceipt.getId());
42 |
43 | //delete refundreceipt
44 | RefundReceipt deletedRefundReceipt = service.delete(addRefundReceipt);
45 | LOG.info("RefundReceipt deleted : " + deletedRefundReceipt.getId() + " status ::: " + deletedRefundReceipt.getStatus());
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while deleting entity :: " + error.getMessage()));
50 | }
51 |
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/inventoryadjustment/InventoryAdjustmentRead.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.inventoryadjustment;
2 |
3 | import com.intuit.developer.sampleapp.crud.helper.InventoryAdjustmentHelper;
4 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
5 | import com.intuit.ipp.data.Error;
6 | import com.intuit.ipp.data.InventoryAdjustment;
7 | import com.intuit.ipp.exception.FMSException;
8 | import com.intuit.ipp.services.DataService;
9 | import com.intuit.ipp.util.Logger;
10 |
11 | import java.util.List;
12 |
13 | /**
14 | * Demonstrates methods to read InventoryAdjustment using Inventory Adjustment id
15 | * Note: We'll create an entity first and then read the same
16 | *
17 | * @author sramadass
18 | *
19 | */
20 | public class InventoryAdjustmentRead {
21 |
22 | private static final org.slf4j.Logger LOG = Logger.getLogger();
23 |
24 | public static void main(String[] args) {
25 | try {
26 | getInventoryAdjustment();
27 | } catch (Exception e) {
28 | LOG.error("Error during CRUD", e.getCause());
29 | }
30 | }
31 |
32 | public static void getInventoryAdjustment() {
33 |
34 | try {
35 |
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // add Inventory Adjustment
39 | InventoryAdjustment inventoryAdjustment = InventoryAdjustmentHelper.getInvAdjFields(service);
40 | InventoryAdjustment savedInventoryAdjustment = service.add(inventoryAdjustment);
41 | LOG.info("Inventory Adjustment created: " + savedInventoryAdjustment.getId());
42 |
43 | InventoryAdjustment inventoryAdjustmentOut = service.findById(savedInventoryAdjustment);
44 | LOG.info("Inventory Adjustment ID: " + inventoryAdjustmentOut.getId());
45 |
46 | } catch (FMSException e) {
47 | List list = e.getErrorList();
48 | list.forEach(error -> LOG.error("Error while calling entity findById:: " + error.getMessage()));
49 | }
50 |
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/taxclassification/TaxClassificationReadByParentId.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.taxclassification;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Error;
8 | import com.intuit.ipp.data.ReferenceType;
9 | import com.intuit.ipp.data.TaxClassification;
10 | import com.intuit.ipp.exception.FMSException;
11 | import com.intuit.ipp.services.DataService;
12 | import com.intuit.ipp.services.QueryResult;
13 | import com.intuit.ipp.util.Logger;
14 |
15 | /**
16 | * Demonstrates methods to read TaxClassification data using parent id
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class TaxClassificationReadByParentId {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | findTaxClassificationByParentId();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void findTaxClassificationByParentId() throws FMSException, ParseException {
34 |
35 | try {
36 |
37 | DataService service = DataServiceFactory.getDataService();
38 |
39 | //read by parent
40 | TaxClassification taxClassification = new TaxClassification();
41 | ReferenceType refParent = new ReferenceType();
42 | refParent.setValue("V1-00060000");
43 | taxClassification.setParentRef(refParent);
44 | QueryResult queryResult = service.findTaxClassificationByParentId(taxClassification);
45 | int count = queryResult.getEntities().size();
46 | LOG.info("Total number of taxclassification :: " + count);
47 |
48 |
49 | } catch (FMSException e) {
50 | List list = e.getErrorList();
51 | list.forEach(error -> LOG.error("Error while calling executeQuery :: " + error.getMessage()));
52 | }
53 |
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/purchaseorder/PurchaseOrderRead.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.purchaseorder;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.helper.PurchaseHelper;
7 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.data.PurchaseOrder;
10 | import com.intuit.ipp.exception.FMSException;
11 | import com.intuit.ipp.services.DataService;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to read purchaseorder data using purchaseorder id
16 | * Note: We'll create an entity first and then read the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class PurchaseOrderRead {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | getPurchaseOrder();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void getPurchaseOrder() throws FMSException, ParseException {
34 |
35 | try {
36 |
37 | DataService service = DataServiceFactory.getDataService();
38 |
39 | // add purchaseorder
40 | PurchaseOrder purchaseorder = PurchaseHelper.getPurchaseOrderFields(service);
41 | PurchaseOrder savedPurchaseOrder = service.add(purchaseorder);
42 | LOG.info("PurchaseOrder created: " + savedPurchaseOrder.getId() + " ::purchaseorder doc num: " + savedPurchaseOrder.getDocNumber());
43 |
44 | PurchaseOrder purchaseorderOut = service.findById(savedPurchaseOrder);
45 | LOG.info("PurchaseOrder amount: " + purchaseorderOut.getTotalAmt());
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while calling entity findById:: " + error.getMessage()));
50 | }
51 |
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/customer/CustomerDelete.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.customer;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.CustomerHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Customer;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to delete customer data
15 | * Name-list resources can only be soft deleted meaning, marked as inactive
16 | * Note: We'll create an entity first and then delete the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class CustomerDelete {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | deleteCustomer();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void deleteCustomer() throws FMSException {
34 |
35 | try {
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // create customer
39 | Customer customer = CustomerHelper.getCustomerWithMandatoryFields();
40 | Customer addCustomer = service.add(customer);
41 | LOG.info("Customer added : " + addCustomer.getId() + " active flag ::: " + addCustomer.isActive());
42 |
43 | // set active flag as false to soft delete
44 | addCustomer.setActive(false);
45 | Customer deletedCustomer = service.update(addCustomer);
46 | LOG.info("Customer deleted : " + deletedCustomer.getId() + " active flag ::: " + deletedCustomer.isActive());
47 |
48 | } catch (FMSException e) {
49 | List list = e.getErrorList();
50 | list.forEach(error -> LOG.error("Error while deleting entity :: " + error.getMessage()));
51 | }
52 |
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/employee/EmployeeCreate.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.employee;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.EmployeeHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Employee;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to create employee
15 | * 1. Using mandatory fields
16 | * 2. Using all fields
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class EmployeeCreate {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | createEmployee();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void createEmployee() throws Exception {
34 |
35 | try {
36 |
37 | DataService service = DataServiceFactory.getDataService();
38 |
39 | // add employee with minimum mandatory fields
40 | Employee employee = EmployeeHelper.getEmployeeWithMandatoryFields();
41 | Employee savedEmployee = service.add(employee);
42 | LOG.info("Employee with mandatory fields created: " + savedEmployee.getId() + " ::employee name: " + savedEmployee.getDisplayName());
43 |
44 | // add employee with all fields
45 | employee = EmployeeHelper.getEmployeeWithAllFields();
46 | savedEmployee = service.add(employee);
47 | LOG.info("Employee with all fields created: " + savedEmployee.getId() + " ::employee name: " + savedEmployee.getDisplayName());
48 |
49 | } catch (FMSException e) {
50 | List list = e.getErrorList();
51 | list.forEach(error -> LOG.error("Error while calling entity add:: " + error.getMessage()));
52 | }
53 |
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/employee/EmployeeDelete.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.employee;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.EmployeeHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Employee;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to delete employee data
15 | * Name-list resources can only be soft deleted meaning, marked as inactive
16 | * Note: We'll create an entity first and then delete the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class EmployeeDelete {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | deleteEmployee();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void deleteEmployee() throws FMSException {
34 |
35 | try {
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // create employee
39 | Employee employee = EmployeeHelper.getEmployeeWithMandatoryFields();
40 | Employee addEmployee = service.add(employee);
41 | LOG.info("Employee added : " + addEmployee.getId() + " active flag ::: " + addEmployee.isActive());
42 |
43 | // set active flag as false to soft delete
44 | addEmployee.setActive(false);
45 | Employee deletedEmployee = service.update(addEmployee);
46 | LOG.info("Employee deleted : " + deletedEmployee.getId() + " active flag ::: " + deletedEmployee.isActive());
47 |
48 | } catch (FMSException e) {
49 | List list = e.getErrorList();
50 | list.forEach(error -> LOG.error("Error while deleting entity :: " + error.getMessage()));
51 | }
52 |
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/refundreceipt/RefundReceiptRead.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.refundreceipt;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.helper.RefundReceiptHelper;
7 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.data.RefundReceipt;
10 | import com.intuit.ipp.exception.FMSException;
11 | import com.intuit.ipp.services.DataService;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to read refundreceipt data using refundreceipt id
16 | * Note: We'll create an entity first and then read the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class RefundReceiptRead {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | getRefundReceipt();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void getRefundReceipt() throws FMSException, ParseException {
34 |
35 | try {
36 |
37 | DataService service = DataServiceFactory.getDataService();
38 |
39 | // add refundreceipt
40 | RefundReceipt refundreceipt = RefundReceiptHelper.getRefundReceiptFields(service);
41 | RefundReceipt savedRefundReceipt = service.add(refundreceipt);
42 | LOG.info("RefundReceipt created: " + savedRefundReceipt.getId() + " ::refundreceipt doc num: " + savedRefundReceipt.getDocNumber());
43 |
44 | RefundReceipt refundreceiptOut = service.findById(savedRefundReceipt);
45 | LOG.info("RefundReceipt amount: " + refundreceiptOut.getTotalAmt());
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while calling entity findById:: " + error.getMessage()));
50 | }
51 |
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/customer/CustomerCreate.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.customer;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.CustomerHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Customer;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to create customer
15 | * 1. Using mandatory fields
16 | * 2. Using all fields
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class CustomerCreate {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | createCustomer();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void createCustomer() throws Exception {
34 |
35 | try {
36 |
37 | DataService service = DataServiceFactory.getDataService();
38 |
39 | // add customer with minimum mandatory fields
40 | Customer customer = CustomerHelper.getCustomerWithMandatoryFields();
41 | Customer savedCustomer = service.add(customer);
42 | LOG.info("Customer with mandatory fields created: " + savedCustomer.getId() + " ::customer name: " + savedCustomer.getDisplayName());
43 |
44 | // add customer with all fields
45 | customer = CustomerHelper.getCustomerWithAllFields();
46 | savedCustomer = service.add(customer);
47 | LOG.info("Customer with all fields created: " + savedCustomer.getId() + " ::customer name: " + savedCustomer.getDisplayName());
48 |
49 | } catch (FMSException e) {
50 | List list = e.getErrorList();
51 | list.forEach(error -> LOG.error("Error while calling entity add:: " + error.getMessage()));
52 | }
53 |
54 | }
55 |
56 |
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/timeactivity/TimeActivityRead.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.timeactivity;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.helper.TimeActivityHelper;
7 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.data.TimeActivity;
10 | import com.intuit.ipp.exception.FMSException;
11 | import com.intuit.ipp.services.DataService;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to read timeactivity data using timeactivity id
16 | * Note: We'll create an entity first and then read the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class TimeActivityRead {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | getTimeActivity();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void getTimeActivity() throws FMSException, ParseException {
34 |
35 | try {
36 |
37 | DataService service = DataServiceFactory.getDataService();
38 |
39 | // add time activity
40 | TimeActivity timeActivityIn = TimeActivityHelper.getTimeActivityFields(service);
41 | TimeActivity timeActivityOut = service.add(timeActivityIn);
42 | LOG.info("TimeActivity created: " + timeActivityOut.getId() + " ::TimeActivity starttime: " + timeActivityOut.getStartTime() + "::: " + timeActivityOut.getEndTime());
43 |
44 | TimeActivity timeactivityOut = service.findById(timeActivityOut);
45 | LOG.info("TimeActivity status: " + timeactivityOut.getBillableStatus());
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while calling entity findById:: " + error.getMessage()));
50 | }
51 |
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/companycurrency/CompanyCurrencyQuery.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.companycurrency;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.CompanyCurrency;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.services.QueryResult;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to query company currency
16 | * 1. Query all records
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class CompanyCurrencyQuery {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | queryCompanyCurrency();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void queryCompanyCurrency() throws FMSException, ParseException {
34 |
35 | try {
36 |
37 | DataService service = DataServiceFactory.getDataService();
38 |
39 | // get all companycurrency
40 | String sql = "select * from companycurrency";
41 | QueryResult queryResult = service.executeQuery(sql);
42 |
43 | if (!queryResult.getEntities().isEmpty() && queryResult.getEntities().size() > 0) {
44 | CompanyCurrency companycurrency = (CompanyCurrency) queryResult.getEntities().get(0);
45 | LOG.info("CompanyCurrency -> name: " + companycurrency.getName());
46 | int count = queryResult.getEntities().size();
47 | LOG.info("Total number of companycurrency: " + count);
48 | }
49 |
50 |
51 |
52 |
53 |
54 |
55 | } catch (FMSException e) {
56 | List list = e.getErrorList();
57 | list.forEach(error -> LOG.error("Error while calling executeQuery :: " + error.getMessage()));
58 | }
59 |
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/department/DepartmentDelete.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.department;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.DepartmentHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Department;
8 | import com.intuit.ipp.data.Error;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to delete department data
15 | * Name-list resources can only be soft deleted meaning, marked as inactive
16 | * Note: We'll create an entity first and then delete the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class DepartmentDelete {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | deleteDepartment();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void deleteDepartment() throws FMSException {
34 |
35 | try {
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // create department
39 | Department department = DepartmentHelper.getDepartmentFields();
40 | Department addDepartment = service.add(department);
41 | LOG.info("Department added : " + addDepartment.getId() + " active flag ::: " + addDepartment.isActive());
42 |
43 | // set active flag as false to soft delete
44 | addDepartment.setActive(false);
45 | Department deletedDepartment = service.update(addDepartment);
46 | LOG.info("Department deleted : " + deletedDepartment.getId() + " active flag ::: " + deletedDepartment.isActive());
47 |
48 | } catch (FMSException e) {
49 | List list = e.getErrorList();
50 | list.forEach(error -> LOG.error("Error while deleting entity :: " + error.getMessage()));
51 | }
52 |
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/creditcardpayment/CreditCardPaymentRead.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.creditcardpayment;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.helper.CreditCardPaymentHelper;
7 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
8 | import com.intuit.ipp.data.CreditCardPaymentTxn;
9 | import com.intuit.ipp.data.Error;
10 | import com.intuit.ipp.exception.FMSException;
11 | import com.intuit.ipp.services.DataService;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to read creditCardPayment using creditCardPayment id
16 | * Note: We'll create an entity first and then read the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class CreditCardPaymentRead {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | getCreditCardPayment();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void getCreditCardPayment() throws FMSException, ParseException {
34 |
35 | try {
36 |
37 | DataService service = DataServiceFactory.getDataService();
38 |
39 | // add creditCardPayment
40 | CreditCardPaymentTxn creditCardPayment = CreditCardPaymentHelper.getCreditCardPaymentFields(service);
41 | CreditCardPaymentTxn savedCreditCardPayment = service.add(creditCardPayment);
42 | LOG.info("CreditCardPayment created: " + savedCreditCardPayment.getId() );
43 |
44 | CreditCardPaymentTxn creditCardPaymentOut = service.findById(savedCreditCardPayment);
45 | LOG.info("CreditCardPayment Txn status: " + creditCardPaymentOut.getTxnStatus());
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while calling entity findById:: " + error.getMessage()));
50 | }
51 |
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/batch/Batch.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.batch;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
6 | import com.intuit.ipp.data.Error;
7 | import com.intuit.ipp.data.Report;
8 | import com.intuit.ipp.exception.FMSException;
9 | import com.intuit.ipp.services.BatchOperation;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.services.QueryResult;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to create bill
16 | * 1. Using mandatory fields
17 | * 2. Using all fields
18 | *
19 | * @author dderose
20 | *
21 | */
22 | public class Batch {
23 |
24 | private static final org.slf4j.Logger LOG = Logger.getLogger();
25 |
26 | public static void main(String[] args) {
27 | try {
28 | addBatch();
29 | } catch (Exception e) {
30 | LOG.error("Error during CRUD", e.getCause());
31 | }
32 | }
33 |
34 | public static void addBatch() throws Exception {
35 |
36 | try {
37 |
38 | DataService service = DataServiceFactory.getDataService();
39 |
40 | BatchOperation batchOperation = new BatchOperation();
41 |
42 | String query = "select * from Customer startposition 1 maxresults 1";
43 | batchOperation.addQuery(query, "bID1");
44 |
45 | String reportQuery = "select * from VendorExpenses";
46 | batchOperation.addReportQuery(reportQuery, "bID2");
47 |
48 | service.executeBatch(batchOperation);
49 |
50 | QueryResult queryResult = batchOperation.getQueryResponse("bID1");
51 | LOG.info("report created: " + queryResult.getEntities().size());
52 |
53 | Report report = batchOperation.getReport("bID2");
54 |
55 | LOG.info("report created: " + report.getRows().getRow().size());
56 |
57 | } catch (FMSException e) {
58 | List list = e.getErrorList();
59 | list.forEach(error -> LOG.error("Error while calling entity add:: " + error.getMessage()));
60 | }
61 |
62 | }
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/reimbursecharge/ReimburseChargeQuery.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.reimbursecharge;
2 |
3 | import com.intuit.developer.sampleapp.crud.helper.RefundReceiptHelper;
4 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
5 | import com.intuit.ipp.data.Error;
6 | import com.intuit.ipp.data.RefundReceipt;
7 | import com.intuit.ipp.exception.FMSException;
8 | import com.intuit.ipp.services.DataService;
9 | import com.intuit.ipp.services.QueryResult;
10 | import com.intuit.ipp.util.Logger;
11 |
12 | import java.text.ParseException;
13 | import java.util.List;
14 |
15 | /**
16 | * Demonstrates methods to query refundreceipt data
17 | * 1. Query all records
18 | * 2. Query by id, note we'll add the entity first and then query
19 | *
20 | * @author dderose
21 | *
22 | */
23 | public class ReimburseChargeQuery {
24 |
25 | private static final org.slf4j.Logger LOG = Logger.getLogger();
26 |
27 | public static void main(String[] args) {
28 | try {
29 | queryReimburseCharge();
30 | } catch (Exception e) {
31 | LOG.error("Error during CRUD", e.getCause());
32 | }
33 | }
34 |
35 | public static void queryReimburseCharge() throws FMSException, ParseException {
36 | try {
37 | DataService service = DataServiceFactory.getDataService();
38 |
39 | // get all reimbursecharge
40 | String sql = "Select * from ReimburseCharge";
41 | QueryResult queryResult = service.executeQuery(sql);
42 | int count = queryResult.getEntities().size();
43 |
44 | LOG.info("Total number of refundreceipts: " + count);
45 |
46 | // get reimbursecharge based on HasBeenInvoiced
47 | sql = "Select * from ReimburseCharge Where HasBeenInvoiced = false";
48 | queryResult = service.executeQuery(sql);
49 | LOG.info("Size: " + queryResult.getEntities().size());
50 | } catch (FMSException e) {
51 | List list = e.getErrorList();
52 | list.forEach(error -> LOG.error("Error while calling executeQuery :: " + error.getMessage()));
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/taxclassification/TaxClassificationReadByLevel.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.taxclassification;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Error;
8 | import com.intuit.ipp.data.TaxClassification;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.services.QueryResult;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to read TaxClassification data using level
16 | *
17 | * @author dderose
18 | *
19 | */
20 | public class TaxClassificationReadByLevel {
21 |
22 | private static final org.slf4j.Logger LOG = Logger.getLogger();
23 |
24 | public static void main(String[] args) {
25 | try {
26 | findTaxClassificationByLevel();
27 | } catch (Exception e) {
28 | LOG.error("Error during CRUD", e.getCause());
29 | }
30 | }
31 |
32 | public static void findTaxClassificationByLevel() throws FMSException, ParseException {
33 |
34 | try {
35 |
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | //read by level
39 | TaxClassification taxClassification = new TaxClassification();
40 | taxClassification.setLevel("1");
41 | QueryResult queryResult = service.findTaxClassificationByLevel(taxClassification);
42 | int count = queryResult.getEntities().size();
43 | LOG.info("Total number of taxclassification :: " + count);
44 |
45 | taxClassification.setLevel("2");
46 | queryResult = service.findTaxClassificationByLevel(taxClassification);
47 | count = queryResult.getEntities().size();
48 | LOG.info("Total number of taxclassification :: " + count);
49 |
50 |
51 |
52 |
53 | } catch (FMSException e) {
54 | List list = e.getErrorList();
55 | list.forEach(error -> LOG.error("Error while calling executeQuery :: " + error.getMessage()));
56 | }
57 |
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/creditcardpayment/CreditCardPaymentDelete.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.creditcardpayment;
2 |
3 | import java.text.ParseException;
4 | import java.util.List;
5 |
6 | import com.intuit.developer.sampleapp.crud.helper.CreditCardPaymentHelper;
7 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
8 | import com.intuit.ipp.data.CreditCardPaymentTxn;
9 | import com.intuit.ipp.data.Error;
10 | import com.intuit.ipp.exception.FMSException;
11 | import com.intuit.ipp.services.DataService;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to delete creditCardPayment
16 | * Note: We'll create an entity first and then delete the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class CreditCardPaymentDelete {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | deleteCreditCardPayment();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void deleteCreditCardPayment() throws FMSException, ParseException {
34 |
35 | try {
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // create creditCardPayment
39 | CreditCardPaymentTxn creditCardPayment = CreditCardPaymentHelper.getCreditCardPaymentFields(service);
40 | CreditCardPaymentTxn addCreditCardPayment = service.add(creditCardPayment);
41 | LOG.info("CreditCardPayment added : " + addCreditCardPayment.getId());
42 |
43 | // delete creditCardPayment
44 | CreditCardPaymentTxn deletedCreditCardPayment = service.delete(addCreditCardPayment);
45 | LOG.info("CreditCardPayment deleted : " + deletedCreditCardPayment.getId() + " status ::: " + deletedCreditCardPayment.getStatus());
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while deleting entity :: " + error.getMessage()));
50 | }
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/inventoryadjustment/InventoryAdjustmentDelete.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.inventoryadjustment;
2 |
3 | import com.intuit.developer.sampleapp.crud.helper.InventoryAdjustmentHelper;
4 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
5 | import com.intuit.ipp.data.Error;
6 | import com.intuit.ipp.data.InventoryAdjustment;
7 | import com.intuit.ipp.exception.FMSException;
8 | import com.intuit.ipp.services.DataService;
9 | import com.intuit.ipp.util.Logger;
10 |
11 | import java.text.ParseException;
12 | import java.util.List;
13 |
14 | /**
15 | * Demonstrates methods to delete inventory adjustment
16 | * Note: We'll create an entity first and then delete the same
17 | *
18 | * @author sramadass
19 | *
20 | */
21 | public class InventoryAdjustmentDelete {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | deleteInventoryAdjustment();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void deleteInventoryAdjustment() throws ParseException {
34 |
35 | try {
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // add Inventory Adjustment
39 | InventoryAdjustment inventoryAdjustment = InventoryAdjustmentHelper.getInvAdjFields(service);
40 | InventoryAdjustment savedInventoryAdjustment = service.add(inventoryAdjustment);
41 | LOG.info("Inventory Adjustment created: " + savedInventoryAdjustment.getId());
42 |
43 | // delete Inventory Adjustment
44 | InventoryAdjustment deletedInventoryAdjustment = service.delete(savedInventoryAdjustment);
45 | LOG.info("Inventory Adjustment deleted : " + deletedInventoryAdjustment.getId() + " status ::: " + deletedInventoryAdjustment.getStatus());
46 |
47 | } catch (FMSException e) {
48 | List list = e.getErrorList();
49 | list.forEach(error -> LOG.error("Error while deleting entity :: " + error.getMessage()));
50 | }
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/paymentmethod/PaymentMethodDelete.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.paymentmethod;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.PaymentHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Error;
8 | import com.intuit.ipp.data.PaymentMethod;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.util.Logger;
12 |
13 | /**
14 | * Demonstrates methods to delete paymentmethod data
15 | * Name-list resources can only be soft deleted meaning, marked as inactive
16 | * Note: We'll create an entity first and then delete the same
17 | *
18 | * @author dderose
19 | *
20 | */
21 | public class PaymentMethodDelete {
22 |
23 | private static final org.slf4j.Logger LOG = Logger.getLogger();
24 |
25 | public static void main(String[] args) {
26 | try {
27 | deletePaymentMethod();
28 | } catch (Exception e) {
29 | LOG.error("Error during CRUD", e.getCause());
30 | }
31 | }
32 |
33 | public static void deletePaymentMethod() throws FMSException {
34 |
35 | try {
36 | DataService service = DataServiceFactory.getDataService();
37 |
38 | // create paymentmethod
39 | PaymentMethod paymentmethod = PaymentHelper.getPaymentMethodFields();
40 | PaymentMethod addPaymentMethod = service.add(paymentmethod);
41 | LOG.info("PaymentMethod added : " + addPaymentMethod.getId() + " active flag ::: " + addPaymentMethod.isActive());
42 |
43 | // set active flag as false to soft delete
44 | addPaymentMethod.setActive(false);
45 | PaymentMethod deletedPaymentMethod = service.update(addPaymentMethod);
46 | LOG.info("PaymentMethod deleted : " + deletedPaymentMethod.getId() + " active flag ::: " + deletedPaymentMethod.isActive());
47 |
48 | } catch (FMSException e) {
49 | List list = e.getErrorList();
50 | list.forEach(error -> LOG.error("Error while deleting entity :: " + error.getMessage()));
51 | }
52 |
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/term/TermQuery.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.term;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.TermHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Error;
8 | import com.intuit.ipp.data.Term;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.services.QueryResult;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to query term data
16 | * 1. Query all records
17 | * 2. Query by id, note we'll add the entity first and then query
18 | *
19 | * @author dderose
20 | *
21 | */
22 | public class TermQuery {
23 |
24 | private static final org.slf4j.Logger LOG = Logger.getLogger();
25 |
26 | public static void main(String[] args) {
27 | try {
28 | queryTerm();
29 | } catch (Exception e) {
30 | LOG.error("Error during CRUD", e.getCause());
31 | }
32 | }
33 |
34 | public static void queryTerm() throws FMSException {
35 |
36 | try {
37 |
38 | DataService service = DataServiceFactory.getDataService();
39 |
40 | // get all term
41 | String sql = "select * from term";
42 | QueryResult queryResult = service.executeQuery(sql);
43 | int count = queryResult.getEntities().size();
44 |
45 | LOG.info("Total number of terms: " + count);
46 |
47 | // add term
48 | Term term = TermHelper.getTermFields();
49 | Term savedTerm = service.add(term);
50 | LOG.info("Term created: " + savedTerm.getId());
51 |
52 | // get term data based on id
53 | sql = "select * from term where id = '" + savedTerm.getId() + "'";
54 | queryResult = service.executeQuery(sql);
55 | term = (Term) queryResult.getEntities().get(0);
56 | LOG.info("Term name : " + term.getName());
57 |
58 | } catch (FMSException e) {
59 | List list = e.getErrorList();
60 | list.forEach(error -> LOG.error("Error while calling executeQuery :: " + error.getMessage()));
61 | }
62 |
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/entities/item/ItemQuery.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.entities.item;
2 |
3 | import java.util.List;
4 |
5 | import com.intuit.developer.sampleapp.crud.helper.ItemHelper;
6 | import com.intuit.developer.sampleapp.crud.qbo.DataServiceFactory;
7 | import com.intuit.ipp.data.Error;
8 | import com.intuit.ipp.data.Item;
9 | import com.intuit.ipp.exception.FMSException;
10 | import com.intuit.ipp.services.DataService;
11 | import com.intuit.ipp.services.QueryResult;
12 | import com.intuit.ipp.util.Logger;
13 |
14 | /**
15 | * Demonstrates methods to query item data
16 | * 1. Query all records
17 | * 2. Query by id, note we'll add the entity first and then query
18 | *
19 | * @author dderose
20 | *
21 | */
22 | public class ItemQuery {
23 |
24 | private static final org.slf4j.Logger LOG = Logger.getLogger();
25 |
26 | public static void main(String[] args) {
27 | try {
28 | queryItem();
29 | } catch (Exception e) {
30 | LOG.error("Error during CRUD", e.getCause());
31 | }
32 | }
33 |
34 | public static void queryItem() throws FMSException {
35 |
36 | try {
37 |
38 | DataService service = DataServiceFactory.getDataService();
39 |
40 | // get all item
41 | String sql = "select * from item";
42 | QueryResult queryResult = service.executeQuery(sql);
43 | int count = queryResult.getEntities().size();
44 |
45 | LOG.info("Total number of items: " + count);
46 |
47 | // add item
48 | Item item = ItemHelper.getItemFields(service);
49 | Item savedItem = service.add(item);
50 | LOG.info("Item created: " + savedItem.getId());
51 |
52 | // get item data based on id
53 | sql = "select * from item where id = '" + savedItem.getId() + "'";
54 | queryResult = service.executeQuery(sql);
55 | item = (Item) queryResult.getEntities().get(0);
56 | LOG.info("Item name : " + item.getName());
57 |
58 | } catch (FMSException e) {
59 | List list = e.getErrorList();
60 | list.forEach(error -> LOG.error("Error while calling executeQuery :: " + error.getMessage()));
61 | }
62 |
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/src/main/java/com/intuit/developer/sampleapp/crud/helper/VendorCreditHelper.java:
--------------------------------------------------------------------------------
1 | package com.intuit.developer.sampleapp.crud.helper;
2 |
3 | import java.math.BigDecimal;
4 | import java.text.ParseException;
5 | import java.util.ArrayList;
6 | import java.util.List;
7 |
8 | import com.intuit.ipp.data.Account;
9 | import com.intuit.ipp.data.AccountBasedExpenseLineDetail;
10 | import com.intuit.ipp.data.Line;
11 | import com.intuit.ipp.data.LineDetailTypeEnum;
12 | import com.intuit.ipp.data.Vendor;
13 | import com.intuit.ipp.data.VendorCredit;
14 | import com.intuit.ipp.exception.FMSException;
15 | import com.intuit.ipp.services.DataService;
16 | import com.intuit.ipp.util.DateUtils;
17 |
18 | /**
19 | * @author dderose
20 | *
21 | */
22 | public final class VendorCreditHelper {
23 |
24 | private VendorCreditHelper() {
25 |
26 | }
27 |
28 | public static VendorCredit getVendorCreditFields(DataService service) throws FMSException, ParseException {
29 |
30 | VendorCredit vendorCredit = new VendorCredit();
31 | Vendor vendor = VendorHelper.getVendor(service);
32 | vendorCredit.setVendorRef(VendorHelper.getVendorRef(vendor));
33 |
34 | Account account = AccountHelper.getLiabilityBankAccount(service);
35 | vendorCredit.setAPAccountRef(AccountHelper.getAccountRef(account));
36 |
37 | Line line1 = new Line();
38 | line1.setAmount(new BigDecimal("30.00"));
39 | line1.setDetailType(LineDetailTypeEnum.ACCOUNT_BASED_EXPENSE_LINE_DETAIL);
40 | AccountBasedExpenseLineDetail detail = new AccountBasedExpenseLineDetail();
41 | Account expenseAccount = AccountHelper.getExpenseBankAccount(service);
42 | detail.setAccountRef(AccountHelper.getAccountRef(expenseAccount));
43 | line1.setAccountBasedExpenseLineDetail(detail);
44 |
45 | List lines1 = new ArrayList();
46 | lines1.add(line1);
47 | vendorCredit.setLine(lines1);
48 |
49 | vendorCredit.setDomain("QBO");
50 | vendorCredit.setPrivateNote("Credit should be specified");
51 | vendorCredit.setTxnDate(DateUtils.getCurrentDateTime());
52 | vendorCredit.setTotalAmt(new BigDecimal("30.00"));
53 | return vendorCredit;
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------