예제 #1
0
 static InMemorySlug create(String slugPath, Container container) {
   Matcher matcher = SLUG_PATH_PATTERN.matcher(slugPath);
   String path = slugPath;
   long version = 0;
   if (matcher.matches()) {
     String strVersion = matcher.group(3);
     if (strVersion != null) {
       String strPath = matcher.group(1);
       if (!strPath.isEmpty()) {
         path = strPath;
         version = Long.parseLong(strVersion);
       }
     }
   }
   return new InMemorySlug(container.id(), path, version);
 }
 private URI getIndirectId(Container container, DataSet dataSet) {
   TemplateIntrospector introspector =
       TemplateIntrospector.newInstance(
           this.templateManagementService.templateOfId(container.id().templateId()));
   if (!introspector.isIndirectContainer()) {
     return null;
   }
   Property property =
       getInsertedContentRelation(dataSet, introspector.getInsertedContentRelation());
   if (property == null) {
     // TODO: Check if this situation is a failure
     return null;
   }
   final List<URI> indirectIdentities = findIndirectIds(property);
   if (indirectIdentities.size() == 1) {
     return indirectIdentities.get(0);
   }
   // TODO: We should fail here, either because no valid identifiers were
   // specified or because to many of them were specified
   return null;
 }