List of usage examples for org.apache.commons.lang ArrayUtils contains
public static boolean contains(boolean[] array, boolean valueToFind)
Checks if the value is in the given array.
From source file:com.redhat.rhn.frontend.action.monitoring.notification.BaseFilterEditAction.java
private void processContactGroups(DynaActionForm form, ModifyFilterCommand cmd) { String[] groups = form.getStrings(CONTACT_GROUPS); if (ArrayUtils.contains(groups, CONTACT_GROUPS_ALL)) { // Erase any restriction by contact group groups = new String[0]; }/* ww w . j av a 2s .c o m*/ cmd.updateContactGroups(groups); }
From source file:com.kbotpro.randoms.GraveDigger.java
/** * Gets called if canRun() returns true. *///from w ww .j a v a 2 s. c om public synchronized void onStart() { finished = false; tookAllCoffins = false; id = -1; idx = -1; KTimer timeout = new KTimer(600000); main: while (!botEnv.randomManager.scriptStopped && isLoggedIn() && !timeout.isDone() && (mausoleum = objects.getClosestObject(20, MAUSOLEUM_ID)) != null) { IComponent iface; if (getMyPlayer().isMoving() || getMyPlayer().getAnimation() != -1) { sleep(50, 100); continue; } else if (interfaces.clickContinue()) { sleep(900, 1200); continue; } IComponent[] leftValuables = interfaces.getInterfaces("No - I haven't left any valuables"); if (leftValuables.length > 0 && leftValuables[0].isVisible()) { leftValuables[0].doClick(); sleep(900, 1200); continue; } else if ((iface = getIComponent("Yes, ")) != null && iface.isValid() && iface.isVisible()) { iface.doClick(); sleep(500, 800); continue; } else if ((iface = interfaces.getComponent(INSTRUCTION_INTERFACE, CLOSE_CHILD_ID)) != null && iface.isVisible()) { iface.doClick(); sleep(500, 800); continue; } if (game.getCurrentTab() != Game.TAB_INVENTORY && !interfaces.interfaceExists(11)) { game.openTab(Game.TAB_INVENTORY); sleep(random(800, 1200)); continue; } if ((inventory.getCount() - inventory.getCount(false, COFFIN_IDS)) > 23 || interfaces.interfaceExists(11)) { if (!interfaces.interfaceExists(11)) { PhysicalObject o = objects.getClosestObject(30, DEPOSIT_BOX); if (o != null) { if (getDistanceTo(o.getLocation()) > 5 || !o.onScreen()) { walking.walkToMM(o.getLocation()); } camera.setAngle(camera.getAngleTo(o.getLocation())); o.doAction("Deposit"); sleep(random(800, 1200)); continue; } } else { IComponent[] deposit = interfaces.getComponent(11, 17).getChildren(); int depositedCount = 0; for (IComponent i : deposit) { if (depositedCount >= 5) break; if (i.getElementID() != -1 && !getAllDoNoDeposit().contains(i.getElementID()) && i.getElementStackSize() == 1) { if (i.doAction("Deposit-1")) { depositedCount++; } } } if (depositedCount == 0) { interfaces.getComponent(11, 18).doClick(); } interfaces.getComponent(11, 15).doClick(); sleep(1000, 2000); continue; } } if (finished) { NPC leo = npcs.getClosest(20, LEO_ID); if (leo.onScreen()) { if (game.hasSelectedItem()) { menu.atMenu("Cancel"); } leo.doAction("talk"); } else walking.walkToMM(leo.getLocation()); } else if (tookAllCoffins) { // Dunno if this bit will work! curGrave.getUID() == objects.getObjectAt(curGrave.getLocation().getUID())) if (curGrave != null && curGrave.getID() == objects.getObjectsAt(curGrave.getLocation())[0].getID()) { if (idx != -1) { //We know the grave's index somethingy... if (id != -1) { //We know the coffin id, lets use it on the grave if (curGrave.onScreen()) { inventory.atItem(id, "Use"); sleep(50, 100); if (curGrave.doAction("Use")) { waitForAnimation(827); } } else { walking.walkToMM(curGrave.getLocation()); } } else { //We don't know the coffin id, lets find it out for (Item coffin : inventory.getItems()) { if (ArrayUtils.contains(COFFIN_IDS, coffin.getID())) { inventory.atItem(coffin.getID(), "Check"); sleep(1500, 3000); if (idx == getCoffinIndex()) { id = coffin.getID(); while (interfaces.getComponent(COFFIN_INTERFACE_ID, 12) != null && !clickExit(interfaces.getComponent(COFFIN_INTERFACE_ID, 12))) { sleep(800, 1200); } continue main; } } } } } else { //We don't know the grave's index somethingy, lets find it out int graveIdx = ArrayUtils.indexOf(EMPTY_GRAVE_IDS, curGrave.getID()); if (curStone != null && curStone.getID() == objects .getClosestObject(20, GRAVESTONE_IDS[graveIdx]).getID()) { if (getGravestoneIndex() != -1) { idx = getGravestoneIndex(); while (interfaces.getComponent(GRAVESTONE_INTERFACE_ID, 3) != null && clickExit(interfaces.getComponent(GRAVESTONE_INTERFACE_ID, 3))) { //clickExit(interfaces.getComponent(GRAVESTONE_INTERFACE_ID, 3)); sleep(800, 1200); } } else { if (curStone.onScreen()) { if (game.hasSelectedItem()) { menu.atMenu("Cancel"); } //curStone.doAction("Read"); mouse.moveMouse(curStone.getScreenPos()); menu.atMenu("Read"); } else walking.walkToMM(curStone.getLocation()); } } else { curStone = objects.getClosestObject(20, GRAVESTONE_IDS[graveIdx]); sleep(50, 100); continue main; } } } else { id = -1; idx = -1; curGrave = objects.getClosestObject(20, EMPTY_GRAVE_IDS); if (curGrave == null) finished = true; sleep(50, 100); continue main; } } else { //PhysicalObject obj = objects.getClosestObject(20, FILLED_GRAVE_IDS); PhysicalObject obj = getClosestObj(FILLED_GRAVE_IDS); if (obj != null) { if (obj.onScreen()) { //obj.doAction("Take-coffin"); mouse.moveMouse(obj.getScreenPos()); sleep(10, 50); if (botEnv.menu.atMenu("Take-coffin")) { waitForAnimation(827); } } else walking.walkToMM(obj.getLocation()); } else { tookAllCoffins = true; } } sleep(1000, 2000); } sleep(1000, 2000); while (game.getGameState() == 25) sleep(500, 1000); if (interfaces.canContinue()) { interfaces.clickContinue(); sleep(1000, 2000); } if (timeout.isDone()) { botEnv.scriptManager.stopAllScripts(); } }
From source file:javacommon.excel.ExcelReader.java
/** * ???// w w w. jav a2s. c om * * @param c ? * @return */ private String getCellStringValue(Cell c) { if (c == null) { return ""; } String value = null; NumberFormat nf = NumberFormat.getInstance(); nf.setGroupingUsed(false); nf.setMaximumFractionDigits(12); switch (c.getCellType()) { case Cell.CELL_TYPE_BOOLEAN: value = String.valueOf(c.getBooleanCellValue()); break; case Cell.CELL_TYPE_NUMERIC: if (DateUtil.isCellDateFormatted(c)) { return DateFormatUtils.ISO_DATE_FORMAT.format(c.getDateCellValue()); } else if ("@".equals(c.getCellStyle().getDataFormatString())) { value = nf.format(c.getNumericCellValue()); } else if ("General".equals(c.getCellStyle().getDataFormatString())) { value = nf.format(c.getNumericCellValue()); } else if (ArrayUtils.contains(ExcelConstants.DATE_PATTERNS, c.getCellStyle().getDataFormatString())) { value = DateFormatUtils.format(HSSFDateUtil.getJavaDate(c.getNumericCellValue()), c.getCellStyle().getDataFormatString()); } else { value = nf.format(c.getNumericCellValue()); } break; case Cell.CELL_TYPE_STRING: value = c.getStringCellValue(); break; case Cell.CELL_TYPE_FORMULA: value = c.getCellFormula(); break; } return value == null ? "" : value.trim(); }
From source file:com.athena.chameleon.engine.core.analyzer.parser.WebXMLParser.java
/** * <pre>/* ww w. j a v a 2 s . c om*/ * web.xml ?? ? filter ? filter-mapping? , UTF-8? filter ? ? * filter UTF-8? filter ? filter-mapping? . * </pre> * @param obj * @param path * @return * @throws JAXBException * @throws IOException */ private Object checkEncodignFilter(Object obj, String path) throws JAXBException, IOException { String[] charSet = { "UTF-8", "UTF8" }; boolean hasEncodingFilter = false; boolean hasUTF8EncodingFilter = false; if (obj instanceof com.athena.chameleon.engine.entity.xml.webapp.v2_5.WebAppType) { com.athena.chameleon.engine.entity.xml.webapp.v2_5.WebAppType webApp = (com.athena.chameleon.engine.entity.xml.webapp.v2_5.WebAppType) obj; // webApp? <filter />, <filter-mapping />? ? List<JAXBElement<?>> elementList = webApp.getDescriptionAndDisplayNameAndIcon(); Object o = null; List<com.athena.chameleon.engine.entity.xml.webapp.v2_5.ParamValueType> paramList = null; com.athena.chameleon.engine.entity.xml.webapp.v2_5.FilterNameType filtername = null; for (JAXBElement<?> element : elementList) { o = element.getValue(); if (o instanceof com.athena.chameleon.engine.entity.xml.webapp.v2_5.FilterType) { filtername = ((com.athena.chameleon.engine.entity.xml.webapp.v2_5.FilterType) o) .getFilterName(); paramList = ((com.athena.chameleon.engine.entity.xml.webapp.v2_5.FilterType) o).getInitParam(); for (com.athena.chameleon.engine.entity.xml.webapp.v2_5.ParamValueType param : paramList) { // init-param? param-name? encoding? ? if (param.getParamName().getValue().toLowerCase().equals("encoding")) { hasEncodingFilter = true; // param-value UTF-8? ? if (ArrayUtils.contains(charSet, param.getParamValue().getValue().toUpperCase())) { hasUTF8EncodingFilter = true; break; } } } if (hasEncodingFilter) { break; } } } // encoding filter UTF-8? ? filter ? filter-mapping . if (hasEncodingFilter && !hasUTF8EncodingFilter) { JAXBElement<?> f = null; JAXBElement<?> fm = null; for (JAXBElement<?> element : elementList) { o = element.getValue(); if (o instanceof com.athena.chameleon.engine.entity.xml.webapp.v2_5.FilterType) { if (((com.athena.chameleon.engine.entity.xml.webapp.v2_5.FilterType) o).getFilterName() .getValue().equals(filtername.getValue())) { f = element; } } else if (o instanceof com.athena.chameleon.engine.entity.xml.webapp.v2_5.FilterMappingType) { if (((com.athena.chameleon.engine.entity.xml.webapp.v2_5.FilterMappingType) o) .getFilterName().getValue().equals(filtername.getValue())) { fm = element; } } } webApp.getDescriptionAndDisplayNameAndIcon().remove(f); webApp.getDescriptionAndDisplayNameAndIcon().remove(fm); } if (!hasUTF8EncodingFilter) { // <filter> element com.athena.chameleon.engine.entity.xml.webapp.v2_5.FilterType filter = new com.athena.chameleon.engine.entity.xml.webapp.v2_5.FilterType(); com.athena.chameleon.engine.entity.xml.webapp.v2_5.FilterNameType filterName = new com.athena.chameleon.engine.entity.xml.webapp.v2_5.FilterNameType(); filterName.setValue("UTF_EncodingFilter"); filter.setFilterName(filterName); com.athena.chameleon.engine.entity.xml.webapp.v2_5.FullyQualifiedClassType filterClass = new com.athena.chameleon.engine.entity.xml.webapp.v2_5.FullyQualifiedClassType(); filterClass.setValue("com.osc.filters.SetCharacterEncodingFilter"); filter.setFilterClass(filterClass); // <init-param> element com.athena.chameleon.engine.entity.xml.webapp.v2_5.ParamValueType paramValue = new com.athena.chameleon.engine.entity.xml.webapp.v2_5.ParamValueType(); com.athena.chameleon.engine.entity.xml.webapp.v2_5.String strName = new com.athena.chameleon.engine.entity.xml.webapp.v2_5.String(); strName.setValue("encoding"); com.athena.chameleon.engine.entity.xml.webapp.v2_5.XsdStringType strValue = new com.athena.chameleon.engine.entity.xml.webapp.v2_5.XsdStringType(); strValue.setValue("UTF-8"); paramValue.setParamName(strName); paramValue.setParamValue(strValue); filter.getInitParam().add(paramValue); paramValue = new com.athena.chameleon.engine.entity.xml.webapp.v2_5.ParamValueType(); strName = new com.athena.chameleon.engine.entity.xml.webapp.v2_5.String(); strName.setValue("forceEncoding"); strValue = new com.athena.chameleon.engine.entity.xml.webapp.v2_5.XsdStringType(); strValue.setValue("UTF-8"); paramValue.setParamName(strName); paramValue.setParamValue(strValue); filter.getInitParam().add(paramValue); // <filter-mapping> elemnet com.athena.chameleon.engine.entity.xml.webapp.v2_5.FilterMappingType filterMapping = new com.athena.chameleon.engine.entity.xml.webapp.v2_5.FilterMappingType(); com.athena.chameleon.engine.entity.xml.webapp.v2_5.UrlPatternType urlPattern = new com.athena.chameleon.engine.entity.xml.webapp.v2_5.UrlPatternType(); urlPattern.setValue("/*"); filterMapping.getUrlPatternOrServletName().add(urlPattern); filterMapping.setFilterName(filterName); // <web-app>? filter com.athena.chameleon.engine.entity.xml.webapp.v2_5.ObjectFactory factory = new com.athena.chameleon.engine.entity.xml.webapp.v2_5.ObjectFactory(); webApp.getDescriptionAndDisplayNameAndIcon().add(factory.createWebAppTypeFilter(filter)); webApp.getDescriptionAndDisplayNameAndIcon() .add(factory.createWebAppTypeFilterMapping(filterMapping)); try { // Filter ?? fileCopy(new File(WebXMLParser.class.getResource("/lib/osc-filters.jar").getFile()), new File(path, "lib/osc-filters.jar")); // web.xml String xmlData = JaxbUtils.marshal( com.athena.chameleon.engine.entity.xml.webapp.v2_5.WebAppType.class.getPackage() .getName(), webApp, new String[] { "http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" }); rewrite(new File(path, "web.xml"), xmlData.replaceAll(" standalone=\"yes\"", "").replaceAll(" standalone=\"true\"", "")); logger.debug("web.xml has been modified.\n{}", xmlData); } catch (JAXBException e) { logger.error("JAXBException has occurred.", e); throw e; } catch (IOException e) { logger.error("IOException has occurred.", e); throw e; } } return webApp; } else if (obj instanceof com.athena.chameleon.engine.entity.xml.webapp.v2_4.WebAppType) { com.athena.chameleon.engine.entity.xml.webapp.v2_4.WebAppType webApp = (com.athena.chameleon.engine.entity.xml.webapp.v2_4.WebAppType) obj; // webApp? <filter />, <filter-mapping />? ? List<Object> elementList = webApp.getDescriptionAndDisplayNameAndIcon(); List<com.athena.chameleon.engine.entity.xml.webapp.v2_4.ParamValueType> paramList = null; com.athena.chameleon.engine.entity.xml.webapp.v2_4.FilterNameType filtername = null; for (Object element : elementList) { if (element instanceof com.athena.chameleon.engine.entity.xml.webapp.v2_4.FilterType) { filtername = ((com.athena.chameleon.engine.entity.xml.webapp.v2_4.FilterType) element) .getFilterName(); paramList = ((com.athena.chameleon.engine.entity.xml.webapp.v2_4.FilterType) element) .getInitParam(); for (com.athena.chameleon.engine.entity.xml.webapp.v2_4.ParamValueType param : paramList) { // init-param? param-name? encoding? ? if (param.getParamName().getValue().toLowerCase().equals("encoding")) { hasEncodingFilter = true; // param-value UTF-8? ? if (ArrayUtils.contains(charSet, param.getParamValue().getValue().toUpperCase())) { hasUTF8EncodingFilter = true; break; } } } if (hasEncodingFilter) { break; } } } // encoding filter UTF-8? ? filter ? filter-mapping . if (hasEncodingFilter && !hasUTF8EncodingFilter) { com.athena.chameleon.engine.entity.xml.webapp.v2_4.FilterType f = null; com.athena.chameleon.engine.entity.xml.webapp.v2_4.FilterMappingType fm = null; for (Object element : elementList) { if (element instanceof com.athena.chameleon.engine.entity.xml.webapp.v2_4.FilterType) { if (((com.athena.chameleon.engine.entity.xml.webapp.v2_4.FilterType) element) .getFilterName().getValue().equals(filtername.getValue())) { f = (com.athena.chameleon.engine.entity.xml.webapp.v2_4.FilterType) element; } } else if (element instanceof com.athena.chameleon.engine.entity.xml.webapp.v2_4.FilterMappingType) { if (((com.athena.chameleon.engine.entity.xml.webapp.v2_4.FilterMappingType) element) .getFilterName().getValue().equals(filtername.getValue())) { fm = (com.athena.chameleon.engine.entity.xml.webapp.v2_4.FilterMappingType) element; } } } webApp.getDescriptionAndDisplayNameAndIcon().remove(f); webApp.getDescriptionAndDisplayNameAndIcon().remove(fm); } if (!hasUTF8EncodingFilter) { // <filter> element com.athena.chameleon.engine.entity.xml.webapp.v2_4.FilterType filter = new com.athena.chameleon.engine.entity.xml.webapp.v2_4.FilterType(); com.athena.chameleon.engine.entity.xml.webapp.v2_4.FilterNameType filterName = new com.athena.chameleon.engine.entity.xml.webapp.v2_4.FilterNameType(); filterName.setValue("UTF_EncodingFilter"); filter.setFilterName(filterName); com.athena.chameleon.engine.entity.xml.webapp.v2_4.FullyQualifiedClassType filterClass = new com.athena.chameleon.engine.entity.xml.webapp.v2_4.FullyQualifiedClassType(); filterClass.setValue("com.osc.filters.SetCharacterEncodingFilter"); filter.setFilterClass(filterClass); // <init-param> element com.athena.chameleon.engine.entity.xml.webapp.v2_4.ParamValueType paramValue = new com.athena.chameleon.engine.entity.xml.webapp.v2_4.ParamValueType(); com.athena.chameleon.engine.entity.xml.webapp.v2_4.String strName = new com.athena.chameleon.engine.entity.xml.webapp.v2_4.String(); strName.setValue("encoding"); com.athena.chameleon.engine.entity.xml.webapp.v2_4.XsdStringType strValue = new com.athena.chameleon.engine.entity.xml.webapp.v2_4.XsdStringType(); strValue.setValue("UTF-8"); paramValue.setParamName(strName); paramValue.setParamValue(strValue); filter.getInitParam().add(paramValue); paramValue = new com.athena.chameleon.engine.entity.xml.webapp.v2_4.ParamValueType(); strName = new com.athena.chameleon.engine.entity.xml.webapp.v2_4.String(); strName.setValue("forceEncoding"); strValue = new com.athena.chameleon.engine.entity.xml.webapp.v2_4.XsdStringType(); strValue.setValue("UTF-8"); paramValue.setParamName(strName); paramValue.setParamValue(strValue); filter.getInitParam().add(paramValue); // <filter-mapping> elemnet com.athena.chameleon.engine.entity.xml.webapp.v2_4.FilterMappingType filterMapping = new com.athena.chameleon.engine.entity.xml.webapp.v2_4.FilterMappingType(); com.athena.chameleon.engine.entity.xml.webapp.v2_4.UrlPatternType urlPattern = new com.athena.chameleon.engine.entity.xml.webapp.v2_4.UrlPatternType(); urlPattern.setValue("/*"); filterMapping.setUrlPattern(urlPattern); filterMapping.setFilterName(filterName); // <web-app>? filter webApp.getDescriptionAndDisplayNameAndIcon().add(filter); webApp.getDescriptionAndDisplayNameAndIcon().add(filterMapping); try { // Filter ?? fileCopy(new File(WebXMLParser.class.getResource("/lib/osc-filters.jar").getFile()), new File(path, "lib/osc-filters.jar")); // web.xml String xmlData = JaxbUtils.marshal( com.athena.chameleon.engine.entity.xml.webapp.v2_4.WebAppType.class.getPackage() .getName(), webApp, new String[] { "http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" }); rewrite(new File(path, "web.xml"), xmlData.replaceAll(" standalone=\"yes\"", "").replaceAll(" standalone=\"true\"", "")); logger.debug("web.xml has been modified.\n{}", xmlData); } catch (JAXBException e) { logger.error("JAXBException has occurred.", e); throw e; } catch (IOException e) { logger.error("IOException has occurred.", e); throw e; } } return webApp; } else { com.athena.chameleon.engine.entity.xml.webapp.v2_3.WebApp webApp = (com.athena.chameleon.engine.entity.xml.webapp.v2_3.WebApp) obj; // webApp? <filter />, <filter-mapping />? ? List<com.athena.chameleon.engine.entity.xml.webapp.v2_3.Filter> filterList = webApp.getFilter(); com.athena.chameleon.engine.entity.xml.webapp.v2_3.FilterName filtername = null; List<com.athena.chameleon.engine.entity.xml.webapp.v2_3.InitParam> initParamList = null; for (com.athena.chameleon.engine.entity.xml.webapp.v2_3.Filter filter : filterList) { filtername = filter.getFilterName(); initParamList = filter.getInitParam(); for (com.athena.chameleon.engine.entity.xml.webapp.v2_3.InitParam initParam : initParamList) { if (initParam.getParamName().getvalue().toLowerCase().equals("encoding")) { hasEncodingFilter = true; // param-value UTF-8? ? if (ArrayUtils.contains(charSet, initParam.getParamValue().getvalue().toUpperCase())) { hasUTF8EncodingFilter = true; break; } } } if (hasEncodingFilter) { break; } } // encoding filter UTF-8? ? filter ? filter-mapping . if (hasEncodingFilter && !hasUTF8EncodingFilter) { com.athena.chameleon.engine.entity.xml.webapp.v2_3.Filter filter = null; for (com.athena.chameleon.engine.entity.xml.webapp.v2_3.Filter f : filterList) { if (f.getFilterName().getvalue().equals(filtername.getvalue())) { filter = f; } } List<com.athena.chameleon.engine.entity.xml.webapp.v2_3.FilterMapping> filterMappingList = webApp .getFilterMapping(); com.athena.chameleon.engine.entity.xml.webapp.v2_3.FilterMapping filterMapping = null; for (com.athena.chameleon.engine.entity.xml.webapp.v2_3.FilterMapping fm : filterMappingList) { if (fm.getFilterName().getvalue().equals(filtername.getvalue())) { filterMapping = fm; } } webApp.getFilter().remove(filter); webApp.getFilterMapping().remove(filterMapping); } if (!hasUTF8EncodingFilter) { // <filter> element com.athena.chameleon.engine.entity.xml.webapp.v2_3.Filter filter = new com.athena.chameleon.engine.entity.xml.webapp.v2_3.Filter(); com.athena.chameleon.engine.entity.xml.webapp.v2_3.FilterName filterName = new com.athena.chameleon.engine.entity.xml.webapp.v2_3.FilterName(); filterName.setvalue("UTF_EncodingFilter"); filter.setFilterName(filterName); com.athena.chameleon.engine.entity.xml.webapp.v2_3.FilterClass filterClass = new com.athena.chameleon.engine.entity.xml.webapp.v2_3.FilterClass(); filterClass.setvalue("com.osc.filters.SetCharacterEncodingFilter"); filter.setFilterClass(filterClass); // <init-param> element com.athena.chameleon.engine.entity.xml.webapp.v2_3.InitParam initParam = new com.athena.chameleon.engine.entity.xml.webapp.v2_3.InitParam(); com.athena.chameleon.engine.entity.xml.webapp.v2_3.ParamName paramName = new com.athena.chameleon.engine.entity.xml.webapp.v2_3.ParamName(); com.athena.chameleon.engine.entity.xml.webapp.v2_3.ParamValue paramValue = new com.athena.chameleon.engine.entity.xml.webapp.v2_3.ParamValue(); paramName.setvalue("encoding"); paramValue.setvalue("UTF-8"); initParam.setParamName(paramName); initParam.setParamValue(paramValue); filter.getInitParam().add(initParam); initParam = new com.athena.chameleon.engine.entity.xml.webapp.v2_3.InitParam(); paramName = new com.athena.chameleon.engine.entity.xml.webapp.v2_3.ParamName(); paramValue = new com.athena.chameleon.engine.entity.xml.webapp.v2_3.ParamValue(); paramName.setvalue("forceEncoding"); paramValue.setvalue("UTF-8"); initParam.setParamName(paramName); initParam.setParamValue(paramValue); filter.getInitParam().add(initParam); // <filter-mapping> elemnet com.athena.chameleon.engine.entity.xml.webapp.v2_3.FilterMapping filterMapping = new com.athena.chameleon.engine.entity.xml.webapp.v2_3.FilterMapping(); com.athena.chameleon.engine.entity.xml.webapp.v2_3.UrlPattern urlPattern = new com.athena.chameleon.engine.entity.xml.webapp.v2_3.UrlPattern(); urlPattern.setvalue("/*"); filterMapping.getUrlPatternOrServletName().add(urlPattern); filterMapping.setFilterName(filterName); // <web-app>? filter webApp.getFilter().add(filter); webApp.getFilterMapping().add(filterMapping); try { // Filter ?? fileCopy(new File(WebXMLParser.class.getResource("/lib/osc-filters.jar").getFile()), new File(path, "lib/osc-filters.jar")); // web.xml String xmlData = JaxbUtils.marshal( com.athena.chameleon.engine.entity.xml.webapp.v2_3.WebApp.class.getPackage().getName(), webApp, "<!DOCTYPE web-app PUBLIC \"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN\" \"http://java.sun.com/dtd/web-app_2_3.dtd\">"); rewrite(new File(path, "web.xml"), xmlData.replaceAll(" standalone=\"yes\"", "").replaceAll(" standalone=\"true\"", "")); logger.debug("web.xml has been modified.\n{}", xmlData); } catch (JAXBException e) { logger.error("JAXBException has occurred.", e); throw e; } catch (IOException e) { logger.error("IOException has occurred.", e); throw e; } } return webApp; } }
From source file:com.adobe.acs.commons.workflow.bulk.execution.model.Workspace.java
/** Internal logic proxies **/ public void addActivePayload(Payload payload) { if (!ArrayUtils.contains(activePayloads, payload.getDereferencedPath())) { activePayloads = (String[]) ArrayUtils.add(activePayloads, payload.getDereferencedPath()); properties.put(PN_ACTIVE_PAYLOADS, activePayloads); addActivePayloadGroup(payload.getPayloadGroup()); }//from w w w .java2s . co m }
From source file:com.wso2telco.user.impl.ClaimInfoMultipleScopeResponseBuilder.java
/** * Gets the requested claims.//from w w w .j ava 2 s . c o m * * @param scopes the scopes * @param scopeConfigs the scope configs * @param totalClaims the total claims * @return the requested claims */ private Map<String, Object> getRequestedClaims(String[] scopes, ScopeConfigs scopeConfigs, Map<String, Object> totalClaims) throws NoSuchAlgorithmException { Map<String, Object> requestedClaims = new HashMap<String, Object>(); if (scopeConfigs != null) { if (ArrayUtils.contains(scopes, hashPhoneScope)) { String hashed_msisdn = getHashedClaimValue((String) totalClaims.get(phone_number_claim)); requestedClaims.put(phone_number_claim, hashed_msisdn); } else { for (Scope scope : scopeConfigs.getScopes().getScopeList()) { if (ArrayUtils.contains(scopes, scope.getName())) { for (String claims : scope.getClaims().getClaimValues()) { if (totalClaims.get(claims) == null) { requestedClaims.put(claims, ""); } else { requestedClaims.put(claims, totalClaims.get(claims)); } } } } } } else { if (log.isDebugEnabled()) { log.debug("Could not load user-info claims."); } } return requestedClaims; }
From source file:de.ingrid.admin.controller.GeneralController.java
private void addIncludedDataTypes(final IDataType... types) { Config config = JettyStarter.getInstance().config; // for all indices // check if index has the parent field and add then the included ones for (IDocumentProducer producer : docProducer) { IndexInfo indexInfo = Utils.getIndexInfo(producer, config); List<String> included = new ArrayList<String>(); String[] datatypesOfIndex = config.datatypesOfIndex.get(indexInfo.getIdentifier()); // check all data types for (final String dataType : datatypesOfIndex) { // find correct idatatype for (final IDataType type : types) { if (type.getName().equals(dataType)) { // if found add all included data types if (type.getIncludedDataTypes() != null) { for (final IDataType include : type.getIncludedDataTypes()) { // add to all datatypes field if (!config.datatypes.contains(include.getName())) { config.datatypes.add(include.getName()); }/*w w w . ja va2s . co m*/ if (ArrayUtils.contains(datatypesOfIndex, dataType)) { included.add(include.getName()); } } } } } } config.datatypesOfIndex.put(indexInfo.getIdentifier(), (String[]) ArrayUtils.addAll(datatypesOfIndex, included.toArray())); } }
From source file:com.manydesigns.elements.fields.search.SelectSearchField.java
private void valueToXhtmlDropDown(XhtmlBuffer xb) { xb.writeLabel(StringUtils.capitalize(label), id, ATTR_NAME_HTML_CLASS); xb.openElement("div"); xb.addAttribute("class", "controls"); Object[] values = getValues(); Map<Object, SelectionModel.Option> options = selectionModel.getOptions(selectionModelIndex); xb.openElement("select"); xb.addAttribute("id", id); xb.addAttribute("name", inputName); boolean selected = (values == null && !notSet); if (!options.isEmpty()) { xb.writeOption("", selected, comboLabel); if (!required) { xb.writeOption(VALUE_NOT_SET, notSet, notSetLabel); }//from w w w .java2 s . com } for (Map.Entry<Object, SelectionModel.Option> option : options.entrySet()) { //#1318 include inactive options, because they must be searchable. Object optionValue = option.getKey(); String optionStringValue = OgnlUtils.convertValueToString(optionValue); String optionLabel = option.getValue().label; selected = ArrayUtils.contains(values, optionValue); xb.writeOption(optionStringValue, selected, optionLabel); } xb.closeElement("select"); if (nextSelectField != null) { String js = composeDropDownJs(); xb.writeJavaScript(js); } xb.closeElement("div"); }
From source file:de.tsystems.mms.apm.performancesignature.PerfSigBuildActionResultsDisplay.java
private JFreeChart createTimeSeriesChart(final StaplerRequest req, final XYDataset dataset) throws UnsupportedEncodingException { String chartDashlet = req.getParameter(Messages.PerfSigBuildActionResultsDisplay_ReqParamChartDashlet()); String measure = req.getParameter(Messages.PerfSigBuildActionResultsDisplay_ReqParamMeasure()); String unit = req.getParameter(Messages.PerfSigBuildActionResultsDisplay_ReqParamUnit()); String color = req.getParameter(Messages.PerfSigBuildActionResultsDisplay_ReqParamColor()); if (StringUtils.isBlank(color)) color = Messages.PerfSigBuildActionResultsDisplay_DefaultColor(); else/*w w w. j a v a 2s .c o m*/ URLDecoder.decode(req.getParameter(Messages.PerfSigBuildActionResultsDisplay_ReqParamColor()), "UTF-8"); String[] timeUnits = { "ns", "ms", "s", "min", "h" }; JFreeChart chart; if (ArrayUtils.contains(timeUnits, unit)) { chart = ChartFactory.createTimeSeriesChart(PerfSigUtils.generateTitle(measure, chartDashlet), // title "time", // domain axis label unit, dataset, // data false, // include legend false, // tooltips false // urls ); } else { chart = ChartFactory.createXYBarChart(PerfSigUtils.generateTitle(measure, chartDashlet), // title "time", // domain axis label true, unit, (IntervalXYDataset) dataset, // data PlotOrientation.VERTICAL, // orientation false, // include legend false, // tooltips false // urls ); } XYPlot xyPlot = chart.getXYPlot(); xyPlot.setForegroundAlpha(0.8f); xyPlot.setRangeGridlinesVisible(true); xyPlot.setRangeGridlinePaint(Color.black); xyPlot.setOutlinePaint(null); XYItemRenderer xyitemrenderer = xyPlot.getRenderer(); if (xyitemrenderer instanceof XYLineAndShapeRenderer) { XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyitemrenderer; xylineandshaperenderer.setBaseShapesVisible(true); xylineandshaperenderer.setBaseShapesFilled(true); } DateAxis dateAxis = (DateAxis) xyPlot.getDomainAxis(); dateAxis.setTickMarkPosition(DateTickMarkPosition.MIDDLE); dateAxis.setDateFormatOverride(new SimpleDateFormat("HH:mm:ss")); xyitemrenderer.setSeriesPaint(0, Color.decode(color)); xyitemrenderer.setSeriesStroke(0, new BasicStroke(2)); chart.setBackgroundPaint(Color.white); return chart; }
From source file:de.unisb.cs.st.javalanche.mutation.util.AddOffutt96Sufficient.java
private static int[] getRorOpcodes(int opcode) { if (ArrayUtils.contains(rorSingleOpcodes, opcode)) { return rorSingleOpcodes; }/*from w w w . j ava2 s. co m*/ if (ArrayUtils.contains(rorIntegerCompareOpcodes, opcode)) { return rorIntegerCompareOpcodes; } return new int[0]; }