Changeset 28609
- Timestamp:
- 01/09/08 17:38:30 (7 months ago)
- Files:
-
- org.nuxeo.ecm.core/branches/1.4/nuxeo-core-api/src/test/java/org/nuxeo/ecm/core/api/TestPropertyModel.java (modified) (2 diffs)
- org.nuxeo.ecm.core/branches/1.4/nuxeo-core/src/main/java/org/nuxeo/ecm/core/api/AbstractSession.java (modified) (2 diffs)
- org.nuxeo.ecm.core/branches/1.4/nuxeo-core/src/main/java/org/nuxeo/ecm/core/api/DocumentModelFactory.java (modified) (1 diff)
- org.nuxeo.ecm.core/branches/1.4/nuxeo-core/src/main/java/org/nuxeo/ecm/core/api/DocumentResolver.java (modified) (1 diff)
- org.nuxeo.ecm.core/branches/1.4/nuxeo-core/src/main/java/org/nuxeo/ecm/core/lifecycle/impl/LifeCycleListener.java (deleted)
- org.nuxeo.ecm.core/branches/1.4/nuxeo-core/src/main/java/org/nuxeo/ecm/core/security/CacheEntry.java (modified) (3 diffs)
- org.nuxeo.ecm.core/branches/1.4/nuxeo-core/src/main/java/org/nuxeo/ecm/core/security/DefaultPermissionProvider.java (modified) (5 diffs)
- org.nuxeo.ecm.core/branches/1.4/nuxeo-core/src/main/java/org/nuxeo/ecm/core/security/PermissionUIItemDescriptor.java (modified) (2 diffs)
- org.nuxeo.ecm.core/branches/1.4/nuxeo-core/src/main/java/org/nuxeo/ecm/core/security/PermissionVisibilityDescriptor.java (modified) (2 diffs)
- org.nuxeo.ecm.core/branches/1.4/nuxeo-core/src/test/java/org/nuxeo/ecm/core/lifecycle/TestLifeCycleService.java (modified) (1 diff)
- org.nuxeo.runtime/branches/1.4/nuxeo-runtime-osgi/src/main/java/org/nuxeo/runtime/launcher/StandaloneBundleLoader.java (modified) (1 diff)
- org.nuxeo.runtime/branches/1.4/nuxeo-runtime/src/main/java/org/nuxeo/runtime/api/DefaultServiceProvider.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
org.nuxeo.ecm.core/branches/1.4/nuxeo-core-api/src/test/java/org/nuxeo/ecm/core/api/TestPropertyModel.java
r28347 r28609 60 60 * 61 61 */ 62 // We're declaring variables as HashMaps / ArrayLists so they can be Serializable 63 @SuppressWarnings({"CollectionDeclaredAsConcreteClass"}) 62 64 public class TestPropertyModel extends TestCase { 63 65 … … 65 67 protected Schema schema; 66 68 67 <T> ArrayList<T> arrayList(T ... args) {69 static <T> ArrayList<T> arrayList(T ... args) { 68 70 ArrayList<T> list = new ArrayList<T>(args.length); 69 71 list.addAll(Arrays.asList(args)); org.nuxeo.ecm.core/branches/1.4/nuxeo-core/src/main/java/org/nuxeo/ecm/core/api/AbstractSession.java
r28583 r28609 313 313 try { 314 314 Session session = getSession(); 315 Document doc = documentResolver.resolveReference(session, docRef);315 Document doc = DocumentResolver.resolveReference(session, docRef); 316 316 return hasPermission(doc, permission); 317 317 } catch (DocumentException e) { … … 335 335 protected final Document resolveReference(DocumentRef docRef) 336 336 throws DocumentException, ClientException { 337 return documentResolver.resolveReference(getSession(), docRef);337 return DocumentResolver.resolveReference(getSession(), docRef); 338 338 } 339 339 org.nuxeo.ecm.core/branches/1.4/nuxeo-core/src/main/java/org/nuxeo/ecm/core/api/DocumentModelFactory.java
r28460 r28609 101 101 PrefetchInfo prefetchInfo = docModel.getDocumentType() 102 102 .getPrefetchInfo(); 103 103 104 if (prefetchInfo != null) { 104 105 105 Field[] prefetchFields = prefetchInfo.getFields(); 106 106 107 for (Field field : prefetchFields) { 107 108 108 String typeName = field.getDeclaringType().getName(); 109 109 String typeLocalName = field.getName().getLocalName(); org.nuxeo.ecm.core/branches/1.4/nuxeo-core/src/main/java/org/nuxeo/ecm/core/api/DocumentResolver.java
r20172 r28609 53 53 * @throws DocumentException if the document could not be resolved 54 54 */ 55 public finalDocument resolveReference(Session session, DocumentRef docRef)55 public static Document resolveReference(Session session, DocumentRef docRef) 56 56 throws DocumentException { 57 57 int type = docRef.type(); org.nuxeo.ecm.core/branches/1.4/nuxeo-core/src/main/java/org/nuxeo/ecm/core/security/CacheEntry.java
r18857 r28609 47 47 } 48 48 49 /* NOT USED?50 51 final String username() {52 return username;53 }54 55 public final String permission() {56 return permission;57 }58 59 public final String docUid() {60 return docUid;61 }62 */63 64 49 public final void setAccess(Access access) { 65 50 this.access = access; … … 73 58 } 74 59 60 @SuppressWarnings({"NonFinalFieldReferencedInHashCode"}) 75 61 @Override 76 62 public int hashCode() { … … 102 88 @Override 103 89 public String toString() { 104 return docUid + ":" + username + ":"+ permission;90 return docUid + ':' + username + ':' + permission; 105 91 } 106 92 org.nuxeo.ecm.core/branches/1.4/nuxeo-core/src/main/java/org/nuxeo/ecm/core/security/DefaultPermissionProvider.java
r28304 r28609 46 46 // to be recomputed each time a new PermissionDescriptor is registered - 47 47 // null means invalidated 48 private Map<String, MergedPermissionDescriptor> mergedPermissions = null;49 50 private Map<String, Set<String>> mergedGroups = null;48 private Map<String, MergedPermissionDescriptor> mergedPermissions; 49 50 private Map<String, Set<String>> mergedGroups; 51 51 52 52 private final List<PermissionVisibilityDescriptor> registeredPermissionsVisibility = new LinkedList<PermissionVisibilityDescriptor>(); 53 53 54 private Map<String, PermissionVisibilityDescriptor> mergedPermissionsVisibility = null; 54 private Map<String, PermissionVisibilityDescriptor> mergedPermissionsVisibility; 55 56 public DefaultPermissionProvider() { 57 mergedPermissionsVisibility = null; 58 } 55 59 56 60 public String[] getUserVisiblePermissions() throws ClientException { … … 215 219 216 220 synchronized public void registerDescriptor( 217 PermissionDescriptor permissionDescriptor) throws Exception {221 PermissionDescriptor descriptor) throws Exception { 218 222 // check that all included permission have previously been registered 219 223 Set<String> alreadyRegistered = new HashSet<String>(); … … 221 225 alreadyRegistered.add(registeredPerm.getName()); 222 226 } 223 for (String includePerm : permissionDescriptor.getIncludePermissions()) {227 for (String includePerm : descriptor.getIncludePermissions()) { 224 228 if (!alreadyRegistered.contains(includePerm)) { 225 229 // TODO: OG: use a specific exception sub class instead of the … … 228 232 String.format( 229 233 "Permission '%s' included by '%s' is not a registered permission", 230 includePerm, permissionDescriptor.getName()));234 includePerm, descriptor.getName())); 231 235 } 232 236 } … … 235 239 mergedGroups = null; 236 240 // append the new descriptor 237 registeredPermissions.add( permissionDescriptor);241 registeredPermissions.add(descriptor); 238 242 } 239 243 240 244 synchronized public void unregisterDescriptor( 241 PermissionDescriptor permissionDescriptor) {242 int lastOccurence = registeredPermissions.lastIndexOf( permissionDescriptor);245 PermissionDescriptor descriptor) { 246 int lastOccurence = registeredPermissions.lastIndexOf(descriptor); 243 247 if (lastOccurence != -1) { 244 248 // invalidate merged permission org.nuxeo.ecm.core/branches/1.4/nuxeo-core/src/main/java/org/nuxeo/ecm/core/security/PermissionUIItemDescriptor.java
r28325 r28609 53 53 return 0; 54 54 } else { 55 return order .intValue();55 return order; 56 56 } 57 57 } … … 62 62 return true; 63 63 } else { 64 return show .booleanValue();64 return show; 65 65 } 66 66 } org.nuxeo.ecm.core/branches/1.4/nuxeo-core/src/main/java/org/nuxeo/ecm/core/security/PermissionVisibilityDescriptor.java
r28325 r28609 66 66 } 67 67 68 @Override69 public boolean equals(Object other) {70 if (other instanceof PermissionVisibilityDescriptor) {71 PermissionVisibilityDescriptor otherPvd = (PermissionVisibilityDescriptor) other;72 if (!typeName.equals(otherPvd.typeName)) {73 return false;74 }75 if (!items.equals(otherPvd.items)) {76 return false;77 }78 return true;79 }80 return false;81 }82 83 68 public void merge(PermissionVisibilityDescriptor other) throws Exception { 84 69 List<PermissionUIItemDescriptor> otherItems = new ArrayList<PermissionUIItemDescriptor>( … … 118 103 119 104 @Override 105 public boolean equals(Object other) { 106 if (other instanceof PermissionVisibilityDescriptor) { 107 PermissionVisibilityDescriptor otherPvd = (PermissionVisibilityDescriptor) other; 108 if (!typeName.equals(otherPvd.typeName)) { 109 return false; 110 } 111 if (!items.equals(otherPvd.items)) { 112 return false; 113 } 114 return true; 115 } 116 return false; 117 } 118 119 @Override 120 120 public String toString() { 121 121 return String.format("PermissionVisibilityDescriptor[%s]", typeName); org.nuxeo.ecm.core/branches/1.4/nuxeo-core/src/test/java/org/nuxeo/ecm/core/lifecycle/TestLifeCycleService.java
r28563 r28609 42 42 public void setUp() throws Exception { 43 43 super.setUp(); 44 deploy ("LifeCycleService.xml");45 deploy ("LifeCycleManagerTestExtensions.xml");44 deployContrib("LifeCycleService.xml"); 45 deployContrib("LifeCycleManagerTestExtensions.xml"); 46 46 47 47 lifeCycleService = NXCore.getLifeCycleService(); org.nuxeo.runtime/branches/1.4/nuxeo-runtime-osgi/src/main/java/org/nuxeo/runtime/launcher/StandaloneBundleLoader.java
r21670 r28609 104 104 } finally { 105 105 System.out.println("Shutting down"); 106 if (osgi != null) { 107 try { 108 osgi.shutdown(); 109 } catch (Exception e) { 110 } 106 try { 107 osgi.shutdown(); 108 } catch (Exception e) { 111 109 } 112 110 } org.nuxeo.runtime/branches/1.4/nuxeo-runtime/src/main/java/org/nuxeo/runtime/api/DefaultServiceProvider.java
r28349 r28609 21 21 22 22 import java.util.Hashtable; 23 24 import org.jetbrains.annotations.NotNull; 23 25 24 26 /** … … 68 70 Object service; 69 71 70 public ServiceRef(Object service) { 71 if (service == null) { 72 throw new IllegalArgumentException("service instance cannot be null"); 73 } 72 public ServiceRef(@NotNull Object service) { 74 73 this.service = service; 75 74 type = service.getClass(); 76 75 } 77 76 78 public ServiceRef(Class<?> type) { 79 if (type == null) { 80 throw new IllegalArgumentException("service type cannot be null"); 81 } 77 public ServiceRef(@NotNull Class<?> type) { 82 78 service = null; 83 79 this.type = type;
