public boolean handleAuditEntryError(Long entryId, String errorMsg, Throwable error) { throw new CmisRuntimeException("Audit entry " + entryId + ": " + errorMsg, error); } };
public boolean handleAuditEntryError(Long entryId, String errorMsg, Throwable error) { throw new CmisRuntimeException("Audit entry " + entryId + ": " + errorMsg, error); } };
public String getPayload() { try { return baous.toString(IOUtils.UTF8); } catch (UnsupportedEncodingException e) { throw new CmisRuntimeException("Unsupported encoding 'UTF-8'!", e); } } }
protected MutablePolicyTypeDefinition createPolicyTypeDefinitionObject() { try { return policyTypeDefinitionClass.newInstance(); } catch (Exception e) { throw new CmisRuntimeException("Cannot create type defintion object: " + e.getMessage(), e); } }
protected MutableSecondaryTypeDefinition createSecondaryTypeDefinitionObject() { try { return secondaryTypeDefinitionClass.newInstance(); } catch (Exception e) { throw new CmisRuntimeException("Cannot create type defintion object: " + e.getMessage(), e); } }
protected MutableDocumentTypeDefinition createDocumentTypeDefinitionObject() { try { return documentTypeDefinitionClass.newInstance(); } catch (Exception e) { throw new CmisRuntimeException("Cannot create type defintion object: " + e.getMessage(), e); } }
protected MutableRelationshipTypeDefinition createRelationshipTypeDefinitionObject() { try { return relationshipTypeDefinitionClass.newInstance(); } catch (Exception e) { throw new CmisRuntimeException("Cannot create type defintion object: " + e.getMessage(), e); } }
protected MutableItemTypeDefinition createItemTypeDefinitionObject() { try { return itemTypeDefinitionClass.newInstance(); } catch (Exception e) { throw new CmisRuntimeException("Cannot create type defintion object: " + e.getMessage(), e); } }
@SuppressWarnings("unchecked") public static Map<String, Object> getMap(final Object o) { if (o == null) { return null; } if (o instanceof Map) { return (Map<String, Object>) o; } throw new CmisRuntimeException("Expected a JSON object but found a " + (o instanceof List ? "JSON array" : o.getClass().getSimpleName()) + ": " + o.toString()); }
@SuppressWarnings("unchecked") public static List<Object> getList(final Object o) { if (o == null) { return null; } if (o instanceof List) { return (List<Object>) o; } throw new CmisRuntimeException("Expected a JSON array but found a " + (o instanceof List ? "JSON object" : o.getClass().getSimpleName()) + ": " + o.toString()); }
@SuppressWarnings("unchecked") public static Map<String, Object> getMap(final Object o) { if (o == null) { return null; } if (o instanceof Map) { return (Map<String, Object>) o; } throw new CmisRuntimeException("Expected a JSON object but found a " + (o instanceof List ? "JSON array" : o.getClass().getSimpleName()) + ": " + o.toString()); }
protected static BigInteger getBigIntegerParameter(Map<String, String> parameters, String key, int def) { String value = parameters.get(key); try { return StringUtils.isBlank(value) ? BigInteger.valueOf(def) : new BigInteger(value); } catch (NumberFormatException e) { throw new CmisRuntimeException("Could not parse configuration values for " + key + ": " + e.getMessage(), e); } }
protected static long getLongParameter(Map<String, String> parameters, String key, long def) { String value = parameters.get(key); try { return StringUtils.isBlank(value) ? def : Long.parseLong(value); } catch (NumberFormatException e) { throw new CmisRuntimeException("Could not parse configuration values for " + key + ": " + e.getMessage(), e); } }
protected CmisServiceFactory getCmisServiceFactory(final ServletContext servletContext) { CmisServiceFactory factory = CmisRepositoryContextListener.getServiceFactory(servletContext); if (factory == null) { throw new CmisRuntimeException("Service factory not available! Configuration problem?"); } return factory; }
public AbstractCmisServiceWrapper createWrapperObject(CmisService service) { try { AbstractCmisServiceWrapper wrapper = wrapperConstructor.newInstance(service); wrapper.initialize(params); return wrapper; } catch (Exception e) { throw new CmisRuntimeException("Could not instantiate service wrapper " + wrapperClass.getName() + ": " + e.toString(), e); } }
/** For extensibility. */ protected Boolean walkOtherPredicate(Tree node) { throw new CmisRuntimeException("Unknown node type: " + node.getType() + " (" + node.getText() + ")"); }
@Override public Folder getRootFolder(OperationContext context) { String rootFolderId = getRepositoryInfo().getRootFolderId(); CmisObject rootFolder = getObject(rootFolderId, context); if (!(rootFolder instanceof Folder)) { throw new CmisRuntimeException("Root folder object is not a folder!"); } return (Folder) rootFolder; }
public RegistryVersion next() { String nextVersion = iterator.next(); try { return new RegistryVersion(getRepository(), getRepository().get(nextVersion), nextVersion, typeManager, pathManager); } catch (RegistryException e) { throw new CmisRuntimeException("Error iterating over versions"); } }
@Override public Folder getRootFolder(OperationContext context) { String rootFolderId = getRepositoryInfo().getRootFolderId(); CmisObject rootFolder = getObject(rootFolderId, context); if (!(rootFolder instanceof Folder)) { throw new CmisRuntimeException("Root folder object is not a folder!"); } return (Folder) rootFolder; }
@Override public ObjectType getTypeDefinition(String typeId, boolean useCache) { RepositoryService service = getBinding().getRepositoryService(); if (!(service instanceof ExtendedRepositoryService)) { throw new CmisRuntimeException( "Internal error: Repository Service does not implement ExtendedRepositoryService!"); } ExtendedRepositoryService extRepSrv = (ExtendedRepositoryService) service; TypeDefinition typeDefinition = extRepSrv.getTypeDefinition(getRepositoryId(), typeId, null, useCache); return convertAndCacheTypeDefinition(typeDefinition, useCache); }