@Test public void transformTestNotMatchingId() { SingleUserPersistenceRequestTransformer sut = new SingleUserPersistenceRequestTransformer( getPersonIdByAccountIdMapper, relevantKey, false, true); final Long entityId = 10L; final String entityAcctName = "acctName"; final JSONObject jsonReq = new JSONObject(); jsonReq.accumulate("savedBy", entityAcctName); context.checking(new Expectations() { { oneOf(getPersonIdByAccountIdMapper).execute(entityAcctName); will(returnValue(entityId - 1L)); } }); Assert.assertEquals(new Long(0L), sut.transform(jsonReq, entityId)); context.assertIsSatisfied(); }
public Serializable transform(final JSONObject request, final Long userEntityId) { String accountId = request.getString(reqKey); Long requestAccountId = getPersonIdByAccountIdMapper.execute(accountId); if (!requireCurrentUser || userEntityId.equals(requestAccountId)) { if (!returnAsArray) { return requestAccountId; } else { final ArrayList<Long> userList = new ArrayList<Long>(); userList.add(requestAccountId); return userList; } } else { if (log.isDebugEnabled()) { log.debug("User was: " + userEntityId + " Request from: " + requestAccountId); } return 0L; } }
SingleUserPersistenceRequestTransformer implements PersistenceDataSourceRequestTransformer { public Serializable transform(final JSONObject request, final Long userEntityId) { String accountId = request.getString(reqKey); Long requestAccountId = getPersonIdByAccountIdMapper.execute(accountId); if (!requireCurrentUser || userEntityId.equals(requestAccountId)) { if (!returnAsArray) { return requestAccountId; } else { final ArrayList<Long> userList = new ArrayList<Long>(); userList.add(requestAccountId); return userList; } } else { if (log.isDebugEnabled()) { log.debug("User was: " + userEntityId + " Request from: " + requestAccountId); } return 0L; } } }
SingleUserPersistenceRequestTransformer implements PersistenceDataSourceRequestTransformer { public Serializable transform(final JSONObject request, final Long userEntityId) { String accountId = request.getString(reqKey); Long requestAccountId = getPersonIdByAccountIdMapper.execute(accountId); if (!requireCurrentUser || userEntityId.equals(requestAccountId)) { if (!returnAsArray) { return requestAccountId; } else { final ArrayList<Long> userList = new ArrayList<Long>(); userList.add(requestAccountId); return userList; } } else { if (log.isDebugEnabled()) { log.debug("User was: " + userEntityId + " Request from: " + requestAccountId); } return 0L; } } SingleUserPersistenceRequestTransformer(final DomainMapper<String, Long> inGetPersonIdByAccountIdMapper,
            final String inReqKey, final Boolean inReturnAsArray, final Boolean inRequireCurrentUser); }
SingleUserPersistenceRequestTransformer implements PersistenceDataSourceRequestTransformer { public Serializable transform(final JSONObject request, final Long userEntityId) { String accountId = request.getString(reqKey); Long requestAccountId = getPersonIdByAccountIdMapper.execute(accountId); if (!requireCurrentUser || userEntityId.equals(requestAccountId)) { if (!returnAsArray) { return requestAccountId; } else { final ArrayList<Long> userList = new ArrayList<Long>(); userList.add(requestAccountId); return userList; } } else { if (log.isDebugEnabled()) { log.debug("User was: " + userEntityId + " Request from: " + requestAccountId); } return 0L; } } SingleUserPersistenceRequestTransformer(final DomainMapper<String, Long> inGetPersonIdByAccountIdMapper,
            final String inReqKey, final Boolean inReturnAsArray, final Boolean inRequireCurrentUser); Serializable transform(final JSONObject request, final Long userEntityId); }
SingleUserPersistenceRequestTransformer implements PersistenceDataSourceRequestTransformer { public Serializable transform(final JSONObject request, final Long userEntityId) { String accountId = request.getString(reqKey); Long requestAccountId = getPersonIdByAccountIdMapper.execute(accountId); if (!requireCurrentUser || userEntityId.equals(requestAccountId)) { if (!returnAsArray) { return requestAccountId; } else { final ArrayList<Long> userList = new ArrayList<Long>(); userList.add(requestAccountId); return userList; } } else { if (log.isDebugEnabled()) { log.debug("User was: " + userEntityId + " Request from: " + requestAccountId); } return 0L; } } SingleUserPersistenceRequestTransformer(final DomainMapper<String, Long> inGetPersonIdByAccountIdMapper,
            final String inReqKey, final Boolean inReturnAsArray, final Boolean inRequireCurrentUser); Serializable transform(final JSONObject request, final Long userEntityId);  }