Examples of PartyEntity


Examples of com.mossle.party.domain.PartyEntity

        return userIds;
    }

    public PartyEntity findUpperDepartment(PartyEntity child) {
        for (PartyStruct partyStruct : child.getParentStructs()) {
            PartyEntity parent = partyStruct.getParentEntity();

            if (parent == null) {
                continue;
            }

            if (parent.getPartyType().getType() == TYPE_ORG) {
                return parent;
            } else {
                return this.findUpperDepartment(parent);
            }
        }
View Full Code Here

Examples of com.mossle.party.domain.PartyEntity

    @RequestMapping("party-entity-input")
    public String input(@RequestParam(value = "id", required = false) Long id,
            Model model) {
        if (id != null) {
            PartyEntity partyEntity = partyEntityManager.get(id);
            model.addAttribute("model", partyEntity);
        }

        List<PartyType> partyTypes = partyTypeManager.getAll();
        model.addAttribute("partyTypes", partyTypes);
View Full Code Here

Examples of com.mossle.party.domain.PartyEntity

    @RequestMapping("party-entity-save")
    public String save(@ModelAttribute PartyEntity partyEntity,
            @RequestParam("partyTypeId") Long partyTypeId,
            RedirectAttributes redirectAttributes) {
        PartyEntity dest = null;
        Long id = partyEntity.getId();

        if (id != null) {
            dest = partyEntityManager.get(id);
            beanMapper.copy(partyEntity, dest);
        } else {
            dest = partyEntity;
        }

        dest.setPartyType(partyTypeManager.get(partyTypeId));
        partyEntityManager.save(dest);

        messageHelper.addFlashMessage(redirectAttributes, "core.success.save",
                "保存成功");
View Full Code Here

Examples of com.mossle.party.domain.PartyEntity

    public String list(
            Model model,
            @RequestParam(value = "partyStructTypeId", required = false) Long partyStructTypeId,
            @RequestParam(value = "partyEntityId", required = false) Long partyEntityId,
            @ModelAttribute Page page) {
        PartyEntity partyEntity = this.init(model, partyStructTypeId,
                partyEntityId);

        // 返回所有下级,包含组织,岗位,人员
        String hql = "from PartyStruct where parentEntity=?";
        // 如果没有选中partyEntityId,就啥也不显示
        page = partyStructTypeManager.pagedQuery(hql, page.getPageNo(),
                page.getPageSize(), partyEntity);
        model.addAttribute("page", page);

        // 判断这个组织下可以创建哪些下级
        // TODO: 应该判断维度
        List<PartyType> childTypes = partyTypeManager
                .find("select childType from PartyType childType join childType.parentStructRules parentStructRule where parentStructRule.parentType=?",
                        partyEntity.getPartyType());
        model.addAttribute("childTypes", childTypes);

        return "party/org-list";
    }
View Full Code Here

Examples of com.mossle.party.domain.PartyEntity

            Model model,
            @RequestParam(value = "partyStructTypeId", required = false) Long partyStructTypeId,
            @RequestParam(value = "partyTypeId", required = false) Long partyTypeId,
            @RequestParam(value = "partyEntityId", required = false) Long partyEntityId)
            throws Exception {
        PartyEntity partyEntity = init(model, partyStructTypeId, partyEntityId);
        PartyType partyType = partyTypeManager.get(partyTypeId);

        model.addAttribute("partyEntity", partyEntity);
        model.addAttribute("partyType", partyType);
View Full Code Here

Examples of com.mossle.party.domain.PartyEntity

            throws Exception {
        PartyType partyType = partyTypeManager.get(partyTypeId);

        if (partyType.getType() == 1) {
            // 人员
            PartyEntity child = partyEntityManager.findUnique(
                    "from PartyEntity where partyType=? and ref=?", partyType,
                    childEntityRef);
            logger.debug("child : {}", child);

            PartyEntity parent = partyEntityManager.get(partyEntityId);

            PartyStruct dest = new PartyStruct();
            beanMapper.copy(partyStruct, dest);
            dest.setPartyStructType(partyStructTypeManager
                    .get(partyStructTypeId));
            dest.setParentEntity(parent);
            dest.setChildEntity(child);
            partyStructManager.save(dest);
        } else {
            // 组织
            PartyEntity child = null;

            if (childEntityId == null) {
                child = new PartyEntity();
                child.setName(childEntityName);
                child.setPartyType(partyType);
                partyEntityManager.save(child);
            } else {
                child = partyEntityManager.get(childEntityId);
            }

            logger.debug("child : {}", child);

            PartyEntity parent = partyEntityManager.get(partyEntityId);

            PartyStruct dest = new PartyStruct();
            beanMapper.copy(partyStruct, dest);
            dest.setPartyStructType(partyStructTypeManager
                    .get(partyStructTypeId));
View Full Code Here

Examples of com.mossle.party.domain.PartyEntity

    /**
     * 同步更新PartyEntity,比如company,department,group,position,user里改了什么信息,就同步修改PartyEntity里的信息.
     */
    public void insertPartyEntity(String partyEntityRef, String partyTypeRef,
            String name) {
        PartyEntity partyEntity = new PartyEntity();
        partyEntity.setRef(partyEntityRef);
        partyEntity.setName(name);

        PartyType partyType = partyTypeManager
                .findUniqueBy("ref", partyTypeRef);
        partyEntity.setPartyType(partyType);
        partyEntityManager.save(partyEntity);
    }
View Full Code Here

Examples of com.mossle.party.domain.PartyEntity

    public void updatePartyEntity(String partyEntityRef, String partyTypeRef,
            String name) {
        PartyType partyType = partyTypeManager
                .findUniqueBy("ref", partyTypeRef);
        PartyEntity partyEntity = partyEntityManager.findUnique(
                "from PartyEntity where ref=? and partyType.id=?",
                partyEntityRef, partyType.getId());
        partyEntity.setName(name);
        partyEntityManager.save(partyEntity);
    }
View Full Code Here

Examples of com.mossle.party.domain.PartyEntity

    }

    public void removePartyEntity(String partyEntityRef, String partyTypeRef) {
        PartyType partyType = partyTypeManager
                .findUniqueBy("ref", partyTypeRef);
        PartyEntity partyEntity = partyEntityManager.findUnique(
                "from PartyEntity where ref=? and partyType.id=?",
                partyEntityRef, partyType.getId());
        partyEntityManager.remove(partyEntity);
    }
View Full Code Here

Examples of com.mossle.party.domain.PartyEntity

    public String getDefaultRootPartyEntityRef() {
        Long defaultPartyStructTypeId = getDefaultPartyStructTypeId();
        String hql = "select distinct o from PartyEntity o left join o.parentStructs p with p.partyStructType.id=? "
                + "join o.childStructs c where p is null and c.partyStructType.id=?";
        PartyEntity partyEntity = partyEntityManager.findUnique(hql,
                defaultPartyStructTypeId, defaultPartyStructTypeId);

        return partyEntity.getRef();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.