mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-18 03:01:05 +01:00
implement UserClientHandler and GroupClientHandler
This commit is contained in:
@@ -55,12 +55,24 @@ public class ScmUrlProvider
|
|||||||
public static final String URLPART_AUTHENTICATION_LOGIN =
|
public static final String URLPART_AUTHENTICATION_LOGIN =
|
||||||
"authentication/login";
|
"authentication/login";
|
||||||
|
|
||||||
|
/** Field description */
|
||||||
|
public static final String URLPART_GROUP = "groups/";
|
||||||
|
|
||||||
|
/** Field description */
|
||||||
|
public static final String URLPART_GROUPS = "groups";
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
public static final String URLPART_REPOSITORIES = "repositories";
|
public static final String URLPART_REPOSITORIES = "repositories";
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
public static final String URLPART_REPOSITORY = "repositories/";
|
public static final String URLPART_REPOSITORY = "repositories/";
|
||||||
|
|
||||||
|
/** Field description */
|
||||||
|
public static final String URLPART_USER = "users/";
|
||||||
|
|
||||||
|
/** Field description */
|
||||||
|
public static final String URLPART_USERS = "users";
|
||||||
|
|
||||||
/** the logger for classVar */
|
/** the logger for classVar */
|
||||||
private static final Logger logger =
|
private static final Logger logger =
|
||||||
LoggerFactory.getLogger(ScmUrlProvider.class);
|
LoggerFactory.getLogger(ScmUrlProvider.class);
|
||||||
@@ -136,6 +148,30 @@ public class ScmUrlProvider
|
|||||||
return extension;
|
return extension;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getGroupUrl(String name)
|
||||||
|
{
|
||||||
|
return getResourceUrl(URLPART_GROUP.concat(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getGroupsUrl()
|
||||||
|
{
|
||||||
|
return getResourceUrl(URLPART_GROUPS);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method description
|
* Method description
|
||||||
*
|
*
|
||||||
@@ -180,6 +216,30 @@ public class ScmUrlProvider
|
|||||||
return resourceUrl;
|
return resourceUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getUserUrl(String name)
|
||||||
|
{
|
||||||
|
return getResourceUrl(URLPART_USER.concat(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getUsersUrl()
|
||||||
|
{
|
||||||
|
return getResourceUrl(URLPART_USERS);
|
||||||
|
}
|
||||||
|
|
||||||
//~--- set methods ----------------------------------------------------------
|
//~--- set methods ----------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -39,13 +39,16 @@ import sonia.scm.group.Group;
|
|||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
|
import com.sun.jersey.api.client.GenericType;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
*/
|
*/
|
||||||
public class JerseyGroupClientHandler implements GroupClientHandler
|
public class JerseyGroupClientHandler extends AbstractClientHandler<Group>
|
||||||
|
implements GroupClientHandler
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -56,7 +59,7 @@ public class JerseyGroupClientHandler implements GroupClientHandler
|
|||||||
*/
|
*/
|
||||||
public JerseyGroupClientHandler(JerseyClientSession session)
|
public JerseyGroupClientHandler(JerseyClientSession session)
|
||||||
{
|
{
|
||||||
this.session = session;
|
super(session, Group.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- methods --------------------------------------------------------------
|
//~--- methods --------------------------------------------------------------
|
||||||
@@ -65,48 +68,13 @@ public class JerseyGroupClientHandler implements GroupClientHandler
|
|||||||
* Method description
|
* Method description
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @param item
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void create(Group item)
|
protected GenericType<List<Group>> createGenericListType()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
return new GenericType<List<Group>>() {}
|
||||||
}
|
;
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param id
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void delete(String id)
|
|
||||||
{
|
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param item
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void delete(Group item)
|
|
||||||
{
|
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param item
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void modify(Group item)
|
|
||||||
{
|
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- get methods ----------------------------------------------------------
|
//~--- get methods ----------------------------------------------------------
|
||||||
@@ -115,14 +83,14 @@ public class JerseyGroupClientHandler implements GroupClientHandler
|
|||||||
* Method description
|
* Method description
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @param id
|
* @param itemId
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Group get(String id)
|
protected String getItemUrl(String itemId)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
return urlProvider.getGroupUrl(itemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -132,13 +100,8 @@ public class JerseyGroupClientHandler implements GroupClientHandler
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<Group> getAll()
|
protected String getItemsUrl()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
return urlProvider.getGroupsUrl();
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- fields ---------------------------------------------------------------
|
|
||||||
|
|
||||||
/** Field description */
|
|
||||||
private JerseyClientSession session;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,13 +39,16 @@ import sonia.scm.user.User;
|
|||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
|
import com.sun.jersey.api.client.GenericType;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
*/
|
*/
|
||||||
public class JerseyUserClientHandler implements UserClientHandler
|
public class JerseyUserClientHandler extends AbstractClientHandler<User>
|
||||||
|
implements UserClientHandler
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -56,7 +59,7 @@ public class JerseyUserClientHandler implements UserClientHandler
|
|||||||
*/
|
*/
|
||||||
public JerseyUserClientHandler(JerseyClientSession session)
|
public JerseyUserClientHandler(JerseyClientSession session)
|
||||||
{
|
{
|
||||||
this.session = session;
|
super(session, User.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- methods --------------------------------------------------------------
|
//~--- methods --------------------------------------------------------------
|
||||||
@@ -65,48 +68,13 @@ public class JerseyUserClientHandler implements UserClientHandler
|
|||||||
* Method description
|
* Method description
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @param item
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void create(User item)
|
protected GenericType<List<User>> createGenericListType()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
return new GenericType<List<User>>() {}
|
||||||
}
|
;
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param id
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void delete(String id)
|
|
||||||
{
|
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param item
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void delete(User item)
|
|
||||||
{
|
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param item
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void modify(User item)
|
|
||||||
{
|
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- get methods ----------------------------------------------------------
|
//~--- get methods ----------------------------------------------------------
|
||||||
@@ -115,14 +83,14 @@ public class JerseyUserClientHandler implements UserClientHandler
|
|||||||
* Method description
|
* Method description
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @param id
|
* @param itemId
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public User get(String id)
|
protected String getItemUrl(String itemId)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
return urlProvider.getUserUrl(itemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -132,13 +100,8 @@ public class JerseyUserClientHandler implements UserClientHandler
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<User> getAll()
|
protected String getItemsUrl()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
return urlProvider.getUsersUrl();
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- fields ---------------------------------------------------------------
|
|
||||||
|
|
||||||
/** Field description */
|
|
||||||
private JerseyClientSession session;
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user