本文整理汇总了Java中org.alfresco.service.cmr.repository.InvalidNodeRefException.getNodeRef方法的典型用法代码示例。如果您正苦于以下问题:Java InvalidNodeRefException.getNodeRef方法的具体用法?Java InvalidNodeRefException.getNodeRef怎么用?Java InvalidNodeRefException.getNodeRef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.alfresco.service.cmr.repository.InvalidNodeRefException
的用法示例。
在下文中一共展示了InvalidNodeRefException.getNodeRef方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: executeImpl
import org.alfresco.service.cmr.repository.InvalidNodeRefException; //导入方法依赖的package包/类
@Override
protected Map<String, Object> executeImpl(final WebScriptRequest req, Status status, Cache cache)
{
// create map of params (template vars)
Map<String, String> params = req.getServiceMatch().getTemplateVars();
final NodeRef nodeRef = WebScriptUtil.getNodeRef(params);
if (nodeRef == null)
{
String msg = "A valid NodeRef must be specified!";
throw new WebScriptException(HttpServletResponse.SC_BAD_REQUEST, msg);
}
try
{
Map<String, Object> model = quickShareService.getMetaData(nodeRef);
if (logger.isDebugEnabled())
{
logger.debug("Retrieved limited metadata: "+nodeRef+" ["+model+"]");
}
return model;
}
catch (InvalidNodeRefException inre)
{
logger.error("Unable to find node: "+inre.getNodeRef());
throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find nodeRef: "+inre.getNodeRef());
}
}
示例2: importImportableItemMetadata
import org.alfresco.service.cmr.repository.InvalidNodeRefException; //导入方法依赖的package包/类
protected final void importImportableItemMetadata(NodeRef nodeRef, Path parentFile, MetadataLoader.Metadata metadata)
{
// Attach aspects
if (metadata.getAspects() != null)
{
for (final QName aspect : metadata.getAspects())
{
if (logger.isDebugEnabled()) logger.debug("Attaching aspect '" + aspect.toString() + "' to node '" + nodeRef.toString() + "'.");
nodeService.addAspect(nodeRef, aspect, null); // Note: we set the aspect's properties separately, hence null for the third parameter
}
}
// Set property values for both the type and any aspect(s)
if (metadata.getProperties() != null)
{
if (logger.isDebugEnabled()) logger.debug("Adding properties to node '" + nodeRef.toString() + "':\n" + mapToString(metadata.getProperties()));
try
{
nodeService.addProperties(nodeRef, metadata.getProperties());
}
catch (final InvalidNodeRefException inre)
{
if (!nodeRef.equals(inre.getNodeRef()))
{
// Caused by an invalid NodeRef in the metadata (e.g. in an association)
throw new IllegalStateException("Invalid nodeRef found in metadata for '" + getFileName(parentFile) + "'. " +
"Probable cause: an association is being populated via metadata, but the " +
"NodeRef for the target of that association ('" + inre.getNodeRef() + "') is invalid. " +
"Please double check your metadata file and try again.", inre);
}
else
{
// Logic bug in the BFSIT. :-(
throw inre;
}
}
}
}