Changeset 3216
- Timestamp:
- 07/31/13 15:57:15 (11 years ago)
- Location:
- DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend
- Files:
-
- 5 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/nb-configuration.xml
r3211 r3216 17 17 <org-netbeans-modules-maven-jaxws.rest_2e_jersey_2e_type>server</org-netbeans-modules-maven-jaxws.rest_2e_jersey_2e_type> 18 18 </properties> 19 <spring-data xmlns="http://www.netbeans.org/ns/spring-data/1"> 20 <config-files> 21 <config-file>src/test/resources/spring-test-config/mockPermissions.xml</config-file> 22 </config-files> 23 <config-file-groups/> 24 </spring-data> 19 25 </project-shared-configuration> -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/dao/UserDao.java
r3205 r3216 25 25 */ 26 26 public interface UserDao extends ResourceDao{ 27 28 /** 29 * 30 * @param userIDentifier 31 * @return the internal identifier of "userIDentifier" 32 */ 27 33 Number getInternalID(UserIdentifier userIDentifier); 34 35 /** 36 * 37 * @param internalId 38 * @return the external UserIdentifier of internalId; 39 */ 40 UserIdentifier getExternalID(Number internalId); 28 41 } 42 43 -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/dao/impl/JdbcResourceDao.java
r3214 r3216 51 51 final static protected String principal_id = "principal_id"; 52 52 final static protected String time_stamp = "time_stamp"; 53 final static protected String permission = "permission_"; 53 54 54 55 // derived string constants: table+field names -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/dao/impl/JdbcUserDao.java
r3209 r3216 61 61 } 62 62 }; 63 64 /////////////////////////////////////////////////////////////////// 65 @Override 66 public UserIdentifier getExternalID(Number internalId) { 67 if (internalId == null) { 68 return null; 69 } 70 String sql = "SELECT " + external_id + " FROM " + principalTableName + " WHERE " + principal_id + "= ?"; 71 List<UserIdentifier> result = getSimpleJdbcTemplate().query(sql, internalIDRowMapper, internalId.toString()); 72 73 if (result == null) { 74 return null; 75 } 76 77 if (result.isEmpty()) { 78 return null; 79 } 80 81 return result.get(0); 82 } 83 private final RowMapper<UserIdentifier> internalIDRowMapper = new RowMapper<UserIdentifier>() { 84 @Override 85 public UserIdentifier mapRow(ResultSet rs, int rowNumber) throws SQLException { 86 UserIdentifier result = new UserIdentifier(rs.getString(external_id)); 87 return result; 88 } 89 }; 63 90 } -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/sql/DashishAnnotatorCreate.sql
r3215 r3216 219 219 -- </xs:complexType> 220 220 221 222 223 221 224 CREATE TABLE annotations_principals_permissions ( 222 225 annotation_id integer REFERENCES annotation(annotation_id), … … 225 228 unique(annotation_id, principal_id), 226 229 CHECK(permission_ = 'reader' OR permission_='writer' OR permission_='owner'), 227 -- soundness:owner in this table must be the same as the owner in the annotation table ---228 -- ??? check for any pair (annotation, principal) there must be exactly one row in this table:230 -- 1 soundness: ??? owner in this table must be the same as the owner in the annotation table --- 231 -- 2 soundness ??? check for any pair (annotation, principal) there must be exactly one row in this table: 229 232 -- impossible because of deleting an nnotation: first we have to remove it from this table 230 233 ); 234 231 235 232 236 --------------------------------------------------------------------------------------------- -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/MockObjectsFactory.java
r3205 r3216 20 20 import eu.dasish.annotation.backend.dao.AnnotationDao; 21 21 import eu.dasish.annotation.backend.dao.NotebookDao; 22 import eu.dasish.annotation.backend.dao.PermissionsDao; 22 23 import eu.dasish.annotation.backend.dao.UserDao; 23 24 import org.jmock.Mockery; … … 47 48 return context.mock(UserDao.class); 48 49 } 50 51 public PermissionsDao newPermissionsDao() { 52 return context.mock(PermissionsDao.class); 53 } 49 54 } -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/resources/test-data/InsertTestData.sql
r3215 r3216 157 157 INSERT INTO annotations_principals_permissions (annotation_id, principal_id, permission_) VALUES (5, 4, 'writer'); 158 158 INSERT INTO annotations_principals_permissions (annotation_id, principal_id, permission_) VALUES (5, 5, 'writer'); 159 -- checking integrity control: 160 -- INSERT INTO annotations_principals_permissions (annotation_id, principal_id, permission_) VALUES (5, 5, 'reader');
Note: See TracChangeset
for help on using the changeset viewer.