protected void checkRepositoryId(String repositoryId) { if (!connector.getRepositoryId().equals(repositoryId)) { throw new CmisObjectNotFoundException("Unknown repository '" + repositoryId + "'!"); } }
} catch (CmisObjectNotFoundException e) { addResult(createResult(UNEXPECTED_EXCEPTION, "Relationship type '" + objectTypeId + "' is not available: " + e.getMessage(), e, true)); return null;
/** * See CMIS 1.0 section 2.2.7.3 checkedIn */ public void checkIn(Holder<String> objectId, Boolean major, Properties properties, ContentStream contentStream, String checkinComment) { if(log.isTraceEnabled()) { log.trace("<<<<<<< checkin for object id " + objectId.getValue()); } // check id if (objectId == null || objectId.getValue() == null) { throw new CmisInvalidArgumentException("Object Id must be set."); } // get the node RegistryObject gregNode; try { gregNode = getGregNode(objectId.getValue()); } catch (CmisObjectNotFoundException e) { throw new CmisUpdateConflictException(e.getCause().getMessage(), e.getCause()); } if (!gregNode.isVersionable()) { throw new CmisUpdateConflictException("Not a version: " + gregNode); } // checkin RegistryVersion checkedIn = gregNode.asVersion().checkin(properties, contentStream, checkinComment); objectId.setValue(checkedIn.getId()); }
@Override public void run(Session session) { if (supportsQuery(session)) { doInvalidQuery(session, ""); doInvalidQuery(session, "SELECT"); doInvalidQuery(session, "SELECT *"); doInvalidQuery(session, "THIS_IS_NOT_A_SELECT"); doInvalidQuery(session, "SELECT FROM cmis:document"); doInvalidQuery(session, "SELECT ,cmis:name FROM cmis:document"); } else { try { doQuery(session, "SELECT * FROM cmis:document"); addResult(createResult(WARNING, "Query capability is set to 'none' but calling query() works.")); } catch (CmisNotSupportedException nse) { // excepted } catch (CmisObjectNotFoundException onfe) { // excepted for AtomPub if (getBinding() != BindingType.ATOMPUB) { addResult(createResult(FAILURE, "Query capability is set to 'none' but calling query() throws an exception, which is not a notSupported exception(" + onfe.toString() + ").", onfe, false)); } } catch (Exception ex) { addResult(createResult(FAILURE, "Query capability is set to 'none' but calling query() throws an exception, which is not a notSupported exception(" + ex.toString() + ").", ex, false)); } } }
} catch (CmisObjectNotFoundException e) { addResult(createResult(UNEXPECTED_EXCEPTION, "Item type '" + objectTypeId + "' is not available: " + e.getMessage(), e, true)); return null;
protected void checkRepositoryId(String repositoryId) { if (!connector.getRepositoryId().equals(repositoryId)) { throw new CmisObjectNotFoundException("Unknown repository '" + repositoryId + "'!"); } }
} catch (CmisObjectNotFoundException e) { addResult(createResult(UNEXPECTED_EXCEPTION, "Policy type '" + objectTypeId + "' is not available: " + e.getMessage(), e, true)); return null;
@Override public RepositoryInfo getRepositoryInfo(String repositoryId, ExtensionsData extension) { if (!fRepInfo.getId().equals(repositoryId)) { throw new CmisObjectNotFoundException( "A repository with repository id '" + repositoryId + "' does not exist!"); } return fRepInfo; }
} catch (CmisObjectNotFoundException e) { addResult(createResult(UNEXPECTED_EXCEPTION, "Document type '" + objectTypeId + "' is not available: " + e.getMessage(), e, true)); return null;
/** * @return this instance as a <code>RegistryFolder</code> * @throws CmisConstraintException if <code>this.isFolder() == false</code> */ public RegistryFolder asFolder() { if (isFolder()) { return (RegistryFolder) this; } else { throw new CmisObjectNotFoundException("Not a folder: " + this); } }
} catch (CmisObjectNotFoundException e) { addResult(createResult(UNEXPECTED_EXCEPTION, "Folder type '" + objectTypeId + "' is not available: " + e.getMessage(), e, true)); return null;
public void checkIfUseful(String what) { switch (objecVariant) { case INVALID_ID: throw new CmisInvalidArgumentException(what + " id is invalid: " + objectId); case NOT_EXISTING: throw new CmisObjectNotFoundException(what + " not found: " + objectId); case NOT_A_CMIS_OBJECT: throw new CmisObjectNotFoundException(what + " is not a CMIS object: " + objectId); case PERMISSION_DENIED: throw new CmisPermissionDeniedException("Permission denied!"); } }
public void checkIfUseful(String what) { switch (objecVariant) { case INVALID_ID: throw new CmisInvalidArgumentException(what + " id is invalid: " + objectId); case NOT_EXISTING: throw new CmisObjectNotFoundException(what + " not found: " + objectId); case NOT_A_CMIS_OBJECT: throw new CmisObjectNotFoundException(what + " is not a CMIS object: " + objectId); case PERMISSION_DENIED: throw new CmisPermissionDeniedException("Permission denied!"); } }
/** * See CMIS 1.0 section 2.2.2.5 getTypeDefinition */ public TypeDefinition getTypeDefinition(String typeId) { if(log.isTraceEnabled()){ log.trace("<<<<<<< getTypeDefinition for type id " + typeId); } TypeDefinition type = typeManager.getType(typeId); if (type == null) { throw new CmisObjectNotFoundException("Type '" + typeId + "' is unknown!"); } return RegistryTypeManager.copyTypeDefinition(type); }
@Override public RepositoryInfo getRepositoryInfo(String repositoryId, ExtensionsData extension) { List<RepositoryInfo> repositoryInfos = getRepositoriesInternal(repositoryId); if (repositoryInfos.isEmpty()) { throw new CmisObjectNotFoundException("Repository '" + repositoryId + "' not found!"); } // find the repository for (RepositoryInfo info : repositoryInfos) { if (info.getId() == null) { continue; } if (info.getId().equals(repositoryId)) { return info; } } throw new CmisObjectNotFoundException("Repository '" + repositoryId + "' not found!"); }
@Override public RepositoryInfo getRepositoryInfo(String repositoryId, ExtensionsData extension) { List<RepositoryInfo> repositoryInfos = getRepositoriesInternal(repositoryId); if (repositoryInfos.isEmpty()) { throw new CmisObjectNotFoundException("Repository '" + repositoryId + "' not found!"); } // find the repository for (RepositoryInfo info : repositoryInfos) { if (info.getId() == null) { continue; } if (info.getId().equals(repositoryId)) { return info; } } throw new CmisObjectNotFoundException("Repository '" + repositoryId + "' not found!"); }
@Override public RepositoryInfo getRepositoryInfo(String repositoryId, ExtensionsData extension) { List<RepositoryInfo> repositoryInfos = getRepositoriesInternal(repositoryId); if (repositoryInfos.isEmpty()) { throw new CmisObjectNotFoundException("Repository '" + repositoryId + "' not found!"); } // find the repository for (RepositoryInfo info : repositoryInfos) { if (info.getId() == null) { continue; } if (info.getId().equals(repositoryId)) { return info; } } throw new CmisObjectNotFoundException("Repository '" + repositoryId + "' not found!"); }
@Override public RepositoryInfo getRepositoryInfo(String repositoryId, ExtensionsData extension) { List<RepositoryInfo> repositoryInfos = getRepositoriesInternal(repositoryId); if (repositoryInfos.size() == 0) { throw new CmisObjectNotFoundException("Repository '" + repositoryId + "' not found!"); } if (repositoryInfos.size() == 1) { return repositoryInfos.get(0); } // find the repository for (RepositoryInfo info : repositoryInfos) { if (info.getId() == null) { continue; } if (info.getId().equals(repositoryId)) { return info; } } throw new CmisObjectNotFoundException("Repository '" + repositoryId + "' not found!"); }
@Override public void deleteType(String repositoryId, String typeId, ExtensionsData extension) { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put(Constants.PARAM_ID, typeId); String link = loadTemplateLink(repositoryId, Constants.TEMPLATE_TYPE_BY_ID, parameters); if (link == null) { throw new CmisObjectNotFoundException("Unknown repository!"); } delete(new UrlBuilder(link)); } }
@Override public void deleteType(String repositoryId, String typeId, ExtensionsData extension) { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put(Constants.PARAM_ID, typeId); String link = loadTemplateLink(repositoryId, Constants.TEMPLATE_TYPE_BY_ID, parameters); if (link == null) { throw new CmisObjectNotFoundException("Unknown repository!"); } delete(new UrlBuilder(link)); } }