Package com.gcrm.domain

Examples of com.gcrm.domain.CaseInstance


            if (documents == null) {
                documents = new HashSet<Document>();
            }
            documents.add(document);
        } else if ("CaseInstance".equals(this.getRelationKey())) {
            CaseInstance caseInstance = caseService.getEntityById(
                    CaseInstance.class,
                    Integer.valueOf(this.getRelationValue()));
            Set<CaseInstance> cases = contact.getCases();
            if (cases == null) {
                cases = new HashSet<CaseInstance>();
View Full Code Here


        String assignedTo = null;
        String accountName = null;
        String priorityName = null;
        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);
            CaseStatus caseStatus = instance.getStatus();
            statusName = CommonUtil.getOptionLabel(caseStatus);
            User user = instance.getAssigned_to();
            if (user != null) {
                assignedTo = 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

        UserUtil.permissionCheck("create_case");
        if (this.getSeleteIDs() != null) {
            String[] ids = seleteIDs.split(",");
            for (int i = 0; i < ids.length; i++) {
                String copyid = ids[i];
                CaseInstance oriRecord = baseService.getEntityById(
                        CaseInstance.class, Integer.valueOf(copyid));
                CaseInstance 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];
                    CaseInstance caseInstance = baseService.getEntityById(
                            CaseInstance.class, Integer.parseInt(id));
                    final HashMap<String, ? super Object> data1 = new HashMap<String, Object>();
                    data1.put(header[0], caseInstance.getId());
                    CasePriority casePriority = caseInstance.getPriority();
                    if (casePriority != null) {
                        data1.put(header[1], casePriority.getId());
                    } else {
                        data1.put(header[1], "");
                    }
                    data1.put(header[2],
                            CommonUtil.getOptionLabel(casePriority));
                    CaseStatus caseStatus = caseInstance.getStatus();
                    if (caseStatus != null) {
                        data1.put(header[3], caseStatus.getId());
                    } else {
                        data1.put(header[3], "");
                    }
                    data1.put(header[4], CommonUtil.getOptionLabel(caseStatus));
                    CaseType caseType = caseInstance.getType();
                    if (caseType != null) {
                        data1.put(header[5], caseType.getId());
                    } else {
                        data1.put(header[5], "");
                    }
                    data1.put(header[6], CommonUtil.getOptionLabel(caseType));
                    CaseOrigin caseOrigin = caseInstance.getOrigin();
                    if (caseOrigin != null) {
                        data1.put(header[7], caseOrigin.getId());
                    } else {
                        data1.put(header[7], "");
                    }
                    data1.put(header[8], CommonUtil.getOptionLabel(caseOrigin));
                    CaseReason caseReason = caseInstance.getReason();
                    if (caseReason != null) {
                        data1.put(header[9], caseReason.getId());
                    } else {
                        data1.put(header[9], "");
                    }
                    data1.put(header[10], CommonUtil.getOptionLabel(caseReason));
                    data1.put(header[11], CommonUtil
                            .fromNullToEmpty(caseInstance.getSubject()));
                    data1.put(header[12],
                            CommonUtil.fromNullToEmpty(caseInstance.getNotes()));
                    data1.put(header[13], CommonUtil
                            .fromNullToEmpty(caseInstance.getResolution()));
                    if (caseInstance.getAssigned_to() != null) {
                        data1.put(header[14], caseInstance.getAssigned_to()
                                .getId());
                        data1.put(header[15], caseInstance.getAssigned_to()
                                .getName());
                    } else {
                        data1.put(header[14], "");
                        data1.put(header[15], "");
                    }
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));
                }
                CaseInstance caseInstance = new CaseInstance();
                try {
                    String id = row.get(getText("entity.id.label"));
                    if (!CommonUtil.isNullOrEmpty(id)) {
                        caseInstance.setId(Integer.parseInt(id));
                        UserUtil.permissionCheck("update_case");
                    } else {
                        UserUtil.permissionCheck("create_case");
                    }
                    String priorityID = row
                            .get(getText("entity.priority_id.label"));
                    if (CommonUtil.isNullOrEmpty(priorityID)) {
                        caseInstance.setPriority(null);
                    } else {
                        CasePriority priority = casePriorityService
                                .getEntityById(CasePriority.class,
                                        Integer.parseInt(priorityID));
                        caseInstance.setPriority(priority);
                    }
                    String statusID = row
                            .get(getText("entity.status_id.label"));
                    if (CommonUtil.isNullOrEmpty(statusID)) {
                        caseInstance.setStatus(null);
                    } else {
                        CaseStatus status = caseStatusService.getEntityById(
                                CaseStatus.class, Integer.parseInt(statusID));
                        caseInstance.setStatus(status);
                    }
                    String typeID = row.get(getText("case.type_id.label"));
                    if (CommonUtil.isNullOrEmpty(typeID)) {
                        caseInstance.setType(null);
                    } else {
                        CaseType type = caseTypeService.getEntityById(
                                CaseType.class, Integer.parseInt(typeID));
                        caseInstance.setType(type);
                    }
                    String originID = row.get(getText("case.origin_id.label"));
                    if (CommonUtil.isNullOrEmpty(originID)) {
                        caseInstance.setOrigin(null);
                    } else {
                        CaseOrigin origin = caseOriginService.getEntityById(
                                CaseOrigin.class, Integer.parseInt(originID));
                        caseInstance.setOrigin(origin);
                    }
                    String reasonID = row.get(getText("case.reason_id.label"));
                    if (CommonUtil.isNullOrEmpty(reasonID)) {
                        caseInstance.setReason(null);
                    } else {
                        CaseReason reason = caseReasonService.getEntityById(
                                CaseReason.class, Integer.parseInt(reasonID));
                        caseInstance.setReason(reason);
                    }
                    caseInstance.setSubject(CommonUtil.fromNullToEmpty(row
                            .get(getText("entity.subject.label"))));
                    caseInstance.setNotes(CommonUtil.fromNullToEmpty(row
                            .get(getText("entity.notes.label"))));
                    caseInstance.setResolution(CommonUtil.fromNullToEmpty(row
                            .get(getText("case.resolution.label"))));
                    String assignedToID = row
                            .get(getText("entity.assigned_to_id.label"));
                    if (CommonUtil.isNullOrEmpty(assignedToID)) {
                        caseInstance.setAssigned_to(null);
                    } else {
                        User assignedTo = userService.getEntityById(User.class,
                                Integer.parseInt(assignedToID));
                        caseInstance.setAssigned_to(assignedTo);
                    }
                    baseService.makePersistent(caseInstance);
                    successfulNum++;
                } catch (Exception e) {
                    failedNum++;
                    failedMsg.put(String.valueOf(caseInstance.getSubject()),
                            e.getMessage());
                }

            }
