private void save() { try { Record records[] = listGrid.getRecords(); Integer mainIdList[] = new Integer[records.length]; int i = 0; for (Record record : records) { mainIdList[i++] = record.getAttributeAsInt("main_id"); } DataSource dataSource = DataSource.get("OrgDS"); com.smartgwt.client.rpc.RPCManager.startQueue(); Record record = new Record(); record.setAttribute("mainIdList", mainIdList); record.setAttribute( "loggedUserName", CommonSingleton.getInstance().getSessionPerson().getUserName()); DSRequest req = new DSRequest(); req.setAttribute("operationId", "updateMainServiceOrders"); dataSource.updateData( record, new DSCallback() { @Override public void execute(DSResponse response, Object rawData, DSRequest request) { destroy(); tabOrganization.search(); } }, req); com.smartgwt.client.rpc.RPCManager.sendQueue(); } catch (Exception e) { e.printStackTrace(); SC.say(e.toString()); } }
@Override public ResourceGroupComposite copyValues(Record from) { Integer idAttrib = from.getAttributeAsInt("id"); String nameAttrib = from.getAttribute(NAME.propertyName()); String descriptionAttrib = from.getAttribute(DESCRIPTION.propertyName()); String typeNameAttrib = from.getAttribute(TYPE.propertyName()); ResourceGroup rg = new ResourceGroup(nameAttrib); rg.setId(idAttrib); rg.setDescription(descriptionAttrib); if (typeNameAttrib != null) { ResourceType rt = new ResourceType(); rt.setName(typeNameAttrib); String pluginNameAttrib = from.getAttribute(PLUGIN.propertyName()); rt.setPlugin(pluginNameAttrib); rg.setResourceType(rt); } Long explicitCount = Long.valueOf(from.getAttribute("explicitCount")); Long explicitDown = Long.valueOf(from.getAttribute("explicitDown")); Long explicitUnknown = Long.valueOf(from.getAttribute("explicitUnknown")); Long explicitDisabled = Long.valueOf(from.getAttribute("explicitDisabled")); Long implicitCount = Long.valueOf(from.getAttribute("implicitCount")); Long implicitDown = Long.valueOf(from.getAttribute("implicitDown")); Long implicitUnknown = Long.valueOf(from.getAttribute("implicitUnknown")); Long implicitDisabled = Long.valueOf(from.getAttribute("implicitDisabled")); ResourceGroupComposite composite = new ResourceGroupComposite( explicitCount, explicitDown, explicitUnknown, explicitDisabled, implicitCount, implicitDown, implicitUnknown, implicitDisabled, rg); return composite; }
public void copyFromRecord(Record from) { setId(from.getAttributeAsInt("id")); setName(from.getAttributeAsString("name")); setDate(from.getAttributeAsDate("date")); }