本文整理了Java中org.sakaiproject.entity.api.Entity.getReference()
方法的一些代码示例,展示了Entity.getReference()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entity.getReference()
方法的具体详情如下:
包路径:org.sakaiproject.entity.api.Entity
类名称:Entity
方法名:getReference
[英]Access the internal reference which can be used to access the entity from within the system.
[中]访问可用于从系统内访问实体的内部引用。
代码示例来源:origin: sakaiproject/sakai
/**
* 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;
}
代码示例来源:origin: sakaiproject/sakai
/**
* Set the refs collection to the entity reference strings from the entities collection (and nothing more)
*
* @param refs
* The collection (String) of entity references to modify.
* @param entities
* The collection (Entity) of entity objects to use.
*/
public static void setEntityRefsFromEntities(Collection<String> refs, Collection<Entity> entities)
{
refs.clear();
for (Iterator<Entity> i = entities.iterator(); i.hasNext();)
{
Entity entity = i.next();
refs.add(entity.getReference());
}
}
代码示例来源:origin: sakaiproject/sakai
/**
* Test a collection of Entity reference Strings for the specified Entity
*
* @param refs
* The collection (String) of entity refs
* @param entity
* The Entity to find.
* @return true if found, false if not.
*/
public static boolean refCollectionContainsEntity(Collection<String> refs, Entity entity)
{
String targetRef = entity.getReference();
for (Iterator<String> i = refs.iterator(); i.hasNext();)
{
String entityRef = i.next();
if (entityRef.equals(targetRef)) return true;
}
return false;
}
代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-impl
public void unlockGroup(Entity entity) {
unlockGroup(entity.getReference());
}
代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-impl
public void lockGroup(Entity entity) {
lockGroup(entity.getReference());
}
代码示例来源:origin: sakaiproject/sakai
/**
* See if the collection of entity reference strings has at least one entity that is in the collection of Entity objects.
*
* @param entityRefs
* The collection (String) of entity references.
* @param entities
* The collection (Entity) of entity objects.
* @return true if there is interesection, false if not.
*/
public static boolean isIntersectionEntityRefsToEntities(Collection<String> entityRefs, Collection<Entity> entities)
{
for (Iterator<String> iRefs = entityRefs.iterator(); iRefs.hasNext();)
{
String findThisEntityRef = iRefs.next();
for (Iterator<Entity> iEntities = entities.iterator(); iEntities.hasNext();)
{
String thisEntityRef = ((Entity) iEntities.next()).getReference();
if (thisEntityRef.equals(findThisEntityRef))
{
return true;
}
}
}
return false;
}
代码示例来源:origin: sakaiproject/sakai
String ref = r.getReference();
if (ref.startsWith(context))
代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-storage-util
/**
* 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;
}
}
代码示例来源:origin: sakaiproject/sakai
String findThisEntityRef = iEntities.next().getReference();
if(!entityRefs.contains(findThisEntityRef)) {
return false;
代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-storage-util
/**
* Count all Resources
* @param container
* The container for this resource.
*/
public int getCount(Entity container)
{
// read With or without a filter
String sql = doubleStorageSql.getCountSql(m_resourceTableName, m_resourceTableContainerIdField);
Object[] fields = new Object[1];
fields[0] = container.getReference();
List countList = m_sql.dbRead(sql, fields, null);
if ( countList.isEmpty() ) return 0;
Object obj = countList.get(0);
String str = (String) obj;
return Integer.parseInt(str);
}
代码示例来源:origin: sakaiproject/sakai
/**
* Count all Resources
* @param container
* The container for this resource.
*/
public int getCount(Entity container)
{
// read With or without a filter
String sql = doubleStorageSql.getCountSql(m_resourceTableName, m_resourceTableContainerIdField);
Object[] fields = new Object[1];
fields[0] = container.getReference();
List countList = m_sql.dbRead(sql, fields, null);
if ( countList.isEmpty() ) return 0;
Object obj = countList.get(0);
String str = (String) obj;
return Integer.parseInt(str);
}
代码示例来源:origin: sakaiproject/sakai
/**
* Fill in the two collections of Entity reference strings - those added in newEntities that were not in oldEntityRefs, and those removed, i.e. in oldEntityRefs not in newEntities.
*/
public static void computeAddedRemovedEntityRefsFromNewEntitiesOldRefs(Collection<String> addedEntities, Collection<String> removedEntities,
Collection<Entity> newEntities, Collection<String> oldEntityRefs)
{
// added
for (Iterator<Entity> i = newEntities.iterator(); i.hasNext();)
{
Entity entity = i.next();
if (!refCollectionContainsEntity(oldEntityRefs, entity))
{
addedEntities.add(entity.getReference());
}
}
// removed
for (Iterator<String> i = oldEntityRefs.iterator(); i.hasNext();)
{
String entityRef = i.next();
if (!entityCollectionContainsRefString(newEntities, entityRef))
{
removedEntities.add(entityRef);
}
}
}
}
代码示例来源:origin: org.sakaiproject/sakai-rwiki-impl
/**
* {@inheritDoc}
*
* @param rwo
* @return
*/
public Reference getReference(RWikiObject rwo)
{
return entityManager.newReference(getEntity(rwo).getReference());
}
代码示例来源:origin: sakaiproject/sakai
/**
* Return a lock on the container with this id, or null if a lock cannot be made.
*
* @param ref
* The container reference.
* @return The locked object with this id, or null if a lock cannot be made.
*/
public Edit editContainer(String ref)
{
Container c = (Container) m_store.get(ref);
if (c == null) return null;
synchronized (m_locks)
{
// check for a lock in place
if (m_locks.get(c.container.getReference()) != null) return null;
// make an Edit
Edit edit = m_user.newContainerEdit(c.container);
// store it in the locks
m_locks.put(edit.getReference(), edit);
return edit;
}
}
代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-storage-util
/**
* Return a lock on the container with this id, or null if a lock cannot be made.
*
* @param ref
* The container reference.
* @return The locked object with this id, or null if a lock cannot be made.
*/
public Edit editContainer(String ref)
{
Container c = (Container) m_store.get(ref);
if (c == null) return null;
synchronized (m_locks)
{
// check for a lock in place
if (m_locks.get(c.container.getReference()) != null) return null;
// make an Edit
Edit edit = m_user.newContainerEdit(c.container);
// store it in the locks
m_locks.put(edit.getReference(), edit);
return edit;
}
}
代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-storage-util
/**
* 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());
}
代码示例来源:origin: sakaiproject/sakai
/**
* Check if a Resource by this id exists.
*
* @param container
* The container for this resource.
* @param id
* The id.
* @return true if a Resource by this id exists, false if not.
*/
public boolean checkResource(Entity container, String id)
{
// just see if the record exists
String sql = doubleStorageSql.getSelectIdSql(m_resourceTableName, m_resourceTableIdField, m_resourceTableContainerIdField);
Object[] fields = new Object[2];
fields[0] = container.getReference();
fields[1] = id;
List ids = m_sql.dbRead(sql, fields, null);
return (!ids.isEmpty());
}
代码示例来源:origin: sakaiproject/sakai
/**
* 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());
}
代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-storage-util
/**
* Check if a Resource by this id exists.
*
* @param container
* The container for this resource.
* @param id
* The id.
* @return true if a Resource by this id exists, false if not.
*/
public boolean checkResource(Entity container, String id)
{
// just see if the record exists
String sql = doubleStorageSql.getSelectIdSql(m_resourceTableName, m_resourceTableIdField, m_resourceTableContainerIdField);
Object[] fields = new Object[2];
fields[0] = container.getReference();
fields[1] = id;
List ids = m_sql.dbRead(sql, fields, null);
return (!ids.isEmpty());
}
代码示例来源:origin: sakaiproject/sakai
/**
* Get the Resource with this id, or null if not found.
*
* @param container
* The container for this resource.
* @param id
* The id.
* @return The Resource with this id, or null if not found.
*/
public Entity getResource(Entity container, String id)
{
Entity entry = null;
// get the user from the db
String sql = doubleStorageSql.getSelectXml4Sql(m_resourceTableName, m_resourceTableIdField, m_resourceTableContainerIdField);
Object[] fields = new Object[2];
fields[0] = container.getReference();
fields[1] = id;
List xml = m_sql.dbRead(sql, fields, null);
if (!xml.isEmpty())
{
// create the Resource from the db xml
entry = readResource(container, (String) xml.get(0));
}
return entry;
}
内容来源于网络,如有侵权,请联系作者删除!