Project

General

Profile

« Previous | Next » 

Revision 54764

Implemented ORCID event generation process and relative configuration profile
Added workflow to orchestrate the event generation for software links

View differences:

OafHbaseUtils.java
78 78
		return Lists.newArrayList(Iterables.transform(ts, t -> mapValue(t)));
79 79
	}
80 80

  
81
	public static <T> List<String> listObjects(Iterable<T> ts) {
82
		return Lists.newArrayList(Iterables.transform(ts, t -> mapObject(t)));
83
	}
84

  
81 85
	public static <T> String getKey(Iterable<T> ts) {
82 86
		return Iterables.getFirst(listKeys(ts), "");
83 87
	}
......
98 102
		throw new IllegalArgumentException(String.format("type %s not mapped", t.getClass()));
99 103
	}
100 104

  
101
	private static <T> String mapValue(final T t) {
105
	public static <T> String mapValue(final T t) {
102 106
		if (t instanceof StructuredProperty) return ((StructuredProperty) t).getValue();
103 107
		if (t instanceof KeyValue) return ((KeyValue) t).getValue();
104 108
		if (t instanceof String) return (String) t;
105 109
		if (t instanceof StringField) return ((StringField) t).getValue();
106 110
		if (t instanceof Qualifier) return ((Qualifier) t).getClassname();
107
		if (t instanceof Author) return ((Author) t).getFullname();
111
		if (t instanceof Author) {
112
			Author a = (Author) t;
113
			if (a.getPidCount() == 0) {
114
				return a.getFullname();
115
			} else {
116
				return a.getFullname() + " " + listObjects(a.getPidList());
117
			}
118
		}
108 119

  
109 120
		throw new IllegalArgumentException(String.format("type %s not mapped", t.getClass()));
110 121
	}
111 122

  
123
	public static <T> String mapObject(final T t) {
124
		if (t instanceof KeyValue) {
125
			KeyValue kv = (KeyValue) t;
126
			return kv.getKey() + ":" + kv.getValue();
127
		}
128
		if (t instanceof String) return (String) t;
129

  
130
		throw new IllegalArgumentException(String.format("type %s not mapped", t.getClass()));
131
	}
132

  
112 133
	public static List<String> getPropertyValues(final Reducer.Context context, final String name) {
113 134
		return doGetPropertyValues(context.getConfiguration().get(name, ""));
114 135
	}

Also available in: Unified diff