Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/1.0.21.1 #104

Merged
merged 17 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
Expand Down
6 changes: 3 additions & 3 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.lambda.genericSignature=do not generate
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.shareCommonFinallyBlocks=disabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
Expand Down Expand Up @@ -169,7 +169,7 @@ org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.processAnnotations=disabled
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.compiler.storeAnnotations=disabled
org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled
org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL
Expand Down
238 changes: 190 additions & 48 deletions README.md

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<project.build.sourceEncoding>ISO-8859-1</project.build.sourceEncoding>
</properties>
<artifactId>SW-JAVA</artifactId>
<version>1.0.19.4</version>
<version>1.0.21.1</version>
<packaging>jar</packaging>
<scm>
<url>https://github.com/lunasoft/sw-sdk-java</url>
Expand Down Expand Up @@ -89,8 +89,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -139,29 +139,29 @@
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.8.1</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.13</version>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
<version>5.3.1</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpasyncclient</artifactId>
<version>4.1.4</version>
<version>4.1.5</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.5.6</version>
<version>4.5.14</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20180130</version>
<version>20240303</version>
</dependency>
<dependency>
<groupId>com.googlecode.juniversalchardet</groupId>
Expand All @@ -176,12 +176,12 @@
<dependency>
<groupId>jakarta.xml.ws</groupId>
<artifactId>jakarta.xml.ws-api</artifactId>
<version>2.3.3</version>
</dependency>
<version>4.0.2</version>
</dependency>
<dependency>
<groupId>com.sun.xml.messaging.saaj</groupId>
<artifactId>saaj-impl</artifactId>
<version>1.5.1</version>
<version>3.0.4</version>
</dependency>
<dependency>
<groupId>mx.com.sw.services</groupId>
Expand All @@ -191,7 +191,7 @@
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.9</version>
<version>2.11.0</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
Expand Down
112 changes: 68 additions & 44 deletions src/main/java/Services/Account/AccountUser/SWAccountUserService.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import Exceptions.AuthException;
import Exceptions.GeneralException;
import Services.SWService;
import Utils.Helpers.EnumAccountUser.AccountUserProfiles;
import Utils.Requests.Account.AccountUser.AccountUserOptionsRequest;
import Utils.Requests.Account.AccountUser.AccountUserRequest;
import Utils.Responses.IResponse;
Expand All @@ -22,12 +21,13 @@
public class SWAccountUserService extends SWService {

/**
* Constructor que requiere credenciales de autenticación para el servicio.
* Constructor que inicializa el servicio utilizando credenciales de
* autenticación.
*
* @param user Nombre de usuario para la autenticación.
* @param password Contraseña para la autenticación.
* @param URI URI base para la autenticación.
* @param URIAPI URI de la API para el servicio.
* @param URIAPI URI base para la autenticación.
* @param proxyHost Host del proxy (puede ser nulo).
* @param proxyPort Puerto del proxy.
* @throws AuthException Si la autenticación falla.
Expand All @@ -38,7 +38,7 @@ public SWAccountUserService(String user, String password, String URI, String URI
}

/**
* Constructor que utiliza un token de autenticación para el servicio.
* Constructor que inicializa el servicio utilizando un token de autenticación.
*
* @param token Token de autenticación.
* @param URIAPI URI de la API para el servicio.
Expand All @@ -52,48 +52,47 @@ public SWAccountUserService(String token, String URIAPI, String proxyHost, int p
/**
* Crea un nuevo usuario de cuenta con la información proporcionada.
*
* @param email Correo electrónico del nuevo usuario.
* @param passwordUser Contraseña del nuevo usuario.
* @param name Nombre del nuevo usuario.
* @param rfc RFC del nuevo usuario.
* @param stamps Número de timbres del nuevo usuario.
* @param profile Perfil del nuevo usuario.
* @param unlimited Indica si el usuario tiene acceso ilimitado.
* @param active Indica si el usuario está activo.
* @param email Correo electrónico del nuevo usuario.
* @param passwordUser Contraseña del nuevo usuario.
* @param name Nombre del nuevo usuario.
* @param rfc RFC del nuevo usuario.
* @param stamps Número de timbres asignados al usuario.
* @param phone Número telefónico del usuario.
* @param unlimited Indica si el usuario tiene acceso ilimitado.
* @param notificationEmail Correo electrónico para notificaciones.
* @return IResponse con el resultado de la operación.
* @throws AuthException Si la autenticación falla.
* @throws GeneralException Si ocurre un error general.
* @throws IOException Si hay un error de entrada/salida.
*/

public IResponse CrearUsuario(String email, String passwordUser, String name, String rfc, int stamps,
AccountUserProfiles profile, boolean unlimited, boolean active)
String phone, boolean unlimited, String notificationEmail)
throws AuthException, GeneralException, IOException {
AccountUserOptionsRequest settings = AccountUserOptionsRequest.crearUsuarioRequest(getToken(), getURIAPI(),
email, passwordUser,
name, rfc, stamps, profile, unlimited, active, getProxyHost(), getProxyPort());
email, passwordUser, name, rfc, stamps, phone, unlimited, notificationEmail, getProxyHost(),
getProxyPort());
return AccountUserRequest.createCreateUserRequest(settings);
}

