Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Dspace7 Angular
Manage
Activity
Members
Labels
Plan
Issues
42
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
code.vt.edu will be down for maintenance from 0530-0630 EDT Wednesday, March 26th
Show more breadcrumbs
vtechworks
Dspace7 Angular
Commits
c616facd
Commit
c616facd
authored
6 years ago
by
Art Lowel
Browse files
Options
Downloads
Patches
Plain Diff
Delegated PIDService's findByID to DataService
parent
0207aa14
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/app/core/data/pid.service.spec.ts
+1
-1
1 addition, 1 deletion
src/app/core/data/pid.service.spec.ts
src/app/core/data/pid.service.ts
+31
-12
31 additions, 12 deletions
src/app/core/data/pid.service.ts
with
32 additions
and
13 deletions
src/app/core/data/pid.service.spec.ts
+
1
−
1
View file @
c616facd
...
...
@@ -7,7 +7,7 @@ import { PIDService } from './pid.service';
import
{
FindByIDRequest
}
from
'
./request.models
'
;
import
{
RequestService
}
from
'
./request.service
'
;
f
describe
(
'
PIDService
'
,
()
=>
{
describe
(
'
PIDService
'
,
()
=>
{
let
scheduler
:
TestScheduler
;
let
service
:
PIDService
;
let
halService
:
HALEndpointService
;
...
...
This diff is collapsed.
Click to expand it.
src/app/core/data/pid.service.ts
+
31
−
12
View file @
c616facd
import
{
Injectable
}
from
'
@angular/core
'
;
import
{
Store
}
from
'
@ngrx/store
'
;
import
{
Observable
}
from
'
rxjs/Observable
'
;
import
{
hasValue
}
from
'
../../shared/empty.util
'
;
import
{
BrowseService
}
from
'
../browse/browse.service
'
;
import
{
RemoteDataBuildService
}
from
'
../cache/builders/remote-data-build.service
'
;
import
{
NormalizedDSpaceObject
}
from
'
../cache/models/normalized-dspace-object.model
'
;
import
{
ResponseCacheService
}
from
'
../cache/response-cache.service
'
;
import
{
CoreState
}
from
'
../core.reducers
'
;
import
{
DSpaceObject
}
from
'
../shared/dspace-object.model
'
;
import
{
HALEndpointService
}
from
'
../shared/hal-endpoint.service
'
;
import
{
DataService
}
from
'
./data.service
'
;
import
{
RemoteData
}
from
'
./remote-data
'
;
import
{
FindByIDRequest
}
from
'
./request.models
'
;
import
{
RequestService
}
from
'
./request.service
'
;
/* tslint:disable:max-classes-per-file */
class
DataServiceImpl
extends
DataService
<
NormalizedDSpaceObject
,
DSpaceObject
>
{
protected
linkPath
=
'
pid
'
;
constructor
(
protected
responseCache
:
ResponseCacheService
,
protected
requestService
:
RequestService
,
protected
rdbService
:
RemoteDataBuildService
,
protected
store
:
Store
<
CoreState
>
,
private
bs
:
BrowseService
,
protected
halService
:
HALEndpointService
)
{
super
();
}
getScopedEndpoint
(
scope
:
string
):
Observable
<
string
>
{
return
undefined
;
}
getFindByIDHref
(
endpoint
,
resourceID
):
string
{
return
endpoint
.
replace
(
/
\{\?
id
\}
/
,
`?id=
${
resourceID
}
`
);
}
}
@
Injectable
()
export
class
PIDService
{
protected
linkPath
=
'
pid
'
;
private
dataService
:
DataServiceImpl
;
constructor
(
protected
requestService
:
RequestService
,
protected
rdbService
:
RemoteDataBuildService
,
protected
halService
:
HALEndpointService
)
{
this
.
dataService
=
new
DataServiceImpl
(
null
,
requestService
,
rdbService
,
null
,
null
,
halService
);
}
findById
(
id
:
string
):
Observable
<
RemoteData
<
DSpaceObject
>>
{
const
hrefObs
=
this
.
halService
.
getEndpoint
(
this
.
linkPath
)
.
map
((
endpoint
:
string
)
=>
endpoint
.
replace
(
/
\{\?
id
\}
/
,
`?id=
${
id
}
`
));
hrefObs
.
filter
((
href
:
string
)
=>
hasValue
(
href
))
.
take
(
1
)
.
subscribe
((
href
:
string
)
=>
{
const
request
=
new
FindByIDRequest
(
this
.
requestService
.
generateRequestId
(),
href
,
id
);
this
.
requestService
.
configure
(
request
);
});
return
this
.
rdbService
.
buildSingle
<
NormalizedDSpaceObject
,
DSpaceObject
>
(
hrefObs
);
return
this
.
dataService
.
findById
(
id
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment