public void execute(Long farmNo, Long loadBalancerNo) { Map<String, String> parameters = new LinkedHashMap<String, String>(); parameters.put("FarmNo", farmNo.toString()); parameters.put("LoadBalancerNo", loadBalancerNo.toString()); requester.execute("/StartLoadBalancer", parameters); }
public void onBackPressed() { end_time = System.currentTimeMillis(); System.out.println("Start: " + start_time.toString() + " " + "End: " + end_time.toString()); dbh.insertCCHLog( "Point of Care", "ANC Acute Emergencies", start_time.toString(), end_time.toString()); finish(); }
public void releaseAndUpdateInlineStudiesValue(Long id, List<VDCGroup> groups) { // String dataversevalue; String itemid = null; Iterator iterator = groups.iterator(); Long newTotal; long localTotal; NetworkStatsState networkStatsState; for (int i = 0; i < searchItemBeans.length; i++) { NetworkStatsItemBean itembean = (NetworkStatsItemBean) searchItemBeans[i]; if (itembean.getItemID().equals("item0")) { // increment the top level -- item0; localTotal = new Long(itembean.getStudyTotal()); newTotal = localTotal + 1; networkStatsState = NetworkStatsState.getInstance(); if (null != networkStatsState) { networkStatsState.fireNetworkStatsEvent(new ReleaseEvent("item0", newTotal.toString())); NetworkStatsState.getNetworkStatsMap().put("item0.studyTotal", newTotal.toString()); } } while (iterator.hasNext()) { VDCGroup group = (VDCGroup) iterator.next(); itemid = "item" + group.getId().toString(); if (itembean.getItemID().equals(itemid)) { localTotal = new Long(itembean.getStudyTotal()); newTotal = localTotal + 1; networkStatsState = NetworkStatsState.getInstance(); if (null != networkStatsState) { networkStatsState.fireNetworkStatsEvent(new ReleaseEvent(itemid, newTotal.toString())); NetworkStatsState.getNetworkStatsMap().put(itemid + ".studyTotal", newTotal.toString()); } } } } }
public Integer getReplies(Long postId) { Integer val = counting.get(CACHE_REPLIES, postId.toString()); if (val == null) { loadPostCounting(postId); } return counting.get(CACHE_REPLIES, postId.toString()); }
/** * Generates a text representation of this linear frequency histogram similar to {@link * #toString()} but with labels on bins. For example, a bin would appear as: * * <pre> * 200ms |*** * 400ms |* * 600ms |***** * </pre> * * @param binLabel the label to append to each of the bins * @return a string representation of this histogram */ public String toString(String binLabel) { // get the length of the longest string version of the integer // to make the histogram line up correctly int maxLength = Long.toString(lBound + (maxIndex * stepSize)).length(); StringBuilder b = new StringBuilder(128); for (int i = minIndex; i <= maxIndex; ++i) { String binName = Long.toString(Math.min(lBound + (i * stepSize), uBound)); // make the bars all line up evenly by padding with spaces for (int j = binName.length(); j < maxLength; ++j) b.append(" "); b.append(binName).append("binLabel").append(" |"); // scale the bar length relative to the max int bars = (int) ((bins[i] / (double) maxCount) * MAX_HIST_LENGTH); // bump all non-empty buckets by one, so we can tell the // difference if (bins[i] > 0) bars++; for (int j = 0; j < bars; ++j) b.append("*"); b.append("\n"); } return b.toString(); }
public void produceCpuEvents(NodePojo node) throws ExecutionException, InterruptedException, IOException { ChartPrettyRandomGenerator genUser = cpuUserGenerator.get(node.getIpAddress()); if (genUser == null) { genUser = new ChartPrettyRandomGenerator(true, 80, 20); cpuUserGenerator.put(node.getIpAddress(), genUser); } ChartPrettyRandomGenerator genSys = cpuSysGenerator.get(node.getIpAddress()); if (genSys == null) { genSys = new ChartPrettyRandomGenerator(true, 80, 20); cpuSysGenerator.put(node.getIpAddress(), genSys); } List<SamplePojo> samples = new ArrayList<SamplePojo>(); long userCpu = Long.parseLong(genUser.getNextValue()); long systemCpu = Long.parseLong(genSys.getNextValue()); long idleCpu; if (userCpu + systemCpu > 100) { systemCpu = 100 - userCpu; idleCpu = 0; } else { idleCpu = 100 - (userCpu + systemCpu); } samples.add(new SamplePojo("User", Long.toString(userCpu))); samples.add(new SamplePojo("Sys", Long.toString(systemCpu))); samples.add(new SamplePojo("Idle", Long.toString(idleCpu))); listener.publishEvent( new EventPojo(node.getIpAddress(), symTime, TopLevelConst.CPU_LINE_CHART_DATA, samples)); }
private static String getNameAndId(String name, long id) { if (name != null) { return name + tr(" ({0})", /* sic to avoid thousand seperators */ Long.toString(id)); } else { return Long.toString(id); } }
public static List<Question> listAllByTabs(List<Tab> tabs) { if (tabs == null || tabs.size() == 0) { return new ArrayList(); } Iterator<Tab> iterator = tabs.iterator(); In in = Condition.column(ColumnAlias.columnWithTable("t", Tab$Table.ID_TAB)) .in(Long.toString(iterator.next().getId_tab())); while (iterator.hasNext()) { in.and(Long.toString(iterator.next().getId_tab())); } return new Select() .from(Question.class) .as("q") .join(Header.class, Join.JoinType.LEFT) .as("h") .on( Condition.column(ColumnAlias.columnWithTable("q", Question$Table.ID_HEADER)) .eq(ColumnAlias.columnWithTable("h", Header$Table.ID_HEADER))) .join(Tab.class, Join.JoinType.LEFT) .as("t") .on( Condition.column(ColumnAlias.columnWithTable("h", Header$Table.ID_TAB)) .eq(ColumnAlias.columnWithTable("t", Tab$Table.ID_TAB))) .where(in) .orderBy(Tab$Table.ORDER_POS) .orderBy(Question$Table.ORDER_POS) .queryList(); }
@Test public void testUpsertValuesWithExpression() throws Exception { long ts = nextTimestamp(); ensureTableCreated(getUrl(), "IntKeyTest", null, ts - 2); Properties props = new Properties(); props.setProperty( PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 1)); // Execute at timestamp 1 Connection conn = DriverManager.getConnection(PHOENIX_JDBC_URL, props); String upsert = "UPSERT INTO IntKeyTest VALUES(-1)"; PreparedStatement upsertStmt = conn.prepareStatement(upsert); int rowsInserted = upsertStmt.executeUpdate(); assertEquals(1, rowsInserted); upsert = "UPSERT INTO IntKeyTest VALUES(1+2)"; upsertStmt = conn.prepareStatement(upsert); rowsInserted = upsertStmt.executeUpdate(); assertEquals(1, rowsInserted); conn.commit(); conn.close(); props.setProperty( PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 1 conn = DriverManager.getConnection(PHOENIX_JDBC_URL, props); String select = "SELECT i FROM IntKeyTest"; ResultSet rs = conn.createStatement().executeQuery(select); assertTrue(rs.next()); assertEquals(-1, rs.getInt(1)); assertTrue(rs.next()); assertEquals(3, rs.getInt(1)); assertFalse(rs.next()); }
@Test public void testUpsertDateValues() throws Exception { long ts = nextTimestamp(); Date now = new Date(System.currentTimeMillis()); ensureTableCreated(getUrl(), TestUtil.PTSDB_NAME, null, ts - 2); Properties props = new Properties(); props.setProperty( PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 1)); // Execute at timestamp 1 Connection conn = DriverManager.getConnection(PHOENIX_JDBC_URL, props); String dateString = "1999-01-01 02:00:00"; PreparedStatement upsertStmt = conn.prepareStatement( "upsert into ptsdb(inst,host,date) values('aaa','bbb',to_date('" + dateString + "'))"); int rowsInserted = upsertStmt.executeUpdate(); assertEquals(1, rowsInserted); upsertStmt = conn.prepareStatement( "upsert into ptsdb(inst,host,date) values('ccc','ddd',current_date())"); rowsInserted = upsertStmt.executeUpdate(); assertEquals(1, rowsInserted); conn.commit(); props.setProperty( PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 1 conn = DriverManager.getConnection(PHOENIX_JDBC_URL, props); String select = "SELECT date,current_date() FROM ptsdb"; ResultSet rs = conn.createStatement().executeQuery(select); Date then = new Date(System.currentTimeMillis()); assertTrue(rs.next()); Date date = DateUtil.parseDate(dateString); assertEquals(date, rs.getDate(1)); assertTrue(rs.next()); assertTrue(rs.getDate(1).after(now) && rs.getDate(1).before(then)); assertFalse(rs.next()); }
@Test public void testUpsertValuesWithDate() throws Exception { long ts = nextTimestamp(); Properties props = new Properties(); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts)); Connection conn = DriverManager.getConnection(getUrl(), props); conn.createStatement() .execute("create table UpsertDateTest (k VARCHAR not null primary key,date DATE)"); conn.close(); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 5)); conn = DriverManager.getConnection(getUrl(), props); conn.createStatement() .execute("upsert into UpsertDateTest values ('a',to_date('2013-06-08 00:00:00'))"); conn.commit(); conn.close(); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); conn = DriverManager.getConnection(getUrl(), props); ResultSet rs = conn.createStatement().executeQuery("select k,to_char(date) from UpsertDateTest"); assertTrue(rs.next()); assertEquals("a", rs.getString(1)); assertEquals("2013-06-08 00:00:00", rs.getString(2)); }
@Test(expectedExceptions = OptimisticLockException.class) public void testOptimisticLockException() { ComponentSpec cs = createComponentSpec( Long.toString(1), "chris", "cs", "type1", "chris", Collections.<Tag>emptyList(), Collections.<String, String>emptyMap()); em.getTransaction().begin(); em.persist(cs); em.getTransaction().commit(); em.clear(); Assert.assertFalse(em.contains(cs)); em.getTransaction().begin(); ComponentSpec orig = em.find(ComponentSpec.class, Long.toString(1)); orig.setComponentName("revisedName"); em.getTransaction().commit(); em.clear(); ComponentSpec current = em.find(ComponentSpec.class, Long.toString(1)); Assert.assertEquals(current.getObjVersion(), 1); Assert.assertEquals(cs.getObjVersion(), 0); em.getTransaction().begin(); em.merge(cs); em.getTransaction() .commit(); // optimistic lock exception should be thrown as there has been an intervening // commit }
/** * Ping the registered devices of the recipients of the notification. * * @param gameMessage contains the information needed for sending and processing the invite * @param gems the number of gems picked up in this game * @param mobsKilled the number of mobiles killed in this game * @param deaths the number of deaths of player in this game * @return {@code true} if delivery to all users were successful; {@code false} otherwise * @throws IOException */ public static boolean pingGamePlayerSendEndScore( GameMessage gameMessage, long gems, long mobsKilled, long deaths) throws IOException { boolean success = false; for (String toHandle : gameMessage.getTo()) { Message msg = new Message.Builder() .collapseKey(gameMessage.getFrom()) .addData(GCM_PAYLOAD_PING_REASON, PING_REASON_PLAYER_END_SCORE) .addData(GCM_PAYLOAD_FROM_USER_HANDLE, gameMessage.getFrom()) .addData(GCM_PAYLOAD_TO_USER_HANDLE, toHandle) .addData(GCM_PAYLOAD_GAME_ID, gameMessage.getGameId()) .addData(GCM_PAYLOAD_MESSAGE, "Here are the endgame scores for this player.") .addData("gems", Long.toString(gems)) .addData("mobs_killed", Long.toString(mobsKilled)) .addData("deaths", Long.toString(deaths)) .build(); if (verifyFields(msg)) { DeviceInfo deviceInfo = endpoint.getDeviceInfo(toHandle); if (deviceInfo != null) { LOG.info("Building game message to send to user: "******" from user: "******"The device was not found in registry for user handle " + toHandle); } } else { LOG.warning("Empty fields in the GCM Message. No invites sent."); } } return success; }
@Test public void getTopologyLogLocalWhileAuthenticated() { final String requestTopologyId = "topology-test"; final TopologyLog mockedLog = RandomGenerator.randomObject(TopologyLog.class); doReturn(mockedLog) .when(topologyServiceMock) .getTopologyLogLocal( requestTopologyId, TEST_SUBJECT_ID, mockedLog.getOffset(), mockedLog.getCount()); mockAuthenticatedSubject(); TopologyLog responseLog = resource() .path("/api/topologies/" + requestTopologyId + "/log") .queryParam("offset", Long.toString(mockedLog.getOffset())) .queryParam("limit", Long.toString(mockedLog.getCount())) .accept(MediaType.APPLICATION_JSON) .get(TopologyLog.class); assertEquals( "Response topology log should match the request topology log", mockedLog, responseLog); verify(topologyServiceMock) .getTopologyLogLocal( requestTopologyId, TEST_SUBJECT_ID, mockedLog.getOffset(), mockedLog.getCount()); }
/** * @param args * @throws IOException */ public static void main(String[] args) throws IOException { File file = new File("server/server.log"); if (!file.exists()) { System.out.println("ERROR: Could not find server/server.log!!!"); System.exit(1); } long lastModified = file.lastModified(); long currentTime = System.currentTimeMillis(); System.out.println("Last modified: " + Long.toString(lastModified)); System.out.println("Current time: " + Long.toString(currentTime)); // 900000 ms = 15 minutes if (currentTime - lastModified > 300000) { // It's been 15 minutes, something went wrong. Runtime.getRuntime().exec("killall java"); Runtime.getRuntime().exec("server/start"); System.out.println("I had to kill the process..."); System.exit(1); } else { // Nothing wrong. System.out.println("Server appears to be up."); System.exit(0); } }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Log.v("Create View", "in Create View..............."); rootView = (View) inflater.inflate(R.layout.fragment_detail, container, false); getActivity().setTitle(title); btnToggle = (Button) rootView.findViewById(R.id.chkState); btnToggle.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { updateFavourite(v); } }); Log.v(LOG_TAG, "going to load view" + mMovieId.toString()); noTrailerView = (View) inflater.inflate(R.layout.no_trailer, container, false); View trailerView = (View) inflater.inflate(R.layout.trailer_movie, container, false); listViewTrailer = (ListView) trailerView.findViewById(R.id.listView_trailer); mTrailerListViewAdapter = new TrailerListViewAdapter(getActivity(), R.layout.list_item_trailer, mTrailerList); listViewTrailer.setAdapter(mTrailerListViewAdapter); Log.v(LOG_TAG, "going to load view" + mMovieId.toString()); noReviewView = (View) inflater.inflate(R.layout.no_review, container, false); View reviewView = inflater.inflate(R.layout.review_movie, container, false); listViewReview = (ListView) reviewView.findViewById(R.id.listView_review); mReviewListViewAdapter = new ReviewListViewAdapter(getActivity(), R.layout.list_item_review, mReviewList); listViewReview.setAdapter(mReviewListViewAdapter); return rootView; }
/** * Generates a new window for response and calls <code>estamblishConnection</code> to start the * authentication process. * * @author Jan Mikael Lindlöf * @author Eemeli Miettinen */ public ResponseWindow(String number, File selectedFile) { Long currentTimeMillis = System.currentTimeMillis(); eventId = "A" + currentTimeMillis.toString().substring(currentTimeMillis.toString().length() - 4); initResponse(); estamblishConnection(number, selectedFile); }
@Override @Transactional(propagation = Propagation.SUPPORTS) public Order updateStatus(Long id, Integer originalStatus, Integer targetStatus) { if (orderStatusTransferService.checkStatus(targetStatus, originalStatus)) { Order order = orderManagement.findOne(id); if (originalStatus.compareTo(order.getOrderStatus()) == 0) { order.setOrderStatus(targetStatus); return order; } else { logger.error( "修改订单状态失败 Long " + id + ", Integer originalStatus" + originalStatus + ", Integer targetStatus:" + targetStatus); throw new ApplicationException( "transaction001034", new String[] {id.toString(), originalStatus.toString(), targetStatus.toString()}); } } else { logger.error( "修改订单状态异常 Long " + id + ", Integer originalStatus" + originalStatus + ", Integer targetStatus:" + targetStatus); throw new ApplicationException( "transaction001034", new String[] {id.toString(), originalStatus.toString(), targetStatus.toString()}); } }
protected HashMap<String, Object> buildConfigParams(HostVO host) { HashMap<String, Object> params = new HashMap<String, Object>(host.getDetails().size() + 5); params.putAll(host.getDetails()); params.put("guid", host.getGuid()); params.put("zone", Long.toString(host.getDataCenterId())); if (host.getPodId() != null) { params.put("pod", Long.toString(host.getPodId())); } if (host.getClusterId() != null) { params.put("cluster", Long.toString(host.getClusterId())); String guid = null; ClusterVO cluster = _clusterDao.findById(host.getClusterId()); if (cluster.getGuid() == null) { guid = host.getDetail("pool"); } else { guid = cluster.getGuid(); } if (guid != null && !guid.isEmpty()) { params.put("pool", guid); } } params.put("ipaddress", host.getPrivateIpAddress()); params.put("secondary.storage.vm", "false"); params.put( "max.template.iso.size", _configDao.getValue(Config.MaxTemplateAndIsoSize.toString())); params.put("migratewait", _configDao.getValue(Config.MigrateWait.toString())); return params; }
private String getSequenceCode(int item) throws SQLException { String result = ""; Database db = new Database(conn); String name = db.getItemFullName(item, ITEM_TYPE.TABLE); String fromClause = name; String sql = SEQUENCE_SOURCE + fromClause; PreparedStatement stmt = conn.prepareStatement(sql); ResultSet rs = stmt.executeQuery(); if (rs.next()) { result = "CREATE SEQUENCE " + name + " AS\n"; result = result + "\t INCREMENT " + Long.toString(rs.getLong(6)) + "\n"; result = result + "\t MINVALUE " + Long.toString(rs.getLong(2)) + "\n"; result = result + "\t MAXVALUE " + Long.toString(rs.getLong(3)) + "\n"; result = result + "\t START " + Long.toString(rs.getLong(1)) + "\n"; result = result + "\t CACHE " + Long.toString(rs.getLong(4)) + "\n"; result = result + "\t "; if (!rs.getBoolean(5)) { result = result + "NO "; } result = result + "CYCLE\n"; } return result; }
// ============================================================ // <T>根据名称获得内容。</T> // // @param name 名称 // @return 内容 // ============================================================ @Override public String get(String name) { switch (name) { case "ouid": return Long.toString(_ouid); case "ovld": return RBoolean.toString(_ovld); case "guid": return _guid; case "member_id": return Long.toString(_memberId); case "product_code": return _productCode; case "time_section": return _timeSection; case "pv": return RInteger.toString(_pv); case "create_user_id": return Long.toString(_createUserId); case "create_date": return _createDate.toString(); case "update_user_id": return Long.toString(_updateUserId); case "update_date": return _updateDate.toString(); } return null; }
@Test public void testAllowDropParentTableWithCascadeAndSingleTenantTable() throws Exception { long ts = nextTimestamp(); Properties props = new Properties(); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts)); Connection conn = DriverManager.getConnection(getUrl(), props); Connection connTenant = null; try { // Drop Parent Table conn.createStatement().executeUpdate("DROP TABLE " + PARENT_TABLE_NAME + " CASCADE"); conn.close(); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); connTenant = DriverManager.getConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL, props); validateTenantViewIsDropped(conn); } finally { if (conn != null) { conn.close(); } if (connTenant != null) { connTenant.close(); } } }
/** * Return a value of the Signal at the specified time * * @param time - time to get the Sinal's value * @return A char with the value of the Signal */ public String getFormattedValueAt(long time) { String strValue = signal.getValueAt(time); if (strValue.length() == 1) return strValue; if (numeralSystem == NumeralSystem.BINARY) return strValue; long value = 0; for (int i = 0; i < strValue.length(); ++i) { value <<= 1; value += strValue.charAt(i) - 48; } switch (numeralSystem) { case UNSIGNED_DECIMAL: return Long.toString(value); case SIGNED_DECIMAL: if (signal.getBitWidth() == 1) { return Long.toString(value); } else { long max = (long) Math.pow(2, signal.getBitWidth() - 1); if (value >= max) { value = -max + (value ^ (1 << (signal.getBitWidth() - 1))); } return Long.toString(value); } case HEXADECIMAL: return Long.toHexString(value).toUpperCase(); } return "No Value"; }
@SuppressWarnings("nls") @Override public void onReceive(Context context, Intent intent) { System.err.println("TVA thug hustlin - "); if (!intent.hasExtra("tag_id")) return; System.err.println( Long.toString(tagData.getValue(TagData.REMOTE_ID)) + " VS " + intent.getStringExtra("tag_id")); if (!Long.toString(tagData.getValue(TagData.REMOTE_ID)) .equals(intent.getStringExtra("tag_id"))) return; runOnUiThread( new Runnable() { @Override public void run() { System.err.println("REFRESH updates list pa-pa-pa"); refreshUpdatesList(); } }); refreshData(false, true); NotificationManager nm = new AndroidNotificationManager(ContextManager.getContext()); nm.cancel(tagData.getValue(TagData.REMOTE_ID).intValue()); }
private void setParamFromField() { String value = widget.getText(); if (D) System.out.println("New Value = " + value); try { Long val; if (value.equals("")) val = null; else val = Long.parseLong(value); setValue(val); refreshParamEditor(); widget.validate(); widget.repaint(); } catch (NumberFormatException ee) { if (D) System.out.println("Error = " + ee.toString()); Long obj = getValue(); if (obj == null) widget.setText(""); else widget.setText(obj.toString()); this.unableToSetValue(value); } catch (ConstraintException ee) { if (D) System.out.println("Error = " + ee.toString()); Long obj = getValue(); if (obj == null) widget.setText(""); else widget.setText(obj.toString()); this.unableToSetValue(value); } catch (WarningException ee) { refreshParamEditor(); widget.validate(); widget.repaint(); } }
@Override public String getColumnText(Object element, int columnIndex) { if (!(element instanceof IRequestLogRecord)) return null; final IRequestLogRecord record = (IRequestLogRecord) element; URI uri; try { uri = new URI(record.getRequest().getRequestLine().getUri()); } catch (URISyntaxException e) { return null; } switch (columnIndex) { case 0: return Long.toString(record.getRequestId()); case 1: return record.getHttpHost().toURI(); case 2: return record.getRequest().getRequestLine().getMethod(); case 3: if (uri.getRawQuery() != null) return uri.getRawPath() + "?" + uri.getRawQuery(); else return uri.getRawPath(); case 4: return Integer.valueOf(record.getResponse().getStatusLine().getStatusCode()).toString(); case 5: return getResponseLength(record.getResponse()); case 6: return Long.toString(record.getRequestMilliseconds()); } return null; }
@RequestMapping("admin-batch-remove") public String remove( @RequestParam("id") Long id, @RequestParam("selectedItem") List<Long> selectedItem, RedirectAttributes redirectAttributes) { PartyEntity group = partyEntityManager.findUnique( "from PartyEntity where partyType.id=2 and reference=?", Long.toString(id)); for (Long userId : selectedItem) { PartyEntity user = partyEntityManager.findUnique( "from PartyEntity where partyType.id=1 and reference=?", Long.toString(userId)); PartyStruct partyStruct = partyStructManager.findUnique( "from PartyStruct where partyStructType.id=2 and parentEntity=? and childEntity=?", group, user); if (partyStruct != null) { partyStructManager.remove(partyStruct); } } messageHelper.addFlashMessage(redirectAttributes, "core.success.delete", "删除成功"); return "redirect:/party/admin-batch-list.do"; }
@RequestMapping("admin-batch-save") public String save( @RequestParam("id") Long id, @RequestParam("userIds") List<Long> userIds, RedirectAttributes redirectAttributes) { PartyEntity group = partyEntityManager.findUnique( "from PartyEntity where partyType.id=2 and reference=?", Long.toString(id)); for (Long userId : userIds) { PartyEntity user = partyEntityManager.findUnique( "from PartyEntity where partyType.id=1 and reference=?", Long.toString(userId)); PartyStruct partyStruct = partyStructManager.findUnique( "from PartyStruct where partyStructType.id=2 and parentEntity=? and childEntity=?", group, user); if (partyStruct == null) { PartyStructId partyStructId = new PartyStructId(2L, group.getId(), user.getId()); partyStruct = new PartyStruct(); partyStruct.setId(partyStructId); partyStructManager.save(partyStruct); } } messageHelper.addFlashMessage(redirectAttributes, "core.success.save", "保存成功"); return "redirect:/party/admin-batch-list.do"; }
@Override public Cursor getTrackPointCursor( long trackId, long startTrackPointId, int maxLocations, boolean descending) { if (trackId < 0) { return null; } String selection; String[] selectionArgs; if (startTrackPointId >= 0) { String comparison = descending ? "<=" : ">="; selection = TrackPointsColumns.TRACKID + "=? AND " + TrackPointsColumns._ID + comparison + "?"; selectionArgs = new String[] {Long.toString(trackId), Long.toString(startTrackPointId)}; } else { selection = TrackPointsColumns.TRACKID + "=?"; selectionArgs = new String[] {Long.toString(trackId)}; } String sortOrder = TrackPointsColumns._ID; if (descending) { sortOrder += " DESC"; } if (maxLocations > 0) { sortOrder += " LIMIT " + maxLocations; } return getTrackPointCursor(null, selection, selectionArgs, sortOrder); }
public void onExceededDatabaseQuota( String url, String databaseIdentifier, long currentQuota, long estimatedSize, long totalUsedQuota, WebStorage.QuotaUpdater quotaUpdater) { Log.d( TAG, "event raised onExceededDatabaseQuota estimatedSize: " + Long.toString(estimatedSize) + " currentQuota: " + Long.toString(currentQuota) + " totalUsedQuota: " + Long.toString(totalUsedQuota)); if (estimatedSize < MAX_QUOTA) { // increase for 1Mb long newQuota = currentQuota + 1024 * 1024; Log.d(TAG, "calling quotaUpdater.updateQuota newQuota: " + Long.toString(newQuota)); quotaUpdater.updateQuota(newQuota); } else { // Set the quota to whatever it is and force an error // TODO: get docs on how to handle this properly quotaUpdater.updateQuota(currentQuota); } }