/**
* Actualiza la información de un usuario existente.
*
* @param idUser Identificador único del usuario a actualizar.
* @param name Nuevo nombre del usuario.
* @param rfc Nuevo RFC del usuario.
* @param unlimited Indica si el usuario tiene acceso ilimitado.
* @param active Indica si el usuario está activo.
* @param idUser Identificador único del usuario a actualizar.
* @param name Nuevo nombre del usuario.
* @param rfc Nuevo RFC del usuario.
* @param unlimited Indica si el usuario tiene acceso ilimitado.
* @param phone Nuevo número telefónico.
* @param notificationEmail Nuevo correo para notificaciones.
* @return IResponse con el resultado de la operación.
* @throws AuthException Si la autenticación falla.
* @throws GeneralException Si ocurre un error general.
* @throws IOException Si hay un error de entrada/salida.
*/
public IResponse ActualizarUsuario(UUID idUser, String name, String rfc, boolean unlimited, boolean active)
public IResponse ActualizarUsuario(UUID idUser, String name, String rfc, boolean unlimited, String phone,
String notificationEmail)
throws AuthException, GeneralException, IOException {

AccountUserOptionsRequest settings = AccountUserOptionsRequest.actualizarUsuarioRequest(getToken(), getURIAPI(),
idUser, name, rfc,
unlimited, active, getProxyHost(), getProxyPort());
idUser, name, rfc, unlimited, phone, notificationEmail, getProxyHost(), getProxyPort());
return AccountUserRequest.createUpdateUserRequest(settings, idUser);
}

Expand All @@ -113,51 +112,76 @@ public IResponse EliminarUsuario(UUID idUser) throws AuthException, GeneralExcep
}

/**
* Obtiene la lista de usuarios paginada.
* Obtiene la lista de usuarios existentes.
*
* @param page Número de página.
* @param pageSize Número usuarios por página.
* @return IResponse con la lista de usuarios.
* @throws AuthException Si la autenticación falla.
* @throws GeneralException Si ocurre un error general.
* @throws IOException Si hay un error de entrada/salida.
*/
public IResponse ObtenerUsuarios(int page, int pageSize) throws AuthException, GeneralException, IOException {

public IResponse ObtenerUsuariosHijo() throws AuthException, GeneralException, IOException {
AccountUserOptionsRequest settings = AccountUserOptionsRequest.obtenerUsuariosRequest(getToken(), getURIAPI(),
page, pageSize,
getProxyHost(), getProxyPort());
return AccountUserRequest.createGetAllUsersRequest(settings, page, pageSize);
return AccountUserRequest.createGetAllUsersRequest(settings);
}

/**
* Obtiene la información del usuario actual.
* Obtiene información de un usuario específico por su ID.
*
* @param idUser Identificador único del usuario.
* @return IResponse con la información del usuario.
* @throws AuthException Si la autenticación falla.
* @throws GeneralException Si ocurre un error general.
* @throws IOException Si hay un error de entrada/salida.
*/
public IResponse ObtenerInfoUsuario() throws AuthException, GeneralException, IOException {
public IResponse ObtenerUsuarioPorId(UUID idUser) throws AuthException, GeneralException, IOException {
AccountUserOptionsRequest settings = AccountUserOptionsRequest.obtenerUsuarioPorTokenRequest(getToken(),
getURIAPI(), getProxyHost(),
getProxyPort());
return AccountUserRequest.createGetUserRequest(settings);
getURIAPI(), getProxyHost(), getProxyPort());
return AccountUserRequest.createGetUserById(settings, idUser);
}

/**
* Obtiene la información de un usuario específico por su identificador ú
* ico.
* Obtiene un usuario por su RFC.
*
* @param idUser Identificador único del usuario.
* @param rfc RFC del usuario.
* @return IResponse con la información del usuario.
* @throws AuthException Si la autenticación falla.
* @throws GeneralException Si ocurre un error general.
* @throws IOException Si hay un error de entrada/salida.
*/
public IResponse ObtenerInfoUsuarioId(UUID idUser) throws AuthException, GeneralException, IOException {
AccountUserOptionsRequest settings = AccountUserOptionsRequest.usuarioIdRequest(getToken(), getURIAPI(), idUser,
getProxyHost(), getProxyPort());
return AccountUserRequest.createGetUserIdRequest(settings, idUser);
public IResponse ObtenerUsuarioPorRfc(String rfc) throws AuthException, GeneralException, IOException {
AccountUserOptionsRequest settings = AccountUserOptionsRequest.obtenerUsuarioPorTokenRequest(getToken(),
getURIAPI(), getProxyHost(), getProxyPort());
return AccountUserRequest.createGetUserByRfc(settings, rfc);
}

/**
* Obtiene un usuario por su correo electrónico.
*
* @param email Correo electrónico del usuario.
* @return IResponse con la información del usuario.
* @throws AuthException Si la autenticación falla.
* @throws GeneralException Si ocurre un error general.
* @throws IOException Si hay un error de entrada/salida.
*/
public IResponse ObtenerUsuarioPorEmail(String email) throws AuthException, GeneralException, IOException {
AccountUserOptionsRequest settings = AccountUserOptionsRequest.obtenerUsuarioPorTokenRequest(getToken(),
getURIAPI(), getProxyHost(), getProxyPort());
return AccountUserRequest.createGetUserByEmail(settings, email);
}

/**
* Obtiene los usuarios activos.
*
* @param isActive Indica si se buscan usuarios activos o inactivos.
* @return IResponse con la lista de usuarios.
* @throws AuthException Si la autenticación falla.
* @throws GeneralException Si ocurre un error general.
* @throws IOException Si hay un error de entrada/salida.
*/
public IResponse ObtenerUsuariosActivos(Boolean isActive) throws AuthException, GeneralException, IOException {
AccountUserOptionsRequest settings = AccountUserOptionsRequest.obtenerUsuarioPorTokenRequest(getToken(),
getURIAPI(), getProxyHost(), getProxyPort());
return AccountUserRequest.createGetUserByActive(settings, isActive);
}
}
Loading
Loading