List of usage examples for java.util StringTokenizer nextElement
public Object nextElement()
From source file:org.apache.cloudstack.storage.datastore.util.SolidFireUtil.java
public static String getModifiedUrl(String originalUrl) { StringBuilder sb = new StringBuilder(); String delimiter = ";"; StringTokenizer st = new StringTokenizer(originalUrl, delimiter); while (st.hasMoreElements()) { String token = st.nextElement().toString().toUpperCase(); if (token.startsWith(SolidFireUtil.MANAGEMENT_VIP.toUpperCase()) || token.startsWith(SolidFireUtil.STORAGE_VIP.toUpperCase())) { sb.append(token).append(delimiter); }/*from w w w. ja v a 2 s . com*/ } String modifiedUrl = sb.toString(); int lastIndexOf = modifiedUrl.lastIndexOf(delimiter); if (lastIndexOf == (modifiedUrl.length() - delimiter.length())) { return modifiedUrl.substring(0, lastIndexOf); } return modifiedUrl; }
From source file:com.jaspersoft.jasperserver.war.action.repositoryExplorer.ResourceAction.java
public Event getUriDisplayLabelList(RequestContext context) { try {//w w w . j av a2 s . co m String uriList = URLDecoder.decode((String) context.getRequestParameters().get("uriList"), "UTF-8"); String type = (String) context.getRequestParameters().get("type"); StringTokenizer str = new StringTokenizer(uriList, ","); StringBuffer sb = new StringBuffer(); sb.append('{'); int counter = 0; int fromIndex = 1; Resource rootFolder = repositoryService.getFolder(null, "/"); while (str.hasMoreElements()) { String currentString = (String) str.nextElement(); StringBuffer currentDisplayLabel = new StringBuffer(""); if (currentString.equals("/")) { sb.append( "\"" + counter + "\":\"" + "/" + rootFolder.getLabel().replaceAll("<", "<") + "\""); counter++; continue; } else { currentDisplayLabel.append("/" + rootFolder.getLabel().replaceAll("<", "<")); } if (currentString.length() > 1) { int lastIndex = currentString.lastIndexOf("/"); while ((fromIndex = currentString.indexOf('/', fromIndex)) != -1) { String currentUri = currentString.substring(0, currentString.indexOf('/', fromIndex)); try { currentDisplayLabel.append("/").append(repositoryService .getFolder(exContext(context), currentUri).getLabel().replaceAll("<", "<")); } catch (Exception e) { currentDisplayLabel.append("/") .append(repositoryService.getResource(exContext(context), currentUri).getLabel() .replaceAll("<", "<")); } if (lastIndex == fromIndex) { break; } fromIndex++; } if ((type.equals("resource")) && (counter > 0)) { currentDisplayLabel.append("/").append(repositoryService .getResource(exContext(context), currentString).getLabel().replaceAll("<", "<")); } else if (type.equals("folder") || ((type.equals("resource")) && (counter == 0))) { currentDisplayLabel.append("/").append(repositoryService .getFolder(exContext(context), currentString).getLabel().replaceAll("<", "<")); } // put each full display label into json if (counter == 0) { sb.append("\"" + counter + "\":\"" + currentDisplayLabel.toString() + "\""); } else { sb.append(",\"" + counter + "\":\"" + currentDisplayLabel.toString() + "\""); } } counter++; fromIndex = 1; } sb.append('}'); context.getRequestScope().put(AJAX_REPORT_MODEL, sb.toString()); } catch (UnsupportedEncodingException e) { } return success(); }
From source file:us.mn.state.health.lims.qaevent.action.QaEventsEntryUpdateAction.java
protected ActionForward performAction(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String forward = FWD_SUCCESS; request.setAttribute(ALLOW_EDITS_KEY, "true"); request.setAttribute(PREVIOUS_DISABLED, "true"); request.setAttribute(NEXT_DISABLED, "true"); BaseActionForm dynaForm = (BaseActionForm) form; String accessionNumber = (String) dynaForm.get("accessionNumber"); String[] selectedAnalysisQaEventIdsForCompletion = (String[]) dynaForm .get("selectedAnalysisQaEventIdsForCompletion"); List testQaEvents = (List) dynaForm.get("testQaEvents"); //bugzilla 2500 String[] selectedSampleQaEventIdsForCompletion = (String[]) dynaForm .get("selectedSampleQaEventIdsForCompletion"); List sampleQaEvents = (List) dynaForm.get("sampleQaEvents"); //bugzilla 2566 for now qa events is for both humand and newborn //bugzilla 2501 String multipleSampleMode = (String) dynaForm.get("multipleSampleMode"); String qaEventCategoryId = (String) dynaForm.get("selectedQaEventsCategoryId"); //bugzilla 2500 String addQaEventPopupSelectedQaEventIdsForSample = (String) dynaForm .get("addQaEventPopupSelectedQaEventIdsForSample"); StringTokenizer qaEventIdTokenizerForSample = new StringTokenizer( addQaEventPopupSelectedQaEventIdsForSample, SystemConfiguration.getInstance().getDefaultIdSeparator()); List listOfAddedQaEventIdsForSample = new ArrayList(); while (qaEventIdTokenizerForSample.hasMoreElements()) { String qaEventIdForSample = (String) qaEventIdTokenizerForSample.nextElement(); listOfAddedQaEventIdsForSample.add(qaEventIdForSample); }//from w w w. j ava 2 s . c o m String addActionSelectedActionIdsForSample = (String) dynaForm .get("addActionPopupSelectedActionIdsForSample"); String addActionSelectedSampleQaEventIds = (String) dynaForm.get("addActionPopupSelectedSampleQaEventIds"); StringTokenizer actionIdTokenizerForSample = new StringTokenizer(addActionSelectedActionIdsForSample, SystemConfiguration.getInstance().getDefaultIdSeparator()); List listOfAddedActionIdsForSample = new ArrayList(); while (actionIdTokenizerForSample.hasMoreElements()) { String actionIdForSample = (String) actionIdTokenizerForSample.nextElement(); listOfAddedActionIdsForSample.add(actionIdForSample); } StringTokenizer sampleQaEventIdTokenizer = new StringTokenizer(addActionSelectedSampleQaEventIds, SystemConfiguration.getInstance().getDefaultIdSeparator()); List listOfSampleQaEventIds = new ArrayList(); while (sampleQaEventIdTokenizer.hasMoreElements()) { String sampleQaEventId = (String) sampleQaEventIdTokenizer.nextElement(); listOfSampleQaEventIds.add(sampleQaEventId); } //end bugzilla 2500 String addQaEventSelectedTestIds = (String) dynaForm.get("addQaEventPopupSelectedTestIds"); String addQaEventSelectedQaEventIds = (String) dynaForm.get("addQaEventPopupSelectedQaEventIds"); StringTokenizer testIdTokenizer = new StringTokenizer(addQaEventSelectedTestIds, SystemConfiguration.getInstance().getDefaultIdSeparator()); List listOfTestIds = new ArrayList(); while (testIdTokenizer.hasMoreElements()) { String testId = (String) testIdTokenizer.nextElement(); listOfTestIds.add(testId); } StringTokenizer qaEventIdTokenizer = new StringTokenizer(addQaEventSelectedQaEventIds, SystemConfiguration.getInstance().getDefaultIdSeparator()); List listOfAddedQaEventIds = new ArrayList(); while (qaEventIdTokenizer.hasMoreElements()) { String qaEventId = (String) qaEventIdTokenizer.nextElement(); listOfAddedQaEventIds.add(qaEventId); } String addActionSelectedActionIds = (String) dynaForm.get("addActionPopupSelectedActionIds"); String addActionSelectedAnalysisQaEventIds = (String) dynaForm .get("addActionPopupSelectedAnalysisQaEventIds"); StringTokenizer actionIdTokenizer = new StringTokenizer(addActionSelectedActionIds, SystemConfiguration.getInstance().getDefaultIdSeparator()); List listOfActionIds = new ArrayList(); while (actionIdTokenizer.hasMoreElements()) { String actionId = (String) actionIdTokenizer.nextElement(); listOfActionIds.add(actionId); } StringTokenizer analysisQaEventIdTokenizer = new StringTokenizer(addActionSelectedAnalysisQaEventIds, SystemConfiguration.getInstance().getDefaultIdSeparator()); List listOfAnalysisQaEventIds = new ArrayList(); while (analysisQaEventIdTokenizer.hasMoreElements()) { String analysisQaEventId = (String) analysisQaEventIdTokenizer.nextElement(); listOfAnalysisQaEventIds.add(analysisQaEventId); } // server side validation of accessionNumber // validate on server-side sample accession number ActionMessages errors = null; try { errors = new ActionMessages(); errors = validateAccessionNumber(request, errors, dynaForm); } catch (Exception e) { //bugzilla 2154 LogEvent.logError("QaEventsEntryUpdateAction", "performAction()", e.toString()); ActionError error = new ActionError("errors.ValidationException", null, null); errors.add(ActionMessages.GLOBAL_MESSAGE, error); } if (errors != null && errors.size() > 0) { saveErrors(request, errors); return mapping.findForward(FWD_FAIL); } // initialize the form dynaForm.initialize(mapping); // 1926 get sysUserId from login module UserSessionData usd = (UserSessionData) request.getSession().getAttribute(USER_SESSION_DATA); String sysUserId = String.valueOf(usd.getSystemUserId()); //bugzilla 2481 Action Owner SystemUser systemUser = new SystemUser(); systemUser.setId(sysUserId); SystemUserDAO systemUserDAO = new SystemUserDAOImpl(); systemUserDAO.getData(systemUser); Date today = Calendar.getInstance().getTime(); Locale locale = (Locale) request.getSession().getAttribute("org.apache.struts.action.LOCALE"); String dateAsText = DateUtil.formatDateAsText(today, locale); org.hibernate.Transaction tx = HibernateUtil.getSession().beginTransaction(); AnalysisQaEventDAO analysisQaEventDAO = new AnalysisQaEventDAOImpl(); SampleDAO sampleDAO = new SampleDAOImpl(); SampleItemDAO sampleItemDAO = new SampleItemDAOImpl(); AnalysisDAO analysisDAO = new AnalysisDAOImpl(); QaEventDAO qaEventDAO = new QaEventDAOImpl(); ActionDAO actionDAO = new ActionDAOImpl(); AnalysisQaEventActionDAO analysisQaEventActionDAO = new AnalysisQaEventActionDAOImpl(); //bugzilla 2501 SampleQaEventDAO sampleQaEventDAO = new SampleQaEventDAOImpl(); SampleQaEventActionDAO sampleQaEventActionDAO = new SampleQaEventActionDAOImpl(); if (!StringUtil.isNullorNill(accessionNumber)) { try { //bugzilla 2500 first update completed dates for sample if (selectedSampleQaEventIdsForCompletion != null && selectedSampleQaEventIdsForCompletion.length > 0) { for (int i = 0; i < selectedSampleQaEventIdsForCompletion.length; i++) { String sampleQaEventId = selectedSampleQaEventIdsForCompletion[i]; SampleQaEvent sampleQaEvent = new SampleQaEvent(); sampleQaEvent.setId(sampleQaEventId); sampleQaEventDAO.getData(sampleQaEvent); if (sampleQaEvent.getCompletedDate() == null) { sampleQaEvent.setCompletedDateForDisplay(dateAsText); sampleQaEvent.setSysUserId(sysUserId); sampleQaEventDAO.updateData(sampleQaEvent); } } } //first update completed dates if (selectedAnalysisQaEventIdsForCompletion != null && selectedAnalysisQaEventIdsForCompletion.length > 0) { for (int i = 0; i < selectedAnalysisQaEventIdsForCompletion.length; i++) { String analysisQaEventId = selectedAnalysisQaEventIdsForCompletion[i]; AnalysisQaEvent analysisQaEvent = new AnalysisQaEvent(); analysisQaEvent.setId(analysisQaEventId); analysisQaEventDAO.getData(analysisQaEvent); if (analysisQaEvent.getCompletedDate() == null) { analysisQaEvent.setCompletedDateForDisplay(dateAsText); analysisQaEvent.setSysUserId(sysUserId); analysisQaEventDAO.updateData(analysisQaEvent); } } } //bug 2500 now check if we added new Qa Events for sample if (listOfAddedQaEventIdsForSample != null && listOfAddedQaEventIdsForSample.size() > 0) { Sample sample = new Sample(); sample.setAccessionNumber(accessionNumber); sampleDAO.getSampleByAccessionNumber(sample); if (!StringUtil.isNullorNill(sample.getId())) { //insert all qaEvents selected for this sample if doesn't exist already for (int j = 0; j < listOfAddedQaEventIdsForSample.size(); j++) { //if this doesn't exist in in SAMPLE_QAEVENT already then insert it QaEvent qaEvent = new QaEvent(); qaEvent.setId((String) listOfAddedQaEventIdsForSample.get(j)); qaEventDAO.getData(qaEvent); if (qaEvent != null) { SampleQaEvent sampleQaEvent = new SampleQaEvent(); sampleQaEvent.setSample(sample); sampleQaEvent.setQaEvent(qaEvent); sampleQaEvent = sampleQaEventDAO.getSampleQaEventBySampleAndQaEvent(sampleQaEvent); if (sampleQaEvent != null) { //do nothing } else { //insert this new analysis qa event sampleQaEvent = new SampleQaEvent(); sampleQaEvent.setSample(sample); sampleQaEvent.setQaEvent(qaEvent); sampleQaEvent.setSysUserId(sysUserId); sampleQaEventDAO.insertData(sampleQaEvent); } } } } } //now check if we added new Actions if (listOfSampleQaEventIds != null && listOfSampleQaEventIds.size() > 0 && listOfAddedActionIdsForSample != null && listOfAddedActionIdsForSample.size() > 0) { Sample sample = new Sample(); sample.setAccessionNumber(accessionNumber); sampleDAO.getSampleByAccessionNumber(sample); if (!StringUtil.isNullorNill(sample.getId())) { SampleQaEvent sampleQaEvent = new SampleQaEvent(); sampleQaEvent.setSample(sample); sampleQaEvents = sampleQaEventDAO.getSampleQaEventsBySample(sampleQaEvent); for (int j = 0; j < sampleQaEvents.size(); j++) { SampleQaEvent sampQaEvent = (SampleQaEvent) sampleQaEvents.get(j); if (listOfSampleQaEventIds.contains(sampQaEvent.getId())) { for (int k = 0; k < listOfAddedActionIdsForSample.size(); k++) { Action action = new Action(); action.setId((String) listOfAddedActionIdsForSample.get(k)); actionDAO.getData(action); //if this analysis qa event action doesn't already exist in ANALYSIS_QA_EVENT_ACTION then insert it if (action != null) { SampleQaEventAction sampQaEventAction = new SampleQaEventAction(); sampQaEventAction.setAction(action); sampQaEventAction.setSampleQaEvent(sampQaEvent); sampQaEventAction = sampleQaEventActionDAO .getSampleQaEventActionBySampleQaEventAndAction(sampQaEventAction); if (sampQaEventAction != null) { //do nothing if already exists } else { //insert this new analysis qa event action sampQaEventAction = new SampleQaEventAction(); sampQaEventAction.setSampleQaEvent(sampQaEvent); sampQaEventAction.setAction(action); sampQaEventAction.setCreatedDateForDisplay(dateAsText); sampQaEventAction.setSysUserId(sysUserId); //bugzilla 2481 sampQaEventAction.setSystemUser(systemUser); sampleQaEventActionDAO.insertData(sampQaEventAction); } } } } } } } //end 2500 //now check if we added new Qa Events if (listOfAddedQaEventIds != null && listOfAddedQaEventIds.size() > 0 && listOfTestIds != null && listOfTestIds.size() > 0) { Sample sample = new Sample(); sample.setAccessionNumber(accessionNumber); sampleDAO.getSampleByAccessionNumber(sample); List analyses = new ArrayList(); if (!StringUtil.isNullorNill(sample.getId())) { SampleItem sampleItem = new SampleItem(); sampleItem.setSample(sample); sampleItemDAO.getDataBySample(sampleItem); if (sampleItem.getId() != null) { //bugzilla 2227 analyses = analysisDAO.getMaxRevisionAnalysesBySample(sampleItem); } } if (analyses != null) { for (int i = 0; i < analyses.size(); i++) { Analysis analysis = (Analysis) analyses.get(i); if (listOfTestIds.contains(analysis.getTest().getId())) { //insert all qaEvents selected for this test if doesn't exist already for (int j = 0; j < listOfAddedQaEventIds.size(); j++) { //if this doesn't exist in in ANALYSIS_QAEVENT already then insert it QaEvent qaEvent = new QaEvent(); qaEvent.setId((String) listOfAddedQaEventIds.get(j)); qaEventDAO.getData(qaEvent); if (qaEvent != null) { AnalysisQaEvent analysisQaEvent = new AnalysisQaEvent(); analysisQaEvent.setAnalysis(analysis); analysisQaEvent.setQaEvent(qaEvent); analysisQaEvent = analysisQaEventDAO .getAnalysisQaEventByAnalysisAndQaEvent(analysisQaEvent); if (analysisQaEvent != null) { //do nothing } else { //insert this new analysis qa event analysisQaEvent = new AnalysisQaEvent(); analysisQaEvent.setAnalysis(analysis); analysisQaEvent.setQaEvent(qaEvent); analysisQaEvent.setSysUserId(sysUserId); analysisQaEventDAO.insertData(analysisQaEvent); } } } } } } } //now check if we added new Actions if (listOfAnalysisQaEventIds != null && listOfAnalysisQaEventIds.size() > 0 && listOfActionIds != null && listOfActionIds.size() > 0) { Sample sample = new Sample(); sample.setAccessionNumber(accessionNumber); sampleDAO.getSampleByAccessionNumber(sample); List analyses = new ArrayList(); if (!StringUtil.isNullorNill(sample.getId())) { SampleItem sampleItem = new SampleItem(); sampleItem.setSample(sample); sampleItemDAO.getDataBySample(sampleItem); if (sampleItem.getId() != null) { //bugzilla 2227 analyses = analysisDAO.getMaxRevisionAnalysesBySample(sampleItem); } } if (analyses != null) { for (int i = 0; i < analyses.size(); i++) { Analysis analysis = (Analysis) analyses.get(i); AnalysisQaEvent analysisQaEvent = new AnalysisQaEvent(); analysisQaEvent.setAnalysis(analysis); List analysisQaEvents = analysisQaEventDAO .getAnalysisQaEventsByAnalysis(analysisQaEvent); for (int j = 0; j < analysisQaEvents.size(); j++) { AnalysisQaEvent analQaEvent = (AnalysisQaEvent) analysisQaEvents.get(j); if (listOfAnalysisQaEventIds.contains(analQaEvent.getId())) { for (int k = 0; k < listOfActionIds.size(); k++) { Action action = new Action(); action.setId((String) listOfActionIds.get(k)); actionDAO.getData(action); //if this analysis qa event action doesn't already exist in ANALYSIS_QA_EVENT_ACTION then insert it if (action != null) { AnalysisQaEventAction analQaEventAction = new AnalysisQaEventAction(); analQaEventAction.setAction(action); analQaEventAction.setAnalysisQaEvent(analQaEvent); analQaEventAction = analysisQaEventActionDAO .getAnalysisQaEventActionByAnalysisQaEventAndAction( analQaEventAction); if (analQaEventAction != null) { //do nothing if already exists } else { //insert this new analysis qa event action analQaEventAction = new AnalysisQaEventAction(); analQaEventAction.setAnalysisQaEvent(analQaEvent); analQaEventAction.setAction(action); analQaEventAction.setCreatedDateForDisplay(dateAsText); analQaEventAction.setSysUserId(sysUserId); //bugzilla 2481 analQaEventAction.setSystemUser(systemUser); analysisQaEventActionDAO.insertData(analQaEventAction); } } } } } } } } tx.commit(); } catch (LIMSRuntimeException lre) { //bugzilla 2154 LogEvent.logError("QaEventsEntryUpdateAction", "performAction()", lre.toString()); tx.rollback(); errors = new ActionMessages(); ActionError error = null; if (lre.getException() instanceof org.hibernate.StaleObjectStateException) { error = new ActionError("errors.OptimisticLockException", null, null); } else { error = new ActionError("errors.UpdateException", null, null); } errors.add(ActionMessages.GLOBAL_MESSAGE, error); saveErrors(request, errors); request.setAttribute(Globals.ERROR_KEY, errors); forward = FWD_FAIL; } finally { HibernateUtil.closeSession(); } } PropertyUtils.setProperty(dynaForm, "accessionNumber", accessionNumber); PropertyUtils.setProperty(dynaForm, "selectedAnalysisQaEventIdsForCompletion", selectedAnalysisQaEventIdsForCompletion); //bugzilla 2500 PropertyUtils.setProperty(dynaForm, "selectedSampleQaEventIdsForCompletion", selectedSampleQaEventIdsForCompletion); //bugzilla 2566 for now qa events is for human and newborn //PropertyUtils.setProperty(dynaForm, "domain", domain); PropertyUtils.setProperty(dynaForm, "testQaEvents", testQaEvents); //bugzilla 2501 PropertyUtils.setProperty(dynaForm, "multipleSampleMode", multipleSampleMode); PropertyUtils.setProperty(dynaForm, "selectedQaEventsCategoryId", qaEventCategoryId); return mapping.findForward(forward); }
From source file:ch.bfh.evoting.alljoyn.BusHandler.java
/** * Helper method extracting an identity from a received message * @param messageObject the original message received *//* w w w . j a v a 2s . c om*/ private void extractIdentity(AllJoynMessage messageObject) { Log.d(TAG, "Exctracting identity " + messageObject.getMessage()); //Get the name and its corresponding key key StringTokenizer tokenizer = new StringTokenizer(messageObject.getMessage(), MESSAGE_PARTS_SEPARATOR); if (tokenizer.countTokens() != 2) { //malformed string Log.d(TAG, "String was not composed of 2 parts"); return; } String peerId = messageObject.getSender(); //then peerName String peerName = (String) tokenizer.nextElement(); //and finally peerKey String peerKey = (String) tokenizer.nextElement(); Identity newIdentity = new Identity(peerName, messageAuthenticater.decodePublicKey(peerKey)); //Check if identity is already known if (identityMap.containsKey(peerId)) { //if yes, check if the same identity as received before if (!identityMap.get(peerId).equals(newIdentity)) { //If not someone is trying to impersonate somebody else Intent intent = new Intent("attackDetected"); intent.putExtra("type", 1); LocalBroadcastManager.getInstance(context).sendBroadcast(intent); Log.e(TAG, "Two different data received for peer " + peerId); return; } } else { boolean verification = messageObject.verifyMessage(newIdentity.getPublicKey()); if (verification) { //Save the new identity Log.d(TAG, "identity received " + newIdentity.getName()); identityMap.put(peerId, newIdentity); this.sendMyIdentity(); //Update the UI LocalBroadcastManager.getInstance(context).sendBroadcast(new Intent("participantStateUpdate")); if (peerId.equals(signatureVerificationTask.getSender())) { verifySignatureSalt(); } } else { Log.e(TAG, "Wrong signature for identiy message from " + peerId); return; } } }
From source file:es.pode.catalogadorWeb.presentacion.catalogadorBasico.CatBasicoControllerImpl.java
public boolean sonValidosExportar(ActionMapping mapping, SonValidosExportarForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { Collection mensajes = new ArrayList(); ValidaVO datos = form.getValida();/*from w w w .j a va 2 s. c o m*/ if (datos != null) { // leemos los errores de validacion String mens = datos.getResultadoValidacion().toString(); StringTokenizer token = new StringTokenizer(mens, ";"); while (token.hasMoreElements()) { mensajes.add(token.nextElement().toString()); // token.nextElement(); } form.setMensajesError(mensajes); } else { datos.setEsValidoManifest(new Boolean(false));//Devuelve false para la validacin } return datos.getEsValidoManifest().booleanValue();//Devuelve el resultado de la validacin, true o false }
From source file:es.pode.catalogadorWeb.presentacion.catalogadorBasico.CatBasicoControllerImpl.java
public boolean sonValidosMDBO(ActionMapping mapping, SonValidosMDBOForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // despues de validar metadatos viene aqui donde comprobaremos si el // resultado es true o false Collection mensajes = new ArrayList(); ValidaVO datos = form.getValida();/*from ww w . j a v a2s.co m*/ if (datos != null) { // leemos los resultados de la validacion String mens = datos.getResultadoValidacion().toString(); StringTokenizer token = new StringTokenizer(mens, ";"); while (token.hasMoreElements()) { mensajes.add(token.nextElement().toString()); // token.nextElement(); } form.setMensajesError(mensajes); } else { datos.setEsValidoManifest(new Boolean(false));//Devuelve false para la validacin } return datos.getEsValidoManifest().booleanValue();//Devuelve el resultado de la validacin, true o false }
From source file:com.pureinfo.ark.auth2.domain.impl.Auth2MgrImplBase.java
/** * Reloads the configuration.//from www .j a va 2 s. co m * * @throws PureException * if failed. */ public synchronized void reloadConfig() throws PureException { // 1. init or clear if (m_hRightDefs == null) { m_hBaseDefs = new HashMap(); m_hRightDefs = new HashMap(); m_actionDictionary = new ActionDictionary(); } else if (m_hRightDefs.size() > 0) { m_hBaseDefs.clear(); m_hRightDefs.clear(); m_actionDictionary.clear(); } //2. to load configuration from file String sPath = ClassResourceUtil.mapFullPath(m_sConfigFile, true); logger.debug("to load rights config from " + sPath); RightsConfig config = new RightsConfig(); config.fromXML(XMLUtil.fileToElement(sPath)); //3. to cache base actions ActionDef[] actions = config.getActions(); if (actions != null) { for (int i = 0; i < actions.length; i++) { m_actionDictionary.put(actions[i]); } } //4. to cache right definitions ResourceDef[] resources = config.getResources(); ResourceDef resource; RightDef[] rights; BaseDef base; RightDef right; StringTokenizer stRoles; Object oKey; for (int i = 0; i < resources.length; i++) { resource = resources[i]; // to cache base def base = resource.getBase(); if (base != null) { // to parse right value base.parseRight(m_actionDictionary); // to cache base oKey = new Integer(resource.getTypeId()); m_hBaseDefs.put(oKey, base); } //to cache right def rights = resource.getRights(); if (rights == null || rights.length == 0) continue; //skip for (int j = 0; j < rights.length; j++) { right = rights[j]; right.parseRight(m_actionDictionary); stRoles = new StringTokenizer(right.getRoles(), ","); while (stRoles.hasMoreElements()) { oKey = makeKey(resource.getTypeId(), (String) stRoles.nextElement()); //logger.debug("RightDef cached: "+oKey); m_hRightDefs.put(oKey, right); } //endwhile } } //endfor }
From source file:org.candlepin.model.Product.java
@XmlTransient public List<String> getSkuEnabledContentIds() { List<String> skus = new LinkedList<String>(); ProductAttribute attrib = this.getAttribute(Attributes.CONTENT_OVERRIDE_ENABLED); if (attrib != null && attrib.getValue() != null && attrib.getValue().length() > 0) { StringTokenizer tokenizer = new StringTokenizer(attrib.getValue(), ","); while (tokenizer.hasMoreElements()) { skus.add((String) tokenizer.nextElement()); }/*from w w w. j a v a 2 s .c o m*/ } return skus; }
From source file:org.candlepin.model.Product.java
@XmlTransient public List<String> getSkuDisabledContentIds() { List<String> skus = new LinkedList<String>(); ProductAttribute attrib = this.getAttribute(Attributes.CONTENT_OVERRIDE_DISABLED); if (attrib != null && attrib.getValue() != null && attrib.getValue().length() > 0) { StringTokenizer tokenizer = new StringTokenizer(attrib.getValue(), ","); while (tokenizer.hasMoreElements()) { skus.add((String) tokenizer.nextElement()); }//from ww w. java 2 s .c om } return skus; }
From source file:com.cyberway.issue.crawler.Heritrix.java
/** * Test string is valid login/password string. * * A valid login/password string has the login and password compounded * w/ a ':' delimiter./*from w ww . j a v a2s .co m*/ * * @param str String to test. * @return True if valid password/login string. */ protected static boolean isValidLoginPasswordString(String str) { boolean isValid = false; StringTokenizer tokenizer = new StringTokenizer(str, ":"); if (tokenizer.countTokens() == 2) { String login = ((String) tokenizer.nextElement()).trim(); String password = ((String) tokenizer.nextElement()).trim(); if (login.length() > 0 && password.length() > 0) { isValid = true; } } return isValid; }