Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
java-gitlab-api
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
沈俊林
java-gitlab-api
Commits
ef25978f
Commit
ef25978f
authored
Apr 14, 2014
by
Adam Retter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added access Enum
parent
f377b902
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
5 deletions
+47
-5
GitlabAPI.java
src/main/java/org/gitlab/api/GitlabAPI.java
+1
-1
Query.java
src/main/java/org/gitlab/api/http/Query.java
+18
-0
GitlabAccessLevel.java
src/main/java/org/gitlab/api/models/GitlabAccessLevel.java
+24
-0
GitlabGroup.java
src/main/java/org/gitlab/api/models/GitlabGroup.java
+4
-4
No files found.
src/main/java/org/gitlab/api/GitlabAPI.java
View file @
ef25978f
...
...
@@ -145,7 +145,7 @@ public class GitlabAPI {
*
* @return The GitLab Group
*/
public
GitlabGroup
createGroup
(
String
name
,
String
path
,
String
ldapCn
,
Integer
ldapAccess
)
throws
IOException
{
public
GitlabGroup
createGroup
(
String
name
,
String
path
,
String
ldapCn
,
GitlabAccessLevel
ldapAccess
)
throws
IOException
{
Query
query
=
new
Query
()
.
append
(
"name"
,
name
)
...
...
src/main/java/org/gitlab/api/http/Query.java
View file @
ef25978f
package
org
.
gitlab
.
api
.
http
;
import
org.gitlab.api.models.GitlabAccessLevel
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLEncoder
;
import
java.util.ArrayList
;
...
...
@@ -87,6 +89,22 @@ public class Query {
return
this
;
}
/**
* Conditionally append a parameter to the query
* if the value of the parameter is not null
*
* @param name Parameter name
* @param value Parameter value
*
* @throws java.io.UnsupportedEncodingException If the provided value cannot be URL Encoded
*/
public
Query
appendIf
(
final
String
name
,
final
GitlabAccessLevel
value
)
throws
UnsupportedEncodingException
{
if
(
value
!=
null
)
{
append
(
name
,
Integer
.
toString
(
value
.
accessValue
));
}
return
this
;
}
/**
* Returns a Query suitable for appending
* to a URI
...
...
src/main/java/org/gitlab/api/models/GitlabAccessLevel.java
0 → 100644
View file @
ef25978f
package
org
.
gitlab
.
api
.
models
;
public
enum
GitlabAccessLevel
{
Guest
(
10
),
Reporter
(
20
),
Developer
(
30
),
Master
(
40
),
Owner
(
50
);
public
final
int
accessValue
;
GitlabAccessLevel
(
int
accessValue
)
{
this
.
accessValue
=
accessValue
;
}
public
static
GitlabAccessLevel
fromAccessValue
(
final
int
accessValue
)
throws
IllegalArgumentException
{
for
(
final
GitlabAccessLevel
gitlabAccessLevel
:
GitlabAccessLevel
.
values
())
{
if
(
gitlabAccessLevel
.
accessValue
==
accessValue
)
{
return
gitlabAccessLevel
;
}
}
throw
new
IllegalArgumentException
(
"No GitLab Access Level enum constant with access value: "
+
accessValue
);
}
}
\ No newline at end of file
src/main/java/org/gitlab/api/models/GitlabGroup.java
View file @
ef25978f
...
...
@@ -48,11 +48,11 @@ public class GitlabGroup {
this
.
_ldapCn
=
ldapCn
;
}
public
Integer
getLdapAccess
()
{
return
_ldapAccess
;
public
GitlabAccessLevel
getLdapAccess
()
{
return
GitlabAccessLevel
.
fromAccessValue
(
_ldapAccess
)
;
}
public
void
setLdapAccess
(
Integer
ldapAccess
)
{
this
.
_ldapAccess
=
ldap
Access
;
public
void
setLdapAccess
(
GitlabAccessLevel
ldapGitlabAccessLevel
)
{
this
.
_ldapAccess
=
ldap
GitlabAccessLevel
.
accessValue
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment