Java Code Examples for com.smartgwt.client.data.Record#setAttribute()
The following examples show how to use
com.smartgwt.client.data.Record#setAttribute() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DigitalObjectAdministrationEditor.java From proarc with GNU General Public License v3.0 | 6 votes |
private void saveBatchEditor() { DynamicForm form = getBatchEditor().getForm(); String device = form.getValueAsString(DigitalObjectAdministrationDataSource.FIELD_DEVICE); String[] pids = DigitalObject.toPidArray(digitalObjects); Record update = new Record(); update.setAttribute(DigitalObjectAdministrationDataSource.FIELD_PID, pids); String batchId = digitalObjects[0].getBatchId(); if (batchId != null) { update.setAttribute(DigitalObjectResourceApi.ATM_ITEM_BATCHID, batchId); } update.setAttribute(DigitalObjectAdministrationDataSource.FIELD_DEVICE, device); DigitalObjectAdministrationDataSource.getInstance().updateData(update, new DSCallback() { @Override public void execute(DSResponse response, Object rawData, DSRequest request) { if (RestConfig.isStatusOk(response)) { StatusView.getInstance().show(i18n.SaveAction_Done_Msg()); } } }); }
Example 2
Source File: CejshExportAction.java From proarc with GNU General Public License v3.0 | 6 votes |
private void askForExportOptions(String[] pids) { if (pids == null || pids.length == 0) { return ; } Record export = new Record(); export.setAttribute(ExportResourceApi.CEJSH_PID_PARAM, pids); // ExportOptionsWidget.showOptions(export, new Callback<Record, Void>() { // // @Override // public void onFailure(Void reason) { // // no-op // } // // @Override // public void onSuccess(Record result) { // exportOrValidate(result); // } // }); exportOrValidate(export); }
Example 3
Source File: ArchiveExportAction.java From proarc with GNU General Public License v3.0 | 6 votes |
private void askForExportOptions(String[] pids) { if (pids == null || pids.length == 0) { return ; } Record export = new Record(); export.setAttribute(ExportResourceApi.ARCHIVE_PID_PARAM, pids); // ExportOptionsWidget.showOptions(export, new Callback<Record, Void>() { // // @Override // public void onFailure(Void reason) { // // no-op // } // // @Override // public void onSuccess(Record result) { // exportOrValidate(result); // } // }); exportOrValidate(export); }
Example 4
Source File: DesaExportAction.java From proarc with GNU General Public License v3.0 | 6 votes |
private void askForExportOptions(String[] pids) { if (pids == null || pids.length == 0) { return ; } Record export = new Record(); export.setAttribute(ExportResourceApi.DESA_PID_PARAM, pids); ExportOptionsWidget.showOptions(export, new Callback<Record, Void>() { @Override public void onFailure(Void reason) { // no-op } @Override public void onSuccess(Record result) { exportOrValidate(result); } }); }
Example 5
Source File: ImportTreeDataSource.java From proarc with GNU General Public License v3.0 | 6 votes |
@Override protected void transformResponse(DSResponse response, DSRequest request, Object data) { if (RestConfig.isStatusOk(response)) { for (Record record : response.getData()) { String path = record.getAttribute(FIELD_PATH); RegExp pathRegExp = RegExp.compile("(.*/)?(.*)/$"); MatchResult mr = pathRegExp.exec(path); String parent = mr.getGroup(1); String name = mr.getGroup(2); // System.out.println("## ITRDS.path: " + path); // System.out.println("## ITRDS.parent: " + parent); // System.out.println("## ITRDS.name: " + name); record.setAttribute(FIELD_NAME, name); record.setAttribute(FIELD_PARENT, parent); } } super.transformResponse(response, request, data); }
Example 6
Source File: RepeatableFormItem.java From proarc with GNU General Public License v3.0 | 6 votes |
/** * Replace string values of record attributes with types declared by item children. * This is necessary as declarative forms do not use DataSource stuff. * @param record record to scan for attributes * @param item item with possible profile * @return resolved record */ private static Record resolveRecordValues(Record record, FormItem item) { Field f = getProfile(item); if (f != null) { for (Field field : f.getFields()) { String fType = field.getType(); if ("date".equals(fType) || "datetime".equals(fType)) { // parses ISO dateTime to Date; otherwise DateItem cannot recognize the value! Object value = record.getAttributeAsObject(field.getName()); if (!(value instanceof String)) { continue; } String sd = (String) value; // ClientUtils.severe(LOG, "name: %s, is date, %s", field.getName(), sd); // Date d = DateTimeFormat.getFormat(PredefinedFormat.ISO_8601).parse("1994-11-05T13:15:30Z"); try { Date d = DateTimeFormat.getFormat(PredefinedFormat.ISO_8601).parse(sd); record.setAttribute(field.getName(), d); } catch (IllegalArgumentException ex) { LOG.log(Level.WARNING, sd, ex); } } } } return record; }
Example 7
Source File: DigitalObjectDataSource.java From proarc with GNU General Public License v3.0 | 6 votes |
public void delete(String[] pids, Map<?,?> options) { final ClientMessages i18n = GWT.create(ClientMessages.class); HashMap<String, String> deleteParams = new HashMap<String, String>(); deleteParams.put(DigitalObjectResourceApi.DELETE_PURGE_PARAM, option(options.get(DigitalObjectResourceApi.DELETE_PURGE_PARAM), Boolean.FALSE.toString())); deleteParams.put(DigitalObjectResourceApi.DELETE_HIERARCHY_PARAM, option(options.get(DigitalObjectResourceApi.DELETE_HIERARCHY_PARAM), Boolean.TRUE.toString())); DSRequest dsRequest = new DSRequest(); dsRequest.setPromptStyle(PromptStyle.DIALOG); dsRequest.setPrompt(i18n.DeleteAction_Deleting_Msg()); dsRequest.setParams(deleteParams); Record query = new Record(); query.setAttribute(FIELD_PID, pids); DigitalObjectDataSource.getInstance().removeData(query, new DSCallback() { @Override public void execute(DSResponse response, Object rawData, DSRequest request) { if (RestConfig.isStatusOk(response)) { StatusView.getInstance().show(i18n.DeleteAction_Done_Msg()); DigitalObjectDataSource.this.updateCaches(response, request); SearchDataSource.getInstance().updateCaches(response, request); RelationDataSource.getInstance().updateCaches(response, request); } } }, dsRequest); }
Example 8
Source File: WorkflowJobView.java From proarc with GNU General Public License v3.0 | 6 votes |
public void edit(String jobId) { if (jobId == null) { init(); return ; } int jobRec = jobGrid.findIndex( new AdvancedCriteria(WorkflowJobDataSource.FIELD_ID, OperatorId.EQUALS, jobId)); if (jobRec >= 0) { jobGrid.selectSingleRecord(jobRec); jobGrid.scrollToRow(jobRec); } else { lastSelection = null; jobGrid.deselectAllRecords(); Record r = new Record(); r.setAttribute(WorkflowJobDataSource.FIELD_ID, jobId); jobFormView.setJob(r); loadSubjobs(r); } }
Example 9
Source File: ImportPresenter.java From proarc with GNU General Public License v3.0 | 6 votes |
private void ingest(String batchId, String parentId, final BooleanCallback call) { ImportBatchDataSource dsBatch = ImportBatchDataSource.getInstance(); DSRequest dsRequest = new DSRequest(); dsRequest.setPromptStyle(PromptStyle.DIALOG); dsRequest.setPrompt(i18n.ImportWizard_UpdateItemsStep_Ingesting_Title()); Record update = new Record(); update.setAttribute(ImportBatchDataSource.FIELD_ID, batchId); update.setAttribute(ImportBatchDataSource.FIELD_PARENT, parentId); update.setAttribute(ImportBatchDataSource.FIELD_STATE, ImportBatchDataSource.State.INGESTING.name()); dsBatch.updateData(update, new DSCallback() { @Override public void execute(DSResponse response, Object rawData, DSRequest request) { if (RestConfig.isStatusOk(response)) { Record[] records = response.getData(); if (records != null && records.length > 0) { importContext.setBatch(new BatchRecord(records[0])); call.execute(true); return; } } call.execute(false); } }, dsRequest); }
Example 10
Source File: DigitalObjectDataSource.java From proarc with GNU General Public License v3.0 | 6 votes |
private DigitalObject(String pid, String batchId, String modelId, MetaModelRecord model, Long worfklowjobId, Record record) { if ((pid == null || pid.isEmpty()) && worfklowjobId == null) { throw new IllegalArgumentException("No PID or WorkflowJobId was set"); } this.pid = pid; this.batchId = batchId; this.modelId = model == null ? modelId : model.getId(); this.model = model; this.workflowJobId = worfklowjobId; if (this.modelId == null || this.modelId.isEmpty()) { throw new IllegalArgumentException("No model for: " + pid); } this.record = record; if (record != null) { record.setAttribute(FIELD_INSTANCE, this); } }
Example 11
Source File: ImportPresenter.java From proarc with GNU General Public License v3.0 | 5 votes |
private void updateBatchParent(String batchId, final String parentPid, final BooleanCallback call) { ImportBatchDataSource dsBatch = ImportBatchDataSource.getInstance(); DSRequest dsRequest = new DSRequest(); Record update = new Record(); update.setAttribute(ImportBatchDataSource.FIELD_ID, batchId); update.setAttribute(ImportBatchDataSource.FIELD_PARENT, parentPid != null ? parentPid : ""); dsBatch.updateData(update, new DSCallback() { @Override public void execute(DSResponse response, Object rawData, DSRequest request) { if (!RestConfig.isStatusOk(response)) { importContext.setParentPid(null); call.execute(false); return; } Record[] data = response.getData(); if (data != null && data.length > 0) { importContext.setBatch(new BatchRecord(data[0])); call.execute(true); } else { // XXX show warning something is wrong importContext.setBatch(null); call.execute(false); } } }, dsRequest); }
Example 12
Source File: RepeatableFormItem.java From proarc with GNU General Public License v3.0 | 5 votes |
private static RecordList simpleArrayAsRecordList(JavaScriptObject jso, String name) { RecordList result = new RecordList(); if (JSOHelper.isArray(jso)) { Object[] values = JSOHelper.convertToArray(jso); for (Object value : values) { Record r = new Record(); r.setAttribute(name, value); result.add(r); } } else { // single value? } return result; }
Example 13
Source File: ImportBatchItemDataSource.java From proarc with GNU General Public License v3.0 | 5 votes |
private void deleteItem() { String[] chunk = nextChunk(); if (chunk == null) { StatusView.getInstance().show(i18n.DeleteAction_Done_Msg()); callback.onSuccess(deleted.toArray(new Record[0])); return ; } Record query = new Record(); query.setAttribute(FIELD_BATCHID, batchId); query.setAttribute(FIELD_PID, chunk); DSRequest dsRequest = new DSRequest(); dsRequest.setPromptStyle(PromptStyle.DIALOG); dsRequest.setPrompt(i18n.DeleteAction_Deleting_Msg()); // TileGrid.removeSelectedData uses queuing support in case of multi-selection. // It will require extra support on server. For now remove data in separate requests. //thumbGrid.removeSelectedData(); ds.removeData(query, new DSCallback() { @Override public void execute(DSResponse response, Object rawData, DSRequest request) { if (RestConfig.isStatusOk(response)) { ds.updateCaches(response, request); deleted.addAll(Arrays.asList(response.getData())); deleteItem(); } else { if (deleted.isEmpty()) { callback.onFailure(null); } else { callback.onSuccess(deleted.toArray(new Record[0])); callback.onFailure(null); } } } }, dsRequest); }
Example 14
Source File: StreamProfileDataSource.java From proarc with GNU General Public License v3.0 | 5 votes |
private static StreamProfile create(Record r, int defaultOrder, String source) { StreamProfile sv = get(r); StreamProfile template = getTemplate(sv.getId(), source); r.setAttribute(FIELD_ORDER, template == null ? defaultOrder : template.getOrder()); r.setAttribute(FIELD_LABEL, template == null ? r.getAttribute(FIELD_ID) : template.getLabel()); return sv; }
Example 15
Source File: ModsBatchEditor.java From proarc with GNU General Public License v3.0 | 5 votes |
private void copyAttribute(boolean enabled, Record src, Record dst, String attrName) { if (enabled) { String value = src.getAttribute(attrName); if (value != null) { dst.setAttribute(attrName, value); } } }
Example 16
Source File: RelationDataSource.java From proarc with GNU General Public License v3.0 | 5 votes |
/** * Saves new children sequence for a given parent object. * * @param parent parent object * @param childPids children sequence * @param call callback */ public void reorderChildren(DigitalObject parent, String[] childPids, final BooleanCallback call) { if (childPids == null || childPids.length < 2) { throw new IllegalArgumentException("Unexpected children: " + Arrays.toString(childPids)); } if (parent == null) { throw new NullPointerException("parent"); } DSRequest dsRequest = new DSRequest(); dsRequest.setAttribute(ATTR_REORDER, childPids); Record update = new Record(); update.setAttribute(RelationDataSource.FIELD_PID, childPids); String parentPid = parent.getPid(); String batchId = parent.getBatchId(); if (batchId != null) { update.setAttribute(DigitalObjectResourceApi.MEMBERS_ITEM_BATCHID, batchId); } else { update.setAttribute(RelationDataSource.FIELD_PARENT, parentPid); } updateData(update, new DSCallback() { @Override public void execute(DSResponse response, Object rawData, DSRequest request) { if (!RestConfig.isStatusOk(response)) { call.execute(false); return; } call.execute(true); } }, dsRequest); }
Example 17
Source File: ConverterAssociationsDialog.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
protected void onApply() { for (Record rec : associationsGrid.getRecordList().toArray()) { if (rec.getAttributeAsBoolean("selected")) { String id = rec.getAttributeAsString("id").trim(); String selectedConverter = converter.getValueAsString(); Record record = srcGrid.find(new AdvancedCriteria("id", OperatorId.EQUALS, id)); if (record != null) { record.setAttribute("converter", selectedConverter); srcGrid.updateData(record); } } } destroy(); }
Example 18
Source File: ChronicleExportAction.java From proarc with GNU General Public License v3.0 | 5 votes |
@Override public void performAction(ActionEvent event) { Record[] records = Actions.getSelection(event); String[] pids = ClientUtils.toFieldValues(records, ExportResourceApi.NDK_PID_PARAM); if (pids == null || pids.length == 0) { return ; } Record export = new Record(); export.setAttribute(ExportResourceApi.NDK_PID_PARAM, pids); export.setAttribute(ExportResourceApi.NDK_PACKAGE, ExportResourceApi.Package.CHRONICLE.name()); exportOrValidate(export); }
Example 19
Source File: KrameriusExportAction.java From proarc with GNU General Public License v3.0 | 4 votes |
@Override protected void setRequestOptions(Record record) { record.setAttribute(KRAMERIUS4_POLICY_PARAM, rgi.getValueAsString()); }
Example 20
Source File: NdkExportAction.java From proarc with GNU General Public License v3.0 | 4 votes |
protected void setAttributes(Record export, String[] pids) { export.setAttribute(ExportResourceApi.NDK_PID_PARAM, pids); }