public List<Stage> createStages(PipelineConfiguration pipelineConfig) { List<Stage> stages = new ArrayList<Stage>(); for (Map<String, Object> stageConfig : pipelineConfig) { String jarId = (String) stageConfig.get(JAR_ID); String stageName = (String) stageConfig.get(STAGE_NAME); DatabaseFile df = new DatabaseFile(); df.setId(jarId); Stage s = new Stage(stageName, df); s.setProperties(stageConfig); s.setMode(Stage.Mode.ACTIVE); stages.add(s); } return stages; } }
@SuppressWarnings("unchecked") private Stage getStage(DBObject dbo) { Stage stage = new Stage((String)dbo.get(STAGE_KEY), getFile(dbo.get(FILE_KEY))); DBObject props = (DBObject) dbo.get(PROPERTIES_KEY); stage.setMode(Mode.valueOf((String)dbo.get(ACTIVE_KEY))); stage.setPropertiesModifiedDate((Date)props.get(PROPERTIES_DATE_SUBKEY)); DBObject properties = (DBObject) props.get(PROPERTIES_MAP_SUBKEY); HashMap<String, Object> map = new HashMap<String, Object>(); if(properties!=null) { map.putAll(properties.toMap()); } stage.setProperties(map); return stage; }