本文整理汇总了Java中org.alfresco.service.cmr.repository.AssociationRef.getId方法的典型用法代码示例。如果您正苦于以下问题:Java AssociationRef.getId方法的具体用法?Java AssociationRef.getId怎么用?Java AssociationRef.getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.alfresco.service.cmr.repository.AssociationRef
的用法示例。
在下文中一共展示了AssociationRef.getId方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getName
import org.alfresco.service.cmr.repository.AssociationRef; //导入方法依赖的package包/类
@Override
public AssociationRef getName(AssociationRef assocRef)
{
if (assocRef == null)
{
return null;
}
return new AssociationRef(assocRef.getId(),
getName(assocRef.getSourceRef()),
assocRef.getTypeQName(),
getName(assocRef.getTargetRef()));
}
示例2: getBaseName
import org.alfresco.service.cmr.repository.AssociationRef; //导入方法依赖的package包/类
@Override
public AssociationRef getBaseName(AssociationRef assocRef)
{
if (assocRef == null)
{
return null;
}
return new AssociationRef(assocRef.getId(),
getBaseName(assocRef.getSourceRef()),
assocRef.getTypeQName(),
getBaseName(assocRef.getTargetRef()));
}
示例3: testCreateAndRemoveAssociation
import org.alfresco.service.cmr.repository.AssociationRef; //导入方法依赖的package包/类
public void testCreateAndRemoveAssociation() throws Exception
{
AssociationRef assocRef = createAssociation();
NodeRef sourceRef = assocRef.getSourceRef();
// create another
Map<QName, Serializable> properties = new HashMap<QName, Serializable>(5);
fillProperties(TYPE_QNAME_TEST_CONTENT, properties);
fillProperties(ASPECT_QNAME_TEST_TITLED, properties);
ChildAssociationRef childAssocRef = nodeService.createNode(
rootNodeRef,
ASSOC_TYPE_QNAME_TEST_CHILDREN,
QName.createQName(null, "N3"),
TYPE_QNAME_TEST_CONTENT,
properties);
NodeRef anotherTargetRef = childAssocRef.getChildRef();
AssociationRef anotherAssocRef = nodeService.createAssociation(
sourceRef,
anotherTargetRef,
ASSOC_TYPE_QNAME_TEST_NEXT);
Long anotherAssocId = anotherAssocRef.getId();
assertNotNull("Created association does not have an ID", anotherAssocId);
AssociationRef anotherAssocRefCheck = nodeService.getAssoc(anotherAssocId);
assertEquals("Assoc fetched by ID is incorrect.", anotherAssocRef, anotherAssocRefCheck);
// remove assocs
List<AssociationRef> assocs = nodeService.getTargetAssocs(sourceRef, ASSOC_TYPE_QNAME_TEST_NEXT);
for (AssociationRef assoc : assocs)
{
nodeService.removeAssociation(
assoc.getSourceRef(),
assoc.getTargetRef(),
assoc.getTypeQName());
}
}
示例4: getTargetAssocs
import org.alfresco.service.cmr.repository.AssociationRef; //导入方法依赖的package包/类
@Override
public List<AssociationRef> getTargetAssocs(NodeRef sourceRef, QNamePattern qnamePattern)
{
NodeServiceTrait theTrait = getTrait();
List<AssociationRef> targetAssocs = null;
Reference reference = Reference.fromNodeRef(sourceRef);
if (reference != null)
{
if (smartStore.canMaterialize(reference))
{
NodeRef materializedReferece = smartStore.materialize(reference);
targetAssocs = theTrait.getTargetAssocs(materializedReferece,
qnamePattern);
}
else
{
targetAssocs = new LinkedList<>();
}
}
else
{
targetAssocs = theTrait.getTargetAssocs(sourceRef,
qnamePattern);
}
List<AssociationRef> virtualizedIfNeededTargetAssocs = null;
Reference sourceReference = Reference.fromNodeRef(sourceRef);
if (sourceReference != null)
{
virtualizedIfNeededTargetAssocs = new LinkedList<>();
for (AssociationRef associationRef : targetAssocs)
{
NodeRef targetNodeRef = associationRef.getTargetRef();
Reference targetReference = NodeProtocol.newReference(targetNodeRef,
sourceReference
.execute(new GetParentReferenceMethod()));
AssociationRef virtualAssocRef = new AssociationRef(associationRef.getId(),
sourceRef,
associationRef.getTypeQName(),
targetReference.toNodeRef(targetNodeRef
.getStoreRef()));
virtualizedIfNeededTargetAssocs.add(virtualAssocRef);
}
}
else
{
virtualizedIfNeededTargetAssocs = targetAssocs;
if (DownloadModel.TYPE_DOWNLOAD.equals(environment.getType(sourceRef)))
{
if (qnamePattern.isMatch(DownloadModel.ASSOC_REQUESTED_NODES))
{
List<AssociationRef> virtualTargetAssocs = getDownloadTargetAssocs(sourceRef);
virtualizedIfNeededTargetAssocs.addAll(virtualTargetAssocs);
}
}
}
return virtualizedIfNeededTargetAssocs;
}
示例5: getSourceAssocs
import org.alfresco.service.cmr.repository.AssociationRef; //导入方法依赖的package包/类
@Override
public List<AssociationRef> getSourceAssocs(NodeRef targetRef, QNamePattern qnamePattern)
{
NodeServiceTrait theTrait = getTrait();
Reference reference = Reference.fromNodeRef(targetRef);
if (reference != null)
{
List<AssociationRef> materialAssocs = new ArrayList<AssociationRef>();
if (smartStore.canMaterialize(reference))
{
List<AssociationRef> sourceAssocs = theTrait.getSourceAssocs(smartStore.materialize(reference),
qnamePattern);
for (AssociationRef associationRef : sourceAssocs)
{
NodeRef sourceRef = associationRef.getSourceRef();
Reference sourceReference = NodeProtocol.newReference(sourceRef,
reference
.execute(new GetParentReferenceMethod()));
AssociationRef virtualAssocRef = new AssociationRef(associationRef.getId(),
sourceReference.toNodeRef(),
associationRef.getTypeQName(),
targetRef);
materialAssocs.add(virtualAssocRef);
}
}
// Download sources are deliberately not virtualized due to
// performance and complexity issues.
// However they could be detected using
// if (qnamePattern.isMatch(DownloadModel.ASSOC_REQUESTED_NODES))
return materialAssocs;
}
else
{
return theTrait.getSourceAssocs(targetRef,
qnamePattern);
}
}
示例6: createRelationship
import org.alfresco.service.cmr.repository.AssociationRef; //导入方法依赖的package包/类
@Override
public String createRelationship(
String repositoryId, Properties properties, List<String> policies, Acl addAces,
Acl removeAces, ExtensionsData extension)
{
checkRepositoryId(repositoryId);
// get type
String objectTypeId = connector.getObjectTypeIdProperty(properties);
final TypeDefinitionWrapper type = connector.getTypeForCreate(objectTypeId, BaseTypeId.CMIS_RELATIONSHIP);
// get source object
String sourceId = connector.getSourceIdProperty(properties);
CMISNodeInfo sourceInfo = getOrCreateNodeInfo(sourceId, "Source");
if (!sourceInfo.isVariant(CMISObjectVariant.CURRENT_VERSION) && !sourceInfo.isVariant(CMISObjectVariant.FOLDER) && !sourceInfo.isVariant(CMISObjectVariant.ITEM))
{
throw new CmisInvalidArgumentException("Source is not the latest version of a document, a folder or an item object!");
}
final NodeRef sourceNodeRef = sourceInfo.getNodeRef();
// get target object
String targetId = connector.getTargetIdProperty(properties);
CMISNodeInfo targetInfo = getOrCreateNodeInfo(targetId, "Target");
if (!targetInfo.isVariant(CMISObjectVariant.CURRENT_VERSION) && !targetInfo.isVariant(CMISObjectVariant.FOLDER) && !targetInfo.isVariant(CMISObjectVariant.ITEM))
{
throw new CmisInvalidArgumentException(
"Target is not the latest version of a document, a folder or an item object!!");
}
final NodeRef targetNodeRef = targetInfo.getNodeRef();
// check policies and ACLs
if ((policies != null) && (!policies.isEmpty()))
{
throw new CmisConstraintException("Relationships are not policy controllable!");
}
if ((addAces != null) && (addAces.getAces() != null) && (!addAces.getAces().isEmpty()))
{
throw new CmisConstraintException("Relationships are not ACL controllable!");
}
if ((removeAces != null) && (removeAces.getAces() != null) && (!removeAces.getAces().isEmpty()))
{
throw new CmisConstraintException("Relationships are not ACL controllable!");
}
// create relationship
// ALF-10085 : disable auditing behaviour for this use case
boolean wasEnabled = connector.disableBehaviour(ContentModel.ASPECT_AUDITABLE, sourceNodeRef); // Lasts for txn
try
{
AssociationRef assocRef = connector.getNodeService().createAssociation(
sourceNodeRef, targetNodeRef, type.getAlfrescoClass());
return CMISConnector.ASSOC_ID_PREFIX + assocRef.getId();
}
finally
{
if(wasEnabled)
{
connector.enableBehaviour(ContentModel.ASPECT_AUDITABLE, sourceNodeRef);
}
}
}