public License getLicense(String name) throws RegistryException { for (License l : getLicenses()) if (l.getAbbreviation().equals(name)) return l; return null; }
protected void setLicense(License license) { if (license != null) licenseBox.setToolTipText("<html>" + license.getDescription() + "</html>"); else licenseBox.setToolTipText(null); }
@Override protected String doInBackground() throws Exception { List<License> licenses; if (registry == null) return null; try { licenses = registry.getLicenses(); if (licenses == null) return null; } catch (RegistryException e) { logger.error("failure when reading licenses from registry", e); throw e; } catch (NullPointerException e) { logger.error("unexpected exception when reading licenses", e); throw e; } for (License license : licenses) try { String name = license.getName(); licenseMap.put(name, license); } catch (NullPointerException e) { logger.error("could not get name of license", e); } return null; }
public License getLicense(String name) throws RegistryException { for (License l : getLicenses()) if (l.getAbbreviation().equals(name)) return l; return null; }
licenseBox.setSelectedItem(preferredLicense.getName()); setLicense(preferredLicense); } else {
protected License getLicenseByAbbreviation(String licenseString) throws RegistryException { checkLicenseCache(); for (License l : getLicenses()) if (l.getAbbreviation().equals(licenseString)) return l; return null; }
protected License getLicenseByAbbreviation(String licenseString) throws RegistryException { checkLicenseCache(); for (License l : getLicenses()) if (l.getAbbreviation().equals(licenseString)) return l; return null; }
private String prepareWorkflowPostContent(String dataflow, String title, String description, License license, String permissionsString) throws RegistryException { StringBuilder contentXml = new StringBuilder("<workflow>"); if (title.length() > 0) contentXml.append("<title>").append(title).append("</title>"); if (description.length() > 0) contentXml.append("<description>").append(description) .append("</description>"); if (license != null) contentXml.append("<license-type>") .append(license.getAbbreviation()) .append("</license-type>"); contentXml.append(permissionsString); if (dataflow.length() > 0) { contentXml .append("<content-type>application/vnd.taverna.t2flow+xml</content-type>"); contentXml.append("<content encoding=\"base64\" type=\"binary\">"); try { contentXml.append(printBase64Binary(dataflow.getBytes("UTF-8"))); } catch (UnsupportedEncodingException e) { throw new RegistryException("Unable to encode workflow", e); } contentXml.append("</content>"); } contentXml.append("</workflow>"); return contentXml.toString(); }
private String prepareWorkflowPostContent(String dataflow, String title, String description, License license, String permissionsString) throws RegistryException { StringBuilder contentXml = new StringBuilder("<workflow>"); if (title.length() > 0) contentXml.append("<title>").append(title).append("</title>"); if (description.length() > 0) contentXml.append("<description>").append(description) .append("</description>"); if (license != null) contentXml.append("<license-type>") .append(license.getAbbreviation()) .append("</license-type>"); contentXml.append(permissionsString); if (dataflow.length() > 0) { contentXml .append("<content-type>application/vnd.taverna.t2flow+xml</content-type>"); contentXml.append("<content encoding=\"base64\" type=\"binary\">"); try { contentXml.append(encodeBytes(dataflow.getBytes("UTF-8"))); } catch (UnsupportedEncodingException e) { throw new RegistryException("Unable to encode workflow", e); } contentXml.append("</content>"); } contentXml.append("</workflow>"); return contentXml.toString(); }
if (license != null) { contentXml.append("<license-type>") .append(license.getAbbreviation()) .append("</license-type>");
public Element createPack(String title, String description, License license, String permissionsString) throws RegistryException { StringBuilder contentXml = new StringBuilder("<pack>"); contentXml.append("<description>" + description + "</description>"); contentXml.append("<title>" + title + "</title>"); if (license != null) contentXml.append("<license-type>") .append(license.getAbbreviation()) .append("</license-type>"); contentXml.append(permissionsString); contentXml.append("</pack>"); ServerResponse response; try { response = myExperimentClient.doMyExperimentPOST( getRegistryBaseString() + "/pack.xml", contentXml.toString()); checkResponseCode(response); return response.getResponseBody().getRootElement(); } catch (Exception e) { throw new RegistryException( "Error while creating a pack with title : " + title, e); } }
public Element createPack(String title, String description, License license, String permissionsString) throws RegistryException { StringBuilder contentXml = new StringBuilder("<pack>"); contentXml.append("<description>" + description + "</description>"); contentXml.append("<title>" + title + "</title>"); if (license != null) contentXml.append("<license-type>") .append(license.getAbbreviation()) .append("</license-type>"); contentXml.append(permissionsString); contentXml.append("</pack>"); ServerResponse response; try { response = myExperimentClient.doMyExperimentPOST( getRegistryBaseString() + "/pack.xml", contentXml.toString()); checkResponseCode(response); return response.getResponseBody().getRootElement(); } catch (Exception e) { throw new RegistryException( "Error while creating a pack with title : " + title, e); } }
if (license != null) { contentXml.append("<license-type>") .append(license.getAbbreviation()) .append("</license-type>");
private ComponentFamilyType makeComponentFamilyCreateRequest( NewComponentProfile profile, String familyName, String description, License license, SharingPolicy sharingPolicy) throws RegistryException { ComponentFamilyType familyDoc = new ComponentFamilyType(); familyDoc.setComponentProfile(profile.getResourceLocation()); familyDoc.setDescription(description); familyDoc.setTitle(familyName); if (license == null) license = getPreferredLicense(); familyDoc.setLicenseType(new Description()); familyDoc.getLicenseType().getContent().add(license.getAbbreviation()); familyDoc.setPermissions(getPermissions(sharingPolicy)); return familyDoc; }
private ComponentFamilyType makeComponentFamilyCreateRequest( NewComponentProfile profile, String familyName, String description, License license, SharingPolicy sharingPolicy) throws RegistryException { ComponentFamilyType familyDoc = new ComponentFamilyType(); familyDoc.setComponentProfile(profile.getResourceLocation()); familyDoc.setDescription(description); familyDoc.setTitle(familyName); if (license == null) license = getPreferredLicense(); familyDoc.setLicenseType(new Description()); familyDoc.getLicenseType().getContent().add(license.getAbbreviation()); familyDoc.setPermissions(getPermissions(sharingPolicy)); return familyDoc; }
private ComponentProfileType makeComponentProfileCreateRequest( String title, String description, String content, License license, SharingPolicy sharingPolicy) throws RegistryException { ComponentProfileType profile = new ComponentProfileType(); profile.setFilename(title + ".xml"); profile.setTitle(title); profile.setTitle(description); profile.setContentType(PROFILE_MIME_TYPE); profile.setContent(new Content()); profile.getContent().setEncoding("base64"); profile.getContent().setType("binary"); profile.getContent().setValue(content.getBytes(utf8)); if (license == null) license = getPreferredLicense(); profile.setLicenseType(new Description()); profile.getLicenseType().getContent().add(license.getAbbreviation()); profile.setPermissions(getPermissions(sharingPolicy)); return profile; }
private ComponentProfileType makeComponentProfileCreateRequest( String title, String description, String content, License license, SharingPolicy sharingPolicy) throws RegistryException { ComponentProfileType profile = new ComponentProfileType(); profile.setFilename(title + ".xml"); profile.setTitle(title); profile.setTitle(description); profile.setContentType(PROFILE_MIME_TYPE); profile.setContent(new Content()); profile.getContent().setEncoding("base64"); profile.getContent().setType("binary"); profile.getContent().setValue(content.getBytes(utf8)); if (license == null) license = getPreferredLicense(); profile.setLicenseType(new Description()); profile.getLicenseType().getContent().add(license.getAbbreviation()); profile.setPermissions(getPermissions(sharingPolicy)); return profile; }
private ComponentType makeComponentVersionCreateRequest(String title, String description, Dataflow content, NewComponentFamily family, License license, SharingPolicy sharingPolicy) throws RegistryException { ComponentType comp = new ComponentType(); comp.setTitle(title); comp.setDescription(description); if (family != null) comp.setComponentFamily(family.getResourceLocation()); comp.setContentType(T2FLOW_MIME_TYPE); comp.setContent(new Content()); comp.getContent().setEncoding("base64"); comp.getContent().setType("binary"); comp.getContent().setValue(serializeDataflow(content).getBytes(utf8)); if (license == null) license = getPreferredLicense(); if (license != null) { comp.setLicenseType(new Description()); comp.getLicenseType().getContent().add(license.getAbbreviation()); } comp.setPermissions(getPermissions(sharingPolicy)); return comp; }
private ComponentType makeComponentVersionCreateRequest(String title, String description, Dataflow content, NewComponentFamily family, License license, SharingPolicy sharingPolicy) throws RegistryException { ComponentType comp = new ComponentType(); comp.setTitle(title); comp.setDescription(description); if (family != null) comp.setComponentFamily(family.getResourceLocation()); comp.setContentType(T2FLOW_MIME_TYPE); comp.setContent(new Content()); comp.getContent().setEncoding("base64"); comp.getContent().setType("binary"); comp.getContent().setValue(serializeDataflow(content).getBytes(utf8)); if (license == null) license = getPreferredLicense(); if (license != null) { comp.setLicenseType(new Description()); comp.getLicenseType().getContent().add(license.getAbbreviation()); } comp.setPermissions(getPermissions(sharingPolicy)); return comp; }