View Full Code Here

     * Saves the entity.
     *
     * @return the SUCCESS result
     */
    public String save() throws Exception {
        CaseInstance originalCase = saveEntity();
        final Collection<ChangeLog> changeLogs = changeLog(originalCase,
                caseInstance);
        caseInstance = getBaseService().makePersistent(caseInstance);
        this.setId(caseInstance.getId());
        this.setSaveFlag("true");
View Full Code Here

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

     *
     * @return original caseInstance record
     * @throws Exception
     */
    private CaseInstance saveEntity() throws Exception {
        CaseInstance originalCase = null;
        if (caseInstance.getId() == null) {
            UserUtil.permissionCheck("create_case");
        } else {
            UserUtil.permissionCheck("update_case");
            originalCase = baseService.getEntityById(CaseInstance.class,
                    caseInstance.getId());
            caseInstance.setContacts(originalCase.getContacts());
            caseInstance.setDocuments(originalCase.getDocuments());
            caseInstance.setCreated_on(originalCase.getCreated_on());
            caseInstance.setCreated_by(originalCase.getCreated_by());
        }

        CaseStatus status = null;
        if (statusID != null) {
            status = caseStatusService
View Full Code Here

            if (opportunities == null) {
                opportunities = new HashSet<Opportunity>();
            }
            opportunities.add(opportunity);
        } else if ("CaseInstance".equals(this.getRelationKey())) {
            CaseInstance caseInstance = caseService.getEntityById(
                    CaseInstance.class,
                    Integer.valueOf(this.getRelationValue()));
            Set<CaseInstance> cases = document.getCases();
            if (cases == null) {
                cases = new HashSet<CaseInstance>();
View Full Code Here

     */
    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())) {
            caseInstance = caseService.getEntityById(CaseInstance.class,
                    Integer.valueOf(this.getRelationValue()));
            documents = caseInstance.getDocuments();
        }

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

TOP

Related Classes of com.gcrm.domain.CaseInstance

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.