Project

General

Profile

« Previous | Next » 

Revision 4a8227d3

Added by Katja Luther about 5 years ago

ref #4545: add getUuidAndAbbrevTitleCache with class parameter

View differences:

cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dao/agent/IAgentDao.java
107 107
	public List<UuidAndTitleCache<Institution>> getInstitutionUuidAndTitleCache(Integer limit, String pattern);
108 108

  
109 109
    /**
110
     * @param clazz
110 111
     * @param limit
111 112
     * @param pattern
112 113
     * @return
113 114
     */
114
    List<UuidAndTitleCache<AgentBase>> getUuidAndAbbrevTitleCache(Integer limit, String pattern, Class clazz);
115
    List<UuidAndTitleCache<AgentBase>> getUuidAndAbbrevTitleCache(Class clazz, Integer limit, String pattern);
115 116
}
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dao/hibernate/agent/AgentDaoImpl.java
28 28
import eu.etaxonomy.cdm.model.agent.InstitutionalMembership;
29 29
import eu.etaxonomy.cdm.model.agent.Person;
30 30
import eu.etaxonomy.cdm.model.agent.Team;
31
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
31 32
import eu.etaxonomy.cdm.model.view.AuditEvent;
32 33
import eu.etaxonomy.cdm.persistence.dao.agent.IAgentDao;
33 34
import eu.etaxonomy.cdm.persistence.dao.hibernate.common.IdentifiableDaoBase;
......
170 171

  
171 172

  
172 173
	@Override
173
    public List<UuidAndTitleCache<AgentBase>> getUuidAndAbbrevTitleCache(Integer limit, String pattern, Class clazz){
174
    public List<UuidAndTitleCache<AgentBase>> getUuidAndAbbrevTitleCache(Class clazz, Integer limit, String pattern){
174 175
        Session session = getSession();
175 176
        String clazzString = "";
176 177
        if (clazz == null){
......
181 182
            clazzString = "dtype = 'Person'";
182 183
        }  else if (clazz.equals(Institution.class)){
183 184
            clazzString = "dtype = 'Institution'";
185
        } else if (clazz.equals(TeamOrPersonBase.class)){
186
            clazzString = "dtype != 'Institution'";
184 187
        }
185 188

  
186 189
        Query query = null;
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/DescriptionServiceImpl.java
717 717
        }
718 718

  
719 719

  
720

  
721 720
        if (! isCopy && descriptionElements == descriptionElements.iterator().next().getInDescription().getElements()){
722 721
            //if the descriptionElements collection is the elements set of a description, put it in a separate set before to avoid concurrent modification exceptions
723 722
            descriptionElements = new HashSet<DescriptionElementBase>(descriptionElements);
......
726 725
        }
727 726
        for (DescriptionElementBase element : descriptionElements){
728 727
            DescriptionBase<?> description = element.getInDescription();
728
            description = dao.load(description.getUuid());
729 729
            try {
730 730
                DescriptionElementBase newElement = (DescriptionElementBase)element.clone();
731 731
                targetDescription.addElement(newElement);
......
743 743
                   }
744 744
                    dao.delete(description);
745 745

  
746
                }else{
747
                    dao.saveOrUpdate(description);
748
                    result.addUpdatedObject(description);
749
                }
746
                }//else{
747
//                    dao.saveOrUpdate(description);
748
//                    result.addUpdatedObject(description);
749
//                }
750 750
            }
751 751

  
752 752

  

Also available in: Unified diff