Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mytime
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
Narendar Vakiti
mytime
Commits
aad89757
Commit
aad89757
authored
Jul 19, 2018
by
Vijay Chaitanya
Committed by
tdutta-nisum-com
Jul 19, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chages done as per conflicts (#25)
parent
4035674c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
65 deletions
+21
-65
DomainController.java
...in/java/com/nisum/mytime/controller/DomainController.java
+5
-16
Domains.java
src/main/java/com/nisum/mytime/model/Domains.java
+0
-5
DomainRepo.java
src/main/java/com/nisum/mytime/repository/DomainRepo.java
+0
-5
DomainService.java
src/main/java/com/nisum/mytime/service/DomainService.java
+0
-4
DomainServiceImpl.java
...main/java/com/nisum/mytime/service/DomainServiceImpl.java
+9
-24
MyTimeUtils.java
src/main/java/com/nisum/mytime/utils/MyTimeUtils.java
+7
-11
No files found.
src/main/java/com/nisum/mytime/controller/DomainController.java
View file @
aad89757
...
@@ -23,8 +23,10 @@ import com.nisum.mytime.service.DomainService;
...
@@ -23,8 +23,10 @@ import com.nisum.mytime.service.DomainService;
import
com.nisum.mytime.utils.MyTimeUtils
;
import
com.nisum.mytime.utils.MyTimeUtils
;
/**
* @author Vijay
*
*/
@RestController
@RestController
public
class
DomainController
{
public
class
DomainController
{
...
@@ -40,9 +42,7 @@ public class DomainController {
...
@@ -40,9 +42,7 @@ public class DomainController {
if
(
StringUtils
.
isEmpty
(
domains
.
getDomainId
()))
{
if
(
StringUtils
.
isEmpty
(
domains
.
getDomainId
()))
{
domains
.
setDomainId
(
generateDomainId
());
domains
.
setDomainId
(
generateDomainId
());
}
}
domains
.
setStatus
(
"Y"
);
domains
.
setStatus
(
MyTimeUtils
.
ACTIVE
);
if
(
domains
.
getId
()==
null
){
if
(
domains
.
getId
()==
null
){
response
=
"saved Succesfully"
;
response
=
"saved Succesfully"
;
}
else
{
}
else
{
...
@@ -52,19 +52,8 @@ public class DomainController {
...
@@ -52,19 +52,8 @@ public class DomainController {
return
new
ResponseEntity
<>(
response
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
response
,
HttpStatus
.
OK
);
}
}
@RequestMapping
(
value
=
"/domains"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
HashMap
<
Object
,
Object
>>>
getDomains
()
throws
MyTimeException
{
@RequestMapping
(
value
=
"/domains"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
Domains
>
addDomain
(
@RequestBody
Domains
domains
)
throws
MyTimeException
{
domains
.
setDomainId
(
domainService
.
getAllDomains
().
size
()+
1
+
""
);
return
new
ResponseEntity
<>(
domainService
.
addDomain
(
domains
),
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"/domains"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
@RequestMapping
(
value
=
"/domains"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
HashMap
<
Object
,
Object
>>>
getAccounts
()
throws
MyTimeException
{
public
ResponseEntity
<
List
<
HashMap
<
Object
,
Object
>>>
getAccounts
()
throws
MyTimeException
{
return
new
ResponseEntity
<>(
domainService
.
getAllDomains
(),
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
domainService
.
getAllDomains
(),
HttpStatus
.
OK
);
}
}
...
...
src/main/java/com/nisum/mytime/model/Domains.java
View file @
aad89757
...
@@ -29,10 +29,5 @@ public class Domains implements Serializable {
...
@@ -29,10 +29,5 @@ public class Domains implements Serializable {
private
String
domainName
;
private
String
domainName
;
private
String
accountName
;
private
String
accountName
;
private
String
status
;
private
String
status
;
List
<
String
>
deliveryManagers
;
List
<
String
>
deliveryManagers
;
List
<
String
>
employee
;
}
}
src/main/java/com/nisum/mytime/repository/DomainRepo.java
View file @
aad89757
package
com
.
nisum
.
mytime
.
repository
;
package
com
.
nisum
.
mytime
.
repository
;
import
java.util.List
;
import
java.util.List
;
import
org.springframework.data.mongodb.repository.MongoRepository
;
import
org.springframework.data.mongodb.repository.MongoRepository
;
import
com.nisum.mytime.model.Domains
;
import
com.nisum.mytime.model.Domains
;
public
interface
DomainRepo
extends
MongoRepository
<
Domains
,
String
>
{
public
interface
DomainRepo
extends
MongoRepository
<
Domains
,
String
>
{
...
...
src/main/java/com/nisum/mytime/service/DomainService.java
View file @
aad89757
/**
*
*/
package
com
.
nisum
.
mytime
.
service
;
package
com
.
nisum
.
mytime
.
service
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
@@ -21,7 +18,6 @@ public interface DomainService {
...
@@ -21,7 +18,6 @@ public interface DomainService {
List
<
HashMap
<
Object
,
Object
>>
getAllDomains
()
throws
MyTimeException
;
List
<
HashMap
<
Object
,
Object
>>
getAllDomains
()
throws
MyTimeException
;
WriteResult
deleteDomain
(
String
id
)
throws
MyTimeException
;
WriteResult
deleteDomain
(
String
id
)
throws
MyTimeException
;
List
<
Domains
>
validateDomains
(
String
domainName
,
String
accountName
)
throws
MyTimeException
;
List
<
Domains
>
validateDomains
(
String
domainName
,
String
accountName
)
throws
MyTimeException
;
...
...
src/main/java/com/nisum/mytime/service/DomainServiceImpl.java
View file @
aad89757
/**
*
*/
package
com
.
nisum
.
mytime
.
service
;
package
com
.
nisum
.
mytime
.
service
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -49,40 +46,28 @@ public class DomainServiceImpl implements DomainService {
...
@@ -49,40 +46,28 @@ public class DomainServiceImpl implements DomainService {
public
List
<
HashMap
<
Object
,
Object
>>
getAllDomains
()
throws
MyTimeException
{
public
List
<
HashMap
<
Object
,
Object
>>
getAllDomains
()
throws
MyTimeException
{
domainList
=
domainRepo
.
findAll
();
domainList
=
domainRepo
.
findAll
();
Query
activeDomainListQuery
=
new
Query
(
Criteria
.
where
(
"status"
).
is
(
"Y"
));
List
<
Domains
>
domainList
=
mongoTemplate
.
find
(
activeDomainListQuery
,
Domains
.
class
);
updatedDomainList
=
new
ArrayList
<>();
updatedDomainList
=
new
ArrayList
<>();
for
(
Domains
domain
:
domainList
)
{
for
(
Domains
domain
:
domainList
)
{
HashMap
<
Object
,
Object
>
domainMap
=
new
HashMap
<>();
HashMap
<
Object
,
Object
>
domainMap
=
new
HashMap
<>();
domainMap
.
put
(
"id"
,
domain
.
getId
());
domainMap
.
put
(
MyTimeUtils
.
ID
,
domain
.
getId
());
domainMap
.
put
(
MyTimeUtils
.
DOMAIN_ID
,
domain
.
getDomainId
());
domainMap
.
put
(
MyTimeUtils
.
DOMAIN_ID
,
domain
.
getDomainId
());
domainMap
.
put
(
MyTimeUtils
.
DOMAIN_NAME
,
domain
.
getDomainName
());
domainMap
.
put
(
MyTimeUtils
.
DOMAIN_NAME
,
domain
.
getDomainName
());
domainMap
.
put
(
"accountName"
,
domain
.
getAccountName
());
domainMap
.
put
(
MyTimeUtils
.
ACCOUNT_NAME
,
domain
.
getAccountName
());
domainMap
.
put
(
MyTimeUtils
.
STATUS
,
domain
.
getStatus
());
domainMap
.
put
(
MyTimeUtils
.
STATUS
,
domain
.
getStatus
());
updatedEmployeeList
=
new
ArrayList
<>();
updatedEmployeeList
=
new
ArrayList
<>();
List
<
String
>
employeeIds
=
domain
.
getDeliveryManagers
();
List
<
String
>
employeeIds
=
domain
.
getDeliveryManagers
();
domainMap
.
put
(
"domainName"
,
domain
.
getDomainName
());
Query
query
=
new
Query
(
Criteria
.
where
(
MyTimeUtils
.
EMPLOYEE_ID
).
in
(
employeeIds
));
domainMap
.
put
(
"accountName"
,
domain
.
getAccountName
());
domainMap
.
put
(
"status"
,
domain
.
getStatus
());
updatedEmployeeList
=
new
ArrayList
<>();
List
<
String
>
employeeIds
=
domain
.
getEmployee
();
Query
query
=
new
Query
(
Criteria
.
where
(
"employeeId"
).
in
(
employeeIds
));
List
<
EmployeeRoles
>
employeeRoles
=
mongoTemplate
.
find
(
query
,
EmployeeRoles
.
class
);
List
<
EmployeeRoles
>
employeeRoles
=
mongoTemplate
.
find
(
query
,
EmployeeRoles
.
class
);
for
(
EmployeeRoles
employeesRole
:
employeeRoles
){
for
(
EmployeeRoles
employeesRole
:
employeeRoles
){
HashMap
<
String
,
String
>
employeeMap
=
new
HashMap
<>();
HashMap
<
String
,
String
>
employeeMap
=
new
HashMap
<>();
employeeMap
.
put
(
"id"
,
employeesRole
.
getEmployeeId
());
employeeMap
.
put
(
MyTimeUtils
.
EMPLOYEE_ID
,
employeesRole
.
getEmployeeId
());
employeeMap
.
put
(
"name"
,
employeesRole
.
getEmployeeName
());
employeeMap
.
put
(
MyTimeUtils
.
EMPLOYEE_NAME
,
employeesRole
.
getEmployeeName
());
updatedEmployeeList
.
add
(
employeeMap
);
updatedEmployeeList
.
add
(
employeeMap
);
}
}
domainMap
.
put
(
"deliveryManagers"
,
updatedEmployeeList
);
domainMap
.
put
(
MyTimeUtils
.
DELIVERY_MANAGERS
,
updatedEmployeeList
);
updatedDomainList
.
add
(
domainMap
);
updatedDomainList
.
add
(
domainMap
);
}
}
return
updatedDomainList
;
return
updatedDomainList
;
...
@@ -90,9 +75,9 @@ public class DomainServiceImpl implements DomainService {
...
@@ -90,9 +75,9 @@ public class DomainServiceImpl implements DomainService {
@Override
@Override
public
WriteResult
deleteDomain
(
String
id
)
throws
MyTimeException
{
public
WriteResult
deleteDomain
(
String
id
)
throws
MyTimeException
{
Query
query
=
new
Query
(
Criteria
.
where
(
"domainId"
).
is
(
id
));
Query
query
=
new
Query
(
Criteria
.
where
(
MyTimeUtils
.
DOMAIN_ID
).
is
(
id
));
Update
update
=
new
Update
();
Update
update
=
new
Update
();
update
.
set
(
"status"
,
"N"
);
update
.
set
(
MyTimeUtils
.
STATUS
,
MyTimeUtils
.
IN_ACTIVE
);
return
mongoTemplate
.
upsert
(
query
,
update
,
Domains
.
class
);
return
mongoTemplate
.
upsert
(
query
,
update
,
Domains
.
class
);
}
}
...
@@ -104,4 +89,4 @@ public class DomainServiceImpl implements DomainService {
...
@@ -104,4 +89,4 @@ public class DomainServiceImpl implements DomainService {
}
}
}
}
\ No newline at end of file
src/main/java/com/nisum/mytime/utils/MyTimeUtils.java
View file @
aad89757
...
@@ -38,15 +38,6 @@ public class MyTimeUtils {
...
@@ -38,15 +38,6 @@ public class MyTimeUtils {
public
final
static
String
ABESENT
=
"Absent"
;
public
final
static
String
ABESENT
=
"Absent"
;
public
final
static
String
EMAIL_ID
=
"emailId"
;
public
final
static
String
EMAIL_ID
=
"emailId"
;
//Domain Constants
public
final
static
String
DOM
=
"DOM"
;
public
final
static
String
ZERO_
=
"00"
;
public
final
static
String
ONE
=
"1"
;
public
final
static
String
DOMAIN_NAME
=
"domainName"
;
public
final
static
String
DOMAIN_ID
=
"domainId"
;
public
final
static
String
STATUS
=
"status"
;
public
final
static
String
ACCOUNT_ID
=
"accountId"
;
public
final
static
String
ACCOUNT_ID
=
"accountId"
;
public
static
final
int
ONE
=
1
;
public
static
final
int
ONE
=
1
;
public
final
static
String
ACC_NAME
=
"Acc"
;
public
final
static
String
ACC_NAME
=
"Acc"
;
...
@@ -70,5 +61,10 @@ public class MyTimeUtils {
...
@@ -70,5 +61,10 @@ public class MyTimeUtils {
public
final
static
int
MINUS_ONE
=
-
1
;
public
final
static
int
MINUS_ONE
=
-
1
;
public
final
static
String
FREE_POLL
=
"Free Pool"
;
public
final
static
String
FREE_POLL
=
"Free Pool"
;
public
final
static
String
START_DATE
=
"startDate"
;
public
final
static
String
START_DATE
=
"startDate"
;
}
//Domain Constants
public
final
static
String
DOM
=
"DOM"
;
public
final
static
String
DOMAIN_NAME
=
"domainName"
;
public
final
static
String
DOMAIN_ID
=
"domainId"
;
//public final static String NAME="deliveryManagers";
}
\ No newline at end of file
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