Java Code Examples for org.apache.sqoop.model.MLink#setCreationDate()

The following examples show how to use org.apache.sqoop.model.MLink#setCreationDate() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LinkBean.java    From sqoop-on-spark with Apache License 2.0 5 votes vote down vote up
private MLink restoreLink(Object obj) {
  JSONObject object = (JSONObject) obj;
  long connectorId = (Long) object.get(CONNECTOR_ID);
  JSONArray connectorLinkConfig = (JSONArray) object.get(LINK_CONFIG_VALUES);
  List<MConfig> linkConfig = restoreConfigList(connectorLinkConfig);
  MLink link = new MLink(connectorId, new MLinkConfig(linkConfig));
  link.setPersistenceId((Long) object.get(ID));
  link.setName((String) object.get(NAME));
  link.setEnabled((Boolean) object.get(ENABLED));
  link.setCreationUser((String) object.get(CREATION_USER));
  link.setCreationDate(new Date((Long) object.get(CREATION_DATE)));
  link.setLastUpdateUser((String) object.get(UPDATE_USER));
  link.setLastUpdateDate(new Date((Long) object.get(UPDATE_DATE)));
  return link;
}
 
Example 2
Source File: BeanTestUtil.java    From sqoop-on-spark with Apache License 2.0 5 votes vote down vote up
public static MLink createLink(String connectorName, String linkName, Long linkId, Date created,
    Date updated) {
  MLink link1 = getLink(connectorName);
  link1.setName(linkName);
  link1.setPersistenceId(linkId);
  link1.setCreationUser("admin");
  link1.setCreationDate(created);
  link1.setLastUpdateUser("user");
  link1.setLastUpdateDate(updated);
  link1.setEnabled(false);
  return link1;
}
 
Example 3
Source File: CommonRepositoryHandler.java    From sqoop-on-spark with Apache License 2.0 4 votes vote down vote up
private List<MLink> loadLinks(PreparedStatement stmt,
                              Connection conn)
    throws SQLException {
  List<MLink> links = new ArrayList<MLink>();
  ResultSet rsConnection = null;
  PreparedStatement connectorConfigFetchStatement = null;
  PreparedStatement connectorConfigInputStatement = null;

  try {
    rsConnection = stmt.executeQuery();

    connectorConfigFetchStatement = conn.prepareStatement(crudQueries.getStmtSelectConfigForConfigurable());
    connectorConfigInputStatement = conn.prepareStatement(crudQueries.getStmtFetchLinkInput());

    while(rsConnection.next()) {
      long id = rsConnection.getLong(1);
      String name = rsConnection.getString(2);
      long connectorId = rsConnection.getLong(3);
      boolean enabled = rsConnection.getBoolean(4);
      String creationUser = rsConnection.getString(5);
      Date creationDate = rsConnection.getTimestamp(6);
      String updateUser = rsConnection.getString(7);
      Date lastUpdateDate = rsConnection.getTimestamp(8);

      connectorConfigFetchStatement.setLong(1, connectorId);
      connectorConfigInputStatement.setLong(1, id);
      connectorConfigInputStatement.setLong(3, id);

      List<MConfig> connectorLinkConfig = new ArrayList<MConfig>();
      List<MConfig> fromConfig = new ArrayList<MConfig>();
      List<MConfig> toConfig = new ArrayList<MConfig>();

      loadConnectorConfigs(connectorLinkConfig, fromConfig, toConfig, connectorConfigFetchStatement,
          connectorConfigInputStatement, 2, conn);
      MLink link = new MLink(connectorId, new MLinkConfig(connectorLinkConfig));

      link.setPersistenceId(id);
      link.setName(name);
      link.setCreationUser(creationUser);
      link.setCreationDate(creationDate);
      link.setLastUpdateUser(updateUser);
      link.setLastUpdateDate(lastUpdateDate);
      link.setEnabled(enabled);

      links.add(link);
    }
  } finally {
    closeResultSets(rsConnection);
    closeStatements(connectorConfigFetchStatement, connectorConfigInputStatement);
  }

  return links;
}