-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lib: add Quota model and the max. number of queries inside the CellBa…
…se token, #TASK-4791, #TASK-4641
- Loading branch information
Showing
6 changed files
with
165 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
cellbase-core/src/main/java/org/opencb/cellbase/core/token/Quota.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* Copyright 2015-2020 OpenCB | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.opencb.cellbase.core.token; | ||
|
||
public class Quota { | ||
private String token; | ||
private String date; // date consists of year + month, e.g.: 202304 | ||
private long numQueries; | ||
|
||
public Quota() { | ||
} | ||
|
||
public Quota(String token, String date, long numQueries) { | ||
this.token = token; | ||
this.date = date; | ||
this.numQueries = numQueries; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
final StringBuilder sb = new StringBuilder("Quota{"); | ||
sb.append("token='").append(token).append('\''); | ||
sb.append(", date='").append(date).append('\''); | ||
sb.append(", numQueries=").append(numQueries); | ||
sb.append('}'); | ||
return sb.toString(); | ||
} | ||
|
||
public String getToken() { | ||
return token; | ||
} | ||
|
||
public Quota setToken(String token) { | ||
this.token = token; | ||
return this; | ||
} | ||
|
||
public String getDate() { | ||
return date; | ||
} | ||
|
||
public Quota setDate(int year, int month) { | ||
this.date = year + String.format("%02d", month); | ||
return this; | ||
} | ||
|
||
public Quota setDate(String date) { | ||
this.date = date; | ||
return this; | ||
} | ||
|
||
public long getNumQueries() { | ||
return numQueries; | ||
} | ||
|
||
public Quota setNumQueries(long numQueries) { | ||
this.numQueries = numQueries; | ||
return this; | ||
} | ||
} |
Oops, something went wrong.