Java Code Examples for com.smartgwt.client.data.Record#getAttributeAsLong()
The following examples show how to use
com.smartgwt.client.data.Record#getAttributeAsLong() .
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: DigitalObjectDataSource.java From proarc with GNU General Public License v3.0 | 6 votes |
/** * Creates digital object instance from record. * @param r record * @param checked {@code false} means ignore missing attributes and return {@code null} * @return instance of digital object */ private static DigitalObject create(Record r, boolean checked) { if (r == null) { throw new NullPointerException(); } DigitalObject dobj = (DigitalObject) r.getAttributeAsObject(FIELD_INSTANCE); if (dobj != null) { return dobj; } Long workflowJobId = r.getAttributeAsLong(WorkflowModelConsts.JOB_ID); String pid = getAttribute(r, FIELD_PID, checked && workflowJobId == null); String modelId = getAttribute(r, FIELD_MODEL, checked); if ((pid == null && workflowJobId == null) || modelId == null) { return null; } String batchId = r.getAttribute(ModsCustomDataSource.FIELD_BATCHID); MetaModelRecord model = MetaModelDataSource.getModel(r); return new DigitalObject(pid, batchId, modelId, model, workflowJobId, r); }
Example 2
Source File: GridUtil.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
static public GUIDocument toDocument(Record record) { GUIDocument document = null; if (record != null) { document = new GUIDocument(); document.setId(record.getAttributeAsLong("id")); if (record.getAttribute("docref") != null) { document.setDocRef(Long.parseLong(record.getAttribute("docref"))); document.setDocRefType(record.getAttribute("docrefType")); } document.setExtResId(record.getAttributeAsString("extResId")); document.setCustomId(record.getAttributeAsString("customId")); document.setType(record.getAttribute("type")); document.setFileName(record.getAttribute("filename")); document.setTemplate(record.getAttribute("template")); document.setVersion(record.getAttribute("version")); document.setFileVersion(record.getAttribute("fileVersion")); document.setLanguage(record.getAttribute("language")); document.setPublisher(record.getAttributeAsString("publisher")); if (record.getAttributeAsFloat("size") != null) document.setFileSize(record.getAttributeAsFloat("size")); if (record.getAttributeAsInt("indexed") != null) document.setIndexed(record.getAttributeAsInt("indexed")); if (record.getAttributeAsInt("status") != null) document.setStatus(record.getAttributeAsInt("status")); if (record.getAttributeAsInt("immutable") != null) document.setImmutable(record.getAttributeAsInt("immutable")); if (record.getAttributeAsInt("password") != null) document.setPasswordProtected(record.getAttributeAsBoolean("password")); if (record.getAttributeAsInt("signed") != null) document.setSigned(record.getAttributeAsInt("signed")); if (record.getAttributeAsInt("stamped") != null) document.setStamped(record.getAttributeAsInt("stamped")); if (record.getAttributeAsInt("bookmarked") != null) document.setBookmarked(record.getAttributeAsBoolean("bookmarked")); if (record.getAttribute("lockUserId") != null) document.setLockUserId(record.getAttributeAsLong("lockUserId")); if (record.getAttribute("lockUser") != null) document.setLockUser(record.getAttribute("lockUser")); if (record.getAttribute("docref") != null) { document.setDocRef(Long.parseLong(record.getAttribute("docref"))); document.setDocRefType(record.getAttribute("docrefType")); } if (record.getAttributeAsInt("workflowStatus") != null) document.setWorkflowStatus(record.getAttributeAsString("workflowStatus")); if (record.getAttributeAsString("workflowStatusDisplay") != null) document.setWorkflowStatusDisplay(record.getAttributeAsString("workflowStatusDisplay")); document.setIcon(record.getAttribute("icon")); if (record.getAttributeAsDate("lastModified") != null) document.setLastModified(record.getAttributeAsDate("lastModified")); if (record.getAttributeAsDate("published") != null) document.setDate(record.getAttributeAsDate("published")); if (record.getAttributeAsDate("created") != null) document.setCreation(record.getAttributeAsDate("created")); GUIFolder folder = new GUIFolder(); if ("folder".equals(document.getType())) { folder.setId(Long.parseLong(record.getAttributeAsString("id"))); } else if (record.getAttributeAsLong("folderId") != null) folder.setId(record.getAttributeAsLong("folderId")); else folder.setId(Session.get().getCurrentFolder().getId()); folder.setName(record.getAttribute("filename")); folder.setDescription(record.getAttribute("comment")); document.setFolder(folder); } return document; }
Example 3
Source File: WorkflowJobView.java From proarc with GNU General Public License v3.0 | 4 votes |
private void fetchModelMenu(Record job) { if (job == null // not subjob || job.getAttribute(WorkflowJobDataSource.FIELD_PARENTID) != null || !Job.State.OPEN.name().equals(job.getAttribute(WorkflowJobDataSource.FIELD_STATE)) ) { createNewObjectButton.setVisible(false); return; } String jobName = job.getAttribute(WorkflowJobDataSource.FIELD_PROFILE_ID); Long jobId = job.getAttributeAsLong(WorkflowJobDataSource.FIELD_ID); if (jobName == null) { return; } Criteria criteria = new Criteria(); criteria.setAttribute(WorkflowMaterialDataSource.FIELD_JOB_ID, jobId); criteria.setAttribute(WorkflowMaterialDataSource.FIELD_TYPE, MaterialType.DIGITAL_OBJECT.name()); WorkflowMaterialDataSource.getInstance().fetchData(criteria, (dsResponse, o, dsRequest) -> { RecordList records = dsResponse.getDataAsRecordList(); if (records.getLength() == 1 && records.get(0) .getAttribute(WorkflowMaterialDataSource.FIELD_DIGITAL_PID) == null) { createNewObjectButton.enable(); } else { createNewObjectButton.disable(); } }); WorkflowProfileDataSource.getInstance().getModels(false, jobName, (models) -> { Menu menu = new Menu(); for (Record model : models) { MenuItem menuItem = new MenuItem(model.getAttribute(WorkflowProfileConsts.MODEL_TITLE)); menu.addItem(menuItem); menuItem.addClickHandler(event -> { saveNewDigitalObject(model.getAttributeAsString(WorkflowProfileConsts.MODEL_NAME), jobId); createNewObjectButton.disable(); actionSource.fireEvent(); jobFormView.refreshState(); jobFormView.refresh(); }); } createNewObjectButton.setVisible(models.length > 0); createNewObjectButton.setMenu(menu); }); }