List of usage examples for java.util List contains
boolean contains(Object o);
From source file:com.evolveum.midpoint.repo.sql.data.common.RObjectTextInfo.java
private static void append(List<String> allWords, String text, PrismContext prismContext) { if (StringUtils.isBlank(text)) { return;/*from ww w.j av a2s . c o m*/ } String normalized = prismContext.getDefaultPolyStringNormalizer().normalize(text); String[] words = StringUtils.split(normalized); for (String word : words) { if (StringUtils.isNotBlank(word)) { if (!allWords.contains(word)) { allWords.add(word); } } } }
From source file:com.glaf.core.util.IdentityUtils.java
/** * ???//from w ww.ja v a2s . c o m * * @param sqlSession * @param statement * @param paramMap * @return */ public static List<String> getActorIds(SqlSession sqlSession, String statement, Map<String, Object> paramMap) { List<String> actorIds = new java.util.ArrayList<String>(); MyBatisEntityDAO entityDAO = new MyBatisEntityDAO(sqlSession); List<Object> rows = entityDAO.getList(statement, paramMap); if (rows != null && !rows.isEmpty()) { for (Object object : rows) { if (object instanceof com.glaf.core.identity.User) { String actorId = ((com.glaf.core.identity.User) object).getActorId(); if (!actorIds.contains(actorId)) { actorIds.add(actorId); } } else if (object instanceof String) { String actorId = (String) object; if (!actorIds.contains(actorId)) { actorIds.add(actorId); } } } } return actorIds; }
From source file:com.jslsolucoes.tagria.lib.util.TagUtil.java
public static String queryString(HttpServletRequest request, List<String> excludesParams) throws UnsupportedEncodingException { List<String> queryString = new ArrayList<>(); Enumeration<String> en = request.getParameterNames(); while (en.hasMoreElements()) { String paramName = en.nextElement(); if (!excludesParams.contains(paramName)) queryString.add(paramName + "=" + URLEncoder.encode(request.getParameter(paramName), "UTF-8")); }//from w ww .ja v a 2s. c om return StringUtils.join(queryString, '&'); }
From source file:org.codehaus.grepo.procedure.compile.ProcedureCompilationUtils.java
/** * Collects all OUT params based on the given {@link ProcedureMethodParameterInfo}. * * @param pmpi The procedure method parameter info. * @param context The procedure execution context. * @return Returns a list containing all (out) {@link ProcedureParamDescriptor}s. *//* w ww .jav a 2 s . co m*/ public static List<ProcedureParamDescriptor> collectOutParams(ProcedureMethodParameterInfo pmpi, ProcedureExecutionContext context) { Logger logger = getLogger(); List<ProcedureParamDescriptor> result = new ArrayList<ProcedureParamDescriptor>(); List<String> handeledParams = new ArrayList<String>(); Out outAnnotation = pmpi.getMethodAnnotation(Out.class); if (outAnnotation != null) { if (handeledParams.contains(outAnnotation.name())) { logger.warn(DUPLICATE_PARAM_WARNING, outAnnotation.name()); } else { result.add(createParamDescriptor(outAnnotation, context)); handeledParams.add(outAnnotation.name()); } } OutParams outParamsAnnotation = pmpi.getMethodAnnotation(OutParams.class); if (outParamsAnnotation != null) { for (Out out : outParamsAnnotation.value()) { if (handeledParams.contains(out.name())) { logger.warn(DUPLICATE_PARAM_WARNING, out.name()); } else { result.add(createParamDescriptor(out, context)); handeledParams.add(out.name()); } } } return result; }
From source file:pl.betoncraft.betonquest.editor.model.PackageSet.java
public static PackageSet loadFromZip(ZipFile file) throws IOException, PackageNotFoundException { HashMap<String, HashMap<String, InputStream>> setMap = new HashMap<>(); Enumeration<? extends ZipEntry> entries = file.entries(); String setName = file.getName().substring(file.getName().lastIndexOf(File.separatorChar) + 1) .replace(".zip", ""); // extract correct entries from the zip file while (true) { try {// www . j a va2 s . c o m ZipEntry entry = entries.nextElement(); String entryName = entry.getName(); // get the correct path separator (both can be used) char separator = (entryName.contains("/") ? '/' : '\\'); // index of first separator used to get set name int index = entryName.indexOf(separator); // skip entry if there are no path separators (files in zip root like license, readme etc.) if (index < 0) { continue; } if (!entryName.endsWith(".yml")) { continue; } String[] parts = entryName.split(Pattern.quote(String.valueOf(separator))); String ymlName = parts[parts.length - 1].substring(0, parts[parts.length - 1].length() - 4); StringBuilder builder = new StringBuilder(); int length = parts.length - 1; boolean conversation = false; if (parts[length - 1].equals("conversations")) { length--; conversation = true; } for (int i = 0; i < length; i++) { builder.append(parts[i] + '-'); } String packName = builder.substring(0, builder.length() - 1); HashMap<String, InputStream> packMap = setMap.get(packName); if (packMap == null) { packMap = new HashMap<>(); setMap.put(packName, packMap); } List<String> allowedNames = Arrays .asList(new String[] { "main", "events", "conditions", "objectives", "journal", "items" }); if (conversation) { packMap.put("conversations." + ymlName, file.getInputStream(entry)); } else { if (allowedNames.contains(ymlName)) { packMap.put(ymlName, file.getInputStream(entry)); } } } catch (NoSuchElementException e) { break; } } PackageSet set = parseStreams(setName, setMap); BetonQuestEditor.getInstance().getSets().add(set); RootController.setPackages(BetonQuestEditor.getInstance().getSets()); return set; }
From source file:org.codehaus.grepo.procedure.compile.ProcedureCompilationUtils.java
/** * Collects all IN params based on the given {@link ProcedureMethodParameterInfo}. * * @param pmpi The procedure method parameter info. * @param context The procedure execution context. * @return Returns a list containing all (in) {@link ProcedureParamDescriptor}s. *//*w ww. jav a 2 s.c om*/ public static List<ProcedureParamDescriptor> collectInParams(ProcedureMethodParameterInfo pmpi, ProcedureExecutionContext context) { Logger logger = getLogger(); List<ProcedureParamDescriptor> result = new ArrayList<ProcedureParamDescriptor>(); List<String> handeledParams = new ArrayList<String>(); In inAnnotation = pmpi.getMethodAnnotation(In.class); if (inAnnotation != null) { if (handeledParams.contains(inAnnotation.name())) { logger.warn(DUPLICATE_PARAM_WARNING, inAnnotation.name()); } else { result.add(createParamDescriptor(inAnnotation, context)); handeledParams.add(inAnnotation.name()); } } InParams inParamsAnnotation = pmpi.getMethodAnnotation(InParams.class); if (inParamsAnnotation != null) { for (In in : inParamsAnnotation.value()) { if (handeledParams.contains(in.name())) { logger.warn(DUPLICATE_PARAM_WARNING, in.name()); } else { result.add(createParamDescriptor(in, context)); handeledParams.add(in.name()); } } } List<In> inAnnotationList = pmpi.getParameterAnnotations(In.class); for (In in : inAnnotationList) { if (handeledParams.contains(in.name())) { logger.warn(DUPLICATE_PARAM_WARNING, in.name()); } else { result.add(createParamDescriptor(in, context)); handeledParams.add(in.name()); } } return result; }
From source file:controllers.group.GroupMsgApp.java
@BodyParser.Of(BodyParser.Json.class) @Transactional/*from w w w.ja v a 2s . c om*/ public static Result invitMembers() throws IOException { User currentUser = User.getFromSession(session()); ObjectNodeResult result = new ObjectNodeResult(); JsonNode json = request().body().asJson(); Long groupId = json.findPath("groupId").asLong(); Group group = Group.queryGroupById(groupId); if (group == null) return ok(result.errorkey("group.error.nofound").getObjectNode()); // String content = json.findPath("content").asText(); Iterator<JsonNode> userIds = json.findPath("userIds").iterator(); List<User> userList = Group.queryUserListOfGroup(groupId); // ? while (userIds.hasNext()) { Long userId = userIds.next().asLong(); if (group.getType() == Group.Type.MULTICOMMUNICATE) { // ???? ChatService.appendMemberToGroup(groupId, userId); } else { User recevierUser = User.findById(userId); if (!userList.contains(recevierUser)) { MessageService.pushMsgInvitMember(currentUser, recevierUser, group); } } } return ok(result.getObjectNode()); }
From source file:com.glaf.core.util.IdentityUtils.java
/** * ??//from www. j a va2 s . com * * @param actorId * @return */ public static List<String> getLeaderIds(SqlSession sqlSession, String userId) { Map<String, Object> paramMap = new java.util.HashMap<String, Object>(); paramMap.put("actorId", userId); String statementId = CustomProperties.getString("sys.getLeaders"); if (StringUtils.isEmpty(statementId)) { statementId = "getLeaders"; } List<String> actorIds = new java.util.ArrayList<String>(); MyBatisEntityDAO entityDAO = new MyBatisEntityDAO(sqlSession); List<Object> rows = entityDAO.getList(statementId, paramMap); if (rows != null && rows.size() > 0) { for (Object object : rows) { if (object instanceof com.glaf.core.identity.User) { String actorId = ((com.glaf.core.identity.User) object).getActorId(); if (!actorIds.contains(actorId)) { actorIds.add(actorId); } } else if (object instanceof String) { String actorId = (String) object; if (!actorIds.contains(actorId)) { actorIds.add(actorId); } } } } return actorIds; }
From source file:com.icesoft.faces.context.effects.LocalEffectEncoder.java
public static void encodeLocalEffects(UIComponent comp, Element rootNode, FacesContext facesContext, ResponseWriter writer, boolean attribTracking, List attributesThatAreSet) { if (attribTracking && (attributesThatAreSet == null || attributesThatAreSet.size() == 0)) { return;/*ww w . j a v a 2 s . com*/ } Map atts = comp.getAttributes(); try { for (int i = 0; i < EVENTS.length; i++) { if (attribTracking && (attributesThatAreSet == null || !attributesThatAreSet.contains(EFFECTS[i]))) { continue; } Effect fx = (Effect) atts.get(EFFECTS[i]); if (fx == null) { // in some cases the value binding can be null on the initial render // but contain an effect later. This makes a place holder for that effect // once it arrives. if (comp.getValueBinding(EFFECTS[i]) != null) { fx = new BlankEffect(); } } if (fx != null) { String value = JavascriptContext.applyEffect(fx, comp.getClientId(facesContext), facesContext); String original; if (attribTracking && (attributesThatAreSet == null || !attributesThatAreSet.contains(ATTRIBUTES[i]))) { original = null; } else { original = (String) atts.get(ATTRIBUTES[i]); } String together = DomBasicRenderer.combinedPassThru(value, original); if (together != null) { if (rootNode != null) { rootNode.setAttribute(ATTRIBUTES[i], together); } else if (writer != null) { writer.writeAttribute(ATTRIBUTES[i], together, null); } } } } } catch (Exception e) { if (log.isErrorEnabled()) { log.error(e.getMessage(), e); } } }
From source file:org.codehaus.grepo.procedure.compile.ProcedureCompilationUtils.java
/** * Collects all INOUT params based on the given {@link ProcedureMethodParameterInfo}. * * @param pmpi The procedure method parameter info. * @param context The procedure execution context. * @return Returns a list containing all (inout) {@link ProcedureParamDescriptor}s. */// w w w.j a v a 2 s .c om public static List<ProcedureParamDescriptor> collectInOutParams(ProcedureMethodParameterInfo pmpi, ProcedureExecutionContext context) { Logger logger = getLogger(); List<ProcedureParamDescriptor> result = new ArrayList<ProcedureParamDescriptor>(); List<String> handeledParams = new ArrayList<String>(); InOut inOutAnnotation = pmpi.getMethodAnnotation(InOut.class); if (inOutAnnotation != null) { if (handeledParams.contains(inOutAnnotation.name())) { logger.warn(DUPLICATE_PARAM_WARNING, inOutAnnotation.name()); } else { result.add(createParamDescriptor(inOutAnnotation, context)); handeledParams.add(inOutAnnotation.name()); } } InOutParams inoutParamsAnnotation = pmpi.getMethodAnnotation(InOutParams.class); if (inoutParamsAnnotation != null) { for (InOut inout : inoutParamsAnnotation.value()) { if (handeledParams.contains(inout.name())) { logger.warn(DUPLICATE_PARAM_WARNING, inout.name()); } else { result.add(createParamDescriptor(inout, context)); handeledParams.add(inout.name()); } } } List<InOut> inoutAnnotationList = pmpi.getParameterAnnotations(InOut.class); for (InOut inout : inoutAnnotationList) { if (handeledParams.contains(inout.name())) { logger.warn(DUPLICATE_PARAM_WARNING, inout.name()); } else { result.add(createParamDescriptor(inout, context)); handeledParams.add(inout.name()); } } return result; }