本文整理汇总了Java中javax.jcr.RepositoryException类的典型用法代码示例。如果您正苦于以下问题:Java RepositoryException类的具体用法?Java RepositoryException怎么用?Java RepositoryException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RepositoryException类属于javax.jcr包,在下文中一共展示了RepositoryException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildPath
import javax.jcr.RepositoryException; //导入依赖的package包/类
private void buildPath(List<String> list, Node parentNode) throws RepositoryException {
NodeIterator nodeIterator=parentNode.getNodes();
while(nodeIterator.hasNext()){
Node node=nodeIterator.nextNode();
String nodePath=node.getPath();
if(nodePath.endsWith(FileType.Ruleset.toString())){
list.add(nodePath);
}else if(nodePath.endsWith(FileType.UL.toString())){
list.add(nodePath);
}else if(nodePath.endsWith(FileType.DecisionTable.toString())){
list.add(nodePath);
}else if(nodePath.endsWith(FileType.ScriptDecisionTable.toString())){
list.add(nodePath);
}else if(nodePath.endsWith(FileType.DecisionTree.toString())){
list.add(nodePath);
}else if(nodePath.endsWith(FileType.RuleFlow.toString())){
list.add(nodePath);
}
buildPath(list,node);
}
}
示例2: getOrCreateAreaNode
import javax.jcr.RepositoryException; //导入依赖的package包/类
private JCRNodeWrapper getOrCreateAreaNode(String areaPath, JCRSessionWrapper session) throws RepositoryException {
JCRNodeWrapper areaParentNode = session.getNode(StringUtils.substringBeforeLast(areaPath, "/"));
String areaName = StringUtils.substringAfterLast(areaPath, "/");
JCRNodeWrapper areaNode = null;
try {
areaNode = areaParentNode.getNode(areaName);
} catch (PathNotFoundException e) {
try {
areaNode = areaParentNode.addNode(areaName, areaType);
session.save();
} catch (ItemExistsException e1) {
// possible race condition when page is accessed concurrently in edit mode
areaNode = areaParentNode.getNode(areaName);
}
}
return areaNode;
}
示例3: isResourceType
import javax.jcr.RepositoryException; //导入依赖的package包/类
private boolean isResourceType(Resource resource, String resourceType) {
if (StringUtils.isBlank(resourceType)) {
return true;
}
if (resource.isResourceType(resourceType)) {
return true;
}
if (!isValidType(resourceType)) {
return false;
}
Node node = resource.adaptTo(Node.class);
try {
if (node != null) {
return node.isNodeType(resourceType);
}
} catch (RepositoryException e) {
LOG.error("Can't check node type", e);
}
return false;
}
示例4: tryReimportBundles
import javax.jcr.RepositoryException; //导入依赖的package包/类
private void tryReimportBundles(final Path watchedRootDir, final Set<Path> changedPaths) {
final Set<Path> reimportedBundleRoots = new HashSet<>();
try {
for (Path changedPath : changedPaths) {
final Path relChangedDir = watchedRootDir.relativize(changedPath);
final String bundleName = relChangedDir.getName(0).toString();
final Path bundleRootDir = watchedRootDir.resolve(bundleName);
if (reimportedBundleRoots.add(bundleRootDir)) {
log.info("Reimporting bundle '{}'", bundleName);
service.importGroovyFiles(session, bundleRootDir.toFile());
}
}
session.save();
} catch (GroovyFileException | RepositoryException | IOException e) {
log.warn("Failed to reimport groovy file bundles {}, resetting session", reimportedBundleRoots, e);
resetSilently(session);
}
}
示例5: setUpdateScriptJcrNode
import javax.jcr.RepositoryException; //导入依赖的package包/类
/**
* do the update or create a node of the groovy file
* this will not save the session
*
* @param parent parentnode of the Node te be
* @param file file to transform into a Node
* @return success
* @throws RepositoryException
*/
public static boolean setUpdateScriptJcrNode(Node parent, File file) throws RepositoryException {
ScriptClass scriptClass = getInterpretingClass(file);
if(!scriptClass.isValid()){
return false;
}
final Updater updater = scriptClass.getUpdater();
String name = updater.name();
if(parent.hasNode(name)){
parent.getNode(name).remove();
}
Node scriptNode = parent.addNode(name, HIPPOSYS_UPDATERINFO);
scriptNode.setProperty(HIPPOSYS_BATCHSIZE, updater.batchSize());
scriptNode.setProperty(HIPPOSYS_DESCRIPTION, updater.description());
scriptNode.setProperty(HIPPOSYS_PARAMETERS, updater.parameters());
scriptNode.setProperty(updater.xpath().isEmpty() ? HIPPOSYS_PATH : HIPPOSYS_QUERY,
updater.xpath().isEmpty() ? updater.path() : updater.xpath());
scriptNode.setProperty(HIPPOSYS_SCRIPT, scriptClass.getContent());
scriptNode.setProperty(HIPPOSYS_THROTTLE, updater.throttle());
return true;
}
示例6: setFieldExternalDocuments
import javax.jcr.RepositoryException; //导入依赖的package包/类
/**
* This method sets what data form the external source should be stored on the document.
* In this case it stores the entire json object as string
*
* @param context
* @param exdocs
*/
@Override
public void setFieldExternalDocuments(ExternalDocumentServiceContext context, ExternalDocumentCollection<JSONObject> exdocs) {
final String fieldName = context.getPluginConfig().getString(PARAM_EXTERNAL_DOCS_FIELD_NAME);
if (StringUtils.isBlank(fieldName)) {
throw new IllegalArgumentException("Invalid plugin configuration parameter for '" + PARAM_EXTERNAL_DOCS_FIELD_NAME + "': " + fieldName);
}
try {
final Node contextNode = context.getContextModel().getNode();
final List<String> docIds = new ArrayList<String>();
for (Iterator<? extends JSONObject> it = exdocs.iterator(); it.hasNext(); ) {
JSONObject doc = it.next();
docIds.add(doc.toString());
}
contextNode.setProperty(fieldName, docIds.toArray(new String[docIds.size()]));
} catch (RepositoryException e) {
log.error("Failed to set related exdoc array field.", e);
}
}
开发者ID:jenskooij,项目名称:hippo-external-document-picker-example-implementation,代码行数:30,代码来源:DocumentServiceFacade.java
示例7: getTaxonomyName
import javax.jcr.RepositoryException; //导入依赖的package包/类
public static String getTaxonomyName() throws HstComponentException {
String taxonomyName;
try {
HstRequestContext ctx = RequestContextProvider.get();
taxonomyName = ctx.getSession().getNode(
"/hippo:namespaces/publicationsystem/publication/editor:templates/_default_/classifiable")
.getProperty("essentials-taxonomy-name")
.getString();
} catch (RepositoryException repositoryException) {
throw new HstComponentException(
"Exception occurred during fetching taxonomy file name.", repositoryException);
}
return taxonomyName;
}
示例8: streamDocumentVariants
import javax.jcr.RepositoryException; //导入依赖的package包/类
protected Stream<Node> streamDocumentVariants(Node node) throws RepositoryException {
if (!hasValidType(node, TYPE_HANDLE)) {
return Stream.empty();
}
Stream<Node> stream = StreamSupport.stream(
((Iterable<Node>) () -> {
try {
return node.getNodes();
} catch (RepositoryException ex) {
log.error("RepositoryException during read operation", ex);
}
return null;
}
).spliterator(),
false
);
return stream;
}
示例9: onEvent
import javax.jcr.RepositoryException; //导入依赖的package包/类
public void onEvent(EventIterator eventIterator) {
try {
while (eventIterator.hasNext()) {
Event event = eventIterator.nextEvent();
int type = event.getType();
switch (type) {
case Event.PROPERTY_CHANGED:
changedProperties.add(event.getPath());
break;
case Event.PROPERTY_ADDED:
addedProperties.add(event.getPath());
break;
case Event.PROPERTY_REMOVED:
removedProperties.add(event.getPath());
break;
}
}
eventBundlesProcessed++;
} catch (RepositoryException e) {
fail(e.getMessage());
}
}
开发者ID:apache,项目名称:sling-org-apache-sling-launchpad-integration-tests,代码行数:23,代码来源:PostServletPrivilegesUpdateTest.java
示例10: doEndTag
import javax.jcr.RepositoryException; //导入依赖的package包/类
/**
* Default processing of the end tag returning EVAL_PAGE.
*
* @return EVAL_PAGE
* @see org.jahia.taglibs.template.include.AddResourcesTag#doEndTag
*/
@Override
public int doEndTag() throws JspException {
// JSP VERSION: org.jahia.services.render.Resource currentResource =
// (org.jahia.services.render.Resource) pageContext.getAttribute("currentResource", PageContext.REQUEST_SCOPE);
Resource currentResource = (Resource) this.helper.getBindings().get("currentResource");
boolean isVisible = true;
RenderContext renderContext = (RenderContext) this.helper.getBindings().get("renderContext");
try {
isVisible = renderContext.getEditModeConfig() == null || renderContext.isVisible(currentResource.getNode());
} catch (RepositoryException e) {
logger.error(e.getMessage(), e);
}
if (isVisible) {
addResources(renderContext);
}
resetState();
return super.doEndTag();
}
示例11: missingResource
import javax.jcr.RepositoryException; //导入依赖的package包/类
protected void missingResource(RenderContext renderContext, Resource currentResource)
throws RepositoryException, IOException {
String currentPath = currentResource.getNode().getPath();
if (path.startsWith(currentPath + "/") && path.substring(currentPath.length() + 1).indexOf('/') == -1) {
currentResource.getMissingResources().add(path.substring(currentPath.length() + 1));
} else if (!path.startsWith("/")) {
currentResource.getMissingResources().add(path);
}
if (!"*".equals(path) && (path.indexOf("/") == -1)) {
// we have a named path that is missing, let's see if we can figure out it's node type.
constraints = ConstraintsHelper.getConstraints(currentResource.getNode(), path);
}
if (canEdit(renderContext) && checkNodeEditable(renderContext, currentResource.getNode()) && contributeAccess(renderContext, currentResource.getNode())) {
if (currentResource.getNode().hasPermission("jcr:addChildNodes")) {
List<String> contributeTypes = contributeTypes(renderContext, currentResource.getNode());
if (contributeTypes != null) {
nodeTypes = StringUtils.join(contributeTypes, " ");
}
printModuleStart("placeholder", path, null, null, null);
printModuleEnd();
}
}
}
示例12: recurse
import javax.jcr.RepositoryException; //导入依赖的package包/类
private void recurse( List<String> facets, String prefix, Node node )
throws RepositoryException
{
for ( Node n : JcrUtils.getChildNodes( node ) )
{
String name = prefix + "/" + n.getName();
if ( n.hasNodes() )
{
recurse( facets, name, n );
}
else
{
// strip leading / first
facets.add( name.substring( 1 ) );
}
}
}
示例13: addMetadataFacet
import javax.jcr.RepositoryException; //导入依赖的package包/类
@Override
public void addMetadataFacet( String repositoryId, MetadataFacet metadataFacet )
throws MetadataRepositoryException
{
try
{
Node repo = getOrAddRepositoryNode( repositoryId );
Node facets = JcrUtils.getOrAddNode( repo, "facets" );
String id = metadataFacet.getFacetId();
Node facetNode = JcrUtils.getOrAddNode( facets, id );
Node node = getOrAddNodeByPath( facetNode, metadataFacet.getName() );
for ( Map.Entry<String, String> entry : metadataFacet.toProperties().entrySet() )
{
node.setProperty( entry.getKey(), entry.getValue() );
}
}
catch ( RepositoryException e )
{
throw new MetadataRepositoryException( e.getMessage(), e );
}
}
示例14: removeMetadataFacets
import javax.jcr.RepositoryException; //导入依赖的package包/类
@Override
public void removeMetadataFacets( String repositoryId, String facetId )
throws MetadataRepositoryException
{
try
{
Node root = getJcrSession().getRootNode();
String path = getFacetPath( repositoryId, facetId );
if ( root.hasNode( path ) )
{
root.getNode( path ).remove();
}
}
catch ( RepositoryException e )
{
throw new MetadataRepositoryException( e.getMessage(), e );
}
}
示例15: removeMetadataFacet
import javax.jcr.RepositoryException; //导入依赖的package包/类
@Override
public void removeMetadataFacet( String repositoryId, String facetId, String name )
throws MetadataRepositoryException
{
try
{
Node root = getJcrSession().getRootNode();
String path = getFacetPath( repositoryId, facetId, name );
if ( root.hasNode( path ) )
{
Node node = root.getNode( path );
do
{
// also remove empty container nodes
Node parent = node.getParent();
node.remove();
node = parent;
}
while ( !node.hasNodes() );
}
}
catch ( RepositoryException e )
{
throw new MetadataRepositoryException( e.getMessage(), e );
}
}