本文整理汇总了Java中org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter类的典型用法代码示例。如果您正苦于以下问题:Java DefaultTypeConverter类的具体用法?Java DefaultTypeConverter怎么用?Java DefaultTypeConverter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DefaultTypeConverter类属于org.alfresco.service.cmr.repository.datatype包,在下文中一共展示了DefaultTypeConverter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: evaluateSingleValue
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter; //导入依赖的package包/类
@Override
protected void evaluateSingleValue(Object value)
{
// ensure that the value can be converted to a String
String checkValue = null;
try
{
checkValue = DefaultTypeConverter.INSTANCE.convert(String.class, value);
}
catch (TypeConversionException e)
{
throw new ConstraintException(ERR_NON_STRING, value);
}
AuthorityType type = AuthorityType.getAuthorityType(checkValue);
if((type != AuthorityType.GROUP) && (type != AuthorityType.ROLE))
{
throw new ConstraintException(ERR_INVALID_AUTHORITY_NAME, value, type);
}
}
示例2: evaluateSingleValue
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter; //导入依赖的package包/类
@Override
protected void evaluateSingleValue(Object value)
{
// ensure that the value can be converted to a String
String checkValue = null;
try
{
checkValue = DefaultTypeConverter.INSTANCE.convert(String.class, value);
}
catch (TypeConversionException e)
{
throw new ConstraintException(ERR_NON_STRING, value);
}
AuthorityType type = AuthorityType.getAuthorityType(checkValue);
if((type != AuthorityType.USER) && (type != AuthorityType.GUEST))
{
throw new ConstraintException(ERR_INVALID_USERNAME, value, type);
}
}
示例3: addComponent
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter; //导入依赖的package包/类
public Q addComponent(Set<String> selectors, Map<String, Argument> functionArgs, LuceneQueryBuilderContext<Q, S, E> luceneContext, FunctionEvaluationContext functionContext)
throws E
{
LuceneQueryParserAdaptor<Q, S, E> lqpa = luceneContext.getLuceneQueryParserAdaptor();
PropertyArgument propertyArgument = (PropertyArgument) functionArgs.get(ARG_PROPERTY);
Argument inverseArgument = functionArgs.get(ARG_NOT);
Boolean not = DefaultTypeConverter.INSTANCE.convert(Boolean.class, inverseArgument.getValue(functionContext));
Q query = functionContext.buildLuceneExists(lqpa, propertyArgument.getPropertyName(), not);
if (query == null)
{
throw new QueryModelException("No query time mapping for property " + propertyArgument.getPropertyName() + ", it should not be allowed in predicates");
}
return query;
}
示例4: testPaging
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter; //导入依赖的package包/类
@Category(RedundantTests.class)
public void testPaging()
{
CMISQueryOptions options = new CMISQueryOptions("SELECT * FROM cmis:folder", rootNodeRef.getStoreRef());
List<String> expected = new ArrayList<String>(10);
CMISResultSet rs = cmisQueryService.query(options);
assertEquals(folder_count, rs.getLength());
for (CMISResultSetRow row : rs)
{
Serializable sValue = row.getValue("cmis:objectId");
String id = DefaultTypeConverter.INSTANCE.convert(String.class, sValue);
expected.add(id);
}
rs.close();
for (int skip = 0; skip < 20; skip++)
{
for (int max = 0; max < 20; max++)
{
doPage(expected, skip, max);
}
}
}
示例5: getAccountExpiryDate
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter; //导入依赖的package包/类
@Override
public Date getAccountExpiryDate(String userName)
{
NodeRef userNode = getUserOrNull(userName);
if (userNode == null)
{
return null;
}
if (DefaultTypeConverter.INSTANCE.booleanValue(nodeService.getProperty(userNode, ContentModel.PROP_ACCOUNT_EXPIRES)))
{
return DefaultTypeConverter.INSTANCE.convert(Date.class, nodeService.getProperty(userNode, ContentModel.PROP_ACCOUNT_EXPIRY_DATE));
}
else
{
return null;
}
}
示例6: getCredentialsExpire
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter; //导入依赖的package包/类
/**
* @param userName the username
* @param properties user properties or <tt>null</tt> to fetch them
*/
protected boolean getCredentialsExpire(String userName, Map<QName, Serializable> properties)
{
if (authorityService.isAdminAuthority(userName))
{
return false; // Admin never expires
}
if (properties == null)
{
properties = getUserProperties(userName);
}
if (properties == null)
{
return false;
}
Serializable ser = properties.get(ContentModel.PROP_CREDENTIALS_EXPIRE);
if (ser == null)
{
return false;
}
else
{
return DefaultTypeConverter.INSTANCE.booleanValue(ser);
}
}
示例7: getCredentialsExpiryDate
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter; //导入依赖的package包/类
/**
* @param userName the username (never <tt>null</tt>
* @param properties the properties associated with the user or <tt>null</tt> to get them
* @param isAdminAuthority is admin authority
* @return Date on which the credentials expire or <tt>null</tt> if they never expire
*/
private Date getCredentialsExpiryDate(String userName, Map<QName, Serializable> properties, Boolean isAdminAuthority)
{
if (isAdminAuthority == null)
{
isAdminAuthority = authorityService.isAdminAuthority(userName);
}
if (isAdminAuthority)
{
return null; // Admin never expires
}
if (properties == null)
{
properties = getUserProperties(userName);
}
if (DefaultTypeConverter.INSTANCE.booleanValue(properties.get(ContentModel.PROP_CREDENTIALS_EXPIRE)))
{
return DefaultTypeConverter.INSTANCE.convert(Date.class, properties.get(ContentModel.PROP_CREDENTIALS_EXPIRY_DATE));
}
return null;
}
示例8: onUpdateProperties
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter; //导入依赖的package包/类
@Override
public void onUpdateProperties(NodeRef nodeRef, Map<QName, Serializable> before, Map<QName, Serializable> after)
{
String uidBefore = DefaultTypeConverter.INSTANCE.convert(String.class, before.get(ContentModel.PROP_USERNAME));
String uidAfter = DefaultTypeConverter.INSTANCE.convert(String.class, after.get(ContentModel.PROP_USERNAME));
if (uidBefore != null && !EqualsHelper.nullSafeEquals(uidBefore, uidAfter))
{
NodeRef userNode = getUserOrNull(uidBefore);
if (userNode != null)
{
nodeService.setProperty(userNode, ContentModel.PROP_USER_USERNAME, uidAfter);
nodeService.moveNode(userNode, nodeService.getPrimaryParent(userNode).getParentRef(),
ContentModel.ASSOC_CHILDREN, QName.createQName(ContentModel.USER_MODEL_URI, uidAfter));
removeAuthenticationFromCache(uidBefore);
}
}
removeAuthenticationFromCache(uidAfter);
}
示例9: removeAuthorityFromZones
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter; //导入依赖的package包/类
public void removeAuthorityFromZones(String authorityName, Set<String> zones)
{
if ((zones != null) && (zones.size() > 0))
{
NodeRef authRef = getAuthorityOrNull(authorityName);
List<ChildAssociationRef> results = nodeService.getParentAssocs(authRef, ContentModel.ASSOC_IN_ZONE, RegexQNamePattern.MATCH_ALL);
for (ChildAssociationRef current : results)
{
NodeRef zoneRef = current.getParentRef();
Serializable value = nodeService.getProperty(zoneRef, ContentModel.PROP_NAME);
if (value == null)
{
continue;
}
else
{
String testZone = DefaultTypeConverter.INSTANCE.convert(String.class, value);
if (zones.contains(testZone))
{
nodeService.removeChildAssociation(current);
}
}
}
}
}
示例10: doPage
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter; //导入依赖的package包/类
private void doPage(List<String> expected, int skip, int max)
{
CMISQueryOptions options = new CMISQueryOptions("SELECT * FROM cmis:folder", rootNodeRef.getStoreRef());
options.setSkipCount(skip);
options.setMaxItems(max);
CMISResultSet rs = cmisQueryService.query(options);
assertEquals("Skip = " + skip + " max = " + max, skip + max > folder_count ? Math.max(folder_count - skip, 0) : max, rs.getLength());
assertEquals("Skip = " + skip + " max = " + max, (skip + max) < folder_count, rs.hasMore());
assertEquals("Skip = " + skip + " max = " + max, skip, rs.getStart());
int actualPosition = skip;
for (CMISResultSetRow row : rs)
{
Serializable sValue = row.getValue("cmis:objectId");
String id = DefaultTypeConverter.INSTANCE.convert(String.class, sValue);
assertEquals("Skip = " + skip + " max = " + max + " actual = " + actualPosition, expected.get(actualPosition), id);
actualPosition++;
}
}
示例11: createSiteInfo
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter; //导入依赖的package包/类
/**
* Creates a site information object given a site node reference
*
* @param siteNodeRef
* site node reference
* @return SiteInfo site information object
*/
private SiteInfo createSiteInfo(NodeRef siteNodeRef)
{
SiteInfo siteInfo = null;
// Get the properties
Map<QName, Serializable> properties = this.directNodeService.getProperties(siteNodeRef);
String shortName = (String) properties.get(ContentModel.PROP_NAME);
String sitePreset = (String) properties.get(PROP_SITE_PRESET);
String title = DefaultTypeConverter.INSTANCE.convert(String.class, properties.get(ContentModel.PROP_TITLE));
String description = DefaultTypeConverter.INSTANCE.convert(String.class, properties.get(ContentModel.PROP_DESCRIPTION));
// Get the visibility of the site
SiteVisibility visibility = getSiteVisibility(siteNodeRef);
// Create and return the site information
Map<QName, Serializable> customProperties = getSiteCustomProperties(properties);
siteInfo = new SiteInfoImpl(sitePreset, shortName, title, description, visibility, customProperties, siteNodeRef);
siteInfo.setCreatedDate(DefaultTypeConverter.INSTANCE.convert(Date.class, properties.get(ContentModel.PROP_CREATED)));
siteInfo.setLastModifiedDate(DefaultTypeConverter.INSTANCE.convert(Date.class, properties.get(ContentModel.PROP_MODIFIED)));
return siteInfo;
}
示例12: getValueAsString
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter; //导入依赖的package包/类
private <Q, S, E extends Throwable> String getValueAsString(LuceneQueryParserAdaptor<Q, S, E> lqpa, Serializable value)
{
String nodeRefStr = null;
if(!NodeRef.isNodeRef((String)value))
{
// assume the object id is the node guid
StoreRef storeRef = getStore(lqpa);
nodeRefStr = storeRef.toString() + "/" + (String)value;
}
else
{
nodeRefStr = (String)value;
}
Object converted = DefaultTypeConverter.INSTANCE.convert(dictionaryService.getDataType(DataTypeDefinition.NODE_REF), nodeRefStr);
String asString = DefaultTypeConverter.INSTANCE.convert(String.class, converted);
return asString;
}
示例13: testFileSpecificMetadata
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter; //导入依赖的package包/类
/**
* We also provide the creation date - check that
*/
protected void testFileSpecificMetadata(String mimetype,
Map<QName, Serializable> properties)
{
// Check for extra fields
assertEquals(
"Property " + ContentModel.PROP_AUTHOR + " not found for mimetype " + mimetype,
"Nevin Nollop",
DefaultTypeConverter.INSTANCE.convert(String.class, properties.get(ContentModel.PROP_AUTHOR)));
// Ensure that we can also get things which are standard
// Tika metadata properties, if we so choose to
assertTrue(
"Test Property " + TIKA_LAST_AUTHOR_TEST_PROPERTY + " not found for mimetype " + mimetype,
properties.containsKey(TIKA_LAST_AUTHOR_TEST_PROPERTY)
);
assertEquals(
"Test Property " + TIKA_LAST_AUTHOR_TEST_PROPERTY + " incorrect for mimetype " + mimetype,
"paolon",
DefaultTypeConverter.INSTANCE.convert(String.class, properties.get(TIKA_LAST_AUTHOR_TEST_PROPERTY)));
}
示例14: getOwner
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter; //导入依赖的package包/类
public String getOwner(NodeRef nodeRef)
{
String userName = nodeOwnerCache.get(nodeRef);
if (userName == null)
{
// If ownership is not explicitly set then we fall back to the creator
if (isRendition(nodeRef))
{
userName = getOwner(nodeService.getPrimaryParent(nodeRef).getParentRef());
}
else if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_OWNABLE))
{
userName = DefaultTypeConverter.INSTANCE.convert(String.class, nodeService.getProperty(nodeRef, ContentModel.PROP_OWNER));
}
else if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_AUDITABLE))
{
userName = DefaultTypeConverter.INSTANCE.convert(String.class, nodeService.getProperty(nodeRef, ContentModel.PROP_CREATOR));
}
cacheOwner(nodeRef, userName);
}
return userName;
}
示例15: inviteNominated
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter; //导入依赖的package包/类
/**
* Start the invitation process for a NominatedInvitation
*
* @param inviteeUserName Alfresco user name of the invitee
* @param resourceType resourceType
* @param resourceName String
* @param inviteeRole String
* @param acceptUrl String
* @param rejectUrl String
* @return the nominated invitation which will contain the invitationId and
* ticket which will uniqely identify this invitation for the rest
* of the workflow.
* @throws InvitationException
* @throws InvitationExceptionUserError
* @throws InvitationExceptionForbidden
*/
public NominatedInvitation inviteNominated(String inviteeUserName, Invitation.ResourceType resourceType,
String resourceName, String inviteeRole, String acceptUrl, String rejectUrl)
{
// inviteeUserName was specified
NodeRef person = this.personService.getPerson(inviteeUserName);
Serializable firstNameVal = this.getNodeService().getProperty(person, ContentModel.PROP_FIRSTNAME);
Serializable lastNameVal = this.getNodeService().getProperty(person, ContentModel.PROP_LASTNAME);
Serializable emailVal = this.getNodeService().getProperty(person, ContentModel.PROP_EMAIL);
String firstName = DefaultTypeConverter.INSTANCE.convert(String.class, firstNameVal);
String lastName = DefaultTypeConverter.INSTANCE.convert(String.class, lastNameVal);
String email = DefaultTypeConverter.INSTANCE.convert(String.class, emailVal);
String serverPath = UrlUtil.getShareUrl(sysAdminParams);
return inviteNominated(firstName, lastName, email, inviteeUserName, resourceType, resourceName, inviteeRole,
serverPath, acceptUrl, rejectUrl);
}