Package com.opengamma.master.user

Examples of com.opengamma.master.user.ManageableOGUser$Meta


    _version1Instant = now.minusSeconds(100);
    _version2Instant = now.minusSeconds(50);
    s_logger.debug("test data now:   {}", _version1Instant);
    s_logger.debug("test data later: {}", _version2Instant);
    final JdbcOperations template = _usrMaster.getDbConnector().getJdbcOperations();
    ManageableOGUser user = new ManageableOGUser("101");
    user.setUniqueId(UniqueId.of("DbUsr", "101", "0"));
    user.setExternalIdBundle(ExternalIdBundle.of(ExternalId.of("A", "B"), ExternalId.of("C", "D"), ExternalId.of("E", "F")));
    user.setUserId("Test101");
    user.setName("TestUser101");
    user.setTimeZone(ZoneId.of("Europe/London"));
    template.update("INSERT INTO usr_oguser VALUES (?,?,?,?,?, ?,?,?,?,?, ?)",
        101, 101, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP,
        "Test101", "PW", "TestUser101", "Europe/London", "email101@email.com");
    user.setUniqueId(UniqueId.of("DbUsr", "102", "0"));
    user.setExternalIdBundle(ExternalIdBundle.of(ExternalId.of("A", "B"), ExternalId.of("C", "D"), ExternalId.of("G", "H")));
    user.setUserId("Test102");
    user.setName("TestUser102");
    user.setTimeZone(ZoneId.of("Europe/Paris"));
    template.update("INSERT INTO usr_oguser VALUES (?,?,?,?,?, ?,?,?,?,?, ?)",
        102, 102, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP,
        "Test102", "PW", "TestUser102", "Europe/Paris", "email102@email.com");
    user.setUniqueId(UniqueId.of("DbUsr", "201", "0"));
    user.setExternalIdBundle(ExternalIdBundle.of(ExternalId.of("C", "D"), ExternalId.of("E", "F")));
    user.setUserId("Test201");
    user.setName("TestUser201");
    user.setTimeZone(ZoneId.of("Asia/Tokyo"));
    template.update("INSERT INTO usr_oguser VALUES (?,?,?,?,?, ?,?,?,?,?, ?)",
        201, 201, toSqlTimestamp(_version1Instant), toSqlTimestamp(_version2Instant), toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP,
        "Test201", "PW", "TestUser201", "Asia/Tokyo", "email201@email.com");
    user.setUniqueId(UniqueId.of("DbUsr", "201", "1"));
    user.setExternalIdBundle(ExternalIdBundle.of(ExternalId.of("C", "D"), ExternalId.of("E", "F")));
    user.setUserId("Test202");
    user.setName("TestUser202");
    user.setTimeZone(ZoneId.of("Asia/Tokyo"));
    template.update("INSERT INTO usr_oguser VALUES (?,?,?,?,?, ?,?,?,?,?, ?)",
        202, 201, toSqlTimestamp(_version2Instant), MAX_SQL_TIMESTAMP, toSqlTimestamp(_version2Instant), MAX_SQL_TIMESTAMP,
        "Test202", "PW", "TestUser202", "Asia/Tokyo", "email202@email.com");
    _totalUsers = 3;
//  id bigint not null,
View Full Code Here


    assertEquals(uniqueId, test.getUniqueId());
    assertEquals(_version1Instant, test.getVersionFromInstant());
    assertEquals(null, test.getVersionToInstant());
    assertEquals(_version1Instant, test.getCorrectionFromInstant());
    assertEquals(null, test.getCorrectionToInstant());
    ManageableOGUser user = test.getUser();
    assertNotNull(user);
    assertEquals(uniqueId, user.getUniqueId());
    assertEquals("Test101", test.getUser().getUserId());
    assertEquals("TestUser101", test.getName());
    assertEquals(ZoneId.of("Europe/London"), user.getTimeZone());
    assertEquals("email101@email.com", user.getEmailAddress());
    assertEquals(ExternalIdBundle.of(ExternalId.of("A", "B"), ExternalId.of("C", "D"), ExternalId.of("E", "F")), user.getExternalIdBundle());
  }
