List of usage examples for java.util Vector get
public synchronized E get(int index)
From source file:eionet.gdem.dcm.business.SchemaManager.java
/** * Get stylesheet information for given XML Schema. * @param schema XML Schema URL or database ID * @return List of styleseeht objects.// w w w . java2 s . c o m * @throws DCMException in case of database error. */ public ArrayList getSchemaStylesheets(String schema) throws DCMException { ArrayList<Stylesheet> stls = new ArrayList<Stylesheet>(); try { ConversionServiceIF cs = new ConversionService(); Vector stylesheets = cs.listConversions(schema); for (int i = 0; i < stylesheets.size(); i++) { Hashtable hash = (Hashtable) stylesheets.get(i); String convertId = (String) hash.get("convert_id"); String xslFileName = (String) hash.get("xsl"); String type = (String) hash.get("result_type"); String description = (String) hash.get("description"); boolean ddConv = false; String xslUrl; if (!xslFileName.startsWith(Properties.gdemURL + "/do/getStylesheet?id=")) { xslUrl = Properties.gdemURL + "/" + Names.XSL_FOLDER + xslFileName; } else { xslUrl = (String) hash.get("xsl"); ddConv = true; } Stylesheet stl = new Stylesheet(); stl.setConvId(convertId); stl.setType(type); stl.setXsl(xslUrl); stl.setXslFileName(xslFileName); stl.setDescription(description); stl.setDdConv(ddConv); stls.add(stl); } } catch (Exception e) { LOGGER.error("Error getting schema stylesheets", e); throw new DCMException(BusinessConstants.EXCEPTION_GENERAL); } return stls; }
From source file:hu.sztaki.lpds.pgportal.portlets.workflow.RealWorkflowPortlet.java
/** * Detailed displaying of a worflow instance data *//*ww w . j a v a 2s.co m*/ public void doInstanceDetails(ActionRequest request, ActionResponse response) throws PortletException { String userID = request.getRemoteUser(); String workflowID = request.getParameter("workflow"); String runtimeID = request.getParameter("rtid"); request.getPortletSession().setAttribute("cworkflow", workflowID); request.getPortletSession().setAttribute("detailsruntime", runtimeID); setRequestAttribute(request.getPortletSession(), "rtid", PortalCacheService.getInstance().getUser(userID) .getWorkflow(workflowID).getRuntime(runtimeID).getText()); setRequestAttribute(request.getPortletSession(), "workflow", PortalCacheService.getInstance().getUser(userID).getWorkflow(workflowID)); // if (PortalCacheService.getInstance().getUser(userID).getWorkflow(workflowID).getRuntime(runtimeID) .getJobsStatus().isEmpty()) { Hashtable prp = new Hashtable(); prp.put("url", PortalCacheService.getInstance().getUser(userID).getWorkflow(workflowID).getWfsID()); ServiceType st = InformationBase.getI().getService("wfs", "portal", prp, new Vector()); try { PortalWfsClient pc = (PortalWfsClient) Class.forName(st.getClientObject()).newInstance(); pc.setServiceURL(st.getServiceUrl()); pc.setServiceID(st.getServiceID()); ComDataBean cmb = new ComDataBean(); cmb.setPortalID(PropertyLoader.getInstance().getProperty("service.url")); cmb.setUserID(userID); cmb.setWorkflowID(workflowID); cmb.setWorkflowRuntimeID(runtimeID); // // In case of getmax overrunning it is need to query job status in more steps. int getmax = 2500; // It steps from cnt 0 to empty status or when the returned vector (retVector) size is less than getmax long cnt = 0; int retCnt = getmax; // while (retCnt == getmax) { // Using ComDataBean.setSize() for stepping query cycle cmb.setSize(cnt); // Vector<JobInstanceBean> retVector = new Vector<JobInstanceBean>(); retVector = pc.getWorkflowInstanceJobs(cmb); // System.out.println("wspgrade doInstanceDetails retVector.size() : " + retVector.size()); for (int i = 0; i < retVector.size(); i++) { JobInstanceBean tmp = retVector.get(i); // System.out.println("wspgrade doInstanceDetails tmp : " + tmp.getJobID() +", "+ tmp.getPID() +", "+ tmp.getStatus() +", "+ tmp.getResource()); // PortalCacheService.getInstance().getUser(userID).getWorkflow(workflowID).getRuntime(runtimeID).addJobbStatus(tmp.getJobID(), "" + tmp.getPID(), "" + tmp.getStatus(), tmp.getResource(), -1); } // retCnt = retVector.size(); cnt++; } } catch (Exception e) { e.printStackTrace(); } } setRequestAttribute(request.getPortletSession(), "instJobList", PortalCacheService.getInstance().getUser(request.getRemoteUser()) .getWorkflow(request.getParameter("workflow")).getRuntime(request.getParameter("rtid")) .getCollectionJobsStatus()); doDetails(request, response); }
From source file:edu.stanford.cfuller.imageanalysistools.clustering.DEGaussianMixtureModelClustering.java
/** * Performs Gaussian mixture model clustering on the given inputs using a differential evolution algorithm for maximization of the likelihood of having observed the data. * @param singleCluster An Image mask with each object to be clustered labeled with a unique greylevel value. (Note that the name stems from this method's original use to recursively divide existing single clusters; this need not actually correspond to a single cluster). * @param clusterObjects A Vector containing an initialized ClusterObject for each object present in the Image passed as singleCluster. * @param clusters A Vector containing an initialized Cluster (guess) for each of the k clusters that will be determined. * @param k The number of clusters to end up with. * @param n The number of cluster objects. * @return The negative log likelihood of observing the objects at their locations, given the maximally likely clustering scheme found. On return, clusterObjects and clusters will have been updated to reflect this maximally likely scheme. *//*from w ww . j a v a2 s .c o m*/ public static double go(Image singleCluster, java.util.Vector<ClusterObject> clusterObjects, java.util.Vector<Cluster> clusters, int k, int n) { final int numParametersEach = 5; int numParameters = k * numParametersEach; int populationSize = numParameters; double tol = 1.0e-3; double scaleFactor = 0.9; double crFrq = 0.05; int maxIterations = 10; RealVector parameterLowerBounds = new ArrayRealVector(numParameters); RealVector parameterUpperBounds = new ArrayRealVector(numParameters); for (int i = 0; i < k; i++) { parameterLowerBounds.setEntry(numParametersEach * i, -0.1 * singleCluster.getDimensionSizes().get(ImageCoordinate.X)); parameterLowerBounds.setEntry(numParametersEach * i + 1, -0.1 * singleCluster.getDimensionSizes().get(ImageCoordinate.Y)); parameterLowerBounds.setEntry(numParametersEach * i + 2, tol); parameterLowerBounds.setEntry(numParametersEach * i + 3, -1); parameterLowerBounds.setEntry(numParametersEach * i + 4, tol); parameterUpperBounds.setEntry(numParametersEach * i, 1.1 * singleCluster.getDimensionSizes().get(ImageCoordinate.X)); parameterUpperBounds.setEntry(numParametersEach * i + 1, 1.1 * singleCluster.getDimensionSizes().get(ImageCoordinate.Y)); parameterUpperBounds.setEntry(numParametersEach * i + 2, Math.pow(0.05 * singleCluster.getDimensionSizes().get(ImageCoordinate.X), 2)); parameterUpperBounds.setEntry(numParametersEach * i + 3, 1); parameterUpperBounds.setEntry(numParametersEach * i + 4, Math.pow(0.05 * singleCluster.getDimensionSizes().get(ImageCoordinate.Y), 2)); } ObjectiveFunction f = new GaussianLikelihoodObjectiveFunction(clusterObjects); DifferentialEvolutionMinimizer dem = new DifferentialEvolutionMinimizer(); RealVector output = null; double L = Double.MAX_VALUE; while (L == Double.MAX_VALUE || output == null) { output = dem.minimize(f, parameterLowerBounds, parameterUpperBounds, populationSize, scaleFactor, maxIterations, crFrq, tol); L = f.evaluate(output); } //set up new clusters for (int i = 0; i < k; i++) { clusters.get(i).setCentroidComponents(output.getEntry(numParametersEach * i), output.getEntry(numParametersEach * i + 1), 0); clusters.get(i).setID(i + 1); clusters.get(i).getObjectSet().clear(); } //assign objects to clusters for (ClusterObject c : clusterObjects) { c.setCurrentCluster(clusters.get(c.getMostProbableCluster())); c.getCurrentCluster().getObjectSet().add(c); } return L; }
From source file:org.openmeetings.app.ldap.LdapLoginManagement.java
/** * Ldap Login/*from w ww . j a va 2 s. com*/ * * Connection Data is retrieved from ConfigurationFile * */ // ---------------------------------------------------------------------------------------- public Object doLdapLogin(String user, String passwd, RoomClient currentClient, String SID, String domain) { log.debug("LdapLoginmanagement.doLdapLogin"); // Retrieve Configuration Data HashMap<String, String> configData; try { configData = getLdapConfigData(domain); } catch (Exception e) { log.error("Error on LdapAuth : " + e.getMessage()); return null; } if (configData == null || configData.size() < 1) { log.error("Error on LdapLogin : Configurationdata couldnt be retrieved!"); return null; } // Connection URL String ldap_url = configData.get(CONFIGKEY_LDAP_URL); // for OpenLDAP only // LDAP SERVER TYPE to search accordingly String ldap_server_type = configData.get(CONFIGKEY_LDAP_SERVER_TYPE); // Username for LDAP SERVER himself String ldap_admin_dn = configData.get(CONFIGKEY_LDAP_ADMIN_DN); // Password for LDAP SERVER himself String ldap_passwd = configData.get(CONFIGKEY_LDAP_ADMIN_PASSWD); // SearchScope for retrievment of userdata String ldap_search_scope = configData.get(CONFIGKEY_LDAP_SEARCH_SCOPE); // FieldName for Users's Principal Name String ldap_fieldname_user_principal = configData.get(CONFIGKEY_LDAP_FIELDNAME_USER_PRINCIPAL); // Wether or not we'll store Ldap passwd into OM db String ldap_sync_passwd_to_om = configData.get(CONFIGKEY_LDAP_SYNC_PASSWD_OM); /*** * for future use (lemeur) // Ldap user filter to refine the search * String ldap_user_extrafilter = * configData.get(CONFIGKEY_LDAP_USER_EXTRAFILTER); * * // Count of Ldap group filters String ldap_group_filter_num = * configData.get(CONFIGKEY_LDAP_GROUP_FILTER_NUM); * * // Prefix name of Ldap group filter name String * ldap_group_filter_name_prefix = * configData.get(CONFIGKEY_LDAP_GROUP_FILTER_NAME_PREFIX); * * // Prefix name of Ldap group filter base String * ldap_group_filter_base_prefix = * configData.get(CONFIGKEY_LDAP_GROUP_FILTER_NAME_PREFIX); * * // Prefix name of Ldap group filter type String * ldap_group_filter_type_prefix = * configData.get(CONFIGKEY_LDAP_GROUP_FILTER_TYPE_PREFIX); * * // Prefix name of Ldap group filter text String * ldap_group_filter_text_prefix = * configData.get(CONFIGKEY_LDAP_GROUP_FILTER_TEXT_PREFIX); ***/ // Get custom Ldap attributes mapping String ldap_user_attr_lastname = configData.get(CONFIGKEY_LDAP_KEY_LASTNAME); String ldap_user_attr_firstname = configData.get(CONFIGKEY_LDAP_KEY_FIRSTNAME); String ldap_user_attr_mail = configData.get(CONFIGKEY_LDAP_KEY_MAIL); String ldap_user_attr_street = configData.get(CONFIGKEY_LDAP_KEY_STREET); String ldap_user_attr_additional_name = configData.get(CONFIGKEY_LDAP_KEY_ADDITIONAL_NAME); String ldap_user_attr_fax = configData.get(CONFIGKEY_LDAP_KEY_FAX); String ldap_user_attr_zip = configData.get(CONFIGKEY_LDAP_KEY_ZIP); String ldap_user_attr_country = configData.get(CONFIGKEY_LDAP_KEY_COUNTRY); String ldap_user_attr_town = configData.get(CONFIGKEY_LDAP_KEY_TOWN); String ldap_user_attr_phone = configData.get(CONFIGKEY_LDAP_KEY_PHONE); String ldap_user_attr_timezone = configData.get(CONFIGKEY_LDAP_TIMEZONE_NAME); String ldap_use_lower_case = configData.get(CONFIGKEY_LDAP_USE_LOWER_CASE); if (ldap_use_lower_case != null && ldap_use_lower_case.equals("true")) { user = user.toLowerCase(); } if (ldap_user_attr_lastname == null) { ldap_user_attr_lastname = LDAP_KEY_LASTNAME; } if (ldap_user_attr_firstname == null) { ldap_user_attr_firstname = LDAP_KEY_FIRSTNAME; } if (ldap_user_attr_mail == null) { ldap_user_attr_mail = LDAP_KEY_MAIL; } if (ldap_user_attr_street == null) { ldap_user_attr_street = LDAP_KEY_STREET; } if (ldap_user_attr_additional_name == null) { ldap_user_attr_additional_name = LDAP_KEY_ADDITIONAL_NAME; } if (ldap_user_attr_fax == null) { ldap_user_attr_fax = LDAP_KEY_FAX; } if (ldap_user_attr_zip == null) { ldap_user_attr_zip = LDAP_KEY_ZIP; } if (ldap_user_attr_country == null) { ldap_user_attr_country = LDAP_KEY_COUNTRY; } if (ldap_user_attr_town == null) { ldap_user_attr_town = LDAP_KEY_TOWN; } if (ldap_user_attr_phone == null) { ldap_user_attr_phone = LDAP_KEY_PHONE; } if (ldap_user_attr_timezone == null) { ldap_user_attr_timezone = LDAP_KEY_TIMEZONE; } // Auth Type String ldap_auth_type = configData.get(CONFIGKEY_LDAP_AUTH_TYPE); if (ldap_auth_type == null) ldap_auth_type = ""; if (!isValidAuthType(ldap_auth_type)) { log.error("ConfigKey in Ldap Config contains invalid auth type : '" + ldap_auth_type + "' -> Defaulting to " + LdapAuthBase.LDAP_AUTH_TYPE_SIMPLE); ldap_auth_type = LdapAuthBase.LDAP_AUTH_TYPE_SIMPLE; } // Filter for Search of UserData String ldap_search_filter = "(" + ldap_fieldname_user_principal + "=" + user + ")"; log.debug("Searching userdata with LDAP Search Filter :" + ldap_search_filter); // replace : -> in config = are replaced by : to be able to build valid // key=value pairs ldap_search_scope = ldap_search_scope.replaceAll(":", "="); ldap_admin_dn = ldap_admin_dn.replaceAll(":", "="); LdapAuthBase lAuth = new LdapAuthBase(ldap_url, ldap_admin_dn, ldap_passwd, ldap_auth_type); log.debug("authenticating admin..."); lAuth.authenticateUser(ldap_admin_dn, ldap_passwd); log.debug("Checking server type..."); // for OpenLDAP only if (ldap_server_type.equalsIgnoreCase("OpenLDAP")) { String ldapUserDN = user; log.debug("LDAP server is OpenLDAP"); log.debug("LDAP search base: " + ldap_search_scope); HashMap<String, String> uidCnDictionary = lAuth.getUidCnHashMap(ldap_search_scope, ldap_search_filter, ldap_fieldname_user_principal); if (uidCnDictionary.get(user) != null) { ldapUserDN = uidCnDictionary.get(user) + "," + ldap_search_scope; log.debug("Authentication with DN: " + ldapUserDN); } try { if (!lAuth.authenticateUser(ldapUserDN, passwd)) { log.error(ldapUserDN + " not authenticated."); return new Long(-11); } } catch (Exception e) { log.error("Error on LdapAuth : " + e.getMessage()); return null; } } else { try { if (!lAuth.authenticateUser(user, passwd)) return new Long(-11); } catch (Exception e) { log.error("Error on LdapAuth : " + e.getMessage()); return null; } } // check if user already exists Users u = null; try { u = userManagement.getUserByLogin(user); } catch (Exception e) { log.error("Error retrieving Userdata : " + e.getMessage()); } // User not existant in local database -> take over data for referential // integrity if (u == null) { log.debug("user doesnt exist local -> create new"); // Attributes to retrieve from ldap List<String> attributes = new ArrayList<String>(); attributes.add(ldap_user_attr_lastname); // Lastname attributes.add(ldap_user_attr_firstname); // Firstname attributes.add(ldap_user_attr_mail);// mail attributes.add(ldap_user_attr_street); // Street attributes.add(ldap_user_attr_additional_name); // Additional name attributes.add(ldap_user_attr_fax); // Fax attributes.add(ldap_user_attr_zip); // ZIP attributes.add(ldap_user_attr_country); // Country attributes.add(ldap_user_attr_town); // Town attributes.add(ldap_user_attr_phone); // Phone attributes.add(ldap_user_attr_timezone); // Phone HashMap<String, String> ldapAttrs = new HashMap<String, String>(); ldapAttrs.put("lastnameAttr", ldap_user_attr_lastname); ldapAttrs.put("firstnameAttr", ldap_user_attr_firstname); ldapAttrs.put("mailAttr", ldap_user_attr_mail); ldapAttrs.put("streetAttr", ldap_user_attr_street); ldapAttrs.put("additionalNameAttr", ldap_user_attr_additional_name); ldapAttrs.put("faxAttr", ldap_user_attr_fax); ldapAttrs.put("zipAttr", ldap_user_attr_zip); ldapAttrs.put("countryAttr", ldap_user_attr_country); ldapAttrs.put("townAttr", ldap_user_attr_town); ldapAttrs.put("phoneAttr", ldap_user_attr_phone); ldapAttrs.put("phoneAttr", ldap_user_attr_phone); ldapAttrs.put("timezoneAttr", ldap_user_attr_timezone); Vector<HashMap<String, String>> result = lAuth.getData(ldap_search_scope, ldap_search_filter, attributes); if (result == null || result.size() < 1) { log.error("Error on Ldap request - no result for user " + user); return new Long(-10); } if (result.size() > 1) { log.error("Error on Ldap request - more than one result for user " + user); return null; } HashMap<String, String> userData = result.get(0); try { // Create User with LdapData Long userid; if (ldap_sync_passwd_to_om != null && ldap_sync_passwd_to_om.equals("no")) { Random r = new Random(); String token = Long.toString(Math.abs(r.nextLong()), 36); log.debug("Synching Ldap user to OM DB with RANDOM password: " + token); userid = createUserFromLdapData(userData, token, user, ldapAttrs); } else { log.debug("Synching Ldap user to OM DB with password"); userid = createUserFromLdapData(userData, passwd, user, ldapAttrs); } log.debug("New User ID : " + userid); // If invoked via SOAP this is NULL if (currentClient != null) { currentClient.setUser_id(userid); } // Update Session Boolean bool = sessionManagement.updateUser(SID, userid); if (bool == null) { // Exception log.error("Error on Updating Session"); return new Long(-1); } else if (!bool) { // invalid Session-Object log.error("Invalid Session Object"); return new Long(-35); } // Return UserObject Users u2 = userManagement.getUserById(userid); if (u2 == null) return new Long(-1); u2.setExternalUserType(EXTERNAL_USER_TYPE_LDAP); // TIBO // initialize lazy collection userManagement.refreshUserObject(u2); log.debug("getUserbyId : " + userid + " : " + u2.getLogin()); return u2; } catch (Exception e) { log.error("Error on Working Userdata : ", e); return new Long(-1); } } else { // User exists, just update necessary values log.debug("User already exists -> Update of current passwd"); // If invoked via SOAP this is NULL if (currentClient != null) { currentClient.setUser_id(u.getUser_id()); } // Update Session Boolean bool = sessionManagement.updateUser(SID, u.getUser_id()); if (bool == null) { // Exception log.error("Error on Updating Session"); return new Long(-1); } else if (!bool) { // invalid Session-Object log.error("Invalid Session Object"); return new Long(-35); } // Update password (could have changed in LDAP) if (ldap_sync_passwd_to_om == null || !ldap_sync_passwd_to_om.equals("no")) { u.setPassword(passwd); } try { userManagement.updateUserObject(u, true); } catch (Exception e) { log.error("Error updating user : " + e.getMessage()); return new Long(-1); } return u; } }
From source file:it.classhidra.core.controller.bsController.java
public static info_stream performStream_EnterRS(Vector _streams, String id_action, i_action action_instance, ServletContext servletContext, HttpServletRequest request, HttpServletResponse response) throws bsControllerException, Exception, Throwable { for (int i = 0; i < _streams.size(); i++) { info_stream iStream = (info_stream) _streams.get(i); i_stream currentStream = action_config.streamFactory(iStream.getName(), request.getSession(), servletContext);/*from ww w . j av a2s. c om*/ if (currentStream != null) { currentStream.onPreEnter(request, response); redirects currentStreamRedirect = currentStream.streamservice_enter(request, response); currentStream.onPostEnter(currentStreamRedirect, request, response); if (currentStreamRedirect != null) { isException(action_instance, request); execRedirect(currentStream, currentStreamRedirect, id_action, servletContext, request, response); return iStream; } } } return null; }
From source file:com.evolveum.openicf.lotus.DominoConnector.java
private Uid updateAccount(Document document, Map<String, Attribute> attrs, Update update) throws NotesException { Validate.notNull(document, "Document for update is null."); LOG.ok("updateAccount {0}", update); final Uid uid = new Uid(getGuid(document.getUniversalID())); if (attrs.isEmpty()) { return uid; }/*ww w . ja va 2 s. c o m*/ Vector fullNames = document.getItemValue(FULL_NAME.getName()); String fullName = getCanonical(connection, fullNames.get(0).toString()); String userHttpPw = decode(getAttributeValue(attrs, HTTP_PASSWORD, GuardedString.class)); if (userHttpPw != null) { attrs.put(HTTP_PASSWORD.getName(), build(HTTP_PASSWORD, userHttpPw)); } Integer pwdChangeInterval = getAttributeValue(attrs, PASSWORD_CHANGE_INTERVAL, Integer.class); Integer pwdGracePeriod = getAttributeValue(attrs, PASSWORD_GRACE_PERIOD, Integer.class); String currentPassword = decode(getAttributeValue(attrs, CURRENT_PASSWORD, GuardedString.class)); String newPassword = decode(getAttributeValue(attrs, PASSWORD, GuardedString.class)); List<String> denyGroups = getAttributeValue(attrs, DENY_GROUPS, Vector.class); if (denyGroups == null && config.getDisableDenyGroup() != null) { denyGroups = new Vector<String>(); denyGroups.add(config.getDisableDenyGroup()); } String idFile = getAttributeValue(attrs, ID_FILE); setPassword(fullName, currentPassword, newPassword, idFile); boolean changed = false; Integer roamCleanPer = getAttributeValue(attrs, ROAM_CLEAN_PER, Integer.class); if (roamCleanPer != null) { document.replaceItemValue(ROAM_CLEAN_PER.getName(), roamCleanPer); changed = true; } Integer roamCleanSetting = getAttributeValue(attrs, ROAM_CLEAN_SETTING, Integer.class); if (roamCleanSetting != null) { document.replaceItemValue(ROAM_CLEAN_SETTING.getName(), roamCleanSetting); changed = true; } Vector groups = getAttributeValue(attrs, GROUP_LIST, Vector.class); if (groups != null) { updateAccountGroupList(fullName, groups, update); } Boolean enable = getAttributeValue(attrs, ENABLE, Boolean.class); updateAccountSecurity(fullName, enable, denyGroups, pwdChangeInterval, pwdGracePeriod); Boolean recertify = getAttributeValue(attrs, RECERTIFY, Boolean.class); if (recertify != null && recertify) { AdministrationProcess adminProcess = connection.getAdministrationProcess(); adminProcess.recertifyUser(fullName); } Integer mailQuotaSize = getAttributeValue(attrs, MAIL_QUOTA_SIZE_LIMIT, Integer.class); Integer mailWarningThreshold = getAttributeValue(attrs, MAIL_QUOTA_WARNING_THRESHOLD, Integer.class); if (mailQuotaSize != null || mailWarningThreshold != null) { String mailDb = document.getItemValueString(MAIL_FILE.getName()); updateMailDbQuota(mailDb, mailQuotaSize, mailWarningThreshold); } updateAccountRenameUser(fullName, document, attrs); String mailServer = getAttributeValue(attrs, MAIL_SERVER); if (mailServer != null) { connection.getAdministrationProcess().moveMailUser(fullName, mailServer, NEW_HOME_SERVER_MAIL_PATH); } attrs.remove(CREDENTIALS.getName()); attrs.remove(NORTH_AMERICAN.getName()); for (Attribute attribute : attrs.values()) { Vector vector = new Vector(attribute.getValue()); document.replaceItemValue(attribute.getName(), vector); changed = true; } if (changed && !document.save()) { LOG.ok("Couldn't update account for {0}.", fullName); throw new ConnectorException("Couldn't update account '" + fullName + "'."); } return uid; }
From source file:it.classhidra.core.controller.bsController.java
public static info_stream performStream_ExitRS(Vector _streams, String id_action, i_action action_instance, ServletContext servletContext, HttpServletRequest request, HttpServletResponse response) throws bsControllerException, Exception, Throwable { for (int i = _streams.size() - 1; i > -1; i--) { info_stream iStream = (info_stream) _streams.get(i); i_stream currentStream = action_config.streamFactory(iStream.getName(), request.getSession(), servletContext);/*w w w . j ava 2 s . c om*/ if (currentStream != null) { currentStream.onPreExit(request, response); redirects currentStreamRedirect = currentStream.streamservice_exit(request, response); currentStream.onPostExit(currentStreamRedirect, request, response); if (currentStreamRedirect != null) { isException(action_instance, request); execRedirect(currentStream, currentStreamRedirect, id_action, servletContext, request, response); return iStream; } } } return null; }
From source file:edu.ku.brc.dbsupport.MySQLDMBSUserMgr.java
@Override public Integer getFieldLength(String tableName, String fieldName) { try {//from w w w . ja v a 2 s.com String sql = "SELECT CHARACTER_MAXIMUM_LENGTH FROM `information_schema`.`COLUMNS` where TABLE_SCHEMA = '" + connection.getCatalog() + "' and TABLE_NAME = '" + tableName + "' and COLUMN_NAME = '" + fieldName + "'"; //log.debug(sql); Vector<Object> rows = BasicSQLUtils.querySingleCol(connection, sql); if (rows.size() == 0) { return null; //the field doesn't even exits } return ((Number) rows.get(0)).intValue(); } catch (Exception ex) { errMsg = "Error getting field length"; } return null; }
From source file:gate.util.reporting.PRTimeReporter.java
/** * Ensures that the required line is read from the given file part. * * @param bytearray/*from ww w.ja v a 2 s. c o m*/ * A part of a file being read upside down. * @param lastNlines * A vector containing the lines extracted from file part. * @return true if marker indicating the logical start of run is found; false * otherwise. */ private boolean parseLinesFromLast(byte[] bytearray, Vector<String> lastNlines) { String lastNChars = new String(bytearray); StringBuffer sb = new StringBuffer(lastNChars); lastNChars = sb.reverse().toString(); StringTokenizer tokens = new StringTokenizer(lastNChars, NL); while (tokens.hasMoreTokens()) { StringBuffer sbLine = new StringBuffer(tokens.nextToken()); lastNlines.add(sbLine.reverse().toString()); if ((lastNlines.get(lastNlines.size() - 1)).trim().endsWith(getLogicalStart())) { return true; } } return false; // indicates didn't read 'lineCount' lines }
From source file:org.powertac.officecomplexcustomer.customers.OfficeComplex.java
private void fillAggDominantLoads(String type) { double[] dominant = new double[OfficeComplexConstants.HOURS_OF_DAY]; double[] nonDominant = new double[OfficeComplexConstants.HOURS_OF_DAY]; Vector<Office> houses = getOffices(type); for (int i = 0; i < houses.size(); i++) { for (int j = 0; j < OfficeComplexConstants.HOURS_OF_DAY; j++) { dominant[j] += houses.get(i).getDominantConsumption(j); nonDominant[j] += houses.get(i).getNonDominantConsumption(j); }/*from w ww.ja v a2 s . co m*/ } if (type.equals("NS")) { dominantLoadNS = dominant; nonDominantLoadNS = nonDominant; } else { dominantLoadSS = dominant; nonDominantLoadSS = nonDominant; } }