public String getCluster() { return (String)getInfo().get(CLUSTER_INFO_KEY); }
public void setCluster(String cluster) { addInfo(CLUSTER_INFO_KEY, cluster); }
String flowName = rowKey.getFlowName(); FlowActivityEntity flowActivity = new FlowActivityEntity( getContext().getClusterId(), time, user, flowName); flowActivity.setId(flowActivity.getId()); flowActivity.addFlowRun(flowRun); flowActivity.getInfo().put(TimelineReaderUtils.FROMID_KEY, rowKey.getRowKeyAsString()); return flowActivity;
@XmlElement(name = "id") @Override public String getId() { // flow activity: cluster/day/user@flow_name String id = super.getId(); if (id == null) { StringBuilder sb = new StringBuilder(); sb.append(getCluster()); sb.append('/'); sb.append(getDate().getTime()); sb.append('/'); sb.append(getUser()); sb.append('@'); sb.append(getFlowName()); id = sb.toString(); setId(id); } return id; }
@Override public int compareTo(TimelineEntity entity) { int comparison = getType().compareTo(entity.getType()); if (comparison == 0) { // order by cluster, date (descending), user, and flow name FlowActivityEntity other = (FlowActivityEntity)entity; int clusterComparison = getCluster().compareTo(other.getCluster()); if (clusterComparison != 0) { return clusterComparison; } int dateComparisonDescending = (int)(other.getDate().getTime() - getDate().getTime()); // descending if (dateComparisonDescending != 0) { return dateComparisonDescending; // descending } int userComparison = getUser().compareTo(other.getUser()); if (userComparison != 0) { return userComparison; } return getFlowName().compareTo(other.getFlowName()); } else { return comparison; } }
public FlowActivityEntity(TimelineEntity entity) { super(entity); if (!TimelineEntityType.YARN_FLOW_ACTIVITY.matches(entity.getType())) { throw new IllegalArgumentException("Incompatible entity type: " + getId()); } // set config to null setConfigs(null); }
public String getFlowName() { return (String)getInfo().get(FLOW_NAME_INFO_KEY); }
public void setUser(String user) { addInfo(USER_INFO_KEY, user); }
public String getUser() { return (String)getInfo().get(USER_INFO_KEY); }
public void setFlowName(String flowName) { addInfo(FLOW_NAME_INFO_KEY, flowName); }
public Date getDate() { Object date = getInfo().get(DATE_INFO_KEY); if (date != null) { if (date instanceof Long) { return new Date((Long)date); } else if (date instanceof Date) { return (Date)date; } } return null; }
public void setDate(long time) { Date date = new Date(time); addInfo(DATE_INFO_KEY, date); }