Source:
<code>public boolean chkAuthorization(String userName, Object conceptCollectionObj, String[] userRoles) throws QuadrigaStorageException, QuadrigaAccessException { IConceptCollection collection; String conceptCollectionId = null; if (conceptCollectionObj.getClass().equals(String.class)) { conceptCollectionId = (String) conceptCollectionObj; collection = conceptCollectionManager.getConceptCollection(conceptCollectionId); } else { collection = (IConceptCollection) conceptCollectionObj; <START> } <END> String conceptCollectionOwner = collection.getOwner().getUserName(); if (userName.equals(conceptCollectionOwner)) { return true; } if (userRoles.length == 0) return false; List<String> roles = Arrays.asList(userRoles); List<IConceptCollectionCollaborator> ccCollaboratorList = conceptCollectionManager .showCollaboratingUsers(conceptCollectionId); if (ccCollaboratorList == null || ccCollaboratorList.isEmpty()) return false; for (IConceptCollectionCollaborator ccCollaborator : ccCollaboratorList) { String collaboratorName = ccCollaborator.getCollaborator().getUserObj().getUserName(); if (userName == null || !userName.equals(collaboratorName)) continue; List<IQuadrigaRole> collaboratorRoles = ccCollaborator.getCollaborator().getCollaboratorRoles(); if (collaboratorRoles != null) { for (IQuadrigaRole collabRole : collaboratorRoles) { String collaboratorRoleId = collabRole.getId(); if (roles != null) { if (roles.contains(collaboratorRoleId)) { return true; } } } } } return false; }</code><technical_language>this clean throw a runtime exception if object is of type string of type concept collection, developers idea wrong if annotation wrong</technical_language>

Target:
public boolean chkAuthorization(String userName, Object conceptCollectionObj, String[] userRoles) throws QuadrigaStorageException, QuadrigaAccessException { IConceptCollection collection; if (conceptCollectionObj instanceof String) { String conceptCollectionId = (String) conceptCollectionObj; collection = conceptCollectionManager.getConceptCollection(conceptCollectionId); } else { try { collection = (IConceptCollection) conceptCollectionObj; } catch (ClassCastException cce) { throw new IllegalObjectException(cce); } } String conceptCollectionOwner = collection.getOwner().getUserName(); if (userName.equals(conceptCollectionOwner)) { return true; } if (userRoles.length == 0) return false; List<String> roles = Arrays.asList(userRoles); List<IConceptCollectionCollaborator> ccCollaboratorList = conceptCollectionManager .showCollaboratingUsers(collection.getConceptCollectionId()); if (ccCollaboratorList == null || ccCollaboratorList.isEmpty()) return false; for (IConceptCollectionCollaborator ccCollaborator : ccCollaboratorList) { String collaboratorName = ccCollaborator.getCollaborator().getUserObj().getUserName(); if (userName == null || !userName.equals(collaboratorName)) continue; List<IQuadrigaRole> collaboratorRoles = ccCollaborator.getCollaborator().getCollaboratorRoles(); if (collaboratorRoles != null) { for (IQuadrigaRole collabRole : collaboratorRoles) { String collaboratorRoleId = collabRole.getId(); if (roles != null) { if (roles.contains(collaboratorRoleId)) { return true; } } } } } return false; }