Refine search
/** * {@inheritDoc} */ public ResourceProperties getProperties(Entity entity) { return entity.getProperties(); }
public class Bean { private List<Entity> entities; private Map<Long, Boolean> checked = new HashMap<Long, Boolean>(); public void submit() { for (Entity entity : entities) { if (checked.get(entity.getId())) { // Entity is checked. Do your thing here. } } } // ... }
/** * From EntityProducer */ public String getEntityUrl(Reference ref) { return getEntity(ref).getUrl(); }
String sql = "UPDATE entity SET name = ?, value = ? WHERE id = ?"; // ... statement = connection.prepareStatement(sql); for (Entity entity : entities) { statement.setString(1, entity.getName()); statement.setInt(2, entity.getValue()); statement.setLong(3, entity.getId()); // ... statement.addBatch(); } statement.executeBatch(); // ...
for(Entity e : entities){ if(!e.isRight()) entityTypes[e.getId()].getAtlas().findRegion(e.getFrame()).flip(true, false); batch.draw(entityTypes[e.getId()].getAtlas().findRegion(e.getFrame()), e.getPosition().x, e.getPosition().y); if(!e.isRight()) entityTypes[e.getId()].getAtlas().findRegion(e.getFrame()).flip(true, false); }
@RequestMapping(value="", method=RequestMethod.GET, produces=MediaType.APPLICATION_JSON_VALUE) public @ResponseBody ResponseEntity<Object> getAll() { List<Entity> entityList = entityManager.findAll(); List<JSONObject> entities = new ArrayList<JSONObject>(); for (Entity n : entityList) { JSONObject Entity = new JSONObject(); entity.put("id", n.getId()); entity.put("address", n.getAddress()); entities.add(entity); } return new ResponseEntity<Object>(entities, HttpStatus.OK); }
StorageUtils.escapeSql(id), StorageUtils.escapeSql(container.getReference())); StringBuilder result = new StringBuilder(); Connection lock = m_sql.dbReadLock(statement, result); m_locks.put(entry.getReference(), lock); fields[1] = doubleStorageSql.getRecordId(container.getReference() + "/" + id); fields[2] = TimeService.newTime(); fields[3] = sessionId; if (m_locks.containsKey(entry.getReference())) return null; m_locks.put(entry.getReference(), edit);
/** * Return a lock on the entry with this id, or null if a lock cannot be made. * * @param container * The container id. * @param id * The id. * @return The locked object with this id, or null if a lock cannot be made. */ public Edit editResource(String container, String id) { if (container == null) container = ""; Container c = ((Container) m_store.get(container)); if (c == null) return null; Entity entry = (Entity) c.contained.get(caseId(id)); if (entry == null) return null; synchronized (m_locks) { // check for a lock in place if (m_locks.get(entry.getReference()) != null) return null; // make an Edit Edit edit = m_user.newResourceEdit(c.container, entry); // store it in the locks m_locks.put(entry.getReference(), edit); return edit; } }
/** * Commit the changes and release the lock. * * @param container * The container id. * @param edit * The entry to commit. */ public void commitResource(String container, Edit edit) { if (container == null) container = ""; Container c = ((Container) m_store.get(container)); if (c != null) { // make a new Entry from the Edit to update the info store Entity updatedEntry = m_user.newResource(c.container, edit); c.contained.put(caseId(updatedEntry.getId()), updatedEntry); } // release the lock m_locks.remove(edit.getReference()); }
/** * Commit the changes and release the locked container. * * @param container * The container id. * @param edit * The entry to commit. */ public void commitContainer(Edit edit) { // make a new Entry from the Edit to update the info store Entity updatedContainer = m_user.newContainer(edit); // update the store Container c = ((Container) m_store.get(updatedContainer.getReference())); if (c != null) { c.container = updatedContainer; } else { c = new Container(updatedContainer); m_store.put(updatedContainer.getReference(), c); } // release the lock m_locks.remove(edit.getReference()); }
Connection lock = (Connection) m_locks.get(edit.getReference()); if (lock == null) m_locks.remove(edit.getReference()); lockFields[1] = doubleStorageSql.getRecordId(container.getReference() + "/" + edit.getId()); boolean ok = m_sql.dbWrite(statement, lockFields); if (!ok) m_locks.remove(edit.getReference());
Container c = ((Container) m_store.get(container)); if (c == null) return new Vector(); if (c.contained.size() == 0) return new Vector(); all.addAll(c.contained.values()); if (candidate.getProperties().getProperty(ResourceProperties.PROP_PUBVIEW) == null)
fields[0] = container.getReference(); int pos = 1; if ((m_resourceTableOrderField != null) && (afterDate != null)) if ((candidate.getProperties().getProperty(ResourceProperties.PROP_PUBVIEW) == null))
String oId = oResource.getId(); String oId2 = oResource.getId(); String nId = ""; String nUrl = ""; ResourceProperties oProperties = oResource.getProperties(); boolean isCollection = false; try transversalMap.put(oResource.getId(), nId); transversalMap.put(oResource.getUrl(), nUrl); transversalMap.putAll(transferCopyEntitiesRefMigrator(oResource.getId(), nId, resourceIds)); ((BaseResourceEdit) edit).closeEdit(); nUrl = edit.getUrl(); transversalMap.put(oResource.getId(), nId); transversalMap.put(oResource.getUrl(), nUrl);
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { resp.setContentType("text/plain"); final DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); final Query query = new Query("Table/Entity Name"); //query.addSort(Entity.KEY_RESERVED_PROPERTY, Query.SortDirection.DESCENDING); for (final Entity entity : datastore.prepare(query).asIterable()) { resp.getWriter().println(entity.getKey().toString()); final Map<String, Object> properties = entity.getProperties(); final String[] propertyNames = properties.keySet().toArray( new String[properties.size()]); for(final String propertyName : propertyNames) { resp.getWriter().println("-> " + propertyName + ": " + entity.getProperty(propertyName)); } } }
String oId = oResource.getId(); ResourceProperties oProperties = oResource.getProperties();
field = Validator.escapeHtml((String)entity.getProperties().get(TagList.PARENT)); } else if (TagList.CRITERIA.equals(column)) { String url = entity.getUrl(); if (url != null) { field = (String)entity.getProperties().get(TagList.THICKBOX_INCLUDE); field +="<a href=\"" + url + "\" class=\"thickbox\">"; field += Validator.escapeHtml((String)entity.getProperties().get(TagList.CRITERIA)); field += "</a>"; field = Validator.escapeHtml((String)entity.getProperties().get(TagList.CRITERIA));
/** * Test a collection of Entity object for the specified entity reference * * @param entities * The collection (Entity) of entities * @param entityRef * The string entity reference to find. * @return true if found, false if not. */ public static boolean entityCollectionContainsRefString(Collection<Entity> entities, String entityRef) { for (Iterator<Entity> i = entities.iterator(); i.hasNext();) { Entity entity = i.next(); if (entity.getReference().equals(entityRef)) return true; } return false; }
entry.toXml(doc, new Stack()); String xml = StorageUtils.writeDocumentToString(doc); "XML")); Object[] fields = new Object[2]; fields[0] = entry.getReference(); fields[1] = xml;