List of usage examples for java.util Vector iterator
public synchronized Iterator<E> iterator()
From source file:org.ptg.cep.SQLParserGenerator.java
public String handleNormal(ZExpression ze, int depth, Map<String, ZFromItem> frms) { // System.out.println("Normal operator"); String str = ""; boolean second = false; Vector<ZExp> operands = ze.getOperands(); Iterator<ZExp> opi = operands.iterator(); ZExp op = null;/*from w w w . ja v a 2 s .c o m*/ if (opi.hasNext()) { op = opi.next(); } MOVENEXT: while (op != null) { if (op instanceof ZExpression) { ZExpression zexpart = (ZExpression) op; if (second) { str += getCondOperator(ze.getOperator()); } else if (!second && !ze.getOperator().equalsIgnoreCase("and") && !ze.getOperator().equalsIgnoreCase("or") && !ze.getOperator().equalsIgnoreCase("&&") && !ze.getOperator().equalsIgnoreCase("||")) { { str += getCondOperator(ze.getOperator()); } } str += "("; str += processsRule(zexpart, depth + 1, frms); str += ")"; push(str); second = true; } else if (op instanceof ZConstant) { ZConstant zc = (ZConstant) op; if (opi.hasNext()) { op = opi.next(); } else { op = null; } if (op instanceof ZConstant) { ZConstant zc2 = (ZConstant) op; str += printMatchExpr(zc, zc2, depth, ze.getOperator(), frms); } else { str += printSingleMatchExpr(depth, ze.getOperator(), frms, zc); continue MOVENEXT; } } else if (op instanceof ZQuery) { ZQuery zq = (ZQuery) op; handleSubQuery(zq); } if (opi.hasNext()) { op = opi.next(); } else { op = null; } } return str; }
From source file:de.dmarcini.submatix.pclogger.gui.spx42LogGraphPanel.java
/** * /*from ww w. j a v a 2s. co m*/ * Ist das Diluent in der Liste ? * * Project: SubmatixBTForPC Package: de.dmarcini.submatix.pclogger.gui * * @author Dirk Marciniak (dirk_marciniak@arcor.de) * * Stand: 03.11.2013 * @param list * @param dil * @return */ private boolean isDiluentInList(Vector<Integer[]> list, Integer[] dil) { Iterator<Integer[]> it = list.iterator(); while (it.hasNext()) { Integer[] toTest = it.next(); if ((toTest[0] == dil[0]) && (toTest[1] == dil[1])) { // gefunden, Suche abbrechen return (true); } } // wenn nichts gefunden return (false); }
From source file:org.apache.rampart.builder.SymmetricBindingBuilder.java
private void doSignBeforeEncrypt(RampartMessageData rmd) throws RampartException { long t0 = 0, t1 = 0, t2 = 0; RampartPolicyData rpd = rmd.getPolicyData(); Document doc = rmd.getDocument(); if (tlog.isDebugEnabled()) { t0 = System.currentTimeMillis(); }//www . ja va2s.co m Token sigToken = rpd.getSignatureToken(); String encrTokId = null; String sigTokId = null; org.apache.rahas.Token encrTok = null; org.apache.rahas.Token sigTok = null; WSSecKerberosToken krbToken = null; Element sigTokElem = null; Vector signatureValues = new Vector(); if (sigToken != null) { if (sigToken instanceof SecureConversationToken) { sigTokId = rmd.getSecConvTokenId(); } else if (sigToken instanceof IssuedToken) { sigTokId = rmd.getIssuedSignatureTokenId(); } else if (sigToken instanceof X509Token) { if (rmd.isInitiator()) { sigTokId = setupEncryptedKey(rmd, sigToken); } else { sigTokId = getEncryptedKey(rmd); } } else if (sigToken instanceof KerberosToken) { Date created = new Date(); Date expires = new Date(); // TODO make this lifetime configurable ??? expires.setTime(System.currentTimeMillis() + 300000); krbToken = getKerberosTokenBuilder(rmd, sigToken); sigTokId = krbToken.getBSTTokenId(); if (rmd.isInitiator()) { sigTokElem = krbToken.getBinarySecurityTokenElement(); } sigTok = new EncryptedKeyToken(sigTokId, created, expires); sigTok.setSecret(krbToken.getSessionKey().getEncoded()); } } else { throw new RampartException("signatureTokenMissing"); } if (sigTokId == null || sigTokId.length() == 0) { throw new RampartException("noSecurityToken"); } if (!(sigToken instanceof KerberosToken)) { sigTok = this.getToken(rmd, sigTokId); if (SPConstants.INCLUDE_TOEKN_ALWAYS == sigToken.getInclusion() || SPConstants.INCLUDE_TOKEN_ONCE == sigToken.getInclusion() || (rmd.isInitiator() && SPConstants.INCLUDE_TOEKN_ALWAYS_TO_RECIPIENT == sigToken.getInclusion())) { sigTokElem = RampartUtil.appendChildToSecHeader(rmd, sigTok.getToken()); } else if ((rmd.isInitiator() && sigToken instanceof X509Token) || sigToken instanceof SecureConversationToken) { sigTokElem = RampartUtil.appendChildToSecHeader(rmd, sigTok.getToken()); } } if (sigTokElem != null) { // Set the insertion location this.setInsertionLocation(sigTokElem); } HashMap sigSuppTokMap = null; HashMap endSuppTokMap = null; HashMap sgndEndSuppTokMap = null; HashMap sgndEncSuppTokMap = null; HashMap endEncSuppTokMap = null; HashMap sgndEndEncSuppTokMap = null; Vector sigParts = RampartUtil.getSignedParts(rmd); if (this.timestampElement != null) { sigParts.add(new WSEncryptionPart(RampartUtil.addWsuIdToElement((OMElement) this.timestampElement))); } if (rmd.isInitiator()) { // Now add the supporting tokens SupportingToken sgndSuppTokens = rpd.getSignedSupportingTokens(); sigSuppTokMap = this.handleSupportingTokens(rmd, sgndSuppTokens); SupportingToken endSuppTokens = rpd.getEndorsingSupportingTokens(); endSuppTokMap = this.handleSupportingTokens(rmd, endSuppTokens); SupportingToken sgndEndSuppTokens = rpd.getSignedEndorsingSupportingTokens(); sgndEndSuppTokMap = this.handleSupportingTokens(rmd, sgndEndSuppTokens); SupportingToken sgndEncryptedSuppTokens = rpd.getSignedEncryptedSupportingTokens(); sgndEncSuppTokMap = this.handleSupportingTokens(rmd, sgndEncryptedSuppTokens); SupportingToken endorsingEncryptedSuppTokens = rpd.getEndorsingEncryptedSupportingTokens(); endEncSuppTokMap = this.handleSupportingTokens(rmd, endorsingEncryptedSuppTokens); SupportingToken sgndEndEncSuppTokens = rpd.getSignedEndorsingEncryptedSupportingTokens(); sgndEndEncSuppTokMap = this.handleSupportingTokens(rmd, sgndEndEncSuppTokens); Vector supportingToks = rpd.getSupportingTokensList(); for (int i = 0; i < supportingToks.size(); i++) { this.handleSupportingTokens(rmd, (SupportingToken) supportingToks.get(i)); } SupportingToken encryptedSupportingToks = rpd.getEncryptedSupportingTokens(); this.handleSupportingTokens(rmd, encryptedSupportingToks); // Setup signature parts sigParts = addSignatureParts(sigSuppTokMap, sigParts); sigParts = addSignatureParts(sgndEncSuppTokMap, sigParts); sigParts = addSignatureParts(sgndEndSuppTokMap, sigParts); sigParts = addSignatureParts(sgndEndEncSuppTokMap, sigParts); } else { addSignatureConfirmation(rmd, sigParts); } if (sigParts.size() > 0) { if (sigToken instanceof KerberosToken) { krbToken.setParts(sigParts); try { krbToken.signMessage(); } catch (WSSecurityException e) { throw new RampartException("errorInSignatureWithKerberosToken"); } this.setInsertionLocation(RampartUtil.insertSiblingAfter(rmd, this.getInsertionLocation(), krbToken.getSignatureElement())); signatureValues.add(krbToken.getSignatureValue()); } else { // Sign the message signatureValues.add(this.doSymmSignature(rmd, sigToken, sigTok, sigParts)); } this.mainSigId = RampartUtil.addWsuIdToElement((OMElement) this.getInsertionLocation()); } if (rmd.isInitiator()) { // Adding the endorsing encrypted supporting tokens to endorsing supporting tokens endSuppTokMap.putAll(endEncSuppTokMap); // Do endorsed signatures Vector endSigVals = this.doEndorsedSignatures(rmd, endSuppTokMap); for (Iterator iter = endSigVals.iterator(); iter.hasNext();) { signatureValues.add(iter.next()); } // Adding the signed endorsed encrypted tokens to signed endorsed supporting tokens sgndEndSuppTokMap.putAll(sgndEndEncSuppTokMap); // Do signed endorsing signatures Vector sigEndSigVals = this.doEndorsedSignatures(rmd, sgndEndSuppTokMap); for (Iterator iter = sigEndSigVals.iterator(); iter.hasNext();) { signatureValues.add(iter.next()); } } if (tlog.isDebugEnabled()) { t1 = System.currentTimeMillis(); } // Encryption Token encrToken = rpd.getEncryptionToken(); boolean isIssuedToken = false; if (encrToken instanceof IssuedToken) { isIssuedToken = true; } Element encrTokElem = null; if (sigToken.equals(encrToken)) { // Use the same token encrTokId = sigTokId; encrTok = sigTok; encrTokElem = sigTokElem; } else { encrTokId = rmd.getIssuedEncryptionTokenId(); encrTok = this.getToken(rmd, encrTokId); if (SPConstants.INCLUDE_TOEKN_ALWAYS == encrToken.getInclusion() || SPConstants.INCLUDE_TOKEN_ONCE == encrToken.getInclusion() || (rmd.isInitiator() && SPConstants.INCLUDE_TOEKN_ALWAYS_TO_RECIPIENT == encrToken.getInclusion())) { encrTokElem = (Element) encrTok.getToken(); // Add the encrToken element before the sigToken element RampartUtil.insertSiblingBefore(rmd, sigTokElem, encrTokElem); } } Vector encrParts = RampartUtil.getEncryptedParts(rmd); // Check for signature protection if (rpd.isSignatureProtection() && this.mainSigId != null) { // Now encrypt the signature using the above token encrParts.add(new WSEncryptionPart(this.mainSigId, "Element")); } if (rmd.isInitiator()) { for (int i = 0; i < encryptedTokensIdList.size(); i++) { encrParts.add(new WSEncryptionPart((String) encryptedTokensIdList.get(i), "Element")); } } Element refList = null; if (encrParts.size() > 0) { // The sec conv token can be used without derived keys if (encrToken.isDerivedKeys()) { try { WSSecDKEncrypt dkEncr = new WSSecDKEncrypt(); // Check whether it is security policy 1.2 and use the secure conversation // accordingly if (SPConstants.SP_V12 == encrToken.getVersion()) { dkEncr.setWscVersion(ConversationConstants.VERSION_05_12); } if (encrTokElem != null && encrTok.getAttachedReference() != null) { dkEncr.setExternalKey(encrTok.getSecret(), (Element) doc.importNode((Element) encrTok.getAttachedReference(), true)); } else if (encrTok.getUnattachedReference() != null) { dkEncr.setExternalKey(encrTok.getSecret(), (Element) doc.importNode((Element) encrTok.getUnattachedReference(), true)); } else if (!rmd.isInitiator() && encrToken.isDerivedKeys()) { // If the Encrypted key used to create the derived key is not // attached use key identifier as defined in WSS1.1 section // 7.7 Encrypted Key reference SecurityTokenReference tokenRef = new SecurityTokenReference(doc); if (encrTok instanceof EncryptedKeyToken) { tokenRef.setKeyIdentifierEncKeySHA1(((EncryptedKeyToken) encrTok).getSHA1()); } dkEncr.setExternalKey(encrTok.getSecret(), tokenRef.getElement()); } else { dkEncr.setExternalKey(encrTok.getSecret(), encrTok.getId()); } if (encrTok instanceof EncryptedKeyToken) { dkEncr.setCustomValueType( WSConstants.SOAPMESSAGE_NS11 + "#" + WSConstants.ENC_KEY_VALUE_TYPE); } dkEncr.setSymmetricEncAlgorithm(rpd.getAlgorithmSuite().getEncryption()); dkEncr.setDerivedKeyLength(rpd.getAlgorithmSuite().getEncryptionDerivedKeyLength() / 8); dkEncr.prepare(doc); Element encrDKTokenElem = null; encrDKTokenElem = dkEncr.getdktElement(); if (encrTokElem != null) { RampartUtil.insertSiblingAfter(rmd, encrTokElem, encrDKTokenElem); } else if (timestampElement != null) { RampartUtil.insertSiblingAfter(rmd, this.timestampElement, encrDKTokenElem); } else { RampartUtil.insertSiblingBefore(rmd, this.getInsertionLocation(), encrDKTokenElem); } refList = dkEncr.encryptForExternalRef(null, encrParts); RampartUtil.insertSiblingAfter(rmd, encrDKTokenElem, refList); } catch (WSSecurityException e) { throw new RampartException("errorInDKEncr"); } catch (ConversationException e) { throw new RampartException("errorInDKEncr"); } } else { try { WSSecEncrypt encr = new WSSecEncrypt(); encr.setWsConfig(rmd.getConfig()); // Hack to handle reference id issues // TODO Need a better fix if (encrTokId.startsWith("#")) { encrTokId = encrTokId.substring(1); } encr.setEncKeyId(encrTokId); if (krbToken == null) { encr.setEphemeralKey(encrTok.getSecret()); RampartUtil.setEncryptionUser(rmd, encr); encr.setSymmetricEncAlgorithm(rpd.getAlgorithmSuite().getEncryption()); } else { if (encrTok != null) { byte[] secret = encrTok.getSecret(); int factor = 0; if (rmd.getPolicyData().getRampartConfig() != null) { KerberosConfig config = null; String fac = null; config = rmd.getPolicyData().getRampartConfig().getKerberosConfig(); if ((fac = config.getProp() .getProperty(KerberosConfig.KDC_DES_AES_FACTOR)) != null) { try { factor = Integer.parseInt(fac); } catch (Exception e) { factor = 0; } } } if (factor > 1) { byte[] newSecret = new byte[secret.length * 4]; int j = 0; for (int i = 0; i < newSecret.length; i++) { newSecret[i] = secret[j++]; if (j == secret.length) j = 0; } encr.setEphemeralKey(newSecret); encrTok.setSecret(newSecret); } else { encr.setEphemeralKey(secret); encrTok.setSecret(secret); } ((EncryptedKeyToken) encrTok).setSHA1(krbToken.getKrbSession().getThumbPrintEncoded()); try { rmd.getTokenStorage().add(sigTok); } catch (TrustException e) { throw new RampartException("errorAddingKerbTokenToStore"); } } } encr.setDocument(doc); encr.setEncryptSymmKey(false); // Use key identifier in the KeyInfo in server side if (!rmd.isInitiator()) { if (krbToken != null) { encr.setUseKeyIdentifier(true); encr.setKeyIdentifierType(WSConstants.KERBEROS_KEY_IDENTIFIER); } else if (encrTok instanceof EncryptedKeyToken) { encr.setUseKeyIdentifier(true); encr.setCustomReferenceValue(((EncryptedKeyToken) encrTok).getSHA1()); encr.setKeyIdentifierType(WSConstants.ENCRYPTED_KEY_SHA1_IDENTIFIER); } else if (isIssuedToken) { encr.setUseKeyIdentifier(true); encr.setCustomReferenceValue(encrTokId); encr.setKeyIdentifierType(WSConstants.SAML_ASSERTION_IDENTIFIER); try { // RampartUtil.insertSiblingAfter(rmd,this.timestampElement,getLLOMfromOM(encrTok.getToken())); } catch (Exception e) { log.debug("error while converting SAML issued token to a dom element"); } } } encr.prepare(doc, RampartUtil.getEncryptionCrypto(rpd.getRampartConfig(), rmd.getCustomClassLoader())); // Encrypt, get hold of the ref list and add it refList = encr.encryptForExternalRef(null, encrParts); if (encrTokElem != null) { RampartUtil.insertSiblingAfter(rmd, encrTokElem, refList); } else { RampartUtil.insertSiblingBeforeOrPrepend(rmd, this.getInsertionLocation(), refList); } } catch (WSSecurityException e) { throw new RampartException("errorInEncryption", e); } } } if (tlog.isDebugEnabled()) { t2 = System.currentTimeMillis(); tlog.debug("Signature took :" + (t1 - t0) + ", Encryption took :" + (t2 - t1)); } }
From source file:org.apache.ojb.broker.metadata.ObjectReferenceDescriptor.java
/** * *//*from w w w . j a v a 2 s . c om*/ public FieldDescriptor[] getForeignKeyFieldDescriptors(ClassDescriptor cld) { FieldDescriptor[] foreignKeyFieldDescriptors; if ((foreignKeyFieldDescriptors = (FieldDescriptor[]) fkFieldMap.get(cld)) == null) { // 1. collect vector of indices of Fk-Fields Vector v = getForeignKeyFields(); // 2. get FieldDescriptor for each index from Class-descriptor // 2A. In a many-to-many relationship foreignkeyfields vector will be null. if (v != null) { Vector ret; if (cld.isInterface()) { //exchange interface class descriptor with first concrete //class Vector extents = cld.getExtentClasses(); Class firstConcreteClass = (Class) extents.get(0); cld = getClassDescriptor().getRepository().getDescriptorFor(firstConcreteClass); } ret = new Vector(); Iterator iter = v.iterator(); while (iter.hasNext()) { Object fk = iter.next(); FieldDescriptor fkfd = null; /* OJB-55 it's possible that the FK field is declared in the super classes of this object, so we can search for a valid field in super class-descriptor */ ClassDescriptor tmp = cld; while (tmp != null) { if (fk instanceof Integer) { Integer index = (Integer) fk; fkfd = cld.getFieldDescriptorByIndex(index.intValue()); } else { fkfd = tmp.getFieldDescriptorByName((String) fk); } if (fkfd != null) { break; } else { tmp = tmp.getSuperClassDescriptor(); } } if (fkfd == null) { throw new OJBRuntimeException("Incorrect or not found field reference name '" + fk + "' in descriptor " + this + " for class-descriptor '" + (cld != null ? cld.getClassNameOfObject() + "'" : "'null'")); } ret.add(fkfd); } foreignKeyFieldDescriptors = (FieldDescriptor[]) ret.toArray(new FieldDescriptor[ret.size()]); fkFieldMap.put(cld, foreignKeyFieldDescriptors); } } return foreignKeyFieldDescriptors; }
From source file:org.kuali.rice.krad.service.impl.PersistenceStructureServiceOjbImpl.java
@Override public Map<String, String> getInverseForeignKeysForCollection(Class boClass, String collectionName) { // yelp if nulls were passed in if (boClass == null) { throw new IllegalArgumentException("The Class passed in for the boClass argument was null."); }//from w w w . j a v a 2s . c om if (collectionName == null) { throw new IllegalArgumentException("The String passed in for the attributeName argument was null."); } PropertyDescriptor propertyDescriptor = null; // make an instance of the class passed Object classInstance; try { classInstance = boClass.newInstance(); } catch (Exception e) { throw new RuntimeException(e); } // make sure the attribute exists at all, throw exception if not try { propertyDescriptor = PropertyUtils.getPropertyDescriptor(classInstance, collectionName); } catch (Exception e) { throw new RuntimeException(e); } if (propertyDescriptor == null) { throw new ReferenceAttributeDoesntExistException("Requested attribute: '" + collectionName + "' does not exist " + "on class: '" + boClass.getName() + "'. GFK"); } // get the class of the attribute name Class attributeClass = propertyDescriptor.getPropertyType(); // make sure the class of the attribute descends from BusinessObject, // otherwise throw an exception if (!Collection.class.isAssignableFrom(attributeClass)) { throw new ObjectNotABusinessObjectRuntimeException( "Attribute requested (" + collectionName + ") is of class: " + "'" + attributeClass.getName() + "' and is not a " + "descendent of Collection"); } // make sure the collection designated is listed as a // collection-descriptor // on the boClass specified, otherwise throw an exception ClassDescriptor classDescriptor = getClassDescriptor(boClass); CollectionDescriptor collectionDescriptor = classDescriptor.getCollectionDescriptorByName(collectionName); // in collections, the number of keys is equal to the number of keys in // the parent class (the class with the collection). // Each of the primary keys on the parent object will be mapped to a // field in the element object. List parentForeignKeys = getPrimaryKeys(boClass); Vector childPrimaryKeysLegacy = collectionDescriptor.getForeignKeyFields(); if (parentForeignKeys.size() != childPrimaryKeysLegacy.size()) { throw new RuntimeException( "The number of keys in the class descriptor and the inverse foreign key mapping for the collection descriptors do not match."); } Map<String, String> fkToPkMap = new HashMap<String, String>(); Iterator pFKIter = parentForeignKeys.iterator(); Iterator cPKIterator = childPrimaryKeysLegacy.iterator(); while (pFKIter.hasNext()) { String parentForeignKey = (String) pFKIter.next(); String childPrimaryKey = (String) cPKIterator.next(); fkToPkMap.put(parentForeignKey, childPrimaryKey); } return fkToPkMap; }
From source file:uk.ac.ucl.chem.ccs.clinicalgui.DisplayJobPanel.java
private void updateGridSAMPanel() { Vector vec = ajo.getGridSAMOutput(); gridsamStatusResults.setText("-------------AHE Job Status-------------\n"); if (vec != null) { Iterator it = vec.iterator(); while (it.hasNext()) { GridSAMStateInfo gssi = (GridSAMStateInfo) it.next(); gridsamStatusResults.append("\n" + gssi.toString()); gridsamStatusResults.append("\n----------------------------------------\n"); }// w w w . jav a 2s . c o m } }
From source file:org.unitime.timetable.test.StudentSectioningTest.java
public static void updateSectioningInfos(org.hibernate.Session hibSession, org.unitime.timetable.model.Student s, CourseRequest courseRequest) { if (courseRequest.getAssignment() == null) return; //not enrolled --> no update Course course = null;/*from w w w .j av a 2 s.c om*/ for (Iterator i = s.getClassEnrollments().iterator(); i.hasNext() && course != null;) { StudentClassEnrollment sce = (StudentClassEnrollment) i.next(); Section section = courseRequest.getSection(sce.getClazz().getUniqueId().longValue()); if (section != null) course = section.getSubpart().getConfig().getOffering().getCourse(courseRequest.getStudent()); } if (course != null) return; //student was already enrolled in the course --> no update Enrollment enrollment = (Enrollment) courseRequest.getAssignment(); for (Iterator i = enrollment.getAssignments().iterator(); i.hasNext();) { Section section = (Section) i.next(); Class_ clazz = new Class_DAO().get(new Long(section.getId())); SectioningInfo si = clazz.getSectioningInfo(); if (si == null || Math.round(si.getNbrHoldingStudents().doubleValue()) < 1) continue; si.setNbrHoldingStudents(new Double(si.getNbrHoldingStudents().doubleValue() - 1)); hibSession.saveOrUpdate(si); sLog.debug(" -- hold for " + clazz.getClassLabel() + " decreased by 1 (to " + si.getNbrHoldingStudents() + ")"); } Vector feasibleEnrollments = new Vector(); for (Iterator g = courseRequest.values().iterator(); g.hasNext();) { Enrollment enrl = (Enrollment) g.next(); boolean overlaps = false; for (Iterator h = courseRequest.getStudent().getRequests().iterator(); h.hasNext();) { Request otherRequest = (Request) h.next(); if (otherRequest instanceof CourseRequest) { CourseRequest otherCourseRequest = (CourseRequest) otherRequest; if (otherCourseRequest.equals(courseRequest)) continue; Enrollment otherErollment = (Enrollment) otherCourseRequest.getAssignment(); if (otherErollment == null) continue; if (enrl.isOverlapping(otherErollment)) { overlaps = true; break; } } } if (!overlaps) feasibleEnrollments.add(enrl); } double decrement = courseRequest.getWeight() / feasibleEnrollments.size(); for (Iterator g = feasibleEnrollments.iterator(); g.hasNext();) { Enrollment feasibleEnrollment = (Enrollment) g.next(); for (Iterator i = feasibleEnrollment.getAssignments().iterator(); i.hasNext();) { Section section = (Section) i.next(); Class_ clazz = new Class_DAO().get(new Long(section.getId())); SectioningInfo si = clazz.getSectioningInfo(); if (si == null || si.getNbrExpectedStudents().doubleValue() <= 0.0) continue; si.setNbrExpectedStudents(new Double(si.getNbrExpectedStudents().doubleValue() - decrement)); hibSession.saveOrUpdate(si); sLog.debug(" -- expected for " + clazz.getClassLabel() + " decreased by " + decrement + " (to " + si.getNbrExpectedStudents() + ")"); } } }
From source file:org.apache.axis.wsdl.toJava.JavaStubWriter.java
/** * This method returns a set of all the TypeEntry in a given PortType. * The elements of the returned HashSet are Types. * //from w w w .j av a 2s . c om * @param portType * @return */ private HashSet getTypesInPortType(PortType portType) { HashSet types = new HashSet(); HashSet firstPassTypes = new HashSet(); // Get all the types from all the operations List operations = portType.getOperations(); for (int i = 0; i < operations.size(); ++i) { Operation op = (Operation) operations.get(i); firstPassTypes.addAll(getTypesInOperation(op)); } // Add all the types nested and derived from the types // in the first pass. Iterator i = firstPassTypes.iterator(); while (i.hasNext()) { TypeEntry type = (TypeEntry) i.next(); if (!types.contains(type)) { types.add(type); types.addAll(type.getNestedTypes(symbolTable, true)); } } if (emitter.isAllWanted()) { HashMap rawSymbolTable = symbolTable.getHashMap(); for (Iterator j = rawSymbolTable.values().iterator(); j.hasNext();) { Vector typeVector = (Vector) j.next(); for (Iterator k = typeVector.iterator(); k.hasNext();) { Object symbol = k.next(); if (symbol instanceof DefinedType) { TypeEntry type = (TypeEntry) symbol; if (!types.contains(type)) { types.add(type); } } } } } return types; }
From source file:org.apache.jetspeed.modules.actions.portlets.PsmlUpdateAction.java
/** * File Import All Action for Psml.// w ww. j av a 2 s .c om * * * @param rundata The turbine rundata context for this request. * @param context The velocity context for this request. */ public void doImportall(RunData rundata, Context context) throws Exception { String copyFrom = null; try { copyFrom = rundata.getParameters().getString("CopyFrom"); // // Collect all .psml files from the root specified // Vector files = new Vector(); this.collectPsml(files, copyFrom); // // Process each file // for (Iterator it = files.iterator(); it.hasNext();) { // If error occurs processing one entry, continue on with the others String path = null; try { String psml = ((File) it.next()).getPath(); path = psml.substring(copyFrom.length() + 1); ProfileLocator locator = this.mapFileToLocator(path); PSMLDocument doc = this.loadDocument(psml); // // create a new profile // if (doc != null) { Portlets portlets = doc.getPortlets(); // // Profiler does not provide update capability - must remove before replacing // if (PsmlManager.getDocument(locator) != null) { Profiler.removeProfile(locator); } Profiler.createProfile(locator, portlets); } else { throw new Exception("Failed to load PSML document [" + psml + "] from disk"); } rundata.addMessage("Profile for [" + locator.getPath() + "] has been imported from file [" + psml + "]<br>"); setRefreshPsmlFlag(rundata, TRUE); } catch (Exception ouch) { logger.error("Exception", ouch); rundata.addMessage("ERROR importing file [" + path + "]: " + ouch.toString() + "<br>"); } } } catch (Exception e) { // log the error msg logger.error("Exception", e); // // dup key found - display error message - bring back to same screen // JetspeedLink link = JetspeedLinkFactory.getInstance(rundata); DynamicURI duri = link.getPaneByName(PSML_UPDATE_PANE) .addPathInfo(SecurityConstants.PARAM_MODE, "import_all") .addPathInfo(SecurityConstants.PARAM_MSGID, SecurityConstants.MID_UPDATE_FAILED); JetspeedLinkFactory.putInstance(link); rundata.setRedirectURI(duri.toString()); } // save values that user just entered so they don't have to re-enter if (copyFrom != null) { rundata.getUser().setTemp(COPY_FROM, copyFrom); } }
From source file:nl.nn.adapterframework.jdbc.XmlQuerySender.java
private String executeUpdate(Connection connection, String correlationID, String tableName, String query, Vector columns) throws SenderException { try {/* w ww . j a v a2 s. c o m*/ if (existLob(columns)) { CallableStatement callableStatement = getCallWithRowIdReturned(connection, correlationID, query); applyParameters(callableStatement, columns); int ri = 1 + countParameters(columns); callableStatement.registerOutParameter(ri, Types.VARCHAR); callableStatement.setQueryTimeout(getTimeout()); int numRowsAffected = callableStatement.executeUpdate(); String rowId = callableStatement.getString(ri); log.debug(getLogPrefix() + "returning ROWID [" + rowId + "]"); Iterator iter = columns.iterator(); while (iter.hasNext()) { Column column = (Column) iter.next(); if (column.getType().equalsIgnoreCase(TYPE_BLOB) || column.getType().equalsIgnoreCase(TYPE_CLOB)) { query = "SELECT " + column.getName() + " FROM " + tableName + " WHERE ROWID=?" + " FOR UPDATE"; PreparedStatement statement = getStatement(connection, correlationID, query, true); statement.setString(1, rowId); statement.setQueryTimeout(getTimeout()); if (column.getType().equalsIgnoreCase(TYPE_BLOB)) { executeUpdateBlobQuery(statement, column.getValue()); } else { executeUpdateClobQuery(statement, column.getValue()); } } } return "<result><rowsupdated>" + numRowsAffected + "</rowsupdated></result>"; } PreparedStatement statement = getStatement(connection, correlationID, query, false); applyParameters(statement, columns); statement.setQueryTimeout(getTimeout()); return executeOtherQuery(connection, correlationID, statement, query, null, null); } catch (Throwable t) { throw new SenderException(t); } }