Search in sources :

Example 6 with HaleConnectProjectInfo

use of eu.esdihumboldt.hale.io.haleconnect.HaleConnectProjectInfo in project hale by halestudio.

the class ChooseHaleConnectProjectWizardPage method updateConfiguration.

/**
 * @see eu.esdihumboldt.hale.ui.util.wizard.ConfigurationWizardPage#updateConfiguration(java.lang.Object)
 */
@Override
public boolean updateConfiguration(HaleConnectProjectConfig configuration) {
    if (projects.getSelection().isEmpty()) {
        return false;
    }
    StructuredSelection selection = (StructuredSelection) projects.getSelection();
    if (!(selection.getFirstElement() instanceof HaleConnectProjectInfo)) {
        return false;
    }
    HaleConnectProjectInfo pi = (HaleConnectProjectInfo) selection.getFirstElement();
    configuration.setProjectId(pi.getId());
    configuration.setProjectName(pi.getName());
    configuration.setOwner(pi.getOwner());
    configuration.setLastModified(pi.getLastModified());
    return true;
}
Also used : StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) HaleConnectProjectInfo(eu.esdihumboldt.hale.io.haleconnect.HaleConnectProjectInfo)

Example 7 with HaleConnectProjectInfo

use of eu.esdihumboldt.hale.io.haleconnect.HaleConnectProjectInfo in project hale by halestudio.

the class HaleConnectServiceImpl method processBucketDetail.

@SuppressWarnings("unchecked")
private HaleConnectProjectInfo processBucketDetail(BucketDetail bucket) {
    String author = null;
    Long lastModified = bucket.getLastModified();
    if (bucket.getProperties() instanceof Map<?, ?>) {
        Map<Object, Object> properties = (Map<Object, Object>) bucket.getProperties();
        if (properties.containsKey("author")) {
            author = properties.get("author").toString();
        }
    }
    HaleConnectUserInfo user = null;
    HaleConnectOrganisationInfo org = null;
    try {
        if (!StringUtils.isEmpty(bucket.getId().getUserId())) {
            user = this.getUserInfo(bucket.getId().getUserId());
        }
        if (!StringUtils.isEmpty(bucket.getId().getOrgId())) {
            org = this.getOrganisationInfo(bucket.getId().getOrgId());
        }
    } catch (HaleConnectException e) {
        log.error(e.getMessage(), e);
    }
    return new HaleConnectProjectInfo(bucket.getId().getTransformationproject(), user, org, bucket.getName(), author, lastModified);
}
Also used : HaleConnectOrganisationInfo(eu.esdihumboldt.hale.io.haleconnect.HaleConnectOrganisationInfo) AtomicLong(java.util.concurrent.atomic.AtomicLong) HaleConnectUserInfo(eu.esdihumboldt.hale.io.haleconnect.HaleConnectUserInfo) HaleConnectException(eu.esdihumboldt.hale.io.haleconnect.HaleConnectException) HaleConnectProjectInfo(eu.esdihumboldt.hale.io.haleconnect.HaleConnectProjectInfo) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap)

Aggregations

HaleConnectProjectInfo (eu.esdihumboldt.hale.io.haleconnect.HaleConnectProjectInfo)7 HaleConnectException (eu.esdihumboldt.hale.io.haleconnect.HaleConnectException)4 Owner (eu.esdihumboldt.hale.io.haleconnect.Owner)3 URI (java.net.URI)3 HaleConnectUserInfo (eu.esdihumboldt.hale.io.haleconnect.HaleConnectUserInfo)2 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)2 IOProviderConfigurationException (eu.esdihumboldt.hale.common.core.io.IOProviderConfigurationException)1 ProjectInfoService (eu.esdihumboldt.hale.common.core.io.project.ProjectInfoService)1 Project (eu.esdihumboldt.hale.common.core.io.project.model.Project)1 IOReport (eu.esdihumboldt.hale.common.core.io.report.IOReport)1 MutableTargetIOReport (eu.esdihumboldt.hale.common.core.io.report.MutableTargetIOReport)1 LocatableURI (eu.esdihumboldt.hale.common.core.io.supplier.LocatableURI)1 NoStreamOutputSupplier (eu.esdihumboldt.hale.common.core.io.supplier.NoStreamOutputSupplier)1 HaleConnectInputSupplier (eu.esdihumboldt.hale.io.haleconnect.HaleConnectInputSupplier)1 HaleConnectOrganisationInfo (eu.esdihumboldt.hale.io.haleconnect.HaleConnectOrganisationInfo)1 OwnerType (eu.esdihumboldt.hale.io.haleconnect.OwnerType)1 File (java.io.File)1 FileOutputStream (java.io.FileOutputStream)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1