use of edu.unc.lib.boxc.model.api.ids.PID in project box-c by UNC-Libraries.
the class RepositoryObjectLoaderTest method getDepositRecordTest.
@Test
public void getDepositRecordTest() {
PID pid = pidMinter.mintDepositRecordPid();
when(objectCacheLoader.load(eq(pid))).thenReturn(mock(DepositRecord.class));
assertNotNull(repoObjLoader.getDepositRecord(pid));
}
use of edu.unc.lib.boxc.model.api.ids.PID in project box-c by UNC-Libraries.
the class WorkObjectTest method setPrimaryObjectToInvalidTypeTest.
@Test(expected = InvalidOperationForObjectType.class)
public void setPrimaryObjectToInvalidTypeTest() {
PID anotherPid = makePid();
WorkObject anotherWork = mock(WorkObject.class);
when(anotherWork.getPid()).thenReturn(anotherPid);
when(driver.getRepositoryObject(eq(anotherPid))).thenReturn(anotherWork);
try {
work.setPrimaryObject(anotherPid);
} finally {
verify(repoObjFactory, never()).createExclusiveRelationship(any(RepositoryObject.class), eq(Cdr.primaryObject), any(Resource.class));
}
}
use of edu.unc.lib.boxc.model.api.ids.PID in project box-c by UNC-Libraries.
the class DepositRecordImpl method addPidsToList.
private List<PID> addPidsToList(Property p) {
Resource resource = getResource();
StmtIterator containsIt = resource.listProperties(p);
List<PID> pids = new ArrayList<>();
while (containsIt.hasNext()) {
String path = containsIt.next().getObject().toString();
pids.add(PIDs.get(path));
}
return pids;
}
use of edu.unc.lib.boxc.model.api.ids.PID in project box-c by UNC-Libraries.
the class FileObjectImpl method getBinaryObjects.
/**
* Retrieve all of the binary objects contained by this FileObject.
*
* @return List of contained binary objects
*/
@Override
public List<BinaryObject> getBinaryObjects() {
Resource resc = getResource();
List<BinaryObject> binaries = new ArrayList<>();
for (StmtIterator it = resc.listProperties(PcdmModels.hasFile); it.hasNext(); ) {
PID binaryPid = PIDs.get(it.nextStatement().getResource().getURI());
binaries.add(driver.getRepositoryObject(binaryPid, BinaryObject.class));
}
return binaries;
}
use of edu.unc.lib.boxc.model.api.ids.PID in project box-c by UNC-Libraries.
the class RepositoryObjectFactoryImpl method deleteProperty.
/**
* Deletes all triples with the given property predicate from the specified repository object.
* @param repoObj repository object to remove properties from
* @param property predicate of properties to remove
*/
@Override
public void deleteProperty(RepositoryObject repoObj, Property property) {
PID subject = repoObj.getPid();
String sparqlUpdate = SparqlUpdateHelper.createSparqlDelete(subject.getRepositoryPath(), property, null);
sparqlUpdateService.executeUpdate(repoObj.getMetadataUri().toString(), sparqlUpdate);
repoObj.shouldRefresh();
}
Aggregations