本文整理汇总了Java中org.apache.taverna.reference.IdentifiedList类的典型用法代码示例。如果您正苦于以下问题:Java IdentifiedList类的具体用法?Java IdentifiedList怎么用?Java IdentifiedList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IdentifiedList类属于org.apache.taverna.reference包,在下文中一共展示了IdentifiedList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerEmptyList
import org.apache.taverna.reference.IdentifiedList; //导入依赖的package包/类
@Override
public IdentifiedList<T2Reference> registerEmptyList(int depth,
ReferenceContext context) throws ListServiceException {
if (depth < 1)
throw new ListServiceException(
"Can't register empty lists of depth " + depth);
checkDao();
checkGenerator();
T2ReferenceImpl newReference = getAsImpl(t2ReferenceGenerator
.nextListReference(false, depth, context));
T2ReferenceListImpl newList = new T2ReferenceListImpl();
newList.setTypedId(newReference);
try {
listDao.store(newList);
return newList;
} catch (DaoException de) {
throw new ListServiceException(de);
}
}
示例2: referenceFromString
import org.apache.taverna.reference.IdentifiedList; //导入依赖的package包/类
/**
* Parse the reference contained in the string and return a
* {@link T2Reference} with the correct properties
*/
@Override
public T2Reference referenceFromString(String reference) {
T2ReferenceImpl newRef = new T2ReferenceImpl();
Map<String, String> parseRef = parseRef(reference);
newRef.setNamespacePart(parseRef.get("namespace"));
newRef.setLocalPart(parseRef.get("localPart"));
String type = parseRef.get("type");
if (type.equals("ref")) {
newRef.setReferenceType(ReferenceSet);
} else if (type.equals("list")) {
newRef.setReferenceType(IdentifiedList);
newRef.setContainsErrors(Boolean.parseBoolean(parseRef.get("error")));
newRef.setDepth(Integer.parseInt(parseRef.get("depth")));
} else if (type.equals("error")) {
newRef.setContainsErrors(true);
newRef.setReferenceType(ErrorDocument);
newRef.setDepth(Integer.parseInt(parseRef.get("depth")));
} else {
return null;
// should throw an error
}
return newRef;
}
示例3: saveIntermediate
import org.apache.taverna.reference.IdentifiedList; //导入依赖的package包/类
private Path saveIntermediate(T2Reference t2Ref) throws IOException {
// Avoid double-saving
Path f = seenReferences.get(t2Ref);
if (f != null) {
return f;
}
Path file = referencePath(t2Ref);
if (t2Ref.getReferenceType() == T2ReferenceType.IdentifiedList) {
IdentifiedList<T2Reference> list = saver.getReferenceService()
.getListService().getList(t2Ref);
for (T2Reference ref : list) {
saveIntermediate(ref);
}
seenReference(t2Ref, file);
return file;
} else {
return saveValue(t2Ref, file);
}
}
示例4: saveValue
import org.apache.taverna.reference.IdentifiedList; //导入依赖的package包/类
private Path saveValue(T2Reference t2Ref, Path file) throws IOException {
Path parent = file.getParent();
switch (t2Ref.getReferenceType()) {
case IdentifiedList:
DataBundles.createList(file);
IdentifiedList<T2Reference> list = saver.getReferenceService()
.getListService().getList(t2Ref);
long position = 0;
for (T2Reference ref : list) {
saveValue(ref, DataBundles.getListItem(file, position++));
}
break;
case ErrorDocument:
Files.createDirectories(parent);
file = saveError(t2Ref, file);
break;
case ReferenceSet:
Files.createDirectories(parent);
file = saver.saveReference(t2Ref, file);
}
seenReference(t2Ref, file);
return file;
}
示例5: considerReference
import org.apache.taverna.reference.IdentifiedList; //导入依赖的package包/类
private T2Reference considerReference(T2Reference value,
List<T2Reference> exceptions) {
if (!value.containsErrors())
return value;
else if (!value.getReferenceType().equals(IdentifiedList))
return replaceErrors(value, value.getDepth(), exceptions);
else if (exceptionHandling.failLists())
return replaceErrors(findFirstFailure(value), value.getDepth(),
exceptions);
List<T2Reference> replacementList = new ArrayList<>();
for (T2Reference subValue : lists.getList(value))
replacementList.add(considerReference(subValue, exceptions));
return references.register(replacementList, value.getDepth(), true,
context);
}
示例6: getList
import org.apache.taverna.reference.IdentifiedList; //导入依赖的package包/类
@Override
public IdentifiedList<T2Reference> getList(T2Reference id)
throws ListServiceException {
checkDao();
try {
return listDao.get(id);
} catch (DaoException de) {
throw new ListServiceException(de);
}
}
示例7: delete
import org.apache.taverna.reference.IdentifiedList; //导入依赖的package包/类
@Override
public boolean delete(T2Reference reference)
throws ReferenceServiceException {
checkDao();
IdentifiedList<T2Reference> list = listDao.get(reference);
if (list == null)
return false;
return listDao.delete(list);
}
示例8: delete
import org.apache.taverna.reference.IdentifiedList; //导入依赖的package包/类
@Override
public boolean delete(T2Reference reference)
throws ReferenceServiceException {
switch (reference.getReferenceType()) {
case IdentifiedList:
return listService.delete(reference);
case ReferenceSet:
return referenceSetService.delete(reference);
case ErrorDocument:
return errorDocumentService.delete(reference);
default:
throw new ReferenceServiceException("Unknown reference type!");
}
}
示例9: testDelete
import org.apache.taverna.reference.IdentifiedList; //导入依赖的package包/类
@Test
public void testDelete() throws Exception {
ReferenceContextImpl invocationContext = new ReferenceContextImpl();
invocationContext.addEntity(new WorkflowRunIdEntity("wfRunListsTest"));
for (ListServiceImpl service : serviceList){
IdentifiedList<T2Reference> list =service.registerEmptyList(1, invocationContext);
assertNotNull(service.getList(list.getId()));
assertTrue(service.delete(list.getId()));
assertNull(service.getList(list.getId()));
assertFalse(service.delete(list.getId()));
}
}
示例10: testDeleteIdentifiedListsForWFRun
import org.apache.taverna.reference.IdentifiedList; //导入依赖的package包/类
@Test
public void testDeleteIdentifiedListsForWFRun() throws Exception {
for (ListServiceImpl service : serviceList){
String wfRunId1 = "wfRunListsTest1";
ReferenceContextImpl invocationContext1 = new ReferenceContextImpl();
invocationContext1.addEntity(new WorkflowRunIdEntity(wfRunId1));
String wfRunId2 = "wfRunListsTest2";
ReferenceContextImpl invocationContext2 = new ReferenceContextImpl();
invocationContext2.addEntity(new WorkflowRunIdEntity(wfRunId2));
IdentifiedList<T2Reference> list1 = service.registerEmptyList(2, invocationContext1);
IdentifiedList<T2Reference> list2 = service.registerEmptyList(1, invocationContext1);
IdentifiedList<T2Reference> list3 = service.registerEmptyList(1, invocationContext2);
assertNotNull(service.getList(list1.getId()));
assertNotNull(service.getList(list2.getId()));
assertNotNull(service.getList(list3.getId()));
service.deleteIdentifiedListsForWorkflowRun(wfRunId1);
assertNull(service.getList(list1.getId()));
assertNull(service.getList(list2.getId()));
assertNotNull(service.getList(list3.getId()));
}
}
示例11: describeEntity
import org.apache.taverna.reference.IdentifiedList; //导入依赖的package包/类
protected Individual describeEntity(T2Reference t2Ref) throws IOException {
URI dataURI = URI.create(uriGenerator.makeT2ReferenceURI(t2Ref.toUri()
.toASCIIString()));
Individual artifact = describedEntities.get(dataURI);
if (artifact != null) {
return artifact;
}
artifact = provModel.createArtifact(dataURI);
describedEntities.put(dataURI, artifact);
if (t2Ref.getReferenceType() == T2ReferenceType.ErrorDocument) {
Individual error = provModel.createError(dataURI);
ErrorDocument errorDoc = saver.getReferenceService()
.getErrorDocumentService().getError(t2Ref);
addMessageIfNonEmpty(error, errorDoc.getMessage());
// getExceptionMEssage added by addStackTrace
addStackTrace(error, errorDoc);
} else if (t2Ref.getReferenceType() == T2ReferenceType.IdentifiedList) {
IdentifiedList<T2Reference> list = saver.getReferenceService()
.getListService().getList(t2Ref);
Individual dictionary = provModel.createDictionary(dataURI);
int pos = 0;
for (T2Reference ref : list) {
URI itemURI = URI.create(uriGenerator.makeT2ReferenceURI(ref
.toUri().toASCIIString()));
Individual listItem = provModel.createArtifact(itemURI);
provModel.addKeyPair(dictionary, pos++, listItem);
describeEntity(ref);
}
if (list.isEmpty()) {
artifact.addRDFType(provModel.EmptyCollection);
artifact.addRDFType(provModel.EmptyDictionary);
}
}
return artifact;
}
示例12: findFirstFailure
import org.apache.taverna.reference.IdentifiedList; //导入依赖的package包/类
private T2Reference findFirstFailure(T2Reference value) {
IdentifiedList<T2Reference> originalList = lists.getList(value);
for (T2Reference subValue : originalList) {
if (subValue.getReferenceType().equals(ErrorDocument))
return subValue;
if (subValue.getReferenceType().equals(IdentifiedList))
if (subValue.containsErrors())
return findFirstFailure(subValue);
// No need to consider value
}
return null;
}
示例13: getErrors
import org.apache.taverna.reference.IdentifiedList; //导入依赖的package包/类
private Set<T2Reference> getErrors(T2Reference ref) {
Set<T2Reference> result = new HashSet<>();
if (ref.getReferenceType().equals(ReferenceSet)) {
// nothing
} else if (ref.getReferenceType().equals(IdentifiedList)) {
IdentifiedList<T2Reference> originalList = lists.getList(ref);
for (T2Reference subValue : originalList)
if (subValue.containsErrors())
result.addAll(getErrors(subValue));
} else
result.add(ref);
return result;
}
示例14: get
import org.apache.taverna.reference.IdentifiedList; //导入依赖的package包/类
@Override
public synchronized IdentifiedList<T2Reference> get(T2Reference reference)
throws DaoException {
return store.get(reference);
}
示例15: store
import org.apache.taverna.reference.IdentifiedList; //导入依赖的package包/类
@Override
public synchronized void store(IdentifiedList<T2Reference> theList)
throws DaoException {
store.put(theList.getId(), theList);
}