View Full Code Here

    assertEquals(uniqueId, test.getUniqueId());
    assertEquals(_version1Instant, test.getVersionFromInstant());
    assertEquals(null, test.getVersionToInstant());
    assertEquals(_version1Instant, test.getCorrectionFromInstant());
    assertEquals(null, test.getCorrectionToInstant());
    ManageableOGUser user = test.getUser();
    assertNotNull(user);
    assertEquals(uniqueId, user.getUniqueId());
    assertEquals("Test102", test.getUser().getUserId());
    assertEquals("TestUser102", test.getName());
    assertEquals(ZoneId.of("Europe/Paris"), user.getTimeZone());
    assertEquals("email102@email.com", user.getEmailAddress());
    assertEquals(ExternalIdBundle.of(ExternalId.of("A", "B"), ExternalId.of("C", "D"), ExternalId.of("G", "H")), user.getExternalIdBundle());
  }
View Full Code Here

    assertEquals(uniqueId, test.getUniqueId());
    assertEquals(_version1Instant, test.getVersionFromInstant());
    assertEquals(_version2Instant, test.getVersionToInstant());
    assertEquals(_version1Instant, test.getCorrectionFromInstant());
    assertEquals(null, test.getCorrectionToInstant());
    ManageableOGUser user = test.getUser();
    assertNotNull(user);
    assertEquals(uniqueId, user.getUniqueId());
    assertEquals("Test201", test.getUser().getUserId());
    assertEquals("TestUser201", test.getName());
    assertEquals(ZoneId.of("Asia/Tokyo"), user.getTimeZone());
    assertEquals("email201@email.com", user.getEmailAddress());
    assertEquals(ExternalIdBundle.of(ExternalId.of("C", "D"), ExternalId.of("E", "F")), user.getExternalIdBundle());
  }
View Full Code Here

    assertEquals(uniqueId, test.getUniqueId());
    assertEquals(_version2Instant, test.getVersionFromInstant());
    assertEquals(null, test.getVersionToInstant());
    assertEquals(_version2Instant, test.getCorrectionFromInstant());
    assertEquals(null, test.getCorrectionToInstant());
    ManageableOGUser user = test.getUser();
    assertNotNull(user);
    assertEquals(uniqueId, user.getUniqueId());
    assertEquals("Test202", test.getUser().getUserId());
    assertEquals("TestUser202", test.getName());
    assertEquals(ZoneId.of("Asia/Tokyo"), user.getTimeZone());
    assertEquals("email202@email.com", user.getEmailAddress());
    assertEquals(ExternalIdBundle.of(ExternalId.of("C", "D"), ExternalId.of("E", "F")), user.getExternalIdBundle());
  }
