Package com.gcrm.domain

Examples of com.gcrm.domain.Contact


            User user = userService
                    .getEntityById(User.class, loginUser.getId());
            Collection<ChangeLog> allChangeLogs = new ArrayList<ChangeLog>();
            for (String IDString : selectIDArray) {
                int id = Integer.parseInt(IDString);
                Contact contactInstance = this.baseService.getEntityById(
                        Contact.class, id);
                Contact originalContact = contactInstance.clone();
                for (String fieldName : fieldNames) {
                    Object value = BeanUtil.getFieldValue(contact, fieldName);
                    BeanUtil.setFieldValue(contactInstance, fieldName, value);
                }
                contactInstance.setUpdated_by(user);
View Full Code Here


     *
     * @return original contact record
     * @throws Exception
     */
    private Contact saveEntity() throws Exception {
        Contact originalContact = null;
        if (contact.getId() == null) {
            UserUtil.permissionCheck("create_contact");
        } else {
            UserUtil.permissionCheck("update_contact");
            originalContact = baseService.getEntityById(Contact.class,
                    contact.getId());
            contact.setAttachment(originalContact.getAttachment());
            contact.setOpportunities(originalContact.getOpportunities());
            contact.setCalls(originalContact.getCalls());
            contact.setCases(originalContact.getCases());
            contact.setDocuments(originalContact.getDocuments());
            contact.setMeetings(originalContact.getMeetings());
            contact.setLeads(originalContact.getLeads());
            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);

        Contact reportTo = null;
        if (reportToID != null) {
            reportTo = baseService.getEntityById(Contact.class, reportToID);
        }
        contact.setReport_to(reportTo);

View Full Code Here

     *
     * @return the SUCCESS result
     */
    public String select() throws ServiceException {
        Document document = null;
        Contact contact = null;
        Set<CaseInstance> cases = null;
        if ("Document".equals(this.getRelationKey())) {
            document = documentService.getEntityById(Document.class,
                    Integer.valueOf(this.getRelationValue()));
            cases = document.getCases();
        } else if ("Contact".equals(this.getRelationKey())) {
            contact = contactService.getEntityById(Contact.class,
                    Integer.valueOf(this.getRelationValue()));
            cases = contact.getCases();
        }

        if (this.getSeleteIDs() != null) {
            String[] ids = seleteIDs.split(",");
            for (int i = 0; i < ids.length; i++) {
View Full Code Here

     *
     * @return the SUCCESS result
     */
    public String unselect() throws ServiceException {
        Document document = null;
        Contact contact = null;
        Set<CaseInstance> cases = null;
        if ("Document".equals(this.getRelationKey())) {
            document = documentService.getEntityById(Document.class,
                    Integer.valueOf(this.getRelationValue()));
            cases = document.getCases();
        } else if ("Contact".equals(this.getRelationKey())) {
            contact = contactService.getEntityById(Contact.class,
                    Integer.valueOf(this.getRelationValue()));
            cases = contact.getCases();
        }

        if (this.getSeleteIDs() != null) {
            String[] ids = seleteIDs.split(",");
            Collection<CaseInstance> selectedCases = new ArrayList<CaseInstance>();
View Full Code Here

            if (accounts == null) {
                accounts = new HashSet<Account>();
            }
            accounts.add(account);
        } else if ("Contact".equals(this.getRelationKey())) {
            Contact contact = contactService.getEntityById(Contact.class,
                    Integer.valueOf(this.getRelationValue()));
            Set<Contact> contacts = document.getContacts();
            if (contacts == null) {
                contacts = new HashSet<Contact>();
            }
View Full Code Here

     *
     * @return the SUCCESS result
     */
    public String select() throws ServiceException {
        Account account = null;
        Contact contact = null;
        Opportunity opportunity = null;
        CaseInstance caseInstance = null;
        Document document = null;
        Set<Document> documents = null;
        if ("Account".equals(this.getRelationKey())) {
            account = accountService.getEntityById(Account.class,
                    Integer.valueOf(this.getRelationValue()));
            documents = account.getDocuments();
        } else if ("Contact".equals(this.getRelationKey())) {
            contact = contactService.getEntityById(Contact.class,
                    Integer.valueOf(this.getRelationValue()));
            documents = contact.getDocuments();
        } else if ("Opportunity".equals(this.getRelationKey())) {
            opportunity = opportunityService.getEntityById(Opportunity.class,
                    Integer.valueOf(this.getRelationValue()));
            documents = opportunity.getDocuments();
        } else if ("CaseInstance".equals(this.getRelationKey())) {
View Full Code Here

     *
     * @return the SUCCESS result
     */
    public String unselect() throws ServiceException {
        Account account = null;
        Contact contact = null;
        Opportunity opportunity = null;
        CaseInstance caseInstance = null;
        Set<Document> documents = null;
        if ("Account".equals(this.getRelationKey())) {
            account = accountService.getEntityById(Account.class,
                    Integer.valueOf(this.getRelationValue()));
            documents = account.getDocuments();
        } else if ("Contact".equals(this.getRelationKey())) {
            contact = contactService.getEntityById(Contact.class,
                    Integer.valueOf(this.getRelationValue()));
            documents = contact.getDocuments();
        } else if ("Opportunity".equals(this.getRelationKey())) {
            opportunity = opportunityService.getEntityById(Opportunity.class,
                    Integer.valueOf(this.getRelationValue()));
            documents = opportunity.getDocuments();
        } else if ("CaseInstance".equals(this.getRelationKey())) {
View Full Code Here

                Map<String, String> row = new HashMap<String, String>();
                for (int i = 0; i < line.size(); i++) {
                    row.put(header[i], line.get(i));
                }

                Contact contact = new Contact();
                try {
                    String id = row.get(getText("entity.id.label"));
                    if (!CommonUtil.isNullOrEmpty(id)) {
                        contact.setId(Integer.parseInt(id));
                        UserUtil.permissionCheck("update_contact");
                    } else {
                        UserUtil.permissionCheck("create_contact");
                    }
                    String salutationID = row
                            .get(getText("entity.salutation_id.label"));
                    if (CommonUtil.isNullOrEmpty(salutationID)) {
                        contact.setSalutation(null);
                    } else {
                        Salutation salutation = salutationService
                                .getEntityById(Salutation.class,
                                        Integer.parseInt(salutationID));
                        contact.setSalutation(salutation);
                    }
                    contact.setFirst_name(CommonUtil.fromNullToEmpty(row
                            .get(getText("entity.first_name.label"))));
                    contact.setLast_name(CommonUtil.fromNullToEmpty(row
                            .get(getText("entity.last_name.label"))));
                    contact.setEmail(CommonUtil.fromNullToEmpty(row
                            .get(getText("entity.email.label"))));
                    contact.setOffice_phone(CommonUtil.fromNullToEmpty(row
                            .get(getText("entity.office_phone.label"))));
                    contact.setTitle(CommonUtil.fromNullToEmpty(row
                            .get(getText("entity.title.label"))));
                    contact.setMobile(CommonUtil.fromNullToEmpty(row
                            .get(getText("entity.mobile.label"))));
                    contact.setSkype_id(CommonUtil.fromNullToEmpty(row
                            .get(getText("contact.skype_id.label"))));
                    contact.setDepartment(CommonUtil.fromNullToEmpty(row
                            .get(getText("entity.department.label"))));
                    contact.setFax(CommonUtil.fromNullToEmpty(row
                            .get(getText("entity.fax.label"))));
                    String accountID = row
                            .get(getText("entity.account_id.label"));
                    if (CommonUtil.isNullOrEmpty(accountID)) {
                        contact.setAccount(null);
                    } else {
                        Account account = accountService.getEntityById(
                                Account.class, Integer.parseInt(accountID));
                        contact.setAccount(account);
                    }
                    contact.setWebsite(CommonUtil.fromNullToEmpty(row
                            .get(getText("entity.website.label"))));
                    contact.setPrimary_street(CommonUtil.fromNullToEmpty(row
                            .get(getText("entity.primary_street.label"))));
                    contact.setPrimary_city(CommonUtil.fromNullToEmpty(row
                            .get(getText("entity.primary_city.label"))));
                    contact.setPrimary_state(CommonUtil.fromNullToEmpty(row
                            .get(getText("entity.primary_state.label"))));
                    contact.setPrimary_postal_code(CommonUtil.fromNullToEmpty(row
                            .get(getText("entity.primary_postal_code.label"))));
                    contact.setPrimary_country(CommonUtil.fromNullToEmpty(row
                            .get(getText("entity.primary_country.label"))));
                    contact.setOther_street(CommonUtil.fromNullToEmpty(row
                            .get(getText("entity.other_street.label"))));
                    contact.setOther_city(CommonUtil.fromNullToEmpty(row
                            .get(getText("entity.other_city.label"))));
                    contact.setOther_state(CommonUtil.fromNullToEmpty(row
                            .get(getText("entity.other_state.label"))));
                    contact.setOther_postal_code(CommonUtil.fromNullToEmpty(row
                            .get(getText("entity.other_postal_code.label"))));
                    contact.setOther_country(CommonUtil.fromNullToEmpty(row
                            .get(getText("entity.other_country.label"))));
                    contact.setOrigo(CommonUtil.fromNullToEmpty(row
                            .get(getText("entity.origo.label"))));
                    String height = row.get(getText("entity.height.label"));
                    if (CommonUtil.isNullOrEmpty(height)) {
                        contact.setHeight(0);
                    } else {
                        contact.setHeight(Double.parseDouble(height));
                    }
                    String weight = row.get(getText("entity.weight.label"));
                    if (CommonUtil.isNullOrEmpty(weight)) {
                        contact.setWeight(0);
                    } else {
                        contact.setWeight(Double.parseDouble(weight));
                    }
                    contact.setRelationship(CommonUtil.fromNullToEmpty(row
                            .get(getText("entity.relationship.label"))));
                    contact.setCharacter(CommonUtil.fromNullToEmpty(row
                            .get(getText("entity.character.label"))));
                    contact.setInterest(CommonUtil.fromNullToEmpty(row
                            .get(getText("entity.interest.label"))));
                    contact.setTaboo(CommonUtil.fromNullToEmpty(row
                            .get(getText("entity.taboo.label"))));
                    String religiousID = row
                            .get(getText("entity.religious_id.label"));
                    if (CommonUtil.isNullOrEmpty(religiousID)) {
                        contact.setReligious(null);
                    } else {
                        Religious religious = religiousService.getEntityById(
                                Religious.class, Integer.parseInt(religiousID));
                        contact.setReligious(religious);
                    }
                    contact.setHabit(CommonUtil.fromNullToEmpty(row
                            .get(getText("entity.habit.label"))));
                    contact.setDiet(CommonUtil.fromNullToEmpty(row
                            .get(getText("entity.diet.label"))));
                    contact.setNotes(CommonUtil.fromNullToEmpty(row
                            .get(getText("entity.notes.label"))));
                    String reportToID = row
                            .get(getText("contact.report_to_id.label"));
                    if (CommonUtil.isNullOrEmpty(reportToID)) {
                        contact.setReport_to(null);
                    } else {
                        Contact reportTo = baseService.getEntityById(
                                Contact.class, Integer.parseInt(reportToID));
                        contact.setReport_to(reportTo);
                    }
                    String doNotCall = row
                            .get(getText("entity.not_call.label"));
View Full Code Here

            if (meetings == null) {
                meetings = new HashSet<Meeting>();
            }
            meetings.add(meeting);
        } else if ("Contact".equals(this.getRelationKey())) {
            Contact contact = contactService.getEntityById(Contact.class,
                    Integer.valueOf(this.getRelationValue()));
            Set<Contact> contacts = lead.getContacts();
            if (contacts == null) {
                contacts = new HashSet<Contact>();
            }
View Full Code Here

                .append(getJsonHeader(totalRecords, searchCondition, isList));

        String assignedTo = null;
        String accountName = null;
        while (contacts.hasNext()) {
            Contact instance = contacts.next();
            int id = instance.getId();
            String firstName = instance.getFirst_name();
            String lastName = instance.getLast_name();
            String name = instance.getName();
            String title = CommonUtil.fromNullToEmpty(instance.getTitle());

            Account account = instance.getAccount();
            if (account != null) {
                accountName = CommonUtil.fromNullToEmpty(account.getName());
            } else {
                accountName = "";
            }
            String email = CommonUtil.fromNullToEmpty(instance.getEmail());
            String officePhone = CommonUtil.fromNullToEmpty(instance
                    .getOffice_phone());
            User user = instance.getAssigned_to();
            if (user != null) {
                assignedTo = CommonUtil.fromNullToEmpty(user.getName());
            } else {
                assignedTo = "";
            }
            if (isList) {
                User createdBy = instance.getCreated_by();
                String createdByName = "";
                if (createdBy != null) {
                    createdByName = CommonUtil.fromNullToEmpty(createdBy
                            .getName());
                }
                User updatedBy = instance.getUpdated_by();
                String updatedByName = "";
                if (updatedBy != null) {
                    updatedByName = CommonUtil.fromNullToEmpty(updatedBy
                            .getName());
                }
                SimpleDateFormat dateFormat = new SimpleDateFormat(
                        Constant.DATE_TIME_FORMAT);
                Date createdOn = instance.getCreated_on();
                String createdOnName = "";
                if (createdOn != null) {
                    createdOnName = dateFormat.format(createdOn);
                }
                Date updatedOn = instance.getUpdated_on();
                String updatedOnName = "";
                if (updatedOn != null) {
                    updatedOnName = dateFormat.format(updatedOn);
                }
View Full Code Here

TOP

Related Classes of com.gcrm.domain.Contact

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.