Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
ejercicio2-framework-back
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
Josue
ejercicio2-framework-back
Commits
85a82694
Commit
85a82694
authored
Sep 09, 2020
by
Aaron Gutierrez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modelo de agentes
parent
d3d98737
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
218 additions
and
0 deletions
+218
-0
Agent.java
src/main/java/com/bytesw/bytebot/model/Agent.java
+53
-0
Country.java
src/main/java/com/bytesw/bytebot/model/Country.java
+23
-0
AgentStatusConverter.java
...bytesw/bytebot/model/converters/AgentStatusConverter.java
+20
-0
AgentTypeConverter.java
...m/bytesw/bytebot/model/converters/AgentTypeConverter.java
+20
-0
AgentStatusEnum.java
.../java/com/bytesw/bytebot/model/enums/AgentStatusEnum.java
+34
-0
AgentTypeEnum.java
...in/java/com/bytesw/bytebot/model/enums/AgentTypeEnum.java
+34
-0
LanguageEnum.java
...ain/java/com/bytesw/bytebot/model/enums/LanguageEnum.java
+34
-0
No files found.
src/main/java/com/bytesw/bytebot/model/Agent.java
0 → 100644
View file @
85a82694
package
com
.
bytesw
.
bytebot
.
model
;
import
com.bytesw.bytebot.model.converters.AgentStatusConverter
;
import
com.bytesw.bytebot.model.converters.AgentTypeConverter
;
import
com.bytesw.bytebot.model.enums.AgentStatusEnum
;
import
com.bytesw.bytebot.model.enums.AgentTypeEnum
;
import
com.bytesw.bytebot.model.enums.LanguageEnum
;
import
lombok.*
;
import
javax.persistence.*
;
import
java.io.Serializable
;
@Entity
@Getter
@Setter
@ToString
@EqualsAndHashCode
(
of
=
"id"
)
@NoArgsConstructor
@Table
(
name
=
"BBOT_AGENT"
)
@NamedQuery
(
name
=
"Agent.findByPK"
,
query
=
"Select u from Agent u where u.id = ?1"
)
public
class
Agent
implements
Serializable
{
@Id
@TableGenerator
(
name
=
"BBOT_AGENT_GENERATOR"
,
table
=
"SEQUENCE_TABLE"
,
pkColumnName
=
"SEQ_NAME"
,
valueColumnName
=
"SEQ_COUNT"
,
pkColumnValue
=
"BBOT_AGENT_SEQ"
,
allocationSize
=
1
)
@GeneratedValue
(
strategy
=
GenerationType
.
TABLE
,
generator
=
"BBOT_AGENT_GENERATOR"
)
@Column
(
name
=
"AGEN_ID"
)
private
Long
id
;
@Column
(
name
=
"AGEN_IDEN"
,
nullable
=
false
)
private
String
identifier
;
@Column
(
name
=
"AGEN_DESCR"
,
nullable
=
false
)
private
String
description
;
@Column
(
name
=
"AGEN_VERS"
,
nullable
=
false
)
private
String
version
;
@Column
(
name
=
"AGEN_LANG"
,
nullable
=
false
)
@Convert
(
converter
=
AgentTypeConverter
.
class
)
private
LanguageEnum
language
;
@Column
(
name
=
"AGEN_TZONE"
,
nullable
=
false
)
private
String
timeZone
;
@Column
(
name
=
"AGEN_TZONE"
,
nullable
=
false
)
private
Country
country
;
@Column
(
name
=
"AGEN_STATE"
,
nullable
=
false
)
@Convert
(
converter
=
AgentStatusConverter
.
class
)
private
AgentStatusEnum
state
;
@Column
(
name
=
"AGEN_TYPE"
,
nullable
=
false
)
@Convert
(
converter
=
AgentTypeConverter
.
class
)
private
AgentTypeEnum
type
;
}
src/main/java/com/bytesw/bytebot/model/Country.java
0 → 100644
View file @
85a82694
package
com
.
bytesw
.
bytebot
.
model
;
import
lombok.*
;
import
javax.persistence.*
;
@Entity
@Getter
@Setter
@ToString
@EqualsAndHashCode
(
of
=
"id"
)
@NoArgsConstructor
@Table
(
name
=
"BBOT_COUNTRY"
)
@NamedQuery
(
name
=
"Country.findByPK"
,
query
=
"Select u from Country u where u.id = ?1"
)
public
class
Country
{
@Id
@TableGenerator
(
name
=
"BBOT_COUNTRY_GENERATOR"
,
table
=
"SEQUENCE_TABLE"
,
pkColumnName
=
"SEQ_NAME"
,
valueColumnName
=
"SEQ_COUNT"
,
pkColumnValue
=
"BBOT_COUNTRY_SEQ"
,
allocationSize
=
1
)
@GeneratedValue
(
strategy
=
GenerationType
.
TABLE
,
generator
=
"BBOT_COUNTRY_GENERATOR"
)
@Column
(
name
=
"COUN_ID"
)
private
Long
id
;
@Column
(
name
=
"COUN_IDEN"
,
nullable
=
false
)
private
String
identifier
;
}
src/main/java/com/bytesw/bytebot/model/converters/AgentStatusConverter.java
0 → 100644
View file @
85a82694
package
com
.
bytesw
.
bytebot
.
model
.
converters
;
import
com.bytesw.bytebot.model.enums.AgentStatusEnum
;
import
org.apache.camel.Converter
;
import
javax.persistence.AttributeConverter
;
@Converter
public
class
AgentStatusConverter
implements
AttributeConverter
<
AgentStatusEnum
,
String
>
{
@Override
public
String
convertToDatabaseColumn
(
AgentStatusEnum
agentStatusEnum
)
{
if
(
agentStatusEnum
==
null
)
return
null
;
return
agentStatusEnum
.
getName
();
}
@Override
public
AgentStatusEnum
convertToEntityAttribute
(
String
s
)
{
return
AgentStatusEnum
.
fromString
(
s
);
}
}
src/main/java/com/bytesw/bytebot/model/converters/AgentTypeConverter.java
0 → 100644
View file @
85a82694
package
com
.
bytesw
.
bytebot
.
model
.
converters
;
import
com.bytesw.bytebot.model.enums.AgentTypeEnum
;
import
org.apache.camel.Converter
;
import
javax.persistence.AttributeConverter
;
@Converter
public
class
AgentTypeConverter
implements
AttributeConverter
<
AgentTypeEnum
,
String
>
{
@Override
public
String
convertToDatabaseColumn
(
AgentTypeEnum
agentTypeEnum
)
{
if
(
agentTypeEnum
==
null
)
return
null
;
return
agentTypeEnum
.
getName
();
}
@Override
public
AgentTypeEnum
convertToEntityAttribute
(
String
s
)
{
return
AgentTypeEnum
.
fromString
(
s
);
}
}
src/main/java/com/bytesw/bytebot/model/enums/AgentStatusEnum.java
0 → 100644
View file @
85a82694
package
com
.
bytesw
.
bytebot
.
model
.
enums
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.NoSuchElementException
;
public
enum
AgentStatusEnum
{
CREATE
(
"C"
),
DEPLOYMENT
(
"I"
);
private
final
String
name
;
private
static
final
Map
<
String
,
AgentStatusEnum
>
map
=
new
HashMap
<>();
static
{
for
(
AgentStatusEnum
type
:
AgentStatusEnum
.
values
())
{
map
.
put
(
type
.
name
,
type
);
}
}
AgentStatusEnum
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getName
()
{
return
name
;
}
public
static
AgentStatusEnum
fromString
(
String
name
)
{
if
(
map
.
containsKey
(
name
))
{
return
map
.
get
(
name
);
}
throw
new
NoSuchElementException
(
name
+
" not found"
);
}
}
src/main/java/com/bytesw/bytebot/model/enums/AgentTypeEnum.java
0 → 100644
View file @
85a82694
package
com
.
bytesw
.
bytebot
.
model
.
enums
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.NoSuchElementException
;
public
enum
AgentTypeEnum
{
FREQUENT_QUESTION
(
"F"
);
private
final
String
name
;
private
static
final
Map
<
String
,
AgentTypeEnum
>
map
=
new
HashMap
<>();
static
{
for
(
AgentTypeEnum
type
:
AgentTypeEnum
.
values
())
{
map
.
put
(
type
.
name
,
type
);
}
}
AgentTypeEnum
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getName
()
{
return
name
;
}
public
static
AgentTypeEnum
fromString
(
String
name
)
{
if
(
map
.
containsKey
(
name
))
{
return
map
.
get
(
name
);
}
throw
new
NoSuchElementException
(
name
+
" not found"
);
}
}
src/main/java/com/bytesw/bytebot/model/enums/LanguageEnum.java
0 → 100644
View file @
85a82694
package
com
.
bytesw
.
bytebot
.
model
.
enums
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.NoSuchElementException
;
public
enum
LanguageEnum
{
SPANISH
(
"S"
);
private
final
String
name
;
private
static
final
Map
<
String
,
LanguageEnum
>
map
=
new
HashMap
<>();
static
{
for
(
LanguageEnum
type
:
LanguageEnum
.
values
())
{
map
.
put
(
type
.
name
,
type
);
}
}
LanguageEnum
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getName
()
{
return
name
;
}
public
static
LanguageEnum
fromString
(
String
name
)
{
if
(
map
.
containsKey
(
name
))
{
return
map
.
get
(
name
);
}
throw
new
NoSuchElementException
(
name
+
" not found"
);
}
}
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