List of usage examples for org.hibernate.criterion Restrictions disjunction
public static Disjunction disjunction()
From source file:com.bandstand.web.ContactsController.java
License:Apache License
@PrincipalSearch public List<MusicianContact> searchMusicianContacts(MusicianAddressBook addressBook, PrincipalSearchCriteria crit) {// w ww.jav a 2s. c om if (crit.getCuType().equals(PrincipalSearchCriteria.CU_TYPE_INDIVIDUAL)) { Criteria c = SessionManager.session().createCriteria(MusicianContact.class); Junction combine; if (crit.getTest().equals(PrincipalSearchCriteria.TestType.ALL)) { combine = Restrictions.disjunction(); } else { combine = Restrictions.conjunction(); } for (PrincipalSearchCriteria.SearchItem searchItem : crit.getSearchItems()) { Criterion r = newCriterion(searchItem); if (r != null) { combine.add(r); } } c.add(combine); } return null; }
From source file:com.blue.ssh.core.orm.hibernate.HibernateDao.java
License:Apache License
/** * ?Criterion,./*from w ww . j a va2 s . c o m*/ */ public Criterion[] buildCriterionByPropertyFilter(final List<PropertyFilter> filters) { List<Criterion> criterionList = new ArrayList<Criterion>(); for (PropertyFilter filter : filters) { if (!filter.hasMultiProperties()) { // ??. Criterion criterion = buildCriterion(filter.getPropertyName(), filter.getMatchValue(), filter.getMatchType()); criterionList.add(criterion); } else {// ??,or?. Disjunction disjunction = Restrictions.disjunction(); for (String param : filter.getPropertyNames()) { Criterion criterion = buildCriterion(param, filter.getMatchValue(), filter.getMatchType()); disjunction.add(criterion); } criterionList.add(disjunction); } } return criterionList.toArray(new Criterion[criterionList.size()]); }
From source file:com.bluexml.side.Framework.alfresco.jbpm.CustomJBPMEngine.java
License:Open Source License
/** * Construct a JBPM Hibernate query based on the Task Query provided * //from ww w . j a v a 2 s . c o m * @param session * @param query * @return jbpm hiberate query criteria */ private Criteria createTaskQueryCriteria(Session session, WorkflowTaskQuery query) { Criteria task = session.createCriteria(TaskInstance.class); // task id if (query.getTaskId() != null) { task.add(Restrictions.eq("id", getJbpmId(query.getTaskId()))); } // task state if (query.getTaskState() != null) { WorkflowTaskState state = query.getTaskState(); if (state == WorkflowTaskState.IN_PROGRESS) { task.add(Restrictions.eq("isOpen", true)); task.add(Restrictions.isNull("end")); } else if (state == WorkflowTaskState.COMPLETED) { task.add(Restrictions.eq("isOpen", false)); task.add(Restrictions.isNotNull("end")); } } // task name if (query.getTaskName() != null) { task.add(Restrictions.eq("name", query.getTaskName().toPrefixString(namespaceService))); } // task actor if (query.getActorId() != null) { task.add(Restrictions.eq("actorId", query.getActorId())); } // task custom properties if (query.getTaskCustomProps() != null) { Map<QName, Object> props = query.getTaskCustomProps(); if (props.size() > 0) { Criteria variables = task.createCriteria("variableInstances"); Disjunction values = Restrictions.disjunction(); for (Map.Entry<QName, Object> prop : props.entrySet()) { Conjunction value = Restrictions.conjunction(); value.add(Restrictions.eq("name", factory.mapQNameToName(prop.getKey()))); value.add(Restrictions.eq("value", prop.getValue().toString())); values.add(value); } variables.add(values); } } // process criteria Criteria process = createProcessCriteria(task, query); // process custom properties if (query.getProcessCustomProps() != null) { // TODO: Due to Hibernate bug // http://opensource.atlassian.com/projects/hibernate/browse/HHH-957 // it's not possible to perform a sub-select with the criteria api. // For now issue a // secondary query and create an IN clause. Map<QName, Object> props = query.getProcessCustomProps(); if (props.size() > 0) { // create criteria for process variables Criteria variables = session.createCriteria(VariableInstance.class); variables.setProjection(Projections.distinct(Property.forName("processInstance"))); Disjunction values = Restrictions.disjunction(); for (Map.Entry<QName, Object> prop : props.entrySet()) { Conjunction value = Restrictions.conjunction(); value.add(Restrictions.eq("name", factory.mapQNameToName(prop.getKey()))); value.add(Restrictions.eq("value", prop.getValue().toString())); values.add(value); } variables.add(values); // note: constrain process variables to same criteria as tasks createProcessCriteria(variables, query); Disjunction processIdCriteria = createProcessIdCriteria(variables); // constrain tasks by process list process = (process == null) ? task.createCriteria("processInstance") : process; process.add(processIdCriteria); } } // order by if (query.getOrderBy() != null) { WorkflowTaskQuery.OrderBy[] orderBy = query.getOrderBy(); for (WorkflowTaskQuery.OrderBy orderByPart : orderBy) { if (orderByPart == WorkflowTaskQuery.OrderBy.TaskActor_Asc) { task.addOrder(Order.asc("actorId")); } else if (orderByPart == WorkflowTaskQuery.OrderBy.TaskActor_Desc) { task.addOrder(Order.desc("actorId")); } else if (orderByPart == WorkflowTaskQuery.OrderBy.TaskCreated_Asc) { task.addOrder(Order.asc("create")); } else if (orderByPart == WorkflowTaskQuery.OrderBy.TaskCreated_Desc) { task.addOrder(Order.desc("create")); } else if (orderByPart == WorkflowTaskQuery.OrderBy.TaskDue_Asc) { task.addOrder(Order.asc("dueDate")); } else if (orderByPart == WorkflowTaskQuery.OrderBy.TaskDue_Desc) { task.addOrder(Order.desc("dueDate")); } else if (orderByPart == WorkflowTaskQuery.OrderBy.TaskId_Asc) { task.addOrder(Order.asc("id")); } else if (orderByPart == WorkflowTaskQuery.OrderBy.TaskId_Desc) { task.addOrder(Order.desc("id")); } else if (orderByPart == WorkflowTaskQuery.OrderBy.TaskName_Asc) { task.addOrder(Order.asc("name")); } else if (orderByPart == WorkflowTaskQuery.OrderBy.TaskName_Desc) { task.addOrder(Order.desc("name")); } else if (orderByPart == WorkflowTaskQuery.OrderBy.TaskState_Asc) { task.addOrder(Order.asc("end")); } else if (orderByPart == WorkflowTaskQuery.OrderBy.TaskState_Desc) { task.addOrder(Order.desc("end")); } } } // limit results if (query.getLimit() != -1) { task.setMaxResults(query.getLimit()); } return task; }
From source file:com.bluexml.side.Framework.alfresco.jbpm.CustomJBPMEngine.java
License:Open Source License
/** * @param variables/*from w w w . j a v a 2s .c om*/ * @return */ private Disjunction createProcessIdCriteria(Criteria variables) { // retrieve list of processes matching specified variables List<?> processList = variables.list(); Object[] processIds = getProcessIds(processList); // ALF-5841 fix int batch = 0; List<Object> buf = new ArrayList<Object>(1000); Disjunction ids = Restrictions.disjunction(); for (Object id : processIds) { if (batch < 1000) { batch++; buf.add(id); } else { ids.add(Restrictions.in("id", buf)); batch = 0; buf.clear(); } } if (!buf.isEmpty()) { ids.add(Restrictions.in("id", buf)); } return ids; }
From source file:com.bookshop.dao.BookDAOImpl.java
@Override public List<Book> listBooks(String searchCriteria) { if (searchCriteria == null) { return new ArrayList<Book>(); }//from ww w. j a va 2 s.c o m Criteria criteria = session.createCriteria(Book.class); Criterion bookNameCriterion = Restrictions.like("bookName", searchCriteria, MatchMode.ANYWHERE); Criterion isbnCriterion = Restrictions.like("ISBN", searchCriteria, MatchMode.ANYWHERE); Criterion editionCriterion = Restrictions.like("edition", searchCriteria, MatchMode.ANYWHERE); // Criterion yearCriterion = Restrictions.eq("year", searchCriteria); Criterion synopsisCriterion = Restrictions.like("synopsis", searchCriteria, MatchMode.ANYWHERE); Criterion aboutAuthorsCriterion = Restrictions.like("aboutAuthors", searchCriteria, MatchMode.ANYWHERE); Criterion topicsCoveredCriterion = Restrictions.like("topicsCovered", searchCriteria, MatchMode.ANYWHERE); Criterion contentsCDROMCriterion = Restrictions.like("contentsCDROM", searchCriteria, MatchMode.ANYWHERE); // Criterion costCriterion = Restrictions.like("cost", searchCriteria, MatchMode.ANYWHERE); Criterion firstAuthorCriterion = Restrictions.like("firstAuthor", searchCriteria, MatchMode.ANYWHERE); Criterion secondAuthorCriterion = Restrictions.like("secondAuthor", searchCriteria, MatchMode.ANYWHERE); Criterion thirdAuthorCriterion = Restrictions.like("thirdAuthor", searchCriteria, MatchMode.ANYWHERE); Criterion fourthAuthorCriterion = Restrictions.like("fourthAuthor", searchCriteria, MatchMode.ANYWHERE); criteria.add(Restrictions.disjunction().add(bookNameCriterion).add(isbnCriterion).add(editionCriterion) .add(synopsisCriterion).add(aboutAuthorsCriterion).add(topicsCoveredCriterion) .add(contentsCDROMCriterion).add(firstAuthorCriterion).add(secondAuthorCriterion) .add(thirdAuthorCriterion).add(fourthAuthorCriterion)); return criteria.list(); }
From source file:com.bplow.look.bass.dao.HibernateDao.java
License:Apache License
/** * ?Criterion,./*from ww w. j av a2 s . c o m*/ */ protected Criterion[] buildPropertyFilterCriterions(final List<PropertyFilter> filters) { List<Criterion> criterionList = new ArrayList<Criterion>(); for (PropertyFilter filter : filters) { if (!filter.isMultiProperty()) { //??. Criterion criterion = buildPropertyFilterCriterion(filter.getPropertyName(), filter.getPropertyValue(), filter.getPropertyType(), filter.getMatchType()); criterionList.add(criterion); } else {//??,or?. Disjunction disjunction = Restrictions.disjunction(); for (String param : filter.getPropertyNames()) { Criterion criterion = buildPropertyFilterCriterion(param, filter.getPropertyValue(), filter.getPropertyType(), filter.getMatchType()); disjunction.add(criterion); } criterionList.add(disjunction); } } return criterionList.toArray(new Criterion[criterionList.size()]); }
From source file:com.cimmyt.model.dao.impl.LabStudyDAOImpl.java
License:Apache License
private void addCriteria(DetachedCriteria criteria, List<DsSearchParam> params, boolean useSampleDetailFilters) { boolean hasAND = false; boolean hasOR = false; List<DsSearchParam> paramList = new ArrayList<DsSearchParam>(params); criteria.createAlias("project", VALUE_PROJECT) .createAlias("investigatorid", "investigator", CriteriaSpecification.LEFT_JOIN) .createAlias("season", "season", CriteriaSpecification.LEFT_JOIN) .createAlias("location", "location", CriteriaSpecification.LEFT_JOIN); if (useSampleDetailFilters) criteria.createAlias("sampleDetailCollection", VALUE_SAMPLE, CriteriaSpecification.INNER_JOIN); //separates 'OR' from other operators, to use in disjunction List<DsSearchParam> orParams = new ArrayList<DsSearchParam>(); for (DsSearchParam p : paramList) { if (p.getOperator().equals(TypeCondition.OR)) { orParams.add(p);//from ww w . j av a 2s . c o m } } paramList.removeAll(orParams); String qualifiedParam = null; Conjunction conjunction = Restrictions.conjunction(); for (DsSearchParam param : paramList) { hasAND = true; qualifiedParam = param.getQualifier(); DataType dataType = OperatorImp.getType(param.getElement(), param.getQualifier()); Operator condition = OperatorImp.valueOf(param.getCondition()); addDynamicCriterion(conjunction, condition, dataType, qualifiedParam, param.getValue()); } Disjunction disjunction = Restrictions.disjunction(); for (DsSearchParam param : orParams) { hasOR = true; qualifiedParam = param.getQualifier(); DataType dataType = OperatorImp.getType(param.getElement(), param.getQualifier()); Operator condition = OperatorImp.valueOf(param.getCondition()); addDynamicCriterion(disjunction, condition, dataType, qualifiedParam, param.getValue()); } if (hasAND) { if (hasOR) { criteria.add(Restrictions.or(conjunction, disjunction)); } else { criteria.add(conjunction); } } else if (hasOR) { criteria.add(disjunction); } }
From source file:com.cimmyt.model.dao.impl.SampleDetailDAOImpl.java
License:Apache License
/** * add parameters for project, study and sample * *///from www .j av a 2 s . com private void addCriteria(DetachedCriteria criteria, List<DsSearchParam> params) { boolean hasAND = false; boolean hasOR = false; List<DsSearchParam> paramList = new ArrayList<DsSearchParam>(params); criteria.createAlias("labstudyid", Constants.VALUE_STUDY) .createAlias("study.project", Constants.VALUE_PROJECT) .createAlias("locationid", "location", CriteriaSpecification.LEFT_JOIN) .createAlias("seasonid", "season", CriteriaSpecification.LEFT_JOIN) .createAlias("study.investigatorid", "investigator", CriteriaSpecification.LEFT_JOIN); //separates 'OR' from other operators, to use in disjunction List<DsSearchParam> orParams = new ArrayList<DsSearchParam>(); for (DsSearchParam p : paramList) { if (p.getOperator().equals(TypeCondition.OR)) { orParams.add(p); } } paramList.removeAll(orParams); String qualifiedParam = null; Conjunction conjunction = Restrictions.conjunction(); for (DsSearchParam param : paramList) { hasAND = true; qualifiedParam = param.getQualifier(); DataType dataType = OperatorImp.getType(param.getElement(), param.getQualifier()); Operator condition = OperatorImp.valueOf(param.getCondition()); addDynamicCriterion(conjunction, condition, dataType, qualifiedParam, param.getValue()); } Disjunction disjunction = Restrictions.disjunction(); for (DsSearchParam param : orParams) { hasOR = true; qualifiedParam = param.getQualifier(); DataType dataType = OperatorImp.getType(param.getElement(), param.getQualifier()); Operator condition = OperatorImp.valueOf(param.getCondition()); addDynamicCriterion(disjunction, condition, dataType, qualifiedParam, param.getValue()); } if (hasAND) { if (hasOR) { criteria.add(Restrictions.or(conjunction, disjunction)); } else { criteria.add(conjunction); } } else if (hasOR) { criteria.add(disjunction); } }
From source file:com.cosylab.cdb.jdal.HibernateWDALImpl.java
License:Open Source License
protected void updateComponentsTableMap(String curl) { m_logger.info("clear_cache(curl): ComponentsTable1"); final String keyField = "Name"; final Class type = alma.TMCDB.maci.Component.class; Map<String, Object> rootMap = (Map<String, Object>) rootNode; Map<String, Object> map = (Map<String, Object>) ((Map<String, Object>) rootMap.get("MACI")) .get("Components"); m_logger.info("clear_cache(curl): ComponentsTable2"); try {//from w w w . j a va 2 s . co m Session session = hibernateUtil.getSession(); Method accessor = DOMJavaClassIntrospector.getAccessorMethod(type, keyField); m_logger.info("clear_cache(curl): ComponentsTable3"); Field field = null; if (accessor == null) { try { field = type.getField(keyField); } catch (Throwable th) { throw new IllegalStateException("failed to obtain key "); } } m_logger.info("clear_cache(curl): ComponentsTable4"); String els[] = curl.split("/"); String rpath = "^/*"; String rsubpath = "^/*"; String rcpath = "^/*"; String rcname = els[els.length - 1]; for (int i = 0; i < els.length; i++) { rpath += els[i]; rsubpath += els[i]; if (i < els.length - 1) { rpath += "/+"; rsubpath += "/+"; rcpath += els[i]; if (i < els.length - 2) rcpath += "/+"; } } rpath += "/*$"; rsubpath += "/+.*"; rcpath += "/*$"; System.out.println(rpath); System.out.println(rsubpath); System.out.println(rcpath + "|" + rcname); m_logger.info("clear_cache(curl): ComponentsTable5"); //Consider the cases where the curl matches exactly the Path, where //it is part of the path and when it matches exactly the path and //the component name. Criterion cr = Restrictions.disjunction().add(getRegularExpressionRestriction("Path", rpath)) .add(getRegularExpressionRestriction("Path", rsubpath)).add(Restrictions .and(getRegularExpressionRestriction("Path", rcpath), Restrictions.eq("Name", rcname))); m_logger.info("clear_cache(curl): ComponentsTable6"); List list = getListForConfiguration(session, type, cr); m_logger.info("clear_cache(curl): ComponentsTable7"); System.out.println("\nFound the following Components"); for (Object data : list) { System.out.println(((alma.TMCDB.maci.Component) data).Path + "/" + ((alma.TMCDB.maci.Component) data).getName()); } m_logger.info("clear_cache(curl): ComponentsTable8"); //Remove the entries from existing maps. System.out.println("\nChecking maps to remove"); Map rParentMap = map; for (int i = 0; i < els.length; i++) { System.out.println("Checking path " + els[i] + "."); System.out.println("Parent keys: " + rParentMap.keySet().toString()); Object data = rParentMap.get(els[i]); if (data == null) { System.out.println("No element found with the given curl"); break; } else { if (data instanceof alma.TMCDB.maci.Component) { System.out.println("Instance of Component (Component!)."); } else if (data instanceof alma.TMCDB.maci.ComponentNode) { System.out.println("Instance of ComponentNode (Path!)."); } else { System.out.println("Unknown type! Details: " + data.toString()); } if (i < els.length - 1) { System.out.println("There are elements remaining, so we proceed to next element in path."); rParentMap = ((alma.TMCDB.maci.ComponentNode) data)._; } else { System.out.println( "There are no elements remaining, we remove all entries from this element in path and on."); rParentMap.remove(els[i]); } } } m_logger.info("clear_cache(curl): ComponentsTable9"); // Sort the list by path + component to ensure that parent components are added before their children Comparator<alma.TMCDB.maci.Component> comparator = new Comparator<alma.TMCDB.maci.Component>() { public int compare(alma.TMCDB.maci.Component o1, alma.TMCDB.maci.Component o2) { String fullName1 = ((o1.Path == null ? "" : o1.Path) + "/") + o1.getName(); String fullName2 = ((o2.Path == null ? "" : o2.Path) + "/") + o2.getName(); return fullName1.compareTo(fullName2); } }; Collections.sort(list, comparator); m_logger.info("clear_cache(curl): ComponentsTable10"); for (Object data : list) { String baseKey; if (accessor != null) baseKey = accessor.invoke(data, (Object[]) null).toString(); else //if (field != null) baseKey = field.get(data).toString(); // baseKey should not be null Map parentMap = map; alma.TMCDB.maci.Component component = (alma.TMCDB.maci.Component) data; // some cleaning if (component.getComponentLogger().getMinLogLevel() == -1 && component.getComponentLogger().getMinLogLevelLocal() == -1) component.setComponentLogger(null); // now find its map String path = getNormalizedPath(component.Path); while (path != null && path.length() > 0) { // remove trailing slashes, to have unique curl (used for key) if (path.charAt(0) == '/') { path = path.substring(1); continue; } int pos = path.indexOf('/'); String parentPath = (pos > 0) ? path.substring(0, pos) : path; String subpath = (pos > 0) ? path.substring(pos + 1, path.length()) : null; alma.TMCDB.maci.ComponentNode parentComponent = (alma.TMCDB.maci.ComponentNode) parentMap .get(parentPath); if (parentComponent == null) { parentComponent = new alma.TMCDB.maci.ComponentNode(); parentMap.put(parentPath, parentComponent); } parentMap = parentComponent._; path = subpath; } // unique key generation int count = 0; String key = baseKey; while (parentMap.containsKey(key)) key = baseKey + String.valueOf(++count); parentMap.put(key, data); if (data instanceof alma.TMCDB.maci.Component) { alma.TMCDB.maci.Component comp = (alma.TMCDB.maci.Component) data; m_logger.finer( "Loaded component name=" + comp.Path + comp.getName() + ", type=" + comp.getType() + ", container=" + comp.getContainer() + ", implLang=" + comp.getImplLang()); } else { m_logger.warning("Bad component class '" + data.getClass().getName() + "' read from TMCDB."); } m_logger.info("clear_cache(curl): ComponentsTable11"); } m_logger.info("clear_cache(curl): ComponentsTable12"); } catch (Throwable th) { th.printStackTrace(); } m_logger.info("clear_cache(curl): ComponentsTable13"); }
From source file:com.cosylab.cdb.jdal.HibernateWDALImpl.java
License:Open Source License
public void updateContainersTableMap(String curl) { m_logger.info("clear_cache(curl): ContainersTable1"); final String keyField = "Name"; final Class type = alma.TMCDB.maci.Container.class; Map<String, Object> rootMap = (Map<String, Object>) rootNode; Map<String, Object> map = (Map<String, Object>) ((Map<String, Object>) rootMap.get("MACI")) .get("Containers"); m_logger.info("clear_cache(curl): ContainersTable2"); try {//from w ww .ja v a 2 s . c om Session session = hibernateUtil.getSession(); Method accessor = DOMJavaClassIntrospector.getAccessorMethod(type, keyField); Field field = null; if (accessor == null) { try { field = type.getField(keyField); } catch (Throwable th) { throw new IllegalStateException("failed to obtain key "); } } m_logger.info("clear_cache(curl): ContainersTable3"); String els[] = curl.split("/"); String rpath = "^/*"; String rsubpath = "^/*"; String rcpath = "^/*"; String rcname = els[els.length - 1]; for (int i = 0; i < els.length; i++) { rpath += els[i]; rsubpath += els[i]; if (i < els.length - 1) { rpath += "/+"; rsubpath += "/+"; rcpath += els[i]; if (i < els.length - 2) rcpath += "/+"; } } rpath += "/*$"; rsubpath += "/+.*"; rcpath += "/*$"; System.out.println(rpath); System.out.println(rsubpath); System.out.println(rcpath + "|" + rcname); m_logger.info("clear_cache(curl): ContainersTable4"); //Consider the cases where the curl matches exactly the Path, where //it is part of the path and when it matches exactly the path and //the component name. Criterion cr = Restrictions.disjunction().add(getRegularExpressionRestriction("Path", rpath)) .add(getRegularExpressionRestriction("Path", rsubpath)).add(Restrictions .and(getRegularExpressionRestriction("Path", rcpath), Restrictions.eq("Name", rcname))); m_logger.info("clear_cache(curl): ContainersTable5"); List list = getListForConfiguration(session, type, cr); m_logger.info("clear_cache(curl): ContainersTable6"); System.out.println("\nFound the following Containers"); for (Object data : list) { System.out.println(((alma.TMCDB.maci.Container) data).Path + "/" + ((alma.TMCDB.maci.Container) data).getName()); } //Remove the entries from existing maps. System.out.println("\nChecking maps to remove"); m_logger.info("clear_cache(curl): ContainersTable7"); Map rParentMap = map; for (int i = 0; i < els.length; i++) { System.out.println("Checking path " + els[i] + "."); System.out.println("Parent keys: " + rParentMap.keySet().toString()); Object data = rParentMap.get(els[i]); if (data == null) { System.out.println("No element found with the given curl"); break; } else { if (data instanceof alma.TMCDB.maci.Container) { System.out.println("Instance of Container (Container!)."); } else if (data instanceof alma.TMCDB.maci.ContainerNode) { System.out.println("Instance of ContainerNode (Path!)."); } else { System.out.println("Unknown type! Details: " + data.toString()); } if (i < els.length - 1) { System.out.println("There are elements remaining, so we proceed to next element in path."); rParentMap = ((alma.TMCDB.maci.ContainerNode) data)._; } else { System.out.println( "There are no elements remaining, we remove all entries from this element in path and on."); rParentMap.remove(els[i]); } } } m_logger.info("clear_cache(curl): ContainersTable8"); // Sort the list by path + component to ensure that parent containers are added before their children Comparator<alma.TMCDB.maci.Container> comparator = new Comparator<alma.TMCDB.maci.Container>() { public int compare(alma.TMCDB.maci.Container o1, alma.TMCDB.maci.Container o2) { String fullName1 = ((o1.Path == null ? "" : o1.Path) + "/") + o1.getName(); String fullName2 = ((o2.Path == null ? "" : o2.Path) + "/") + o2.getName(); return fullName1.compareTo(fullName2); } }; Collections.sort(list, comparator); m_logger.info("clear_cache(curl): ContainersTable9"); for (Object data : list) { String baseKey; if (accessor != null) baseKey = accessor.invoke(data, (Object[]) null).toString(); else //if (field != null) baseKey = field.get(data).toString(); // baseKey should not be null Map parentMap = map; alma.TMCDB.maci.Container container = (alma.TMCDB.maci.Container) data; // do not include this if (DUMMY_CONTAINER_FLAG.equals(container.getDeployInfo().getTypeModifiers())) continue; // some cleaning if (container.getDeployInfo() != null && container.getDeployInfo().getHost() == null) container.setDeployInfo(null); // now find its map String path = getNormalizedPath(container.Path); while (path != null && path.length() > 0) { // remove trailing slashes, to have unique curl (used for key) if (path.charAt(0) == '/') { path = path.substring(1); continue; } int pos = path.indexOf('/'); String parentPath = (pos > 0) ? path.substring(0, pos) : path; String subpath = (pos > 0) ? path.substring(pos + 1, path.length()) : null; alma.TMCDB.maci.ContainerNode parentContainer = (alma.TMCDB.maci.ContainerNode) parentMap .get(parentPath); if (parentContainer == null) { parentContainer = new alma.TMCDB.maci.ContainerNode(); parentMap.put(parentPath, parentContainer); } parentMap = parentContainer._; path = subpath; } // unique key generation int count = 0; String key = baseKey; while (parentMap.containsKey(key)) key = baseKey + String.valueOf(++count); parentMap.put(key, data); if (data instanceof alma.TMCDB.maci.Container) { alma.TMCDB.maci.Container cont = (alma.TMCDB.maci.Container) data; m_logger.finer("Loaded container name=" + cont.Path + cont.getName() + ", implLang=" + cont.getImplLang()); } else { m_logger.warning("Bad container class '" + data.getClass().getName() + "' read from TMCDB."); } m_logger.info("clear_cache(curl): ContainersTable10"); } m_logger.info("clear_cache(curl): ContainersTable11"); } catch (Throwable th) { th.printStackTrace(); } m_logger.info("clear_cache(curl): ContainersTable12"); }