use of au.org.ala.spatial.composer.input.UploadSpeciesController in project spatial-portal by AtlasOfLivingAustralia.
the class ToolComposer method onUpload$fileUpload.
public void onUpload$fileUpload(Event event) {
UploadEvent ue = null;
UserDataDTO ud = null;
if (event instanceof UploadEvent) {
ue = (UploadEvent) event;
} else if (event instanceof ForwardEvent) {
ue = (UploadEvent) ((ForwardEvent) event).getOrigin();
}
Media m = ue.getMedia();
if (ud == null) {
ud = new UserDataDTO(m.getName());
}
if (ud.getName().trim().isEmpty()) {
ud.setName(m.getName());
}
ud.setFilename(m.getName());
if (ud.getName() == null || ud.getName().length() == 0) {
ud.setName(m.getName());
}
if (ud.getDescription() == null || ud.getDescription().length() == 0) {
ud.setDescription(m.getName());
}
ud.setUploadedTimeInMs(System.currentTimeMillis());
UploadSpeciesController usc = (UploadSpeciesController) Executions.createComponents("WEB-INF/zul/input/UploadSpecies.zul", this, null);
usc.setAddToMap(false);
if (rgSpeciesBk != null) {
if (rgSpeciesBk.getSelectedItem() == rSpeciesUploadLSIDBk) {
usc.setUploadType(StringConstants.ASSEMBLAGE_BK);
} else if (rgSpeciesBk.getSelectedItem() == rSpeciesUploadSpeciesBk) {
usc.setUploadType("bk");
}
}
usc.setVisible(false);
usc.doOverlapped();
usc.doFileUpload(ud, event);
usc.detach();
}
use of au.org.ala.spatial.composer.input.UploadSpeciesController in project spatial-portal by AtlasOfLivingAustralia.
the class ToolComposer method onClick$btnUpload.
public void onClick$btnUpload(Event event) {
try {
LOGGER.debug("onClick$btnUpload(Event event)");
if (StringUtils.isNotEmpty((String) CommonData.getSettings().getProperty("sandbox.url", null)) && CommonData.getSettings().getProperty("import.points.layers-service", "false").equals("false")) {
SandboxPasteController spc = (SandboxPasteController) Executions.createComponents("WEB-INF/zul/sandbox/SandboxPaste.zul", getMapComposer(), null);
spc.setAddToMap(true);
spc.setParent(getMapComposer());
spc.doModal();
} else {
UploadSpeciesController usc = (UploadSpeciesController) Executions.createComponents("WEB-INF/zul/input/UploadSpecies.zul", this, null);
if (rSpeciesUploadSpecies.isSelected()) {
usc.setTbInstructions("3. Select file (comma separated ID (text), longitude (decimal degrees), latitude(decimal degrees))");
} else if (rSpeciesUploadLSID.isSelected()) {
usc.setTbInstructions("3. Select file (text file, one LSID or name per line)");
} else {
usc.setTbInstructions("3. Select file");
}
usc.setAddToMap(true);
usc.setParent(this);
usc.doModal();
}
} catch (Exception e) {
LOGGER.error("file upload error", e);
}
}
use of au.org.ala.spatial.composer.input.UploadSpeciesController in project spatial-portal by AtlasOfLivingAustralia.
the class AddSpeciesController method onClick$btnUpload.
public void onClick$btnUpload(Event event) {
try {
if (StringUtils.isNotEmpty((String) CommonData.getSettings().getProperty("sandbox.url", null)) && CommonData.getSettings().getProperty("import.points.layers-service", "false").equals("false")) {
SandboxPasteController spc = (SandboxPasteController) Executions.createComponents("WEB-INF/zul/sandbox/SandboxPaste.zul", getMapComposer(), null);
spc.setAddToMap(true);
spc.setParent(getMapComposer());
spc.doModal();
} else {
UploadSpeciesController usc = (UploadSpeciesController) Executions.createComponents("WEB-INF/zul/input/UploadSpecies.zul", getMapComposer(), null);
if (rUploadCoordinates.isSelected()) {
usc.setTbInstructions(CommonData.lang("instruction_upload_species_csv"));
} else if (rUploadLSIDs.isSelected()) {
usc.setTbInstructions(CommonData.lang("instruction_upload_species_lsids"));
} else {
usc.setTbInstructions(CommonData.lang("instruction_upload_species_other"));
}
usc.setAddToMap(true);
usc.setDefineArea(chkArea.isChecked());
usc.setParent(getMapComposer());
usc.doModal();
}
} catch (Exception e) {
LOGGER.error("error displaying uploadspecies.zul", e);
}
}
Aggregations