本文整理匯總了Java中org.alfresco.service.cmr.repository.NodeRef類的典型用法代碼示例。如果您正苦於以下問題:Java NodeRef類的具體用法?Java NodeRef怎麽用?Java NodeRef使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
NodeRef類屬於org.alfresco.service.cmr.repository包,在下文中一共展示了NodeRef類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setHidden
import org.alfresco.service.cmr.repository.NodeRef; //導入依賴的package包/類
@Override
public void setHidden(NodeRef nodeRef, boolean isHidden)
{
int mask = 0;
boolean allVisible = true;
Visibility webDavVisibility = isHidden ? Visibility.NotVisible : Visibility.Visible;
for (Client client : hiddenAspect.getClients())
{
Visibility clientVisibility = client == FileFilterMode.getClient() ? webDavVisibility : hiddenAspect
.getVisibility(client, nodeRef);
if (clientVisibility != Visibility.Visible)
{
allVisible = false;
}
mask |= hiddenAspect.getClientVisibilityMask(client, clientVisibility);
}
if (allVisible)
{
hiddenAspect.showNode(nodeRef, true);
}
else
{
hiddenAspect.hideNode(nodeRef, mask, true, true, false);
}
}
示例2: checkPermissions
import org.alfresco.service.cmr.repository.NodeRef; //導入依賴的package包/類
private void checkPermissions(NodeRef nodeRef, String necessatyAuth, String expectedPermission, String actionInfo)
{
Set<AccessPermission> allSetPermissions = permissionService.getAllSetPermissions(nodeRef);
for (AccessPermission perm : allSetPermissions)
{
String authority = perm.getAuthority();
if (necessatyAuth.equals(authority))
{
if (expectedPermission.equals(perm.getPermission()))
{
return;
}
fail("Expected permissions for authority \"" + necessatyAuth + "\" are incorrect. Expected: " + expectedPermission + ", but actual permission: "
+ perm.getPermission() + ". Check position: " + actionInfo);
}
}
fail("Expected authority \"" + necessatyAuth + "\" wasn't found. Check position: " + actionInfo);
}
示例3: checkFirstVersion
import org.alfresco.service.cmr.repository.NodeRef; //導入依賴的package包/類
private void checkFirstVersion(NodeRef mlContainerNodeRef)
{
// get the edition list of edition
VersionHistory editionHistory = editionService.getEditions(mlContainerNodeRef);
// Ensure that the first edition of the mlContainer is created
assertNotNull("The edition history can't be null", editionHistory);
// Ensure that it contains only one version
assertTrue("The edition history must contain only one edition", editionHistory.getAllVersions().size() == 1);
// get the edition
Version currentEdition = editionHistory.getAllVersions().iterator().next();
// Ensure that this version is the edition of the mlContainer
assertTrue("The versioned mlContainer noderef of the editon must be the noderef of the created mlContainer", currentEdition.getVersionedNodeRef().equals(mlContainerNodeRef));
// get the list of translations
List<VersionHistory> translations = editionService.getVersionedTranslations(currentEdition);
// Ensure that the get versioned translations is empty
assertNotNull("The translations list of the current edition can't be null", translations);
// Ensure that the list is empty
assertTrue("The translations list of the current edition would be empty", translations.size() == 0);
}
示例4: getTransferTargets
import org.alfresco.service.cmr.repository.NodeRef; //導入依賴的package包/類
/**
* Given the noderef of a group of transfer targets, return all the contained transfer targets.
* @param groupNode NodeRef
* @return Set<TransferTarget>
*/
private Set<TransferTarget> getTransferTargets(NodeRef groupNode)
{
Set<TransferTarget> result = new HashSet<TransferTarget>();
List<ChildAssociationRef>children = nodeService.getChildAssocs(groupNode, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
for(ChildAssociationRef child : children)
{
if(nodeService.getType(child.getChildRef()).equals(TransferModel.TYPE_TRANSFER_TARGET))
{
TransferTargetImpl newTarget = new TransferTargetImpl();
mapTransferTarget(child.getChildRef(), newTarget);
result.add(newTarget);
}
}
return result;
}
示例5: executeImpl
import org.alfresco.service.cmr.repository.NodeRef; //導入依賴的package包/類
@SuppressWarnings("unchecked")
@Override protected void executeImpl(Action action, NodeRef actionedUponNodeRef)
{
Object checkValue = action.getParameterValue("check");
assertEquals("Parameter value should be Boolean", checkValue.getClass(), Boolean.class);
Object dateValue = action.getParameterValue("date");
assertEquals("Parameter value should be Date", dateValue.getClass(), Date.class);
Object qnameValue = action.getParameterValue("qname");
assertEquals("Parameter value should be ArrayList", qnameValue.getClass(), ArrayList.class);
for (QName qname : (ArrayList<QName>)qnameValue)
{
assertEquals("The item value should be QName", qname.getClass(), QName.class);
}
Object nodeRefsValue = action.getParameterValue("nodeRefs");
assertEquals("Parameter value should be ArrayList", nodeRefsValue.getClass(), ArrayList.class);
for (NodeRef nodeRef : (ArrayList<NodeRef>)nodeRefsValue)
{
assertEquals("The item value should be NodeRef", nodeRef.getClass(), NodeRef.class);
}
}
示例6: unsubscribe
import org.alfresco.service.cmr.repository.NodeRef; //導入依賴的package包/類
public void unsubscribe(AlfrescoImapUser user, String mailbox)
{
if (logger.isDebugEnabled())
{
logger.debug("Unsubscribing: " + user + ", " + mailbox);
}
AlfrescoImapFolder mailFolder = getOrCreateMailbox(user, mailbox, true, false);
if(mailFolder.getFolderInfo() != null)
{
PersonService personService = serviceRegistry.getPersonService();
NodeRef userRef = personService.getPerson(user.getLogin());
nodeService.createAssociation(userRef, mailFolder.getFolderInfo().getNodeRef(), ImapModel.ASSOC_IMAP_UNSUBSCRIBED);
}
else
{
// perhaps the folder has been deleted by another async process?
logger.debug("Unable to find folder to unsubscribe");
}
}
示例7: test20OverrideProvider
import org.alfresco.service.cmr.repository.NodeRef; //導入依賴的package包/類
@Test
public void test20OverrideProvider() throws Exception
{
NodeRef person = createUser("a/b/c", "fred");
moveUserHomeFolders();
assertHomeFolderLocation("fred", "fr/fred");
homeFolderProviderSynchronizer.setOverrideHomeFolderProviderName(
testHomeFolderProviderName);
moveUserHomeFolders();
assertHomeFolderLocation("fred", "a/b/c/fred");
String providerName = (String) nodeService.getProperty(person,
ContentModel.PROP_HOME_FOLDER_PROVIDER);
assertEquals(testHomeFolderProviderName , providerName);
}
示例8: deleteUser
import org.alfresco.service.cmr.repository.NodeRef; //導入依賴的package包/類
private void deleteUser(final Set<NodeRef> adminGuestUserHomeFolders,
NodeRef person, String username, String domainUsername)
{
if (!domainUsername.equals("admin") && !domainUsername.equals("guest"))
{
personService.deletePerson(person);
System.out.println("deleted user "+username);
}
else
{
NodeRef homeFolder = DefaultTypeConverter.INSTANCE.convert(
NodeRef.class, nodeService.getProperty(person,
ContentModel.PROP_HOMEFOLDER));
adminGuestUserHomeFolders.add(homeFolder);
}
}
示例9: getWorkingCopy
import org.alfresco.service.cmr.repository.NodeRef; //導入依賴的package包/類
@Override
@Extend(traitAPI=CheckOutCheckInServiceTrait.class,extensionAPI=CheckOutCheckInServiceExtension.class)
public NodeRef getWorkingCopy(NodeRef nodeRef)
{
NodeRef workingCopy = null;
if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_CHECKED_OUT))
{
List<AssociationRef> assocs = nodeService.getTargetAssocs(nodeRef, ContentModel.ASSOC_WORKING_COPY_LINK);
// It is a 1:1 relationship
if (assocs.size() == 0)
{
logger.warn("Found node with cm:checkedOut aspect but no association. Current node state: " + nodeService.getNodeStatus(nodeRef));
}
else if (assocs.size() > 1)
{
logger.warn("Found multiple " + ContentModel.ASSOC_WORKING_COPY_LINK + " association from node: " + nodeRef);
}
else
{
workingCopy = assocs.get(0).getTargetRef();
}
}
return workingCopy;
}
示例10: removeSharedId
import org.alfresco.service.cmr.repository.NodeRef; //導入依賴的package包/類
private void removeSharedId(final String sharedId)
{
TenantUtil.runAsDefaultTenant(new TenantRunAsWork<Void>()
{
public Void doWork() throws Exception
{
attributeService.removeAttribute(ATTR_KEY_SHAREDIDS_ROOT, sharedId);
return null;
}
});
try
{
// Remove scheduled expiry action if any
NodeRef expiryActionNodeRef = getQuickShareLinkExpiryActionNode(sharedId);
if (expiryActionNodeRef != null)
{
deleteQuickShareLinkExpiryAction(expiryActionNodeRef);
}
}
catch (Exception ex)
{
throw new QuickShareLinkExpiryActionException("Couldn't delete the quick share link expiry action for the sharedId:" + sharedId);
}
}
示例11: validateNode
import org.alfresco.service.cmr.repository.NodeRef; //導入依賴的package包/類
@Override
public NodeRef validateNode(StoreRef storeRef, String nodeId)
{
String versionLabel = null;
int idx = nodeId.indexOf(";");
if (idx != -1)
{
versionLabel = nodeId.substring(idx + 1);
nodeId = nodeId.substring(0, idx);
if (versionLabel.equals("pwc"))
{
// TODO correct exception?
throw new EntityNotFoundException(nodeId);
}
}
NodeRef nodeRef = new NodeRef(storeRef, nodeId);
return validateNode(nodeRef);
}
示例12: isReference
import org.alfresco.service.cmr.repository.NodeRef; //導入依賴的package包/類
/**
* Quick Reference compliance check of a {@link NodeRef}.<br>
* NodeRef Reference representations validated by this method should produce
* valid Reference objects based on the given {@link NodeRef} when passed to
* the {@link #fromNodeRef(NodeRef)} method.
*
* @deprecated
* @param nodeRef
* @return <code>true</code> if the given {@link NodeRef} is a valid
* Reference representation<br>
* <code>false</code> otherwise
*/
public static final boolean isReference(NodeRef nodeRef)
{
if (nodeRef != null)
{
String id = nodeRef.getId();
if ((id != null) && (id.length() > 1) && (id.startsWith("" + VIRTUAL_TOKEN)))
{
char token = id.charAt(1);
Encoding encoding = Encodings.fromToken(token);
if (encoding != null)
{
return true;
}
}
else
{
if (logger.isDebugEnabled())
{
logger.debug("NodeRef is not a reference.");
}
}
}
return false;
}
示例13: testCreateNode_noFilingRule
import org.alfresco.service.cmr.repository.NodeRef; //導入依賴的package包/類
@Test
public void testCreateNode_noFilingRule() throws Exception
{
NodeRef testTemplate2 = createVirtualizedFolder(testRootFolder.getNodeRef(),
"aVFTestTemplate2",
TEST_TEMPLATE_2_JSON_SYS_PATH);
NodeRef testTemplate2Node2 = nodeService.getChildByName(testTemplate2,
ContentModel.ASSOC_CONTAINS,
"Node2");
try
{
createContent(testTemplate2Node2,
"shouldNotBeCreated");
fail("Should not be able to create node in a readonly context.");
}
catch (AccessDeniedException e)
{
logger.info("Succesfully denied creation in readonly",
e);
}
}
示例14: hasAuthority
import org.alfresco.service.cmr.repository.NodeRef; //導入依賴的package包/類
public boolean hasAuthority(final NodeRef nodeRef, final String userName)
{
return AuthenticationUtil.runAs(new RunAsWork<Boolean>(){
public Boolean doWork() throws Exception
{
if (lockService.getLockStatus(nodeRef, userName) == LockStatus.LOCK_OWNER)
{
return true;
}
NodeRef original = checkOutCheckInService.getCheckedOut(nodeRef);
if (original != null)
{
return (lockService.getLockStatus(original, userName) == LockStatus.LOCK_OWNER);
}
else
{
return false;
}
}}, AuthenticationUtil.getSystemUserName());
}
示例15: generateKey
import org.alfresco.service.cmr.repository.NodeRef; //導入依賴的package包/類
/**
* Key for a cache object is built from all the known Authorities (which can change dynamically so they must all be
* used) the NodeRef ID and the permission reference itself. This gives a unique key for each permission test.
*/
Serializable generateKey(Set<String> auths, NodeRef nodeRef, PermissionReference perm, CacheType type)
{
LinkedHashSet<Serializable> key = new LinkedHashSet<Serializable>();
key.add(perm.toString());
// We will just have to key our dynamic sets by username. We wrap it so as not to be confused with a static set
if (auths instanceof AuthorityServiceImpl.UserAuthoritySet)
{
key.add((Serializable)Collections.singleton(((AuthorityServiceImpl.UserAuthoritySet)auths).getUsername()));
}
else
{
key.addAll(auths);
}
key.add(nodeRef);
// Ensure some concept of node version or transaction is included in the key so we can track without cache replication
NodeRef.Status nodeStatus = nodeService.getNodeStatus(nodeRef);
key.add(nodeStatus == null ? "null" : nodeStatus.getChangeTxnId());
key.add(type);
return key;
}