/src/main/java/com/google/ie/business/service/ShardedCounterService.java

http://thoughtsite.googlecode.com/ · Java · 85 lines · 11 code · 13 blank · 61 comment · 0 complexity · c9fe975ba76fa77198b02a9cd67b0242 MD5 · raw file

  1. /* Copyright 2010 Google Inc.
  2. *
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS.
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License
  14. */
  15. package com.google.ie.business.service;
  16. import com.google.ie.business.domain.ShardedCounter;
  17. /**
  18. * A Service specification for the {@link ShardedCounter} entity.
  19. *
  20. * @author gmaurya
  21. *
  22. */
  23. public interface ShardedCounterService {
  24. /**
  25. * This method get the merged shardedcounter for a specific parentKey;
  26. *
  27. * @param parentKey key of the object for which merging of shareded counter
  28. * is being done.
  29. * @return ShardedCounter Aggregate sharded counter.
  30. */
  31. public ShardedCounter getMergedShardedCounter(String parentKey);
  32. /**
  33. * Get total point for a specific parent key.
  34. *
  35. * @param parentKey String
  36. * @return long
  37. */
  38. public long getTotalPoint(String parentKey);
  39. /**
  40. * Increment negative points for a specific parent key.
  41. *
  42. * @param parentKey Key of object
  43. */
  44. public void incrementNegativePoints(String parentKey);
  45. /**
  46. * increment positive points for a specific parent key.
  47. *
  48. * @param parentKey Key of object
  49. */
  50. public void incrementPositivePoints(String parentKey);
  51. /**
  52. * Retrieves negative points for a specific parent key.
  53. *
  54. * @param parentKey Key of object.
  55. * @return total negative points.
  56. */
  57. public int getNegativePoint(String parentKey);
  58. /**
  59. * Get positive points for a specific parent key.
  60. *
  61. * @param parentKey Key of object.
  62. * @return total positive points.
  63. */
  64. public int getPositivePoint(String parentKey);
  65. /**
  66. * update Total Points for a specific key.
  67. *
  68. * @param parentKey Key of object.
  69. * @param points
  70. */
  71. public void updateTotalPoints(String parentKey, long points);
  72. }