repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBInitializerHelper.java | DBInitializerHelper.useSequenceForOrderNumber | public static boolean useSequenceForOrderNumber(WorkspaceEntry wsConfig, String dbDialect) throws RepositoryConfigurationException
{
try
{
if (wsConfig.getContainer().getParameterValue(JDBCWorkspaceDataContainer.USE_SEQUENCE_FOR_ORDER_NUMBER, JDBCWorkspaceDataContainer.USE_SEQUENCE_AUTO).equalsI... | java | public static boolean useSequenceForOrderNumber(WorkspaceEntry wsConfig, String dbDialect) throws RepositoryConfigurationException
{
try
{
if (wsConfig.getContainer().getParameterValue(JDBCWorkspaceDataContainer.USE_SEQUENCE_FOR_ORDER_NUMBER, JDBCWorkspaceDataContainer.USE_SEQUENCE_AUTO).equalsI... | [
"public",
"static",
"boolean",
"useSequenceForOrderNumber",
"(",
"WorkspaceEntry",
"wsConfig",
",",
"String",
"dbDialect",
")",
"throws",
"RepositoryConfigurationException",
"{",
"try",
"{",
"if",
"(",
"wsConfig",
".",
"getContainer",
"(",
")",
".",
"getParameterValue... | Use sequence for order number.
@param wsConfig The workspace configuration.
@return true if the sequence are enable. False otherwise. | [
"Use",
"sequence",
"for",
"order",
"number",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBInitializerHelper.java#L395-L412 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionFactory.java | SessionFactory.createSession | SessionImpl createSession(ConversationState user) throws RepositoryException, LoginException
{
if (IdentityConstants.SYSTEM.equals(user.getIdentity().getUserId()))
{
// Need privileges to get system session.
SecurityManager security = System.getSecurityManager();
if (security !... | java | SessionImpl createSession(ConversationState user) throws RepositoryException, LoginException
{
if (IdentityConstants.SYSTEM.equals(user.getIdentity().getUserId()))
{
// Need privileges to get system session.
SecurityManager security = System.getSecurityManager();
if (security !... | [
"SessionImpl",
"createSession",
"(",
"ConversationState",
"user",
")",
"throws",
"RepositoryException",
",",
"LoginException",
"{",
"if",
"(",
"IdentityConstants",
".",
"SYSTEM",
".",
"equals",
"(",
"user",
".",
"getIdentity",
"(",
")",
".",
"getUserId",
"(",
")... | Creates Session object by given Credentials
@param credentials
@return the SessionImpl corresponding to the given {@link ConversationState}
@throws RepositoryException | [
"Creates",
"Session",
"object",
"by",
"given",
"Credentials"
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionFactory.java#L119-L147 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/config/RepositoryServiceConfigurationImpl.java | RepositoryServiceConfigurationImpl.retain | @Override
public synchronized void retain() throws RepositoryException
{
try
{
if (!isRetainable())
throw new RepositoryException("Unsupported configuration place "
+ configurationService.getURL(param.getValue())
+ " If you want to save configuration... | java | @Override
public synchronized void retain() throws RepositoryException
{
try
{
if (!isRetainable())
throw new RepositoryException("Unsupported configuration place "
+ configurationService.getURL(param.getValue())
+ " If you want to save configuration... | [
"@",
"Override",
"public",
"synchronized",
"void",
"retain",
"(",
")",
"throws",
"RepositoryException",
"{",
"try",
"{",
"if",
"(",
"!",
"isRetainable",
"(",
")",
")",
"throw",
"new",
"RepositoryException",
"(",
"\"Unsupported configuration place \"",
"+",
"confi... | Retain configuration of JCR If configurationPersister is configured it write data in to the
persister otherwise it try to save configuration in file
@throws RepositoryException | [
"Retain",
"configuration",
"of",
"JCR",
"If",
"configurationPersister",
"is",
"configured",
"it",
"write",
"data",
"in",
"to",
"the",
"persister",
"otherwise",
"it",
"try",
"to",
"save",
"configuration",
"in",
"file"
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/config/RepositoryServiceConfigurationImpl.java#L166-L273 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/quota/WorkspaceQuotaRestore.java | WorkspaceQuotaRestore.doRestore | protected void doRestore(File backupFile) throws BackupException
{
if (!PrivilegedFileHelper.exists(backupFile))
{
LOG.warn("Nothing to restore for quotas");
return;
}
ZipObjectReader in = null;
try
{
in = new ZipObjectReader(PrivilegedFileHelper.zipInp... | java | protected void doRestore(File backupFile) throws BackupException
{
if (!PrivilegedFileHelper.exists(backupFile))
{
LOG.warn("Nothing to restore for quotas");
return;
}
ZipObjectReader in = null;
try
{
in = new ZipObjectReader(PrivilegedFileHelper.zipInp... | [
"protected",
"void",
"doRestore",
"(",
"File",
"backupFile",
")",
"throws",
"BackupException",
"{",
"if",
"(",
"!",
"PrivilegedFileHelper",
".",
"exists",
"(",
"backupFile",
")",
")",
"{",
"LOG",
".",
"warn",
"(",
"\"Nothing to restore for quotas\"",
")",
";",
... | Restores content. | [
"Restores",
"content",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/quota/WorkspaceQuotaRestore.java#L186-L220 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/quota/WorkspaceQuotaRestore.java | WorkspaceQuotaRestore.repairDataSize | private void repairDataSize()
{
try
{
long dataSize = quotaPersister.getWorkspaceDataSize(rName, wsName);
ChangesItem changesItem = new ChangesItem();
changesItem.updateWorkspaceChangedSize(dataSize);
quotaPersister.setWorkspaceDataSize(rName, wsName, 0); // workarou... | java | private void repairDataSize()
{
try
{
long dataSize = quotaPersister.getWorkspaceDataSize(rName, wsName);
ChangesItem changesItem = new ChangesItem();
changesItem.updateWorkspaceChangedSize(dataSize);
quotaPersister.setWorkspaceDataSize(rName, wsName, 0); // workarou... | [
"private",
"void",
"repairDataSize",
"(",
")",
"{",
"try",
"{",
"long",
"dataSize",
"=",
"quotaPersister",
".",
"getWorkspaceDataSize",
"(",
"rName",
",",
"wsName",
")",
";",
"ChangesItem",
"changesItem",
"=",
"new",
"ChangesItem",
"(",
")",
";",
"changesItem"... | After workspace data size being restored, need also to update
repository and global data size on respective value. | [
"After",
"workspace",
"data",
"size",
"being",
"restored",
"need",
"also",
"to",
"update",
"repository",
"and",
"global",
"data",
"size",
"on",
"respective",
"value",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/quota/WorkspaceQuotaRestore.java#L226-L247 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/quota/WorkspaceQuotaRestore.java | WorkspaceQuotaRestore.doBackup | protected void doBackup(File backupFile) throws BackupException
{
ZipObjectWriter out = null;
try
{
out = new ZipObjectWriter(PrivilegedFileHelper.zipOutputStream(backupFile));
quotaPersister.backupWorkspaceData(rName, wsName, out);
}
catch (IOException e)
{
... | java | protected void doBackup(File backupFile) throws BackupException
{
ZipObjectWriter out = null;
try
{
out = new ZipObjectWriter(PrivilegedFileHelper.zipOutputStream(backupFile));
quotaPersister.backupWorkspaceData(rName, wsName, out);
}
catch (IOException e)
{
... | [
"protected",
"void",
"doBackup",
"(",
"File",
"backupFile",
")",
"throws",
"BackupException",
"{",
"ZipObjectWriter",
"out",
"=",
"null",
";",
"try",
"{",
"out",
"=",
"new",
"ZipObjectWriter",
"(",
"PrivilegedFileHelper",
".",
"zipOutputStream",
"(",
"backupFile",... | Backups data to define file. | [
"Backups",
"data",
"to",
"define",
"file",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/quota/WorkspaceQuotaRestore.java#L252-L278 | train |
exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/artifact/ArtifactManagingServiceImpl.java | ArtifactManagingServiceImpl.importResource | private void importResource(Node parentNode, InputStream file_in, String resourceType, ArtifactDescriptor artifact)
throws RepositoryException
{
// Note that artifactBean been initialized within constructor
// resourceType can be jar, pom, metadata
String filename;
if (resourceTy... | java | private void importResource(Node parentNode, InputStream file_in, String resourceType, ArtifactDescriptor artifact)
throws RepositoryException
{
// Note that artifactBean been initialized within constructor
// resourceType can be jar, pom, metadata
String filename;
if (resourceTy... | [
"private",
"void",
"importResource",
"(",
"Node",
"parentNode",
",",
"InputStream",
"file_in",
",",
"String",
"resourceType",
",",
"ArtifactDescriptor",
"artifact",
")",
"throws",
"RepositoryException",
"{",
"// Note that artifactBean been initialized within constructor",
"//... | this method used for writing to repo jars, poms and their checksums | [
"this",
"method",
"used",
"for",
"writing",
"to",
"repo",
"jars",
"poms",
"and",
"their",
"checksums"
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/artifact/ArtifactManagingServiceImpl.java#L858-L911 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexChangesFilter.java | ISPNIndexChangesFilter.createIndexInfos | private IndexInfos createIndexInfos(Boolean system, IndexerIoModeHandler modeHandler, QueryHandlerEntry config,
QueryHandler handler) throws RepositoryConfigurationException
{
try
{
// read RSYNC configuration
RSyncConfiguration rSyncConfiguration = new RSyncConfiguration(config);... | java | private IndexInfos createIndexInfos(Boolean system, IndexerIoModeHandler modeHandler, QueryHandlerEntry config,
QueryHandler handler) throws RepositoryConfigurationException
{
try
{
// read RSYNC configuration
RSyncConfiguration rSyncConfiguration = new RSyncConfiguration(config);... | [
"private",
"IndexInfos",
"createIndexInfos",
"(",
"Boolean",
"system",
",",
"IndexerIoModeHandler",
"modeHandler",
",",
"QueryHandlerEntry",
"config",
",",
"QueryHandler",
"handler",
")",
"throws",
"RepositoryConfigurationException",
"{",
"try",
"{",
"// read RSYNC configur... | Factory method for creating corresponding IndexInfos class. RSyncIndexInfos created if RSync configured
and ISPNIndexInfos otherwise
@param system
@param modeHandler
@param config
@param handler
@return
@throws RepositoryConfigurationException | [
"Factory",
"method",
"for",
"creating",
"corresponding",
"IndexInfos",
"class",
".",
"RSyncIndexInfos",
"created",
"if",
"RSync",
"configured",
"and",
"ISPNIndexInfos",
"otherwise"
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexChangesFilter.java#L125-L148 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/cacheable/AbstractCacheableLockManager.java | AbstractCacheableLockManager.getNumLocks | @Managed
@ManagedDescription("The number of active locks")
public int getNumLocks()
{
try
{
return getNumLocks.run();
}
catch (LockException e)
{
if (LOG.isTraceEnabled())
{
LOG.trace("An exception occurred: " + e.getMessage());
}
... | java | @Managed
@ManagedDescription("The number of active locks")
public int getNumLocks()
{
try
{
return getNumLocks.run();
}
catch (LockException e)
{
if (LOG.isTraceEnabled())
{
LOG.trace("An exception occurred: " + e.getMessage());
}
... | [
"@",
"Managed",
"@",
"ManagedDescription",
"(",
"\"The number of active locks\"",
")",
"public",
"int",
"getNumLocks",
"(",
")",
"{",
"try",
"{",
"return",
"getNumLocks",
".",
"run",
"(",
")",
";",
"}",
"catch",
"(",
"LockException",
"e",
")",
"{",
"if",
"... | Returns the number of active locks. | [
"Returns",
"the",
"number",
"of",
"active",
"locks",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/cacheable/AbstractCacheableLockManager.java#L200-L216 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/cacheable/AbstractCacheableLockManager.java | AbstractCacheableLockManager.hasLocks | protected boolean hasLocks()
{
try
{
return hasLocks.run();
}
catch (LockException e)
{
if (LOG.isTraceEnabled())
{
LOG.trace("An exception occurred: " + e.getMessage());
}
}
return true;
} | java | protected boolean hasLocks()
{
try
{
return hasLocks.run();
}
catch (LockException e)
{
if (LOG.isTraceEnabled())
{
LOG.trace("An exception occurred: " + e.getMessage());
}
}
return true;
} | [
"protected",
"boolean",
"hasLocks",
"(",
")",
"{",
"try",
"{",
"return",
"hasLocks",
".",
"run",
"(",
")",
";",
"}",
"catch",
"(",
"LockException",
"e",
")",
"{",
"if",
"(",
"LOG",
".",
"isTraceEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"trace",
"("... | Indicates if some locks have already been created. | [
"Indicates",
"if",
"some",
"locks",
"have",
"already",
"been",
"created",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/cacheable/AbstractCacheableLockManager.java#L221-L235 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/cacheable/AbstractCacheableLockManager.java | AbstractCacheableLockManager.isLockLive | public boolean isLockLive(String nodeId) throws LockException
{
try
{
return isLockLive.run(nodeId);
}
catch (LockException e)
{
if (LOG.isTraceEnabled())
{
LOG.trace("An exception occurred: " + e.getMessage());
}
}
return fals... | java | public boolean isLockLive(String nodeId) throws LockException
{
try
{
return isLockLive.run(nodeId);
}
catch (LockException e)
{
if (LOG.isTraceEnabled())
{
LOG.trace("An exception occurred: " + e.getMessage());
}
}
return fals... | [
"public",
"boolean",
"isLockLive",
"(",
"String",
"nodeId",
")",
"throws",
"LockException",
"{",
"try",
"{",
"return",
"isLockLive",
".",
"run",
"(",
"nodeId",
")",
";",
"}",
"catch",
"(",
"LockException",
"e",
")",
"{",
"if",
"(",
"LOG",
".",
"isTraceEn... | Check is LockManager contains lock. No matter it is in pending or persistent state. | [
"Check",
"is",
"LockManager",
"contains",
"lock",
".",
"No",
"matter",
"it",
"is",
"in",
"pending",
"or",
"persistent",
"state",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/cacheable/AbstractCacheableLockManager.java#L240-L254 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/cacheable/AbstractCacheableLockManager.java | AbstractCacheableLockManager.getLockDataById | protected LockData getLockDataById(String nodeId)
{
try
{
return getLockDataById.run(nodeId);
}
catch (LockException e)
{
if (LOG.isTraceEnabled())
{
LOG.trace("An exception occurred: " + e.getMessage());
}
}
return null;
} | java | protected LockData getLockDataById(String nodeId)
{
try
{
return getLockDataById.run(nodeId);
}
catch (LockException e)
{
if (LOG.isTraceEnabled())
{
LOG.trace("An exception occurred: " + e.getMessage());
}
}
return null;
} | [
"protected",
"LockData",
"getLockDataById",
"(",
"String",
"nodeId",
")",
"{",
"try",
"{",
"return",
"getLockDataById",
".",
"run",
"(",
"nodeId",
")",
";",
"}",
"catch",
"(",
"LockException",
"e",
")",
"{",
"if",
"(",
"LOG",
".",
"isTraceEnabled",
"(",
... | Returns lock data by node identifier. | [
"Returns",
"lock",
"data",
"by",
"node",
"identifier",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/cacheable/AbstractCacheableLockManager.java#L286-L300 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/cacheable/AbstractCacheableLockManager.java | AbstractCacheableLockManager.getLockList | protected synchronized List<LockData> getLockList()
{
try
{
return getLockList.run();
}
catch (LockException e)
{
if (LOG.isTraceEnabled())
{
LOG.trace("An exception occurred: " + e.getMessage());
}
}
return null;
} | java | protected synchronized List<LockData> getLockList()
{
try
{
return getLockList.run();
}
catch (LockException e)
{
if (LOG.isTraceEnabled())
{
LOG.trace("An exception occurred: " + e.getMessage());
}
}
return null;
} | [
"protected",
"synchronized",
"List",
"<",
"LockData",
">",
"getLockList",
"(",
")",
"{",
"try",
"{",
"return",
"getLockList",
".",
"run",
"(",
")",
";",
"}",
"catch",
"(",
"LockException",
"e",
")",
"{",
"if",
"(",
"LOG",
".",
"isTraceEnabled",
"(",
")... | Returns all locks. | [
"Returns",
"all",
"locks",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/cacheable/AbstractCacheableLockManager.java#L305-L319 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/cacheable/AbstractCacheableLockManager.java | AbstractCacheableLockManager.getSessionLockManager | public SessionLockManager getSessionLockManager(String sessionId, SessionDataManager transientManager)
{
CacheableSessionLockManager sessionManager = new CacheableSessionLockManager(sessionId, this, transientManager);
sessionLockManagers.put(sessionId, sessionManager);
return sessionManager;
} | java | public SessionLockManager getSessionLockManager(String sessionId, SessionDataManager transientManager)
{
CacheableSessionLockManager sessionManager = new CacheableSessionLockManager(sessionId, this, transientManager);
sessionLockManagers.put(sessionId, sessionManager);
return sessionManager;
} | [
"public",
"SessionLockManager",
"getSessionLockManager",
"(",
"String",
"sessionId",
",",
"SessionDataManager",
"transientManager",
")",
"{",
"CacheableSessionLockManager",
"sessionManager",
"=",
"new",
"CacheableSessionLockManager",
"(",
"sessionId",
",",
"this",
",",
"tra... | Return new instance of session lock manager. | [
"Return",
"new",
"instance",
"of",
"session",
"lock",
"manager",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/cacheable/AbstractCacheableLockManager.java#L336-L341 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/cacheable/AbstractCacheableLockManager.java | AbstractCacheableLockManager.removeExpired | public synchronized void removeExpired()
{
final List<String> removeLockList = new ArrayList<String>();
for (LockData lock : getLockList())
{
if (!lock.isSessionScoped() && lock.getTimeToDeath() < 0)
{
removeLockList.add(lock.getNodeIdentifier());
}
}
... | java | public synchronized void removeExpired()
{
final List<String> removeLockList = new ArrayList<String>();
for (LockData lock : getLockList())
{
if (!lock.isSessionScoped() && lock.getTimeToDeath() < 0)
{
removeLockList.add(lock.getNodeIdentifier());
}
}
... | [
"public",
"synchronized",
"void",
"removeExpired",
"(",
")",
"{",
"final",
"List",
"<",
"String",
">",
"removeLockList",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
"LockData",
"lock",
":",
"getLockList",
"(",
")",
")",
"{",
... | Remove expired locks. Used from LockRemover. | [
"Remove",
"expired",
"locks",
".",
"Used",
"from",
"LockRemover",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/cacheable/AbstractCacheableLockManager.java#L526-L544 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/cacheable/AbstractCacheableLockManager.java | AbstractCacheableLockManager.removeLock | protected void removeLock(String nodeIdentifier)
{
try
{
NodeData nData = (NodeData)dataManager.getItemData(nodeIdentifier);
//Skip removing, because that node was removed in other node of cluster.
if (nData == null)
{
return;
}
PlainC... | java | protected void removeLock(String nodeIdentifier)
{
try
{
NodeData nData = (NodeData)dataManager.getItemData(nodeIdentifier);
//Skip removing, because that node was removed in other node of cluster.
if (nData == null)
{
return;
}
PlainC... | [
"protected",
"void",
"removeLock",
"(",
"String",
"nodeIdentifier",
")",
"{",
"try",
"{",
"NodeData",
"nData",
"=",
"(",
"NodeData",
")",
"dataManager",
".",
"getItemData",
"(",
"nodeIdentifier",
")",
";",
"//Skip removing, because that node was removed in other node of... | Remove lock, used by Lock remover.
@param nodeIdentifier String | [
"Remove",
"lock",
"used",
"by",
"Lock",
"remover",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/cacheable/AbstractCacheableLockManager.java#L722-L782 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/cacheable/AbstractCacheableLockManager.java | AbstractCacheableLockManager.removeAll | protected void removeAll()
{
List<LockData> locks = getLockList();
for (LockData lockData : locks)
{
removeLock(lockData.getNodeIdentifier());
}
} | java | protected void removeAll()
{
List<LockData> locks = getLockList();
for (LockData lockData : locks)
{
removeLock(lockData.getNodeIdentifier());
}
} | [
"protected",
"void",
"removeAll",
"(",
")",
"{",
"List",
"<",
"LockData",
">",
"locks",
"=",
"getLockList",
"(",
")",
";",
"for",
"(",
"LockData",
"lockData",
":",
"locks",
")",
"{",
"removeLock",
"(",
"lockData",
".",
"getNodeIdentifier",
"(",
")",
")",... | Remove all locks. | [
"Remove",
"all",
"locks",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/cacheable/AbstractCacheableLockManager.java#L814-L821 | train |
exoplatform/jcr | exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/PendingChangesLog.java | PendingChangesLog.getAsByteArray | public static byte[] getAsByteArray(TransactionChangesLog dataChangesLog) throws IOException
{
ByteArrayOutputStream os = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(os);
oos.writeObject(dataChangesLog);
byte[] bArray = os.toByteArray();
return bArray;
... | java | public static byte[] getAsByteArray(TransactionChangesLog dataChangesLog) throws IOException
{
ByteArrayOutputStream os = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(os);
oos.writeObject(dataChangesLog);
byte[] bArray = os.toByteArray();
return bArray;
... | [
"public",
"static",
"byte",
"[",
"]",
"getAsByteArray",
"(",
"TransactionChangesLog",
"dataChangesLog",
")",
"throws",
"IOException",
"{",
"ByteArrayOutputStream",
"os",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"ObjectOutputStream",
"oos",
"=",
"new",
"Ob... | getAsByteArray. Make the array of bytes from ChangesLog.
@param dataChangesLog
the ChangesLog with data
@return byte[] return the serialized ChangesLog
@throws IOException
will be generated the IOException | [
"getAsByteArray",
".",
"Make",
"the",
"array",
"of",
"bytes",
"from",
"ChangesLog",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/PendingChangesLog.java#L374-L382 | train |
exoplatform/jcr | exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/PendingChangesLog.java | PendingChangesLog.getAsItemDataChangesLog | public static TransactionChangesLog getAsItemDataChangesLog(byte[] byteArray) throws IOException,
ClassNotFoundException
{
ByteArrayInputStream is = new ByteArrayInputStream(byteArray);
ObjectInputStream ois = new ObjectInputStream(is);
TransactionChangesLog objRead = (TransactionChangesLog)o... | java | public static TransactionChangesLog getAsItemDataChangesLog(byte[] byteArray) throws IOException,
ClassNotFoundException
{
ByteArrayInputStream is = new ByteArrayInputStream(byteArray);
ObjectInputStream ois = new ObjectInputStream(is);
TransactionChangesLog objRead = (TransactionChangesLog)o... | [
"public",
"static",
"TransactionChangesLog",
"getAsItemDataChangesLog",
"(",
"byte",
"[",
"]",
"byteArray",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"ByteArrayInputStream",
"is",
"=",
"new",
"ByteArrayInputStream",
"(",
"byteArray",
")",
";",
... | getAsItemDataChangesLog. Make the ChangesLog from array of bytes.
@param byteArray
the serialized ChangesLog
@return TransactionChangesLog return the deserialized ChangesLog
@throws IOException
will be generated the IOException
@throws ClassNotFoundException
will be generated the ClassNotFoundException | [
"getAsItemDataChangesLog",
".",
"Make",
"the",
"ChangesLog",
"from",
"array",
"of",
"bytes",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/PendingChangesLog.java#L395-L403 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/PlainChangesLogReader.java | PlainChangesLogReader.read | public PlainChangesLog read(ObjectReader in) throws UnknownClassIdException, IOException
{
int key;
if ((key = in.readInt()) != SerializationConstants.PLAIN_CHANGES_LOG_IMPL)
{
throw new UnknownClassIdException("There is unexpected class [" + key + "]");
}
int eventType ... | java | public PlainChangesLog read(ObjectReader in) throws UnknownClassIdException, IOException
{
int key;
if ((key = in.readInt()) != SerializationConstants.PLAIN_CHANGES_LOG_IMPL)
{
throw new UnknownClassIdException("There is unexpected class [" + key + "]");
}
int eventType ... | [
"public",
"PlainChangesLog",
"read",
"(",
"ObjectReader",
"in",
")",
"throws",
"UnknownClassIdException",
",",
"IOException",
"{",
"int",
"key",
";",
"if",
"(",
"(",
"key",
"=",
"in",
".",
"readInt",
"(",
")",
")",
"!=",
"SerializationConstants",
".",
"PLAIN... | Read and set PlainChangesLog data.
@param in
ObjectReader.
@return PlainChangesLog object.
@throws UnknownClassIdException
If read Class ID is not expected or do not exist.
@throws IOException
If an I/O error has occurred. | [
"Read",
"and",
"set",
"PlainChangesLog",
"data",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/PlainChangesLogReader.java#L78-L99 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/PlainChangesLogWriter.java | PlainChangesLogWriter.write | public void write(ObjectWriter out, PlainChangesLog pcl) throws IOException
{
// write id
out.writeInt(SerializationConstants.PLAIN_CHANGES_LOG_IMPL);
out.writeInt(pcl.getEventType());
out.writeString(pcl.getSessionId());
List<ItemState> list = pcl.getAllStates();
int... | java | public void write(ObjectWriter out, PlainChangesLog pcl) throws IOException
{
// write id
out.writeInt(SerializationConstants.PLAIN_CHANGES_LOG_IMPL);
out.writeInt(pcl.getEventType());
out.writeString(pcl.getSessionId());
List<ItemState> list = pcl.getAllStates();
int... | [
"public",
"void",
"write",
"(",
"ObjectWriter",
"out",
",",
"PlainChangesLog",
"pcl",
")",
"throws",
"IOException",
"{",
"// write id\r",
"out",
".",
"writeInt",
"(",
"SerializationConstants",
".",
"PLAIN_CHANGES_LOG_IMPL",
")",
";",
"out",
".",
"writeInt",
"(",
... | Write PlainChangesLog data.
@param out
ObjectWriter
@param pcl
PlainChangesLog ojbect
@throws IOException
if any Exception is occurred | [
"Write",
"PlainChangesLog",
"data",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/PlainChangesLogWriter.java#L51-L69 | train |
exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/SimpleJCRUserListAccess.java | SimpleJCRUserListAccess.getUsersStorageNode | private ExtendedNode getUsersStorageNode() throws RepositoryException
{
Session session = service.getStorageSession();
try
{
return (ExtendedNode)utils.getUsersStorageNode(service.getStorageSession());
}
finally
{
session.logout();
}
} | java | private ExtendedNode getUsersStorageNode() throws RepositoryException
{
Session session = service.getStorageSession();
try
{
return (ExtendedNode)utils.getUsersStorageNode(service.getStorageSession());
}
finally
{
session.logout();
}
} | [
"private",
"ExtendedNode",
"getUsersStorageNode",
"(",
")",
"throws",
"RepositoryException",
"{",
"Session",
"session",
"=",
"service",
".",
"getStorageSession",
"(",
")",
";",
"try",
"{",
"return",
"(",
"ExtendedNode",
")",
"utils",
".",
"getUsersStorageNode",
"(... | Returns users storage node. | [
"Returns",
"users",
"storage",
"node",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/SimpleJCRUserListAccess.java#L95-L106 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java | JDBCStorageConnection.closeStatements | protected void closeStatements()
{
try
{
if (findItemById != null)
{
findItemById.close();
}
if (findItemByPath != null)
{
findItemByPath.close();
}
if (findItemByName != null)
{
findItemByName.c... | java | protected void closeStatements()
{
try
{
if (findItemById != null)
{
findItemById.close();
}
if (findItemByPath != null)
{
findItemByPath.close();
}
if (findItemByName != null)
{
findItemByName.c... | [
"protected",
"void",
"closeStatements",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"findItemById",
"!=",
"null",
")",
"{",
"findItemById",
".",
"close",
"(",
")",
";",
"}",
"if",
"(",
"findItemByPath",
"!=",
"null",
")",
"{",
"findItemByPath",
".",
"close",
... | Close all statements. | [
"Close",
"all",
"statements",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java#L517-L685 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java | JDBCStorageConnection.getNodesAndProperties | public List<NodeDataIndexing> getNodesAndProperties(String lastNodeId, int offset, int limit)
throws RepositoryException, IllegalStateException
{
List<NodeDataIndexing> result = new ArrayList<NodeDataIndexing>();
checkIfOpened();
try
{
startTxIfNeeded();
ResultSet res... | java | public List<NodeDataIndexing> getNodesAndProperties(String lastNodeId, int offset, int limit)
throws RepositoryException, IllegalStateException
{
List<NodeDataIndexing> result = new ArrayList<NodeDataIndexing>();
checkIfOpened();
try
{
startTxIfNeeded();
ResultSet res... | [
"public",
"List",
"<",
"NodeDataIndexing",
">",
"getNodesAndProperties",
"(",
"String",
"lastNodeId",
",",
"int",
"offset",
",",
"int",
"limit",
")",
"throws",
"RepositoryException",
",",
"IllegalStateException",
"{",
"List",
"<",
"NodeDataIndexing",
">",
"result",
... | Returns from storage the next page of nodes and its properties. | [
"Returns",
"from",
"storage",
"the",
"next",
"page",
"of",
"nodes",
"and",
"its",
"properties",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java#L1287-L1371 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java | JDBCStorageConnection.getNodesCount | public long getNodesCount() throws RepositoryException
{
try
{
ResultSet countNodes = findNodesCount();
try
{
if (countNodes.next())
{
return countNodes.getLong(1);
}
else
{
throw new SQLE... | java | public long getNodesCount() throws RepositoryException
{
try
{
ResultSet countNodes = findNodesCount();
try
{
if (countNodes.next())
{
return countNodes.getLong(1);
}
else
{
throw new SQLE... | [
"public",
"long",
"getNodesCount",
"(",
")",
"throws",
"RepositoryException",
"{",
"try",
"{",
"ResultSet",
"countNodes",
"=",
"findNodesCount",
"(",
")",
";",
"try",
"{",
"if",
"(",
"countNodes",
".",
"next",
"(",
")",
")",
"{",
"return",
"countNodes",
".... | Reads count of nodes in workspace.
@return
nodes count
@throws RepositoryException
if a database access error occurs | [
"Reads",
"count",
"of",
"nodes",
"in",
"workspace",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java#L1533-L1558 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java | JDBCStorageConnection.getWorkspaceDataSize | public long getWorkspaceDataSize() throws RepositoryException
{
long dataSize = 0;
ResultSet result = null;
try
{
result = findWorkspaceDataSize();
try
{
if (result.next())
{
dataSize += result.getLong(1);
}
... | java | public long getWorkspaceDataSize() throws RepositoryException
{
long dataSize = 0;
ResultSet result = null;
try
{
result = findWorkspaceDataSize();
try
{
if (result.next())
{
dataSize += result.getLong(1);
}
... | [
"public",
"long",
"getWorkspaceDataSize",
"(",
")",
"throws",
"RepositoryException",
"{",
"long",
"dataSize",
"=",
"0",
";",
"ResultSet",
"result",
"=",
"null",
";",
"try",
"{",
"result",
"=",
"findWorkspaceDataSize",
"(",
")",
";",
"try",
"{",
"if",
"(",
... | Calculates workspace data size.
@throws RepositoryException
if a database access error occurs | [
"Calculates",
"workspace",
"data",
"size",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java#L1566-L1615 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java | JDBCStorageConnection.getNodeDataSize | public long getNodeDataSize(String nodeIdentifier) throws RepositoryException
{
long dataSize = 0;
ResultSet result = null;
try
{
result = findNodeDataSize(getInternalId(nodeIdentifier));
try
{
if (result.next())
{
dataSize +=... | java | public long getNodeDataSize(String nodeIdentifier) throws RepositoryException
{
long dataSize = 0;
ResultSet result = null;
try
{
result = findNodeDataSize(getInternalId(nodeIdentifier));
try
{
if (result.next())
{
dataSize +=... | [
"public",
"long",
"getNodeDataSize",
"(",
"String",
"nodeIdentifier",
")",
"throws",
"RepositoryException",
"{",
"long",
"dataSize",
"=",
"0",
";",
"ResultSet",
"result",
"=",
"null",
";",
"try",
"{",
"result",
"=",
"findNodeDataSize",
"(",
"getInternalId",
"(",... | Calculates node data size.
@throws RepositoryException
if a database access error occurs | [
"Calculates",
"node",
"data",
"size",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java#L1623-L1672 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java | JDBCStorageConnection.getItemByIdentifier | protected ItemData getItemByIdentifier(String cid) throws RepositoryException, IllegalStateException
{
checkIfOpened();
try
{
ResultSet item = findItemByIdentifier(cid);
try
{
if (item.next())
{
return itemData(null, item, item.getIn... | java | protected ItemData getItemByIdentifier(String cid) throws RepositoryException, IllegalStateException
{
checkIfOpened();
try
{
ResultSet item = findItemByIdentifier(cid);
try
{
if (item.next())
{
return itemData(null, item, item.getIn... | [
"protected",
"ItemData",
"getItemByIdentifier",
"(",
"String",
"cid",
")",
"throws",
"RepositoryException",
",",
"IllegalStateException",
"{",
"checkIfOpened",
"(",
")",
";",
"try",
"{",
"ResultSet",
"item",
"=",
"findItemByIdentifier",
"(",
"cid",
")",
";",
"try"... | Get Item By Identifier.
@param cid
Item id (container internal)
@return ItemData
@throws RepositoryException
Repository error
@throws IllegalStateException
if connection is closed | [
"Get",
"Item",
"By",
"Identifier",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java#L1687-L1721 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java | JDBCStorageConnection.getItemByName | protected ItemData getItemByName(NodeData parent, String parentId, QPathEntry name, ItemType itemType)
throws RepositoryException, IllegalStateException
{
checkIfOpened();
try
{
ResultSet item = null;
try
{
item = findItemByName(parentId, name.getAsStrin... | java | protected ItemData getItemByName(NodeData parent, String parentId, QPathEntry name, ItemType itemType)
throws RepositoryException, IllegalStateException
{
checkIfOpened();
try
{
ResultSet item = null;
try
{
item = findItemByName(parentId, name.getAsStrin... | [
"protected",
"ItemData",
"getItemByName",
"(",
"NodeData",
"parent",
",",
"String",
"parentId",
",",
"QPathEntry",
"name",
",",
"ItemType",
"itemType",
")",
"throws",
"RepositoryException",
",",
"IllegalStateException",
"{",
"checkIfOpened",
"(",
")",
";",
"try",
... | Gets an item data from database.
@param parent
- parent QPath
@param parentId
- parent container internal id (depends on Multi/Single DB)
@param name
- item name
@param itemType
- item type
@return - ItemData instance
@throws RepositoryException
Repository error
@throws IllegalStateException
if connection is closed | [
"Gets",
"an",
"item",
"data",
"from",
"database",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java#L1782-L1826 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java | JDBCStorageConnection.itemData | private ItemData itemData(QPath parentPath, ResultSet item, int itemClass, AccessControlList parentACL)
throws RepositoryException, SQLException, IOException
{
String cid = item.getString(COLUMN_ID);
String cname = item.getString(COLUMN_NAME);
int cversion = item.getInt(COLUMN_VERSION);
... | java | private ItemData itemData(QPath parentPath, ResultSet item, int itemClass, AccessControlList parentACL)
throws RepositoryException, SQLException, IOException
{
String cid = item.getString(COLUMN_ID);
String cname = item.getString(COLUMN_NAME);
int cversion = item.getInt(COLUMN_VERSION);
... | [
"private",
"ItemData",
"itemData",
"(",
"QPath",
"parentPath",
",",
"ResultSet",
"item",
",",
"int",
"itemClass",
",",
"AccessControlList",
"parentACL",
")",
"throws",
"RepositoryException",
",",
"SQLException",
",",
"IOException",
"{",
"String",
"cid",
"=",
"item... | Build ItemData.
@param parentPath
- parent path
@param item
database - ResultSet with Item record(s)
@param itemClass
- Item type (Node or Property)
@param parentACL
- parent ACL
@return ItemData instance
@throws RepositoryException
Repository error
@throws SQLException
database error
@throws IOException
I/O error | [
"Build",
"ItemData",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java#L1984-L2013 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java | JDBCStorageConnection.readMixins | protected MixinInfo readMixins(String cid) throws SQLException, IllegalNameException
{
ResultSet mtrs = findPropertyByName(cid, Constants.JCR_MIXINTYPES.getAsString());
try
{
List<InternalQName> mts = null;
boolean owneable = false;
boolean privilegeable = false;
... | java | protected MixinInfo readMixins(String cid) throws SQLException, IllegalNameException
{
ResultSet mtrs = findPropertyByName(cid, Constants.JCR_MIXINTYPES.getAsString());
try
{
List<InternalQName> mts = null;
boolean owneable = false;
boolean privilegeable = false;
... | [
"protected",
"MixinInfo",
"readMixins",
"(",
"String",
"cid",
")",
"throws",
"SQLException",
",",
"IllegalNameException",
"{",
"ResultSet",
"mtrs",
"=",
"findPropertyByName",
"(",
"cid",
",",
"Constants",
".",
"JCR_MIXINTYPES",
".",
"getAsString",
"(",
")",
")",
... | Read mixins from database.
@param cid
- Item id (internal)
@return MixinInfo
@throws SQLException
database error
@throws IllegalNameException
if nodetype name in mixin record is wrong | [
"Read",
"mixins",
"from",
"database",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java#L2178-L2224 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java | JDBCStorageConnection.loadPropertyRecord | protected PersistedPropertyData loadPropertyRecord(QPath parentPath, String cname, String cid, String cpid,
int cversion, int cptype, boolean cpmultivalued) throws RepositoryException, SQLException, IOException
{
// NOTE: cpid never should be null or root parent (' ')
try
{
QPath q... | java | protected PersistedPropertyData loadPropertyRecord(QPath parentPath, String cname, String cid, String cpid,
int cversion, int cptype, boolean cpmultivalued) throws RepositoryException, SQLException, IOException
{
// NOTE: cpid never should be null or root parent (' ')
try
{
QPath q... | [
"protected",
"PersistedPropertyData",
"loadPropertyRecord",
"(",
"QPath",
"parentPath",
",",
"String",
"cname",
",",
"String",
"cid",
",",
"String",
"cpid",
",",
"int",
"cversion",
",",
"int",
"cptype",
",",
"boolean",
"cpmultivalued",
")",
"throws",
"RepositoryEx... | Load PropertyData record.
@param parentPath
parent path
@param cname
Property name
@param cid
Property id
@param cpid
Property parent id
@param cversion
Property persistent verison
@param cptype
Property type
@param cpmultivalued
Property multivalued status
@return PersistedPropertyData
@throws RepositoryException
Rep... | [
"Load",
"PropertyData",
"record",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java#L2496-L2529 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java | JDBCStorageConnection.deleteValues | private void deleteValues(String cid, PropertyData pdata, boolean update, ChangedSizeHandler sizeHandler)
throws IOException, SQLException, RepositoryException, InvalidItemStateException
{
Set<String> storages = new HashSet<String>();
final ResultSet valueRecords = findValueStorageDescAndSize(cid)... | java | private void deleteValues(String cid, PropertyData pdata, boolean update, ChangedSizeHandler sizeHandler)
throws IOException, SQLException, RepositoryException, InvalidItemStateException
{
Set<String> storages = new HashSet<String>();
final ResultSet valueRecords = findValueStorageDescAndSize(cid)... | [
"private",
"void",
"deleteValues",
"(",
"String",
"cid",
",",
"PropertyData",
"pdata",
",",
"boolean",
"update",
",",
"ChangedSizeHandler",
"sizeHandler",
")",
"throws",
"IOException",
",",
"SQLException",
",",
"RepositoryException",
",",
"InvalidItemStateException",
... | Delete Property Values.
@param cid
Property id
@param pdata
PropertyData
@param update
boolean true if it's delete-add sequence (update operation)
@param sizeHandler
accumulates changed size
@throws IOException
i/O error
@throws SQLException
if database error occurs
@throws RepositoryException
@throws InvalidItemState... | [
"Delete",
"Property",
"Values",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java#L2549-L2598 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java | JDBCStorageConnection.readValues | private List<ValueDataWrapper> readValues(String cid, int cptype, String identifier, int cversion)
throws IOException, SQLException, ValueStorageNotFoundException
{
List<ValueDataWrapper> data = new ArrayList<ValueDataWrapper>();
final ResultSet valueRecords = findValuesByPropertyId(cid);
tr... | java | private List<ValueDataWrapper> readValues(String cid, int cptype, String identifier, int cversion)
throws IOException, SQLException, ValueStorageNotFoundException
{
List<ValueDataWrapper> data = new ArrayList<ValueDataWrapper>();
final ResultSet valueRecords = findValuesByPropertyId(cid);
tr... | [
"private",
"List",
"<",
"ValueDataWrapper",
">",
"readValues",
"(",
"String",
"cid",
",",
"int",
"cptype",
",",
"String",
"identifier",
",",
"int",
"cversion",
")",
"throws",
"IOException",
",",
"SQLException",
",",
"ValueStorageNotFoundException",
"{",
"List",
... | Read Property Values.
@param identifier
property identifier
@param cid
Property id
@param pdata
PropertyData
@return list of ValueData
@throws IOException
i/O error
@throws SQLException
if database errro occurs
@throws ValueStorageNotFoundException
if no such storage found with Value storageId | [
"Read",
"Property",
"Values",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java#L2617-L2651 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java | JDBCStorageConnection.readValueData | protected ValueDataWrapper readValueData(String identifier, int orderNumber, int type, String storageId)
throws SQLException, IOException, ValueStorageNotFoundException
{
ValueIOChannel channel = this.containerConfig.valueStorageProvider.getChannel(storageId);
try
{
return channel.re... | java | protected ValueDataWrapper readValueData(String identifier, int orderNumber, int type, String storageId)
throws SQLException, IOException, ValueStorageNotFoundException
{
ValueIOChannel channel = this.containerConfig.valueStorageProvider.getChannel(storageId);
try
{
return channel.re... | [
"protected",
"ValueDataWrapper",
"readValueData",
"(",
"String",
"identifier",
",",
"int",
"orderNumber",
",",
"int",
"type",
",",
"String",
"storageId",
")",
"throws",
"SQLException",
",",
"IOException",
",",
"ValueStorageNotFoundException",
"{",
"ValueIOChannel",
"c... | Read ValueData from External Storage.
@param identifier
PropertyData
@param orderNumber
Value order number
@param type
property type
@param storageId
external Value storage id
@return ValueData
@throws SQLException
database error
@throws IOException
I/O error
@throws ValueStorageNotFoundException
if no such storage fo... | [
"Read",
"ValueData",
"from",
"External",
"Storage",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java#L2672-L2684 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexerCacheStore.java | IndexerCacheStore.getModeHandler | public IndexerIoModeHandler getModeHandler()
{
if (modeHandler == null)
{
if (ctx.getCache().getStatus() != ComponentStatus.RUNNING)
{
throw new IllegalStateException("The cache should be started first");
}
synchronized (this)
{
if (mo... | java | public IndexerIoModeHandler getModeHandler()
{
if (modeHandler == null)
{
if (ctx.getCache().getStatus() != ComponentStatus.RUNNING)
{
throw new IllegalStateException("The cache should be started first");
}
synchronized (this)
{
if (mo... | [
"public",
"IndexerIoModeHandler",
"getModeHandler",
"(",
")",
"{",
"if",
"(",
"modeHandler",
"==",
"null",
")",
"{",
"if",
"(",
"ctx",
".",
"getCache",
"(",
")",
".",
"getStatus",
"(",
")",
"!=",
"ComponentStatus",
".",
"RUNNING",
")",
"{",
"throw",
"new... | Get the mode handler | [
"Get",
"the",
"mode",
"handler"
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexerCacheStore.java#L87-L108 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexerCacheStore.java | IndexerCacheStore.doPushState | @SuppressWarnings("rawtypes")
protected void doPushState()
{
final boolean debugEnabled = LOG.isDebugEnabled();
if (debugEnabled)
{
LOG.debug("start pushing in-memory state to cache cacheLoader collection");
}
Map<String, ChangesFilterListsWrapper> changesMap = new HashMap... | java | @SuppressWarnings("rawtypes")
protected void doPushState()
{
final boolean debugEnabled = LOG.isDebugEnabled();
if (debugEnabled)
{
LOG.debug("start pushing in-memory state to cache cacheLoader collection");
}
Map<String, ChangesFilterListsWrapper> changesMap = new HashMap... | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"protected",
"void",
"doPushState",
"(",
")",
"{",
"final",
"boolean",
"debugEnabled",
"=",
"LOG",
".",
"isDebugEnabled",
"(",
")",
";",
"if",
"(",
"debugEnabled",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"st... | Flushes all cache content to underlying CacheStore | [
"Flushes",
"all",
"cache",
"content",
"to",
"underlying",
"CacheStore"
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexerCacheStore.java#L166-L239 | train |
exoplatform/jcr | exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavConst.java | WebDavConst.getStatusDescription | public static String getStatusDescription(int status)
{
String description = "";
Integer statusKey = new Integer(status);
if (statusDescriptions.containsKey(statusKey))
{
description = statusDescriptions.get(statusKey);
}
return String.format("%s %d %s", WebDavConst.HTT... | java | public static String getStatusDescription(int status)
{
String description = "";
Integer statusKey = new Integer(status);
if (statusDescriptions.containsKey(statusKey))
{
description = statusDescriptions.get(statusKey);
}
return String.format("%s %d %s", WebDavConst.HTT... | [
"public",
"static",
"String",
"getStatusDescription",
"(",
"int",
"status",
")",
"{",
"String",
"description",
"=",
"\"\"",
";",
"Integer",
"statusKey",
"=",
"new",
"Integer",
"(",
"status",
")",
";",
"if",
"(",
"statusDescriptions",
".",
"containsKey",
"(",
... | Returns status description by it's code.
@param status Status code
@return Status Description | [
"Returns",
"status",
"description",
"by",
"it",
"s",
"code",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavConst.java#L540-L551 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/StreamPersistedValueData.java | StreamPersistedValueData.spoolContent | private void spoolContent(InputStream is) throws IOException, FileNotFoundException
{
SwapFile swapFile =
SwapFile.get(spoolConfig.tempDirectory, System.currentTimeMillis() + "_" + SEQUENCE.incrementAndGet(),
spoolConfig.fileCleaner);
try
{
OutputStream os = Privileged... | java | private void spoolContent(InputStream is) throws IOException, FileNotFoundException
{
SwapFile swapFile =
SwapFile.get(spoolConfig.tempDirectory, System.currentTimeMillis() + "_" + SEQUENCE.incrementAndGet(),
spoolConfig.fileCleaner);
try
{
OutputStream os = Privileged... | [
"private",
"void",
"spoolContent",
"(",
"InputStream",
"is",
")",
"throws",
"IOException",
",",
"FileNotFoundException",
"{",
"SwapFile",
"swapFile",
"=",
"SwapFile",
".",
"get",
"(",
"spoolConfig",
".",
"tempDirectory",
",",
"System",
".",
"currentTimeMillis",
"(... | Spools the content extracted from the URL | [
"Spools",
"the",
"content",
"extracted",
"from",
"the",
"URL"
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/StreamPersistedValueData.java#L369-L397 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/misc/Pattern.java | Pattern.match | public MatchResult match(QPath input)
{
try
{
return match(new Context(input)).getMatchResult();
}
catch (RepositoryException e)
{
throw (IllegalArgumentException)new IllegalArgumentException("QPath not normalized").initCause(e);
}
} | java | public MatchResult match(QPath input)
{
try
{
return match(new Context(input)).getMatchResult();
}
catch (RepositoryException e)
{
throw (IllegalArgumentException)new IllegalArgumentException("QPath not normalized").initCause(e);
}
} | [
"public",
"MatchResult",
"match",
"(",
"QPath",
"input",
")",
"{",
"try",
"{",
"return",
"match",
"(",
"new",
"Context",
"(",
"input",
")",
")",
".",
"getMatchResult",
"(",
")",
";",
"}",
"catch",
"(",
"RepositoryException",
"e",
")",
"{",
"throw",
"("... | Matches this pattern against the input.
@param input path to match with this pattern
@return result from the matching <code>pattern</code> against <code>input</code>
@throws IllegalArgumentException if <code>input</code> is not normalized | [
"Matches",
"this",
"pattern",
"against",
"the",
"input",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/misc/Pattern.java#L43-L53 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/quota/ChangesListener.java | ChangesListener.addPathsWithUnknownChangedSize | private void addPathsWithUnknownChangedSize(ChangesItem changesItem, ItemState state)
{
if (!state.isPersisted() && (state.isDeleted() || state.isRenamed()))
{
String itemPath = getPath(state.getData().getQPath());
for (String trackedPath : quotaPersister.getAllTrackedNodes(rName, wsNa... | java | private void addPathsWithUnknownChangedSize(ChangesItem changesItem, ItemState state)
{
if (!state.isPersisted() && (state.isDeleted() || state.isRenamed()))
{
String itemPath = getPath(state.getData().getQPath());
for (String trackedPath : quotaPersister.getAllTrackedNodes(rName, wsNa... | [
"private",
"void",
"addPathsWithUnknownChangedSize",
"(",
"ChangesItem",
"changesItem",
",",
"ItemState",
"state",
")",
"{",
"if",
"(",
"!",
"state",
".",
"isPersisted",
"(",
")",
"&&",
"(",
"state",
".",
"isDeleted",
"(",
")",
"||",
"state",
".",
"isRenamed... | Checks if changes were made but changed size is unknown. If so, determinate
for which nodes data size should be recalculated at all and put those paths into
respective collection. | [
"Checks",
"if",
"changes",
"were",
"made",
"but",
"changed",
"size",
"is",
"unknown",
".",
"If",
"so",
"determinate",
"for",
"which",
"nodes",
"data",
"size",
"should",
"be",
"recalculated",
"at",
"all",
"and",
"put",
"those",
"paths",
"into",
"respective",
... | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/quota/ChangesListener.java#L188-L202 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/quota/ChangesListener.java | ChangesListener.behaveWhenQuotaExceeded | private void behaveWhenQuotaExceeded(String message) throws ExceededQuotaLimitException
{
switch (exceededQuotaBehavior)
{
case EXCEPTION :
throw new ExceededQuotaLimitException(message);
case WARNING :
LOG.warn(message);
break;
}
} | java | private void behaveWhenQuotaExceeded(String message) throws ExceededQuotaLimitException
{
switch (exceededQuotaBehavior)
{
case EXCEPTION :
throw new ExceededQuotaLimitException(message);
case WARNING :
LOG.warn(message);
break;
}
} | [
"private",
"void",
"behaveWhenQuotaExceeded",
"(",
"String",
"message",
")",
"throws",
"ExceededQuotaLimitException",
"{",
"switch",
"(",
"exceededQuotaBehavior",
")",
"{",
"case",
"EXCEPTION",
":",
"throw",
"new",
"ExceededQuotaLimitException",
"(",
"message",
")",
"... | What to do if data size exceeded quota limit. Throwing exception or logging only.
Depends on preconfigured parameter.
@param message
the detail message for exception or log operation
@throws ExceededQuotaLimitException
if current behavior is {@link ExceededQuotaBehavior#EXCEPTION} | [
"What",
"to",
"do",
"if",
"data",
"size",
"exceeded",
"quota",
"limit",
".",
"Throwing",
"exception",
"or",
"logging",
"only",
".",
"Depends",
"on",
"preconfigured",
"parameter",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/quota/ChangesListener.java#L382-L393 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/quota/ChangesListener.java | ChangesListener.pushChangesToCoordinator | protected void pushChangesToCoordinator(ChangesItem changesItem) throws SecurityException, RPCException
{
if (!changesItem.isEmpty())
{
rpcService.executeCommandOnCoordinator(applyPersistedChangesTask, true, changesItem);
}
} | java | protected void pushChangesToCoordinator(ChangesItem changesItem) throws SecurityException, RPCException
{
if (!changesItem.isEmpty())
{
rpcService.executeCommandOnCoordinator(applyPersistedChangesTask, true, changesItem);
}
} | [
"protected",
"void",
"pushChangesToCoordinator",
"(",
"ChangesItem",
"changesItem",
")",
"throws",
"SecurityException",
",",
"RPCException",
"{",
"if",
"(",
"!",
"changesItem",
".",
"isEmpty",
"(",
")",
")",
"{",
"rpcService",
".",
"executeCommandOnCoordinator",
"("... | Push changes to coordinator to apply. | [
"Push",
"changes",
"to",
"coordinator",
"to",
"apply",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/quota/ChangesListener.java#L432-L438 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/quota/ChangesListener.java | ChangesListener.getPath | private String getPath(QPath path)
{
try
{
return lFactory.createJCRPath(path).getAsString(false);
}
catch (RepositoryException e)
{
throw new IllegalStateException(e.getMessage(), e);
}
} | java | private String getPath(QPath path)
{
try
{
return lFactory.createJCRPath(path).getAsString(false);
}
catch (RepositoryException e)
{
throw new IllegalStateException(e.getMessage(), e);
}
} | [
"private",
"String",
"getPath",
"(",
"QPath",
"path",
")",
"{",
"try",
"{",
"return",
"lFactory",
".",
"createJCRPath",
"(",
"path",
")",
".",
"getAsString",
"(",
"false",
")",
";",
"}",
"catch",
"(",
"RepositoryException",
"e",
")",
"{",
"throw",
"new",... | Returns item absolute path.
@param path
{@link QPath} representation
@throws IllegalStateException if something wrong | [
"Returns",
"item",
"absolute",
"path",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/quota/ChangesListener.java#L463-L473 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/quota/DummyRPCServiceImpl.java | DummyRPCServiceImpl.executeCommand | private Serializable executeCommand(RemoteCommand command, Serializable... args) throws RPCException
{
try
{
return command.execute(args);
}
catch (Throwable e)//NOSONAR
{
throw new RPCException(e.getMessage(), e);
}
} | java | private Serializable executeCommand(RemoteCommand command, Serializable... args) throws RPCException
{
try
{
return command.execute(args);
}
catch (Throwable e)//NOSONAR
{
throw new RPCException(e.getMessage(), e);
}
} | [
"private",
"Serializable",
"executeCommand",
"(",
"RemoteCommand",
"command",
",",
"Serializable",
"...",
"args",
")",
"throws",
"RPCException",
"{",
"try",
"{",
"return",
"command",
".",
"execute",
"(",
"args",
")",
";",
"}",
"catch",
"(",
"Throwable",
"e",
... | Command executing. | [
"Command",
"executing",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/quota/DummyRPCServiceImpl.java#L123-L133 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/ItemStateReader.java | ItemStateReader.read | public ItemState read(ObjectReader in) throws UnknownClassIdException, IOException
{
// read id
int key;
if ((key = in.readInt()) != SerializationConstants.ITEM_STATE)
{
throw new UnknownClassIdException("There is unexpected class [" + key + "]");
}
ItemState is... | java | public ItemState read(ObjectReader in) throws UnknownClassIdException, IOException
{
// read id
int key;
if ((key = in.readInt()) != SerializationConstants.ITEM_STATE)
{
throw new UnknownClassIdException("There is unexpected class [" + key + "]");
}
ItemState is... | [
"public",
"ItemState",
"read",
"(",
"ObjectReader",
"in",
")",
"throws",
"UnknownClassIdException",
",",
"IOException",
"{",
"// read id\r",
"int",
"key",
";",
"if",
"(",
"(",
"key",
"=",
"in",
".",
"readInt",
"(",
")",
")",
"!=",
"SerializationConstants",
"... | Read and set ItemState data.
@param in
ObjectReader.
@return ItemState object.
@throws UnknownClassIdException
If read Class ID is not expected or do not exist.
@throws IOException
If an I/O error has occurred. | [
"Read",
"and",
"set",
"ItemState",
"data",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/ItemStateReader.java#L74-L119 | train |
exoplatform/jcr | exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/SearchCommand.java | SearchCommand.search | public Response search(Session session, HierarchicalProperty body, String baseURI)
{
try
{
SearchRequestEntity requestEntity = new SearchRequestEntity(body);
Query query =
session.getWorkspace().getQueryManager().createQuery(requestEntity.getQuery(),
... | java | public Response search(Session session, HierarchicalProperty body, String baseURI)
{
try
{
SearchRequestEntity requestEntity = new SearchRequestEntity(body);
Query query =
session.getWorkspace().getQueryManager().createQuery(requestEntity.getQuery(),
... | [
"public",
"Response",
"search",
"(",
"Session",
"session",
",",
"HierarchicalProperty",
"body",
",",
"String",
"baseURI",
")",
"{",
"try",
"{",
"SearchRequestEntity",
"requestEntity",
"=",
"new",
"SearchRequestEntity",
"(",
"body",
")",
";",
"Query",
"query",
"=... | Webdav search method implementation.
@param session current session
@param body rrequest body
@param baseURI base uri
@return the instance of javax.ws.rs.core.Response | [
"Webdav",
"search",
"method",
"implementation",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/SearchCommand.java#L59-L91 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/ScoreNode.java | ScoreNode.getDoc | public int getDoc(IndexReader reader) throws IOException {
if (doc == -1) {
TermDocs docs = reader.termDocs(new Term(FieldNames.UUID, id.toString()));
try {
if (docs.next()) {
return docs.doc();
} else {
throw new IO... | java | public int getDoc(IndexReader reader) throws IOException {
if (doc == -1) {
TermDocs docs = reader.termDocs(new Term(FieldNames.UUID, id.toString()));
try {
if (docs.next()) {
return docs.doc();
} else {
throw new IO... | [
"public",
"int",
"getDoc",
"(",
"IndexReader",
"reader",
")",
"throws",
"IOException",
"{",
"if",
"(",
"doc",
"==",
"-",
"1",
")",
"{",
"TermDocs",
"docs",
"=",
"reader",
".",
"termDocs",
"(",
"new",
"Term",
"(",
"FieldNames",
".",
"UUID",
",",
"id",
... | Returns the document number for this score node.
@param reader the current index reader to look up the document if
needed.
@return the document number.
@throws IOException if an error occurs while reading from the index or
the node is not present in the index. | [
"Returns",
"the",
"document",
"number",
"for",
"this",
"score",
"node",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/ScoreNode.java#L93-L108 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/NodeTypeConverter.java | NodeTypeConverter.safeListToArray | private String[] safeListToArray(List<String> v)
{
return v != null ? v.toArray(new String[v.size()]) : new String[0];
} | java | private String[] safeListToArray(List<String> v)
{
return v != null ? v.toArray(new String[v.size()]) : new String[0];
} | [
"private",
"String",
"[",
"]",
"safeListToArray",
"(",
"List",
"<",
"String",
">",
"v",
")",
"{",
"return",
"v",
"!=",
"null",
"?",
"v",
".",
"toArray",
"(",
"new",
"String",
"[",
"v",
".",
"size",
"(",
")",
"]",
")",
":",
"new",
"String",
"[",
... | Convert list to array.
@param v list of string
@return array of string, empty array if list null. | [
"Convert",
"list",
"to",
"array",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/NodeTypeConverter.java#L166-L169 | train |
exoplatform/jcr | exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/IndexCleanHelper.java | IndexCleanHelper.removeWorkspaceIndex | public void removeWorkspaceIndex(WorkspaceEntry wsConfig, boolean isSystem) throws RepositoryConfigurationException,
IOException
{
String indexDirName = wsConfig.getQueryHandler().getParameterValue(QueryHandlerParams.PARAM_INDEX_DIR);
File indexDir = new File(indexDirName);
if (P... | java | public void removeWorkspaceIndex(WorkspaceEntry wsConfig, boolean isSystem) throws RepositoryConfigurationException,
IOException
{
String indexDirName = wsConfig.getQueryHandler().getParameterValue(QueryHandlerParams.PARAM_INDEX_DIR);
File indexDir = new File(indexDirName);
if (P... | [
"public",
"void",
"removeWorkspaceIndex",
"(",
"WorkspaceEntry",
"wsConfig",
",",
"boolean",
"isSystem",
")",
"throws",
"RepositoryConfigurationException",
",",
"IOException",
"{",
"String",
"indexDirName",
"=",
"wsConfig",
".",
"getQueryHandler",
"(",
")",
".",
"getP... | Remove all file of workspace index.
@param wsConfig - workspace configuration.
@param isSystem - 'true' to clean system workspace.
@throws RepositoryConfigurationException - exception on parsing workspace configuration
@throws IOException - exception on remove index folder | [
"Remove",
"all",
"file",
"of",
"workspace",
"index",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/IndexCleanHelper.java#L48-L67 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/SessionChangesLog.java | SessionChangesLog.pushLog | public PlainChangesLog pushLog(QPath rootPath)
{
// session instance is always present in SessionChangesLog
PlainChangesLog cLog = new PlainChangesLogImpl(getDescendantsChanges(rootPath), session);
if (rootPath.equals(Constants.ROOT_PATH))
{
clear();
}
else
{
... | java | public PlainChangesLog pushLog(QPath rootPath)
{
// session instance is always present in SessionChangesLog
PlainChangesLog cLog = new PlainChangesLogImpl(getDescendantsChanges(rootPath), session);
if (rootPath.equals(Constants.ROOT_PATH))
{
clear();
}
else
{
... | [
"public",
"PlainChangesLog",
"pushLog",
"(",
"QPath",
"rootPath",
")",
"{",
"// session instance is always present in SessionChangesLog",
"PlainChangesLog",
"cLog",
"=",
"new",
"PlainChangesLogImpl",
"(",
"getDescendantsChanges",
"(",
"rootPath",
")",
",",
"session",
")",
... | Creates new changes log with rootPath and its descendants of this one and removes those
entries.
@param rootPath
@return ItemDataChangesLog | [
"Creates",
"new",
"changes",
"log",
"with",
"rootPath",
"and",
"its",
"descendants",
"of",
"this",
"one",
"and",
"removes",
"those",
"entries",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/SessionChangesLog.java#L107-L120 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SysViewWorkspaceInitializer.java | SysViewWorkspaceInitializer.doRestore | protected void doRestore() throws Throwable
{
PlainChangesLog changes = read();
TransactionChangesLog tLog = new TransactionChangesLog(changes);
tLog.setSystemId(Constants.JCR_CORE_RESTORE_WORKSPACE_INITIALIZER_SYSTEM_ID); // mark changes
dataManager.save(tLog);
} | java | protected void doRestore() throws Throwable
{
PlainChangesLog changes = read();
TransactionChangesLog tLog = new TransactionChangesLog(changes);
tLog.setSystemId(Constants.JCR_CORE_RESTORE_WORKSPACE_INITIALIZER_SYSTEM_ID); // mark changes
dataManager.save(tLog);
} | [
"protected",
"void",
"doRestore",
"(",
")",
"throws",
"Throwable",
"{",
"PlainChangesLog",
"changes",
"=",
"read",
"(",
")",
";",
"TransactionChangesLog",
"tLog",
"=",
"new",
"TransactionChangesLog",
"(",
"changes",
")",
";",
"tLog",
".",
"setSystemId",
"(",
"... | Perform restore operation. | [
"Perform",
"restore",
"operation",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SysViewWorkspaceInitializer.java#L532-L540 | train |
exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/UserByQueryJCRUserListAccess.java | UserByQueryJCRUserListAccess.removeAsterisk | private String removeAsterisk(String str)
{
if (str.startsWith("*"))
{
str = str.substring(1);
}
if (str.endsWith("*"))
{
str = str.substring(0, str.length() - 1);
}
return str;
} | java | private String removeAsterisk(String str)
{
if (str.startsWith("*"))
{
str = str.substring(1);
}
if (str.endsWith("*"))
{
str = str.substring(0, str.length() - 1);
}
return str;
} | [
"private",
"String",
"removeAsterisk",
"(",
"String",
"str",
")",
"{",
"if",
"(",
"str",
".",
"startsWith",
"(",
"\"*\"",
")",
")",
"{",
"str",
"=",
"str",
".",
"substring",
"(",
"1",
")",
";",
"}",
"if",
"(",
"str",
".",
"endsWith",
"(",
"\"*\"",
... | Removes asterisk from beginning and from end of statement. | [
"Removes",
"asterisk",
"from",
"beginning",
"and",
"from",
"end",
"of",
"statement",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/UserByQueryJCRUserListAccess.java#L70-L83 | train |
exoplatform/jcr | exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/VersionHistoryResource.java | VersionHistoryResource.getVersions | public Set<VersionResource> getVersions() throws RepositoryException, IllegalResourceTypeException
{
Set<VersionResource> resources = new HashSet<VersionResource>();
VersionIterator versions = versionHistory.getAllVersions();
while (versions.hasNext())
{
Version version = versi... | java | public Set<VersionResource> getVersions() throws RepositoryException, IllegalResourceTypeException
{
Set<VersionResource> resources = new HashSet<VersionResource>();
VersionIterator versions = versionHistory.getAllVersions();
while (versions.hasNext())
{
Version version = versi... | [
"public",
"Set",
"<",
"VersionResource",
">",
"getVersions",
"(",
")",
"throws",
"RepositoryException",
",",
"IllegalResourceTypeException",
"{",
"Set",
"<",
"VersionResource",
">",
"resources",
"=",
"new",
"HashSet",
"<",
"VersionResource",
">",
"(",
")",
";",
... | Returns all versions of a resource.
@return all versions of a resource
@throws RepositoryException {@link RepositoryException}
@throws IllegalResourceTypeException {@link IllegalResourceTypeException} | [
"Returns",
"all",
"versions",
"of",
"a",
"resource",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/VersionHistoryResource.java#L97-L113 | train |
exoplatform/jcr | exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/VersionHistoryResource.java | VersionHistoryResource.getVersion | public VersionResource getVersion(String name) throws RepositoryException, IllegalResourceTypeException
{
return new VersionResource(versionURI(name), versionedResource, versionHistory.getVersion(name), namespaceContext);
} | java | public VersionResource getVersion(String name) throws RepositoryException, IllegalResourceTypeException
{
return new VersionResource(versionURI(name), versionedResource, versionHistory.getVersion(name), namespaceContext);
} | [
"public",
"VersionResource",
"getVersion",
"(",
"String",
"name",
")",
"throws",
"RepositoryException",
",",
"IllegalResourceTypeException",
"{",
"return",
"new",
"VersionResource",
"(",
"versionURI",
"(",
"name",
")",
",",
"versionedResource",
",",
"versionHistory",
... | Returns the version of resouce by name.
@param name version name
@return version of a resource
@throws RepositoryException {@link RepositoryException}
@throws IllegalResourceTypeException {@link IllegalResourceTypeException} | [
"Returns",
"the",
"version",
"of",
"resouce",
"by",
"name",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/VersionHistoryResource.java#L123-L126 | train |
exoplatform/jcr | exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/VersionHistoryResource.java | VersionHistoryResource.versionURI | protected final URI versionURI(String versionName)
{
return URI.create(versionedResource.getIdentifier().toASCIIString() + "?version=" + versionName);
} | java | protected final URI versionURI(String versionName)
{
return URI.create(versionedResource.getIdentifier().toASCIIString() + "?version=" + versionName);
} | [
"protected",
"final",
"URI",
"versionURI",
"(",
"String",
"versionName",
")",
"{",
"return",
"URI",
".",
"create",
"(",
"versionedResource",
".",
"getIdentifier",
"(",
")",
".",
"toASCIIString",
"(",
")",
"+",
"\"?version=\"",
"+",
"versionName",
")",
";",
"... | Returns URI of the resource version.
@param versionName version name
@return URI of the resource version | [
"Returns",
"URI",
"of",
"the",
"resource",
"version",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/VersionHistoryResource.java#L134-L137 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/TreeFileIOChannel.java | TreeFileIOChannel.buildPathX8 | protected String buildPathX8(String fileName)
{
final int xLength = 8;
char[] chs = fileName.toCharArray();
StringBuilder path = new StringBuilder();
for (int i = 0; i < xLength; i++)
{
path.append(File.separator).append(chs[i]);
}
path.append(fileName.subs... | java | protected String buildPathX8(String fileName)
{
final int xLength = 8;
char[] chs = fileName.toCharArray();
StringBuilder path = new StringBuilder();
for (int i = 0; i < xLength; i++)
{
path.append(File.separator).append(chs[i]);
}
path.append(fileName.subs... | [
"protected",
"String",
"buildPathX8",
"(",
"String",
"fileName",
")",
"{",
"final",
"int",
"xLength",
"=",
"8",
";",
"char",
"[",
"]",
"chs",
"=",
"fileName",
".",
"toCharArray",
"(",
")",
";",
"StringBuilder",
"path",
"=",
"new",
"StringBuilder",
"(",
"... | best for now, 12.07.07 | [
"best",
"for",
"now",
"12",
".",
"07",
".",
"07"
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/TreeFileIOChannel.java#L102-L113 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/FileBasedNamespaceMappings.java | FileBasedNamespaceMappings.load | private void load() throws IOException
{
if (PrivilegedFileHelper.exists(storage))
{
InputStream in = PrivilegedFileHelper.fileInputStream(storage);
try
{
Properties props = new Properties();
log.debug("loading namespace mappings...");
props.... | java | private void load() throws IOException
{
if (PrivilegedFileHelper.exists(storage))
{
InputStream in = PrivilegedFileHelper.fileInputStream(storage);
try
{
Properties props = new Properties();
log.debug("loading namespace mappings...");
props.... | [
"private",
"void",
"load",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"PrivilegedFileHelper",
".",
"exists",
"(",
"storage",
")",
")",
"{",
"InputStream",
"in",
"=",
"PrivilegedFileHelper",
".",
"fileInputStream",
"(",
"storage",
")",
";",
"try",
"{"... | Loads currently known mappings from a .properties file.
@throws IOException if an error occurs while reading from the file. | [
"Loads",
"currently",
"known",
"mappings",
"from",
"a",
".",
"properties",
"file",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/FileBasedNamespaceMappings.java#L148-L177 | train |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/FileBasedNamespaceMappings.java | FileBasedNamespaceMappings.store | private void store() throws IOException
{
Properties props = new Properties();
// store mappings in properties
Iterator<String> iter = prefixToURI.keySet().iterator();
while (iter.hasNext())
{
String prefix = iter.next();
String uri = prefixToURI.get(prefix);
... | java | private void store() throws IOException
{
Properties props = new Properties();
// store mappings in properties
Iterator<String> iter = prefixToURI.keySet().iterator();
while (iter.hasNext())
{
String prefix = iter.next();
String uri = prefixToURI.get(prefix);
... | [
"private",
"void",
"store",
"(",
")",
"throws",
"IOException",
"{",
"Properties",
"props",
"=",
"new",
"Properties",
"(",
")",
";",
"// store mappings in properties",
"Iterator",
"<",
"String",
">",
"iter",
"=",
"prefixToURI",
".",
"keySet",
"(",
")",
".",
"... | Writes the currently known mappings into a .properties file.
@throws IOException if an error occurs while writing the file. | [
"Writes",
"the",
"currently",
"known",
"mappings",
"into",
"a",
".",
"properties",
"file",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/FileBasedNamespaceMappings.java#L184-L208 | train |
exoplatform/jcr | exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/registry/RegistryEntry.java | RegistryEntry.parse | public static RegistryEntry parse(final byte[] bytes) throws IOException, SAXException, ParserConfigurationException
{
try
{
return SecurityHelper.doPrivilegedExceptionAction(new PrivilegedExceptionAction<RegistryEntry>()
{
public RegistryEntry run() throws Exception
... | java | public static RegistryEntry parse(final byte[] bytes) throws IOException, SAXException, ParserConfigurationException
{
try
{
return SecurityHelper.doPrivilegedExceptionAction(new PrivilegedExceptionAction<RegistryEntry>()
{
public RegistryEntry run() throws Exception
... | [
"public",
"static",
"RegistryEntry",
"parse",
"(",
"final",
"byte",
"[",
"]",
"bytes",
")",
"throws",
"IOException",
",",
"SAXException",
",",
"ParserConfigurationException",
"{",
"try",
"{",
"return",
"SecurityHelper",
".",
"doPrivilegedExceptionAction",
"(",
"new"... | Factory method to create RegistryEntry from serialized XML
@param bytes
@return RegistryEntry
@throws IOException
@throws SAXException
@throws ParserConfigurationException | [
"Factory",
"method",
"to",
"create",
"RegistryEntry",
"from",
"serialized",
"XML"
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/registry/RegistryEntry.java#L98-L135 | train |
EsotericSoftware/jsonbeans | src/com/esotericsoftware/jsonbeans/Json.java | Json.addClassTag | public void addClassTag (String tag, Class type) {
tagToClass.put(tag, type);
classToTag.put(type, tag);
} | java | public void addClassTag (String tag, Class type) {
tagToClass.put(tag, type);
classToTag.put(type, tag);
} | [
"public",
"void",
"addClassTag",
"(",
"String",
"tag",
",",
"Class",
"type",
")",
"{",
"tagToClass",
".",
"put",
"(",
"tag",
",",
"type",
")",
";",
"classToTag",
".",
"put",
"(",
"type",
",",
"tag",
")",
";",
"}"
] | Sets a tag to use instead of the fully qualifier class name. This can make the JSON easier to read. | [
"Sets",
"a",
"tag",
"to",
"use",
"instead",
"of",
"the",
"fully",
"qualifier",
"class",
"name",
".",
"This",
"can",
"make",
"the",
"JSON",
"easier",
"to",
"read",
"."
] | ff4502d0ff86cc77aa5c61d47371d0c66c14fe2f | https://github.com/EsotericSoftware/jsonbeans/blob/ff4502d0ff86cc77aa5c61d47371d0c66c14fe2f/src/com/esotericsoftware/jsonbeans/Json.java#L96-L99 | train |
EsotericSoftware/jsonbeans | src/com/esotericsoftware/jsonbeans/Json.java | Json.setSerializer | public <T> void setSerializer (Class<T> type, JsonSerializer<T> serializer) {
classToSerializer.put(type, serializer);
} | java | public <T> void setSerializer (Class<T> type, JsonSerializer<T> serializer) {
classToSerializer.put(type, serializer);
} | [
"public",
"<",
"T",
">",
"void",
"setSerializer",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"JsonSerializer",
"<",
"T",
">",
"serializer",
")",
"{",
"classToSerializer",
".",
"put",
"(",
"type",
",",
"serializer",
")",
";",
"}"
] | Registers a serializer to use for the specified type instead of the default behavior of serializing all of an objects
fields. | [
"Registers",
"a",
"serializer",
"to",
"use",
"for",
"the",
"specified",
"type",
"instead",
"of",
"the",
"default",
"behavior",
"of",
"serializing",
"all",
"of",
"an",
"objects",
"fields",
"."
] | ff4502d0ff86cc77aa5c61d47371d0c66c14fe2f | https://github.com/EsotericSoftware/jsonbeans/blob/ff4502d0ff86cc77aa5c61d47371d0c66c14fe2f/src/com/esotericsoftware/jsonbeans/Json.java#L126-L128 | train |
EsotericSoftware/jsonbeans | src/com/esotericsoftware/jsonbeans/Json.java | Json.setElementType | public void setElementType (Class type, String fieldName, Class elementType) {
ObjectMap<String, FieldMetadata> fields = getFields(type);
FieldMetadata metadata = fields.get(fieldName);
if (metadata == null) throw new JsonException("Field not found: " + fieldName + " (" + type.getName() + ")");
metadata.ele... | java | public void setElementType (Class type, String fieldName, Class elementType) {
ObjectMap<String, FieldMetadata> fields = getFields(type);
FieldMetadata metadata = fields.get(fieldName);
if (metadata == null) throw new JsonException("Field not found: " + fieldName + " (" + type.getName() + ")");
metadata.ele... | [
"public",
"void",
"setElementType",
"(",
"Class",
"type",
",",
"String",
"fieldName",
",",
"Class",
"elementType",
")",
"{",
"ObjectMap",
"<",
"String",
",",
"FieldMetadata",
">",
"fields",
"=",
"getFields",
"(",
"type",
")",
";",
"FieldMetadata",
"metadata",
... | Sets the type of elements in a collection. When the element type is known, the class for each element in the collection
does not need to be written unless different from the element type. | [
"Sets",
"the",
"type",
"of",
"elements",
"in",
"a",
"collection",
".",
"When",
"the",
"element",
"type",
"is",
"known",
"the",
"class",
"for",
"each",
"element",
"in",
"the",
"collection",
"does",
"not",
"need",
"to",
"be",
"written",
"unless",
"different"... | ff4502d0ff86cc77aa5c61d47371d0c66c14fe2f | https://github.com/EsotericSoftware/jsonbeans/blob/ff4502d0ff86cc77aa5c61d47371d0c66c14fe2f/src/com/esotericsoftware/jsonbeans/Json.java#L141-L146 | train |
EsotericSoftware/jsonbeans | src/com/esotericsoftware/jsonbeans/Json.java | Json.setWriter | public void setWriter (Writer writer) {
if (!(writer instanceof JsonWriter)) writer = new JsonWriter(writer);
this.writer = (JsonWriter)writer;
this.writer.setOutputType(outputType);
this.writer.setQuoteLongValues(quoteLongValues);
} | java | public void setWriter (Writer writer) {
if (!(writer instanceof JsonWriter)) writer = new JsonWriter(writer);
this.writer = (JsonWriter)writer;
this.writer.setOutputType(outputType);
this.writer.setQuoteLongValues(quoteLongValues);
} | [
"public",
"void",
"setWriter",
"(",
"Writer",
"writer",
")",
"{",
"if",
"(",
"!",
"(",
"writer",
"instanceof",
"JsonWriter",
")",
")",
"writer",
"=",
"new",
"JsonWriter",
"(",
"writer",
")",
";",
"this",
".",
"writer",
"=",
"(",
"JsonWriter",
")",
"wri... | Sets the writer where JSON output will be written. This is only necessary when not using the toJson methods. | [
"Sets",
"the",
"writer",
"where",
"JSON",
"output",
"will",
"be",
"written",
".",
"This",
"is",
"only",
"necessary",
"when",
"not",
"using",
"the",
"toJson",
"methods",
"."
] | ff4502d0ff86cc77aa5c61d47371d0c66c14fe2f | https://github.com/EsotericSoftware/jsonbeans/blob/ff4502d0ff86cc77aa5c61d47371d0c66c14fe2f/src/com/esotericsoftware/jsonbeans/Json.java#L251-L256 | train |
EsotericSoftware/jsonbeans | src/com/esotericsoftware/jsonbeans/Json.java | Json.writeFields | public void writeFields (Object object) {
Class type = object.getClass();
Object[] defaultValues = getDefaultValues(type);
OrderedMap<String, FieldMetadata> fields = getFields(type);
int i = 0;
for (FieldMetadata metadata : new OrderedMapValues<FieldMetadata>(fields)) {
Field field = metadata.fie... | java | public void writeFields (Object object) {
Class type = object.getClass();
Object[] defaultValues = getDefaultValues(type);
OrderedMap<String, FieldMetadata> fields = getFields(type);
int i = 0;
for (FieldMetadata metadata : new OrderedMapValues<FieldMetadata>(fields)) {
Field field = metadata.fie... | [
"public",
"void",
"writeFields",
"(",
"Object",
"object",
")",
"{",
"Class",
"type",
"=",
"object",
".",
"getClass",
"(",
")",
";",
"Object",
"[",
"]",
"defaultValues",
"=",
"getDefaultValues",
"(",
"type",
")",
";",
"OrderedMap",
"<",
"String",
",",
"Fi... | Writes all fields of the specified object to the current JSON object. | [
"Writes",
"all",
"fields",
"of",
"the",
"specified",
"object",
"to",
"the",
"current",
"JSON",
"object",
"."
] | ff4502d0ff86cc77aa5c61d47371d0c66c14fe2f | https://github.com/EsotericSoftware/jsonbeans/blob/ff4502d0ff86cc77aa5c61d47371d0c66c14fe2f/src/com/esotericsoftware/jsonbeans/Json.java#L263-L301 | train |
EsotericSoftware/jsonbeans | src/com/esotericsoftware/jsonbeans/Json.java | Json.writeField | public void writeField (Object object, String fieldName, String jsonName, Class elementType) {
Class type = object.getClass();
ObjectMap<String, FieldMetadata> fields = getFields(type);
FieldMetadata metadata = fields.get(fieldName);
if (metadata == null) throw new JsonException("Field not found: " + fieldN... | java | public void writeField (Object object, String fieldName, String jsonName, Class elementType) {
Class type = object.getClass();
ObjectMap<String, FieldMetadata> fields = getFields(type);
FieldMetadata metadata = fields.get(fieldName);
if (metadata == null) throw new JsonException("Field not found: " + fieldN... | [
"public",
"void",
"writeField",
"(",
"Object",
"object",
",",
"String",
"fieldName",
",",
"String",
"jsonName",
",",
"Class",
"elementType",
")",
"{",
"Class",
"type",
"=",
"object",
".",
"getClass",
"(",
")",
";",
"ObjectMap",
"<",
"String",
",",
"FieldMe... | Writes the specified field to the current JSON object.
@param elementType May be null if the type is unknown. | [
"Writes",
"the",
"specified",
"field",
"to",
"the",
"current",
"JSON",
"object",
"."
] | ff4502d0ff86cc77aa5c61d47371d0c66c14fe2f | https://github.com/EsotericSoftware/jsonbeans/blob/ff4502d0ff86cc77aa5c61d47371d0c66c14fe2f/src/com/esotericsoftware/jsonbeans/Json.java#L355-L376 | train |
EsotericSoftware/jsonbeans | src/com/esotericsoftware/jsonbeans/Json.java | Json.writeValue | public void writeValue (String name, Object value) {
try {
writer.name(name);
} catch (IOException ex) {
throw new JsonException(ex);
}
if (value == null)
writeValue(value, null, null);
else
writeValue(value, value.getClass(), null);
} | java | public void writeValue (String name, Object value) {
try {
writer.name(name);
} catch (IOException ex) {
throw new JsonException(ex);
}
if (value == null)
writeValue(value, null, null);
else
writeValue(value, value.getClass(), null);
} | [
"public",
"void",
"writeValue",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"try",
"{",
"writer",
".",
"name",
"(",
"name",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"throw",
"new",
"JsonException",
"(",
"ex",
")",
";",... | Writes the value as a field on the current JSON object, without writing the actual class.
@param value May be null.
@see #writeValue(String, Object, Class, Class) | [
"Writes",
"the",
"value",
"as",
"a",
"field",
"on",
"the",
"current",
"JSON",
"object",
"without",
"writing",
"the",
"actual",
"class",
"."
] | ff4502d0ff86cc77aa5c61d47371d0c66c14fe2f | https://github.com/EsotericSoftware/jsonbeans/blob/ff4502d0ff86cc77aa5c61d47371d0c66c14fe2f/src/com/esotericsoftware/jsonbeans/Json.java#L381-L391 | train |
EsotericSoftware/jsonbeans | src/com/esotericsoftware/jsonbeans/Json.java | Json.writeValue | public void writeValue (String name, Object value, Class knownType) {
try {
writer.name(name);
} catch (IOException ex) {
throw new JsonException(ex);
}
writeValue(value, knownType, null);
} | java | public void writeValue (String name, Object value, Class knownType) {
try {
writer.name(name);
} catch (IOException ex) {
throw new JsonException(ex);
}
writeValue(value, knownType, null);
} | [
"public",
"void",
"writeValue",
"(",
"String",
"name",
",",
"Object",
"value",
",",
"Class",
"knownType",
")",
"{",
"try",
"{",
"writer",
".",
"name",
"(",
"name",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"throw",
"new",
"JsonExcepti... | Writes the value as a field on the current JSON object, writing the class of the object if it differs from the specified
known type.
@param value May be null.
@param knownType May be null if the type is unknown.
@see #writeValue(String, Object, Class, Class) | [
"Writes",
"the",
"value",
"as",
"a",
"field",
"on",
"the",
"current",
"JSON",
"object",
"writing",
"the",
"class",
"of",
"the",
"object",
"if",
"it",
"differs",
"from",
"the",
"specified",
"known",
"type",
"."
] | ff4502d0ff86cc77aa5c61d47371d0c66c14fe2f | https://github.com/EsotericSoftware/jsonbeans/blob/ff4502d0ff86cc77aa5c61d47371d0c66c14fe2f/src/com/esotericsoftware/jsonbeans/Json.java#L398-L405 | train |
EsotericSoftware/jsonbeans | src/com/esotericsoftware/jsonbeans/Json.java | Json.writeValue | public void writeValue (Object value) {
if (value == null)
writeValue(value, null, null);
else
writeValue(value, value.getClass(), null);
} | java | public void writeValue (Object value) {
if (value == null)
writeValue(value, null, null);
else
writeValue(value, value.getClass(), null);
} | [
"public",
"void",
"writeValue",
"(",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"writeValue",
"(",
"value",
",",
"null",
",",
"null",
")",
";",
"else",
"writeValue",
"(",
"value",
",",
"value",
".",
"getClass",
"(",
")",
",",... | Writes the value, without writing the class of the object.
@param value May be null. | [
"Writes",
"the",
"value",
"without",
"writing",
"the",
"class",
"of",
"the",
"object",
"."
] | ff4502d0ff86cc77aa5c61d47371d0c66c14fe2f | https://github.com/EsotericSoftware/jsonbeans/blob/ff4502d0ff86cc77aa5c61d47371d0c66c14fe2f/src/com/esotericsoftware/jsonbeans/Json.java#L423-L428 | train |
Coreoz/Wisp | src/main/java/com/coreoz/wisp/LongRunningJobMonitor.java | LongRunningJobMonitor.detectLongRunningJob | boolean detectLongRunningJob(long currentTime, Job job) {
if(job.status() == JobStatus.RUNNING && !longRunningJobs.containsKey(job)) {
int jobExecutionsCount = job.executionsCount();
Long jobStartedtimeInMillis = job.lastExecutionStartedTimeInMillis();
Thread threadRunningJob = job.threadRunningJob();
if... | java | boolean detectLongRunningJob(long currentTime, Job job) {
if(job.status() == JobStatus.RUNNING && !longRunningJobs.containsKey(job)) {
int jobExecutionsCount = job.executionsCount();
Long jobStartedtimeInMillis = job.lastExecutionStartedTimeInMillis();
Thread threadRunningJob = job.threadRunningJob();
if... | [
"boolean",
"detectLongRunningJob",
"(",
"long",
"currentTime",
",",
"Job",
"job",
")",
"{",
"if",
"(",
"job",
".",
"status",
"(",
")",
"==",
"JobStatus",
".",
"RUNNING",
"&&",
"!",
"longRunningJobs",
".",
"containsKey",
"(",
"job",
")",
")",
"{",
"int",
... | Check whether a job is running for too long or not.
@return true if the is running for too long, else false.
Returned value is made available for testing purposes. | [
"Check",
"whether",
"a",
"job",
"is",
"running",
"for",
"too",
"long",
"or",
"not",
"."
] | 6d5de3b88fbe259e327296eea167b18cf41c7641 | https://github.com/Coreoz/Wisp/blob/6d5de3b88fbe259e327296eea167b18cf41c7641/src/main/java/com/coreoz/wisp/LongRunningJobMonitor.java#L81-L110 | train |
Coreoz/Wisp | src/main/java/com/coreoz/wisp/Scheduler.java | Scheduler.schedule | public Job schedule(Runnable runnable, Schedule when) {
return schedule(null, runnable, when);
} | java | public Job schedule(Runnable runnable, Schedule when) {
return schedule(null, runnable, when);
} | [
"public",
"Job",
"schedule",
"(",
"Runnable",
"runnable",
",",
"Schedule",
"when",
")",
"{",
"return",
"schedule",
"(",
"null",
",",
"runnable",
",",
"when",
")",
";",
"}"
] | Schedule the executions of a process.
@param runnable The process to be executed at a schedule
@param when The {@link Schedule} at which the process will be executed
@return The corresponding {@link Job} created.
@throws NullPointerException if {@code runnable} or {@code when} are {@code null}
@throws IllegalArgumentE... | [
"Schedule",
"the",
"executions",
"of",
"a",
"process",
"."
] | 6d5de3b88fbe259e327296eea167b18cf41c7641 | https://github.com/Coreoz/Wisp/blob/6d5de3b88fbe259e327296eea167b18cf41c7641/src/main/java/com/coreoz/wisp/Scheduler.java#L163-L165 | train |
Coreoz/Wisp | src/main/java/com/coreoz/wisp/Scheduler.java | Scheduler.findJob | public Optional<Job> findJob(String name) {
return Optional.ofNullable(indexedJobsByName.get(name));
} | java | public Optional<Job> findJob(String name) {
return Optional.ofNullable(indexedJobsByName.get(name));
} | [
"public",
"Optional",
"<",
"Job",
">",
"findJob",
"(",
"String",
"name",
")",
"{",
"return",
"Optional",
".",
"ofNullable",
"(",
"indexedJobsByName",
".",
"get",
"(",
"name",
")",
")",
";",
"}"
] | Find a job by its name | [
"Find",
"a",
"job",
"by",
"its",
"name"
] | 6d5de3b88fbe259e327296eea167b18cf41c7641 | https://github.com/Coreoz/Wisp/blob/6d5de3b88fbe259e327296eea167b18cf41c7641/src/main/java/com/coreoz/wisp/Scheduler.java#L215-L217 | train |
Coreoz/Wisp | src/main/java/com/coreoz/wisp/Scheduler.java | Scheduler.gracefullyShutdown | @SneakyThrows
public void gracefullyShutdown(Duration timeout) {
logger.info("Shutting down...");
if(!shuttingDown) {
synchronized (this) {
shuttingDown = true;
threadPoolExecutor.shutdown();
}
// stops jobs that have not yet started to be executed
for(Job job : jobStatus()) {
Runnable ru... | java | @SneakyThrows
public void gracefullyShutdown(Duration timeout) {
logger.info("Shutting down...");
if(!shuttingDown) {
synchronized (this) {
shuttingDown = true;
threadPoolExecutor.shutdown();
}
// stops jobs that have not yet started to be executed
for(Job job : jobStatus()) {
Runnable ru... | [
"@",
"SneakyThrows",
"public",
"void",
"gracefullyShutdown",
"(",
"Duration",
"timeout",
")",
"{",
"logger",
".",
"info",
"(",
"\"Shutting down...\"",
")",
";",
"if",
"(",
"!",
"shuttingDown",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"shuttingDown",
... | Wait until the current running jobs are executed
and cancel jobs that are planned to be executed.
@param timeout The maximum time to wait
@throws InterruptedException if the shutdown lasts more than 10 seconds | [
"Wait",
"until",
"the",
"current",
"running",
"jobs",
"are",
"executed",
"and",
"cancel",
"jobs",
"that",
"are",
"planned",
"to",
"be",
"executed",
"."
] | 6d5de3b88fbe259e327296eea167b18cf41c7641 | https://github.com/Coreoz/Wisp/blob/6d5de3b88fbe259e327296eea167b18cf41c7641/src/main/java/com/coreoz/wisp/Scheduler.java#L292-L317 | train |
Coreoz/Wisp | src/main/java/com/coreoz/wisp/Scheduler.java | Scheduler.launcher | @SneakyThrows
private void launcher() {
while(!shuttingDown) {
Long timeBeforeNextExecution = null;
synchronized (this) {
if(nextExecutionsOrder.size() > 0) {
timeBeforeNextExecution = nextExecutionsOrder.get(0).nextExecutionTimeInMillis()
- timeProvider.currentTime();
}
}
if(timeBefo... | java | @SneakyThrows
private void launcher() {
while(!shuttingDown) {
Long timeBeforeNextExecution = null;
synchronized (this) {
if(nextExecutionsOrder.size() > 0) {
timeBeforeNextExecution = nextExecutionsOrder.get(0).nextExecutionTimeInMillis()
- timeProvider.currentTime();
}
}
if(timeBefo... | [
"@",
"SneakyThrows",
"private",
"void",
"launcher",
"(",
")",
"{",
"while",
"(",
"!",
"shuttingDown",
")",
"{",
"Long",
"timeBeforeNextExecution",
"=",
"null",
";",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"nextExecutionsOrder",
".",
"size",
"(",
... | The daemon that will be in charge of placing the jobs in the thread pool
when they are ready to be executed. | [
"The",
"daemon",
"that",
"will",
"be",
"in",
"charge",
"of",
"placing",
"the",
"jobs",
"in",
"the",
"thread",
"pool",
"when",
"they",
"are",
"ready",
"to",
"be",
"executed",
"."
] | 6d5de3b88fbe259e327296eea167b18cf41c7641 | https://github.com/Coreoz/Wisp/blob/6d5de3b88fbe259e327296eea167b18cf41c7641/src/main/java/com/coreoz/wisp/Scheduler.java#L413-L463 | train |
Coreoz/Wisp | src/main/java/com/coreoz/wisp/Scheduler.java | Scheduler.runJob | private void runJob(Job jobToRun) {
long startExecutionTime = timeProvider.currentTime();
long timeBeforeNextExecution = jobToRun.nextExecutionTimeInMillis() - startExecutionTime;
if(timeBeforeNextExecution < 0) {
logger.debug("Job '{}' execution is {}ms late", jobToRun.name(), -timeBeforeNextExecution);
}
... | java | private void runJob(Job jobToRun) {
long startExecutionTime = timeProvider.currentTime();
long timeBeforeNextExecution = jobToRun.nextExecutionTimeInMillis() - startExecutionTime;
if(timeBeforeNextExecution < 0) {
logger.debug("Job '{}' execution is {}ms late", jobToRun.name(), -timeBeforeNextExecution);
}
... | [
"private",
"void",
"runJob",
"(",
"Job",
"jobToRun",
")",
"{",
"long",
"startExecutionTime",
"=",
"timeProvider",
".",
"currentTime",
"(",
")",
";",
"long",
"timeBeforeNextExecution",
"=",
"jobToRun",
".",
"nextExecutionTimeInMillis",
"(",
")",
"-",
"startExecutio... | The wrapper around a job that will be executed in the thread pool.
It is especially in charge of logging, changing the job status
and checking for the next job to be executed.
@param jobToRun the job to execute | [
"The",
"wrapper",
"around",
"a",
"job",
"that",
"will",
"be",
"executed",
"in",
"the",
"thread",
"pool",
".",
"It",
"is",
"especially",
"in",
"charge",
"of",
"logging",
"changing",
"the",
"job",
"status",
"and",
"checking",
"for",
"the",
"next",
"job",
"... | 6d5de3b88fbe259e327296eea167b18cf41c7641 | https://github.com/Coreoz/Wisp/blob/6d5de3b88fbe259e327296eea167b18cf41c7641/src/main/java/com/coreoz/wisp/Scheduler.java#L471-L503 | train |
mmazi/rescu | src/main/java/si/mazi/rescu/HttpTemplate.java | HttpTemplate.configureURLConnection | private HttpURLConnection configureURLConnection(HttpMethod method, String urlString, Map<String, String> httpHeaders, int contentLength) throws IOException {
preconditionNotNull(method, "method cannot be null");
preconditionNotNull(urlString, "urlString cannot be null");
preconditionNotNull(ht... | java | private HttpURLConnection configureURLConnection(HttpMethod method, String urlString, Map<String, String> httpHeaders, int contentLength) throws IOException {
preconditionNotNull(method, "method cannot be null");
preconditionNotNull(urlString, "urlString cannot be null");
preconditionNotNull(ht... | [
"private",
"HttpURLConnection",
"configureURLConnection",
"(",
"HttpMethod",
"method",
",",
"String",
"urlString",
",",
"Map",
"<",
"String",
",",
"String",
">",
"httpHeaders",
",",
"int",
"contentLength",
")",
"throws",
"IOException",
"{",
"preconditionNotNull",
"(... | Provides an internal convenience method to allow easy overriding by test classes
@param method The HTTP method (e.g. GET, POST etc)
@param urlString A string representation of a URL
@param httpHeaders The HTTP headers (will override the defaults)
@param contentLength The Content-Length request property
@r... | [
"Provides",
"an",
"internal",
"convenience",
"method",
"to",
"allow",
"easy",
"overriding",
"by",
"test",
"classes"
] | 8a4f9367994da0a2617bd37acf0320c942e62de3 | https://github.com/mmazi/rescu/blob/8a4f9367994da0a2617bd37acf0320c942e62de3/src/main/java/si/mazi/rescu/HttpTemplate.java#L153-L179 | train |
mmazi/rescu | src/main/java/si/mazi/rescu/HttpTemplate.java | HttpTemplate.getResponseEncoding | String getResponseEncoding(URLConnection connection) {
String charset = null;
String contentType = connection.getHeaderField("Content-Type");
if (contentType != null) {
for (String param : contentType.replace(" ", "").split(";")) {
if (param.startsWith("charset=")) ... | java | String getResponseEncoding(URLConnection connection) {
String charset = null;
String contentType = connection.getHeaderField("Content-Type");
if (contentType != null) {
for (String param : contentType.replace(" ", "").split(";")) {
if (param.startsWith("charset=")) ... | [
"String",
"getResponseEncoding",
"(",
"URLConnection",
"connection",
")",
"{",
"String",
"charset",
"=",
"null",
";",
"String",
"contentType",
"=",
"connection",
".",
"getHeaderField",
"(",
"\"Content-Type\"",
")",
";",
"if",
"(",
"contentType",
"!=",
"null",
")... | Determine the response encoding if specified
@param connection The HTTP connection
@return The response encoding as a string (taken from "Content-Type") | [
"Determine",
"the",
"response",
"encoding",
"if",
"specified"
] | 8a4f9367994da0a2617bd37acf0320c942e62de3 | https://github.com/mmazi/rescu/blob/8a4f9367994da0a2617bd37acf0320c942e62de3/src/main/java/si/mazi/rescu/HttpTemplate.java#L253-L267 | train |
rototor/pdfbox-graphics2d | src/main/java/de/rototor/pdfbox/graphics2d/PdfBoxGraphics2DFontTextDrawerDefaultFonts.java | PdfBoxGraphics2DFontTextDrawerDefaultFonts.mapDefaultFonts | public static PDFont mapDefaultFonts(Font font) {
/*
* Map default font names to the matching families.
*/
if (fontNameEqualsAnyOf(font, Font.SANS_SERIF, Font.DIALOG, Font.DIALOG_INPUT, "Arial", "Helvetica"))
return chooseMatchingHelvetica(font);
if (fontNameEqualsAnyOf(font, Font.MONOSPACED, "courier", ... | java | public static PDFont mapDefaultFonts(Font font) {
/*
* Map default font names to the matching families.
*/
if (fontNameEqualsAnyOf(font, Font.SANS_SERIF, Font.DIALOG, Font.DIALOG_INPUT, "Arial", "Helvetica"))
return chooseMatchingHelvetica(font);
if (fontNameEqualsAnyOf(font, Font.MONOSPACED, "courier", ... | [
"public",
"static",
"PDFont",
"mapDefaultFonts",
"(",
"Font",
"font",
")",
"{",
"/*\n\t\t * Map default font names to the matching families.\n\t\t */",
"if",
"(",
"fontNameEqualsAnyOf",
"(",
"font",
",",
"Font",
".",
"SANS_SERIF",
",",
"Font",
".",
"DIALOG",
",",
"Fon... | Find a PDFont for the given font object, which does not need to be embedded.
@param font
font for which to find a suitable default font
@return null if no default font is found or a default font which does not
need to be embedded. | [
"Find",
"a",
"PDFont",
"for",
"the",
"given",
"font",
"object",
"which",
"does",
"not",
"need",
"to",
"be",
"embedded",
"."
] | 86d53942cf2c137edca59d45766927c077f49230 | https://github.com/rototor/pdfbox-graphics2d/blob/86d53942cf2c137edca59d45766927c077f49230/src/main/java/de/rototor/pdfbox/graphics2d/PdfBoxGraphics2DFontTextDrawerDefaultFonts.java#L41-L56 | train |
rototor/pdfbox-graphics2d | src/main/java/de/rototor/pdfbox/graphics2d/PdfBoxGraphics2DFontTextDrawerDefaultFonts.java | PdfBoxGraphics2DFontTextDrawerDefaultFonts.chooseMatchingTimes | public static PDFont chooseMatchingTimes(Font font) {
if ((font.getStyle() & (Font.ITALIC | Font.BOLD)) == (Font.ITALIC | Font.BOLD))
return PDType1Font.TIMES_BOLD_ITALIC;
if ((font.getStyle() & Font.ITALIC) == Font.ITALIC)
return PDType1Font.TIMES_ITALIC;
if ((font.getStyle() & Font.BOLD) == Font.BOLD)
... | java | public static PDFont chooseMatchingTimes(Font font) {
if ((font.getStyle() & (Font.ITALIC | Font.BOLD)) == (Font.ITALIC | Font.BOLD))
return PDType1Font.TIMES_BOLD_ITALIC;
if ((font.getStyle() & Font.ITALIC) == Font.ITALIC)
return PDType1Font.TIMES_ITALIC;
if ((font.getStyle() & Font.BOLD) == Font.BOLD)
... | [
"public",
"static",
"PDFont",
"chooseMatchingTimes",
"(",
"Font",
"font",
")",
"{",
"if",
"(",
"(",
"font",
".",
"getStyle",
"(",
")",
"&",
"(",
"Font",
".",
"ITALIC",
"|",
"Font",
".",
"BOLD",
")",
")",
"==",
"(",
"Font",
".",
"ITALIC",
"|",
"Font... | Get a PDType1Font.TIMES-variant, which matches the given font
@param font
Font to get the styles from
@return a PDFont Times variant which matches the style in the given Font
object. | [
"Get",
"a",
"PDType1Font",
".",
"TIMES",
"-",
"variant",
"which",
"matches",
"the",
"given",
"font"
] | 86d53942cf2c137edca59d45766927c077f49230 | https://github.com/rototor/pdfbox-graphics2d/blob/86d53942cf2c137edca59d45766927c077f49230/src/main/java/de/rototor/pdfbox/graphics2d/PdfBoxGraphics2DFontTextDrawerDefaultFonts.java#L75-L83 | train |
rototor/pdfbox-graphics2d | src/main/java/de/rototor/pdfbox/graphics2d/PdfBoxGraphics2DFontTextDrawerDefaultFonts.java | PdfBoxGraphics2DFontTextDrawerDefaultFonts.chooseMatchingCourier | public static PDFont chooseMatchingCourier(Font font) {
if ((font.getStyle() & (Font.ITALIC | Font.BOLD)) == (Font.ITALIC | Font.BOLD))
return PDType1Font.COURIER_BOLD_OBLIQUE;
if ((font.getStyle() & Font.ITALIC) == Font.ITALIC)
return PDType1Font.COURIER_OBLIQUE;
if ((font.getStyle() & Font.BOLD) == Font.B... | java | public static PDFont chooseMatchingCourier(Font font) {
if ((font.getStyle() & (Font.ITALIC | Font.BOLD)) == (Font.ITALIC | Font.BOLD))
return PDType1Font.COURIER_BOLD_OBLIQUE;
if ((font.getStyle() & Font.ITALIC) == Font.ITALIC)
return PDType1Font.COURIER_OBLIQUE;
if ((font.getStyle() & Font.BOLD) == Font.B... | [
"public",
"static",
"PDFont",
"chooseMatchingCourier",
"(",
"Font",
"font",
")",
"{",
"if",
"(",
"(",
"font",
".",
"getStyle",
"(",
")",
"&",
"(",
"Font",
".",
"ITALIC",
"|",
"Font",
".",
"BOLD",
")",
")",
"==",
"(",
"Font",
".",
"ITALIC",
"|",
"Fo... | Get a PDType1Font.COURIER-variant, which matches the given font
@param font
Font to get the styles from
@return a PDFont Courier variant which matches the style in the given Font
object. | [
"Get",
"a",
"PDType1Font",
".",
"COURIER",
"-",
"variant",
"which",
"matches",
"the",
"given",
"font"
] | 86d53942cf2c137edca59d45766927c077f49230 | https://github.com/rototor/pdfbox-graphics2d/blob/86d53942cf2c137edca59d45766927c077f49230/src/main/java/de/rototor/pdfbox/graphics2d/PdfBoxGraphics2DFontTextDrawerDefaultFonts.java#L93-L101 | train |
rototor/pdfbox-graphics2d | src/main/java/de/rototor/pdfbox/graphics2d/PdfBoxGraphics2DFontTextDrawerDefaultFonts.java | PdfBoxGraphics2DFontTextDrawerDefaultFonts.chooseMatchingHelvetica | public static PDFont chooseMatchingHelvetica(Font font) {
if ((font.getStyle() & (Font.ITALIC | Font.BOLD)) == (Font.ITALIC | Font.BOLD))
return PDType1Font.HELVETICA_BOLD_OBLIQUE;
if ((font.getStyle() & Font.ITALIC) == Font.ITALIC)
return PDType1Font.HELVETICA_OBLIQUE;
if ((font.getStyle() & Font.BOLD) == ... | java | public static PDFont chooseMatchingHelvetica(Font font) {
if ((font.getStyle() & (Font.ITALIC | Font.BOLD)) == (Font.ITALIC | Font.BOLD))
return PDType1Font.HELVETICA_BOLD_OBLIQUE;
if ((font.getStyle() & Font.ITALIC) == Font.ITALIC)
return PDType1Font.HELVETICA_OBLIQUE;
if ((font.getStyle() & Font.BOLD) == ... | [
"public",
"static",
"PDFont",
"chooseMatchingHelvetica",
"(",
"Font",
"font",
")",
"{",
"if",
"(",
"(",
"font",
".",
"getStyle",
"(",
")",
"&",
"(",
"Font",
".",
"ITALIC",
"|",
"Font",
".",
"BOLD",
")",
")",
"==",
"(",
"Font",
".",
"ITALIC",
"|",
"... | Get a PDType1Font.HELVETICA-variant, which matches the given font
@param font
Font to get the styles from
@return a PDFont Helvetica variant which matches the style in the given Font
object. | [
"Get",
"a",
"PDType1Font",
".",
"HELVETICA",
"-",
"variant",
"which",
"matches",
"the",
"given",
"font"
] | 86d53942cf2c137edca59d45766927c077f49230 | https://github.com/rototor/pdfbox-graphics2d/blob/86d53942cf2c137edca59d45766927c077f49230/src/main/java/de/rototor/pdfbox/graphics2d/PdfBoxGraphics2DFontTextDrawerDefaultFonts.java#L111-L119 | train |
rototor/pdfbox-graphics2d | src/main/java/de/rototor/pdfbox/graphics2d/PdfBoxGraphics2DFontTextDrawer.java | PdfBoxGraphics2DFontTextDrawer.registerFont | @SuppressWarnings("WeakerAccess")
public void registerFont(String fontName, File fontFile) {
if (!fontFile.exists())
throw new IllegalArgumentException("Font " + fontFile + " does not exist!");
FontEntry entry = new FontEntry();
entry.overrideName = fontName;
entry.file = fontFile;
fontFiles.add(entry);
... | java | @SuppressWarnings("WeakerAccess")
public void registerFont(String fontName, File fontFile) {
if (!fontFile.exists())
throw new IllegalArgumentException("Font " + fontFile + " does not exist!");
FontEntry entry = new FontEntry();
entry.overrideName = fontName;
entry.file = fontFile;
fontFiles.add(entry);
... | [
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"public",
"void",
"registerFont",
"(",
"String",
"fontName",
",",
"File",
"fontFile",
")",
"{",
"if",
"(",
"!",
"fontFile",
".",
"exists",
"(",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
... | Register a font.
@param fontName
the name of the font to use. If null, the name is taken from the
font.
@param fontFile
the font file. This file must exist for the live time of this
object, as the font data will be read lazy on demand | [
"Register",
"a",
"font",
"."
] | 86d53942cf2c137edca59d45766927c077f49230 | https://github.com/rototor/pdfbox-graphics2d/blob/86d53942cf2c137edca59d45766927c077f49230/src/main/java/de/rototor/pdfbox/graphics2d/PdfBoxGraphics2DFontTextDrawer.java#L106-L114 | train |
rototor/pdfbox-graphics2d | src/main/java/de/rototor/pdfbox/graphics2d/PdfBoxGraphics2DFontTextDrawer.java | PdfBoxGraphics2DFontTextDrawer.registerFont | @SuppressWarnings("WeakerAccess")
public void registerFont(String name, PDFont font) {
fontMap.put(name, font);
} | java | @SuppressWarnings("WeakerAccess")
public void registerFont(String name, PDFont font) {
fontMap.put(name, font);
} | [
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"public",
"void",
"registerFont",
"(",
"String",
"name",
",",
"PDFont",
"font",
")",
"{",
"fontMap",
".",
"put",
"(",
"name",
",",
"font",
")",
";",
"}"
] | Register a font which is already associated with the PDDocument
@param name
the name of the font as returned by
{@link java.awt.Font#getFontName()}. This name is used for the
mapping the java.awt.Font to this PDFont.
@param font
the PDFont to use. This font must be loaded in the current
document. | [
"Register",
"a",
"font",
"which",
"is",
"already",
"associated",
"with",
"the",
"PDDocument"
] | 86d53942cf2c137edca59d45766927c077f49230 | https://github.com/rototor/pdfbox-graphics2d/blob/86d53942cf2c137edca59d45766927c077f49230/src/main/java/de/rototor/pdfbox/graphics2d/PdfBoxGraphics2DFontTextDrawer.java#L152-L155 | train |
rototor/pdfbox-graphics2d | src/main/java/de/rototor/pdfbox/graphics2d/PdfBoxGraphics2DFontTextDrawer.java | PdfBoxGraphics2DFontTextDrawer.mapFont | @SuppressWarnings("WeakerAccess")
protected PDFont mapFont(final Font font, final IFontTextDrawerEnv env) throws IOException, FontFormatException {
/*
* If we have any font registering's, we must perform them now
*/
for (final FontEntry fontEntry : fontFiles) {
if (fontEntry.overrideName == null) {
Fo... | java | @SuppressWarnings("WeakerAccess")
protected PDFont mapFont(final Font font, final IFontTextDrawerEnv env) throws IOException, FontFormatException {
/*
* If we have any font registering's, we must perform them now
*/
for (final FontEntry fontEntry : fontFiles) {
if (fontEntry.overrideName == null) {
Fo... | [
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"protected",
"PDFont",
"mapFont",
"(",
"final",
"Font",
"font",
",",
"final",
"IFontTextDrawerEnv",
"env",
")",
"throws",
"IOException",
",",
"FontFormatException",
"{",
"/*\n\t\t * If we have any font registering's, ... | Try to map the java.awt.Font to a PDFont.
@param font
the java.awt.Font for which a mapping should be found
@param env
environment of the font mapper
@return the PDFont or null if none can be found. | [
"Try",
"to",
"map",
"the",
"java",
".",
"awt",
".",
"Font",
"to",
"a",
"PDFont",
"."
] | 86d53942cf2c137edca59d45766927c077f49230 | https://github.com/rototor/pdfbox-graphics2d/blob/86d53942cf2c137edca59d45766927c077f49230/src/main/java/de/rototor/pdfbox/graphics2d/PdfBoxGraphics2DFontTextDrawer.java#L408-L439 | train |
telly/MrVector | library/src/main/java/com/telly/mrvector/VectorDrawable.java | VectorDrawable.getPixelSize | public float getPixelSize() {
if (mVectorState == null && mVectorState.mVPathRenderer == null ||
mVectorState.mVPathRenderer.mBaseWidth == 0 ||
mVectorState.mVPathRenderer.mBaseHeight == 0 ||
mVectorState.mVPathRenderer.mViewportHeight == 0 ||
mVectorState.mVPathRenderer.mViewportWid... | java | public float getPixelSize() {
if (mVectorState == null && mVectorState.mVPathRenderer == null ||
mVectorState.mVPathRenderer.mBaseWidth == 0 ||
mVectorState.mVPathRenderer.mBaseHeight == 0 ||
mVectorState.mVPathRenderer.mViewportHeight == 0 ||
mVectorState.mVPathRenderer.mViewportWid... | [
"public",
"float",
"getPixelSize",
"(",
")",
"{",
"if",
"(",
"mVectorState",
"==",
"null",
"&&",
"mVectorState",
".",
"mVPathRenderer",
"==",
"null",
"||",
"mVectorState",
".",
"mVPathRenderer",
".",
"mBaseWidth",
"==",
"0",
"||",
"mVectorState",
".",
"mVPathR... | The size of a pixel when scaled from the intrinsic dimension to the viewport dimension.
This is used to calculate the path animation accuracy.
@hide | [
"The",
"size",
"of",
"a",
"pixel",
"when",
"scaled",
"from",
"the",
"intrinsic",
"dimension",
"to",
"the",
"viewport",
"dimension",
".",
"This",
"is",
"used",
"to",
"calculate",
"the",
"path",
"animation",
"accuracy",
"."
] | 846cd05ab6e57dcdc1cae28e796ac84b1d6365d5 | https://github.com/telly/MrVector/blob/846cd05ab6e57dcdc1cae28e796ac84b1d6365d5/library/src/main/java/com/telly/mrvector/VectorDrawable.java#L410-L425 | train |
otto-de/edison-hal | example-springboot/src/main/java/de/otto/edison/hal/example/web/HomeController.java | HomeController.getHomeDocument | @RequestMapping(
path = "/api",
method = RequestMethod.GET,
produces = {"application/hal+json", "application/json"}
)
public HalRepresentation getHomeDocument(final HttpServletRequest request) {
final String homeUrl = request.getRequestURL().toString();
return... | java | @RequestMapping(
path = "/api",
method = RequestMethod.GET,
produces = {"application/hal+json", "application/json"}
)
public HalRepresentation getHomeDocument(final HttpServletRequest request) {
final String homeUrl = request.getRequestURL().toString();
return... | [
"@",
"RequestMapping",
"(",
"path",
"=",
"\"/api\"",
",",
"method",
"=",
"RequestMethod",
".",
"GET",
",",
"produces",
"=",
"{",
"\"application/hal+json\"",
",",
"\"application/json\"",
"}",
")",
"public",
"HalRepresentation",
"getHomeDocument",
"(",
"final",
"Htt... | Entry point for the products REST API.
@param request current request
@return application/hal+json document containing links to the API. | [
"Entry",
"point",
"for",
"the",
"products",
"REST",
"API",
"."
] | 1582d2b49d1f0d9103e03bf742f18afa9d166992 | https://github.com/otto-de/edison-hal/blob/1582d2b49d1f0d9103e03bf742f18afa9d166992/example-springboot/src/main/java/de/otto/edison/hal/example/web/HomeController.java#L22-L38 | train |
otto-de/edison-hal | src/main/java/de/otto/edison/hal/Link.java | Link.copyOf | public static Builder copyOf(final Link prototype) {
return new Builder(prototype.rel, prototype.href)
.withType(prototype.type)
.withProfile(prototype.profile)
.withTitle(prototype.title)
.withName(prototype.name)
.withDeprecation(... | java | public static Builder copyOf(final Link prototype) {
return new Builder(prototype.rel, prototype.href)
.withType(prototype.type)
.withProfile(prototype.profile)
.withTitle(prototype.title)
.withName(prototype.name)
.withDeprecation(... | [
"public",
"static",
"Builder",
"copyOf",
"(",
"final",
"Link",
"prototype",
")",
"{",
"return",
"new",
"Builder",
"(",
"prototype",
".",
"rel",
",",
"prototype",
".",
"href",
")",
".",
"withType",
"(",
"prototype",
".",
"type",
")",
".",
"withProfile",
"... | Create a Builder instance and initialize it from a prototype Link.
@param prototype the prototype link
@return a Builder for a Link.
@since 0.1.0 | [
"Create",
"a",
"Builder",
"instance",
"and",
"initialize",
"it",
"from",
"a",
"prototype",
"Link",
"."
] | 1582d2b49d1f0d9103e03bf742f18afa9d166992 | https://github.com/otto-de/edison-hal/blob/1582d2b49d1f0d9103e03bf742f18afa9d166992/src/main/java/de/otto/edison/hal/Link.java#L232-L240 | train |
otto-de/edison-hal | src/main/java/de/otto/edison/hal/Embedded.java | Embedded.embedded | public static Embedded embedded(final String rel,
final HalRepresentation embeddedItem) {
return new Embedded(singletonMap(rel, embeddedItem));
} | java | public static Embedded embedded(final String rel,
final HalRepresentation embeddedItem) {
return new Embedded(singletonMap(rel, embeddedItem));
} | [
"public",
"static",
"Embedded",
"embedded",
"(",
"final",
"String",
"rel",
",",
"final",
"HalRepresentation",
"embeddedItem",
")",
"{",
"return",
"new",
"Embedded",
"(",
"singletonMap",
"(",
"rel",
",",
"embeddedItem",
")",
")",
";",
"}"
] | Create an Embedded instance with a single embedded HalRepresentations that will be rendered as a single
item instead of an array of embedded items.
@param rel the link-relation type of the embedded items
@param embeddedItem the single embedded item
@return Embedded
@since 2.0.0 | [
"Create",
"an",
"Embedded",
"instance",
"with",
"a",
"single",
"embedded",
"HalRepresentations",
"that",
"will",
"be",
"rendered",
"as",
"a",
"single",
"item",
"instead",
"of",
"an",
"array",
"of",
"embedded",
"items",
"."
] | 1582d2b49d1f0d9103e03bf742f18afa9d166992 | https://github.com/otto-de/edison-hal/blob/1582d2b49d1f0d9103e03bf742f18afa9d166992/src/main/java/de/otto/edison/hal/Embedded.java#L121-L124 | train |
otto-de/edison-hal | src/main/java/de/otto/edison/hal/Embedded.java | Embedded.embedded | public static Embedded embedded(final String rel,
final List<? extends HalRepresentation> embeddedRepresentations) {
return new Embedded(singletonMap(rel, new ArrayList<>(embeddedRepresentations)));
} | java | public static Embedded embedded(final String rel,
final List<? extends HalRepresentation> embeddedRepresentations) {
return new Embedded(singletonMap(rel, new ArrayList<>(embeddedRepresentations)));
} | [
"public",
"static",
"Embedded",
"embedded",
"(",
"final",
"String",
"rel",
",",
"final",
"List",
"<",
"?",
"extends",
"HalRepresentation",
">",
"embeddedRepresentations",
")",
"{",
"return",
"new",
"Embedded",
"(",
"singletonMap",
"(",
"rel",
",",
"new",
"Arra... | Create an Embedded instance with a list of nested HalRepresentations for a single link-relation type.
@param rel the link-relation type of the embedded representations
@param embeddedRepresentations the list of embedded representations
@return Embedded
@since 0.1.0 | [
"Create",
"an",
"Embedded",
"instance",
"with",
"a",
"list",
"of",
"nested",
"HalRepresentations",
"for",
"a",
"single",
"link",
"-",
"relation",
"type",
"."
] | 1582d2b49d1f0d9103e03bf742f18afa9d166992 | https://github.com/otto-de/edison-hal/blob/1582d2b49d1f0d9103e03bf742f18afa9d166992/src/main/java/de/otto/edison/hal/Embedded.java#L135-L138 | train |
otto-de/edison-hal | src/main/java/de/otto/edison/hal/paging/NumberedPaging.java | NumberedPaging.calcLastPage | private int calcLastPage(int total, int pageSize) {
if (total == 0) {
return firstPage;
} else {
final int zeroBasedPageNo = total % pageSize > 0
? total / pageSize
: total / pageSize - 1;
return firstPage + zeroBasedPageNo;
... | java | private int calcLastPage(int total, int pageSize) {
if (total == 0) {
return firstPage;
} else {
final int zeroBasedPageNo = total % pageSize > 0
? total / pageSize
: total / pageSize - 1;
return firstPage + zeroBasedPageNo;
... | [
"private",
"int",
"calcLastPage",
"(",
"int",
"total",
",",
"int",
"pageSize",
")",
"{",
"if",
"(",
"total",
"==",
"0",
")",
"{",
"return",
"firstPage",
";",
"}",
"else",
"{",
"final",
"int",
"zeroBasedPageNo",
"=",
"total",
"%",
"pageSize",
">",
"0",
... | Returns the number of the last page, if the total number of items is known.
@param total total number of items
@param pageSize the current page size
@return page number of the last page | [
"Returns",
"the",
"number",
"of",
"the",
"last",
"page",
"if",
"the",
"total",
"number",
"of",
"items",
"is",
"known",
"."
] | 1582d2b49d1f0d9103e03bf742f18afa9d166992 | https://github.com/otto-de/edison-hal/blob/1582d2b49d1f0d9103e03bf742f18afa9d166992/src/main/java/de/otto/edison/hal/paging/NumberedPaging.java#L321-L330 | train |
otto-de/edison-hal | src/main/java/de/otto/edison/hal/paging/NumberedPaging.java | NumberedPaging.pageUri | private String pageUri(final UriTemplate uriTemplate, final int pageNumber, final int pageSize) {
if (pageSize == MAX_VALUE) {
return uriTemplate.expand();
}
return uriTemplate.set(pageNumberVar(), pageNumber).set(pageSizeVar(), pageSize).expand();
} | java | private String pageUri(final UriTemplate uriTemplate, final int pageNumber, final int pageSize) {
if (pageSize == MAX_VALUE) {
return uriTemplate.expand();
}
return uriTemplate.set(pageNumberVar(), pageNumber).set(pageSizeVar(), pageSize).expand();
} | [
"private",
"String",
"pageUri",
"(",
"final",
"UriTemplate",
"uriTemplate",
",",
"final",
"int",
"pageNumber",
",",
"final",
"int",
"pageSize",
")",
"{",
"if",
"(",
"pageSize",
"==",
"MAX_VALUE",
")",
"{",
"return",
"uriTemplate",
".",
"expand",
"(",
")",
... | Return the HREF of the page specified by UriTemplate, pageNumber and pageSize.
@param uriTemplate the template used to build hrefs.
@param pageNumber the number of the linked page.
@param pageSize the size of the pages.
@return href of the linked page. | [
"Return",
"the",
"HREF",
"of",
"the",
"page",
"specified",
"by",
"UriTemplate",
"pageNumber",
"and",
"pageSize",
"."
] | 1582d2b49d1f0d9103e03bf742f18afa9d166992 | https://github.com/otto-de/edison-hal/blob/1582d2b49d1f0d9103e03bf742f18afa9d166992/src/main/java/de/otto/edison/hal/paging/NumberedPaging.java#L340-L345 | train |
otto-de/edison-hal | src/main/java/de/otto/edison/hal/Links.java | Links.stream | @SuppressWarnings("rawtypes")
public Stream<Link> stream() {
return links.values()
.stream()
.map(obj -> {
if (obj instanceof List) {
return (List) obj;
} else {
return singletonList(obj);... | java | @SuppressWarnings("rawtypes")
public Stream<Link> stream() {
return links.values()
.stream()
.map(obj -> {
if (obj instanceof List) {
return (List) obj;
} else {
return singletonList(obj);... | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"public",
"Stream",
"<",
"Link",
">",
"stream",
"(",
")",
"{",
"return",
"links",
".",
"values",
"(",
")",
".",
"stream",
"(",
")",
".",
"map",
"(",
"obj",
"->",
"{",
"if",
"(",
"obj",
"instanceof",
... | Returns a Stream of links.
@return Stream of Links | [
"Returns",
"a",
"Stream",
"of",
"links",
"."
] | 1582d2b49d1f0d9103e03bf742f18afa9d166992 | https://github.com/otto-de/edison-hal/blob/1582d2b49d1f0d9103e03bf742f18afa9d166992/src/main/java/de/otto/edison/hal/Links.java#L136-L148 | train |
otto-de/edison-hal | src/main/java/de/otto/edison/hal/paging/SkipLimitPaging.java | SkipLimitPaging.calcLastPageSkip | private int calcLastPageSkip(int total, int skip, int limit) {
if (skip > total - limit) {
return skip;
}
if (total % limit > 0) {
return total - total % limit;
}
return total - limit;
} | java | private int calcLastPageSkip(int total, int skip, int limit) {
if (skip > total - limit) {
return skip;
}
if (total % limit > 0) {
return total - total % limit;
}
return total - limit;
} | [
"private",
"int",
"calcLastPageSkip",
"(",
"int",
"total",
",",
"int",
"skip",
",",
"int",
"limit",
")",
"{",
"if",
"(",
"skip",
">",
"total",
"-",
"limit",
")",
"{",
"return",
"skip",
";",
"}",
"if",
"(",
"total",
"%",
"limit",
">",
"0",
")",
"{... | Calculate the number of items to skip for the last page.
@param total total number of items.
@param skip number of items to skip for the current page.
@param limit page size
@return skipped items | [
"Calculate",
"the",
"number",
"of",
"items",
"to",
"skip",
"for",
"the",
"last",
"page",
"."
] | 1582d2b49d1f0d9103e03bf742f18afa9d166992 | https://github.com/otto-de/edison-hal/blob/1582d2b49d1f0d9103e03bf742f18afa9d166992/src/main/java/de/otto/edison/hal/paging/SkipLimitPaging.java#L278-L286 | train |
otto-de/edison-hal | src/main/java/de/otto/edison/hal/paging/SkipLimitPaging.java | SkipLimitPaging.pageUri | private String pageUri(final UriTemplate uriTemplate, final int skip, final int limit) {
if (limit == MAX_VALUE) {
return uriTemplate.expand();
}
return uriTemplate.set(skipVar(), skip).set(limitVar(), limit).expand();
} | java | private String pageUri(final UriTemplate uriTemplate, final int skip, final int limit) {
if (limit == MAX_VALUE) {
return uriTemplate.expand();
}
return uriTemplate.set(skipVar(), skip).set(limitVar(), limit).expand();
} | [
"private",
"String",
"pageUri",
"(",
"final",
"UriTemplate",
"uriTemplate",
",",
"final",
"int",
"skip",
",",
"final",
"int",
"limit",
")",
"{",
"if",
"(",
"limit",
"==",
"MAX_VALUE",
")",
"{",
"return",
"uriTemplate",
".",
"expand",
"(",
")",
";",
"}",
... | Return the URI of the page with N skipped items and a page limitted to pages of size M.
@param uriTemplate the template used to create the link
@param skip the number of skipped items
@param limit the page size
@return href | [
"Return",
"the",
"URI",
"of",
"the",
"page",
"with",
"N",
"skipped",
"items",
"and",
"a",
"page",
"limitted",
"to",
"pages",
"of",
"size",
"M",
"."
] | 1582d2b49d1f0d9103e03bf742f18afa9d166992 | https://github.com/otto-de/edison-hal/blob/1582d2b49d1f0d9103e03bf742f18afa9d166992/src/main/java/de/otto/edison/hal/paging/SkipLimitPaging.java#L295-L300 | train |
otto-de/edison-hal | example-springboot/src/main/java/de/otto/edison/hal/example/shop/ProductSearchService.java | ProductSearchService.searchFor | public List<Product> searchFor(final Optional<String> searchTerm) {
if (searchTerm.isPresent()) {
return products
.stream()
.filter(matchingProductsFor(searchTerm.get()))
.collect(toList());
} else {
return products;
... | java | public List<Product> searchFor(final Optional<String> searchTerm) {
if (searchTerm.isPresent()) {
return products
.stream()
.filter(matchingProductsFor(searchTerm.get()))
.collect(toList());
} else {
return products;
... | [
"public",
"List",
"<",
"Product",
">",
"searchFor",
"(",
"final",
"Optional",
"<",
"String",
">",
"searchTerm",
")",
"{",
"if",
"(",
"searchTerm",
".",
"isPresent",
"(",
")",
")",
"{",
"return",
"products",
".",
"stream",
"(",
")",
".",
"filter",
"(",
... | Searches for products using a case-insensitive search term.
@param searchTerm expression to search for
@return List of matching products, or an empty list. | [
"Searches",
"for",
"products",
"using",
"a",
"case",
"-",
"insensitive",
"search",
"term",
"."
] | 1582d2b49d1f0d9103e03bf742f18afa9d166992 | https://github.com/otto-de/edison-hal/blob/1582d2b49d1f0d9103e03bf742f18afa9d166992/example-springboot/src/main/java/de/otto/edison/hal/example/shop/ProductSearchService.java#L62-L72 | train |
otto-de/edison-hal | src/main/java/de/otto/edison/hal/HalRepresentation.java | HalRepresentation.mergeWithEmbedding | HalRepresentation mergeWithEmbedding(final Curies curies) {
this.curies = this.curies.mergeWith(curies);
if (this.links != null) {
removeDuplicateCuriesFromEmbedding(curies);
this.links = this.links.using(this.curies);
if (embedded != null) {
embedde... | java | HalRepresentation mergeWithEmbedding(final Curies curies) {
this.curies = this.curies.mergeWith(curies);
if (this.links != null) {
removeDuplicateCuriesFromEmbedding(curies);
this.links = this.links.using(this.curies);
if (embedded != null) {
embedde... | [
"HalRepresentation",
"mergeWithEmbedding",
"(",
"final",
"Curies",
"curies",
")",
"{",
"this",
".",
"curies",
"=",
"this",
".",
"curies",
".",
"mergeWith",
"(",
"curies",
")",
";",
"if",
"(",
"this",
".",
"links",
"!=",
"null",
")",
"{",
"removeDuplicateCu... | Merges the Curies of an embedded resource with the Curies of this resource and updates
link-relation types in _links and _embedded items.
@param curies the Curies of the embedding resource
@return this | [
"Merges",
"the",
"Curies",
"of",
"an",
"embedded",
"resource",
"with",
"the",
"Curies",
"of",
"this",
"resource",
"and",
"updates",
"link",
"-",
"relation",
"types",
"in",
"_links",
"and",
"_embedded",
"items",
"."
] | 1582d2b49d1f0d9103e03bf742f18afa9d166992 | https://github.com/otto-de/edison-hal/blob/1582d2b49d1f0d9103e03bf742f18afa9d166992/src/main/java/de/otto/edison/hal/HalRepresentation.java#L238-L254 | train |
otto-de/edison-hal | src/main/java/de/otto/edison/hal/HalParser.java | HalParser.as | public <T extends HalRepresentation> T as(final Class<T> type) throws IOException {
return objectMapper.readValue(json, type);
} | java | public <T extends HalRepresentation> T as(final Class<T> type) throws IOException {
return objectMapper.readValue(json, type);
} | [
"public",
"<",
"T",
"extends",
"HalRepresentation",
">",
"T",
"as",
"(",
"final",
"Class",
"<",
"T",
">",
"type",
")",
"throws",
"IOException",
"{",
"return",
"objectMapper",
".",
"readValue",
"(",
"json",
",",
"type",
")",
";",
"}"
] | Specify the type that is used to parse and map the json.
@param type the java type used to parse the JSON
@param <T> the type of the class, extending HalRepresentation
@return instance of T, containing the data of the parsed HAL document.
@throws IOException if a low-level I/O problem (unexpected end-of-input, network... | [
"Specify",
"the",
"type",
"that",
"is",
"used",
"to",
"parse",
"and",
"map",
"the",
"json",
"."
] | 1582d2b49d1f0d9103e03bf742f18afa9d166992 | https://github.com/otto-de/edison-hal/blob/1582d2b49d1f0d9103e03bf742f18afa9d166992/src/main/java/de/otto/edison/hal/HalParser.java#L133-L135 | train |
otto-de/edison-hal | src/main/java/de/otto/edison/hal/HalParser.java | HalParser.findPossiblyCuriedEmbeddedNode | private Optional<JsonNode> findPossiblyCuriedEmbeddedNode(final HalRepresentation halRepresentation,
final JsonNode jsonNode,
final String rel) {
final JsonNode embedded = jsonNode.get("_e... | java | private Optional<JsonNode> findPossiblyCuriedEmbeddedNode(final HalRepresentation halRepresentation,
final JsonNode jsonNode,
final String rel) {
final JsonNode embedded = jsonNode.get("_e... | [
"private",
"Optional",
"<",
"JsonNode",
">",
"findPossiblyCuriedEmbeddedNode",
"(",
"final",
"HalRepresentation",
"halRepresentation",
",",
"final",
"JsonNode",
"jsonNode",
",",
"final",
"String",
"rel",
")",
"{",
"final",
"JsonNode",
"embedded",
"=",
"jsonNode",
".... | Returns the JsonNode of the embedded items by link-relation type and resolves possibly curied rels.
@param halRepresentation the HAL document including the 'curies' links.
@param jsonNode the JsonNode of the document
@param rel the link-relation type of interest
@return JsonNode
@since 0.3.0 | [
"Returns",
"the",
"JsonNode",
"of",
"the",
"embedded",
"items",
"by",
"link",
"-",
"relation",
"type",
"and",
"resolves",
"possibly",
"curied",
"rels",
"."
] | 1582d2b49d1f0d9103e03bf742f18afa9d166992 | https://github.com/otto-de/edison-hal/blob/1582d2b49d1f0d9103e03bf742f18afa9d166992/src/main/java/de/otto/edison/hal/HalParser.java#L250-L265 | train |
otto-de/edison-hal | src/main/java/de/otto/edison/hal/Curies.java | Curies.register | public void register(final Link curi) {
if (!curi.getRel().equals("curies")) {
throw new IllegalArgumentException("Link must be a CURI");
}
final boolean alreadyRegistered = curies
.stream()
.anyMatch(link -> link.getHref().equals(curi.getHref()));
... | java | public void register(final Link curi) {
if (!curi.getRel().equals("curies")) {
throw new IllegalArgumentException("Link must be a CURI");
}
final boolean alreadyRegistered = curies
.stream()
.anyMatch(link -> link.getHref().equals(curi.getHref()));
... | [
"public",
"void",
"register",
"(",
"final",
"Link",
"curi",
")",
"{",
"if",
"(",
"!",
"curi",
".",
"getRel",
"(",
")",
".",
"equals",
"(",
"\"curies\"",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Link must be a CURI\"",
")",
";",
... | Registers a CURI link in the Curies instance.
@param curi the CURI
@throws IllegalArgumentException if the link-relation type of the link is not equal to 'curies' | [
"Registers",
"a",
"CURI",
"link",
"in",
"the",
"Curies",
"instance",
"."
] | 1582d2b49d1f0d9103e03bf742f18afa9d166992 | https://github.com/otto-de/edison-hal/blob/1582d2b49d1f0d9103e03bf742f18afa9d166992/src/main/java/de/otto/edison/hal/Curies.java#L93-L106 | train |
otto-de/edison-hal | src/main/java/de/otto/edison/hal/Curies.java | Curies.mergeWith | public Curies mergeWith(final Curies other) {
final Curies merged = copyOf(this);
other.curies.forEach(merged::register);
return merged;
} | java | public Curies mergeWith(final Curies other) {
final Curies merged = copyOf(this);
other.curies.forEach(merged::register);
return merged;
} | [
"public",
"Curies",
"mergeWith",
"(",
"final",
"Curies",
"other",
")",
"{",
"final",
"Curies",
"merged",
"=",
"copyOf",
"(",
"this",
")",
";",
"other",
".",
"curies",
".",
"forEach",
"(",
"merged",
"::",
"register",
")",
";",
"return",
"merged",
";",
"... | Merges this Curies with another instance of Curies and returns the merged instance.
@param other merged Curies
@return a merged copy of this and other | [
"Merges",
"this",
"Curies",
"with",
"another",
"instance",
"of",
"Curies",
"and",
"returns",
"the",
"merged",
"instance",
"."
] | 1582d2b49d1f0d9103e03bf742f18afa9d166992 | https://github.com/otto-de/edison-hal/blob/1582d2b49d1f0d9103e03bf742f18afa9d166992/src/main/java/de/otto/edison/hal/Curies.java#L114-L118 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.