Le document suivant contient les résultats de l'inspection CPD CPD 5.3.5.
Fichier | Ligne |
---|---|
org/apache/chemistry/opencmis/server/impl/atompub/NavigationService.java | 236 |
org/apache/chemistry/opencmis/server/impl/atompub/NavigationService.java | 323 |
throw new CmisRuntimeException( "Descendants are null!" ); } ObjectInfo folderInfo = service.getObjectInfo( repositoryId, folderId ); if ( folderInfo == null ) { throw new CmisRuntimeException( "Folder Object Info is missing!" ); } // set headers response.setStatus( HttpServletResponse.SC_OK ); response.setContentType( Constants.MEDIATYPE_FEED ); // write XML AtomFeed feed = new AtomFeed( ); feed.startDocument( response.getOutputStream( ) ); feed.startFeed( true ); // write basic Atom feed elements feed.writeFeedElements( folderInfo.getId( ), folderInfo.getCreatedBy( ), folderInfo.getName( ), folderInfo.getLastModificationDate( ), null, null ); // write links UrlBuilder baseUrl = compileBaseUrl( request, repositoryId ); feed.writeServiceLink( baseUrl.toString( ), repositoryId ); feed.writeSelfLink( compileUrl( baseUrl, RESOURCE_DESCENDANTS, folderInfo.getId( ) ), null ); feed.writeViaLink( compileUrl( baseUrl, RESOURCE_ENTRY, folderInfo.getId( ) ) ); feed.writeDownLink( compileUrl( baseUrl, RESOURCE_CHILDREN, folderInfo.getId( ) ), Constants.MEDIATYPE_FEED ); if ( folderInfo.supportsFolderTree( ) ) |
Fichier | Ligne |
---|---|
org/apache/chemistry/opencmis/server/impl/atompub/CmisAtomPubServlet.java | 259 |
org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java | 424 |
response.sendError( HttpServletResponse.SC_METHOD_NOT_ALLOWED, "Unknown operation" ); } } finally { if ( service != null ) { service.close( ); } } } /** * Translates an exception in an appropriate HTTP error code. */ private static int getErrorCode( CmisBaseException ex ) { if ( ex instanceof CmisConstraintException ) { return 409; } else if ( ex instanceof CmisContentAlreadyExistsException ) { return 409; } else if ( ex instanceof CmisFilterNotValidException ) { return 400; } else if ( ex instanceof CmisInvalidArgumentException ) { return 400; } else if ( ex instanceof CmisNameConstraintViolationException ) { return 409; } else if ( ex instanceof CmisNotSupportedException ) { return 405; } else if ( ex instanceof CmisObjectNotFoundException ) { return 404; } else if ( ex instanceof CmisPermissionDeniedException ) { return 403; } else if ( ex instanceof CmisStorageException ) { return 500; } else if ( ex instanceof CmisStreamNotSupportedException ) { return 403; } else if ( ex instanceof CmisUpdateConflictException ) { return 409; } else if ( ex instanceof CmisVersioningException ) { return 409; } return 500; } /** * Prints the error HTML page. */ private static void printError( Exception ex, HttpServletResponse response ) |
Fichier | Ligne |
---|---|
org/apache/chemistry/opencmis/server/impl/atompub/MultiFilingService.java | 125 |
org/apache/chemistry/opencmis/server/impl/atompub/ObjectService.java | 162 |
versioningState, parser.getPolicyIds( ), null ); ObjectInfo objectInfo = service.getObjectInfo( repositoryId, newObjectId ); if ( objectInfo == null ) { throw new CmisRuntimeException( "Object Info is missing!" ); } ObjectData object = objectInfo.getObject( ); if ( object == null ) { throw new CmisRuntimeException( "Object is null!" ); } // set headers UrlBuilder baseUrl = compileBaseUrl( request, repositoryId ); response.setStatus( HttpServletResponse.SC_CREATED ); response.setContentType( Constants.MEDIATYPE_ENTRY ); response.setHeader( "Location", compileUrl( baseUrl, RESOURCE_ENTRY, newObjectId ) ); // write XML AtomEntry entry = new AtomEntry( ); entry.startDocument( response.getOutputStream( ) ); writeObjectEntry( service, entry, object, null, repositoryId, null, null, baseUrl, true ); entry.endDocument( ); } |
Fichier | Ligne |
---|---|
org/apache/chemistry/opencmis/server/impl/atompub/ObjectService.java | 121 |
org/apache/chemistry/opencmis/server/impl/atompub/ObjectService.java | 164 |
ObjectInfo objectInfo = service.getObjectInfo( repositoryId, newObjectId ); if ( objectInfo == null ) { throw new CmisRuntimeException( "Object Info is missing!" ); } ObjectData object = objectInfo.getObject( ); if ( object == null ) { throw new CmisRuntimeException( "Object is null!" ); } // set headers UrlBuilder baseUrl = compileBaseUrl( request, repositoryId ); response.setStatus( HttpServletResponse.SC_CREATED ); response.setContentType( Constants.MEDIATYPE_ENTRY ); response.setHeader( "Location", compileUrl( baseUrl, RESOURCE_ENTRY, newObjectId ) ); // write XML AtomEntry entry = new AtomEntry( ); entry.startDocument( response.getOutputStream( ) ); writeObjectEntry( service, entry, object, null, repositoryId, null, null, baseUrl, true ); entry.endDocument( ); } /** * Create relationship. */ public static void createRelationship( CallContext context, CmisService service, String repositoryId, |
Fichier | Ligne |
---|---|
org/apache/chemistry/opencmis/server/impl/atompub/MultiFilingService.java | 127 |
org/apache/chemistry/opencmis/server/impl/atompub/ObjectService.java | 121 |
ObjectInfo objectInfo = service.getObjectInfo( repositoryId, newObjectId ); if ( objectInfo == null ) { throw new CmisRuntimeException( "Object Info is missing!" ); } ObjectData object = objectInfo.getObject( ); if ( object == null ) { throw new CmisRuntimeException( "Object is null!" ); } // set headers UrlBuilder baseUrl = compileBaseUrl( request, repositoryId ); response.setStatus( HttpServletResponse.SC_CREATED ); response.setContentType( Constants.MEDIATYPE_ENTRY ); response.setHeader( "Location", compileUrl( baseUrl, RESOURCE_ENTRY, newObjectId ) ); // write XML AtomEntry entry = new AtomEntry( ); entry.startDocument( response.getOutputStream( ) ); writeObjectEntry( service, entry, object, null, repositoryId, null, null, baseUrl, true ); entry.endDocument( ); } |
Fichier | Ligne |
---|---|
org/apache/chemistry/opencmis/server/impl/atompub/NavigationService.java | 410 |
org/apache/chemistry/opencmis/server/impl/atompub/PolicyService.java | 67 |
throw new CmisRuntimeException( "Parents are null!" ); } ObjectInfo objectInfo = service.getObjectInfo( repositoryId, objectId ); if ( objectInfo == null ) { throw new CmisRuntimeException( "Object Info is missing!" ); } // set headers response.setStatus( HttpServletResponse.SC_OK ); response.setContentType( Constants.MEDIATYPE_FEED ); // write XML AtomFeed feed = new AtomFeed( ); feed.startDocument( response.getOutputStream( ) ); feed.startFeed( true ); // write basic Atom feed elements feed.writeFeedElements( objectInfo.getId( ), objectInfo.getCreatedBy( ), objectInfo.getName( ), objectInfo.getLastModificationDate( ), null, null ); // write links UrlBuilder baseUrl = compileBaseUrl( request, repositoryId ); feed.writeServiceLink( baseUrl.toString( ), repositoryId ); feed.writeSelfLink( compileUrl( baseUrl, RESOURCE_PARENTS, objectInfo.getId( ) ), null ); |
Fichier | Ligne |
---|---|
org/apache/chemistry/opencmis/server/impl/atompub/RepositoryService.java | 280 |
org/apache/chemistry/opencmis/server/impl/atompub/RepositoryService.java | 368 |
Boolean hasMoreItems = ( ( typeList == null ) ? null : typeList.hasMoreItems( ) ); String parentTypeId = null; String typeName = "Type Children"; // in order to get the parent type, we need the type definition of this // type as well if ( typeId != null ) { TypeDefinition typeDefinition = service.getTypeDefinition( repositoryId, typeId, null ); parentTypeId = ( ( typeDefinition == null ) ? null : typeDefinition.getParentTypeId( ) ); typeName = ( ( typeDefinition == null ) ? typeId : typeDefinition.getDisplayName( ) ); } // write XML response.setStatus( HttpServletResponse.SC_OK ); response.setContentType( Constants.MEDIATYPE_FEED ); AtomFeed feed = new AtomFeed( ); feed.startDocument( response.getOutputStream( ) ); feed.startFeed( true ); // write basic Atom feed elements feed.writeFeedElements( typeId, TYPE_AUTHOR, typeName, new GregorianCalendar( ), null, numItems ); |
Fichier | Ligne |
---|---|
org/apache/chemistry/opencmis/server/impl/browser/MultiFilingService.java | 65 |
org/apache/chemistry/opencmis/server/impl/browser/ObjectService.java | 631 |
service.addObjectToFolder( repositoryId, objectId, folderId, allVersions, null ); String newObjectId = ( ( objectIdHolder.getValue( ) == null ) ? objectId : objectIdHolder.getValue( ) ); ObjectData object = getSimpleObject( service, repositoryId, newObjectId ); if ( object == null ) { throw new CmisRuntimeException( "Object is null!" ); } // set headers String location = compileUrl( compileBaseUrl( request, repositoryId ), RESOURCE_CONTENT, newObjectId ); setStatus( request, response, HttpServletResponse.SC_CREATED ); response.setHeader( "Location", location ); // return object TypeCache typeCache = new TypeCacheImpl( repositoryId, service ); JSONObject jsonObject = JSONConverter.convert( object, typeCache, false ); writeJSON( jsonObject, request, response ); } /* * removeObjectFromFolder. */ public static void removeObjectFromFolder( CallContext context, CmisService service, String repositoryId, |
Fichier | Ligne |
---|---|
org/apache/chemistry/opencmis/server/impl/browser/MultiFilingService.java | 102 |
org/apache/chemistry/opencmis/server/impl/browser/ObjectService.java | 669 |
service.removeObjectFromFolder( repositoryId, objectId, folderId, null ); String newObjectId = ( ( objectIdHolder.getValue( ) == null ) ? objectId : objectIdHolder.getValue( ) ); ObjectData object = getSimpleObject( service, repositoryId, newObjectId ); if ( object == null ) { throw new CmisRuntimeException( "Object is null!" ); } // set headers String location = compileUrl( compileBaseUrl( request, repositoryId ), RESOURCE_CONTENT, newObjectId ); setStatus( request, response, HttpServletResponse.SC_CREATED ); response.setHeader( "Location", location ); // return object TypeCache typeCache = new TypeCacheImpl( repositoryId, service ); JSONObject jsonObject = JSONConverter.convert( object, typeCache, false ); writeJSON( jsonObject, request, response ); } } |
Fichier | Ligne |
---|---|
org/apache/chemistry/opencmis/server/impl/browser/MultiFilingService.java | 65 |
org/apache/chemistry/opencmis/server/impl/browser/MultiFilingService.java | 102 |
org/apache/chemistry/opencmis/server/impl/browser/ObjectService.java | 631 |
org/apache/chemistry/opencmis/server/impl/browser/ObjectService.java | 669 |
service.addObjectToFolder( repositoryId, objectId, folderId, allVersions, null ); String newObjectId = ( ( objectIdHolder.getValue( ) == null ) ? objectId : objectIdHolder.getValue( ) ); ObjectData object = getSimpleObject( service, repositoryId, newObjectId ); if ( object == null ) { throw new CmisRuntimeException( "Object is null!" ); } // set headers String location = compileUrl( compileBaseUrl( request, repositoryId ), RESOURCE_CONTENT, newObjectId ); setStatus( request, response, HttpServletResponse.SC_CREATED ); response.setHeader( "Location", location ); // return object TypeCache typeCache = new TypeCacheImpl( repositoryId, service ); JSONObject jsonObject = JSONConverter.convert( object, typeCache, false ); writeJSON( jsonObject, request, response ); } |
Fichier | Ligne |
---|---|
org/apache/chemistry/opencmis/server/impl/webservices/AbstractService.java | 131 |
org/apache/chemistry/opencmis/server/shared/HttpUtils.java | 141 |
String acceptLanguage = header.getValue( ).get( 0 ); if ( acceptLanguage != null ) { String[] locale = acceptLanguage.split( "-" ); context.put( CallContext.LOCALE_ISO639_LANGUAGE, locale[0].trim( ) ); if ( locale.length > 1 ) { int x = locale[1].indexOf( ',' ); if ( x == -1 ) { context.put( CallContext.LOCALE_ISO3166_COUNTRY, locale[1].trim( ) ); } else { context.put( CallContext.LOCALE_ISO3166_COUNTRY, locale[1].substring( 0, x ).trim( ) ); } } } |
Fichier | Ligne |
---|---|
org/apache/chemistry/opencmis/server/impl/browser/ObjectService.java | 120 |
org/apache/chemistry/opencmis/server/impl/browser/ObjectService.java | 166 |
createContentStream( request ), versioningState, createPolicies( cp ), createAddAcl( cp ), createRemoveAcl( cp ), null ); ObjectData object = getSimpleObject( service, repositoryId, newObjectId ); if ( object == null ) { throw new CmisRuntimeException( "New document is null!" ); } // return object JSONObject jsonObject = JSONConverter.convert( object, typeCache, false ); setStatus( request, response, HttpServletResponse.SC_CREATED ); setCookie( request, response, repositoryId, transaction, createCookieValue( HttpServletResponse.SC_CREATED, object.getId( ), null, null ) ); writeJSON( jsonObject, request, response ); } /** * Create document from source. */ public static void createDocumentFromSource( CallContext context, CmisService service, String repositoryId, |
Fichier | Ligne |
---|---|
org/apache/chemistry/opencmis/server/impl/atompub/NavigationService.java | 216 |
org/apache/chemistry/opencmis/server/impl/atompub/NavigationService.java | 303 |
public static void getDescendants( CallContext context, CmisService service, String repositoryId, HttpServletRequest request, HttpServletResponse response ) throws Exception { // get parameters String folderId = getStringParameter( request, Constants.PARAM_ID ); BigInteger depth = getBigIntegerParameter( request, Constants.PARAM_DEPTH ); String filter = getStringParameter( request, Constants.PARAM_FILTER ); Boolean includeAllowableActions = getBooleanParameter( request, Constants.PARAM_ALLOWABLE_ACTIONS ); IncludeRelationships includeRelationships = getEnumParameter( request, Constants.PARAM_RELATIONSHIPS, IncludeRelationships.class ); String renditionFilter = getStringParameter( request, Constants.PARAM_RENDITION_FILTER ); Boolean includePathSegment = getBooleanParameter( request, Constants.PARAM_PATH_SEGMENT ); // execute List<ObjectInFolderContainer> descendants = service.getDescendants( repositoryId, folderId, depth, filter, |
Fichier | Ligne |
---|---|
org/apache/chemistry/opencmis/server/impl/atompub/CmisAtomPubServlet.java | 206 |
org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java | 272 |
printError( e, response ); } } // we are done. response.flushBuffer( ); } /** * Dispatches to feed, entry or whatever. */ private void dispatch( CallContext context, HttpServletRequest request, HttpServletResponse response ) throws Exception { CmisService service = null; try { // get services factory CmisServiceFactory factory = (CmisServiceFactory) getServletContext( ) .getAttribute( CmisRepositoryContextListener.SERVICES_FACTORY ); if ( factory == null ) { throw new CmisRuntimeException( "Service factory not available! Configuration problem?" ); } // get the service service = factory.getService( context ); // analyze the path String[] pathFragments = HttpUtils.splitPath( request ); if ( pathFragments.length < 4 ) { // root -> service document RepositoryService.getRepositories( context, service, request, response ); return; } |