Package org.apache.sling.api.resource

Examples of org.apache.sling.api.resource.ResourceResolver.commit()


                // if there is already a resource, it means we must handle an update
                // TODO - we should use a hash for this!
                if ( foundResource != null ) {
                    try {
                        writerResolver.delete(foundResource);
                        writerResolver.commit();
                    } catch (final PersistenceException pe) {
                        // we ignore this
                        this.ignoreException(pe);
                        writerResolver.refresh();
                    }
View Full Code Here


                rr.delete(appsValidatorsRoot);
            }
            if (libsValidatorsRoot != null) {
                rr.delete(libsValidatorsRoot);
            }
            rr.commit();
            rr.close();
        }
    }

    @Before
View Full Code Here

            if (model2 != null) {
                rr.delete(model2);
            }
        } finally {
            if (rr != null) {
                rr.commit();
                rr.close();
            }
        }
    }
View Full Code Here

            if (model3 != null) {
                rr.delete(model3);
            }
        } finally {
            if (rr != null) {
                rr.commit();
                rr.close();
            }
        }
    }
View Full Code Here

        } finally {
            if (model1 != null) {
                rr.delete(model1);
            }
            if (rr != null) {
                rr.commit();
                rr.close();
            }
        }
    }
View Full Code Here

            if (model1 != null) {
                rr.delete(model1);
            }
        } finally {
            if (rr != null) {
                rr.commit();
                rr.close();
            }
        }
    }
View Full Code Here

                testResource = ResourceUtil.getOrCreateResource(rr, "/apps/validation/1/resource", JcrConstants.NT_UNSTRUCTURED,
                        JcrConstants.NT_UNSTRUCTURED, true);
                Resource childResource = rr.create(testResource, "child1", new HashMap<String, Object>(){{
                    put(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED);
                }});
                rr.commit();

                ModifiableValueMap mvm = testResource.adaptTo(ModifiableValueMap.class);
                mvm.put("field1", "1");
                rr.commit();
View Full Code Here

                }});
                rr.commit();

                ModifiableValueMap mvm = testResource.adaptTo(ModifiableValueMap.class);
                mvm.put("field1", "1");
                rr.commit();

                // /apps/validation/1/resource/child1 will miss its mandatory "hello" property
                Resource resourceChild = rr.create(testResource, "child1", new HashMap<String, Object>(){{
                    put(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED);
                }});
View Full Code Here

                }});

                Resource resourceGrandChild = rr.create(resourceChild, "grandChild1", new HashMap<String, Object>(){{
                    put(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED);
                }});
                rr.commit();
            }
            ValidationModel vm = validationService.getValidationModel("sling/validation/test", "/apps/validation/1/resource");
            ValidationResult vr = validationService.validate(testResource, vm);
            assertFalse(vr.isValid());
            assertTrue(vr.getFailureMessages().containsKey("child1/hello"));
View Full Code Here

                    rr.delete(model1);
                }
                if (testResource != null) {
                    rr.delete(testResource);
                }
                rr.commit();
                rr.close();
            }
        }
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.