public StepPartitioningMeta(Repository rep, long id_step) throws KettleException { this(); partitionSchemaName = rep.getStepAttributeString(id_step, "PARTITIONING_SCHEMA"); String methodCode = rep.getStepAttributeString(id_step, "PARTITIONING_METHOD"); setMethod(getMethod(methodCode)); if (partitioner != null) { partitioner.loadRep(rep, id_step); } hasChanged = true; }
/** * Saves partitioning properties in the repository for the given step. * * @param rep the repository to save in * @param id_transformation the ID of the transformation * @param id_step the ID of the step * @throws KettleDatabaseException In case anything goes wrong */ public void saveRep(Repository rep, long id_transformation, long id_step) throws KettleException { rep.saveStepAttribute( id_transformation, id_step, "PARTITIONING_SCHEMA", partitionSchema != null ? partitionSchema.getName() : ""); // selected schema rep.saveStepAttribute( id_transformation, id_step, "PARTITIONING_METHOD", getMethodCode()); // method of partitioning }
public TransHopMeta(Repository rep, long id_trans_hop, List<StepMeta> steps) throws KettleException { try { setID(id_trans_hop); RowMetaAndData r = rep.getTransHop(id_trans_hop); long id_step_from = r.getInteger("ID_STEP_FROM", 0); // $NON-NLS-1$ long id_step_to = r.getInteger("ID_STEP_TO", 0); // $NON-NLS-1$ enabled = r.getBoolean("ENABLED", false); // $NON-NLS-1$ guiMidLocationX = r.getString("GUI_MID_LOCATION_X", ""); guiMidLocationY = r.getString("GUI_MID_LOCATION_Y", ""); from_step = StepMeta.findStep(steps, id_step_from); if (from_step == null && id_step_from > 0) // Links to a shared // objects, try again by // looking up the // name... { // Simply load this, we only want the name, we don't care about // the rest... StepMeta stepMeta = new StepMeta( rep, id_step_from, new ArrayList<DatabaseMeta>(), new Hashtable<String, Counter>(), new ArrayList<PartitionSchema>()); from_step = StepMeta.findStep(steps, stepMeta.getName()); } from_step.setDraw(true); to_step = StepMeta.findStep(steps, id_step_to); if (to_step == null && id_step_to > 0) // Links to a shared // objects, try again by // looking up the name... { // Simply load this, we only want the name, we don't care about // the rest... StepMeta stepMeta = new StepMeta( rep, id_step_to, new ArrayList<DatabaseMeta>(), new Hashtable<String, Counter>(), new ArrayList<PartitionSchema>()); to_step = StepMeta.findStep(steps, stepMeta.getName()); } to_step.setDraw(true); } catch (KettleDatabaseException dbe) { throw new KettleException( Messages.getString("TransHopMeta.Exception.LoadTransformationHopInfo") + id_trans_hop, dbe); //$NON-NLS-1$ } }
public void readRep( Repository rep, long id_step, List<DatabaseMeta> databases, Map<String, Counter> counters) throws KettleException { try { long id_connection = rep.getStepAttributeInteger(id_step, "id_connection"); // $NON-NLS-1$ databaseMeta = DatabaseMeta.findDatabase(databases, id_connection); rowLimit = (int) rep.getStepAttributeInteger(id_step, "rowlimit"); // $NON-NLS-1$ sql = rep.getStepAttributeString(id_step, "sql"); // $NON-NLS-1$ outerJoin = rep.getStepAttributeBoolean(id_step, "outer_join"); // $NON-NLS-1$ replacevars = rep.getStepAttributeBoolean(id_step, "replace_vars"); sqlfieldname = rep.getStepAttributeString(id_step, "sql_fieldname"); // $NON-NLS-1$ queryonlyonchange = rep.getStepAttributeBoolean(id_step, "query_only_on_change"); // $NON-NLS-1$ } catch (Exception e) { throw new KettleException( Messages.getString("DynamicSQLRowMeta.Exception.UnexpectedErrorReadingStepInfo"), e); //$NON-NLS-1$ } }
public void saveRep(Repository rep, long id_transformation, long id_step) throws KettleException { try { rep.saveStepAttribute(id_transformation, id_step, "rownum", includeRowNumber); rep.saveStepAttribute(id_transformation, id_step, "foldername_dynamic", isFoldernameDynamic); rep.saveStepAttribute(id_transformation, id_step, "foldername_field", dynamicFoldernameField); rep.saveStepAttribute(id_transformation, id_step, "rownum_field", rowNumberField); rep.saveStepAttribute(id_transformation, id_step, "limit", rowLimit); for (int i = 0; i < folderName.length; i++) { rep.saveStepAttribute(id_transformation, id_step, i, "file_name", folderName[i]); rep.saveStepAttribute(id_transformation, id_step, i, "file_required", folderRequired[i]); } } catch (Exception e) { throw new KettleException( "Unable to save step information to the repository for id_step=" + id_step, e); } }
public void readRep( Repository rep, long id_step, List<DatabaseMeta> databases, Map<String, Counter> counters) throws KettleException { try { int nrfiles = rep.countNrStepAttributes(id_step, "file_name"); dynamicFoldernameField = rep.getStepAttributeString(id_step, "foldername_Field"); includeRowNumber = rep.getStepAttributeBoolean(id_step, "rownum"); isFoldernameDynamic = rep.getStepAttributeBoolean(id_step, "foldername_dynamic"); rowNumberField = rep.getStepAttributeString(id_step, "rownum_field"); rowLimit = rep.getStepAttributeInteger(id_step, "limit"); allocate(nrfiles); for (int i = 0; i < nrfiles; i++) { folderName[i] = rep.getStepAttributeString(id_step, i, "file_name"); folderRequired[i] = rep.getStepAttributeString(id_step, i, "file_required"); } } catch (Exception e) { throw new KettleException("Unexpected error reading step information from the repository", e); } }
public void saveRep(Repository rep, long id_transformation, long id_step) throws KettleException { try { rep.saveStepAttribute( id_transformation, id_step, "id_connection", databaseMeta == null ? -1 : databaseMeta.getID()); // $NON-NLS-1$ rep.saveStepAttribute(id_transformation, id_step, "rowlimit", rowLimit); // $NON-NLS-1$ rep.saveStepAttribute(id_transformation, id_step, "sql", sql); // $NON-NLS-1$ rep.saveStepAttribute(id_transformation, id_step, "outer_join", outerJoin); // $NON-NLS-1$ rep.saveStepAttribute(id_transformation, id_step, "replace_vars", replacevars); rep.saveStepAttribute( id_transformation, id_step, "sql_fieldname", sqlfieldname); // $NON-NLS-1$ rep.saveStepAttribute(id_transformation, id_step, "query_only_on_change", queryonlyonchange); // Also, save the step-database relationship! if (databaseMeta != null) rep.insertStepDatabase(id_transformation, id_step, databaseMeta.getID()); } catch (Exception e) { throw new KettleException( Messages.getString("DynamicSQLRowMeta.Exception.UnableToSaveStepInfo") + id_step, e); //$NON-NLS-1$ } }
public void saveRep(Repository rep, long id_transformation) throws KettleException { try { // See if a transformation hop with the same fromstep and tostep is // already available... long id_step_from = from_step == null ? -1 : from_step.getID(); long id_step_to = to_step == null ? -1 : to_step.getID(); // Insert new transMeta hop in repository setID( rep.insertTransHop( id_transformation, id_step_from, id_step_to, enabled, guiMidLocationX, guiMidLocationY)); } catch (KettleDatabaseException dbe) { throw new KettleException( Messages.getString("TransHopMeta.Exception.UnableToSaveTransformationHopInfo") + id_transformation, dbe); //$NON-NLS-1$ } }
public void saveRep(Repository rep, long id_job) throws KettleException { try { long id_jobentry_from = -1, id_jobentry_to = -1; id_jobentry_from = from_entry == null ? -1 : from_entry.getID(); id_jobentry_to = to_entry == null ? -1 : to_entry.getID(); // Insert new transMeta hop in repository setID( rep.insertJobHop( id_job, id_jobentry_from, id_jobentry_to, enabled, evaluation, unconditional, guiMidLocationX, guiMidLocationY)); } catch (KettleDatabaseException dbe) { throw new KettleException( Messages.getString("JobHopMeta.Exception.UnableToSaveHopInfoRep", "" + id_job), dbe); } }
public JobHopMeta(Repository rep, long id_job_hop, JobMeta job, List<JobEntryCopy> jobcopies) throws KettleException { try { long id_jobentry_copy_from; long id_jobentry_copy_to; RowMetaAndData r = rep.getJobHop(id_job_hop); if (r != null) { id_jobentry_copy_from = r.getInteger("ID_JOBENTRY_COPY_FROM", -1L); id_jobentry_copy_to = r.getInteger("ID_JOBENTRY_COPY_TO", -1L); enabled = r.getBoolean("ENABLED", true); evaluation = r.getBoolean("EVALUATION", true); unconditional = r.getBoolean("UNCONDITIONAL", !evaluation); guiMidLocationX = r.getString("GUI_MID_LOCATION_X", ""); guiMidLocationY = r.getString("GUI_MID_LOCATION_Y", ""); from_entry = JobMeta.findJobEntryCopy(jobcopies, id_jobentry_copy_from); to_entry = JobMeta.findJobEntryCopy(jobcopies, id_jobentry_copy_to); } } catch (KettleDatabaseException dbe) { throw new KettleException( Messages.getString("JobHopMeta.Exception.UnableToLoadHopInfoRep", "" + id_job_hop), dbe); } }