View Full Code Here

    ArgumentChecker.notNull(document.getUser().getTimeZone(), "document.user.timezone");

    final long docId = nextId("usr_oguser_seq");
    final long docOid = (document.getUniqueId() != null ? extractOid(document.getUniqueId()) : docId);
    final UniqueId uniqueId = createUniqueId(docOid, docId);
    final ManageableOGUser user = document.getUser();
    user.setUniqueId(uniqueId);
    document.setUniqueId(uniqueId);
   
    // the arguments for inserting into the user table
    final DbMapSqlParameterSource docArgs = new DbMapSqlParameterSource()
      .addValue("doc_id", docId)
      .addValue("doc_oid", docOid)
      .addTimestamp("ver_from_instant", document.getVersionFromInstant())
      .addTimestampNullFuture("ver_to_instant", document.getVersionToInstant())
      .addTimestamp("corr_from_instant", document.getCorrectionFromInstant())
      .addTimestampNullFuture("corr_to_instant", document.getCorrectionToInstant())
      .addValue("userid", user.getUserId())
      .addValue("password", user.getPasswordHash())
      .addValue("name", user.getName())
      .addValue("time_zone", user.getTimeZone().getId())
      .addValue("email_address", user.getEmailAddress());
   
    // the arguments for inserting into the idkey tables
    final List<DbMapSqlParameterSource> assocList = new ArrayList<DbMapSqlParameterSource>();
    final List<DbMapSqlParameterSource> idKeyList = new ArrayList<DbMapSqlParameterSource>();
    final String sqlSelectIdKey = getElSqlBundle().getSql("SelectIdKey");
    for (ExternalId id : user.getExternalIdBundle()) {
      final DbMapSqlParameterSource assocArgs = new DbMapSqlParameterSource()
        .addValue("doc_id", docId)
        .addValue("key_scheme", id.getScheme().getName())
        .addValue("key_value", id.getValue());
      assocList.add(assocArgs);
      if (getJdbcTemplate().queryForList(sqlSelectIdKey, assocArgs).isEmpty()) {
        // select avoids creating unecessary id, but id may still not be used
        final long idKeyId = nextId("usr_idkey_seq");
        final DbMapSqlParameterSource idkeyArgs = new DbMapSqlParameterSource()
          .addValue("idkey_id", idKeyId)
          .addValue("key_scheme", id.getScheme().getName())
          .addValue("key_value", id.getValue());
        idKeyList.add(idkeyArgs);
      }
    }
   
    final List<DbMapSqlParameterSource> entitlementList = new ArrayList<DbMapSqlParameterSource>();
    int iEntitlement = 0;
    for (String entitlement : user.getEntitlements()) {
      entitlementList.add(new DbMapSqlParameterSource()
        .addValue("oguser_id", docId)
        .addValue("entitlement_index", iEntitlement)
        .addValue("entitlement_pattern", entitlement));
      iEntitlement++;
View Full Code Here

      final Timestamp correctionFrom = rs.getTimestamp("CORR_FROM_INSTANT");
      final Timestamp correctionTo = rs.getTimestamp("CORR_TO_INSTANT");
     
      UniqueId uniqueId = createUniqueId(docOid, docId);
     
      ManageableOGUser user = new ManageableOGUser(rs.getString("USERID"));
      user.setPasswordHash(rs.getString("PASSWORD"));
      user.setName(rs.getString("NAME"));
      user.setTimeZone(ZoneId.of(rs.getString("TIME_ZONE")));
      user.setEmailAddress(rs.getString("EMAIL_ADDRESS"));
      user.setUniqueId(uniqueId);
      _currUser = user;
     
      UserDocument doc = new UserDocument();
      doc.setUniqueId(uniqueId);
      doc.setVersionFromInstant(DbDateUtils.fromSqlTimestamp(versionFrom));
View Full Code Here

  private UserDocument addedDoc;

  @BeforeMethod
  public void setUp() {
    master = new InMemoryUserMaster();
    ManageableOGUser inputUser = new ManageableOGUser("testuser");
    inputUser.setExternalIdBundle(BUNDLE_FULL);
    UserDocument inputDoc = new UserDocument(inputUser);
    addedDoc = master.add(inputDoc);
  }
View Full Code Here

    ArgumentChecker.notNull(document, "document");
    ArgumentChecker.notNull(document.getUser(), "document.user");
   
    final ObjectId objectId = _objectIdSupplier.get();
    final UniqueId uniqueId = objectId.atVersion("");
    final ManageableOGUser user = document.getUser().clone();
    user.setUniqueId(uniqueId);
    document.setUniqueId(uniqueId);
    final Instant now = Instant.now();
    final UserDocument doc = new UserDocument(user);
    doc.setVersionFromInstant(now);
    doc.setCorrectionFromInstant(now);
View Full Code Here

TOP

Related Classes of com.opengamma.master.user.ManageableOGUser$Meta

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.