本文整理汇总了Java中org.alfresco.service.cmr.repository.StoreRef.toString方法的典型用法代码示例。如果您正苦于以下问题:Java StoreRef.toString方法的具体用法?Java StoreRef.toString怎么用?Java StoreRef.toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.alfresco.service.cmr.repository.StoreRef
的用法示例。
在下文中一共展示了StoreRef.toString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getValueAsString
import org.alfresco.service.cmr.repository.StoreRef; //导入方法依赖的package包/类
private <Q, S, E extends Throwable> String getValueAsString(LuceneQueryParserAdaptor<Q, S, E> lqpa, Serializable value)
{
String nodeRefStr = null;
if(!NodeRef.isNodeRef((String)value))
{
// assume the object id is the node guid
StoreRef storeRef = getStore(lqpa);
nodeRefStr = storeRef.toString() + "/" + (String)value;
}
else
{
nodeRefStr = (String)value;
}
Object converted = DefaultTypeConverter.INSTANCE.convert(dictionaryService.getDataType(DataTypeDefinition.NODE_REF), nodeRefStr);
String asString = DefaultTypeConverter.INSTANCE.convert(String.class, converted);
return asString;
}
示例2: getValueAsString
import org.alfresco.service.cmr.repository.StoreRef; //导入方法依赖的package包/类
private <Q, S, E extends Throwable> String getValueAsString(LuceneQueryParserAdaptor<Q, S, E> lqpa, Serializable value)
{
String nodeRefStr = (String)value;
if(!NodeRef.isNodeRef((String)value))
{
// assume the value (object id) is the node guid
StoreRef storeRef = getStore(lqpa);
nodeRefStr = storeRef.toString() + "/" + (String)value;
}
Object converted = DefaultTypeConverter.INSTANCE.convert(dictionaryService.getDataType(DataTypeDefinition.NODE_REF), nodeRefStr);
String asString = DefaultTypeConverter.INSTANCE.convert(String.class, converted);
return asString;
}
示例3: deployMessageResourceFile
import org.alfresco.service.cmr.repository.StoreRef; //导入方法依赖的package包/类
private void deployMessageResourceFile(String bundleBasePath, String name, InputStream resourceStream, boolean registerResourceBundle)
{
// Check that all the passed values are not null
ParameterCheck.mandatory("BundleBasePath", bundleBasePath);
ParameterCheck.mandatory("Name", name);
ParameterCheck.mandatory("ResourceStream", resourceStream);
try
{
Map<QName, Serializable> contentProps = new HashMap<QName, Serializable>();
contentProps.put(ContentModel.PROP_NAME, name);
StoreRef storeRef = repoMessagesLocation.getStoreRef();
NodeRef rootNode = nodeService.getRootNode(storeRef);
List<NodeRef> nodeRefs = searchService.selectNodes(rootNode, repoMessagesLocation.getPath(), null, namespaceService, false);
if (nodeRefs.size() == 0)
{
throw new AlfrescoRuntimeException(MESSAGES_LOCATION_NOT_FOUND, new Object[] { repoMessagesLocation.getPath() });
}
else if (nodeRefs.size() > 1)
{
// unexpected: should not find multiple nodes with same name
throw new AlfrescoRuntimeException(MESSAGES_LOCATION_MULTIPLE_FOUND, new Object[] { repoMessagesLocation.getPath() });
}
NodeRef customLabelsNodeRef = nodeRefs.get(0);
ChildAssociationRef association = nodeService.createNode(customLabelsNodeRef,
ContentModel.ASSOC_CONTAINS,
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name),
ContentModel.TYPE_CONTENT,
contentProps);
NodeRef content = association.getChildRef();
// add titled aspect (for Web Client display)
Map<QName, Serializable> titledProps = new HashMap<QName, Serializable>();
titledProps.put(ContentModel.PROP_TITLE, name);
titledProps.put(ContentModel.PROP_DESCRIPTION, name);
nodeService.addAspect(content, ContentModel.ASPECT_TITLED, titledProps);
// add inline-editable aspect
Map<QName, Serializable> editProps = new HashMap<QName, Serializable>(1, 1.0f);
editProps.put(ApplicationModel.PROP_EDITINLINE, true);
nodeService.addAspect(content, ApplicationModel.ASPECT_INLINEEDITABLE, editProps);
ContentWriter writer = contentService.getWriter(content, ContentModel.PROP_CONTENT, true);
writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);
writer.setEncoding("UTF-8");
writer.putContent(resourceStream);
resourceStream.close();
if (registerResourceBundle == true)
{
String bundleBaseName = null;
int idx = bundleBasePath.lastIndexOf("/");
if ((idx != -1) && (idx != bundleBasePath.length() - 1))
{
bundleBaseName = bundleBasePath.substring(idx+1);
}
else
{
bundleBaseName = bundleBasePath;
}
String repoBundlePath = storeRef.toString() + repoMessagesLocation.getPath() + "/cm:" + bundleBaseName;
messageService.registerResourceBundle(repoBundlePath);
}
logger.info("Message resource deployed: " + name);
}
catch (Throwable e)
{
throw new AlfrescoRuntimeException("Message resource deployment failed", e);
}
}
示例4: undeployMessageBundle
import org.alfresco.service.cmr.repository.StoreRef; //导入方法依赖的package包/类
public void undeployMessageBundle(String bundleBaseName)
{
checkBundleBaseName(bundleBaseName);
try
{
StoreRef storeRef = repoMessagesLocation.getStoreRef();
// unregister bundle
String repoBundlePath = storeRef.toString() + repoMessagesLocation.getPath() + "/cm:" + bundleBaseName;
messageService.unregisterResourceBundle(repoBundlePath);
NodeRef rootNode = nodeService.getRootNode(storeRef);
List<NodeRef> nodeRefs = searchService.selectNodes(rootNode, repoMessagesLocation.getPath()+CRITERIA_ALL, null, namespaceService, false);
boolean found = false;
for (NodeRef nodeRef : nodeRefs)
{
String resourceName = (String)nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
if (bundleBaseName.equals(messageService.getBaseBundleName(resourceName)))
{
// remove message resource file from the repository
nodeService.deleteNode(nodeRef);
found = true; // continue to undeploy any others
}
}
if (found)
{
logger.info("Message resources undeployed: " + bundleBaseName);
}
else
{
throw new AlfrescoRuntimeException(MSG_RESOURCES_NOT_FOUND, new Object[] { repoBundlePath });
}
}
catch (Throwable t)
{
throw new AlfrescoRuntimeException(MSG_RESOURCES_UNDEPLOYMENT_FAILED, t);
}
}
示例5: reloadMessageBundle
import org.alfresco.service.cmr.repository.StoreRef; //导入方法依赖的package包/类
public void reloadMessageBundle(String bundleBaseName)
{
checkBundleBaseName(bundleBaseName);
try
{
StoreRef storeRef = repoMessagesLocation.getStoreRef();
// re-register bundle
String repoBundlePath = storeRef.toString() + repoMessagesLocation.getPath() + "/cm:" + bundleBaseName;
NodeRef rootNode = nodeService.getRootNode(storeRef);
List<NodeRef> nodeRefs = searchService.selectNodes(rootNode, repoMessagesLocation.getPath()+CRITERIA_ALL, null, namespaceService, false);
boolean found = false;
for (NodeRef nodeRef : nodeRefs)
{
String resourceName = (String)nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
if (bundleBaseName.equals(messageService.getBaseBundleName(resourceName)))
{
found = true;
break;
}
}
if (found)
{
messageService.unregisterResourceBundle(repoBundlePath);
messageService.registerResourceBundle(repoBundlePath);
logger.info("Message resources re-loaded: " + bundleBaseName);
}
else
{
throw new AlfrescoRuntimeException(MSG_RESOURCES_NOT_FOUND, new Object[] { repoBundlePath });
}
}
catch (Throwable e)
{
throw new AlfrescoRuntimeException(MSG_RESOURCES_RELOAD_FAILED, e);
}
}