Package com.gcrm.domain

Examples of com.gcrm.domain.Account


     *
     * @return original account record
     * @throws Exception
     */
    private Account saveEntity() throws Exception {
        Account originalAccount = null;
        if (account.getId() == null) {
            UserUtil.permissionCheck("create_account");
        } else {
            UserUtil.permissionCheck("update_account");
            originalAccount = baseService.getEntityById(Account.class,
                    account.getId());
            account.setTargetLists(originalAccount.getTargetLists());
            account.setDocuments(originalAccount.getDocuments());
            account.setCreated_on(originalAccount.getCreated_on());
            account.setCreated_by(originalAccount.getCreated_by());
        }
        AccountType type = null;
        if (typeID != null) {
            type = accountTypeService.getOptionById(AccountType.class, typeID);
        }
        account.setAccount_type(type);

        AccountLevel accountLevel = null;
        if (accountLevelID != null) {
            accountLevel = accountLevelService.getOptionById(
                    AccountLevel.class, accountLevelID);
        }
        account.setAccount_level(accountLevel);

        Currency currency = null;
        if (currencyID != null) {
            currency = currencyService
                    .getEntityById(Currency.class, currencyID);
        }
        account.setCurrency(currency);

        Capital capital = null;
        if (capitalID != null) {
            capital = capitalService.getOptionById(Capital.class, capitalID);
        }
        account.setCapital(capital);

        AnnualRevenue annualRevenue = null;
        if (annualRevenueID != null) {
            annualRevenue = annualRevenueService.getOptionById(
                    AnnualRevenue.class, annualRevenueID);
        }
        account.setAnnual_revenue(annualRevenue);

        CompanySize companySize = null;
        if (companySizeID != null) {
            companySize = companySizeService.getOptionById(CompanySize.class,
                    companySizeID);
        }
        account.setCompany_size(companySize);

        AccountNature accountNature = null;
        if (accountNatureID != null) {
            accountNature = accountNatureService.getOptionById(
                    AccountNature.class, accountNatureID);
        }
        account.setAccount_nature(accountNature);

        Industry industry = null;
        if (industryID != null) {
            industry = industryService
                    .getOptionById(Industry.class, industryID);
        }
        account.setIndustry(industry);

        User assignedTo = null;
        if (this.getAssignedToID() != null) {
            assignedTo = userService.getEntityById(User.class,
                    this.getAssignedToID());
        }
        account.setAssigned_to(assignedTo);

        User owner = null;
        if (this.getOwnerID() != null) {
            owner = userService.getEntityById(User.class, this.getOwnerID());
        }
        account.setOwner(owner);

        Account manager = null;
        if (managerID != null) {
            manager = baseService.getEntityById(Account.class, managerID);
        }
        account.setManager(manager);

View Full Code Here


            createChangeLog(changeLogs, entityName, recordID,
                    "account.ticket_symbol.label", oldTicketSymbol,
                    newTicketSymbol, loginUser);

            String oldManagerName = "";
            Account oldManager = originalAccount.getManager();
            if (oldManager != null) {
                oldManagerName = CommonUtil.fromNullToEmpty(oldManager
                        .getName());
            }
            String newManagerName = "";
            Account newManager = account.getManager();
            if (newManager != null) {
                newManagerName = CommonUtil.fromNullToEmpty(newManager
                        .getName());
            }
            createChangeLog(changeLogs, entityName, recordID,
                    "account.manager.label", oldManagerName, newManagerName,
                    loginUser);
View Full Code Here

            if (assignedTo != null) {
                this.setAssignedToID(assignedTo.getId());
                this.setAssignedToText(assignedTo.getName());
            }

            Account manager = account.getManager();
            if (manager != null) {
                managerID = manager.getId();
                managerText = manager.getName();
            }

            Date create_date = account.getCreate_date();
            SimpleDateFormat dateFormat = new SimpleDateFormat(
                    Constant.DATE_FORMAT);
View Full Code Here

     * @return the SUCCESS result
     */
    public String get() throws Exception {
        if (this.getId() != null) {
            contact = baseService.getEntityById(Contact.class, this.getId());
            Account account = contact.getAccount();
            if (account != null) {
                accountID = account.getId();
                accountText = account.getName();
            }

            Contact report_to = contact.getReport_to();
            if (report_to != null) {
                reportToID = report_to.getId();
View Full Code Here

            contact.setTargetLists(originalContact.getTargetLists());
            contact.setCreated_on(originalContact.getCreated_on());
            contact.setCreated_by(originalContact.getCreated_by());
        }

        Account account = null;
        if (accountID != null) {
            account = accountService.getEntityById(Account.class, accountID);
        }
        contact.setAccount(account);
View Full Code Here

            createChangeLog(changeLogs, entityName, recordID,
                    "contact.report_to.label", oldReportToName,
                    newReportToName, loginUser);

            String oldAccountName = "";
            Account oldAccount = originalContact.getAccount();
            if (oldAccount != null) {
                oldAccountName = CommonUtil.fromNullToEmpty(oldAccount
                        .getName());
            }
            String newAccountName = "";
            Account newAccount = contact.getAccount();
            if (newAccount != null) {
                newAccountName = CommonUtil.fromNullToEmpty(newAccount
                        .getName());
            }
            createChangeLog(changeLogs, entityName, recordID,
                    "entity.account.label", oldAccountName, newAccountName,
                    loginUser);
View Full Code Here

        String statusName = null;
        while (cases.hasNext()) {
            CaseInstance instance = cases.next();
            int id = instance.getId();
            String subject = instance.getSubject();
            Account account = instance.getAccount();
            if (account != null) {
                accountName = account.getName();
            } else {
                accountName = "";
            }
            CasePriority casePriority = instance.getPriority();
            priorityName = CommonUtil.getOptionLabel(casePriority);
View Full Code Here

        StringBuilder jsonBuilder = new StringBuilder("");
        String assignedTo = null;
        jsonBuilder
                .append(getJsonHeader(totalRecords, searchCondition, isList));
        while (accounts.hasNext()) {
            Account instance = accounts.next();
            int id = instance.getId();
            String name = CommonUtil.fromNullToEmpty(instance.getName());
            String officePhone = CommonUtil.fromNullToEmpty(instance
                    .getOffice_phone());
            String email = CommonUtil.fromNullToEmpty(instance.getEmail());
            User user = instance.getAssigned_to();
            if (user != null) {
                assignedTo = CommonUtil.fromNullToEmpty(user.getName());
            } else {
                assignedTo = "";
            }

            String billStreet = CommonUtil.fromNullToEmpty(instance
                    .getBill_street());
            String billCity = CommonUtil.fromNullToEmpty(instance
                    .getBill_city());
            String billCountry = CommonUtil.fromNullToEmpty(instance
                    .getBill_country());
            String billState = CommonUtil.fromNullToEmpty(instance
                    .getBill_state());
            String billPostalCode = CommonUtil.fromNullToEmpty(instance
                    .getBill_postal_code());
            if (isList) {
                jsonBuilder.append("{\"cell\":[\"").append(id).append("\",\"")
                        .append(name).append("\",\"").append(officePhone)
                        .append("\",\"").append(email).append("\"");
                String website = CommonUtil.fromNullToEmpty(instance
                        .getWebsite());
                String fax = CommonUtil.fromNullToEmpty(instance.getFax());
                String shipStreet = CommonUtil.fromNullToEmpty(instance
                        .getShip_street());
                String shipCity = CommonUtil.fromNullToEmpty(instance
                        .getBill_city());
                String shipState = CommonUtil.fromNullToEmpty(instance
                        .getBill_state());
                String shipPostalCode = CommonUtil.fromNullToEmpty(instance
                        .getShip_postal_code());
                String shipCountry = CommonUtil.fromNullToEmpty(instance
                        .getShip_country());
                String sicCode = CommonUtil.fromNullToEmpty(instance
                        .getSic_code());
                String ticketSymbol = CommonUtil.fromNullToEmpty(instance
                        .getTicket_symbol());
                Account manager = instance.getManager();
                String managerName = "";
                if (manager != null) {
                    managerName = CommonUtil.fromNullToEmpty(manager.getName());
                }
                User createdBy = instance.getCreated_by();
                String createdByName = "";
                if (createdBy != null) {
                    createdByName = CommonUtil.fromNullToEmpty(createdBy
View Full Code Here

        UserUtil.permissionCheck("create_account");
        if (this.getSeleteIDs() != null) {
            String[] ids = seleteIDs.split(",");
            for (int i = 0; i < ids.length; i++) {
                String copyid = ids[i];
                Account oriRecord = baseService.getEntityById(Account.class,
                        Integer.valueOf(copyid));
                Account targetRecord = oriRecord.clone();
                targetRecord.setId(null);
                this.getbaseService().makePersistent(targetRecord);
            }
        }
        return SUCCESS;
    }
View Full Code Here

            writer.writeHeader(header);
            if (!isTemplate) {
                String[] ids = seleteIDs.split(",");
                for (int i = 0; i < ids.length; i++) {
                    String id = ids[i];
                    Account account = baseService.getEntityById(Account.class,
                            Integer.parseInt(id));
                    final HashMap<String, ? super Object> data1 = new HashMap<String, Object>();
                    data1.put(header[0], account.getId());
                    data1.put(header[1],
                            CommonUtil.fromNullToEmpty(account.getName()));
                    AccountLevel accountLevel = account.getAccount_level();
                    if (accountLevel != null) {
                        data1.put(header[2], accountLevel.getId());
                    } else {
                        data1.put(header[2], "");
                    }
                    data1.put(header[3],
                            CommonUtil.getOptionLabel(accountLevel));
                    if (account.getCurrency() != null) {
                        data1.put(header[4], account.getCurrency().getId());
                        data1.put(header[5], account.getCurrency().getName());
                    } else {
                        data1.put(header[4], "");
                        data1.put(header[5], "");
                    }
                    Capital capital = account.getCapital();
                    if (capital != null) {
                        data1.put(header[6], capital.getId());
                    } else {
                        data1.put(header[6], "");
                    }
                    data1.put(header[7], CommonUtil.getOptionLabel(capital));
                    AnnualRevenue annualRevenue = account.getAnnual_revenue();
                    if (annualRevenue != null) {
                        data1.put(header[8], annualRevenue.getId());
                    } else {
                        data1.put(header[8], "");
                    }
                    data1.put(header[9],
                            CommonUtil.getOptionLabel(annualRevenue));
                    CompanySize companySize = account.getCompany_size();
                    if (companySize != null) {
                        data1.put(header[10], companySize.getId());
                    } else {
                        data1.put(header[10], "");
                    }
                    data1.put(header[11],
                            CommonUtil.getOptionLabel(companySize));
                    AccountType accountType = account.getAccount_type();
                    if (accountType != null) {
                        data1.put(header[12], accountType.getId());
                    } else {
                        data1.put(header[12], "");
                    }
                    data1.put(header[13],
                            CommonUtil.getOptionLabel(accountType));
                    Industry industry = account.getIndustry();
                    if (industry != null) {
                        data1.put(header[14], industry.getId());
                    } else {
                        data1.put(header[14], "");
                    }
                    data1.put(header[15], CommonUtil.getOptionLabel(industry));
                    data1.put(header[16],
                            CommonUtil.fromNullToEmpty(account.getEmail()));
                    data1.put(header[17], CommonUtil.fromNullToEmpty(account
                            .getOffice_phone()));
                    data1.put(header[18],
                            CommonUtil.fromNullToEmpty(account.getWebsite()));
                    data1.put(header[19],
                            CommonUtil.fromNullToEmpty(account.getFax()));
                    data1.put(header[20], CommonUtil.fromNullToEmpty(account
                            .getBill_street()));
                    data1.put(header[21],
                            CommonUtil.fromNullToEmpty(account.getBill_city()));
                    data1.put(header[22],
                            CommonUtil.fromNullToEmpty(account.getBill_state()));
                    data1.put(header[23], CommonUtil.fromNullToEmpty(account
                            .getBill_postal_code()));
                    data1.put(header[24], CommonUtil.fromNullToEmpty(account
                            .getBill_country()));
                    data1.put(header[25], CommonUtil.fromNullToEmpty(account
                            .getShip_street()));
                    data1.put(header[26],
                            CommonUtil.fromNullToEmpty(account.getShip_city()));
                    data1.put(header[27],
                            CommonUtil.fromNullToEmpty(account.getShip_state()));
                    data1.put(header[28], CommonUtil.fromNullToEmpty(account
                            .getShip_postal_code()));
                    data1.put(header[29], CommonUtil.fromNullToEmpty(account
                            .getShip_country()));
                    AccountNature accountNature = account.getAccount_nature();
                    if (accountNature != null) {
                        data1.put(header[30], accountNature.getId());
                    } else {
                        data1.put(header[30], "");
                    }
                    data1.put(header[31],
                            CommonUtil.getOptionLabel(accountNature));
                    data1.put(header[32], CommonUtil.fromNullToEmpty(account
                            .getLegal_representative()));
                    data1.put(header[33], CommonUtil.fromNullToEmpty(account
                            .getBusiness_scope()));
                    Date createDate = account.getCreate_date();
                    SimpleDateFormat dateFormat = new SimpleDateFormat(
                            Constant.DATE_EDIT_FORMAT);
                    if (createDate != null) {
                        data1.put(header[34], dateFormat.format(createDate));
                    } else {
                        data1.put(header[34], "");
                    }
                    data1.put(header[35],
                            CommonUtil.fromNullToEmpty(account.getCredit()));
                    data1.put(header[36],
                            CommonUtil.fromNullToEmpty(account.getReputation()));
                    data1.put(header[37], CommonUtil.fromNullToEmpty(account
                            .getMarket_position()));
                    data1.put(header[38], CommonUtil.fromNullToEmpty(account
                            .getDevelopment_potential()));
                    data1.put(header[39], CommonUtil.fromNullToEmpty(account
                            .getOperational_characteristics()));
                    data1.put(header[40], CommonUtil.fromNullToEmpty(account
                            .getOperational_direction()));
                    data1.put(header[41],
                            CommonUtil.fromNullToEmpty(account.getSic_code()));
                    data1.put(header[42], CommonUtil.fromNullToEmpty(account
                            .getTicket_symbol()));
                    if (account.getManager() != null) {
                        data1.put(header[43], account.getManager().getId());
                        data1.put(header[44], account.getManager().getName());
                    } else {
                        data1.put(header[43], "");
                        data1.put(header[44], "");
                    }
                    if (account.getAssigned_to() != null) {
                        data1.put(header[45], account.getAssigned_to().getId());
                        data1.put(header[46], account.getAssigned_to()
                                .getName());
                    } else {
                        data1.put(header[45], "");
                        data1.put(header[46], "");
                    }
View Full Code Here

TOP

Related Classes of com.gcrm.domain.Account

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.