Loading bundles/ch.elexis.core.data/src/ch/elexis/core/data/service/internal/LocalDocumentService.java +17 −14 Original line number Diff line number Diff line Loading @@ -27,7 +27,6 @@ import org.osgi.service.component.annotations.Component; import org.slf4j.LoggerFactory; import ch.elexis.core.data.activator.CoreHub; import ch.elexis.core.data.interfaces.IPersistentObject; import ch.elexis.core.data.service.LocalLockServiceHolder; import ch.elexis.core.lock.types.LockResponse; import ch.elexis.core.services.IConflictHandler; Loading @@ -49,9 +48,9 @@ public class LocalDocumentService implements ILocalDocumentService { public Optional<File> add(Object documentSource, IConflictHandler conflictHandler) throws IllegalStateException{ boolean readOnly = false; if (documentSource instanceof IPersistentObject) { if (documentSource != null) { LockResponse result = LocalLockServiceHolder.get().acquireLock((IPersistentObject) documentSource); LocalLockServiceHolder.get().acquireLock(documentSource); if (result.isOk()) { managedLocks.put(documentSource, result); } else { Loading Loading @@ -126,7 +125,7 @@ public class LocalDocumentService implements ILocalDocumentService { private void removeManaged(Object documentSource){ LockResponse lock = managedLocks.get(documentSource); if (lock != null) { LocalLockServiceHolder.get().releaseLock((IPersistentObject) documentSource); LocalLockServiceHolder.get().releaseLock(documentSource); managedLocks.remove(documentSource); } managedFiles.remove(documentSource); Loading Loading @@ -299,7 +298,8 @@ public class LocalDocumentService implements ILocalDocumentService { Method mimeMethod = null; Method[] methods = documentSource.getClass().getMethods(); for (Method method : methods) { if (method.getName().toLowerCase().contains("mime")) { if (method.getName().toLowerCase().contains("mime") && method.getReturnType() == String.class) { mimeMethod = method; break; } Loading Loading @@ -341,6 +341,7 @@ public class LocalDocumentService implements ILocalDocumentService { } private String getFileEnding(String mime){ if (mime != null) { if (mime.length() < 5) { return mime; } else { Loading @@ -354,6 +355,8 @@ public class LocalDocumentService implements ILocalDocumentService { } } } return getDefaultFileEnding(); } private String getDefaultFileEnding(){ return ".tmp"; Loading Loading
bundles/ch.elexis.core.data/src/ch/elexis/core/data/service/internal/LocalDocumentService.java +17 −14 Original line number Diff line number Diff line Loading @@ -27,7 +27,6 @@ import org.osgi.service.component.annotations.Component; import org.slf4j.LoggerFactory; import ch.elexis.core.data.activator.CoreHub; import ch.elexis.core.data.interfaces.IPersistentObject; import ch.elexis.core.data.service.LocalLockServiceHolder; import ch.elexis.core.lock.types.LockResponse; import ch.elexis.core.services.IConflictHandler; Loading @@ -49,9 +48,9 @@ public class LocalDocumentService implements ILocalDocumentService { public Optional<File> add(Object documentSource, IConflictHandler conflictHandler) throws IllegalStateException{ boolean readOnly = false; if (documentSource instanceof IPersistentObject) { if (documentSource != null) { LockResponse result = LocalLockServiceHolder.get().acquireLock((IPersistentObject) documentSource); LocalLockServiceHolder.get().acquireLock(documentSource); if (result.isOk()) { managedLocks.put(documentSource, result); } else { Loading Loading @@ -126,7 +125,7 @@ public class LocalDocumentService implements ILocalDocumentService { private void removeManaged(Object documentSource){ LockResponse lock = managedLocks.get(documentSource); if (lock != null) { LocalLockServiceHolder.get().releaseLock((IPersistentObject) documentSource); LocalLockServiceHolder.get().releaseLock(documentSource); managedLocks.remove(documentSource); } managedFiles.remove(documentSource); Loading Loading @@ -299,7 +298,8 @@ public class LocalDocumentService implements ILocalDocumentService { Method mimeMethod = null; Method[] methods = documentSource.getClass().getMethods(); for (Method method : methods) { if (method.getName().toLowerCase().contains("mime")) { if (method.getName().toLowerCase().contains("mime") && method.getReturnType() == String.class) { mimeMethod = method; break; } Loading Loading @@ -341,6 +341,7 @@ public class LocalDocumentService implements ILocalDocumentService { } private String getFileEnding(String mime){ if (mime != null) { if (mime.length() < 5) { return mime; } else { Loading @@ -354,6 +355,8 @@ public class LocalDocumentService implements ILocalDocumentService { } } } return getDefaultFileEnding(); } private String getDefaultFileEnding(){ return ".tmp"; Loading