Project

General

Profile

« Previous | Next » 

Revision 90f0f337

Added by Katja Luther about 3 years ago

fix #9506: the rights were filtered by text, this fixed now

View differences:

cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dao/hibernate/common/RightsDaoImpl.java
46 46
        List<UuidAndTitleCache<Rights>> list = new ArrayList<UuidAndTitleCache<Rights>>();
47 47
        Session session = getSession();
48 48

  
49
        String queryString = "SELECT " +"r.uuid, r.id, r.text, agent.titleCache FROM " + type.getSimpleName() + " AS r LEFT OUTER JOIN r.agent AS agent ";
49
        String queryString = "SELECT " +"r.uuid, r.id, r.text, agent.titleCache, type.titleCache FROM " + type.getSimpleName() + " AS r LEFT OUTER JOIN r.agent AS agent LEFT OUTER JOIN r.type as type";
50 50

  
51 51
        if (pattern != null){
52 52
            queryString += " WHERE ";
53 53
            queryString += " r.text LIKE :pattern";
54 54
            queryString += " OR agent.titleCache LIKE :pattern";
55
//            queryString += " OR type.titleCache LIKE :pattern";
55 56
        }
56 57

  
57 58

  
......
79 80
        for(Object[] object : result){
80 81
            String rightsText = (String) object[2];
81 82

  
82
            if(rightsText != null){
83
                String agentTitle = (String) object[3];
84
                rightsText = rightsText + " - " + agentTitle;
85

  
86
                list.add(new UuidAndTitleCache<Rights>(Rights.class, (UUID) object[0],(Integer)object[1], rightsText));
87
            }else{
88
                logger.error("text of rights is null. UUID: " + object[0]);
83
            if(rightsText == null){
84
                rightsText = "no text";
89 85
            }
86
            String agentTitle = (String) object[3];
87

  
88
            String typeLabel = (String) object[4];
89
            rightsText = rightsText + " - " + agentTitle + " - " + typeLabel;
90

  
91
            list.add(new UuidAndTitleCache<Rights>(Rights.class, (UUID) object[0],(Integer)object[1], rightsText));
92

  
90 93
        }
91 94

  
92 95
        return list;

Also available in: Unified diff