本文整理汇总了Java中org.apache.chemistry.opencmis.commons.spi.Holder.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java Holder.getValue方法的具体用法?Java Holder.getValue怎么用?Java Holder.getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.chemistry.opencmis.commons.spi.Holder
的用法示例。
在下文中一共展示了Holder.getValue方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkOut
import org.apache.chemistry.opencmis.commons.spi.Holder; //导入方法依赖的package包/类
/**
* See CMIS 1.0 section 2.2.7.1 checkOut
*/
public void checkOut(Holder<String> objectId, Holder<Boolean> contentCopied) {
if(log.isTraceEnabled()) {
log.trace("<<<<<<<<< checkout for object id " + objectId.getValue());
}
// check id
if (objectId == null || objectId.getValue() == null) {
throw new CmisInvalidArgumentException("Object Id must be set.");
}
// get the node
RegistryObject gregNode = getGregNode(objectId.getValue());
if (!gregNode.isVersionable()) {
throw new CmisUpdateConflictException("Not a version: " + gregNode);
}
// checkout
RegistryPrivateWorkingCopy pwc = gregNode.asVersion().checkout();
objectId.setValue(pwc.getId());
if (contentCopied != null) {
contentCopied.setValue(true);
}
}
示例2: updateProperties
import org.apache.chemistry.opencmis.commons.spi.Holder; //导入方法依赖的package包/类
/**
* CMIS updateProperties.
*/
public ObjectData updateProperties(CallContext context, Holder<String> objectId, Properties properties,
ObjectInfoHandler objectInfos) {
boolean userReadOnly = checkUser(context, true);
// check object id
if (objectId == null || objectId.getValue() == null) {
throw new CmisInvalidArgumentException("Id is not valid!");
}
// get the file or folder
File file = getFile(objectId.getValue());
// check the properties
String typeId = (file.isDirectory() ? BaseTypeId.CMIS_FOLDER.value() : BaseTypeId.CMIS_DOCUMENT.value());
checkUpdateProperties(properties, typeId);
// get and check the new name
String newName = FileBridgeUtils.getStringProperty(properties, PropertyIds.NAME);
boolean isRename = (newName != null) && (!file.getName().equals(newName));
if (isRename && !isValidName(newName)) {
throw new CmisNameConstraintViolationException("Name is not valid!");
}
// rename file or folder if necessary
File newFile = file;
if (isRename) {
File parent = file.getParentFile();
newFile = new File(parent, newName);
if (!file.renameTo(newFile)) {
// if something went wrong, throw an exception
throw new CmisUpdateConflictException("Could not rename object!");
} else {
// set new id
objectId.setValue(getId(newFile));
}
}
return compileObjectData(context, newFile, null, false, false, userReadOnly, objectInfos);
}
示例3: checkIn
import org.apache.chemistry.opencmis.commons.spi.Holder; //导入方法依赖的package包/类
/**
* See CMIS 1.0 section 2.2.7.3 checkedIn
*/
public void checkIn(Holder<String> objectId, Boolean major, Properties properties,
ContentStream contentStream, String checkinComment) {
if(log.isTraceEnabled()) {
log.trace("<<<<<<< checkin for object id " + objectId.getValue());
}
// check id
if (objectId == null || objectId.getValue() == null) {
throw new CmisInvalidArgumentException("Object Id must be set.");
}
// get the node
RegistryObject gregNode;
try {
gregNode = getGregNode(objectId.getValue());
}
catch (CmisObjectNotFoundException e) {
throw new CmisUpdateConflictException(e.getCause().getMessage(), e.getCause());
}
if (!gregNode.isVersionable()) {
throw new CmisUpdateConflictException("Not a version: " + gregNode);
}
// checkin
RegistryVersion checkedIn = gregNode.asVersion().checkin(properties, contentStream, checkinComment);
objectId.setValue(checkedIn.getId());
}
示例4: getContentChanges
import org.apache.chemistry.opencmis.commons.spi.Holder; //导入方法依赖的package包/类
/**
* Returns content changes.
*/
public ObjectList getContentChanges(Holder<String> changeLogToken, BigInteger maxItems)
{
final ObjectListImpl result = new ObjectListImpl();
result.setObjects(new ArrayList<ObjectData>());
EntryIdCallback changeLogCollectingCallback = new EntryIdCallback(true)
{
@Override
public boolean handleAuditEntry(Long entryId, String user, long time, Map<String, Serializable> values)
{
result.getObjects().addAll(createChangeEvents(time, values));
return super.handleAuditEntry(entryId, user, time, values);
}
};
Long from = null;
if ((changeLogToken != null) && (changeLogToken.getValue() != null))
{
try
{
from = Long.parseLong(changeLogToken.getValue());
}
catch (NumberFormatException e)
{
throw new CmisInvalidArgumentException("Invalid change log token: " + changeLogToken);
}
}
AuditQueryParameters params = new AuditQueryParameters();
params.setApplicationName(CMIS_CHANGELOG_AUDIT_APPLICATION);
params.setForward(true);
params.setFromId(from);
// So we have a BigInteger. We need to ensure that we cut it down to an integer smaller than Integer.MAX_VALUE
int maxResults = (maxItems == null ? contentChangesDefaultMaxItems : maxItems.intValue());
maxResults = maxResults < 1 ? contentChangesDefaultMaxItems : maxResults; // Just a double check of the unbundled contents
maxResults = maxResults > contentChangesDefaultMaxItems ? contentChangesDefaultMaxItems : maxResults; // cut it down
int queryFor = maxResults + 1; // Query for 1 more so that we know if there are more results
auditService.auditQuery(changeLogCollectingCallback, params, queryFor);
String newChangeLogToken = null;
// Check if we got more than the client requested
if (result.getObjects().size() >= maxResults)
{
// Build the change log token from the last item
StringBuilder clt = new StringBuilder();
newChangeLogToken = (from == null ? clt.append(maxItems.intValue() + 1).toString() : clt.append(from.longValue() + maxItems.intValue()).toString()); // TODO: Make this readable
// Remove extra item that was not actually requested
result.getObjects().remove(result.getObjects().size() - 1).getId();
// Note to client that there are more items
result.setHasMoreItems(true);
}
else
{
// We got the same or fewer than the number requested, so there are no more items
result.setHasMoreItems(false);
}
if (changeLogToken != null)
{
changeLogToken.setValue(newChangeLogToken);
}
return result;
}
示例5: getContentChanges
import org.apache.chemistry.opencmis.commons.spi.Holder; //导入方法依赖的package包/类
/**
* Returns content changes.
*/
public ObjectList getContentChanges(Holder<String> changeLogToken, BigInteger maxItems)
{
final ObjectListImpl result = new ObjectListImpl();
result.setObjects(new ArrayList<ObjectData>());
EntryIdCallback changeLogCollectingCallback = new EntryIdCallback(true)
{
@Override
public boolean handleAuditEntry(Long entryId, String user, long time, Map<String, Serializable> values)
{
result.getObjects().addAll(createChangeEvents(time, values));
return super.handleAuditEntry(entryId, user, time, values);
}
};
Long from = null;
if ((changeLogToken != null) && (changeLogToken.getValue() != null))
{
try
{
from = Long.parseLong(changeLogToken.getValue());
}
catch (NumberFormatException e)
{
throw new CmisInvalidArgumentException("Invalid change log token: " + changeLogToken);
}
}
AuditQueryParameters params = new AuditQueryParameters();
params.setApplicationName(CMIS_CHANGELOG_AUDIT_APPLICATION);
params.setForward(true);
params.setFromId(from);
int maxResults = (maxItems == null ? 0 : maxItems.intValue());
maxResults = (maxResults < 1 ? 0 : maxResults + 1);
auditService.auditQuery(changeLogCollectingCallback, params, maxResults);
String newChangeLogToken = null;
if (maxResults > 0)
{
if (result.getObjects().size() >= maxResults)
{
StringBuilder clt = new StringBuilder();
newChangeLogToken = (from == null ? clt.append(maxItems.intValue() + 1).toString() : clt.append(from.longValue() + maxItems.intValue()).toString());
result.getObjects().remove(result.getObjects().size() - 1).getId();
result.setHasMoreItems(true);
}
else
{
result.setHasMoreItems(false);
}
}
if (changeLogToken != null)
{
changeLogToken.setValue(newChangeLogToken);
}
return result;
}
示例6: setContentStream
import org.apache.chemistry.opencmis.commons.spi.Holder; //导入方法依赖的package包/类
/**
* See CMIS 1.0 section 2.2.4.16 setContentStream
*/
public void setContentStream(Holder<String> objectId, Boolean overwriteFlag,
ContentStream contentStream) {
if(log.isTraceEnabled()) {
log.trace("<<<<<<< Set the content stream for object " + objectId.getValue() +
" with overwrite set to " + overwriteFlag);
}
if (!CommonUtil.hasObjectId(objectId)) {
throw new CmisInvalidArgumentException("Id is not valid!");
}
String pathOfObject = objectId.getValue();
/*If it's a version (We cannot set or delete content from versions.
If this is a version, it should mean the base version is passed.
If not, then an exception)
*/
String pathToGet = objectId.getValue();
if(pathOfObject.contains(";")){
pathToGet = pathOfObject.substring(0, pathOfObject.indexOf(";"));
//get path of latest version
try {
String pathOfLatestVersion = repository.getVersions(pathToGet)[0];
if( pathOfLatestVersion.equals(pathOfObject )){
//It's okay
} else{
throw new CmisInvalidArgumentException("Cannot set or delete content in a Version");
}
} catch (RegistryException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
}
RegistryDocument gregDocument = getGregNode(pathToGet).asDocument();
String id = gregDocument.setContentStream(contentStream, Boolean.TRUE.equals(overwriteFlag)).getId();
objectId.setValue(id);
}
示例7: hasObjectId
import org.apache.chemistry.opencmis.commons.spi.Holder; //导入方法依赖的package包/类
public static boolean hasObjectId(Holder<String> objectId) {
return objectId != null && objectId.getValue() != null;
}
示例8: updateProperties
import org.apache.chemistry.opencmis.commons.spi.Holder; //导入方法依赖的package包/类
/**
* CMIS updateProperties.
*/
public ObjectData updateProperties(CallContext context,
Holder<String> objectId, Properties properties,
ObjectInfoHandler objectInfos) {
boolean userReadOnly = checkUser(context, true);
// check object id
if (objectId == null || objectId.getValue() == null) {
throw new CmisInvalidArgumentException("Id is not valid!");
}
// get the file or folder
File file = getFile(objectId.getValue());
// check the properties
String typeId = (file.isDirectory() ? BaseTypeId.CMIS_FOLDER.value()
: BaseTypeId.CMIS_DOCUMENT.value());
checkUpdateProperties(properties, typeId);
// get and check the new name
String newName = FileBridgeUtils.getStringProperty(properties,
PropertyIds.NAME);
boolean isRename = (newName != null)
&& (!file.getName().equals(newName));
if (isRename && !isValidName(newName)) {
throw new CmisNameConstraintViolationException("Name is not valid!");
}
// rename file or folder if necessary
File newFile = file;
if (isRename) {
File parent = file.getParentFile();
newFile = new File(parent, newName);
if (!file.renameTo(newFile)) {
// if something went wrong, throw an exception
throw new CmisUpdateConflictException(
"Could not rename object!");
} else {
// set new id
objectId.setValue(getId(newFile));
}
}
return compileObjectData(context, newFile, null, false, false,
userReadOnly, objectInfos);
}