@Override public DataResult getAuditAppraisalRecord( Appraisal appraisal, Map<String, Object> params, int pageIndex, int pageSize) { DataResult dataResult = new DataResult(); SqlQueryParameter sqlQueryParameter = new SqlQueryParameter(); if (pageIndex != -1) { sqlQueryParameter.setPageIndex(pageIndex); sqlQueryParameter.setPage(true); } if (pageSize != -1) { sqlQueryParameter.setPageSize(pageSize); } sqlQueryParameter.setParameter(appraisal); if (!CollectionUtils.isEmpty(params)) { sqlQueryParameter.getKeyValMap().putAll(params); } List<Appraisal> appraisalList = appraisalDao.getAuditAppraisalRecord(sqlQueryParameter); if (!CollectionUtils.isEmpty(appraisalList)) { List<Map<String, Object>> dataMap = new ArrayList<Map<String, Object>>(); Map<String, Object> temp = null; for (Appraisal a : appraisalList) { temp = a.getPersistentState(); temp.put("screateDate", DateUtil.dateToString(a.getCreateTime(), "yyyy年MM月dd日")); temp.put( "statusDisplay", SystemCacheUtil.getInstance() .getSystemStatusCache() .get("Status_" + StringUtil.getString(temp.get("status")))); dataMap.add(temp); } dataResult.setData(dataMap); dataResult.setTotal(sqlQueryParameter.getTotalRecord()); } return dataResult; }
@GET @Path("{groupId}/clientstransfertemplate") @Consumes({MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_JSON}) public String retrieveClientTranferTemplate( @Context final UriInfo uriInfo, @PathParam("groupId") final Long groupId, @DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly) { this.context.authenticatedUser().validateHasReadPermission("GROUP"); GroupGeneralData group = this.groupReadPlatformService.retrieveOne(groupId); final boolean transferActiveLoans = true; final boolean inheritDestinationGroupLoanOfficer = true; Collection<ClientData> membersOfGroup = this.clientReadPlatformService.retrieveClientMembersOfGroup(groupId); if (CollectionUtils.isEmpty(membersOfGroup)) { membersOfGroup = null; } final boolean loanOfficersOnly = false; Collection<StaffData> staffOptions = null; if (staffInSelectedOfficeOnly) { staffOptions = this.staffReadPlatformService.retrieveAllStaffForDropdown(group.officeId()); } else { staffOptions = this.staffReadPlatformService.retrieveAllStaffInOfficeAndItsParentOfficeHierarchy( group.officeId(), loanOfficersOnly); } if (CollectionUtils.isEmpty(staffOptions)) { staffOptions = null; } Collection<GroupGeneralData> groupOptions = this.groupReadPlatformService.retrieveGroupsForLookup(group.officeId(), groupId); GroupTransferData data = GroupTransferData.template( groupId, membersOfGroup, groupOptions, staffOptions, transferActiveLoans, inheritDestinationGroupLoanOfficer); final Set<String> GROUP_TRANSFERS_DATA_PARAMETERS = new HashSet<String>( Arrays.asList( "groupId", "clientOptions", "groupOptions", "staffOptions", "transferActiveLoans", "inheritDestinationGroupLoanOfficer")); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); return this.toApiJsonSerializer.serialize(settings, data, GROUP_TRANSFERS_DATA_PARAMETERS); }
@Override protected BeanDefinitionBuilder parseHandler(Element element, ParserContext parserContext) { final BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(ContentEnricher.class); IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "request-channel"); IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "reply-channel"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "request-timeout"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "reply-timeout"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "requires-reply"); List<Element> subElements = DomUtils.getChildElementsByTagName(element, "property"); if (!CollectionUtils.isEmpty(subElements)) { ManagedMap<String, Object> expressions = new ManagedMap<String, Object>(); for (Element subElement : subElements) { String name = subElement.getAttribute("name"); BeanDefinition beanDefinition = IntegrationNamespaceUtils.createExpressionDefinitionFromValueOrExpression( "value", "expression", parserContext, subElement, true); expressions.put(name, beanDefinition); } builder.addPropertyValue("propertyExpressions", expressions); } subElements = DomUtils.getChildElementsByTagName(element, "header"); if (!CollectionUtils.isEmpty(subElements)) { ManagedMap<String, Object> expressions = new ManagedMap<String, Object>(); for (Element subElement : subElements) { String name = subElement.getAttribute("name"); BeanDefinition expressionDefinition = IntegrationNamespaceUtils.createExpressionDefinitionFromValueOrExpression( "value", "expression", parserContext, subElement, true); BeanDefinitionBuilder valueProcessorBuilder = BeanDefinitionBuilder.genericBeanDefinition( IntegrationNamespaceUtils.BASE_PACKAGE + ".transformer.support.ExpressionEvaluatingHeaderValueMessageProcessor"); valueProcessorBuilder .addConstructorArgValue(expressionDefinition) .addConstructorArgValue(subElement.getAttribute("type")); IntegrationNamespaceUtils.setValueIfAttributeDefined( valueProcessorBuilder, subElement, "overwrite"); expressions.put(name, valueProcessorBuilder.getBeanDefinition()); } builder.addPropertyValue("headerExpressions", expressions); } IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "should-clone-payload"); String requestPayloadExpression = element.getAttribute("request-payload-expression"); if (StringUtils.hasText(requestPayloadExpression)) { BeanDefinitionBuilder expressionBuilder = BeanDefinitionBuilder.genericBeanDefinition(ExpressionFactoryBean.class); expressionBuilder.addConstructorArgValue(requestPayloadExpression); builder.addPropertyValue("requestPayloadExpression", expressionBuilder.getBeanDefinition()); } return builder; }
/** * 报销页面 * * @return */ @RequestMapping( value = "expenseView", method = {RequestMethod.GET, RequestMethod.POST}) public ModelAndView createExpenseView(HttpServletRequest request) { ModelAndView modelView = createModelAndViewWithSign("expense", request); // 1、获取报销信息 String id = HttpRequestUtil.getInst().getString("id"); String corpId = HttpRequestUtil.getInst().getCurrentCorpId(); if (!StringUtils.isEmpty(id)) { Expense expense = expenseService.getExpenseById(id); if (null == expense) { throw new VyiyunBusinessException("记录已被撤销或不存在!"); } modelView.addObject("expenseInfo", expense); List<Accessory> accessoryList = accessoryService.getAccessoryByEntityId(id); if (!CollectionUtils.isEmpty(accessoryList)) { modelView.addObject("accessoryInfor", accessoryList); } ExpenseFee expenseFee = new ExpenseFee(); expenseFee.setExpenseId(id); expenseFee.setCorpId(corpId); List<ExpenseFee> expenseFeeList = expenseFeeService.getExpenseFee(expenseFee); if (!CollectionUtils.isEmpty(expenseFeeList)) { List<Map<String, Object>> dataMap = new ArrayList<Map<String, Object>>(); Map<String, Object> temp = null; SystemStatusCache<Object> systemStatusCache = SystemCacheUtil.getInstance().getSystemStatusCache(); for (ExpenseFee ex : expenseFeeList) { temp = ex.getPersistentState(); temp.put( "categoryDisplay", systemStatusCache.getSystemStatusValue(corpId, "CostCategory", ex.getCategory())); dataMap.add(temp); } modelView.addObject("expenseFeeList", dataMap); } } else { // 获取报销类别 Expense expense = new Expense(); WeixinUser weixinUser = HttpRequestUtil.getInst().getCurrentWeixinUser(); WeixinContactCache<Object> weixinContactCache = (WeixinContactCache<Object>) SystemCacheUtil.getInstance().getWeixinContactCache(); expense.setDepartment(weixinContactCache.getUserDept(weixinUser.getDepartment())); modelView.addObject("expenseInfo", expense); } List<SystemStatus> costCategoryList = (List<SystemStatus>) systemStatusService.getSystemStatus(corpId, Constants.COST_CATEGORY, true); // (List<SystemStatus>) // SystemCacheUtil.getInstance().getSystemStatusCache() // .getSystemStatus(corpId, "CostCategory"); if (!CollectionUtils.isEmpty(costCategoryList)) { modelView.addObject("costCategoryList", costCategoryList); } return modelView; }
@Override public GroupGeneralData retrieveTemplate( final Long officeId, final boolean isCenterGroup, final boolean staffInSelectedOfficeOnly) { final Long defaultOfficeId = defaultToUsersOfficeIfNull(officeId); Collection<CenterData> centerOptions = null; if (isCenterGroup) { centerOptions = this.centerReadPlatformService.retrieveAllForDropdown(defaultOfficeId); } final Collection<OfficeData> officeOptions = this.officeReadPlatformService.retrieveAllOfficesForDropdown(); final boolean loanOfficersOnly = false; Collection<StaffData> staffOptions = null; if (staffInSelectedOfficeOnly) { staffOptions = this.staffReadPlatformService.retrieveAllStaffForDropdown(defaultOfficeId); } else { staffOptions = this.staffReadPlatformService.retrieveAllStaffInOfficeAndItsParentOfficeHierarchy( defaultOfficeId, loanOfficersOnly); } if (CollectionUtils.isEmpty(staffOptions)) { staffOptions = null; } Collection<ClientData> clientOptions = this.clientReadPlatformService.retrieveAllForLookupByOfficeId(defaultOfficeId); if (CollectionUtils.isEmpty(clientOptions)) { clientOptions = null; } final Collection<CodeValueData> availableRoles = this.codeValueReadPlatformService.retrieveCodeValuesByCode( GroupingTypesApiConstants.GROUP_ROLE_NAME); final Long centerId = null; final String centerName = null; final Long staffId = null; final String staffName = null; return GroupGeneralData.template( defaultOfficeId, centerId, centerName, staffId, staffName, centerOptions, officeOptions, staffOptions, clientOptions, availableRoles); }
/** * 判断是否需要执行MilouDbUnitTestExecutionListener * * @param testClass */ private void switchMilouDBUnitTestExecutionListener(TestClass testClass) { List<FrameworkMethod> DBSituations = testClass.getAnnotatedMethods(DBSituations.class); List<FrameworkMethod> DBSetupSituation = testClass.getAnnotatedMethods(DBSetupSituation.class); List<FrameworkMethod> DBTeardownSituation = testClass.getAnnotatedMethods(DBTeardownSituation.class); if (!CollectionUtils.isEmpty(DBSituations) || !CollectionUtils.isEmpty(DBSetupSituation) || !CollectionUtils.isEmpty(DBTeardownSituation)) { MilouDBThreadLocal.setMilouDBListener(Boolean.valueOf(true)); } }
@Override public Message buildMessageContent(TestContext context, String messageType) { if (getMessageHeaders().isEmpty() && CollectionUtils.isEmpty(getHeaderData()) && CollectionUtils.isEmpty(getHeaderResources()) && getMessageInterceptors().isEmpty() && getDataDictionary() == null) { return message; } else { return super.buildMessageContent(context, messageType); } }
/** * Validates the acl assignment changes. It is not valid acl assignment change, when an acl entry * contains more than one privilege or privileges other than USE if the tenant provided in the acl * entry is not a valid tenant org. * * @param changes acl assignment changes to validated. */ private void validateAclAssignments(ACLAssignmentChanges changes) { if (changes == null) { throw APIException.badRequests.requiredParameterMissingOrEmpty("ACLAssignmentChanges"); } // Make sure at least one acl entry either in the add or remove // list. if (CollectionUtils.isEmpty(changes.getAdd()) && CollectionUtils.isEmpty(changes.getRemove())) { throw APIException.badRequests.requiredParameterMissingOrEmpty("ACLAssignmentChanges"); } validateAclEntries(changes.getAdd()); validateAclEntries(changes.getRemove()); }
public List<String> getManagerAndCommissionMails(Long buildingId) { List<String> recipientMails = new ArrayList<String>(); List<String> managerMails = this.getManagerMails(buildingId); if (!CollectionUtils.isEmpty(managerMails)) { recipientMails.addAll(managerMails); } List<String> commissionMails = this.getCommissionMails(buildingId); if (!CollectionUtils.isEmpty(commissionMails)) { recipientMails.addAll(commissionMails); } return recipientMails; }
/** * Searches parent for the target {@link AbstractExpression} beginning from the root element. This * is a recursive method. * * @param parentCandidate parent candidate to check * @param target target {@link AbstractExpression} instance * @return the parent of the target {@link AbstractExpression} instance or null, if target is a * root element. */ private AbstractExpression searchParent( AbstractExpression parentCandidate, AbstractExpression target) { if (null == parentCandidate || parentCandidate.equals(target)) { return null; } List<? extends AbstractExpression> children = null; if (parentCandidate instanceof IContainerExpression) { children = ((IContainerExpression) parentCandidate).getOperands(); } if (CollectionUtils.isEmpty(children)) { return null; } for (AbstractExpression child : children) { if (target.equals(child)) { return parentCandidate; } else { AbstractExpression childResult = searchParent(child, target); if (null != childResult) { return childResult; } } } return null; }
@Override public DataResponse<Iterable<TestResult>> search(TestResultRequest request) { Component component = componentRepository.findOne(request.getComponentId()); if (!component.getCollectorItems().containsKey(CollectorType.Test)) { return new DataResponse<>(null, 0L); } List<TestResult> result = new ArrayList<>(); for (CollectorItem item : component.getCollectorItems().get(CollectorType.Test)) { QTestResult testResult = new QTestResult("testResult"); BooleanBuilder builder = new BooleanBuilder(); builder.and(testResult.collectorItemId.eq(item.getId())); if (request.validStartDateRange()) { builder.and( testResult.startTime.between(request.getStartDateBegins(), request.getStartDateEnds())); } if (request.validEndDateRange()) { builder.and( testResult.endTime.between(request.getEndDateBegins(), request.getEndDateEnds())); } if (request.validDurationRange()) { builder.and( testResult.duration.between( request.getDurationGreaterThan(), request.getDurationLessThan())); } if (!request.getTypes().isEmpty()) { builder.and(testResult.testCapabilities.any().type.in(request.getTypes())); } if (request.getMax() == null) { result.addAll( Lists.newArrayList( testResultRepository.findAll(builder.getValue(), testResult.timestamp.desc()))); } else { PageRequest pageRequest = new PageRequest(0, request.getMax(), Sort.Direction.DESC, "timestamp"); result.addAll( Lists.newArrayList( testResultRepository.findAll(builder.getValue(), pageRequest).getContent())); } } // One collector per Type. get(0) is hardcoded. if (!CollectionUtils.isEmpty(component.getCollectorItems().get(CollectorType.Test)) && (component.getCollectorItems().get(CollectorType.Test).get(0) != null)) { Collector collector = collectorRepository.findOne( component.getCollectorItems().get(CollectorType.Test).get(0).getCollectorId()); if (collector != null) { return new DataResponse<>( pruneToDepth(result, request.getDepth()), collector.getLastExecuted()); } } return new DataResponse<>(null, 0L); }
/** * Writes the optional attributes configured via this base class to the supplied {@link * TagWriter}. The set of optional attributes that will be rendered includes any non-standard * dynamic attributes. Called by {@link #writeDefaultAttributes(TagWriter)}. */ protected void writeOptionalAttributes(TagWriter tagWriter) throws JspException { tagWriter.writeOptionalAttributeValue(CLASS_ATTRIBUTE, resolveCssClass()); tagWriter.writeOptionalAttributeValue( STYLE_ATTRIBUTE, ObjectUtils.getDisplayString(evaluate("cssStyle", getCssStyle()))); writeOptionalAttribute(tagWriter, LANG_ATTRIBUTE, getLang()); writeOptionalAttribute(tagWriter, TITLE_ATTRIBUTE, getTitle()); writeOptionalAttribute(tagWriter, DIR_ATTRIBUTE, getDir()); writeOptionalAttribute(tagWriter, TABINDEX_ATTRIBUTE, getTabindex()); writeOptionalAttribute(tagWriter, ONCLICK_ATTRIBUTE, getOnclick()); writeOptionalAttribute(tagWriter, ONDBLCLICK_ATTRIBUTE, getOndblclick()); writeOptionalAttribute(tagWriter, ONMOUSEDOWN_ATTRIBUTE, getOnmousedown()); writeOptionalAttribute(tagWriter, ONMOUSEUP_ATTRIBUTE, getOnmouseup()); writeOptionalAttribute(tagWriter, ONMOUSEOVER_ATTRIBUTE, getOnmouseover()); writeOptionalAttribute(tagWriter, ONMOUSEMOVE_ATTRIBUTE, getOnmousemove()); writeOptionalAttribute(tagWriter, ONMOUSEOUT_ATTRIBUTE, getOnmouseout()); writeOptionalAttribute(tagWriter, ONKEYPRESS_ATTRIBUTE, getOnkeypress()); writeOptionalAttribute(tagWriter, ONKEYUP_ATTRIBUTE, getOnkeyup()); writeOptionalAttribute(tagWriter, ONKEYDOWN_ATTRIBUTE, getOnkeydown()); if (!CollectionUtils.isEmpty(this.dynamicAttributes)) { for (String attr : this.dynamicAttributes.keySet()) { tagWriter.writeOptionalAttributeValue( attr, getDisplayString(this.dynamicAttributes.get(attr))); } } }
protected void verifyResultCollectionConsistsOfMessages(Collection<?> elements) { Class<?> commonElementType = CollectionUtils.findCommonElementType(elements); Assert.isAssignable( Message.class, commonElementType, "The expected collection of Messages contains non-Message element: " + commonElementType); }
@Override public Object buildResponseFromRequest(Object stepRequest) { EmrHiveStepAddRequest emrHiveStepAddRequest = (EmrHiveStepAddRequest) stepRequest; EmrHiveStep step = new EmrHiveStep(); step.setNamespace(emrHiveStepAddRequest.getNamespace()); step.setEmrClusterDefinitionName(emrHiveStepAddRequest.getEmrClusterDefinitionName()); step.setEmrClusterName(emrHiveStepAddRequest.getEmrClusterName()); step.setStepName(emrHiveStepAddRequest.getStepName().trim()); step.setScriptLocation( emrHiveStepAddRequest .getScriptLocation() .trim() .replaceAll(getS3ManagedReplaceString(), emrHelper.getS3StagingLocation())); // Add the script arguments if (!CollectionUtils.isEmpty(emrHiveStepAddRequest.getScriptArguments())) { List<String> scriptArguments = new ArrayList<>(); step.setScriptArguments(scriptArguments); for (String argument : emrHiveStepAddRequest.getScriptArguments()) { scriptArguments.add(argument.trim()); } } step.setContinueOnError(emrHiveStepAddRequest.isContinueOnError()); return step; }
// TODO: proper search API implementation @Override @GET @Path("/owner/search") @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public Response findOwnerByLastName(@QueryParam("lastName") String lastName) { try { Result<List<Owner>> response = petClinicMgr.findOwnerByLastName(lastName); ServiceResponse<OwnerSrvMdlList> responseMessage = ResponseTranslator.toServiceResponse(response); if (response.isSuccess()) { List<Owner> owners = response.getResult(); if (!CollectionUtils.isEmpty(owners)) { List<OwnerSrvMdl> ownerSrvMdlList = new ArrayList<OwnerSrvMdl>(owners.size()); for (Owner owner : owners) { ownerSrvMdlList.add(ResponseTranslator.transform(owner)); } responseMessage.setResult(new OwnerSrvMdlList(ownerSrvMdlList)); } } return Response.ok(responseMessage).build(); } catch (Exception ex) { ex.printStackTrace(); } return Response.ok(ServiceResponse.failure()).build(); }
@MetaData(title = "树形表格数据") public HttpHeaders treeGridData() { Map<String, Menu> menuDatas = Maps.newLinkedHashMap(); String nodeid = this.getParameter("nodeid"); if (StringUtils.isNotBlank(nodeid)) { Menu parent = menuService.findOne(nodeid); List<Menu> children = menuService.findChildren(parent); for (Menu menu : children) { menu.addExtraAttribute("level", menu.getLevel()); menu.addExtraAttribute("parent", nodeid); menu.addExtraAttribute( "isLeaf", CollectionUtils.isEmpty(menuService.findChildren(menu)) ? true : false); menu.addExtraAttribute("expanded", false); menu.addExtraAttribute("loaded", true); menuDatas.put(menu.getId(), menu); } } else { GroupPropertyFilter groupFilter = GroupPropertyFilter.buildGroupFilterFromHttpRequest(entityClass, getRequest()); if (groupFilter.isEmpty()) { groupFilter.and(new PropertyFilter(MatchType.NU, "parent", true)); } List<Menu> menus = menuService.findByFilters(groupFilter, new Sort(Direction.DESC, "parent", "orderRank")); for (Menu menu : menus) { loopTreeGridData(menuDatas, menu, false); } } setModel(menuDatas.values()); return buildDefaultHttpHeaders(); }
public int getDevicesSize() { int size = 0; if (!CollectionUtils.isEmpty(this.getDevices())) { size = this.getDevices().size(); } return size; }
@Override public List<Consulta> getConcimientosVinculados(HashMap filters) { List<Consulta> lista = new ArrayList<Consulta>(); try { ContenidoDao contenidoDao = (ContenidoDao) ServiceFinder.findBean("ContenidoDao"); List<HashMap> consulta = contenidoDao.getConcimientosVinculados(filters); if (!CollectionUtils.isEmpty(consulta)) { for (HashMap map : consulta) { Consulta c = new Consulta(); c.setId((BigDecimal) map.get("ID")); c.setIdconocimiento((BigDecimal) map.get("IDCONOCIMIENTO")); c.setCodigo((String) map.get("NUMERO")); c.setNombre((String) map.get("NOMBRE")); c.setSumilla((String) map.get("SUMILLA")); c.setFechaPublicacion((Date) map.get("FECHA")); c.setIdCategoria((BigDecimal) map.get("IDCATEGORIA")); c.setCategoria((String) map.get("CATEGORIA")); c.setIdTipoConocimiento((BigDecimal) map.get("IDTIPOCONOCIMIENTO")); c.setTipoConocimiento((String) map.get("TIPOCONOCIMIENTO")); c.setIdEstado((BigDecimal) map.get("IDESTADO")); c.setEstado((String) map.get("ESTADO")); lista.add(c); } } } catch (Exception e) { e.getMessage(); e.printStackTrace(); } return lista; }
@Override public void handle(ServerHttpRequest request, ServerHttpResponse response) throws IOException { if (!HttpMethod.GET.equals(request.getMethod())) { sendMethodNotAllowed(response, Arrays.asList(HttpMethod.GET)); return; } String content = String.format(IFRAME_CONTENT, getSockJsClientLibraryUrl()); byte[] contentBytes = content.getBytes(Charset.forName("UTF-8")); StringBuilder builder = new StringBuilder("\"0"); DigestUtils.appendMd5DigestAsHex(contentBytes, builder); builder.append('"'); String etagValue = builder.toString(); List<String> ifNoneMatch = request.getHeaders().getIfNoneMatch(); if (!CollectionUtils.isEmpty(ifNoneMatch) && ifNoneMatch.get(0).equals(etagValue)) { response.setStatusCode(HttpStatus.NOT_MODIFIED); return; } response .getHeaders() .setContentType(new MediaType("text", "html", Charset.forName("UTF-8"))); response.getHeaders().setContentLength(contentBytes.length); addCacheHeaders(response); response.getHeaders().setETag(etagValue); response.getBody().write(contentBytes); }
/** * Initialize the PersistenceManagerFactory for the given location. * * @throws IllegalArgumentException in case of illegal property values * @throws IOException if the properties could not be loaded from the given location * @throws JDOException in case of JDO initialization errors */ public void afterPropertiesSet() throws IllegalArgumentException, IOException, JDOException { if (this.persistenceManagerFactoryName != null) { if (this.configLocation != null || !this.jdoPropertyMap.isEmpty()) { throw new IllegalStateException( "'configLocation'/'jdoProperties' not supported in " + "combination with 'persistenceManagerFactoryName' - specify one or the other, not both"); } if (logger.isInfoEnabled()) { logger.info( "Building new JDO PersistenceManagerFactory for name '" + this.persistenceManagerFactoryName + "'"); } this.persistenceManagerFactory = newPersistenceManagerFactory(this.persistenceManagerFactoryName); } else { Map<String, Object> mergedProps = new HashMap<String, Object>(); if (this.configLocation != null) { if (logger.isInfoEnabled()) { logger.info("Loading JDO config from [" + this.configLocation + "]"); } CollectionUtils.mergePropertiesIntoMap( PropertiesLoaderUtils.loadProperties(this.configLocation), mergedProps); } mergedProps.putAll(this.jdoPropertyMap); logger.info("Building new JDO PersistenceManagerFactory"); this.persistenceManagerFactory = newPersistenceManagerFactory(mergedProps); } // Build default JdoDialect if none explicitly specified. if (this.jdoDialect == null) { this.jdoDialect = new DefaultJdoDialect(this.persistenceManagerFactory.getConnectionFactory()); } }
@Override @GET @Path("/vets") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response findAllVets() { try { Result<List<Vet>> response = petClinicMgr.findAllVets(); ServiceResponse<VetSrvMdlList> responseMessage = ResponseTranslator.toServiceResponse(response); if (response.isSuccess()) { List<Vet> vets = response.getResult(); if (!CollectionUtils.isEmpty(vets)) { List<VetSrvMdl> vetSrvMdls = new ArrayList<VetSrvMdl>(vets.size()); for (Vet vet : vets) { vetSrvMdls.add(ResponseTranslator.transform(vet)); } VetSrvMdlList vetSrvMdlList = new VetSrvMdlList(vetSrvMdls); responseMessage.setResult(vetSrvMdlList); } } return Response.ok(responseMessage).build(); } catch (Exception ex) { ex.printStackTrace(); } return Response.ok(ServiceResponse.failure()).build(); }
protected static Predicate getPredicate( final Class clazz, final Map<String, String[]> searchTerms, Root<Persistable> root, CriteriaBuilder cb) { LinkedList<Predicate> predicates = new LinkedList<Predicate>(); Predicate predicate; if (!CollectionUtils.isEmpty(searchTerms)) { Set<String> propertyNames = searchTerms.keySet(); // put aside nested AND/OR param groups NestedJunctions junctions = new NestedJunctions(); for (String propertyName : propertyNames) { String[] values = searchTerms.get(propertyName); if (!junctions.addIfNestedJunction(propertyName, values)) { addPredicate(clazz, root, cb, predicates, values, propertyName); } } // add nested AND/OR param groups Map<String, Map<String, String[]>> andJunctions = junctions.getAndJunctions(); addJunctionedParams(clazz, root, cb, predicates, andJunctions, AND); Map<String, Map<String, String[]>> orJunctions = junctions.getOrJunctions(); addJunctionedParams(clazz, root, cb, predicates, orJunctions, OR); } if (searchTerms.containsKey(SEARCH_MODE) && searchTerms.get(SEARCH_MODE)[0].equalsIgnoreCase(OR)) { predicate = cb.or(predicates.toArray(new Predicate[predicates.size()])); } else { predicate = cb.and(predicates.toArray(new Predicate[predicates.size()])); } return predicate; }
@Override @GET @Path("/petTypes") @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public Response findPetTypes() { try { Result<List<PetType>> response = petClinicMgr.findAllPetTypes(); ServiceResponse<PetTypeSrvMdlList> responseMessage = ResponseTranslator.toServiceResponse(response); if (response.isSuccess()) { List<PetType> petTypeList = response.getResult(); if (!CollectionUtils.isEmpty(petTypeList)) { List<PetTypeSrvMdl> petTypeSrvMdlList = new ArrayList<PetTypeSrvMdl>(petTypeList.size()); for (PetType petType : petTypeList) { petTypeSrvMdlList.add(ResponseTranslator.transform(petType)); } responseMessage.setResult(new PetTypeSrvMdlList(petTypeSrvMdlList)); } } return Response.ok(responseMessage).build(); } catch (Exception ex) { ex.printStackTrace(); } return Response.ok(ServiceResponse.failure()).build(); }
private List<View> getCandidateViews( String viewName, Locale locale, List<MediaType> requestedMediaTypes) throws Exception { List<View> candidateViews = new ArrayList<View>(); for (ViewResolver viewResolver : this.viewResolvers) { View view = viewResolver.resolveViewName(viewName, locale); if (view != null) { candidateViews.add(view); } for (MediaType requestedMediaType : requestedMediaTypes) { List<String> extensions = getExtensionsForMediaType(requestedMediaType); for (String extension : extensions) { String viewNameWithExtension = viewName + "." + extension; view = viewResolver.resolveViewName(viewNameWithExtension, locale); if (view != null) { candidateViews.add(view); } } } } if (!CollectionUtils.isEmpty(this.defaultViews)) { candidateViews.addAll(this.defaultViews); } return candidateViews; }
/** * This is a hook/hack for assign reviewer/submit for review, which has potential of multiple * reviewers reviewers are supposed to be processed separately, but for 'prompt user', it merged * into one prompt. 'reviewer role' are the same, but the role qualifiers' are different which is * based on context. the role qualifier are populated when we merge all recipients in to one list. * So, when sendnotification, it is just using the last 'context', so at this point, we don't want * rolequalifiers being populated again. If it is populated again, all reviewer role will retrieve * same reviewer because the context are the same at the point of 'send'. Unless, there is better * approach, we'll stick with this hack for now. isPopulateRole is only 'true' for this case, so * the other cases will stay the same as before this change. * * @see * org.kuali.coeus.common.notification.impl.NotificationContextBase#populateRoleQualifiers(org.kuali.coeus.common.notification.impl.bo.NotificationTypeRecipient) */ @Override public void populateRoleQualifiers(NotificationTypeRecipient notificationRecipient) throws UnknownRoleException { if (CollectionUtils.isEmpty(notificationRecipient.getRoleQualifiers())) { super.populateRoleQualifiers(notificationRecipient); } }
/** * Set the mappings of format discriminators to view class names. The default mappings are: * * <p> * * <ul> * <li>{@code csv} - {@code JasperReportsCsvView} * <li>{@code html} - {@code JasperReportsHtmlView} * <li>{@code pdf} - {@code JasperReportsPdfView} * <li>{@code xls} - {@code JasperReportsXlsView} * </ul> */ public void setFormatMappings( Map<String, Class<? extends AbstractJasperReportsView>> formatMappings) { if (CollectionUtils.isEmpty(formatMappings)) { throw new IllegalArgumentException("'formatMappings' must not be empty"); } this.formatMappings = formatMappings; }
protected static Predicate getPredicate( final Class clazz, final Restriction searchTerms, Root<Persistable> root, CriteriaBuilder cb) { LinkedList<Predicate> predicates = new LinkedList<Predicate>(); Predicate predicate; // process child restrictions if (!CollectionUtils.isEmpty(searchTerms.getRestrictions())) { for (Restriction restriction : searchTerms.getRestrictions()) { predicates.add(getPredicate(clazz, restriction, root, cb)); } } // process main restriction if (StringUtils.isNotBlank(searchTerms.getField())) { String propertyName = searchTerms.getField(); addPredicate( clazz, root, cb, predicates, searchTerms.getValues().toArray(new String[searchTerms.getValues().size()]), propertyName); } if (searchTerms.getJunction().equals(Restriction.Junction.OR)) { predicate = cb.or(predicates.toArray(new Predicate[predicates.size()])); } else { predicate = cb.and(predicates.toArray(new Predicate[predicates.size()])); } return predicate; }
public static void main(String[] args) { String jsonText = "{\"total\": \"zcKQCrrWbv\",\"fieldHeaderList\": [{" + "\"fieldId\": 5313," + "\"fieldName\": \"FCIDWAWSEB\"," + "\"fieldType\": 69231," + "\"selected\": true," + "\"ordered\": 35999," + "\"moduleType\": 86580" + "}]," + "\"activityLevelHeader\": \"rfIfHljtmc\"," + "\"goodsChioceHeader\": \"QSkAkCGbGZ\"," + "\"code\": 200," + "\"pageInfo\": {" + "\"total\": 74236," + "\"pageSize\": \"OmJABqsBxj\"," + "\"currentPage\": \"tDiLdYOLRg\"}," + "\"msg\": \"wAjzDduCgu\"}"; Map<String, Object> map = toMap(jsonText); if (!CollectionUtils.isEmpty(map)) { for (Entry<String, Object> entry : map.entrySet()) { System.out.println(entry.getKey() + ":" + entry.getValue()); } } }
@Transactional(readOnly = true) public List<Dictionary> findByIds(List<String> ids) throws Exception { if (CollectionUtils.isEmpty(ids)) { return null; } return dictionaryDao.findByIds(ids); }
public static void getVcenterTenantOptions(String id) { List<TenantOrgRestRep> vCenterTenantOptions = new ArrayList<TenantOrgRestRep>(); if (StringUtils.isBlank(id) || id.equalsIgnoreCase("null")) { renderJSON(vCenterTenantOptions); return; } List<ACLEntry> vcenterAcls = VCenterUtils.getAcl(uri(id)); if (CollectionUtils.isEmpty(vcenterAcls)) { renderJSON(vCenterTenantOptions); return; } addNoneTenantOption(id, vCenterTenantOptions); Iterator<ACLEntry> aclEntryIterator = vcenterAcls.iterator(); while (aclEntryIterator.hasNext()) { ACLEntry aclEntry = aclEntryIterator.next(); if (aclEntry == null) { continue; } TenantOrgRestRep tenantOrgRestRep = TenantUtils.getTenant(aclEntry.getTenant()); if (tenantOrgRestRep != null) { vCenterTenantOptions.add(tenantOrgRestRep); } } renderJSON(vCenterTenantOptions); }