Package com.gcrm.domain

Examples of com.gcrm.domain.Document


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


            createChangeLog(changeLogs, entityName, recordID,
                    "document.sub_category.label", oldSubCategory,
                    newSubCategory, loginUser);

            String oldRelatedDocumentName = "";
            Document oldRelatedDocument = originalDocument
                    .getRelated_document();
            if (oldRelatedDocument != null) {
                oldRelatedDocumentName = CommonUtil
                        .fromNullToEmpty(oldRelatedDocument.getName());
            }
            String newRelatedDocumentName = "";
            Document newRelatedDocument = document.getRelated_document();
            if (newRelatedDocument != null) {
                newRelatedDocumentName = CommonUtil
                        .fromNullToEmpty(newRelatedDocument.getName());
            }
            createChangeLog(changeLogs, entityName, recordID,
                    "document.related_document.label", oldRelatedDocumentName,
                    newRelatedDocumentName, loginUser);
View Full Code Here

            User assignedTo = document.getAssigned_to();
            if (assignedTo != null) {
                this.setAssignedToID(assignedTo.getId());
                this.setAssignedToText(assignedTo.getName());
            }
            Document relatedDocument = document.getRelated_document();
            if (relatedDocument != null) {
                relatedDocumentID = relatedDocument.getId();
                relatedDocumentText = relatedDocument.getName();
            }
            Date publishDate = document.getPublish_date();
            SimpleDateFormat dateFormat = new SimpleDateFormat(
                    Constant.DATE_EDIT_FORMAT);
            if (publishDate != null) {
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);
                Document documentInstance = this.baseService.getEntityById(
                        Document.class, id);
                Document originalDocument = documentInstance.clone();
                for (String fieldName : fieldNames) {
                    Object value = BeanUtil.getFieldValue(document, fieldName);
                    BeanUtil.setFieldValue(documentInstance, fieldName, value);
                }
                documentInstance.setUpdated_by(user);
View Full Code Here

     *
     * @return original document record
     * @throws ParseException
     */
    private Document saveEntity() throws Exception {
        Document originalDocument = null;
        if (document.getId() == null) {
            UserUtil.permissionCheck("create_document");
        } else {
            UserUtil.permissionCheck("update_document");
            originalDocument = baseService.getEntityById(Document.class,
                    document.getId());
            document.setAttachment(originalDocument.getAttachment());
            document.setContacts(originalDocument.getContacts());
            document.setCases(originalDocument.getCases());
            document.setAccounts(originalDocument.getAccounts());
            document.setOpportunities(originalDocument.getOpportunities());
            document.setCreated_on(originalDocument.getCreated_on());
            document.setCreated_by(originalDocument.getCreated_by());
        }

        DocumentStatus status = null;
        if (statusID != null) {
            status = documentStatusService.getEntityById(DocumentStatus.class,
                    statusID);
        }
        document.setStatus(status);

        DocumentCategory category = null;
        if (categoryID != null) {
            category = documentCategoryService.getEntityById(
                    DocumentCategory.class, categoryID);
        }
        document.setCategory(category);

        DocumentSubCategory subCategory = null;
        if (subCategoryID != null) {
            subCategory = documentSubCategoryService.getEntityById(
                    DocumentSubCategory.class, subCategoryID);
        }
        document.setSub_category(subCategory);
        User assignedTo = null;
        if (this.getAssignedToID() != null) {
            assignedTo = userService.getEntityById(User.class,
                    this.getAssignedToID());
        }
        document.setAssigned_to(assignedTo);
        User owner = null;
        if (this.getOwnerID() != null) {
            owner = userService.getEntityById(User.class, this.getOwnerID());
        }
        document.setOwner(owner);
        Document relatedDocument = null;
        if (relatedDocumentID != null) {
            relatedDocument = baseService.getEntityById(Document.class,
                    relatedDocumentID);
        }
        document.setRelated_document(relatedDocument);
View Full Code Here

     *
     */
    public InputStream getInputStream() throws Exception {
        byte[] fileBytes = null;
        if (this.getId() != null) {
            Document document = baseService.getEntityById(Document.class,
                    this.getId());
            Attachment attachment = document.getAttachment();
            if (attachment != null) {
                fileBytes = attachment.getContent();
            }
        }
        InputStream in = new ByteArrayInputStream(fileBytes);
View Full Code Here

        String assignedTo = null;
        String publishDateS = null;
        String categoryName = null;
        while (documents.hasNext()) {
            Document instance = documents.next();
            int id = instance.getId();
            String name = instance.getName();
            Date publishDate = instance.getPublish_date();
            if (publishDate != null) {
                publishDateS = publishDate.toString();
            } else {
                publishDateS = "";
            }
            DocumentCategory category = instance.getCategory();
            categoryName = CommonUtil.getOptionLabel(category);
            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

    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();
View Full Code Here

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

    public String select() throws ServiceException {
        Opportunity opportunity = null;
        TargetList targetList = null;
        Call call = null;
        Meeting meeting = null;
        Document document = null;
        CaseInstance caseInstance = null;
        Set<Contact> contacts = null;

        if ("Opportunity".equals(this.getRelationKey())) {
            opportunity = opportunityService.getEntityById(Opportunity.class,
                    Integer.valueOf(this.getRelationValue()));
            contacts = opportunity.getContacts();
        } else if ("TargetList".equals(this.getRelationKey())) {
            targetList = targetListService.getEntityById(TargetList.class,
                    Integer.valueOf(this.getRelationValue()));
            contacts = targetList.getContacts();
        } else if ("Call".equals(this.getRelationKey())) {
            call = callService.getEntityById(Call.class,
                    Integer.valueOf(this.getRelationValue()));
            contacts = call.getContacts();
        } else if ("Meeting".equals(this.getRelationKey())) {
            meeting = meetingService.getEntityById(Meeting.class,
                    Integer.valueOf(this.getRelationValue()));
            contacts = meeting.getContacts();
        } else if ("Document".equals(this.getRelationKey())) {
            document = documentService.getEntityById(Document.class,
                    Integer.valueOf(this.getRelationValue()));
            contacts = document.getContacts();
        } else if ("CaseInstance".equals(this.getRelationKey())) {
            caseInstance = caseService.getEntityById(CaseInstance.class,
                    Integer.valueOf(this.getRelationValue()));
            contacts = caseInstance.getContacts();
        }
View Full Code Here

TOP

Related Classes of com.gcrm.domain.Document

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.