/** * {@inheritDoc} * * @see org.opencastproject.mediapackage.MediaPackage#getAttachments() */ @XmlElementWrapper(name = "publications") @XmlElement(name = "publication") @Override public Publication[] getPublications() { return mlist(elements).bind(presentations).value().toArray(new Publication[0]); }
@Override public HashMap<EName, List<DublinCoreValue>> apply(HashMap<EName, List<DublinCoreValue>> map, List<CatalogEntry> entries) { if (entries.size() > 0) { final EName property = entries.get(0).getEName(); map.put(property, mlist(entries).map(toDublinCoreValue).value()); } return map; } });
/** Convert a locale into a list of strings, [language, country, variant] */ public static List<String> localeToList(Locale locale) { return mlist(Strings.trimToNone(locale.getLanguage()), Strings.trimToNone(locale.getCountry()), Strings.trimToNone(locale.getVariant())) // flatten .bind(Functions.<Option<String>> identity()).value(); }
/** Create an object. */ public static Obj obj(Prop... ps) { return new Obj(mlist(ps).filter(notZero.o(getVal)).value()); }
@Override public List<B> apply(List<A> as) { return mlist(as).bind(f).value(); } };
public JaxbIncidentDigestTree(IncidentService svc, Locale locale, IncidentTree tree) throws IncidentServiceException, NotFoundException { this.incidents = mlist(tree.getIncidents()).map(JaxbIncidentDigest.mkFn(svc, locale)).value(); this.descendants = mlist(tree.getDescendants()).map(mkFn(svc, locale)).value(); }
public JaxbIncidentFullList(IncidentService svc, Locale locale, List<Incident> incidents) throws IncidentServiceException, NotFoundException { this.incidents = mlist(incidents).map(JaxbIncidentFull.mkFn(svc, locale)).value(); } }
private List<Incident> getIncidentsOfJob(long jobId) throws NotFoundException, IncidentServiceException { final Job job = findJob(jobId); try { return mlist(getPenv().tx(IncidentDto.findByJobId(jobId))).map(toIncident(job)).value(); } catch (Exception e) { logger.error("Could not retrieve incidents of job '{}': {}", job.getId(), e.getMessage()); throw new IncidentServiceException(e); } }
@Override public List<C> apply(A a) { return mlist(m.apply(a)).bind(n).value(); } };
public JaxbIncidentFullTree(IncidentService svc, Locale locale, IncidentTree tree) throws IncidentServiceException, NotFoundException { this.incidents = mlist(tree.getIncidents()).map(JaxbIncidentFull.mkFn(svc, locale)).value(); this.descendants = mlist(tree.getDescendants()).map(mkFn(svc, locale)).value(); }
public JaxbIncidentDigestList(IncidentService svc, Locale locale, List<Incident> incidents) throws IncidentServiceException, NotFoundException { this.incidents = mlist(incidents).map(JaxbIncidentDigest.mkFn(svc, locale)).value(); } }
/** Create a config info string suitable for logging purposes. */ public static String showConfig(Tuple<String, ?>... cfg) { return "Config\n" + Collections.mkString(mlist(cfg).map(new Function<Tuple<String, ?>, String>() { @Override public String apply(Tuple<String, ?> t) { return t.getA() + "=" + t.getB().toString(); } }).value(), "\n"); }
public JaxbIncidentFull(Incident incident, IncidentL10n l10n) { this.id = incident.getId(); this.jobId = incident.getJobId(); this.serviceType = incident.getServiceType(); this.title = l10n.getTitle(); this.processingHost = incident.getProcessingHost(); this.date = incident.getTimestamp(); this.severity = incident.getSeverity().name(); this.code = incident.getCode(); this.details = mlist(incident.getDetails()).map(JaxbIncidentDetail.mkFn).value(); this.description = l10n.getDescription(); }
@Override public List<B> apply(A[] as) { return Monadics.mlist(as).bind(f).value(); } };
@Override public List<DublinCoreValue> get(EName property) { RequireUtil.notNull(property, "property"); return mlist(getValuesAsList(property)).map(toDublinCoreValue).value(); }
/** Create a list of access control entries for a given role. */ public static Either<AccessControlEntry, List<AccessControlEntry>> entries(final String role, Tuple<String, Boolean>... actions) { final List<AccessControlEntry> entries = mlist(actions).map( new Function<Tuple<String, Boolean>, AccessControlEntry>() { @Override public AccessControlEntry apply(Tuple<String, Boolean> action) { return new AccessControlEntry(role, action.getA(), action.getB()); } }).value(); return right(entries); }
@Override public List<B> apply(List<A> as) { return mlist(as).fmap(f).value(); } };
public Incident toIncident() { return new IncidentImpl(id, jobId, serviceType, processingHost, timestamp, severity, code, mlist(nullToNil(details)).map(JaxbIncidentDetail.toDetailFn).value(), mlist( nullToNil(descriptionParameters)).foldl(new HashMap<>(), new Function2<Map<String, String>, Param, Map<String, String>>() { @Override public Map<String, String> apply(Map<String, String> sum, Param param) { sum.put(param.getName(), param.getValue()); return sum; } })); }
public JaxbIncident(Incident incident) { this.id = incident.getId(); this.jobId = incident.getJobId(); this.serviceType = incident.getServiceType(); this.processingHost = incident.getProcessingHost(); this.timestamp = new Date(incident.getTimestamp().getTime()); this.severity = incident.getSeverity(); this.code = incident.getCode(); this.descriptionParameters = mlist(incident.getDescriptionParameters().entrySet()).map(Param.mkFn).value(); this.details = mlist(incident.getDetails()).map(JaxbIncidentDetail.mkFn).value(); }