List of usage examples for java.util ArrayList toString
public String toString()
From source file:org.kuali.kfs.module.cam.document.AssetPaymentDocument.java
/** * @see org.kuali.rice.krad.document.DocumentBase#postProcessSave(org.kuali.rice.krad.rule.event.KualiDocumentEvent) *//*from w w w .j a v a 2s.co m*/ @Override public void postProcessSave(KualiDocumentEvent event) { super.postProcessSave(event); if (!(event instanceof SaveDocumentEvent)) { // don't lock until they // route ArrayList<Long> capitalAssetNumbers = new ArrayList<Long>(); for (AssetPaymentAssetDetail assetPaymentAssetDetail : this.getAssetPaymentAssetDetail()) { if (assetPaymentAssetDetail.getCapitalAssetNumber() != null) { capitalAssetNumbers.add(assetPaymentAssetDetail.getCapitalAssetNumber()); } } String documentTypeForLocking = CamsConstants.DocumentTypeName.ASSET_PAYMENT; if (this.isCapitalAssetBuilderOriginIndicator()) { documentTypeForLocking = CamsConstants.DocumentTypeName.ASSET_PAYMENT_FROM_CAB; } if (!this.getCapitalAssetManagementModuleService().storeAssetLocks(capitalAssetNumbers, this.getDocumentNumber(), documentTypeForLocking, null)) { throw new ValidationException( "Asset " + capitalAssetNumbers.toString() + " is being locked by other documents."); } } }
From source file:eu.iescities.pilot.rovereto.roveretoexplorer.fragments.event.EventsListingFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == R.id.map_view) { category = (getArguments() != null) ? getArguments().getString(SearchFragment.ARG_CATEGORY) : null; if (category == null && (getArguments() != null) && getArguments().containsKey(SearchFragment.ARG_MY)) category = CategoryHelper.EVENTS_MY.category; if (category == null && (getArguments() != null) && getArguments().getString(ARG_QUERY_TODAY) != null) category = CategoryHelper.EVENTS_TODAY.category; boolean query = getArguments().containsKey(SearchFragment.ARG_QUERY); if (category != null && !query) { Log.i("AB TITLE", "switchToMapView category:" + category); MapManager.switchToMapView(category, MapFragment.ARG_EVENT_CATEGORY, this); } else {/*from w w w . ja v a2s .c o m*/ ArrayList<BaseDTObject> target = new ArrayList<BaseDTObject>(); if (list != null) { for (int i = 0; i < listEvents.size(); i++) { ExplorerObject o = listEvents.get(i); if (o.getLocation() != null && o.getLocation()[0] != 0 && o.getLocation()[1] != 0) { target.add(o); } } } Log.i("AB TITLE", "switchToMapView BaseDTOObjects:" + target.toString()); MapManager.switchToMapView(target, this); } return true; } else if (item.getItemId() == R.id.search_action) { FragmentTransaction fragmentTransaction; Fragment fragment; fragmentTransaction = getActivity().getSupportFragmentManager().beginTransaction(); fragment = new SearchFragment(); Bundle args = new Bundle(); args.putString(SearchFragment.ARG_CATEGORY, category); args.putString(CategoryHelper.CATEGORY_TYPE_EVENTS, CategoryHelper.CATEGORY_TYPE_EVENTS); if (getArguments() != null && getArguments().containsKey(SearchFragment.ARG_MY) && getArguments().getBoolean(SearchFragment.ARG_MY)) args.putBoolean(SearchFragment.ARG_MY, getArguments().getBoolean(SearchFragment.ARG_MY)); fragment.setArguments(args); fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); fragmentTransaction.replace(R.id.content_frame, fragment, "events"); fragmentTransaction.addToBackStack(fragment.getTag()); fragmentTransaction.commit(); /* add category to bundle */ return true; } else { return super.onOptionsItemSelected(item); } }
From source file:com.elecnor.ecosystem.serviceimpl.LicenseDirectoryServiceImpl.java
public Integer readFromHeader(ArrayList<String> excelHeader, String valToCheck) { int result = 0; try {//w w w . j a v a 2 s . c om ClassLoader cl = PropertyFileReader.class.getClassLoader(); InputStream in = cl.getResourceAsStream("header.properties"); Properties prop = new Properties(); prop.load(in); if (valToCheck == null) { String excelUploadedHeader = excelHeader.toString().substring(1, excelHeader.toString().indexOf("]")); if (excelUploadedHeader .equalsIgnoreCase(prop.getProperty(ConstantUtil.STATE_LICENSE_EXCEL_FORMAT))) { result = 1; } else { result = 0; } } else { return Integer.valueOf(prop.getProperty(valToCheck)); } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } return result; }
From source file:com.elecnor.ecosystem.serviceimpl.LicenseDirectoryServiceImpl.java
public Integer readFromLocalHeader(ArrayList<String> excelHeader, String valToCheck) { int result = 0; try {// w ww.j a v a2 s . co m ClassLoader cl = PropertyFileReader.class.getClassLoader(); InputStream in = cl.getResourceAsStream("header.properties"); Properties prop = new Properties(); prop.load(in); if (valToCheck == null) { String excelUploadedHeader = excelHeader.toString().substring(1, excelHeader.toString().indexOf("]")); if (excelUploadedHeader .equalsIgnoreCase(prop.getProperty(ConstantUtil.LOCAL_LICENSE_EXCEL_FORMAT))) { result = 1; } else { result = 0; } } else { return Integer.valueOf(prop.getProperty(valToCheck)); } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } return result; }
From source file:User_Manager.User_TblJDBCTemplate.java
public boolean follow_Unfollow(int loggedin_user, int profile_user, int cmd) throws SQLException { /* /*w w w . j a v a 2 s. co m*/ follower- is the logged in user sending request to follow/unfollow followed- is the user who follower wants to follow or unfollow */ try { con = conn.getDataSource().getConnection(); PreparedStatement st = con.prepareStatement( "SELECT A.following,B.followers FROM login_tbl A, login_tbl B where A.uid=? and B.uid=?;"); st.setInt(1, loggedin_user); st.setInt(2, profile_user); ResultSet rs = st.executeQuery(); rs.next(); ArrayList<Integer> profile_user_followers = gson.fromJson(rs.getString("followers"), ArrayList.class); ArrayList<Integer> loggedin_user_following = gson.fromJson(rs.getString("following"), ArrayList.class); switch (cmd) { case 0: {//unfollow profile_user_followers.remove(loggedin_user + .0); loggedin_user_following.remove(profile_user + .0); // } break; case 1: {//follow profile_user_followers.add(loggedin_user); loggedin_user_following.add(profile_user); } break; } // IMPORTANT Make a transaction or a batch execution here st = con.prepareStatement("UPDATE login_tbl SET following=? WHERE uid=?;"); st.setObject(1, loggedin_user_following.toString()); st.setObject(2, loggedin_user); //System.out.println("query for following"+st); st.execute(); //st.addBatch(); st = con.prepareStatement("UPDATE login_tbl SET followers=? WHERE uid=?;"); st.setObject(1, profile_user_followers.toString()); st.setObject(2, profile_user); //System.out.println("query for followers"+st); st.execute(); //st.addBatch(); //int rslt[]=st.executeBatch(); return true; } catch (Exception e) { return false; } finally { con.close(); } }
From source file:com.linuxbox.enkive.web.search.DeleteSearchWebScript.java
public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException { String searchIds = ""; ArrayList<String> failedDeletedSearches = new ArrayList<String>(); searchIds = WebScriptUtils.cleanGetParameter(req, "searchids"); WorkspaceService workspaceService = getWorkspaceService(); Workspace workspace;//from w w w . ja v a 2 s .c o m try { workspace = workspaceService.getActiveWorkspace(req.getUserPrincipal().getName()); for (String searchId : searchIds.split(",")) { if (!searchId.isEmpty()) { try { workspace.deleteSearchResult(searchIds); SearchResult result = workspace.getSearchResultBuilder().getSearchResult(searchId); result.deleteSearchResult(); if (LOGGER.isDebugEnabled()) LOGGER.debug("deleted search at id " + searchId); } catch (WorkspaceException e) { failedDeletedSearches.add(searchId); } } } workspace.saveWorkspace(); if (!failedDeletedSearches.isEmpty()) { respondError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, null, res); throw new IOException("Could not delete searches with UUIDs " + failedDeletedSearches.toString()); } } catch (WorkspaceException e1) { respondError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, null, res); throw new IOException("Could not update workspace to remove searches"); } }
From source file:org.kuali.kfs.module.cam.document.EquipmentLoanOrReturnDocument.java
/** * @see org.kuali.rice.krad.document.DocumentBase#postProcessSave(org.kuali.rice.krad.rule.event.KualiDocumentEvent) *///from w w w . ja va2 s . c o m public void postProcessSave(KualiDocumentEvent event) { super.postProcessSave(event); if (!(event instanceof SaveDocumentEvent)) { // don't lock until they route ArrayList capitalAssetNumbers = new ArrayList<Long>(); if (this.getCapitalAssetNumber() != null) { capitalAssetNumbers.add(this.getCapitalAssetNumber()); } // check and lock on asset numbers exclude approve event. if (!this.getCapitalAssetManagementModuleService().storeAssetLocks(capitalAssetNumbers, this.getDocumentNumber(), CamsConstants.DocumentTypeName.ASSET_EQUIPMENT_LOAN_OR_RETURN, null)) { throw new ValidationException( "Asset " + capitalAssetNumbers.toString() + " is being locked by other documents."); } } }
From source file:com.zira.registration.VehicleInformationActivity.java
private void initialiseListener() { saveAndContinueButton.setOnClickListener(new View.OnClickListener() { public void onClick(View arg0) { emptyFieldCheck();/*from w w w .j a va 2 s . c om*/ } }); vehicleMakeNameSpinner.setOnItemSelectedListener(new OnItemSelectedListener() { public void onItemSelected(AdapterView<?> arg0, View arg1, int position, long arg3) { makePos = position; vehicle_flag++; System.err.println("vehicle_flag" + vehicle_flag); SingleTon.getInstance().setVehicleMake(vehicleMakeNameSpinner.getSelectedItem().toString()); // editor.putString("makename", ""+vehicleMakeNameSpinner.getSelectedItem().toString()); // editor.commit(); if (makePos > 0) { setApapterForVehicleModel(vehicleArrayList.get(makePos).getListModalData()); } else { ArrayList<ModelArray> modelArray = new ArrayList<Vehicle.ModelArray>(); ModelArray mObj = new Vehicle().new ModelArray(); mObj.setVehiclemodalName("Choose Vehicle Modal"); mObj.setVehiclemodalYear("Choose Vehicle Year"); mObj.setVehiclemodelID("0"); modelArray.add(mObj); setApapterForVehicleModel(modelArray); } } @Override public void onNothingSelected(AdapterView<?> arg0) { } }); //vehiclemodalNameSpinner.setSelection(Integer.parseInt(mProfileInfoModel.getVechile_modelID())); vehiclemodalNameSpinner.setOnItemSelectedListener(new OnItemSelectedListener() { public void onItemSelected(AdapterView<?> arg0, View arg1, int position, long arg3) { modalPos = position; ModelArray modalData; if (makePos > 0) modalData = (ModelArray) vehicleArrayList.get(makePos).getListModalData().get(modalPos); else { modalData = new Vehicle().new ModelArray(); modalData.setVehiclemodalName("Choose Vehicle Modal"); modalData.setVehiclemodalYear("Choose Vehicle Year"); modalData.setVehiclemodelID("0"); } // int position1=position+1; //SingleTon.getInstance().setVehicleModel(""+position1); //vehiclemodalNameSpinner.getSelectedItem().toString()); String modelname = modalData.getVehiclemodalName(); String modelid = modalData.getVehiclemodelID(); // System.err.println("index modelid="+modelid); SingleTon.getInstance().setVehicleModel("" + modelid); // editor.putString("modelid", ""+modelid); // editor.commit(); String year = modalData.getVehiclemodalYear(); setApapterForVehicleYear(year); //edit code /* if(flag_vehicelspinner==0) { flag_vehicelspinner=1; for(int i=0;i<Util.arraylist_modelid().size();i++){ if(mProfileInfoModel.getVechile_modelID().equalsIgnoreCase(Util.arraylist_modelid().get(i))) { //vehiclemodalNameSpinner.setSelection(i); System.err.println("vehiclemodalNameSpinner=="+i); } } }*/ } @Override public void onNothingSelected(AdapterView<?> arg0) { } }); SingleTon.getInstance() .setVehicleCountryName("" + Integer.parseInt(mProfileInfoModel.getLicenseplatecountryID())); countryNameSpinner.setOnItemSelectedListener(new OnItemSelectedListener() { public void onItemSelected(AdapterView<?> arg0, View arg1, int position, long arg3) { flag++; //if(position==0) //((TextView) arg0.getChildAt(0)).setTextColor(Color.GRAY); /*SingleTon.getInstance().setVehicleCountryName(countryNameSpinner.getSelectedItem().toString());*/ Country country = (Country) countryNameSpinner.getSelectedItem(); countryid = country.getCountryID(); SingleTon.getInstance().setVehicleCountryName("" + countryid); // editor.putString("countryid", ""+countryid); // editor.commit(); //System.err.println("index county="+countryid); if (position == 0) { stateList = new ArrayList<State>(); State dummyState = new State(); stateList.add(dummyState); } else { //try{ ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(1); if (value == 1) { nameValuePairs.add(new BasicNameValuePair("countryname", countryid)); } else { nameValuePairs.add(new BasicNameValuePair("countryname", "" + countryid)); } // if(!(gettingCountry.equals("Licence Plate Country"))){ Log.e("fetchStates", nameValuePairs.toString()); if (Util.isNetworkAvailable(VehicleInformationActivity.this)) { AsyncTaskForZira mFetchStates = new AsyncTaskForZira(VehicleInformationActivity.this, fetchStates, nameValuePairs, true, "Please wait..."); mFetchStates.delegate = (AsyncResponseForZira) VehicleInformationActivity.this; mFetchStates.execute(); } else { Util.alertMessage(VehicleInformationActivity.this, "Please check your internet connection"); } } // } /* catch(Exception e) { }*/ // } //edit code //countryNameSpinner.setSelection(Integer.parseInt(mProfileInfoModel.getLicenseplatecountryID())); //System.err.println("country=="+Integer.parseInt(mProfileInfoModel.getLicenseplatecountryID())); /* if(flag_countryspinner==0) { flag_countryspinner=1; String getcountryid="2";//mProfileInfoModel.getLicenseplatecountryID(); for(int i=0;i<Util.arraylist_countryid().size();i++){ if(getcountryid.equalsIgnoreCase(Util.arraylist_countryid().get(i))) { countryNameSpinner.setSelection(i); System.err.println("countryNameSpinner=="+i); } } }*/ } @Override public void onNothingSelected(AdapterView<?> arg0) { } }); SingleTon.getInstance().setVehicleStateName("" + mProfileInfoModel.getLicenseplatestateID()); StateNameSpinner.setOnItemSelectedListener(new OnItemSelectedListener() { public void onItemSelected(AdapterView<?> arg0, View arg1, int position, long arg3) { //if(position==0) //((TextView) arg0.getChildAt(0)).setTextColor(Color.GRAY); //SingleTon.getInstance().setVehicleStateName(""+position); State state = (State) StateNameSpinner.getSelectedItem(); String stateid = state.getStateId(); //System.err.println("index="+stateid); SingleTon.getInstance().setVehicleStateName("" + stateid); // editor.putString("stateid", ""+stateid); // editor.commit(); //edit code /* if(flag_statespinner==0) { flag_statespinner=1; for(int i=0;i<Util.arraylist_stateid().size();i++){ String getstateid="1";//mProfileInfoModel.getLicenseplatestateID(); if(getstateid.equalsIgnoreCase(Util.arraylist_stateid().get(i))) { StateNameSpinner.setSelection(i); System.err.println("StateNameSpinner=="+i); } } }*/ } @Override public void onNothingSelected(AdapterView<?> arg0) { } }); vehiclemodalYearSpinner.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> arg0, View arg1, int position, long arg3) { if (!(value == 1)) { // if(position==0) // ((TextView) arg0.getChildAt(0)).setTextColor(Color.GRAY); } SingleTon.getInstance().setVehicleYear(vehiclemodalYearSpinner.getSelectedItem().toString()); // editor.putString("year", ""+vehiclemodalYearSpinner.getSelectedItem().toString()); // editor.commit(); } @Override public void onNothingSelected(AdapterView<?> arg0) { } }); }
From source file:com.celements.calendar.Event.java
void splitLanguageDependentFields(Set<String> confIndep, Set<String> confDep, List<String> propertyNames) { ArrayList<String> propNamesCleanList = new ArrayList<String>(); propNamesCleanList.addAll(propertyNames); propNamesCleanList.remove("detaillink"); if (propNamesCleanList.contains("date") || propNamesCleanList.contains("time")) { propNamesCleanList.remove("date"); propNamesCleanList.remove("time"); propNamesCleanList.add("eventDate"); }// ww w .j a v a 2 s .co m if (propNamesCleanList.contains("date_end") || propNamesCleanList.contains("time_end")) { propNamesCleanList.remove("date_end"); propNamesCleanList.remove("time_end"); propNamesCleanList.add("eventDate_end"); } LOGGER.debug("splitLanguageDepFields: " + propNamesCleanList.toString()); for (String propName : propNamesCleanList) { if (propName.startsWith("l_")) { confDep.add(propName); } else { confIndep.add(propName); } } }
From source file:com.atinternet.tracker.Builder.java
/** * Prepare the hit queryString/*from ww w. ja va2s . co m*/ * * @return LinkedHashMap */ private LinkedHashMap<String, Object[]> prepareQuery() { LinkedHashMap<String, Object[]> formattedParameters = new LinkedHashMap<String, Object[]>(); ArrayList<Param> completeBuffer = new ArrayList<Param>() { { addAll(persistentParams); addAll(volatileParams); } }; ArrayList<Param> params = organizeParameters(completeBuffer); for (Param p : params) { String value = p.getValue().execute(); String key = p.getKey(); HashMap<String, String> plugins = PluginParam.get(tracker); if (plugins.containsKey(key)) { String pluginClass = plugins.get(key); Plugin plugin = null; try { plugin = (Plugin) Class.forName(pluginClass).newInstance(); plugin.execute(tracker); value = plugin.getResponse(); p.setType(Param.Type.JSON); key = Hit.HitParam.JSON.stringValue(); } catch (Exception e) { e.printStackTrace(); value = null; } } else if (key.equals(Hit.HitParam.UserId.stringValue())) { if (TechnicalContext.doNotTrackEnabled(Tracker.getAppContext())) { value = OPT_OUT; } else if (((Boolean) configuration.get(TrackerConfigurationKeys.HASH_USER_ID))) { value = Tool.SHA_256(value); } } if (p.getType() == Param.Type.Closure && Tool.parseJSON(value) != null) { p.setType(Param.Type.JSON); } if (value != null) { // Referrer processing if (key.equals(Hit.HitParam.Referrer.stringValue())) { value = value.replace("&", "$").replaceAll("[<>]", ""); } if (p.getOptions() != null && p.getOptions().isEncode()) { value = Tool.percentEncode(value); p.getOptions().setSeparator(Tool.percentEncode(p.getOptions().getSeparator())); } int duplicateParamIndex = -1; String duplicateParamKey = null; Set<String> keys = formattedParameters.keySet(); String[] keySet = keys.toArray(new String[keys.size()]); int length = keySet.length; for (int i = 0; i < length; i++) { if (keySet[i].equals(key)) { duplicateParamIndex = i; duplicateParamKey = key; break; } } if (duplicateParamIndex != -1) { List<Object[]> values = new ArrayList<Object[]>(formattedParameters.values()); Param duplicateParam = (Param) values.get(duplicateParamIndex)[0]; String str = ((String) formattedParameters.get(duplicateParamKey)[1]).split("=")[0] + "="; String val = ((String) formattedParameters.get(duplicateParamKey)[1]).split("=")[1]; if (p.getType() == Param.Type.JSON) { Object json = Tool.parseJSON(Tool.percentDecode(val)); Object newJson = Tool.parseJSON(Tool.percentDecode(value)); if (json != null && json instanceof JSONObject) { Map dictionary = Tool.toMap((JSONObject) json); if (newJson instanceof JSONObject) { Map newDictionary = Tool.toMap((JSONObject) newJson); dictionary.putAll(newDictionary); JSONObject jsonData = new JSONObject(dictionary); formattedParameters.put(key, new Object[] { duplicateParam, makeSubQuery(key, Tool.percentEncode(jsonData.toString())) }); } else { Tool.executeCallback(tracker.getListener(), CallbackType.warning, "Couldn't append value to a dictionary"); } } else if (json != null && json instanceof JSONArray) { try { ArrayList<Object> array = new ArrayList<Object>(); JSONArray jArray = (JSONArray) json; for (int i = 0; i < jArray.length(); i++) { array.add(jArray.get(i).toString()); } if (newJson instanceof JSONArray) { jArray = (JSONArray) newJson; for (int i = 0; i < jArray.length(); i++) { array.add(jArray.get(i).toString()); } JSONObject jsonData = new JSONObject(array.toString()); formattedParameters.put(key, new Object[] { duplicateParam, makeSubQuery(key, Tool.percentEncode(jsonData.toString())) }); } else { Tool.executeCallback(tracker.getListener(), CallbackType.warning, "Couldn't append value to an array"); } } catch (JSONException e) { Tool.executeCallback(tracker.getListener(), CallbackType.warning, "Couldn't append value to an array"); } } else { Tool.executeCallback(tracker.getListener(), CallbackType.warning, "Couldn't append value to a JSON Object"); } } else if (duplicateParam.getType() == Param.Type.JSON) { Tool.executeCallback(tracker.getListener(), CallbackType.warning, "Couldn't append value to a JSON Object"); } else { formattedParameters.put(key, new Object[] { duplicateParam, str + val + p.getOptions().getSeparator() + value }); } } else { formattedParameters.put(key, new Object[] { p, makeSubQuery(key, value) }); } } } return formattedParameters; }