Java Code Examples for org.apache.wicket.util.lang.Objects#equal()

The following examples show how to use org.apache.wicket.util.lang.Objects#equal() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultIssueChangeManager.java    From onedev with MIT License 5 votes vote down vote up
@Transactional
@Override
public void changeDescription(Issue issue, @Nullable String description) {
	String prevDescription = issue.getDescription();
	if (!Objects.equal(description, prevDescription)) {
		issue.setDescription(description);
		
		IssueChange change = new IssueChange();
		change.setIssue(issue);
		change.setDate(new Date());
		change.setUser(SecurityUtils.getUser());
		change.setData(new IssueDescriptionChangeData(prevDescription, issue.getDescription()));
		save(change);
	}
}
 
Example 2
Source File: DefaultIssueChangeManager.java    From onedev with MIT License 5 votes vote down vote up
@Transactional
@Override
public void changeMilestone(Issue issue, @Nullable Milestone milestone) {
	Milestone prevMilestone = issue.getMilestone();
	if (!Objects.equal(prevMilestone, milestone)) {
		issue.setMilestone(milestone);
		
		IssueChange change = new IssueChange();
		change.setIssue(issue);
		change.setDate(new Date());
		change.setUser(SecurityUtils.getUser());
		change.setData(new IssueMilestoneChangeData(prevMilestone, issue.getMilestone()));
		save(change);
	}
}
 
Example 3
Source File: FeatureStateModel.java    From webanno with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(Object obj)
{
    if (this == obj) {
        return true;
    }
    if (!(obj instanceof FeatureStateModel)) {
        return false;
    }
    FeatureStateModel that = (FeatureStateModel) obj;
    return Objects.equal(feature, that.feature);
}
 
Example 4
Source File: OSchemaHelper.java    From wicket-orientdb with Apache License 2.0 5 votes vote down vote up
/**
 * Set linked class to a current property
 * @param className class name to set as a linked class
 * @return this helper
 */
public OSchemaHelper linkedClass(String className)
{
	checkOProperty();
	OClass linkedToClass =  schema.getClass(className);
	if(linkedToClass==null) throw new IllegalArgumentException("Target OClass '"+className+"' to link to not found");
	if(!Objects.equal(linkedToClass, lastProperty.getLinkedClass()))
	{
		lastProperty.setLinkedClass(linkedToClass);
	}
	return this;
}
 
Example 5
Source File: TransactionRequestCycleListener.java    From wicket-orientdb with Apache License 2.0 5 votes vote down vote up
@Override
public void start(RequestCycle cycle) {
	OrientDbWebSession session = OrientDbWebSession.get();
	ODatabaseDocumentInternal db = session.getDatabase();
	//It's required to have ability to check security rights locally
	OSecurityUser oUser = session.getUser();
	OSecurityUser dbUser = db.getUser();
	if(oUser!=null && oUser.getDocument()!=null 
			&& oUser.getDocument().getIdentity()!=null 
			&& (!oUser.getDocument().getIdentity().isValid() || dbUser==null || !Objects.equal(dbUser.getName(), oUser.getName())))
	{
		db.setUser(db.getMetadata().getSecurity().getUser(oUser.getName()));
	}
	db.begin();
}
 
Example 6
Source File: UpdateOnDashboardDisplayModeChangeBehavior.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
@Override
protected boolean match(Component component, ActionPerformedEvent<?> event,
		IEvent<?> wicketEvent) {
	if(component instanceof AbstractWidget && event.getCommand().isChangingDisplayMode()) {
		AbstractWidget<?> widget = (AbstractWidget<?>)component;
		return Objects.equal(widget.getDashboardPanel().getDashboardDocument(), event.getObject());
	} else return false;
}
 
Example 7
Source File: PlantUmlService.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
public void describe(Writer writer, OProperty oProperty)
{
	PrintWriter out = toPrintWriter(writer);
	OType type = oProperty.getType();
	String min = oProperty.getMin();
	String max = oProperty.getMax();
	String range = null;
	
	if(min!=null || max!=null)
	{
		range = Objects.equal(min, max)?min:(min!=null?min:"0")+".."+(max!=null?max:"*");
	}
	else if(type.isMultiValue())
	{
		range = "*";
	}
	
	boolean isEmbedded = type.equals(OType.EMBEDDED) || type.equals(OType.EMBEDDEDLIST) 
			|| type.equals(OType.EMBEDDEDMAP) || type.equals(OType.EMBEDDEDSET);
	
	if(oProperty.getLinkedClass()!=null
			&& (isEmbedded || type.isLink()))
	{
		out.append(oProperty.getOwnerClass().getName());
		if(isEmbedded) out.append("\"1\" *-- ");
		else out.append(" -> ");
		if(range!=null) out.append('"').append(range).append("\" ");
		out.append(oProperty.getLinkedClass().getName());
		out.append(" : ").append(oProperty.getName());
	}
	else
	{
		out.append(oProperty.getOwnerClass().getName())
			.append(" : ")
			.append(oProperty.getName()).append(" : ").append(type.name());
	}
	out.println();
}
 
Example 8
Source File: EqualsDecorator.java    From projectforge-webapp with GNU General Public License v3.0 5 votes vote down vote up
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
{
  String methodName = method.getName();
  if (methodName.equals("equals")) {
    if (args[0] instanceof IModel< ? >) {
      return Objects.equal(model.getObject(), ((IModel< ? >) args[0]).getObject());
    }
  } else if (methodName.equals("hashCode")) {
    Object val = model.getObject();
    return Objects.hashCode(val);
  } else if (methodName.equals("writeReplace")) {
    return new SerializableReplacement(model);
  }
  return method.invoke(model, args);
}
 
Example 9
Source File: EventManager.java    From projectforge-webapp with GNU General Public License v3.0 5 votes vote down vote up
public EventSource getEventSource(String id) throws EventSourceNotFoundException {

		for (EventSource source : calendar.getConfig().getEventSources()) {
			if (Objects.equal(id, source.getUuid())) {
				return source;
			}
		}
		throw new EventSourceNotFoundException("Event source with uuid: " + id + " not found");
	}
 
Example 10
Source File: UpdateOnActionPerformedEventBehavior.java    From Orienteer with Apache License 2.0 4 votes vote down vote up
protected boolean match(Component component, ActionPerformedEvent<?> event, IEvent<?> wicketEvent) {
	return Objects.equal(component.getDefaultModelObject(), event.getObject());
}