Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dda-front
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jose Francisco Montiel Jimenez
dda-front
Commits
11319278
Commit
11319278
authored
Jun 26, 2024
by
Jose Francisco Montiel Jimenez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clase de validaciones
parent
90d2251c
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
261 additions
and
24 deletions
+261
-24
dominio/.classpath
dominio/.classpath
+1
-1
dominio/.settings/org.eclipse.jdt.core.prefs
dominio/.settings/org.eclipse.jdt.core.prefs
+9
-4
dominio/.settings/org.eclipse.wst.common.project.facet.core.xml
...o/.settings/org.eclipse.wst.common.project.facet.core.xml
+1
-1
front/.classpath
front/.classpath
+1
-1
front/.settings/org.eclipse.jdt.core.prefs
front/.settings/org.eclipse.jdt.core.prefs
+3
-3
front/src/main/java/com/mx/dla/util/Validaciones.java
front/src/main/java/com/mx/dla/util/Validaciones.java
+216
-0
persistencia/.classpath
persistencia/.classpath
+1
-1
persistencia/.settings/org.eclipse.jdt.core.prefs
persistencia/.settings/org.eclipse.jdt.core.prefs
+9
-4
persistencia/.settings/org.eclipse.wst.common.project.facet.core.xml
...a/.settings/org.eclipse.wst.common.project.facet.core.xml
+1
-1
pom.xml
pom.xml
+8
-2
servicios/.classpath
servicios/.classpath
+1
-1
servicios/.settings/org.eclipse.jdt.core.prefs
servicios/.settings/org.eclipse.jdt.core.prefs
+9
-4
servicios/.settings/org.eclipse.wst.common.project.facet.core.xml
...s/.settings/org.eclipse.wst.common.project.facet.core.xml
+1
-1
No files found.
dominio/.classpath
View file @
11319278
...
...
@@ -6,7 +6,7 @@
<attribute
name=
"org.eclipse.jst.component.nondependency"
value=
""
/>
</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>
...
...
dominio/.settings/org.eclipse.jdt.core.prefs
View file @
11319278
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
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
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=
ignore
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=
warning
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.
7
org.eclipse.jdt.core.compiler.source=1.
8
dominio/.settings/org.eclipse.wst.common.project.facet.core.xml
View file @
11319278
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<installed
facet=
"jst.utility"
version=
"1.0"
/>
<installed
facet=
"java"
version=
"1.
7
"
/>
<installed
facet=
"java"
version=
"1.
8
"
/>
</faceted-project>
front/.classpath
View file @
11319278
...
...
@@ -11,7 +11,7 @@
<attribute
name=
"org.eclipse.jst.component.dependency"
value=
"/WEB-INF/lib"
/>
</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>
...
...
front/.settings/org.eclipse.jdt.core.prefs
View file @
11319278
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.
7
org.eclipse.jdt.core.compiler.compliance=1.
7
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.
8
org.eclipse.jdt.core.compiler.compliance=1.
8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.
7
org.eclipse.jdt.core.compiler.source=1.
8
front/src/main/java/com/mx/dla/util/Validaciones.java
0 → 100644
View file @
11319278
package
com.mx.dla.util
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
org.owasp.encoder.Encode
;
public
class
Validaciones
{
private
static
final
List
<
String
>
FORBIDDEN_WORDS
=
Collections
.
unmodifiableList
(
Arrays
.
asList
(
"<script>"
,
"<a>"
,
"onclick"
));
public
static
String
encodeString
(
String
dato
)
{
return
Encode
.
forHtml
(
dato
);
}
public
static
String
[]
validaListaNegra
(
String
dato
)
{
String
[]
respuesta
=
new
String
[
2
];
respuesta
[
0
]
=
"1"
;
respuesta
[
1
]
=
""
;
if
(
FORBIDDEN_WORDS
.
stream
().
anyMatch
(
word
->
dato
.
contains
(
word
.
toLowerCase
())))
{
respuesta
[
0
]
=
"0"
;
respuesta
[
1
]
=
"No es posible registrar el valor ingresado"
;
}
return
respuesta
;
}
public
static
String
[]
validaShort
(
String
dato
,
short
min
,
short
max
,
int
minLength
,
int
maxLength
)
{
String
[]
respuesta
=
new
String
[
2
];
Pattern
pat
=
Pattern
.
compile
(
"^-?\\d+$"
);
Matcher
mat
=
pat
.
matcher
(
dato
);
Short
datoShort
=
null
;
respuesta
[
1
]
=
""
;
if
(
mat
.
matches
())
{
respuesta
[
0
]
=
"1"
;
datoShort
=
Short
.
parseShort
(
dato
);
}
else
{
respuesta
[
0
]
=
"0"
;
respuesta
[
1
]
=
"El valor ingresado no es de tipo short"
;
}
if
(
datoShort
!=
null
)
{
if
(
min
!=
-
1
&&
datoShort
<
min
)
{
respuesta
[
0
]
=
"0"
;
respuesta
[
1
]
=
"El valor ingresado es menor que el valor mínimo permitido"
;
}
if
(
max
!=
-
1
&&
datoShort
>
max
)
{
respuesta
[
0
]
=
"0"
;
respuesta
[
1
]
=
"El valor ingresado es mayor que el valor máximo permitido"
;
}
if
(
maxLength
!=
-
1
&&
dato
.
length
()
>
maxLength
)
{
respuesta
[
0
]
=
"0"
;
respuesta
[
1
]
=
"La longitud del valor ingresado es mayor que la longitud máximo permitida"
;
}
if
(
minLength
!=
-
1
&&
dato
.
length
()
<
minLength
)
{
respuesta
[
0
]
=
"0"
;
respuesta
[
1
]
=
"La longitud del valor ingresado es menor que la longitud mínimo permitida"
;
}
}
return
respuesta
;
}
public
static
String
[]
validaInt
(
String
dato
,
int
min
,
int
max
,
int
minLength
,
int
maxLength
)
{
String
[]
respuesta
=
new
String
[
2
];
Pattern
pat
=
Pattern
.
compile
(
"^-?\\d+$"
);
Matcher
mat
=
pat
.
matcher
(
dato
);
Integer
datoInt
=
null
;
respuesta
[
1
]
=
""
;
if
(
mat
.
matches
())
{
respuesta
[
0
]
=
"1"
;
datoInt
=
Integer
.
parseInt
(
dato
);
}
else
{
respuesta
[
0
]
=
"0"
;
respuesta
[
1
]
=
"El valor ingresado no es de tipo int"
;
}
if
(
datoInt
!=
null
)
{
if
(
min
!=
-
1
&&
datoInt
<
min
)
{
respuesta
[
0
]
=
"0"
;
respuesta
[
1
]
=
"El valor ingresado es menor que el valor mínimo permitido"
;
}
if
(
max
!=
-
1
&&
datoInt
>
max
)
{
respuesta
[
0
]
=
"0"
;
respuesta
[
1
]
=
"El valor ingresado es mayor que el valor máximo permitido"
;
}
if
(
maxLength
!=
-
1
&&
dato
.
length
()
>
maxLength
)
{
respuesta
[
0
]
=
"0"
;
respuesta
[
1
]
=
"La longitud del valor ingresado es mayor que la longitud máximo permitida"
;
}
if
(
minLength
!=
-
1
&&
dato
.
length
()
<
minLength
)
{
respuesta
[
0
]
=
"0"
;
respuesta
[
1
]
=
"La longitud del valor ingresado es menor que la longitud mínimo permitida"
;
}
}
return
respuesta
;
}
public
static
String
[]
validaLong
(
String
dato
,
long
min
,
long
max
,
int
minLength
,
int
maxLength
)
{
String
[]
respuesta
=
new
String
[
2
];
Pattern
pat
=
Pattern
.
compile
(
"^-?\\d+$"
);
Matcher
mat
=
pat
.
matcher
(
dato
);
Long
datoLong
=
null
;
respuesta
[
1
]
=
""
;
if
(
mat
.
matches
())
{
respuesta
[
0
]
=
"1"
;
datoLong
=
Long
.
parseLong
(
dato
);
}
else
{
respuesta
[
0
]
=
"0"
;
respuesta
[
1
]
=
"El valor ingresado no es de tipo long"
;
}
if
(
datoLong
!=
null
)
{
if
(
min
!=
-
1
&&
datoLong
<
min
)
{
respuesta
[
0
]
=
"0"
;
respuesta
[
1
]
=
"El valor ingresado es menor que el valor mínimo permitido"
;
}
if
(
max
!=
-
1
&&
datoLong
>
max
)
{
respuesta
[
0
]
=
"0"
;
respuesta
[
1
]
=
"El valor ingresado es mayor que el valor máximo permitido"
;
}
if
(
maxLength
!=
-
1
&&
dato
.
length
()
>
maxLength
)
{
respuesta
[
0
]
=
"0"
;
respuesta
[
1
]
=
"La longitud del valor ingresado es mayor que la longitud máximo permitida"
;
}
if
(
minLength
!=
-
1
&&
dato
.
length
()
<
minLength
)
{
respuesta
[
0
]
=
"0"
;
respuesta
[
1
]
=
"La longitud del valor ingresado es menor que la longitud mínimo permitida"
;
}
}
return
respuesta
;
}
public
static
String
[]
validaDouble
(
String
dato
,
double
min
,
double
max
,
int
minLength
,
int
maxLength
)
{
String
[]
respuesta
=
new
String
[
2
];
Pattern
pat
=
Pattern
.
compile
(
"^-?\\d+(\\.\\d+)?$"
);
Matcher
mat
=
pat
.
matcher
(
dato
);
Double
datoDouble
=
null
;
respuesta
[
1
]
=
""
;
if
(
mat
.
matches
())
{
respuesta
[
0
]
=
"1"
;
datoDouble
=
Double
.
parseDouble
(
dato
);
}
else
{
respuesta
[
0
]
=
"0"
;
respuesta
[
1
]
=
"El valor ingresado no es de tipo double"
;
}
if
(
datoDouble
!=
null
)
{
if
(
min
!=
-
1
&&
datoDouble
<
min
)
{
respuesta
[
0
]
=
"0"
;
respuesta
[
1
]
=
"El valor ingresado es menor que el valor mínimo permitido"
;
}
if
(
max
!=
-
1
&&
datoDouble
>
max
)
{
respuesta
[
0
]
=
"0"
;
respuesta
[
1
]
=
"El valor ingresado es mayor que el valor máximo permitido"
;
}
if
(
maxLength
!=
-
1
&&
dato
.
length
()
>
maxLength
)
{
respuesta
[
0
]
=
"0"
;
respuesta
[
1
]
=
"La longitud del valor ingresado es mayor que la longitud máximo permitida"
;
}
if
(
minLength
!=
-
1
&&
dato
.
length
()
<
minLength
)
{
respuesta
[
0
]
=
"0"
;
respuesta
[
1
]
=
"La longitud del valor ingresado es menor que la longitud mínimo permitida"
;
}
}
return
respuesta
;
}
public
static
String
[]
validaFloat
(
String
dato
,
float
min
,
float
max
,
int
minLength
,
int
maxLength
)
{
String
[]
respuesta
=
new
String
[
2
];
Pattern
pat
=
Pattern
.
compile
(
"^-?\\d+(\\.\\d+)?$"
);
Matcher
mat
=
pat
.
matcher
(
dato
);
Float
datoFloat
=
null
;
respuesta
[
1
]
=
""
;
if
(
mat
.
matches
())
{
respuesta
[
0
]
=
"1"
;
datoFloat
=
Float
.
parseFloat
(
dato
);
}
else
{
respuesta
[
0
]
=
"0"
;
respuesta
[
1
]
=
"El valor ingresado no es de tipo float"
;
}
if
(
datoFloat
!=
null
)
{
if
(
min
!=
-
1
&&
datoFloat
<
min
)
{
respuesta
[
0
]
=
"0"
;
respuesta
[
1
]
=
"El valor ingresado es menor que el valor mínimo permitido"
;
}
if
(
max
!=
-
1
&&
datoFloat
>
max
)
{
respuesta
[
0
]
=
"0"
;
respuesta
[
1
]
=
"El valor ingresado es mayor que el valor máximo permitido"
;
}
if
(
maxLength
!=
-
1
&&
dato
.
length
()
>
maxLength
)
{
respuesta
[
0
]
=
"0"
;
respuesta
[
1
]
=
"La longitud del valor ingresado es mayor que la longitud máximo permitida"
;
}
if
(
minLength
!=
-
1
&&
dato
.
length
()
<
minLength
)
{
respuesta
[
0
]
=
"0"
;
respuesta
[
1
]
=
"La longitud del valor ingresado es menor que la longitud mínimo permitida"
;
}
}
return
respuesta
;
}
public
static
String
[]
validaString
(
String
dato
,
int
minLength
,
int
maxLength
)
{
String
[]
respuesta
=
new
String
[
2
];
respuesta
=
validaListaNegra
(
dato
);
if
(
dato
!=
null
)
{
if
(
maxLength
!=
-
1
&&
dato
.
length
()
>
maxLength
)
{
respuesta
[
0
]
=
"0"
;
respuesta
[
1
]
=
"La longitud del valor ingresado es mayor que la longitud máximo permitida"
;
}
if
(
minLength
!=
-
1
&&
dato
.
length
()
<
minLength
)
{
respuesta
[
0
]
=
"0"
;
respuesta
[
1
]
=
"La longitud del valor ingresado es menor que la longitud mínimo permitida"
;
}
}
return
respuesta
;
}
}
persistencia/.classpath
View file @
11319278
...
...
@@ -17,7 +17,7 @@
<attribute
name=
"org.eclipse.jst.component.nondependency"
value=
""
/>
</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>
...
...
persistencia/.settings/org.eclipse.jdt.core.prefs
View file @
11319278
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
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
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=
ignore
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=
warning
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.
7
org.eclipse.jdt.core.compiler.source=1.
8
persistencia/.settings/org.eclipse.wst.common.project.facet.core.xml
View file @
11319278
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<installed
facet=
"jst.utility"
version=
"1.0"
/>
<installed
facet=
"java"
version=
"1.
7
"
/>
<installed
facet=
"java"
version=
"1.
8
"
/>
</faceted-project>
pom.xml
View file @
11319278
...
...
@@ -283,6 +283,12 @@
<artifactId>
javax.jws-api
</artifactId>
<version>
1.1
</version>
</dependency>
<dependency>
<groupId>
org.owasp.encoder
</groupId>
<artifactId>
encoder
</artifactId>
<version>
1.2.2
</version>
</dependency>
</dependencies>
<profiles>
...
...
@@ -380,8 +386,8 @@
<artifactId>
maven-compiler-plugin
</artifactId>
<version>
3.1
</version>
<configuration>
<source>
1.
7
</source>
<target>
1.
7
</target>
<source>
1.
8
</source>
<target>
1.
8
</target>
<encoding>
iso-8859-1
</encoding>
</configuration>
</plugin>
...
...
servicios/.classpath
View file @
11319278
...
...
@@ -12,7 +12,7 @@
<attribute
name=
"org.eclipse.jst.component.nondependency"
value=
""
/>
</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>
...
...
servicios/.settings/org.eclipse.jdt.core.prefs
View file @
11319278
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
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
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=
ignore
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=
warning
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.
7
org.eclipse.jdt.core.compiler.source=1.
8
servicios/.settings/org.eclipse.wst.common.project.facet.core.xml
View file @
11319278
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<installed
facet=
"jst.utility"
version=
"1.0"
/>
<installed
facet=
"java"
version=
"1.
7
"
/>
<installed
facet=
"java"
version=
"1.
8
"
/>
</faceted-project>
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