本文整理匯總了Java中org.alfresco.service.cmr.remotecredentials.BaseCredentialsInfo.getNodeRef方法的典型用法代碼示例。如果您正苦於以下問題:Java BaseCredentialsInfo.getNodeRef方法的具體用法?Java BaseCredentialsInfo.getNodeRef怎麽用?Java BaseCredentialsInfo.getNodeRef使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.alfresco.service.cmr.remotecredentials.BaseCredentialsInfo
的用法示例。
在下文中一共展示了BaseCredentialsInfo.getNodeRef方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: deleteCredentials
import org.alfresco.service.cmr.remotecredentials.BaseCredentialsInfo; //導入方法依賴的package包/類
@Override
public void deleteCredentials(BaseCredentialsInfo credentialsInfo)
{
if (credentialsInfo.getNodeRef() == null)
{
throw new IllegalArgumentException("Cannot delete Credentials which haven't been persisted yet!");
}
nodeService.deleteNode(credentialsInfo.getNodeRef());
if (logger.isDebugEnabled())
logger.debug("Deleted credentials " + credentialsInfo + " from " + credentialsInfo.getNodeRef() +
" from Remote System " + credentialsInfo.getRemoteSystemName());
// Leave the Remote System Container, in case special permissions
// were previously applied to it that should be retained
}
示例2: createCredentials
import org.alfresco.service.cmr.remotecredentials.BaseCredentialsInfo; //導入方法依賴的package包/類
private BaseCredentialsInfo createCredentials(String remoteSystem, NodeRef remoteSystemNodeRef, BaseCredentialsInfo credentials)
{
if (credentials.getNodeRef() != null)
{
throw new IllegalArgumentException("Cannot create Credentials which have already been persisted!");
}
// Check we know about the type
RemoteCredentialsInfoFactory factory = credentialsFactories.get(credentials.getCredentialsType());
if (factory == null)
{
throw new TypeConversionException("No Factory registered for type " + credentials.getCredentialsType());
}
// Build the properties
Map<QName,Serializable> properties = RemoteCredentialsInfoFactory.FactoryHelper.getCoreCredentials(credentials);
properties.putAll( factory.serializeCredentials(credentials) );
// Generate a name for it, which will be unique and doesn't need updating
QName name = QName.createQName(GUID.generate());
// Add the node
NodeRef nodeRef = nodeService.createNode(
remoteSystemNodeRef, RemoteCredentialsModel.ASSOC_CREDENTIALS,
name, credentials.getCredentialsType(), properties
).getChildRef();
if (logger.isDebugEnabled())
logger.debug("Created new credentials at " + nodeRef + " for " + remoteSystem + " in " +
remoteSystemNodeRef + " of " + credentials);
// Return the new object
return factory.createCredentials(
credentials.getCredentialsType(), nodeRef,
remoteSystem, remoteSystemNodeRef,
nodeService.getProperties(nodeRef)
);
}
示例3: updateCredentials
import org.alfresco.service.cmr.remotecredentials.BaseCredentialsInfo; //導入方法依賴的package包/類
@Override
public BaseCredentialsInfo updateCredentials(BaseCredentialsInfo credentials)
{
if (credentials.getNodeRef() == null)
{
throw new IllegalArgumentException("Cannot update Credentials which haven't been persisted yet!");
}
RemoteCredentialsInfoFactory factory = credentialsFactories.get(credentials.getCredentialsType());
if (factory == null)
{
throw new TypeConversionException("No Factory registered for type " + credentials.getCredentialsType());
}
// Grab the current set of properties
Map<QName,Serializable> oldProps = nodeService.getProperties(credentials.getNodeRef());
// Overwrite them with the credentials ones
Map<QName,Serializable> props = new HashMap<QName,Serializable>(oldProps);
props.putAll( RemoteCredentialsInfoFactory.FactoryHelper.getCoreCredentials(credentials) );
props.putAll( factory.serializeCredentials(credentials) );
// Store
nodeService.setProperties(credentials.getNodeRef(), props);
// For now, return as-is
return credentials;
}
示例4: updateCredentialsAuthenticationSucceeded
import org.alfresco.service.cmr.remotecredentials.BaseCredentialsInfo; //導入方法依賴的package包/類
@Override
public BaseCredentialsInfo updateCredentialsAuthenticationSucceeded(boolean succeeded, BaseCredentialsInfo credentials)
{
// We can't help with credentials that have never been stored
if (credentials.getNodeRef() == null)
{
throw new IllegalArgumentException("Cannot update Credentials which haven't been persisted yet!");
}
// Return quickly if the credentials are already in the correct state
if (succeeded == credentials.getLastAuthenticationSucceeded())
{
return credentials;
}
// Do the update
nodeService.setProperty(credentials.getNodeRef(), RemoteCredentialsModel.PROP_LAST_AUTHENTICATION_SUCCEEDED, succeeded);
// Update the object if we can
if (credentials instanceof AbstractCredentialsImpl)
{
((AbstractCredentialsImpl)credentials).setLastAuthenticationSucceeded(succeeded);
return credentials;
}
else
{
// Need to re-load
return loadCredentials(credentials.getRemoteSystemName(),
credentials.getRemoteSystemContainerNodeRef(), credentials.getNodeRef());
}
}