本文整理汇总了Java中com.ibm.team.workitem.common.model.IWorkItemReferences类的典型用法代码示例。如果您正苦于以下问题:Java IWorkItemReferences类的具体用法?Java IWorkItemReferences怎么用?Java IWorkItemReferences使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IWorkItemReferences类属于com.ibm.team.workitem.common.model包,在下文中一共展示了IWorkItemReferences类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleAttachments
import com.ibm.team.workitem.common.model.IWorkItemReferences; //导入依赖的package包/类
/**
* make sure that all attachments will be moved to the new project area
* @param sourceWorkItem the original work item to which the attachments have belonged to
* @param targetWorkItem work item object is it will be available in the target pa after movement
* @param workItemCommon common service
* @param progressMonitor progress monitor
* @throws TeamRepositoryException whenever an attachment can't be moved
*/
@Override
protected void handleAttachments(IWorkItem sourceWorkItem, IWorkItem targetWorkItem, IWorkItemCommon workItemCommon,
IProgressMonitor progressMonitor) throws TeamRepositoryException {
ILinkServiceLibrary lsl = (ILinkServiceLibrary) this.service.getService(ILinkService.class)
.getServiceLibrary(ILinkServiceLibrary.class);
IWorkItemReferences references = workItemCommon.resolveWorkItemReferences(sourceWorkItem, monitor);
for (IReference attachmentReference : references.getReferences(WorkItemEndPoints.ATTACHMENT)) {
if (!attachmentReference.isItemReference()) continue;
IAttachmentHandle attachmentHandle = (IAttachmentHandle)((IItemReference)attachmentReference)
.getReferencedItem();
IAttachment attachment = workItemCommon.getAuditableCommon()
.resolveAuditable(attachmentHandle, IAttachment.SMALL_PROFILE, monitor);
if (commitChanges) {
this.moveAttachment(targetWorkItem, workItemCommon, attachment);
continue;
}
this.checkAttachmentReferences(attachmentReference, lsl.findLinksBySource(attachmentReference), sourceWorkItem);
this.checkAttachmentReferences(attachmentReference, lsl.findLinksByTarget(attachmentReference), sourceWorkItem);
}
}
示例2: saveAttachements
import com.ibm.team.workitem.common.model.IWorkItemReferences; //导入依赖的package包/类
public void saveAttachements(IWorkItem workItem) {
IWorkItemCommon common = (IWorkItemCommon) repo.getClientLibrary(IWorkItemCommon.class);
IWorkItemReferences workitemReferences;
try {
workitemReferences = common.resolveWorkItemReferences(workItem, null);
List<IReference> references = workitemReferences.getReferences(WorkItemEndPoints.ATTACHMENT);
for (IReference iReference : references) {
IAttachmentHandle attachHandle = (IAttachmentHandle) iReference.resolve();
IAuditableClient auditableClient = (IAuditableClient) repo.getClientLibrary(IAuditableClient.class);
IAttachment attachment = auditableClient.resolveAuditable(attachHandle, IAttachment.DEFAULT_PROFILE, null);
saveAttachment(workItem.getId(), attachment);
}
} catch (TeamRepositoryException | IOException e) {
LOGGER.warning("Cannot download attachement for WorkItem " + workItem.getId() + "(" + e.getMessage() + ")");
}
}
示例3: prepareTargetLink
import com.ibm.team.workitem.common.model.IWorkItemReferences; //导入依赖的package包/类
@Override
public void prepareTargetLink(final IWorkItemReferences targetReferences, IEndPointDescriptor endPoint, IReference sourceValue, final EvaluationContext context, final IProgressMonitor monitor) throws TeamRepositoryException {
IWorkItemHandle sourceHandle= (IWorkItemHandle)((IItemReference)sourceValue).getReferencedItem();
IWorkItemHandle targetHandle= context.sourceContext.getPair(sourceHandle);
if (targetHandle == null) {
return;
}
for (IReference reference : targetReferences.getReferences(endPoint)) {
if (((IItemReference)reference).getReferencedItem().sameItemId(sourceHandle)) {
return;
}
}
targetReferences.add(endPoint, IReferenceFactory.INSTANCE.createReferenceToItem(targetHandle));
}
示例4: copyLinks
import com.ibm.team.workitem.common.model.IWorkItemReferences; //导入依赖的package包/类
private void copyLinks(List<WorkItemWorkingCopy> targets, SubMonitor linksMonitor) throws TeamRepositoryException {
if (fContext.configuration.copyLinks || fContext.configuration.copyAttachments) {
int counter= 1;
for (WorkItemWorkingCopy target : targets) {
SubMonitor singleMonitor= linksMonitor.newChild(1);
String preparingMessage= "Copying links " + (fContext.configuration.copyAttachments ? "with attachments " : "");
singleMonitor.setTaskName(preparingMessage + "(" + counter + " of " + targets.size() + ")");
IWorkItemReferences sourceReferences= fContext.sourceContext.workingCopyManager.getWorkingCopy(fContext.targetContext.getPair(target.getWorkItem())).getReferences();
IWorkItemReferences targetReferences= target.getReferences();
for (IEndPointDescriptor endPoint : getEndPointsToCopy(sourceReferences)) {
updateEndPoint(sourceReferences, targetReferences, endPoint, singleMonitor);
}
fContext.sourceContext.itemResolver.execute(singleMonitor);
fContext.targetContext.itemResolver.execute(singleMonitor);
if (!targetReferences.getChangedReferenceTypes().isEmpty()) {
target.save(linksMonitor.newChild(1));
}
counter++;
}
linksMonitor.done();
}
}
示例5: copyAttachments
import com.ibm.team.workitem.common.model.IWorkItemReferences; //导入依赖的package包/类
private void copyAttachments(IWorkItemReferences targetReferences, IAttachment sourceValue, EvaluationContext context, IProgressMonitor monitor) throws TeamRepositoryException {
File file= new File(sourceValue.getName());
OutputStream stream;
try {
stream= new FileOutputStream(file);
} catch (FileNotFoundException e) {
throw new TeamRepositoryException(e);
}
context.sourceContext.contentManager.retrieveContent(sourceValue.getContent(), stream, SubMonitor.convert(monitor, 1));
targetReferences.add(WorkItemEndPoints.ATTACHMENT, com.ibm.team.workitem.rcp.ui.internal.util.Utils.createReference(file));
}
示例6: getEndPointsToCopy
import com.ibm.team.workitem.common.model.IWorkItemReferences; //导入依赖的package包/类
private List<IEndPointDescriptor> getEndPointsToCopy(IWorkItemReferences sourceReferences) {
if (fContext.configuration.copyLinks) {
List<IEndPointDescriptor> all= new ArrayList<IEndPointDescriptor>(sourceReferences.getTypes());
if (!fContext.configuration.copyAttachments) {
all.remove(WorkItemEndPoints.ATTACHMENT);
}
return all;
}
return Collections.singletonList(WorkItemEndPoints.ATTACHMENT);
}
示例7: updateEndPoint
import com.ibm.team.workitem.common.model.IWorkItemReferences; //导入依赖的package包/类
private void updateEndPoint(IWorkItemReferences source, IWorkItemReferences target, IEndPointDescriptor endPoint, IProgressMonitor monitor) throws TeamRepositoryException {
ILinkProcessor processor= LinkProcessors.getProcessor(endPoint);
if (processor != null) {
for (IReference reference : source.getReferences(endPoint)) {
processor.prepareTargetLink(target, endPoint, reference, fContext, monitor);
}
}
}
示例8: prepareTargetLink
import com.ibm.team.workitem.common.model.IWorkItemReferences; //导入依赖的package包/类
@Override
public void prepareTargetLink(IWorkItemReferences targetReferences, IEndPointDescriptor endPoint, IReference sourceValue, EvaluationContext context, IProgressMonitor progressMonitor) throws TeamRepositoryException {
targetReferences.add(endPoint, IReferenceFactory.INSTANCE.createReferenceFromURI(sourceValue.createURI()));
}
示例9: getWorkItemReferences
import com.ibm.team.workitem.common.model.IWorkItemReferences; //导入依赖的package包/类
/**
* Make sure that all work item references are being resolved properly
* @param workItem the work item for which we will be resolving all its references
* @param workItemCommon common service
* @param monitor progress monitor
* @return list of resolved references
* @throws TeamRepositoryException in case of an error
*/
@Override
protected IWorkItemReferences getWorkItemReferences(IWorkItem workItem, IWorkItemCommon workItemCommon,
IProgressMonitor monitor) throws TeamRepositoryException {
return workItemCommon.resolveWorkItemReferences(workItem, null);
}
示例10: prepareTargetLink
import com.ibm.team.workitem.common.model.IWorkItemReferences; //导入依赖的package包/类
public void prepareTargetLink(IWorkItemReferences targetReferences, IEndPointDescriptor endPoint, IReference sourceValue, EvaluationContext context, IProgressMonitor progressMonitor) throws TeamRepositoryException;